@cashub/ui 0.21.0 → 0.21.1

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 (229) hide show
  1. package/Tab/Tab.js +9 -13
  2. package/Tab/TabList.js +14 -32
  3. package/Tab/TabPanel.js +21 -58
  4. package/Tab/TabTab.js +20 -40
  5. package/Tab/index.js +2 -10
  6. package/Tab/subComponent/TabContext.js +2 -5
  7. package/animate/Collapse.js +26 -53
  8. package/animate/Loader.js +21 -26
  9. package/animate/NumberCounter.js +22 -44
  10. package/animate/PulseRing.js +9 -21
  11. package/animate/Spinner.js +2 -10
  12. package/animate/index.js +5 -11
  13. package/backdrop/BaseBackdrop.js +2 -9
  14. package/backdrop/LoadingBackdrop.js +2 -9
  15. package/backdrop/ModalBackdrop.js +2 -9
  16. package/backdrop/index.js +3 -7
  17. package/badge/Badge.js +2 -11
  18. package/badge/BadgeDot.js +2 -10
  19. package/badge/BadgeFill.js +15 -20
  20. package/badge/BadgeWithText.js +6 -13
  21. package/badge/index.js +4 -9
  22. package/billing/BarChart.js +10 -17
  23. package/billing/Grid.js +11 -15
  24. package/billing/Header2.js +6 -9
  25. package/billing/Header3.js +9 -16
  26. package/billing/Paragraph.js +8 -14
  27. package/billing/ParagraphGroup.js +6 -9
  28. package/billing/ParagraphText.js +7 -12
  29. package/billing/Section.js +13 -23
  30. package/billing/SectionBody.js +5 -8
  31. package/billing/SectionHeader.js +7 -12
  32. package/breadcrumb/Breadcrumb.js +11 -21
  33. package/breadcrumb/index.js +1 -3
  34. package/button/Button.js +41 -38
  35. package/button/ButtonGroup.js +21 -18
  36. package/button/IconButton.js +29 -29
  37. package/button/ScrollToTopButton.js +12 -39
  38. package/button/index.js +4 -9
  39. package/callout/Callout.js +13 -26
  40. package/callout/index.js +1 -3
  41. package/chart/BarChart.js +28 -53
  42. package/chart/DoughnutChart.js +23 -62
  43. package/chart/LineChart.js +33 -55
  44. package/chart/SingleBarChart.js +11 -17
  45. package/chart/index.js +5 -12
  46. package/chart/utils/customTooltip.js +26 -43
  47. package/chart/utils/htmlLegendPlugin.js +24 -30
  48. package/chart/utils/index.js +3 -7
  49. package/chart/utils/padEmptyChartBar.js +24 -22
  50. package/container/FlexContainer.js +9 -12
  51. package/container/index.js +1 -3
  52. package/cropper/Cropper.js +21 -34
  53. package/cropper/CropperModalHandler.js +15 -21
  54. package/cropper/index.js +2 -5
  55. package/cropper/subComponent/CropImageModal.js +23 -58
  56. package/datetimePicker/DatePicker.js +103 -217
  57. package/datetimePicker/DatePickerV2.js +116 -221
  58. package/datetimePicker/DatetimePicker.js +27 -48
  59. package/datetimePicker/DatetimePickerV2.js +115 -231
  60. package/datetimePicker/TimeInput.js +9 -22
  61. package/datetimePicker/TimePicker.js +94 -151
  62. package/datetimePicker/TimePickerStyle.js +2 -9
  63. package/datetimePicker/accordion/Month.js +70 -90
  64. package/datetimePicker/accordion/Year.js +91 -135
  65. package/datetimePicker/hooks/index.js +3 -7
  66. package/datetimePicker/hooks/useChangeNumber.js +14 -27
  67. package/datetimePicker/hooks/useDecrease.js +19 -35
  68. package/datetimePicker/hooks/useIncrease.js +19 -35
  69. package/datetimePicker/index.js +7 -15
  70. package/datetimePicker/provider/constant.js +2 -3
  71. package/datetimePicker/subComponent/Accordion.js +108 -158
  72. package/datetimePicker/subComponent/CustomTimeInput.js +18 -48
  73. package/datetimePicker/subComponent/DateTimePickerContext.js +2 -5
  74. package/datetimePicker/utils/GMTDate.js +3 -7
  75. package/datetimePicker/utils/pad.js +2 -6
  76. package/datetimePicker/utils/toUTC0.js +3 -6
  77. package/descriptionList/DescriptionDetail.js +5 -10
  78. package/descriptionList/DescriptionList.js +5 -10
  79. package/descriptionList/DescriptionTerm.js +2 -9
  80. package/descriptionList/index.js +3 -7
  81. package/divider/Divider.js +9 -12
  82. package/divider/index.js +1 -3
  83. package/dropdown/Dropdown.js +28 -65
  84. package/dropdown/DropdownButtonOption.js +2 -9
  85. package/dropdown/DropdownContent.js +33 -64
  86. package/dropdown/DropdownDivOption.js +2 -9
  87. package/dropdown/DropdownItem.js +10 -16
  88. package/dropdown/DropdownLinkOption.js +2 -9
  89. package/dropdown/DropdownToggle.js +18 -38
  90. package/dropdown/index.js +6 -17
  91. package/dropdown/subComponent/DropdownContext.js +2 -5
  92. package/dropzone/FileDropzone.js +148 -302
  93. package/dropzone/ImageDropzone.js +96 -171
  94. package/dropzone/index.js +2 -5
  95. package/dropzone/subComponent/Message.js +7 -14
  96. package/figure/IconFigure.js +9 -16
  97. package/figure/ImageFigure.js +11 -17
  98. package/figure/index.js +2 -5
  99. package/file/HiddenFileInput.js +5 -14
  100. package/file/index.js +1 -3
  101. package/form/Checkbox.js +34 -43
  102. package/form/FormItem.js +2 -9
  103. package/form/Input.js +13 -15
  104. package/form/Label.js +10 -13
  105. package/form/MutedText.js +5 -10
  106. package/form/RadioButton.js +20 -32
  107. package/form/Searchbox.js +21 -65
  108. package/form/Slider.js +14 -0
  109. package/form/SwitchButton.js +34 -39
  110. package/form/Textarea.js +2 -11
  111. package/form/index.js +9 -19
  112. package/grid/Column.js +17 -17
  113. package/grid/Grid.js +13 -14
  114. package/grid/index.js +2 -5
  115. package/heading/Heading1.js +5 -10
  116. package/heading/Heading2.js +9 -12
  117. package/heading/Heading3.js +21 -18
  118. package/heading/index.js +3 -7
  119. package/helmet/Helmet.js +6 -9
  120. package/helmet/index.js +2 -5
  121. package/iconbox/ApplicationIconBox.js +25 -31
  122. package/iconbox/IconBox.js +11 -24
  123. package/iconbox/IconBoxV2.js +14 -26
  124. package/iconbox/index.js +3 -7
  125. package/iconbox/subComponent/IconBoxFigure.js +25 -20
  126. package/iconbox/subComponent/IconBoxImage.js +15 -18
  127. package/image/ImageFluid.js +2 -10
  128. package/image/UploadImage.js +65 -113
  129. package/image/index.js +2 -5
  130. package/index.js +44 -130
  131. package/jsoneditor/JsonEditor.js +10 -32
  132. package/jsoneditor/index.js +1 -3
  133. package/keyframe/Pulse.js +2 -7
  134. package/keyframe/Spin.js +2 -7
  135. package/link/LinkSpan.js +22 -35
  136. package/link/index.js +1 -3
  137. package/map/GoogleMap.js +122 -175
  138. package/map/GoogleReverseGeolocation.js +79 -186
  139. package/map/LeafletMap.js +78 -132
  140. package/map/LeafletReverseGeolocation.js +49 -121
  141. package/map/index.js +4 -9
  142. package/map/subComponent/BasicLeafletMap.js +8 -14
  143. package/map/subComponent/GoogleMapContainer.js +5 -10
  144. package/map/subComponent/GoogleMapPopup.js +66 -123
  145. package/map/subComponent/GoogleMapWrapper.js +13 -32
  146. package/map/subComponent/GoogleMarkerSpiderfier.js +14 -24
  147. package/map/subComponent/LeafletDrawControl.js +47 -84
  148. package/map/subComponent/LeafletMapContainer.js +5 -10
  149. package/map/subComponent/MapSearchBoxControl.js +24 -70
  150. package/modal/StateModal.js +41 -100
  151. package/modal/TitleModal.js +89 -190
  152. package/modal/index.js +2 -5
  153. package/package.json +1 -1
  154. package/paginate/Paginate.js +40 -54
  155. package/paginate/index.js +1 -3
  156. package/popover/Popover.js +39 -87
  157. package/popover/index.js +1 -3
  158. package/qrcode/QRCode.js +10 -23
  159. package/qrcode/QRCodeContainter.js +8 -16
  160. package/qrcode/index.js +2 -5
  161. package/ribbon/Ribbon.js +4 -15
  162. package/ribbon/index.js +1 -3
  163. package/section/Section.js +57 -39
  164. package/section/SectionBody.js +15 -22
  165. package/section/SectionHeader.js +27 -27
  166. package/section/SectionToolbar.js +2 -9
  167. package/section/SectionToolbarItem.js +2 -9
  168. package/section/index.js +5 -11
  169. package/select/InputSelect.js +103 -215
  170. package/select/Select.js +204 -362
  171. package/select/index.js +2 -5
  172. package/select/subComponent/ListBox.js +9 -12
  173. package/select/subComponent/Option.js +8 -16
  174. package/select/subComponent/OptionGroup.js +2 -9
  175. package/select/subComponent/Options.js +5 -11
  176. package/select/subComponent/SearchBox.js +9 -29
  177. package/select/subComponent/SelectedMultiple.js +8 -16
  178. package/select/subComponent/SelectedSingle.js +2 -9
  179. package/styles/GlobalStyle.js +169 -91
  180. package/styles/config/breakpoint.style.js +2 -3
  181. package/styles/config/header.style.js +2 -3
  182. package/styles/config/sidebar.style.js +2 -3
  183. package/styles/index.js +2 -5
  184. package/styles/mixin/backgroundColor.js +17 -14
  185. package/styles/mixin/borderColor.js +17 -14
  186. package/styles/mixin/color.js +17 -14
  187. package/styles/mixin/colorOnBackground.js +17 -14
  188. package/styles/mixin/inputPlaceholder.js +3 -9
  189. package/styles/mixin/media.js +3 -11
  190. package/styles/mixin/rounded.js +13 -12
  191. package/styles/mixin/scrollbar.js +7 -13
  192. package/styles/theme/dark.theme.js +20 -20
  193. package/styles/theme/light.theme.js +20 -20
  194. package/styles/theme/white.theme.js +20 -20
  195. package/styles/themes.js +2 -8
  196. package/table/GridTable.js +105 -143
  197. package/table/ImageBox.js +8 -18
  198. package/table/PermissionTable.js +25 -25
  199. package/table/Table.js +137 -153
  200. package/table/__mock__/columns.js +2 -3
  201. package/table/__mock__/data.js +2 -3
  202. package/table/hooks/index.js +2 -5
  203. package/table/hooks/useCalculateDataRange.js +9 -36
  204. package/table/hooks/useGenerateSort.js +6 -17
  205. package/table/index.js +4 -9
  206. package/table/subComponent/BaseTableHeadCell.js +15 -21
  207. package/table/subComponent/GridTableFooter.js +5 -10
  208. package/table/subComponent/GridTableHeadCell.js +5 -10
  209. package/table/subComponent/Resizer.js +17 -44
  210. package/table/subComponent/TableFooter.js +5 -10
  211. package/table/subComponent/TableFooterInfo.js +2 -9
  212. package/table/subComponent/TableFooterPager.js +5 -12
  213. package/table/subComponent/TableHeadCell.js +2 -9
  214. package/table/subComponent/TableSort.js +13 -19
  215. package/tagify/TagifyStyle.js +2 -9
  216. package/tagify/Tags.js +15 -37
  217. package/tagify/index.js +2 -5
  218. package/text/Paragraph.js +25 -20
  219. package/text/index.js +1 -3
  220. package/timeline/Timeline.js +28 -37
  221. package/timeline/index.js +1 -3
  222. package/toast/CustomToastContainer.js +2 -9
  223. package/toast/MessageContainer.js +9 -18
  224. package/toast/index.js +3 -8
  225. package/toast/show.js +18 -28
  226. package/tooltip/Tooltip.js +48 -97
  227. package/tooltip/index.js +1 -3
  228. package/wizard/Wizard.js +63 -133
  229. package/wizard/index.js +1 -3
