@patternfly/react-templates 6.0.0-alpha.9 → 6.0.0-prerelease.10

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +238 -0
  2. package/README.md +4 -17
  3. package/components/package.json +1 -1
  4. package/dist/dynamic/components/Dropdown/package.json +1 -0
  5. package/dist/dynamic/components/Select/package.json +1 -1
  6. package/dist/dynamic-modules.json +19 -0
  7. package/dist/esm/components/Dropdown/SimpleDropdown.d.ts +48 -0
  8. package/dist/esm/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
  9. package/dist/esm/components/Dropdown/SimpleDropdown.js +33 -0
  10. package/dist/esm/components/Dropdown/SimpleDropdown.js.map +1 -0
  11. package/dist/esm/components/Dropdown/index.d.ts +2 -0
  12. package/dist/esm/components/Dropdown/index.d.ts.map +1 -0
  13. package/dist/esm/components/Dropdown/index.js +2 -0
  14. package/dist/esm/components/Dropdown/index.js.map +1 -0
  15. package/dist/esm/components/Select/CheckboxSelect.d.ts +7 -3
  16. package/dist/esm/components/Select/CheckboxSelect.d.ts.map +1 -1
  17. package/dist/esm/components/Select/CheckboxSelect.js +14 -6
  18. package/dist/esm/components/Select/CheckboxSelect.js.map +1 -1
  19. package/dist/esm/components/Select/MultiTypeaheadSelect.d.ts +33 -0
  20. package/dist/esm/components/Select/MultiTypeaheadSelect.d.ts.map +1 -0
  21. package/dist/esm/components/Select/MultiTypeaheadSelect.js +186 -0
  22. package/dist/esm/components/Select/MultiTypeaheadSelect.js.map +1 -0
  23. package/dist/esm/components/Select/{SelectSimple.d.ts → SimpleSelect.d.ts} +12 -7
  24. package/dist/esm/components/Select/SimpleSelect.d.ts.map +1 -0
  25. package/dist/esm/components/Select/SimpleSelect.js +39 -0
  26. package/dist/esm/components/Select/SimpleSelect.js.map +1 -0
  27. package/dist/esm/components/Select/TypeaheadSelect.d.ts +43 -0
  28. package/dist/esm/components/Select/TypeaheadSelect.d.ts.map +1 -0
  29. package/dist/esm/components/Select/TypeaheadSelect.js +219 -0
  30. package/dist/esm/components/Select/TypeaheadSelect.js.map +1 -0
  31. package/dist/esm/components/Select/index.d.ts +3 -1
  32. package/dist/esm/components/Select/index.d.ts.map +1 -1
  33. package/dist/esm/components/Select/index.js +3 -1
  34. package/dist/esm/components/Select/index.js.map +1 -1
  35. package/dist/esm/components/index.d.ts +1 -0
  36. package/dist/esm/components/index.d.ts.map +1 -1
  37. package/dist/esm/components/index.js +1 -0
  38. package/dist/esm/components/index.js.map +1 -1
  39. package/dist/js/components/Dropdown/SimpleDropdown.d.ts +48 -0
  40. package/dist/js/components/Dropdown/SimpleDropdown.d.ts.map +1 -0
  41. package/dist/js/components/Dropdown/SimpleDropdown.js +36 -0
  42. package/dist/js/components/Dropdown/SimpleDropdown.js.map +1 -0
  43. package/dist/js/components/Dropdown/index.d.ts +2 -0
  44. package/dist/js/components/Dropdown/index.d.ts.map +1 -0
  45. package/dist/js/components/Dropdown/index.js +5 -0
  46. package/dist/js/components/Dropdown/index.js.map +1 -0
  47. package/dist/js/components/Select/CheckboxSelect.d.ts +7 -3
  48. package/dist/js/components/Select/CheckboxSelect.d.ts.map +1 -1
  49. package/dist/js/components/Select/CheckboxSelect.js +14 -6
  50. package/dist/js/components/Select/CheckboxSelect.js.map +1 -1
  51. package/dist/js/components/Select/MultiTypeaheadSelect.d.ts +33 -0
  52. package/dist/js/components/Select/MultiTypeaheadSelect.d.ts.map +1 -0
  53. package/dist/js/components/Select/MultiTypeaheadSelect.js +190 -0
  54. package/dist/js/components/Select/MultiTypeaheadSelect.js.map +1 -0
  55. package/dist/js/components/Select/{SelectSimple.d.ts → SimpleSelect.d.ts} +12 -7
  56. package/dist/js/components/Select/SimpleSelect.d.ts.map +1 -0
  57. package/dist/js/components/Select/SimpleSelect.js +42 -0
  58. package/dist/js/components/Select/SimpleSelect.js.map +1 -0
  59. package/dist/js/components/Select/TypeaheadSelect.d.ts +43 -0
  60. package/dist/js/components/Select/TypeaheadSelect.d.ts.map +1 -0
  61. package/dist/js/components/Select/TypeaheadSelect.js +223 -0
  62. package/dist/js/components/Select/TypeaheadSelect.js.map +1 -0
  63. package/dist/js/components/Select/index.d.ts +3 -1
  64. package/dist/js/components/Select/index.d.ts.map +1 -1
  65. package/dist/js/components/Select/index.js +3 -1
  66. package/dist/js/components/Select/index.js.map +1 -1
  67. package/dist/js/components/index.d.ts +1 -0
  68. package/dist/js/components/index.d.ts.map +1 -1
  69. package/dist/js/components/index.js +1 -0
  70. package/dist/js/components/index.js.map +1 -1
  71. package/dist/umd/assets/output-D0LdS41Q.css +23489 -0
  72. package/dist/umd/react-templates.min.js +1 -1
  73. package/package.json +10 -14
  74. package/rollup.config.mjs +8 -0
  75. package/src/components/Dropdown/SimpleDropdown.tsx +139 -0
  76. package/src/components/Dropdown/__tests__/SimpleDropdown.test.tsx +266 -0
  77. package/src/components/Dropdown/__tests__/__snapshots__/SimpleDropdown.test.tsx.snap +81 -0
  78. package/src/components/Dropdown/examples/DropdownTemplates.md +24 -0
  79. package/src/components/Dropdown/examples/SimpleDropdownExample.tsx +53 -0
  80. package/src/components/Dropdown/index.ts +1 -0
  81. package/src/components/Select/CheckboxSelect.tsx +23 -7
  82. package/src/components/Select/MultiTypeaheadSelect.tsx +348 -0
  83. package/src/components/Select/{SelectSimple.tsx → SimpleSelect.tsx} +39 -18
  84. package/src/components/Select/TypeaheadSelect.tsx +388 -0
  85. package/src/components/Select/{CheckboxSelect.test.tsx → __tests__/CheckboxSelect.test.tsx} +29 -1
  86. package/src/components/Select/{CheckboxSelectSnapshots.test.tsx → __tests__/CheckboxSelectSnapshots.test.tsx} +1 -1
  87. package/src/components/Select/__tests__/MultiTypeaheadSelect.test.tsx +414 -0
  88. package/src/components/Select/__tests__/SimpleSelect.test.tsx +241 -0
  89. package/src/components/Select/__tests__/TypeaheadSelect.test.tsx +408 -0
  90. package/src/components/Select/__tests__/__snapshots__/CheckboxSelectSnapshots.test.tsx.snap +83 -0
  91. package/src/components/Select/__tests__/__snapshots__/MultiTypeaheadSelect.test.tsx.snap +97 -0
  92. package/src/components/Select/__tests__/__snapshots__/SimpleSelect.test.tsx.snap +83 -0
  93. package/src/components/Select/__tests__/__snapshots__/TypeaheadSelect.test.tsx.snap +97 -0
  94. package/src/components/Select/examples/CheckboxSelectDemo.tsx +25 -8
  95. package/src/components/Select/examples/MultiTypeaheadSelectDemo.tsx +35 -0
  96. package/src/components/Select/examples/SelectTemplates.md +17 -4
  97. package/src/components/Select/examples/SimpleSelectDemo.tsx +36 -0
  98. package/src/components/Select/examples/TypeaheadSelectDemo.tsx +65 -0
  99. package/src/components/Select/index.ts +3 -1
  100. package/src/components/index.ts +1 -0
  101. package/dist/esm/components/Select/SelectSimple.d.ts.map +0 -1
  102. package/dist/esm/components/Select/SelectSimple.js +0 -31
  103. package/dist/esm/components/Select/SelectSimple.js.map +0 -1
  104. package/dist/js/components/Select/SelectSimple.d.ts.map +0 -1
  105. package/dist/js/components/Select/SelectSimple.js +0 -34
  106. package/dist/js/components/Select/SelectSimple.js.map +0 -1
  107. package/rollup.config.js +0 -7
  108. package/src/components/Select/__snapshots__/CheckboxSelectSnapshots.test.tsx.snap +0 -212
  109. package/src/components/Select/examples/SelectSimpleDemo.tsx +0 -26
