Skip to content

Commit

Permalink
Merge pull request #989 from Amberroseweeks/amberroseweeks-663-checkb…
Browse files Browse the repository at this point in the history
…ox-behavior

663 checkbox behavior
  • Loading branch information
bacitracin authored Nov 5, 2024
2 parents b92fa67 + 257a9ae commit f2d09b4
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 99 deletions.
174 changes: 78 additions & 96 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/components/Filters/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Check } from '@phosphor-icons/react';
type ButtonGroupProps = {
options: string[];
selectedKeys: string[];
aria_describedby_label?: string;
toggleDimension: (dimension: string) => void;
displayOptions?: { [key: string]: string };
};
Expand All @@ -15,6 +16,7 @@ const ButtonGroup: FC<ButtonGroupProps> = ({
options,
selectedKeys,
toggleDimension,
aria_describedby_label,
displayOptions = {},
}) => {
return (
Expand All @@ -23,6 +25,7 @@ const ButtonGroup: FC<ButtonGroupProps> = ({
<Button
key={index}
disableAnimation
role="checkbox"
onPress={() => toggleDimension(option)}
size="sm"
color={selectedKeys.includes(option) ? 'success' : 'default'}
Expand All @@ -33,7 +36,8 @@ const ButtonGroup: FC<ButtonGroupProps> = ({
: '')
}
radius="full"
aria-pressed={selectedKeys.includes(option)}
aria-checked={selectedKeys.includes(option)}
aria-describedby={aria_describedby_label}
startContent={
selectedKeys.includes(option) ? (
<Check className="w-3 w-3.5 max-h-6" />
Expand Down
2 changes: 2 additions & 0 deletions src/components/Filters/DimensionFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ const DimensionFilter: FC<DimensionFilterProps> = ({
selectedKeys={selectedKeys}
toggleDimension={toggleDimension}
displayOptions={optionsDisplayMapping[property]}
aria_describedby_label={filterLabelID}
/>
);
} else if (type === 'panels') {
Expand All @@ -137,6 +138,7 @@ const DimensionFilter: FC<DimensionFilterProps> = ({
selectedKeys={selectedKeys}
toggleDimension={toggleDimension}
handleSelectionChange={handleSelectionChange}
aria_describedby_label={filterLabelID}
/>
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Filters/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type MultiSelectProps = {
display: string;
options: any[];

Check warning on line 14 in src/components/Filters/MultiSelect.tsx

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
selectedKeys: string[];
aria_describedby_label?: string;
toggleDimension: (dimension: string) => void;
handleSelectionChange: (
selection: React.ChangeEvent<HTMLSelectElement> | string
Expand All @@ -23,13 +24,14 @@ const MultiSelect: FC<MultiSelectProps> = ({
display,

Check warning on line 24 in src/components/Filters/MultiSelect.tsx

View workflow job for this annotation

GitHub Actions / lint

'display' is defined but never used
options,
selectedKeys,
aria_describedby_label,
toggleDimension,

Check warning on line 28 in src/components/Filters/MultiSelect.tsx

View workflow job for this annotation

GitHub Actions / lint

'toggleDimension' is defined but never used
handleSelectionChange,
}) => {
return (
<div className="space-x-2 min-h-[33.5px]">
<SelectFilter
aria-label={display}
aria-describedby={aria_describedby_label}
items={options}
variant="flat"
size="md"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Filters/Panels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const Panels: FC<PanelsProps> = ({
key={index}
role="checkbox"
aria-describedby={aria_describedby_label}
aria-checked={isSelected ? 'true' : 'false'}
aria-checked={isSelected}
className={isSelected ? 'panelSelected ' : 'panelDefault'}
isPressable
onPress={() => toggleDimensionForPanel(panel.dimension, panel.property)}
Expand Down

0 comments on commit f2d09b4

Please sign in to comment.