package/select/Select.js CHANGED
@@ -4,222 +4,112 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = require("react");
9
-
10
8
  var _reactI18next = require("react-i18next");
11
-
12
9
  var _reactOutsideClickHandler = _interopRequireDefault(require("react-outside-click-handler"));
13
-
14
10
  var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
11
  var _lodash = _interopRequireDefault(require("lodash.uniqueid"));
17
-
18
12
  var _ti = require("react-icons/ti");
19
-
20
13
  var _md = require("react-icons/md");
21
-
22
14
  var _hooks = require("@cashub/hooks");
23
-
24
15
  var _utils = require("@cashub/utils");
25
-
26
16
  var _media = _interopRequireDefault(require("../styles/mixin/media"));
27
-
28
17
  var _SelectedSingle = _interopRequireDefault(require("./subComponent/SelectedSingle"));
29
-
30
18
  var _SelectedMultiple = _interopRequireDefault(require("./subComponent/SelectedMultiple"));
31
-
32
19
  var _ListBox = _interopRequireDefault(require("./subComponent/ListBox"));
33
-
34
20
  var _SearchBox = _interopRequireDefault(require("./subComponent/SearchBox"));
35
-
36
21
  var _Options = _interopRequireDefault(require("./subComponent/Options"));
37
-
38
22
  var _OptionGroup = _interopRequireDefault(require("./subComponent/OptionGroup"));