@@ -0,0 +1,186 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import { Select, SelectOption, SelectList, MenuToggle, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button, Label, LabelGroup } from '@patternfly/react-core';
4
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
5
+ export const MultiTypeaheadSelectBase = (_a) => {
6
+ var _b;
7
+ var { innerRef, initialOptions, onSelectionChange, onToggle, onInputChange, placeholder = 'Select an option', noOptionsFoundMessage = (filter) => `No results found for "${filter}"`, isDisabled, toggleWidth, toggleProps } = _a, props = __rest(_a, ["innerRef", "initialOptions", "onSelectionChange", "onToggle", "onInputChange", "placeholder", "noOptionsFoundMessage", "isDisabled", "toggleWidth", "toggleProps"]);
8
+ const [isOpen, setIsOpen] = React.useState(false);
9
+ const [selected, setSelected] = React.useState(((_b = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.filter((o) => o.selected)) !== null && _b !== void 0 ? _b : []).map((o) => o.value));
10
+ const [inputValue, setInputValue] = React.useState();
11
+ const [selectOptions, setSelectOptions] = React.useState(initialOptions);
12
+ const [focusedItemIndex, setFocusedItemIndex] = React.useState(null);
13
+ const [activeItemId, setActiveItemId] = React.useState(null);
14
+ const textInputRef = React.useRef();
15
+ const NO_RESULTS = 'no results';
16
+ const openMenu = () => {
17
+ onToggle && onToggle(true);
18
+ setIsOpen(true);
19
+ };
20
+ React.useEffect(() => {
21
+ let newSelectOptions = initialOptions;
22
+ // Filter menu items based on the text input value when one exists
23
+ if (inputValue) {
24
+ newSelectOptions = initialOptions.filter((option) => String(option.content).toLowerCase().includes(inputValue.toLowerCase()));
25
+ // When no options are found after filtering, display 'No results found'
26
+ if (!newSelectOptions.length) {
27
+ newSelectOptions = [
28
+ {
29
+ isAriaDisabled: true,
30
+ content: typeof noOptionsFoundMessage === 'string' ? noOptionsFoundMessage : noOptionsFoundMessage(inputValue),
31
+ value: NO_RESULTS
32
+ }
33
+ ];
34
+ }
35
+ // Open the menu when the input value changes and the new value is not empty
36
+ openMenu();
37
+ }
38
+ setSelectOptions(newSelectOptions);
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ }, [inputValue, initialOptions]);
41
+ React.useEffect(() => { var _a; return setSelected(((_a = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.filter((o) => o.selected)) !== null && _a !== void 0 ? _a : []).map((o) => o.value)); }, [initialOptions]);
42
+ const setActiveAndFocusedItem = (itemIndex) => {
43
+ setFocusedItemIndex(itemIndex);
44
+ const focusedItem = selectOptions[itemIndex];
45
+ setActiveItemId(focusedItem.value);
46
+ };
47
+ const resetActiveAndFocusedItem = () => {
48
+ setFocusedItemIndex(null);
49
+ setActiveItemId(null);
50
+ };
51
+ const closeMenu = () => {
52
+ onToggle && onToggle(false);
53
+ setIsOpen(false);
54
+ resetActiveAndFocusedItem();
55
+ setInputValue('');
56
+ };
57
+ const onInputClick = () => {
58
+ if (!isOpen) {
59
+ openMenu();
60
+ }
61
+ else if (!inputValue) {
62
+ closeMenu();
63
+ }
64
+ };
65
+ const selectOption = (_event, option) => {
66
+ const selections = selected.includes(option) ? selected.filter((o) => option !== o) : [...selected, option];
67
+ onSelectionChange && onSelectionChange(_event, selections);
68
+ setSelected(selections);
69
+ };
70
+ const clearOption = (_event, option) => {
71
+ const selections = selected.filter((o) => option !== o);
72
+ onSelectionChange && onSelectionChange(_event, selections);
73
+ setSelected(selections);
74
+ };
75
+ const _onSelect = (_event, value) => {
76
+ if (value && value !== NO_RESULTS) {
77
+ selectOption(_event, value);
78
+ }
79
+ };
80
+ const onTextInputChange = (_event, value) => {
81
+ setInputValue(value);
82
+ onInputChange && onInputChange(value);
83
+ resetActiveAndFocusedItem();
84
+ };
85
+ const handleMenuArrowKeys = (key) => {
86
+ let indexToFocus = 0;
87
+ if (!isOpen) {
88
+ openMenu();
89
+ }
90
+ if (selectOptions.every((option) => option.isDisabled)) {
91
+ return;
92
+ }
93
+ if (key === 'ArrowUp') {
94
+ // When no index is set or at the first index, focus to the last, otherwise decrement focus index
95
+ if (focusedItemIndex === null || focusedItemIndex === 0) {
96
+ indexToFocus = selectOptions.length - 1;
97
+ }
98
+ else {
99
+ indexToFocus = focusedItemIndex - 1;
100
+ }
101
+ // Skip disabled options
102
+ while (selectOptions[indexToFocus].isDisabled) {
103
+ indexToFocus--;
104
+ if (indexToFocus === -1) {
105
+ indexToFocus = selectOptions.length - 1;
106
+ }
107
+ }
108
+ }
109
+ if (key === 'ArrowDown') {
110
+ // When no index is set or at the last index, focus to the first, otherwise increment focus index
111
+ if (focusedItemIndex === null || focusedItemIndex === selectOptions.length - 1) {
112
+ indexToFocus = 0;
113
+ }
114
+ else {
115
+ indexToFocus = focusedItemIndex + 1;
116
+ }
117
+ // Skip disabled options
118
+ while (selectOptions[indexToFocus].isDisabled) {
119
+ indexToFocus++;
120
+ if (indexToFocus === selectOptions.length) {
121
+ indexToFocus = 0;
122
+ }
123
+ }
124
+ }
125
+ setActiveAndFocusedItem(indexToFocus);
126
+ };
127
+ const onInputKeyDown = (event) => {
128
+ const focusedItem = focusedItemIndex !== null ? selectOptions[focusedItemIndex] : null;
129
+ switch (event.key) {
130
+ case 'Enter':
131
+ if (isOpen && focusedItem && focusedItem.value !== NO_RESULTS && !focusedItem.isAriaDisabled) {
132
+ selectOption(event, focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.value);
133
+ }
134
+ if (!isOpen) {
135
+ onToggle && onToggle(true);
136
+ setIsOpen(true);
137
+ }
138
+ break;
139
+ case 'ArrowUp':
140
+ case 'ArrowDown':
141
+ event.preventDefault();
142
+ handleMenuArrowKeys(event.key);
143
+ break;
144
+ }
145
+ };
146
+ const onToggleClick = () => {
147
+ var _a;
148
+ onToggle && onToggle(!isOpen);
149
+ setIsOpen(!isOpen);
150
+ (_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
151
+ };
152
+ const onClearButtonClick = (ev) => {
153
+ var _a;
154
+ setSelected([]);
155
+ onInputChange && onInputChange('');
156
+ resetActiveAndFocusedItem();
157
+ (_a = textInputRef === null || textInputRef === void 0 ? void 0 : textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
158
+ onSelectionChange && onSelectionChange(ev, []);
159
+ };
160
+ const toggle = (toggleRef) => (React.createElement(MenuToggle, Object.assign({ ref: toggleRef, variant: "typeahead", "aria-label": "Multi select Typeahead menu toggle", onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, isFullWidth: true, style: {
161
+ width: toggleWidth
162
+ } }, toggleProps),
163
+ React.createElement(TextInputGroup, { isPlain: true },
164
+ React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onInputClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown, autoComplete: "off", innerRef: textInputRef, placeholder: placeholder }, (activeItemId && { 'aria-activedescendant': activeItemId }), { role: "combobox", isExpanded: isOpen, "aria-controls": "select-typeahead-listbox" }),
165
+ React.createElement(LabelGroup, { "aria-label": "Current selections" }, selected.map((selection, index) => {
166
+ var _a;
167
+ return (React.createElement(Label, { key: index, "datatest-id": `${selection}-chip`, onClick: (ev) => {
168
+ ev.stopPropagation();
169
+ clearOption(ev, selection);
170
+ } }, (_a = initialOptions.find((o) => o.value === selection)) === null || _a === void 0 ? void 0 : _a.content));
171
+ }))),
172
+ React.createElement(TextInputGroupUtilities, Object.assign({}, (selected.length === 0 ? { style: { display: 'none' } } : {})),
173
+ React.createElement(Button, { variant: "plain", onClick: onClearButtonClick, "aria-label": "Clear input value" },
174
+ React.createElement(TimesIcon, { "aria-hidden": true }))))));
175
+ return (React.createElement(Select, Object.assign({ isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => {
176
+ !isOpen && closeMenu();
177
+ }, toggle: toggle, shouldFocusFirstItemOnOpen: false, ref: innerRef }, props),
178
+ React.createElement(SelectList, null, selectOptions.map((option, index) => {
179
+ const { content, value } = option, props = __rest(option, ["content", "value"]);
180
+ return (React.createElement(SelectOption, Object.assign({ key: value, value: value, isFocused: focusedItemIndex === index }, props), content));
181
+ }))));
182
+ };
183
+ MultiTypeaheadSelectBase.displayName = 'MultiTypeaheadSelectBase';
184
+ export const MultiTypeaheadSelect = React.forwardRef((props, ref) => (React.createElement(MultiTypeaheadSelectBase, Object.assign({}, props, { innerRef: ref }))));
185
+ MultiTypeaheadSelect.displayName = 'MultiTypeaheadSelect';
186
+ //# sourceMappingURL=MultiTypeaheadSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiTypeaheadSelect.js","sourceRoot":"","sources":["../../../../src/components/Select/MultiTypeaheadSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OA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Q,EAAE,SAAS,EACnB,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;YACvB,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QACzB,CAAC,EACD,MAAM,EAAE,MAAM,EACd,0BAA0B,EAAE,KAAK,EACjC,GAAG,EAAE,QAAQ,IACT,KAAK;QAET,oBAAC,UAAU,QACR,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACnC,MAAM,EAAE,OAAO,EAAE,KAAK,KAAe,MAAM,EAAhB,KAAK,UAAK,MAAM,EAArC,oBAA4B,CAAS,CAAC;YAE5C,OAAO,CACL,oBAAC,YAAY,kBAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,KAAK,KAAK,IAAM,KAAK,GACrF,OAAO,CACK,CAChB,CAAC;QACJ,CAAC,CAAC,CACS,CACN,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,wBAAwB,CAAC,WAAW,GAAG,0BAA0B,CAAC;AAElE,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAgC,EAAE,GAAmB,EAAE,EAAE,CAAC,CAC9G,oBAAC,wBAAwB,oBAAK,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CACvD,CAAC,CAAC;AAEH,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC"}
@@ -1,16 +1,17 @@
1
1
  import React from 'react';
