@saleor/macaw-ui 0.4.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionBar/ActionBar.d.ts +8 -0
- package/dist/ActionBar/ActionBar.stories.d.ts +4 -0
- package/dist/ActionBar/context.d.ts +9 -0
- package/dist/ActionBar/index.d.ts +2 -0
- package/dist/ActionBar/styles.d.ts +2 -0
- package/dist/Alert/Alert.d.ts +8 -0
- package/dist/Alert/Alert.stories.d.ts +12 -0
- package/dist/Alert/AlertBase.d.ts +8 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/styles.d.ts +2 -0
- package/dist/Backlink/Backlink.d.ts +8 -0
- package/dist/Backlink/Backlink.stories.d.ts +5 -0
- package/dist/Backlink/context.d.ts +5 -0
- package/dist/Backlink/index.d.ts +2 -0
- package/dist/Backlink/styles.d.ts +2 -0
- package/dist/BaseList/BaseList.d.ts +26 -0
- package/dist/BaseList/context.d.ts +7 -0
- package/dist/BaseList/index.d.ts +1 -0
- package/dist/BaseList/styles.d.ts +5 -0
- package/dist/Button/Button.d.ts +16 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/styles.d.ts +2 -0
- package/dist/ConfirmButton/ConfirmButton.d.ts +11 -0
- package/dist/ConfirmButton/ConfirmButton.stories.d.ts +8 -0
- package/dist/ConfirmButton/index.d.ts +1 -0
- package/dist/ConfirmButton/styles.d.ts +2 -0
- package/dist/DialogHeader/DialogHeader.d.ts +6 -0
- package/dist/DialogHeader/index.d.ts +1 -0
- package/dist/DialogHeader/styles.d.ts +1 -0
- package/dist/DialogTable/DialogTable.d.ts +6 -0
- package/dist/DialogTable/index.d.ts +1 -0
- package/dist/DialogTable/styles.d.ts +1 -0
- package/dist/Filter/Filter.d.ts +10 -0
- package/dist/Filter/Filter.stories.d.ts +5 -0
- package/dist/Filter/FilterBar.d.ts +11 -0
- package/dist/Filter/FilterContent.d.ts +7 -0
- package/dist/Filter/FilterField/MultipleSelectFilterField.d.ts +6 -0
- package/dist/Filter/FilterField/RangeFilterField.d.ts +7 -0
- package/dist/Filter/FilterField/SelectFilterField.d.ts +6 -0
- package/dist/Filter/FilterField/TextFilterField.d.ts +6 -0
- package/dist/Filter/FilterMenu.d.ts +9 -0
- package/dist/Filter/context.d.ts +4 -0
- package/dist/Filter/index.d.ts +4 -0
- package/dist/Filter/styles.d.ts +2 -0
- package/dist/Filter/types.d.ts +49 -0
- package/dist/Filter/utils.d.ts +8 -0
- package/dist/IconButton/IconButton.d.ts +8 -0
- package/dist/IconButton/index.d.ts +1 -0
- package/dist/IconButton/partials.d.ts +14 -0
- package/dist/IconButton/styles.d.ts +2 -0
- package/dist/LayoutButton/LayoutButton.d.ts +7 -0
- package/dist/LayoutButton/index.d.ts +1 -0
- package/dist/LayoutButton/styles.d.ts +2 -0
- package/dist/List/List.d.ts +13 -0
- package/dist/List/List.stories.d.ts +5 -0
- package/dist/List/context.d.ts +8 -0
- package/dist/List/index.d.ts +1 -0
- package/dist/List/styles.d.ts +1 -0
- package/dist/Notification/Notification.d.ts +3 -0
- package/dist/Notification/Notification.stories.d.ts +10 -0
- package/dist/Notification/index.d.ts +2 -0
- package/dist/Notification/styles.d.ts +2 -0
- package/dist/Notification/types.d.ts +16 -0
- package/dist/OffsettedList/OffsettedList.d.ts +12 -0
- package/dist/OffsettedList/OffsettedList.stories.d.ts +5 -0
- package/dist/OffsettedList/index.d.ts +1 -0
- package/dist/OffsettedList/styles.d.ts +2 -0
- package/dist/PageTabs/PageTab.d.ts +3 -0
- package/dist/PageTabs/PageTab.stories.d.ts +4 -0
- package/dist/PageTabs/PageTabPanel.d.ts +4 -0
- package/dist/PageTabs/PageTabs.d.ts +5 -0
- package/dist/PageTabs/index.d.ts +3 -0
- package/dist/PageTabs/styles.d.ts +2 -0
- package/dist/Pagination/Pagination.d.ts +10 -0
- package/dist/Pagination/PaginationActions.d.ts +11 -0
- package/dist/Pagination/PaginationRowNumberSelect.d.ts +11 -0
- package/dist/Pagination/TablePagination.d.ts +6 -0
- package/dist/Pagination/index.d.ts +4 -0
- package/dist/Pagination/styles.d.ts +2 -0
- package/dist/PillLink/PillLink.d.ts +15 -0
- package/dist/PillLink/index.d.ts +1 -0
- package/dist/PillLink/styles.d.ts +2 -0
- package/dist/ResponsiveTable/ResponsiveTable.d.ts +8 -0
- package/dist/ResponsiveTable/index.d.ts +1 -0
- package/dist/ResponsiveTable/styles.d.ts +2 -0
- package/dist/Savebar/ButtonTooltipDecorator.d.ts +6 -0
- package/dist/Savebar/Savebar.d.ts +14 -0
- package/dist/Savebar/Savebar.stories.d.ts +6 -0
- package/dist/Savebar/index.d.ts +1 -0
- package/dist/Savebar/styles.d.ts +2 -0
- package/dist/ScrollShadow/ScrollShadow.d.ts +6 -0
- package/dist/ScrollShadow/index.d.ts +1 -0
- package/dist/ScrollShadow/styles.d.ts +1 -0
- package/dist/Sidebar/ExpandButton.d.ts +6 -0
- package/dist/Sidebar/MenuItem.d.ts +11 -0
- package/dist/Sidebar/Sidebar.d.ts +6 -0
- package/dist/Sidebar/Sidebar.stories.d.ts +6 -0
- package/dist/Sidebar/fixtures.d.ts +2 -0
- package/dist/Sidebar/index.d.ts +4 -0
- package/dist/Sidebar/types.d.ts +16 -0
- package/dist/SidebarDrawer/MenuItemBtn.d.ts +7 -0
- package/dist/SidebarDrawer/SidebarDrawer.d.ts +4 -0
- package/dist/SidebarDrawer/SidebarDrawer.stories.d.ts +4 -0
- package/dist/SidebarDrawer/index.d.ts +2 -0
- package/dist/SidebarDrawer/styles.d.ts +2 -0
- package/dist/SquareButton/SquareButton.d.ts +3 -0
- package/dist/SquareButton/SquareButton.stories.d.ts +5 -0
- package/dist/SquareButton/index.d.ts +1 -0
- package/dist/StatusChip/StatusChip.d.ts +3 -0
- package/dist/StatusChip/StatusChip.stories.d.ts +8 -0
- package/dist/StatusChip/index.d.ts +2 -0
- package/dist/StatusChip/styles.d.ts +3 -0
- package/dist/StatusChip/types.d.ts +8 -0
- package/dist/Tooltip/Tooltip.d.ts +6 -0
- package/dist/Tooltip/Tooltip.stories.d.ts +7 -0
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/styles.d.ts +3 -0
- package/dist/UserChipMenu/UserChipMenu.d.ts +9 -0
- package/dist/UserChipMenu/UserChipMenu.stories.d.ts +6 -0
- package/dist/UserChipMenu/UserChipMenuItem.d.ts +6 -0
- package/dist/UserChipMenu/context.d.ts +4 -0
- package/dist/UserChipMenu/index.d.ts +2 -0
- package/dist/UserChipMenu/styles.d.ts +2 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +3 -3
- package/dist/extensions/index.d.ts +3 -0
- package/dist/extensions/sendMessage.d.ts +3 -0
- package/dist/extensions/types.d.ts +22 -0
- package/dist/extensions/useExtensionMessage.d.ts +2 -0
- package/dist/icons/ArrowDropdownIcon.d.ts +2 -0
- package/dist/icons/ArrowRightIcon.d.ts +1 -0
- package/dist/icons/CheckboxCheckedIcon.d.ts +1 -0
- package/dist/icons/CheckboxIcon.d.ts +1 -0
- package/dist/icons/CheckboxIndeterminateIcon.d.ts +1 -0
- package/dist/icons/CloseIcon.d.ts +1 -0
- package/dist/icons/CompleteIcon.d.ts +2 -0
- package/dist/icons/DeleteIcon.d.ts +1 -0
- package/dist/icons/EditIcon.d.ts +1 -0
- package/dist/icons/FilteringIcon.d.ts +1 -0
- package/dist/icons/ImageIcon.d.ts +1 -0
- package/dist/icons/InfoIcon.d.ts +2 -0
- package/dist/icons/Logo.d.ts +2 -0
- package/dist/icons/LogoLight.d.ts +2 -0
- package/dist/icons/MoreIcon.d.ts +1 -0
- package/dist/icons/NavigatorIcon.d.ts +1 -0
- package/dist/icons/NotAllowedIcon.d.ts +2 -0
- package/dist/icons/NotAllowedInvertedIcon.d.ts +2 -0
- package/dist/icons/PlusIcon.d.ts +1 -0
- package/dist/icons/RadioCheckedIcon.d.ts +1 -0
- package/dist/icons/RadioIcon.d.ts +1 -0
- package/dist/icons/SearchIcon.d.ts +1 -0
- package/dist/icons/WarningIcon.d.ts +2 -0
- package/dist/icons/index.d.ts +18 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +7 -0
- package/dist/localStorageKeys.d.ts +4 -0
- package/dist/mjs/index.js +5 -0
- package/dist/mjs/index.js.map +7 -0
- package/dist/theme/Baseline.d.ts +2 -0
- package/dist/theme/ThemeProvider.d.ts +17 -0
- package/dist/theme/context.d.ts +3 -0
- package/dist/theme/createSaleorTheme/createSaleorTheme.d.ts +3 -0
- package/dist/theme/createSaleorTheme/index.d.ts +2 -0
- package/dist/theme/createSaleorTheme/overrides/buttons.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/controls.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/index.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/inputs.d.ts +3 -0
- package/dist/theme/createSaleorTheme/overrides/tables.d.ts +3 -0
- package/dist/theme/createSaleorTheme/palette.d.ts +2 -0
- package/dist/theme/createSaleorTheme/shadows.d.ts +2 -0
- package/dist/theme/createSaleorTheme/types.d.ts +51 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/styles.d.ts +5 -0
- package/dist/theme/themes.d.ts +3 -0
- package/dist/theme/types.d.ts +6 -0
- package/dist/theme/utils.d.ts +1 -0
- package/dist/theme/utils.test.d.ts +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/useElementScroll.d.ts +12 -0
- package/dist/tools/useLocalStorage.d.ts +5 -0
- package/dist/tools/useWindowScroll.d.ts +4 -0
- package/dist/types/Autocomplete/Autocomplete.d.ts +23 -0
- package/dist/types/Autocomplete/Autocomplete.stories.d.ts +5 -0
- package/dist/types/Autocomplete/fixtures.d.ts +4 -0
- package/dist/types/Autocomplete/index.d.ts +1 -0
- package/dist/types/Autocomplete/styles.d.ts +2 -0
- package/dist/types/Backlink/Backlink.d.ts +6 -4
- package/dist/types/Filter/FilterField/AutocompleteFilterField.d.ts +6 -0
- package/dist/types/Filter/FilterField/MultipleValueAutocompleteFilterField.d.ts +6 -0
- package/dist/types/Filter/stories/Filter.stories.d.ts +5 -0
- package/dist/types/Filter/stories/FilterInteractive.stories.d.ts +4 -0
- package/dist/types/Filter/stories/labels.d.ts +8 -0
- package/dist/types/Filter/styles.d.ts +1 -1
- package/dist/types/Filter/types.d.ts +8 -2
- package/dist/types/Filter/utils.d.ts +4 -1
- package/dist/types/IconButton/IconButton.d.ts +44 -2
- package/dist/types/LayoutButton/LayoutButton.d.ts +29 -2
- package/dist/types/MultipleValueAutocomplete/MultipleValueAutocomplete.d.ts +26 -0
- package/dist/types/MultipleValueAutocomplete/MultipleValueAutocomplete.stories.d.ts +6 -0
- package/dist/types/MultipleValueAutocomplete/fixtures.d.ts +4 -0
- package/dist/types/MultipleValueAutocomplete/index.d.ts +1 -0
- package/dist/types/MultipleValueAutocomplete/styles.d.ts +2 -0
- package/dist/types/MultipleValueAutocomplete/useMultipleValueAutocomplete.d.ts +32 -0
- package/dist/types/StatusChip/styles.d.ts +3 -0
- package/dist/types/SwitchSelector/SwitchSelector.d.ts +2 -0
- package/dist/types/SwitchSelector/SwitchSelector.stories.d.ts +4 -0
- package/dist/types/SwitchSelector/SwitchSelectorButton.d.ts +8 -0
- package/dist/types/SwitchSelector/index.d.ts +2 -0
- package/dist/types/consts.d.ts +4 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/tools/useTextWidth.d.ts +2 -0
- package/dist/types/utils/mergeRefs.d.ts +2 -0
- package/dist/types/utils/useMockAutocomplete.d.ts +10 -0
- package/dist/utils/Decorator.d.ts +4 -0
- package/dist/utils/useListStory.d.ts +21 -0
- package/package.json +10 -6
- package/src/Autocomplete/Autocomplete.stories.tsx +43 -0
- package/src/Autocomplete/Autocomplete.tsx +188 -0
- package/src/Autocomplete/fixtures.ts +122 -0
- package/src/Autocomplete/index.ts +1 -0
- package/src/Autocomplete/styles.ts +22 -0
- package/src/Backlink/Backlink.tsx +7 -7
- package/src/Backlink/styles.ts +1 -1
- package/src/Chip/styles.ts +2 -1
- package/src/Filter/Filter.tsx +88 -44
- package/src/Filter/FilterBar.tsx +15 -9
- package/src/Filter/FilterContent.tsx +8 -1
- package/src/Filter/FilterField/AutocompleteFilterField.tsx +61 -0
- package/src/Filter/FilterField/MultipleSelectFilterField.tsx +6 -2
- package/src/Filter/FilterField/MultipleValueAutocompleteFilterField.tsx +60 -0
- package/src/Filter/context.tsx +1 -1
- package/src/Filter/{Filter.stories.tsx → stories/Filter.stories.tsx} +47 -13
- package/src/Filter/stories/FilterInteractive.stories.tsx +97 -0
- package/src/Filter/stories/labels.ts +8 -0
- package/src/Filter/styles.ts +37 -6
- package/src/Filter/types.ts +8 -1
- package/src/Filter/utils.ts +71 -5
- package/src/IconButton/IconButton.tsx +29 -7
- package/src/LayoutButton/LayoutButton.tsx +39 -23
- package/src/MultipleValueAutocomplete/MultipleValueAutocomplete.stories.tsx +76 -0
- package/src/MultipleValueAutocomplete/MultipleValueAutocomplete.tsx +185 -0
- package/src/MultipleValueAutocomplete/fixtures.ts +122 -0
- package/src/MultipleValueAutocomplete/index.ts +1 -0
- package/src/MultipleValueAutocomplete/styles.ts +41 -0
- package/src/MultipleValueAutocomplete/useMultipleValueAutocomplete.ts +172 -0
- package/src/SwitchSelector/SwitchSelector.stories.tsx +63 -0
- package/src/SwitchSelector/SwitchSelector.tsx +20 -0
- package/src/SwitchSelector/SwitchSelectorButton.tsx +60 -0
- package/src/SwitchSelector/index.ts +2 -0
- package/src/consts.ts +4 -0
- package/src/index.tsx +3 -0
- package/src/theme/createSaleorTheme/createSaleorTheme.tsx +1 -1
- package/src/tools/useTextWidth.ts +20 -0
- package/src/utils/mergeRefs.ts +14 -0
- package/src/utils/useMockAutocomplete.ts +37 -0
- package/dist/types/Chip/ColorSwatch.d.ts +0 -6
- package/dist/types/Chip/common/ChipMovable.d.ts +0 -5
- package/dist/types/Chip/common/ChipRemovable.d.ts +0 -6
- package/dist/types/Chip/common/ChipSwatch.d.ts +0 -7
- package/dist/types/Chip/common/index.d.ts +0 -3
- package/src/Chip/.DS_Store +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useCombobox,
|
|
3
|
+
UseComboboxGetItemPropsOptions,
|
|
4
|
+
useMultipleSelection,
|
|
5
|
+
} from "downshift";
|
|
6
|
+
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
7
|
+
|
|
8
|
+
import { SyntheticChangeEvent } from "../../types/utils";
|
|
9
|
+
import { Choice } from "../Filter";
|
|
10
|
+
import { useTextWidth } from "../tools/useTextWidth";
|
|
11
|
+
import { mergeRefs } from "../utils/mergeRefs";
|
|
12
|
+
|
|
13
|
+
export interface UseMultipleValueAutocomplete {
|
|
14
|
+
choices: Choice[];
|
|
15
|
+
enableReinitialize?: boolean;
|
|
16
|
+
name?: string;
|
|
17
|
+
initialValue: Choice[];
|
|
18
|
+
onChange?: (event: SyntheticChangeEvent<string[]>) => void;
|
|
19
|
+
onInputChange?: (value: string) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function useMultipleValueAutocomplete({
|
|
23
|
+
choices,
|
|
24
|
+
enableReinitialize,
|
|
25
|
+
initialValue,
|
|
26
|
+
name,
|
|
27
|
+
onChange,
|
|
28
|
+
onInputChange,
|
|
29
|
+
}: UseMultipleValueAutocomplete) {
|
|
30
|
+
const anchor = useRef<HTMLDivElement>();
|
|
31
|
+
const input = useRef<HTMLInputElement>();
|
|
32
|
+
|
|
33
|
+
const [inputWidth, setInputText] = useTextWidth(
|
|
34
|
+
window
|
|
35
|
+
.getComputedStyle(input.current ?? document.body, null)
|
|
36
|
+
.getPropertyValue("font")
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
getSelectedItemProps,
|
|
41
|
+
getDropdownProps,
|
|
42
|
+
addSelectedItem,
|
|
43
|
+
removeSelectedItem,
|
|
44
|
+
selectedItems,
|
|
45
|
+
setSelectedItems,
|
|
46
|
+
} = useMultipleSelection({
|
|
47
|
+
initialSelectedItems: initialValue,
|
|
48
|
+
onSelectedItemsChange: ({ selectedItems }) => {
|
|
49
|
+
if (onChange) {
|
|
50
|
+
onChange({
|
|
51
|
+
target: {
|
|
52
|
+
name: name ?? "",
|
|
53
|
+
value: selectedItems!.map((choice) => choice.value),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
const filteredChoices = useMemo(
|
|
60
|
+
() =>
|
|
61
|
+
choices.filter(
|
|
62
|
+
(choice) =>
|
|
63
|
+
!selectedItems.find(
|
|
64
|
+
(selectedChoice) => selectedChoice.value === choice.value
|
|
65
|
+
)
|
|
66
|
+
),
|
|
67
|
+
[choices, selectedItems]
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (enableReinitialize) setSelectedItems(initialValue);
|
|
72
|
+
}, [initialValue]);
|
|
73
|
+
|
|
74
|
+
const {
|
|
75
|
+
isOpen,
|
|
76
|
+
getToggleButtonProps,
|
|
77
|
+
getLabelProps,
|
|
78
|
+
getMenuProps,
|
|
79
|
+
getInputProps,
|
|
80
|
+
getComboboxProps,
|
|
81
|
+
highlightedIndex,
|
|
82
|
+
getItemProps: baseGetItemProps,
|
|
83
|
+
openMenu,
|
|
84
|
+
inputValue,
|
|
85
|
+
setInputValue,
|
|
86
|
+
selectItem,
|
|
87
|
+
} = useCombobox({
|
|
88
|
+
circularNavigation: false,
|
|
89
|
+
defaultHighlightedIndex: 0,
|
|
90
|
+
items: filteredChoices,
|
|
91
|
+
onInputValueChange: ({ inputValue }) => {
|
|
92
|
+
setInputText(inputValue || "");
|
|
93
|
+
if (onInputChange && inputValue) {
|
|
94
|
+
onInputChange(inputValue);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
onSelectedItemChange: ({ selectedItem }) => {
|
|
98
|
+
if (selectedItem) {
|
|
99
|
+
addSelectedItem(selectedItem);
|
|
100
|
+
setInputValue("");
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
stateReducer: (_, actionAndChanges) => {
|
|
104
|
+
const { changes, type } = actionAndChanges;
|
|
105
|
+
switch (type) {
|
|
106
|
+
case useCombobox.stateChangeTypes.InputKeyDownEnter:
|
|
107
|
+
case useCombobox.stateChangeTypes.FunctionSelectItem:
|
|
108
|
+
const index = filteredChoices.findIndex(
|
|
109
|
+
(choice) => choice.value === changes.selectedItem?.value
|
|
110
|
+
);
|
|
111
|
+
return {
|
|
112
|
+
...changes,
|
|
113
|
+
highlightedIndex: index > 0 ? index - 1 : 0,
|
|
114
|
+
isOpen: true,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
return changes;
|
|
118
|
+
},
|
|
119
|
+
selectedItem: null,
|
|
120
|
+
itemToString: () => "",
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Downshift doesn't like portals like popper
|
|
124
|
+
// https://github.com/downshift-js/downshift/issues/287
|
|
125
|
+
const getItemProps = useCallback(
|
|
126
|
+
(options: UseComboboxGetItemPropsOptions<Choice>) => {
|
|
127
|
+
const baseProps = baseGetItemProps(options);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
...baseProps,
|
|
131
|
+
onClick: () => selectItem(options.item),
|
|
132
|
+
selected: highlightedIndex === options.index,
|
|
133
|
+
};
|
|
134
|
+
},
|
|
135
|
+
[baseGetItemProps, highlightedIndex]
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
const labelProps = getLabelProps();
|
|
139
|
+
const { ref: comboboxDownshiftRef, ...comboboxProps } = getComboboxProps();
|
|
140
|
+
const { ref: downshiftRef, ...inputProps } = getInputProps({
|
|
141
|
+
...getDropdownProps(),
|
|
142
|
+
onFocus: () => {
|
|
143
|
+
if (!isOpen) {
|
|
144
|
+
input.current?.select();
|
|
145
|
+
openMenu();
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
const menuProps = getMenuProps({}, { suppressRefError: true });
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
anchor,
|
|
153
|
+
comboboxProps,
|
|
154
|
+
filteredChoices,
|
|
155
|
+
getItemProps,
|
|
156
|
+
getSelectedItemProps,
|
|
157
|
+
getToggleButtonProps,
|
|
158
|
+
highlightedIndex,
|
|
159
|
+
inputProps,
|
|
160
|
+
inputRef: mergeRefs(downshiftRef, input),
|
|
161
|
+
inputValue,
|
|
162
|
+
inputWidth,
|
|
163
|
+
isOpen,
|
|
164
|
+
labelProps,
|
|
165
|
+
menuProps,
|
|
166
|
+
ref: mergeRefs(comboboxDownshiftRef, anchor),
|
|
167
|
+
removeSelectedItem,
|
|
168
|
+
selectedItems,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export default useMultipleValueAutocomplete;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Typography } from "@material-ui/core";
|
|
2
|
+
import { Meta, Story } from "@storybook/react";
|
|
3
|
+
import React, { useState } from "react";
|
|
4
|
+
|
|
5
|
+
import useGuideStyles from "../utils/guideStyles";
|
|
6
|
+
import { SwitchSelector } from "./SwitchSelector";
|
|
7
|
+
import { SwitchSelectorButton } from "./SwitchSelectorButton";
|
|
8
|
+
|
|
9
|
+
type SwitchSelectorButtonOptions = {
|
|
10
|
+
label: string | React.ReactNode;
|
|
11
|
+
value: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const INITIAL_TAB = "op2";
|
|
15
|
+
|
|
16
|
+
const OPTIONS: SwitchSelectorButtonOptions[] = [
|
|
17
|
+
{ label: "Option 1", value: "op1" },
|
|
18
|
+
{ label: "Option 2", value: "op2" },
|
|
19
|
+
{ label: "Option 3", value: "op3" },
|
|
20
|
+
{ label: "Option 4", value: "op4" },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
const DefaultStory: React.FC = () => {
|
|
24
|
+
const guideClasses = useGuideStyles();
|
|
25
|
+
const [active, setActive] = useState(INITIAL_TAB);
|
|
26
|
+
|
|
27
|
+
const currentTab = OPTIONS.find((option) => option.value === active);
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div>
|
|
31
|
+
<Typography className={guideClasses.headline} variant="h1">
|
|
32
|
+
Switch Selector
|
|
33
|
+
</Typography>
|
|
34
|
+
<Typography className={guideClasses.paragraph} component="p">
|
|
35
|
+
Switch Selector has the functionality of a radio button group. It is
|
|
36
|
+
used to change an active tab to toggle context.
|
|
37
|
+
</Typography>
|
|
38
|
+
<div>
|
|
39
|
+
<SwitchSelector>
|
|
40
|
+
{OPTIONS.map(({ label, value }) => (
|
|
41
|
+
<SwitchSelectorButton
|
|
42
|
+
value={value}
|
|
43
|
+
onClick={() => setActive(value)}
|
|
44
|
+
activeTab={active}
|
|
45
|
+
>
|
|
46
|
+
{label}
|
|
47
|
+
</SwitchSelectorButton>
|
|
48
|
+
))}
|
|
49
|
+
</SwitchSelector>
|
|
50
|
+
|
|
51
|
+
<div style={{ marginTop: "2em" }}>
|
|
52
|
+
<Typography>{`You have selected ${currentTab?.label}`}</Typography>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Default: Story = () => <DefaultStory />;
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
title: "Switch selector",
|
|
63
|
+
} as Meta;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import { makeStyles } from "..";
|
|
4
|
+
|
|
5
|
+
const useStyles = makeStyles((theme) => ({
|
|
6
|
+
switchSelector: {
|
|
7
|
+
border: `1px solid ${theme.palette.saleor.main[5]}`,
|
|
8
|
+
padding: "6px",
|
|
9
|
+
borderRadius: 4,
|
|
10
|
+
width: "fit-content",
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
export const SwitchSelector: React.FC<{}> = ({ children }) => {
|
|
15
|
+
const classes = useStyles();
|
|
16
|
+
|
|
17
|
+
return <div className={classes.switchSelector}>{children}</div>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
SwitchSelector.displayName = "SwitchSelector";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
import { Button, makeStyles } from "..";
|
|
5
|
+
|
|
6
|
+
interface SwitchSelectorButtonProps {
|
|
7
|
+
value: string;
|
|
8
|
+
activeTab?: string;
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const useSwitchSelectorButtonStyles = makeStyles((theme) => ({
|
|
13
|
+
root: {
|
|
14
|
+
color: "#77738C",
|
|
15
|
+
background: "none",
|
|
16
|
+
borderColor: "transparent",
|
|
17
|
+
cursor: "pointer",
|
|
18
|
+
|
|
19
|
+
"&:not(:first-child)": {
|
|
20
|
+
marginLeft: theme.spacing(1),
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
"&:hover": {
|
|
24
|
+
backgroundColor: theme.palette.common.white,
|
|
25
|
+
color: theme.palette.saleor.active[1],
|
|
26
|
+
border: `1px solid ${theme.palette.saleor.active[1]}`,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
"&:active": {
|
|
30
|
+
backgroundColor: theme.palette.saleor.active[5],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
buttonSelected: {
|
|
34
|
+
color: theme.palette.common.white,
|
|
35
|
+
backgroundColor: theme.palette.saleor.active[1],
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
export const SwitchSelectorButton: React.FC<SwitchSelectorButtonProps> = ({
|
|
40
|
+
onClick,
|
|
41
|
+
value,
|
|
42
|
+
children,
|
|
43
|
+
activeTab,
|
|
44
|
+
}) => {
|
|
45
|
+
const classes = useSwitchSelectorButtonStyles();
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Button
|
|
49
|
+
key={value}
|
|
50
|
+
onClick={onClick}
|
|
51
|
+
className={clsx(classes.root, {
|
|
52
|
+
[classes.buttonSelected]: value === activeTab,
|
|
53
|
+
})}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</Button>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
SwitchSelectorButton.displayName = "SwitchSelectorButton";
|
package/src/consts.ts
CHANGED
package/src/index.tsx
CHANGED
|
@@ -163,7 +163,6 @@ export const createTheme = (colors: SaleorThemeColors): SaleorTheme =>
|
|
|
163
163
|
"&$selected, &$selected:focus, &$selected:hover": {
|
|
164
164
|
backgroundColor: [colors.active[5], "!important"] as any,
|
|
165
165
|
color: colors.active[1],
|
|
166
|
-
fontWeight: 700,
|
|
167
166
|
},
|
|
168
167
|
"&:hover": {
|
|
169
168
|
backgroundColor: [colors.active[5], "!important"] as any,
|
|
@@ -171,6 +170,7 @@ export const createTheme = (colors: SaleorThemeColors): SaleorTheme =>
|
|
|
171
170
|
"@media(min-width: 600px)": {
|
|
172
171
|
minHeight: 48,
|
|
173
172
|
},
|
|
173
|
+
cursor: "pointer",
|
|
174
174
|
},
|
|
175
175
|
},
|
|
176
176
|
MuiSelect: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export function useTextWidth(
|
|
4
|
+
font: string
|
|
5
|
+
): [number, Dispatch<SetStateAction<string>>] {
|
|
6
|
+
const [text, setText] = useState("");
|
|
7
|
+
const [width, setWidth] = useState(0);
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const canvas = document.createElement("canvas");
|
|
11
|
+
const context = canvas.getContext("2d")!;
|
|
12
|
+
context.font = font;
|
|
13
|
+
const { width: newWidth } = context.measureText(text);
|
|
14
|
+
canvas.remove();
|
|
15
|
+
|
|
16
|
+
setWidth(newWidth + 8);
|
|
17
|
+
}, [text, font]);
|
|
18
|
+
|
|
19
|
+
return [width, setText];
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
|
|
3
|
+
export function mergeRefs<T>(...refs: Ref<T>[]) {
|
|
4
|
+
return (node: T) => {
|
|
5
|
+
for (const ref of refs) {
|
|
6
|
+
if (typeof ref === "function") {
|
|
7
|
+
ref(node);
|
|
8
|
+
} else {
|
|
9
|
+
// ref.current is typed as readonly
|
|
10
|
+
(ref as any).current = node;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { score } from "fuzzaldrin";
|
|
2
|
+
import { sortBy } from "lodash";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
|
|
5
|
+
const pageSize = 10;
|
|
6
|
+
|
|
7
|
+
export function useMockAutocomplete(
|
|
8
|
+
choices: Array<Record<"label" | "value", string>>
|
|
9
|
+
) {
|
|
10
|
+
const [query, setQuery] = useState("");
|
|
11
|
+
const [slice, setSlice] = useState(pageSize);
|
|
12
|
+
const results = useMemo(
|
|
13
|
+
() =>
|
|
14
|
+
sortBy(
|
|
15
|
+
choices.map((choice) => ({
|
|
16
|
+
...choice,
|
|
17
|
+
score: -score(choice.label, query),
|
|
18
|
+
})),
|
|
19
|
+
"score"
|
|
20
|
+
).slice(0, slice),
|
|
21
|
+
[query]
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
setSlice(pageSize);
|
|
26
|
+
}, [query]);
|
|
27
|
+
|
|
28
|
+
const search = (query: string) => setTimeout(() => setQuery(query), 300);
|
|
29
|
+
|
|
30
|
+
const more = () => setSlice((s) => s + pageSize);
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
search,
|
|
34
|
+
results,
|
|
35
|
+
more,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ChipProps } from "../Chip";
|
|
3
|
-
export interface ChipMovableProps extends ChipProps {
|
|
4
|
-
}
|
|
5
|
-
export declare const ChipMovable: React.ForwardRefExoticComponent<Pick<ChipMovableProps, "children" | "slot" | "style" | "title" | "dir" | "color" | "translate" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "endAdornment" | "startAdornment"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ChipProps } from "../Chip";
|
|
3
|
-
export interface ChipRemovableProps extends ChipProps {
|
|
4
|
-
onRemove?: () => void;
|
|
5
|
-
}
|
|
6
|
-
export declare const ChipRemovable: React.ForwardRefExoticComponent<Pick<ChipRemovableProps, "children" | "slot" | "style" | "title" | "dir" | "color" | "translate" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "endAdornment" | "startAdornment" | "onRemove"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { ChipProps } from "../Chip";
|
|
3
|
-
export interface ChipSwatchProps extends Omit<ChipProps, "startAdornment"> {
|
|
4
|
-
onRemove?: () => void;
|
|
5
|
-
color: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const ChipSwatch: React.ForwardRefExoticComponent<Pick<ChipSwatchProps, "children" | "slot" | "style" | "title" | "dir" | "color" | "translate" | "hidden" | "className" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "key" | "endAdornment" | "onRemove"> & React.RefAttributes<HTMLDivElement>>;
|
package/src/Chip/.DS_Store
DELETED
|
Binary file
|