39
-
40
23
  var _Option = _interopRequireDefault(require("./subComponent/Option"));
41
-
42
24
  var _jsxRuntime = require("react/jsx-runtime");
43
-
44
25
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
45
-
46
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
-
48
27
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
49
-
50
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
51
-
52
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
53
-
54
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
55
-
56
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
57
-
58
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
59
-
60
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
61
-
62
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
63
-
64
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
65
-
66
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
67
-
68
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
69
-
70
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
71
-
72
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
73
-
74
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
75
-
76
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
77
-
78
- var Select = function Select(_ref) {
79
- var options = _ref.options,
80
- _ref$enableSelectAll = _ref.enableSelectAll,
81
- enableSelectAll = _ref$enableSelectAll === void 0 ? false : _ref$enableSelectAll,
82
- selected = _ref.selected,
83
- onSelect = _ref.onSelect,
84
- onDeselect = _ref.onDeselect,
85
- _ref$multiple = _ref.multiple,
86
- multiple = _ref$multiple === void 0 ? false : _ref$multiple,
87
- _ref$allowClear = _ref.allowClear,
88
- allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
89
- _ref$allowSearch = _ref.allowSearch,
90
- allowSearch = _ref$allowSearch === void 0 ? true : _ref$allowSearch,
91
- disabled = _ref.disabled,
92
- _ref$placeholder = _ref.placeholder,
93
- placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
94
- fullWidth = _ref.fullWidth,
95
- large = _ref.large,
96
- fill = _ref.fill,
97
- fillReverse = _ref.fillReverse,
98
- onBlur = _ref.onBlur,
99
- onSearch = _ref.onSearch;
100
-
101
- var _useTranslation = (0, _reactI18next.useTranslation)(),
102
- t = _useTranslation.t;
103
-
104
- var _useState = (0, _react.useState)((0, _lodash.default)('select-')),
105
- _useState2 = _slicedToArray(_useState, 1),
106
- id = _useState2[0];
107
-
108
- var _useState3 = (0, _react.useState)((0, _lodash.default)('allOptons-')),
109
- _useState4 = _slicedToArray(_useState3, 1),
110
- allOptionId = _useState4[0];
111
-
112
- var _useState5 = (0, _react.useState)(false),
113
- _useState6 = _slicedToArray(_useState5, 2),
114
- display = _useState6[0],
115
- setDisplay = _useState6[1];
116
-
117
- var _useState7 = (0, _react.useState)(null),
118
- _useState8 = _slicedToArray(_useState7, 2),
119
- comboboxElement = _useState8[0],
120
- setComboboxElement = _useState8[1];
121
-
122
- var _useState9 = (0, _react.useState)(null),
123
- _useState10 = _slicedToArray(_useState9, 2),
124
- listBoxElement = _useState10[0],
125
- setListBoxElement = _useState10[1];
126
-
127
- var optionsElementRef = (0, _react.useRef)(null);
128
- var searchBoxElement = (0, _react.useRef)(null);
129
-
130
- var _useState11 = (0, _react.useState)(0),
131
- _useState12 = _slicedToArray(_useState11, 2),
132
- listBoxWidth = _useState12[0],
133
- setListBoxWidth = _useState12[1];
134
-
135
- var _useState13 = (0, _react.useState)([]),
136
- _useState14 = _slicedToArray(_useState13, 2),
137
- optionList = _useState14[0],
138
- setOptionList = _useState14[1];
139
-
140
- var _useState15 = (0, _react.useState)(null),
141
- _useState16 = _slicedToArray(_useState15, 2),
142
- focusedOption = _useState16[0],
143
- setFocusedOption = _useState16[1];
144
-
145
- var _useState17 = (0, _react.useState)(false),
146
- _useState18 = _slicedToArray(_useState17, 2),
147
- isFocusCombobox = _useState18[0],
148
- setIsFocusCombobox = _useState18[1];
149
-
150
- var _useState19 = (0, _react.useState)([]),
151
- _useState20 = _slicedToArray(_useState19, 2),
152
- selectedOptions = _useState20[0],
153
- setSelectedOptions = _useState20[1];
154
-
155
- var _useState21 = (0, _react.useState)(options),
156
- _useState22 = _slicedToArray(_useState21, 2),
157
- filteredOptions = _useState22[0],
158
- setFilteredOptions = _useState22[1];
159
-
160
- var _useState23 = (0, _react.useState)(''),
161
- _useState24 = _slicedToArray(_useState23, 2),
162
- search = _useState24[0],
163
- setSearch = _useState24[1];
164
-
165
- var _useCustomPopper = (0, _hooks.useCustomPopper)(comboboxElement, listBoxElement),
166
- styles = _useCustomPopper.styles,
167
- attributes = _useCustomPopper.attributes,
168
- state = _useCustomPopper.state,
169
- update = _useCustomPopper.update;
170
-
171
- var newOptions = (0, _react.useMemo)(function () {
28
+ const Select = _ref => {
29
+ let {
30
+ options,
31
+ enableSelectAll = false,
32
+ selected,
33
+ onSelect,
34
+ onDeselect,
35
+ multiple = false,
36
+ allowClear = false,
37
+ allowSearch = true,
38
+ disabled,
39
+ placeholder = '',
40
+ fullWidth,
41
+ large,
42
+ fill,
43
+ fillReverse,
44
+ onBlur,
45
+ onSearch
46
+ } = _ref;
47
+ const {
48
+ t
49
+ } = (0, _reactI18next.useTranslation)();
50
+ const [id] = (0, _react.useState)((0, _lodash.default)('select-'));
51
+ const [allOptionId] = (0, _react.useState)((0, _lodash.default)('allOptons-'));
52
+ const [display, setDisplay] = (0, _react.useState)(false);
53
+ const [comboboxElement, setComboboxElement] = (0, _react.useState)(null);
54
+ const [listBoxElement, setListBoxElement] = (0, _react.useState)(null);
55
+ const optionsElementRef = (0, _react.useRef)(null);
56
+ const searchBoxElement = (0, _react.useRef)(null);
57
+ const [listBoxWidth, setListBoxWidth] = (0, _react.useState)(0);
58
+ const [optionList, setOptionList] = (0, _react.useState)([]);
59
+ const [focusedOption, setFocusedOption] = (0, _react.useState)(null);
60
+ const [isFocusCombobox, setIsFocusCombobox] = (0, _react.useState)(false);
61
+ const [selectedOptions, setSelectedOptions] = (0, _react.useState)([]);
62
+ const [filteredOptions, setFilteredOptions] = (0, _react.useState)(options);
63
+ const [search, setSearch] = (0, _react.useState)('');
64
+ const {
65
+ styles,
66
+ attributes,
67
+ state,
68
+ update
69
+ } = (0, _hooks.useCustomPopper)(comboboxElement, listBoxElement);
70
+ const newOptions = (0, _react.useMemo)(() => {
172
71
  if (!options) return;
173
-
174
- var newOptions = _toConsumableArray(options);
175
-
72
+ const newOptions = [...options];
176
73
  if (options.length > 0 && multiple && enableSelectAll) {
177
74
  newOptions.unshift({
178
75
  id: allOptionId,
179
76
  text: t('All')
180
77
  });
181
78
  }
182
-
183
79
  return newOptions;
184
- }, [options, multiple, enableSelectAll, allOptionId]); // parse all value to string
185
- // for subsequently determine whether it is a selected item
80
+ }, [options, multiple, enableSelectAll, allOptionId]);
186
81
 
187
- var parsedSelected = (0, _react.useMemo)(function () {
82
+ // parse all value to string
83
+ // for subsequently determine whether it is a selected item
84
+ const parsedSelected = (0, _react.useMemo)(() => {
188
85
  if (selected || selected === 0) {
189
86
  // multiple value
190
87
  if (Array.isArray(selected)) {
191
- return selected.map(function (value) {
192
- return value.toString();
193
- });
194
- } // single value
195
-
88
+ return selected.map(value => value.toString());
89
+ }
196
90
 
91
+ // single value
197
92
  return selected.toString();
198
93
  }
199
-
200
94
  return '';
201
95
  }, [selected]);
202
- var selectedAllOptions = (0, _react.useMemo)(function () {
96
+ const selectedAllOptions = (0, _react.useMemo)(() => {
203
97
  if (multiple && enableSelectAll && parsedSelected.length + 1 === newOptions.length) {
204
- var _selectedAllOptions = _toConsumableArray(parsedSelected);
205
-
206
- _selectedAllOptions.unshift(allOptionId);
207
-
208
- return _selectedAllOptions;
98
+ const selectedAllOptions = [...parsedSelected];
99
+ selectedAllOptions.unshift(allOptionId);
100
+ return selectedAllOptions;
209
101
  }
210
-
211
102
  return parsedSelected;
212
- }, [multiple, enableSelectAll, newOptions.length, parsedSelected, allOptionId]); // set focused option
103
+ }, [multiple, enableSelectAll, newOptions.length, parsedSelected, allOptionId]);
213
104
 
214
- var handleFocusItem = (0, _react.useCallback)(function (element) {
105
+ // set focused option
106
+ const handleFocusItem = (0, _react.useCallback)(element => {
215
107
  if (!optionsElementRef.current) return;
216
108
  setFocusedOption(element);
217
- var container = optionsElementRef.current;
218
-
109
+ const container = optionsElementRef.current;
219
110
  if (container.scrollHeight > container.clientHeight) {
220
- var scrollBottom = container.clientHeight + container.scrollTop;
221
- var elementBottom = element.offsetTop + element.offsetHeight;
222
-
111
+ const scrollBottom = container.clientHeight + container.scrollTop;
112
+ const elementBottom = element.offsetTop + element.offsetHeight;
223
113
  if (elementBottom > scrollBottom) {
224
114
  container.scrollTop = elementBottom - container.clientHeight;
225
115
  } else if (element.offsetTop < container.scrollTop) {
@@ -227,17 +117,15 @@ var Select = function Select(_ref) {
227
117
  }
228
118
  }
229
119
  }, []);
230
- var focusFirstItem = (0, _react.useCallback)(function () {
231
- var firstItem = listBoxElement.querySelector('[role="option"]');
232
-
120
+ const focusFirstItem = (0, _react.useCallback)(() => {
121
+ const firstItem = listBoxElement.querySelector('[role="option"]');
233
122
  if (firstItem) {
234
123
  handleFocusItem(firstItem);
235
124
  }
236
125
  }, [listBoxElement, handleFocusItem]);
237
- var setupFocus = (0, _react.useCallback)(function () {
126
+ const setupFocus = (0, _react.useCallback)(() => {
238
127
  if (!listBoxElement) return;
239
- var selectedItem = listBoxElement.querySelector('[aria-selected="true"]');
240
-
128
+ const selectedItem = listBoxElement.querySelector('[aria-selected="true"]');
241
129
  if (selectedItem) {
242
130
  handleFocusItem(selectedItem);
243
131
  } else if (optionList.length > 0) {
@@ -246,42 +134,36 @@ var Select = function Select(_ref) {
246
134
  setFocusedOption(null);
247
135
  }
248
136
  }, [listBoxElement, handleFocusItem, focusFirstItem, optionList]);
249
- var findPreviousItem = (0, _react.useCallback)(function (currentItem) {
250
- var allItem = _toConsumableArray(listBoxElement.querySelectorAll('[role="option"]'));
251
-
252
- var currentItemIndex = allItem.indexOf(currentItem);
253
- var previousItem = null;
254
-
137
+ const findPreviousItem = (0, _react.useCallback)(currentItem => {
138
+ const allItem = [...listBoxElement.querySelectorAll('[role="option"]')];
139
+ const currentItemIndex = allItem.indexOf(currentItem);
140
+ let previousItem = null;
255
141
  if (currentItemIndex !== -1 && currentItemIndex > 0) {
256
142
  previousItem = allItem[currentItemIndex - 1];
257
143
  }
258
-
259
144
  return previousItem;
260
145
  }, [listBoxElement]);
261
- var findNextItem = (0, _react.useCallback)(function (currentItem) {
262
- var allItem = _toConsumableArray(listBoxElement.querySelectorAll('[role="option"]'));
263
-
264
- var currentItemIndex = allItem.indexOf(currentItem);
265
- var nextItem = null;
266
-
146
+ const findNextItem = (0, _react.useCallback)(currentItem => {
147
+ const allItem = [...listBoxElement.querySelectorAll('[role="option"]')];
148
+ const currentItemIndex = allItem.indexOf(currentItem);
149
+ let nextItem = null;
267
150
  if (currentItemIndex !== -1 && currentItemIndex < allItem.length - 1) {
268
151
  nextItem = allItem[currentItemIndex + 1];
269
152
  }
270
-
271
153
  return nextItem;
272
154
  }, [listBoxElement]);
273
- var handleOnSelect = (0, _react.useCallback)(function (event, value) {
155
+ const handleOnSelect = (0, _react.useCallback)((event, value) => {
274
156
  event.stopPropagation();
275
- if (disabled === true) return; // 選取選項
276
- // 點選 all 全選
157
+ if (disabled === true) return;
277
158
 
159
+ // 選取選項
160
+ // 點選 all 全選
278
161
  if (multiple) {
279
162
  if (value.toString() === allOptionId && selectedAllOptions.length < newOptions.length) {
280
- for (var index = 1; index < newOptions.length; index += 1) {
163
+ for (let index = 1; index < newOptions.length; index += 1) {
281
164
  onSelect(newOptions[index].id);
282
165
  }
283
166
  }
284
-
285
167
  if (value.toString() !== allOptionId && !selectedAllOptions.includes(value.toString())) {
286
168
  // 選取一個選項,變成全選
287
169
  if (selectedAllOptions.length + 2 === newOptions.length) {
@@ -290,16 +172,15 @@ var Select = function Select(_ref) {
290
172
  // 選取特定選項
291
173
  onSelect(value);
292
174
  }
293
- } // 刪除選項
294
- // 點選 all 刪除全選
295
-
175
+ }
296
176
 
177
+ // 刪除選項
178
+ // 點選 all 刪除全選
297
179
  if (value.toString() === allOptionId && selectedAllOptions.length === newOptions.length) {
298
- for (var _index = 0; _index < newOptions.length; _index += 1) {
299
- onDeselect(newOptions[_index].id);
180
+ for (let index = 0; index < newOptions.length; index += 1) {
181
+ onDeselect(newOptions[index].id);
300
182
  }
301
183
  }
302
-
303
184
  if (value.toString() !== allOptionId && selectedAllOptions.includes(value.toString())) {
304
185
  // 原本是 all 全選後來刪除其中一個選項
305
186
  if (selectedAllOptions.length === newOptions.length) {
@@ -309,23 +190,20 @@ var Select = function Select(_ref) {
309
190
  onDeselect(value);
310
191
  }
311
192
  }
312
-
313
193
  setDisplay(true);
314
194
  } else {
315
195
  onSelect(value);
316
196
  setDisplay(false);
317
197
  }
318
-
319
198
  comboboxElement.focus();
320
199
  setSearch('');
321
200
  }, [disabled, onSelect, comboboxElement, selectedAllOptions, onDeselect, newOptions, allOptionId, multiple]);
322
- var handleOnDeselect = (0, _react.useCallback)(function (event, value) {
201
+ const handleOnDeselect = (0, _react.useCallback)((event, value) => {
323
202
  event.stopPropagation();
324
203
  if (disabled === true) return;
325
-
326
204
  if (multiple) {
327
205
  if (value.toString() === allOptionId) {
328
- for (var index = 0; index < optionList.length; index += 1) {
206
+ for (let index = 0; index < optionList.length; index += 1) {
329
207
  onDeselect(optionList[index].id);
330
208
  }
331
209
  } else {
@@ -334,42 +212,36 @@ var Select = function Select(_ref) {
334
212
  } else {
335
213
  onDeselect(value);
336
214
  }
337
- }, [disabled, onDeselect, optionList, allOptionId, multiple]); // list all selected option
215
+ }, [disabled, onDeselect, optionList, allOptionId, multiple]);
338
216
 
339
- var selectedItem = (0, _react.useMemo)(function () {
217
+ // list all selected option
218
+ const selectedItem = (0, _react.useMemo)(() => {
340
219
  if (selectedOptions.length > 0) {
341
220
  if (multiple) {
342
221
  if (selectedOptions[0].id === allOptionId) {
343
222
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectedMultiple.default, {
344
223
  content: selectedOptions[0].text,
345
- onClick: function onClick(event) {
346
- return handleOnDeselect(event, selectedOptions[0].id);
347
- },
224
+ onClick: event => handleOnDeselect(event, selectedOptions[0].id),
348
225
  disabled: disabled
349
226
  }, selectedOptions[0].id);
350
227
  }
351
-
352
- return selectedOptions.map(function (value) {
228
+ return selectedOptions.map(value => {
353
229
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectedMultiple.default, {
354
230
  content: value.text,
355
- onClick: function onClick(event) {
356
- return handleOnDeselect(event, value.id);
357
- },
231
+ onClick: event => handleOnDeselect(event, value.id),
358
232
  disabled: disabled
359
233
  }, value.id);
360
234
  });
361
235
  }
362
-
363
236
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectedSingle.default, {
364
237
  children: selectedOptions[0].text
365
238
  });
366
239
  }
367
-
368
240
  return placeholder;
369
241
  }, [placeholder, handleOnDeselect, multiple, selectedOptions, disabled, allOptionId]);
370
- var optionItem = (0, _react.useMemo)(function () {
242
+ const optionItem = (0, _react.useMemo)(() => {
371
243
  if (optionList.length <= 0) return null;
372
- return optionList.map(function (option) {
244
+ return optionList.map(option => {
373
245
  if (option.child && option.child.length > 0) {
374
246
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OptionGroup.default, {
375
247
  "aria-labelledby": option.text,
@@ -377,14 +249,12 @@ var Select = function Select(_ref) {
377
249
  role: "presentation",
378
250
  id: option.text,
379
251
  children: option.text
380
- }), option.child.map(function (option) {
252
+ }), option.child.map(option => {
381
253
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Option.default, {
382
254
  role: "option",
383
255
  tabIndex: "0",
384
256
  id: option.id,
385
- onClick: function onClick(event) {
386
- return handleOnSelect(event, option.id);
387
- },
257
+ onClick: event => handleOnSelect(event, option.id),
388
258
  focus: focusedOption && focusedOption.id === option.id.toString(),
389
259
  selected: option.selected,
390
260
  "aria-selected": option.selected,
@@ -393,39 +263,34 @@ var Select = function Select(_ref) {
393
263
  })]
394
264
  }, option.text);
395
265
  }
396
-
397
266
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Option.default, {
398
267
  role: "option",
399
268
  tabIndex: "0",
400
269
  id: option.id,
401
- onClick: function onClick(event) {
402
- return handleOnSelect(event, option.id);
403
- },
270
+ onClick: event => handleOnSelect(event, option.id),
404
271
  focus: focusedOption && focusedOption.id === option.id.toString(),
405
272
  selected: option.selected,
406
273
  "aria-selected": option.selected,
407
274
  children: option.text
408
275
  }, option.id);
409
276
  });
410
- }, [optionList, focusedOption, handleOnSelect]); // show or hide listbox
411
- // and set listbox width according to combobox current width
277
+ }, [optionList, focusedOption, handleOnSelect]);
412
278
 
413
- var handleToggle = function handleToggle() {
279
+ // show or hide listbox
280
+ // and set listbox width according to combobox current width
281
+ const handleToggle = () => {
414
282
  if (disabled === true) return;
415
- var tmpDisplay = !display;
416
-
283
+ const tmpDisplay = !display;
417
284
  if (!tmpDisplay) {
418
285
  setFocusedOption(null);
419
286
  }
420
-
421
287
  setDisplay(tmpDisplay);
422
288
  update();
423
- }; // handle keyboard interaction
424
-
425
-
426
- var handleKeyUp = function handleKeyUp(event) {
427
- var key = event.keyCode;
289
+ };
428
290
 
291
+ // handle keyboard interaction
292
+ const handleKeyUp = event => {
293
+ const key = event.keyCode;
429
294
  switch (key) {
430
295
  case _utils.KEY_CODE.ENTER:
431
296
  if (!display) {
@@ -433,71 +298,53 @@ var Select = function Select(_ref) {
433
298
  } else if (focusedOption) {
434
299
  handleOnSelect(event, focusedOption.id);
435
300
  }
436
-
437
301
  break;
438
-
439
302
  case _utils.KEY_CODE.ESCAPE:
440
303
  if (display) {
441
304
  handleToggle();
442
305
  }
443
-
444
306
  break;
445
-
446
307
  case _utils.KEY_CODE.UP:
447
308
  {
448
309
  if (!focusedOption) {
449
310
  return;
450
311
  }
451
-
452
- var previousItem = findPreviousItem(focusedOption);
453
-
312
+ const previousItem = findPreviousItem(focusedOption);
454
313
  if (previousItem) {
455
314
  handleFocusItem(previousItem);
456
315
  }
457
-
458
316
  break;
459
317
  }
460
-
461
318
  case _utils.KEY_CODE.DOWN:
462
319
  {
463
320
  if (!focusedOption) {
464
321
  return;
465
322
  }
466
-
467
- var nextItem = findNextItem(focusedOption);
468
-
323
+ const nextItem = findNextItem(focusedOption);
469
324
  if (nextItem) {
470
325
  handleFocusItem(nextItem);
471
326
  }
472
-
473
327
  break;
474
328
  }
475
-
476
329
  case _utils.KEY_CODE.END:
477
330
  {
478
331
  event.preventDefault();
479
- var itemList = listBoxElement.querySelectorAll('[role="option"]');
480
-
332
+ const itemList = listBoxElement.querySelectorAll('[role="option"]');
481
333
  if (itemList.length) {
482
334
  handleFocusItem(itemList[itemList.length - 1]);
483
335
  }
484
-
485
336
  break;
486
337
  }
487
-
488
338
  case _utils.KEY_CODE.HOME:
489
339
  event.preventDefault();
490
340
  focusFirstItem();
491
341
  break;
492
-
493
342
  default:
494
343
  break;
495
344
  }
496
345
  };
497
-
498
- var handleKeyDown = function handleKeyDown(event) {
499
- var key = event.keyCode;
500
-
346
+ const handleKeyDown = event => {
347
+ const key = event.keyCode;
501
348
  switch (key) {
502
349
  case _utils.KEY_CODE.ENTER:
503
350
  case _utils.KEY_CODE.ESCAPE:
@@ -507,34 +354,31 @@ var Select = function Select(_ref) {
507
354
  case _utils.KEY_CODE.HOME:
508
355
  event.preventDefault();
509
356
  break;
510
-
511
357
  default:
512
358
  break;
513
359
  }
514
- }; // handle search keyword change
515
-
360
+ };
516
361
 
517
- var handleSearchChange = function handleSearchChange(event) {
362
+ // handle search keyword change
363
+ const handleSearchChange = event => {
518
364
  if (onSearch) {
519
365
  onSearch(event.target.value);
520
366
  }
521
-
522
367
  setSearch(event.target.value);
523
368
  };
524
-
525
- var handleFocus = function handleFocus(event) {
369
+ const handleFocus = event => {
526
370
  event.preventDefault();
527
371
  event.stopPropagation();
528
372
  setIsFocusCombobox(true);
529
- }; // determine selected option(s)
530
-
373
+ };
531
374
 
532
- (0, _react.useEffect)(function () {
375
+ // determine selected option(s)
376
+ (0, _react.useEffect)(() => {
533
377
  if (!newOptions) return;
534
- var tmpSelectedOptions = [];
535
- newOptions.forEach(function (option) {
378
+ const tmpSelectedOptions = [];
379
+ newOptions.forEach(option => {
536
380
  if (option.child && option.child.length > 0) {
537
- option.child.forEach(function (option) {
381
+ option.child.forEach(option => {
538
382
  if (multiple && selectedAllOptions.includes(option.id.toString())) {
539
383
  tmpSelectedOptions.push(option);
540
384
  } else if (selectedAllOptions === option.id.toString()) {
@@ -548,99 +392,87 @@ var Select = function Select(_ref) {
548
392
  tmpSelectedOptions.push(option);
549
393
  }
550
394
  }
551
-
552
395
  return false;
553
396
  });
554
397
  setSelectedOptions(tmpSelectedOptions);
555
398
  }, [newOptions, selectedAllOptions, multiple]);
556
- (0, _react.useEffect)(function () {
399
+ (0, _react.useEffect)(() => {
557
400
  if (update) {
558
- setTimeout(function () {
401
+ setTimeout(() => {
559
402
  update();
560
403
  }, 100);
561
404
  }
562
- }, [update, listBoxWidth]); // observe element resized
405
+ }, [update, listBoxWidth]);
563
406
 
564
- (0, _react.useEffect)(function () {
407
+ // observe element resized
408
+ (0, _react.useEffect)(() => {
565
409
  if (!comboboxElement) return;
566
- var resizeObserverInstance = new ResizeObserver(function (entries) {
567
- var _iterator = _createForOfIteratorHelper(entries),
568
- _step;
569
-
570
- try {
571
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
572
- var entry = _step.value;
573
-
574
- if (entry.target) {
575
- var borderBoxSize = entry.target.clientWidth;
576
- setListBoxWidth(borderBoxSize);
577
- }
410
+ const resizeObserverInstance = new ResizeObserver(entries => {
411
+ for (const entry of entries) {
412
+ if (entry.target) {
413
+ const borderBoxSize = entry.target.clientWidth;
414
+ setListBoxWidth(borderBoxSize);
578
415
  }
579
- } catch (err) {
580
- _iterator.e(err);
581
- } finally {
582
- _iterator.f();
583
416
  }
584
417
  });
585
418
  resizeObserverInstance.observe(comboboxElement);
586
- return function () {
419
+ return () => {
587
420
  // unobserve element
588
421
  resizeObserverInstance.unobserve(comboboxElement);
589
422
  };
590
- }, [comboboxElement]); // re-setup focus when option list changed and update popper position
423
+ }, [comboboxElement]);
591
424
 
592
- (0, _react.useEffect)(function () {
425
+ // re-setup focus when option list changed and update popper position
426
+ (0, _react.useEffect)(() => {
593
427
  setupFocus();
594
428
  if (update) update();
595
- }, [setupFocus, optionList, update]); // parse option list when filtered options change
429
+ }, [setupFocus, optionList, update]);
596
430
 
597
- (0, _react.useEffect)(function () {
431
+ // parse option list when filtered options change
432
+ (0, _react.useEffect)(() => {
598
433
  if (!filteredOptions) return;
599
- setOptionList(filteredOptions.map(function (option) {
434
+ setOptionList(filteredOptions.map(option => {
600
435
  if (option.child && option.child.length > 0) {
601
- return _objectSpread(_objectSpread({}, option), {}, {
602
- child: option.child.map(function (option) {
603
- var selected = false;
604
-
436
+ return {
437
+ ...option,
438
+ child: option.child.map(option => {
439
+ let selected = false;
605
440
  if (multiple && selectedAllOptions.includes(option.id.toString())) {
606
441
  selected = true;
607
442
  } else if (selectedAllOptions === option.id.toString()) {
608
443
  selected = true;
609
444
  }
610
-
611
- return _objectSpread(_objectSpread({}, option), {}, {
612
- selected: selected
613
- });
445
+ return {
446
+ ...option,
447
+ selected
448
+ };
614
449
  })
615
- });
450
+ };
616
451
  }
617
-
618
- var selected = false;
619
-
452
+ let selected = false;
620
453
  if (multiple && selectedAllOptions.includes(option.id.toString())) {
621
454
  selected = true;
622
455
  } else if (selectedAllOptions === option.id.toString()) {
623
456
  selected = true;
624
457
  }
625
-
626
- return _objectSpread(_objectSpread({}, option), {}, {
627
- selected: selected
628
- });
458
+ return {
459
+ ...option,
460
+ selected
461
+ };
629
462
  }));
630
- }, [filteredOptions, multiple, selectedAllOptions]); // filter options on search keyword changed
463
+ }, [filteredOptions, multiple, selectedAllOptions]);
631
464
 
632
- (0, _react.useEffect)(function () {
633
- var tmpFilteredOptions = [];
634
- newOptions.forEach(function (option) {
465
+ // filter options on search keyword changed
466
+ (0, _react.useEffect)(() => {
467
+ const tmpFilteredOptions = [];
468
+ newOptions.forEach(option => {
635
469
  if (option.child && option.child.length > 0) {
636
- var tmpFilteredChildOptions = option.child.filter(function (option) {
637
- return option.text.toLowerCase().indexOf(search.toLowerCase().trim()) !== -1;
638
- });
639
-
470
+ const tmpFilteredChildOptions = option.child.filter(option => option.text.toLowerCase().indexOf(search.toLowerCase().trim()) !== -1);
640
471
  if (tmpFilteredChildOptions.length > 0) {
641
- tmpFilteredOptions.push(_objectSpread(_objectSpread({}, option), {}, {
472
+ tmpFilteredOptions.push({
473
+ ...option,
642
474
  child: tmpFilteredChildOptions
643
- }));
475
+ });
644
476
  }
645
477
  } else if (option.text.toLowerCase().indexOf(search.toLowerCase().trim()) !== -1) {
646
478
  tmpFilteredOptions.push(option);
@@ -648,17 +480,16 @@ var Select = function Select(_ref) {
648
480
  });
649
481
  setFilteredOptions(tmpFilteredOptions);
650
482
  }, [search, newOptions]);
651
- (0, _react.useEffect)(function () {
483
+ (0, _react.useEffect)(() => {
652
484
  if (display) {
653
485
  setupFocus();
654
-
655
486
  if (allowSearch) {
656
487
  searchBoxElement.current.focus();
657
488
  }
658
489
  }
659
490
  }, [setupFocus, display, allowSearch]);
660
491
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactOutsideClickHandler.default, {
661
- onOutsideClick: function onOutsideClick() {
492
+ onOutsideClick: () => {
662
493
  setDisplay(false);
663
494
  if (onBlur) onBlur();
664
495
  setIsFocusCombobox(false);
@@ -683,14 +514,14 @@ var Select = function Select(_ref) {
683
514
  onFocus: handleFocus,
684
515
  placeholder: placeholder,
685
516
  children: [selectedItem, selectedOptions.length > 0 && !multiple && !disabled && allowClear && /*#__PURE__*/(0, _jsxRuntime.jsx)(CloseButton, {
686
- onClick: function onClick() {
517
+ onClick: () => {
687
518
  onSelect('');
688
519
  }
689
520
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandArrow, {
690
521
  "aria-haspopup": "listbox",
691
522
  "aria-expanded": display
692
523
  })]
693
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListBox.default, _objectSpread(_objectSpread({
524
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ListBox.default, {
694
525
  role: "listbox",
695
526
  tabIndex: "0",
696
527
  id: id,
@@ -699,8 +530,8 @@ var Select = function Select(_ref) {
699
530
  onKeyDown: handleKeyDown,
700
531
  width: listBoxWidth,
701
532
  $display: display,
702
- style: styles.popper
703
- }, attributes.popper), {}, {
533
+ style: styles.popper,
534
+ ...attributes.popper,
704
535
  placement: state && state.placement,
705
536
  children: [allowSearch && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SearchBox.default, {
706
537
  ref: searchBoxElement,
@@ -714,44 +545,55 @@ var Select = function Select(_ref) {
714
545
  children: "No results found"
715
546
  })
716
547
  })]
717
- }))]
548
+ })]
718
549
  });
719
550
  };
720
-
721
- var Combobox = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n min-height: 36px;\n min-width: 160px;\n cursor: pointer;\n position: relative;\n background: transparent;\n color: var(--font-on-background);\n font-size: var(--font-body1);\n border: var(--border-width) solid var(--border-color);\n border-radius: var(--border-radius-l);\n padding: 0 calc(var(--spacing-s) * 2 + 8px) 0 var(--spacing-s);\n\n &:focus {\n ", ";\n }\n\n ", "\n\n ", "\n ", "\n \n ", ";\n\n ", "\n\n ", "\n\n ", "\n"])), function (_ref2) {
722
- var disabled = _ref2.disabled;
551
+ const Combobox = _styledComponents.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n min-height: 36px;\n min-width: 160px;\n cursor: pointer;\n position: relative;\n background: transparent;\n color: var(--font-on-background);\n font-size: var(--font-body1);\n border: var(--border-width) solid var(--border-color);\n border-radius: var(--border-radius-l);\n padding: 0 calc(var(--spacing-s) * 2 + 8px) 0 var(--spacing-s);\n\n &:focus {\n ", ";\n }\n\n ", "\n\n ", "\n ", "\n \n ", ";\n\n ", "\n\n ", "\n\n ", "\n"])), _ref2 => {
552
+ let {
553
+ disabled
554
+ } = _ref2;
723
555
  return !disabled && "\n border-color: var(--color-primary);\n outline: none;\n ";
724
- }, function (_ref3) {
725
- var $display = _ref3.$display;
556
+ }, _ref3 => {
557
+ let {
558
+ $display
559
+ } = _ref3;
726
560
  return $display && "\n border-color: var(--color-primary);\n outline: none;\n ";
727
- }, function (_ref4) {
728
- var disabled = _ref4.disabled;
561
+ }, _ref4 => {
562
+ let {
563
+ disabled
564
+ } = _ref4;
729
565
  return disabled && 'cursor: not-allowed;opacity: 0.5;';
730
- }, function (_ref5) {
731
- var placeholder = _ref5.placeholder;
566
+ }, _ref5 => {
567
+ let {
568
+ placeholder
569
+ } = _ref5;
732
570
  return placeholder && 'color: var(--font-on-mute);';
733
- }, function (_ref6) {
734
- var fullWidth = _ref6.fullWidth;
571
+ }, _ref6 => {
572
+ let {
573
+ fullWidth
574
+ } = _ref6;
735
575
  return fullWidth ? 'width: 100%' : 'max-width: 320px';
736
- }, function (_ref7) {
737
- var large = _ref7.large;
576
+ }, _ref7 => {
577
+ let {
578
+ large
579
+ } = _ref7;
738
580
  return large && "\n height: 40px;\n padding: 12px calc(var(--spacing-s) * 2 + 8px) 12px var(--spacing-s);\n ";
739
- }, function (_ref8) {
740
- var $fill = _ref8.$fill;
581
+ }, _ref8 => {
582
+ let {
583
+ $fill
584
+ } = _ref8;
741
585
  return $fill && "\n background: var(--color-background2);\n border-color: transparent;\n ";
742
- }, function (_ref9) {
743
- var fillReverse = _ref9.fillReverse;
586
+ }, _ref9 => {
587
+ let {
588
+ fillReverse
589
+ } = _ref9;
744
590
  return fillReverse && "\n background: var(--color-background1);\n border-color: transparent;\n ";
745
591
  });
746
-
747
592
  Combobox.displayName = 'Combobox';
748
- var CloseButton = (0, _styledComponents.default)(_md.MdClose)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: var(--color-primary);\n font-size: var(--font-body1);\n right: var(--spacing-l);\n\n ", ";\n"])), _media.default.tablet(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n right: calc(var(--spacing) + var(--spacing-s));\n "]))));
593
+ const CloseButton = (0, _styledComponents.default)(_md.MdClose)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: var(--color-primary);\n font-size: var(--font-body1);\n right: var(--spacing-l);\n\n ", ";\n"])), _media.default.tablet(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n right: calc(var(--spacing) + var(--spacing-s));\n "]))));
749
594
  CloseButton.displayName = 'CloseButton';
750
- var ExpandArrow = (0, _styledComponents.default)(_ti.TiArrowSortedDown)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: var(--color-primary);\n font-size: var(--font-body1);\n right: var(--spacing-s);\n"])));
595
+ const ExpandArrow = (0, _styledComponents.default)(_ti.TiArrowSortedDown)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n color: var(--color-primary);\n font-size: var(--font-body1);\n right: var(--spacing-s);\n"])));
751
596
  ExpandArrow.displayName = 'ExpandArrow';
752
-
753
- var Message = _styledComponents.default.p(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 12px var(--spacing-s);\n"])));
754
-
597
+ const Message = _styledComponents.default.p(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 12px var(--spacing-s);\n"])));
755
598
  Message.displayName = 'Message';
756
- var _default = Select;
757
- exports.default = _default;
599
+ var _default = exports.default = Select;