2
- import { SelectOptionProps } from '@patternfly/react-core/dist/esm/components/Select';
3
- export interface SelectSimpleOption extends Omit<SelectOptionProps, 'content'> {
2
+ import { SelectOptionProps, SelectProps } from '@patternfly/react-core/dist/esm/components/Select';
3
+ import { MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle';
4
+ export interface SimpleSelectOption extends Omit<SelectOptionProps, 'content'> {
4
5
  /** Content of the select option. */
5
6
  content: React.ReactNode;
6
7
  /** Value of the select option. */
7
8
  value: string | number;
8
9
  }
9
- export interface SelectSimpleProps {
10
+ export interface SimpleSelectProps extends Omit<SelectProps, 'toggle'> {
10
11
  /** @hide Forwarded ref */
11
12
  innerRef?: React.Ref<any>;
12
13
  /** Initial options of the select. */
13
- initialOptions?: SelectSimpleOption[];
14
+ initialOptions?: SimpleSelectOption[];
14
15
  /** Callback triggered on selection. */
15
16
  onSelect?: (_event: React.MouseEvent<Element, MouseEvent>, selection: string | number) => void;
16
17
  /** Callback triggered when the select opens or closes. */
@@ -19,8 +20,12 @@ export interface SelectSimpleProps {
19
20
  isDisabled?: boolean;
20
21
  /** Content of the toggle. Defaults to the selected option. */
21
22
  toggleContent?: React.ReactNode;
22
- /** Width of the toggle */
23
+ /** Placeholder text for the select input. */
24
+ placeholder?: string;
25
+ /** Width of the toggle. */
23
26
  toggleWidth?: string;
27
+ /** Additional props passed to the toggle. */
28
+ toggleProps?: MenuToggleProps;
24
29
  }
25
- export declare const SelectSimple: React.ForwardRefExoticComponent<SelectSimpleProps & React.RefAttributes<any>>;
26
- //# sourceMappingURL=SelectSimple.d.ts.map
30
+ export declare const SimpleSelect: React.ForwardRefExoticComponent<SimpleSelectProps & React.RefAttributes<any>>;
31
+ //# sourceMappingURL=SimpleSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/SimpleSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,EACjB,WAAW,EACZ,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAiC,eAAe,EAAE,MAAM,uDAAuD,CAAC;AAEvH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC;IAC5E,oCAAoC;IACpC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;IACpE,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,qCAAqC;IACrC,cAAc,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACtC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC/F,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAgFD,eAAO,MAAM,YAAY,+EAEvB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import { Select, SelectList, SelectOption } from '@patternfly/react-core/dist/esm/components/Select';
4
+ import { MenuToggle } from '@patternfly/react-core/dist/esm/components/MenuToggle';
5
+ const SimpleSelectBase = (_a) => {
6
+ var { innerRef, initialOptions, isDisabled, onSelect, onToggle, toggleContent, toggleWidth = '200px', toggleProps, placeholder = 'Select a value' } = _a, props = __rest(_a, ["innerRef", "initialOptions", "isDisabled", "onSelect", "onToggle", "toggleContent", "toggleWidth", "toggleProps", "placeholder"]);
7
+ const [isOpen, setIsOpen] = React.useState(false);
8
+ const [selected, setSelected] = React.useState();
9
+ React.useEffect(() => {
10
+ const selectedOption = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.find((option) => option.selected);
11
+ setSelected(selectedOption);
12
+ }, [initialOptions]);
13
+ const simpleSelectOptions = initialOptions === null || initialOptions === void 0 ? void 0 : initialOptions.map((option) => {
14
+ const { content, value } = option, props = __rest(option, ["content", "value"]);
15
+ const isSelected = (selected === null || selected === void 0 ? void 0 : selected.value) === value;
16
+ return (React.createElement(SelectOption, Object.assign({ value: value, key: value, isSelected: isSelected }, props), content));
17
+ });
18
+ const onToggleClick = () => {
19
+ onToggle && onToggle(!isOpen);
20
+ setIsOpen(!isOpen);
21
+ };
22
+ const _onSelect = (_event, value) => {
23
+ onSelect && onSelect(_event, value);
24
+ setSelected(initialOptions.find((o) => o.value === value));
25
+ onToggle && onToggle(true);
26
+ setIsOpen(false);
27
+ };
28
+ const toggle = (toggleRef) => (React.createElement(MenuToggle, Object.assign({ ref: toggleRef, onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, style: {
29
+ width: toggleWidth
30
+ } }, toggleProps), toggleContent ? toggleContent : (selected === null || selected === void 0 ? void 0 : selected.content) || placeholder));
31
+ return (React.createElement(Select, Object.assign({ isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => {
32
+ onToggle && onToggle(isOpen);
33
+ setIsOpen(isOpen);
34
+ }, toggle: toggle, shouldFocusToggleOnSelect: true, ref: innerRef }, props),
35
+ React.createElement(SelectList, null, simpleSelectOptions)));
36
+ };
37
+ export const SimpleSelect = React.forwardRef((props, ref) => (React.createElement(SimpleSelectBase, Object.assign({}, props, { innerRef: ref }))));
38
+ SimpleSelect.displayName = 'SimpleSelect';
39
+ //# sourceMappingURL=SimpleSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SimpleSelect.js","sourceRoot":"","sources":["../../../../src/components/Select/SimpleSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,MAAM,EACN,UAAU,EACV,YAAY,EAGb,MAAM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AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAwB,EAAE,GAAmB,EAAE,EAAE,CAAC,CAC9F,oBAAC,gBAAgB,oBAAK,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CAC/C,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { SelectOptionProps, MenuToggleProps, SelectProps } from '@patternfly/react-core';
3
+ export interface TypeaheadSelectOption extends Omit<SelectOptionProps, 'content'> {
4
+ /** Content of the select option. */
5
+ content: string | number;
6
+ /** Value of the select option. */
7
+ value: string | number;
8
+ }
9
+ export interface TypeaheadSelectProps extends Omit<SelectProps, 'toggle' | 'onSelect'> {
10
+ /** @hide Forwarded ref */
11
+ innerRef?: React.Ref<any>;
12
+ /** Initial options of the select. */
13
+ initialOptions: TypeaheadSelectOption[];
14
+ /** Callback triggered on selection. */
15
+ onSelect?: (_event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<HTMLInputElement> | undefined, selection: string | number) => void;
16
+ /** Callback triggered when the select opens or closes. */
17
+ onToggle?: (nextIsOpen: boolean) => void;
18
+ /** Callback triggered when the text in the input field changes. */
19
+ onInputChange?: (newValue: string) => void;
20
+ /** Callback triggered when the clear button is selected */
21
+ onClearSelection?: () => void;
22
+ /** Placeholder text for the select input. */
23
+ placeholder?: string;
24
+ /** Flag to indicate if the typeahead select allows new items */
25
+ isCreatable?: boolean;
26
+ /** Flag to indicate if create option should be at top of typeahead */
27
+ isCreateOptionOnTop?: boolean;
28
+ /** Message to display to create a new option */
29
+ createOptionMessage?: string | ((newValue: string) => string);
30
+ /** Message to display when no options are available. */
31
+ noOptionsAvailableMessage?: string;
32
+ /** Message to display when no options match the filter. */
33
+ noOptionsFoundMessage?: string | ((filter: string) => string);
34
+ /** Flag indicating the select should be disabled. */
35
+ isDisabled?: boolean;
36
+ /** Width of the toggle. */
37
+ toggleWidth?: string;
38
+ /** Additional props passed to the toggle. */
39
+ toggleProps?: MenuToggleProps;
40
+ }
41
+ export declare const TypeaheadSelectBase: React.FunctionComponent<TypeaheadSelectProps>;
42
+ export declare const TypeaheadSelect: React.ForwardRefExoticComponent<TypeaheadSelectProps & React.RefAttributes<any>>;
43
+ //# sourceMappingURL=TypeaheadSelect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeaheadSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/TypeaheadSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,EAOjB,eAAe,EACf,WAAW,EACZ,MAAM,wBAAwB,CAAC;AAGhC,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC;IAC/E,oCAAoC;IACpC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,kCAAkC;IAClC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,UAAU,CAAC;IACpF,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1B,qCAAqC;IACrC,cAAc,EAAE,qBAAqB,EAAE,CAAC;IACxC,uCAAuC;IACvC,QAAQ,CAAC,EAAE,CACT,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,SAAS,EACjG,SAAS,EAAE,MAAM,GAAG,MAAM,KACvB,IAAI,CAAC;IACV,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gDAAgD;IAChD,mBAAmB,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC9D,wDAAwD;IACxD,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,2DAA2D;IAC3D,qBAAqB,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC9D,qDAAqD;IACrD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAKD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CA6T7E,CAAC;AAGF,eAAO,MAAM,eAAe,kFAE1B,CAAC"}
@@ -0,0 +1,219 @@
1
+ import { __rest } from "tslib";
2
+ import React from 'react';
3
+ import { Select, SelectOption, SelectList, MenuToggle, TextInputGroup, TextInputGroupMain, TextInputGroupUtilities, Button } from '@patternfly/react-core';
4
+ import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
5
+ const defaultNoOptionsFoundMessage = (filter) => `No results found for "${filter}"`;
6
+ const defaultCreateOptionMessage = (newValue) => `Create "${newValue}"`;
7
+ export const TypeaheadSelectBase = (_a) => {
8
+ var _b, _c, _d, _e;
9
+ var { innerRef, initialOptions, onSelect, onToggle, onInputChange, onClearSelection, placeholder = 'Select an option', noOptionsAvailableMessage = 'No options are available', noOptionsFoundMessage = defaultNoOptionsFoundMessage, isCreatable = false, isCreateOptionOnTop = false, createOptionMessage = defaultCreateOptionMessage, isDisabled, toggleWidth, toggleProps } = _a, props = __rest(_a, ["innerRef", "initialOptions", "onSelect", "onToggle", "onInputChange", "onClearSelection", "placeholder", "noOptionsAvailableMessage", "noOptionsFoundMessage", "isCreatable", "isCreateOptionOnTop", "createOptionMessage", "isDisabled", "toggleWidth", "toggleProps"]);
10
+ const [isOpen, setIsOpen] = React.useState(false);
11
+ const [selected, setSelected] = React.useState(String((_c = (_b = initialOptions.find((o) => o.selected)) === null || _b === void 0 ? void 0 : _b.content) !== null && _c !== void 0 ? _c : ''));
12
+ const [inputValue, setInputValue] = React.useState(String((_e = (_d = initialOptions.find((o) => o.selected)) === null || _d === void 0 ? void 0 : _d.content) !== null && _e !== void 0 ? _e : ''));
13
+ const [filterValue, setFilterValue] = React.useState('');
14
+ const [selectOptions, setSelectOptions] = React.useState(initialOptions);
15
+ const [focusedItemIndex, setFocusedItemIndex] = React.useState(null);
16
+ const [activeItemId, setActiveItemId] = React.useState(null);
17
+ const textInputRef = React.useRef();
18
+ const NO_RESULTS = 'no results';
19
+ React.useEffect(() => {
20
+ let newSelectOptions = initialOptions;
21
+ // Filter menu items based on the text input value when one exists
22
+ if (filterValue) {
23
+ newSelectOptions = initialOptions.filter((option) => String(option.content).toLowerCase().includes(filterValue.toLowerCase()));
24
+ if (isCreatable &&
25
+ filterValue &&
26
+ !initialOptions.find((o) => String(o.content).toLowerCase() === filterValue.toLowerCase())) {
27
+ const createOption = {
28
+ content: typeof createOptionMessage === 'string' ? createOptionMessage : createOptionMessage(filterValue),
29
+ value: filterValue
30
+ };
31
+ newSelectOptions = isCreateOptionOnTop
32
+ ? [createOption, ...newSelectOptions]
33
+ : [...newSelectOptions, createOption];
34
+ }
35
+ // When no options are found after filtering, display 'No results found'
36
+ if (!newSelectOptions.length) {
37
+ newSelectOptions = [
38
+ {
39
+ isAriaDisabled: true,
40
+ content: typeof noOptionsFoundMessage === 'string' ? noOptionsFoundMessage : noOptionsFoundMessage(filterValue),
41
+ value: NO_RESULTS
42
+ }
43
+ ];
44
+ }
45
+ // Open the menu when the input value changes and the new value is not empty
46
+ openMenu();
47
+ }
48
+ // When no options are available, display 'No options available'
49
+ if (!newSelectOptions.length) {
50
+ newSelectOptions = [
51
+ {
52
+ isAriaDisabled: true,
53
+ content: noOptionsAvailableMessage,
54
+ value: NO_RESULTS
55
+ }
56
+ ];
57
+ }
58
+ setSelectOptions(newSelectOptions);
59
+ }, [
60
+ filterValue,
61
+ initialOptions,
62
+ noOptionsFoundMessage,
63
+ isCreatable,
64
+ isCreateOptionOnTop,
65
+ createOptionMessage,
66
+ noOptionsAvailableMessage
67
+ ]);
68
+ React.useEffect(() => {
69
+ var _a;
70
+ // If the selected option changed and the current input value is the previously selected item, update the displayed value.
71
+ const selectedOption = initialOptions.find((o) => o.selected);
72
+ if (inputValue === selected && (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) !== selected) {
73
+ setInputValue(String((_a = selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.content) !== null && _a !== void 0 ? _a : ''));
74
+ }
75
+ // Only update when options change
76
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
+ }, [initialOptions]);
78
+ const setActiveAndFocusedItem = (itemIndex) => {
79
+ setFocusedItemIndex(itemIndex);
80
+ const focusedItem = selectOptions[itemIndex];
81
+ setActiveItemId(String(focusedItem.value));
82
+ };
83
+ const resetActiveAndFocusedItem = () => {
84
+ setFocusedItemIndex(null);
85
+ setActiveItemId(null);
86
+ };
87
+ const openMenu = () => {
88
+ if (!isOpen) {
89
+ onToggle && onToggle(true);
90
+ setIsOpen(true);
91
+ }
92
+ };
93
+ const closeMenu = () => {
94
+ onToggle && onToggle(false);
95
+ setIsOpen(false);
96
+ resetActiveAndFocusedItem();
97
+ const option = initialOptions.find((o) => o.value === selected);
98
+ if (option) {
99
+ setInputValue(String(option.content));
100
+ }
101
+ };
102
+ const onInputClick = () => {
103
+ if (!isOpen) {
104
+ openMenu();
105
+ }
106
+ else if (!inputValue) {
107
+ closeMenu();
108
+ }
109
+ };
110
+ const selectOption = (_event, option) => {
111
+ onSelect && onSelect(_event, option.value);
112
+ setInputValue(String(option.content));
113
+ setFilterValue('');
114
+ setSelected(String(option.value));
115
+ closeMenu();
116
+ };
117
+ const _onSelect = (_event, value) => {
118
+ if (value && value !== NO_RESULTS) {
119
+ const optionToSelect = selectOptions.find((option) => option.value === value);
120
+ selectOption(_event, optionToSelect);
121
+ }
122
+ };
123
+ const onTextInputChange = (_event, value) => {
124
+ setInputValue(value);
125
+ onInputChange && onInputChange(value);
126
+ setFilterValue(value);
127
+ resetActiveAndFocusedItem();
128
+ };
129
+ const handleMenuArrowKeys = (key) => {
130
+ let indexToFocus = 0;
131
+ openMenu();
132
+ if (selectOptions.every((option) => option.isDisabled)) {
133
+ return;
134
+ }
135
+ if (key === 'ArrowUp') {
136
+ // When no index is set or at the first index, focus to the last, otherwise decrement focus index
137
+ if (focusedItemIndex === null || focusedItemIndex === 0) {
138
+ indexToFocus = selectOptions.length - 1;
139
+ }
140
+ else {
141
+ indexToFocus = focusedItemIndex - 1;
142
+ }
143
+ // Skip disabled options
144
+ while (selectOptions[indexToFocus].isDisabled) {
145
+ indexToFocus--;
146
+ if (indexToFocus === -1) {
147
+ indexToFocus = selectOptions.length - 1;
148
+ }
149
+ }
150
+ }
151
+ if (key === 'ArrowDown') {
152
+ // When no index is set or at the last index, focus to the first, otherwise increment focus index
153
+ if (focusedItemIndex === null || focusedItemIndex === selectOptions.length - 1) {
154
+ indexToFocus = 0;
155
+ }
156
+ else {
157
+ indexToFocus = focusedItemIndex + 1;
158
+ }
159
+ // Skip disabled options
160
+ while (selectOptions[indexToFocus].isDisabled) {
161
+ indexToFocus++;
162
+ if (indexToFocus === selectOptions.length) {
163
+ indexToFocus = 0;
164
+ }
165
+ }
166
+ }
167
+ setActiveAndFocusedItem(indexToFocus);
168
+ };
169
+ const onInputKeyDown = (event) => {
170
+ const focusedItem = focusedItemIndex !== null ? selectOptions[focusedItemIndex] : null;
171
+ switch (event.key) {
172
+ case 'Enter':
173
+ if (isOpen && focusedItem && focusedItem.value !== NO_RESULTS && !focusedItem.isAriaDisabled) {
174
+ selectOption(event, focusedItem);
175
+ }
176
+ openMenu();
177
+ break;
178
+ case 'ArrowUp':
179
+ case 'ArrowDown':
180
+ event.preventDefault();
181
+ handleMenuArrowKeys(event.key);
182
+ break;
183
+ }
184
+ };
185
+ const onToggleClick = () => {
186
+ var _a;
187
+ onToggle && onToggle(!isOpen);
188
+ setIsOpen(!isOpen);
189
+ (_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
190
+ };
191
+ const onClearButtonClick = () => {
192
+ var _a;
193
+ setSelected('');
194
+ setInputValue('');
195
+ onInputChange && onInputChange('');
196
+ setFilterValue('');
197
+ resetActiveAndFocusedItem();
198
+ (_a = textInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
199
+ onClearSelection && onClearSelection();
200
+ };
201
+ const toggle = (toggleRef) => (React.createElement(MenuToggle, Object.assign({ ref: toggleRef, variant: "typeahead", "aria-label": "Typeahead menu toggle", onClick: onToggleClick, isExpanded: isOpen, isDisabled: isDisabled, isFullWidth: true, style: {
202
+ width: toggleWidth
203
+ } }, toggleProps),
204
+ React.createElement(TextInputGroup, { isPlain: true },
205
+ React.createElement(TextInputGroupMain, Object.assign({ value: inputValue, onClick: onInputClick, onChange: onTextInputChange, onKeyDown: onInputKeyDown, autoComplete: "off", innerRef: textInputRef, placeholder: placeholder }, (activeItemId && { 'aria-activedescendant': activeItemId }), { role: "combobox", isExpanded: isOpen, "aria-controls": "select-typeahead-listbox" })),
206
+ React.createElement(TextInputGroupUtilities, Object.assign({}, (!inputValue ? { style: { display: 'none' } } : {})),
207
+ React.createElement(Button, { variant: "plain", onClick: onClearButtonClick, "aria-label": "Clear input value", icon: React.createElement(TimesIcon, { "aria-hidden": true }) })))));
208
+ return (React.createElement(Select, Object.assign({ isOpen: isOpen, selected: selected, onSelect: _onSelect, onOpenChange: (isOpen) => {
209
+ !isOpen && closeMenu();
210
+ }, toggle: toggle, shouldFocusFirstItemOnOpen: false, ref: innerRef }, props),
211
+ React.createElement(SelectList, null, selectOptions.map((option, index) => {
212
+ const { content, value } = option, props = __rest(option, ["content", "value"]);
213
+ return (React.createElement(SelectOption, Object.assign({ key: value, value: value, isFocused: focusedItemIndex === index }, props), content));
214
+ }))));
215
+ };
216
+ TypeaheadSelectBase.displayName = 'TypeaheadSelectBase';
217
+ export const TypeaheadSelect = React.forwardRef((props, ref) => (React.createElement(TypeaheadSelectBase, Object.assign({}, props, { innerRef: ref }))));
218
+ TypeaheadSelect.displayName = 'TypeaheadSelect';
219
+ //# sourceMappingURL=TypeaheadSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeaheadSelect.js","sourceRoot":"","sources":["../../../../src/components/Select/TypeaheadSelect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EAEV,UAAU,EAEV,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,MAAM,EAGP,MAAM,wBAAwB,CAAC;AAChC,OAAO,SAAS,MAAM,mDAAmD,CAAC;AA6C1E,MAAM,4BAA4B,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,yBAAyB,MAAM,GAAG,CAAC;AAC5F,MAAM,0BAA0B,GAAG,CAAC,QAAgB,EAAE,EAAE,CAAC,WAAW,QAAQ,GAAG,CAAC;AAEhF,MAAM,CAAC,MAAM,mBAAmB,GAAkD,CAAC,EAiB5D,EAAE,EAAE;;QAjBwD,EACjF,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,WAAW,GAAG,kBAAkB,EAChC,yBAAyB,GAAG,0BAA0B,EACtD,qBAAqB,GAAG,4BAA4B,EACpD,WAAW,GAAG,KA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EF,OAAO,CACL,oBAAC,MAAM,kBACL,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,SAAS,EACnB,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;YACvB,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;QACzB,CAAC,EACD,MAAM,EAAE,MAAM,EACd,0BAA0B,EAAE,KAAK,EACjC,GAAG,EAAE,QAAQ,IACT,KAAK;QAET,oBAAC,UAAU,QACR,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACnC,MAAM,EAAE,OAAO,EAAE,KAAK,KAAe,MAAM,EAAhB,KAAK,UAAK,MAAM,EAArC,oBAA4B,CAAS,CAAC;YAE5C,OAAO,CACL,oBAAC,YAAY,kBAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,KAAK,KAAK,IAAM,KAAK,GACrF,OAAO,CACK,CAChB,CAAC;QACJ,CAAC,CAAC,CACS,CACN,CACV,CAAC;AACJ,CAAC,CAAC;AACF,mBAAmB,CAAC,WAAW,GAAG,qBAAqB,CAAC;AAExD,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAA2B,EAAE,GAAmB,EAAE,EAAE,CAAC,CACpG,oBAAC,mBAAmB,oBAAK,KAAK,IAAE,QAAQ,EAAE,GAAG,IAAI,CAClD,CAAC,CAAC;AAEH,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC"}
@@ -1,3 +1,5 @@
1
- export * from './SelectSimple';
1
+ export * from './SimpleSelect';
2
2
  export * from './CheckboxSelect';
3
+ export * from './TypeaheadSelect';
4
+ export * from './MultiTypeaheadSelect';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
@@ -1,3 +1,5 @@
1
- export * from './SelectSimple';
1
+ export * from './SimpleSelect';
2
2
  export * from './CheckboxSelect';
3
+ export * from './TypeaheadSelect';
4
+ export * from './MultiTypeaheadSelect';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Select/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
@@ -1,2 +1,3 @@
1
+ export * from './Dropdown';
1
2
  export * from './Select';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -1,2 +1,3 @@
1
+ export * from './Dropdown';
1
2
  export * from './Select';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}