diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index d1c42f14..d66ded36 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -646,6 +646,7 @@ export type ComboBoxItemId = any; export interface ComboBoxItem { id: ComboBoxItemId; text: string; + disabled?: boolean; } ``` @@ -1140,6 +1141,7 @@ export type DropdownItemText = string; export interface DropdownItem { id: DropdownItemId; text: DropdownItemText; + disabled?: boolean; } ``` @@ -2085,6 +2087,7 @@ None. | :---------- | :------- | :--------------- | :------- | -------------------- | ------------------ | --------------------------------------------- | | active | No | let | No | boolean | false | Set to `true` to enable the active state | | highlighted | No | let | No | boolean | false | Set to `true` to enable the highlighted state | +| disabled | No | let | No | boolean | false | Set to `true` to disable the menu item | ### Slots @@ -2327,6 +2330,7 @@ export type MultiSelectItemText = string; export interface MultiSelectItem { id: MultiSelectItemId; text: MultiSelectItemText; + disabled?: boolean; } ``` diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index f6851af1..51bddad8 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -1769,9 +1769,9 @@ "ts": "type ComboBoxItemId = any" }, { - "type": "{ id: ComboBoxItemId; text: string; }", + "type": "{ id: ComboBoxItemId; text: string; disabled?: boolean; }", "name": "ComboBoxItem", - "ts": "interface ComboBoxItem { id: ComboBoxItemId; text: string; }" + "ts": "interface ComboBoxItem { id: ComboBoxItemId; text: string; disabled?: boolean; }" } ], "rest_props": { "type": "Element", "name": "input" } @@ -3493,9 +3493,9 @@ "ts": "type DropdownItemText = string" }, { - "type": "{ id: DropdownItemId; text: DropdownItemText; }", + "type": "{ id: DropdownItemId; text: DropdownItemText; disabled?: boolean; }", "name": "DropdownItem", - "ts": "interface DropdownItem { id: DropdownItemId; text: DropdownItemText; }" + "ts": "interface DropdownItem { id: DropdownItemId; text: DropdownItemText; disabled?: boolean; }" } ], "rest_props": { "type": "Element", "name": "div" } @@ -6063,6 +6063,18 @@ "isRequired": false, "constant": false, "reactive": false + }, + { + "name": "disabled", + "kind": "let", + "description": "Set to `true` to disable the menu item", + "type": "boolean", + "value": "false", + "isFunction": false, + "isFunctionDeclaration": false, + "isRequired": false, + "constant": false, + "reactive": false } ], "moduleExports": [], @@ -7296,9 +7308,9 @@ "ts": "type MultiSelectItemText = string" }, { - "type": "{ id: MultiSelectItemId; text: MultiSelectItemText; }", + "type": "{ id: MultiSelectItemId; text: MultiSelectItemText; disabled?: boolean; }", "name": "MultiSelectItem", - "ts": "interface MultiSelectItem { id: MultiSelectItemId; text: MultiSelectItemText; }" + "ts": "interface MultiSelectItem { id: MultiSelectItemId; text: MultiSelectItemText; disabled?: boolean; }" } ], "rest_props": { "type": "Element", "name": "input" } diff --git a/docs/src/pages/components/ComboBox.svx b/docs/src/pages/components/ComboBox.svx index 4b4e20f1..46ee62ed 100644 --- a/docs/src/pages/components/ComboBox.svx +++ b/docs/src/pages/components/ComboBox.svx @@ -112,11 +112,25 @@ items={[ {id: "2", text: "Fax"} ]} /> -### Disabled +### Disabled state \ No newline at end of file + ]} /> + +### Disabled items + +Use the `disabled` property in the `items` prop to disable specific items. + + \ No newline at end of file diff --git a/docs/src/pages/components/Dropdown.svx b/docs/src/pages/components/Dropdown.svx index a45c00a2..9ac60d2a 100644 --- a/docs/src/pages/components/Dropdown.svx +++ b/docs/src/pages/components/Dropdown.svx @@ -95,6 +95,20 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input. {id: "1", text: "Email"}, {id: "2", text: "Fax"}]}" /> +### Disabled items + +Use the `disabled` property in the `items` prop to disable specific items. + + + ### Skeleton \ No newline at end of file diff --git a/docs/src/pages/components/MultiSelect.svx b/docs/src/pages/components/MultiSelect.svx index 6f8d5a86..82c5fc2d 100644 --- a/docs/src/pages/components/MultiSelect.svx +++ b/docs/src/pages/components/MultiSelect.svx @@ -145,4 +145,18 @@ Set `direction` to `"top"` for the dropdown menu to appear above the input. items="{[{id: "0", text: "Slack"}, {id: "1", text: "Email"}, {id: "2", text: "Fax"}]}" - /> \ No newline at end of file + /> + +### Disabled items + +Use the `disabled` property in the `items` prop to disable specific items. + + \ No newline at end of file diff --git a/src/ComboBox/ComboBox.svelte b/src/ComboBox/ComboBox.svelte index 97b8ead0..9b293ac9 100644 --- a/src/ComboBox/ComboBox.svelte +++ b/src/ComboBox/ComboBox.svelte @@ -1,7 +1,7 @@