Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/demo/src/content/components/filter-dropdown.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ Basic usage:

## Props

| Name | Description | Type | Default | Required |
| ----------------- | ------------------------------------------------------------ | ------------------------------------- | ------- | -------- |
| `label` | The text displayed on the trigger button. | `string` | - | ✅ |
| `options` | The list of filter options to display in the dropdown. | `{ value: string; label: string; }[]` | - | ✅ |
| `selectedFilters` | Array of currently selected filter values. | `string[]` | - | ✅ |
| `onToggleFilter` | Callback fired when a filter option is checked or unchecked. | `(value: string) => void` | - | ✅ |
| `onClearAll` | Callback fired when the "Clear all" button is clicked. | `() => void` | - | ✅ |
| Name | Description | Type | Default | Required |
| ----------------- | --------------------------------------------------------------------------------- | ------------------------------------- | ------- | -------- |
| `label` | The text displayed on the trigger button. | `string` | - | ✅ |
| `options` | The list of filter options to display in the dropdown. | `{ value: string; label: string; }[]` | - | ✅ |
| `selectedFilters` | Array of currently selected filter values. | `string[]` | - | ✅ |
| `onToggleFilter` | Callback fired when a filter option is checked or unchecked. | `(value: string) => void` | - | ✅ |
| `onClearAll` | Callback fired when the "Clear all" button is clicked. | `() => void` | - | ✅ |
| `disabled` | When `true`, the trigger button is unclickable and the dropdown cannot be opened. | `boolean` | `false` | ❌ |
2 changes: 1 addition & 1 deletion packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@eqtylab/equality",
"description": "EQTYLab's component and token-based design system",
"homepage": "https://equality.eqtylab.io/",
"version": "2.1.3",
"version": "2.1.4",
"license": "Apache-2.0",
"keywords": [
"component library",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ interface FilterDropdownProps {
onClearAll: () => void;
buttonClassName?: string;
contentClassName?: string;
disabled?: boolean;
}

const FilterDropdown = ({
Expand All @@ -39,6 +40,7 @@ const FilterDropdown = ({
onClearAll,
buttonClassName,
contentClassName,
disabled = false,
}: FilterDropdownProps) => {
const hasSelectedFilters = selectedFilters.length > 0;
const filteredOptions = options.filter(
Expand All @@ -49,7 +51,11 @@ const FilterDropdown = ({
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
<Button variant="tertiary" className={cn(styles['selector-button'], buttonClassName)}>
<Button
variant="tertiary"
disabled={disabled}
className={cn(styles['selector-button'], buttonClassName)}
>
<span className={styles['selector-button-content']}>
{label}
{hasSelectedFilters && <Badge variant="primary">{selectedFilters.length}</Badge>}
Expand Down
Loading