@jobber/components 9.5.3 → 9.6.0

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 (178) hide show
  1. package/Combobox.d.ts +1 -0
  2. package/Combobox.js +17 -0
  3. package/dist/Autocomplete/index.cjs +0 -2
  4. package/dist/Autocomplete/index.mjs +0 -2
  5. package/dist/Autocomplete-cjs.js +4 -5
  6. package/dist/Autocomplete-es.js +1 -2
  7. package/dist/Card/index.cjs +2 -2
  8. package/dist/Card/index.mjs +2 -2
  9. package/dist/Chip/index.cjs +0 -2
  10. package/dist/Chip/index.mjs +0 -2
  11. package/dist/Chips/InternalChipDismissible/hooks/index.cjs +0 -2
  12. package/dist/Chips/InternalChipDismissible/hooks/index.mjs +0 -2
  13. package/dist/Chips/InternalChipDismissible/index.cjs +0 -2
  14. package/dist/Chips/InternalChipDismissible/index.mjs +0 -2
  15. package/dist/Chips/index.cjs +0 -2
  16. package/dist/Chips/index.mjs +0 -2
  17. package/dist/Combobox/Combobox.contentSlots.d.ts +5 -0
  18. package/dist/Combobox/Combobox.context.d.ts +34 -0
  19. package/dist/Combobox/Combobox.d.ts +69 -0
  20. package/dist/Combobox/Combobox.footer.d.ts +7 -0
  21. package/dist/Combobox/Combobox.items.d.ts +25 -0
  22. package/dist/Combobox/Combobox.responsive.d.ts +54 -0
  23. package/dist/Combobox/Combobox.selectAll.d.ts +4 -0
  24. package/dist/Combobox/Combobox.slotFactory.d.ts +7 -0
  25. package/dist/Combobox/Combobox.testUtils.d.ts +12 -0
  26. package/dist/Combobox/Combobox.types.d.ts +166 -0
  27. package/dist/Combobox/index.cjs +35 -0
  28. package/dist/Combobox/index.d.ts +2 -0
  29. package/dist/Combobox/index.mjs +29 -0
  30. package/dist/Combobox-cjs.js +675 -0
  31. package/dist/Combobox-es.js +673 -0
  32. package/dist/ComboboxPrimitive-cjs.js +88 -47
  33. package/dist/ComboboxPrimitive-es.js +39 -23
  34. package/dist/{ComboboxChipRemove-cjs.js → ComboboxSeparator-cjs.js} +501 -455
  35. package/dist/{ComboboxChipRemove-es.js → ComboboxSeparator-es.js} +500 -456
  36. package/dist/ConfirmationModal/index.cjs +0 -2
  37. package/dist/ConfirmationModal/index.mjs +0 -2
  38. package/dist/ContentBlock/index.cjs +1 -0
  39. package/dist/ContentBlock/index.mjs +1 -0
  40. package/dist/ContentBlock-cjs.js +2 -18
  41. package/dist/ContentBlock-es.js +1 -17
  42. package/dist/DataDump/index.cjs +2 -2
  43. package/dist/DataDump/index.mjs +2 -2
  44. package/dist/DataList/components/DataListActions/index.cjs +0 -2
  45. package/dist/DataList/components/DataListActions/index.mjs +0 -2
  46. package/dist/DataList/components/DataListBulkActions/index.cjs +0 -2
  47. package/dist/DataList/components/DataListBulkActions/index.mjs +0 -2
  48. package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +0 -2
  49. package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +0 -2
  50. package/dist/DataList/components/DataListFilters/index.cjs +0 -2
  51. package/dist/DataList/components/DataListFilters/index.mjs +0 -2
  52. package/dist/DataList/components/DataListHeader/index.cjs +0 -2
  53. package/dist/DataList/components/DataListHeader/index.mjs +0 -2
  54. package/dist/DataList/components/DataListItem/index.cjs +0 -2
  55. package/dist/DataList/components/DataListItem/index.mjs +0 -2
  56. package/dist/DataList/components/DataListItemActions/index.cjs +0 -2
  57. package/dist/DataList/components/DataListItemActions/index.mjs +0 -2
  58. package/dist/DataList/components/DataListItemActionsOverflow/index.cjs +0 -2
  59. package/dist/DataList/components/DataListItemActionsOverflow/index.mjs +0 -2
  60. package/dist/DataList/components/DataListItems/index.cjs +0 -2
  61. package/dist/DataList/components/DataListItems/index.mjs +0 -2
  62. package/dist/DataList/components/DataListLayout/index.cjs +0 -2
  63. package/dist/DataList/components/DataListLayout/index.mjs +0 -2
  64. package/dist/DataList/components/DataListLayoutActions/index.cjs +0 -2
  65. package/dist/DataList/components/DataListLayoutActions/index.mjs +0 -2
  66. package/dist/DataList/index.cjs +0 -2
  67. package/dist/DataList/index.mjs +0 -2
  68. package/dist/DatePicker/index.cjs +0 -2
  69. package/dist/DatePicker/index.mjs +0 -2
  70. package/dist/DatePicker-cjs.js +4 -5
  71. package/dist/DatePicker-es.js +1 -2
  72. package/dist/Dialog/index.cjs +2 -2
  73. package/dist/Dialog/index.mjs +2 -2
  74. package/dist/DrawerDescription-cjs.js +268 -99
  75. package/dist/DrawerDescription-es.js +270 -103
  76. package/dist/DrawerTitle-cjs.js +2 -6
  77. package/dist/DrawerTitle-es.js +3 -7
  78. package/dist/FieldDescription-cjs.js +184 -181
  79. package/dist/FieldDescription-es.js +187 -184
  80. package/dist/FilterPicker/components/FilterPickerActivator/index.cjs +0 -2
  81. package/dist/FilterPicker/components/FilterPickerActivator/index.mjs +0 -2
  82. package/dist/FilterPicker/components/FilterPickerContent/index.cjs +0 -2
  83. package/dist/FilterPicker/components/FilterPickerContent/index.mjs +0 -2
  84. package/dist/FilterPicker/components/FilterPickerTrigger/index.cjs +0 -2
  85. package/dist/FilterPicker/components/FilterPickerTrigger/index.mjs +0 -2
  86. package/dist/FilterPicker/index.cjs +0 -2
  87. package/dist/FilterPicker/index.mjs +0 -2
  88. package/dist/FilterPickerContent-cjs.js +4 -5
  89. package/dist/FilterPickerContent-es.js +1 -2
  90. package/dist/FormatFile/index.cjs +0 -2
  91. package/dist/FormatFile/index.mjs +0 -2
  92. package/dist/Gallery/index.cjs +0 -2
  93. package/dist/Gallery/index.mjs +0 -2
  94. package/dist/InputDate/index.cjs +0 -2
  95. package/dist/InputDate/index.mjs +0 -2
  96. package/dist/InputNumber/index.cjs +2 -2
  97. package/dist/InputNumber/index.mjs +2 -2
  98. package/dist/InputNumber/types.d.ts +5 -0
  99. package/dist/InputNumber-cjs.js +2 -2
  100. package/dist/InputNumber-es.js +2 -2
  101. package/dist/LightBox/index.cjs +0 -2
  102. package/dist/LightBox/index.mjs +0 -2
  103. package/dist/Menu/index.cjs +2 -2
  104. package/dist/Menu/index.mjs +2 -2
  105. package/dist/Menu-cjs.js +4 -5
  106. package/dist/Menu-es.js +1 -2
  107. package/dist/MenuSubmenuTrigger-cjs.js +206 -164
  108. package/dist/MenuSubmenuTrigger-es.js +194 -152
  109. package/dist/Modal/index.cjs +0 -2
  110. package/dist/Modal/index.mjs +1 -3
  111. package/dist/NumberFieldInput-cjs.js +187 -308
  112. package/dist/NumberFieldInput-es.js +187 -308
  113. package/dist/Page/index.cjs +2 -2
  114. package/dist/Page/index.mjs +2 -2
  115. package/dist/Popover/index.cjs +0 -2
  116. package/dist/Popover/index.mjs +0 -2
  117. package/dist/Popover-cjs.js +7 -8
  118. package/dist/Popover-es.js +1 -2
  119. package/dist/ScrollAreaViewport-cjs.js +747 -1093
  120. package/dist/ScrollAreaViewport-es.js +734 -1081
  121. package/dist/Select/index.cjs +2 -2
  122. package/dist/Select/index.mjs +2 -2
  123. package/dist/SelectGroupLabel-cjs.js +207 -306
  124. package/dist/SelectGroupLabel-es.js +203 -302
  125. package/dist/SelectPrimitive-cjs.js +11 -17
  126. package/dist/SelectPrimitive-es.js +1 -7
  127. package/dist/Tooltip/index.cjs +0 -2
  128. package/dist/Tooltip/index.mjs +0 -2
  129. package/dist/Tooltip-cjs.js +6 -7
  130. package/dist/Tooltip-es.js +1 -2
  131. package/dist/buttonRenderAdapter-cjs.js +2 -1
  132. package/dist/buttonRenderAdapter-es.js +2 -1
  133. package/dist/dialogReturnFocus-cjs.js +1 -1
  134. package/dist/dialogReturnFocus-es.js +2 -2
  135. package/dist/docs/InputNumber/InputNumber.md +2 -2
  136. package/dist/docs/SelectPrimitive/SelectPrimitive.md +1 -1
  137. package/dist/floating-ui.react-cjs.js +2557 -185
  138. package/dist/floating-ui.react-es.js +2512 -149
  139. package/dist/getMappedBreakpointWidth-cjs.js +21 -0
  140. package/dist/getMappedBreakpointWidth-es.js +18 -0
  141. package/dist/index.cjs +15 -10
  142. package/dist/index.d.mts +1 -0
  143. package/dist/index.d.ts +1 -0
  144. package/dist/index.mjs +14 -10
  145. package/dist/mergeClassName-cjs.js +12 -0
  146. package/dist/mergeClassName-es.js +10 -0
  147. package/dist/primitives/BottomSheet/index.cjs +1 -1
  148. package/dist/primitives/BottomSheet/index.mjs +1 -1
  149. package/dist/primitives/ComboboxPrimitive/ComboboxPrimitive.d.ts +2 -2
  150. package/dist/primitives/ComboboxPrimitive/index.cjs +4 -5
  151. package/dist/primitives/ComboboxPrimitive/index.mjs +4 -5
  152. package/dist/primitives/SelectPrimitive/index.cjs +1 -2
  153. package/dist/primitives/SelectPrimitive/index.mjs +1 -2
  154. package/dist/primitives/index.cjs +3 -3
  155. package/dist/primitives/index.mjs +3 -3
  156. package/dist/scrollEdges-cjs.js +1 -11
  157. package/dist/scrollEdges-es.js +1 -11
  158. package/dist/scrollable-cjs.js +58 -0
  159. package/dist/scrollable-es.js +54 -0
  160. package/dist/styles.css +759 -42
  161. package/dist/unstyledPrimitives/index.cjs +720 -478
  162. package/dist/unstyledPrimitives/index.mjs +663 -421
  163. package/dist/useCompositeListItem-cjs.js +2108 -361
  164. package/dist/useCompositeListItem-es.js +2076 -331
  165. package/dist/useLabel-cjs.js +2 -3
  166. package/dist/useLabel-es.js +2 -3
  167. package/dist/useRenderElement-cjs.js +9 -7
  168. package/dist/useRenderElement-es.js +9 -7
  169. package/dist/useScrollLock-cjs.js +819 -344
  170. package/dist/useScrollLock-es.js +732 -296
  171. package/dist/useScrollToActive-cjs.js +4 -5
  172. package/dist/useScrollToActive-es.js +1 -2
  173. package/dist/utils/meta/meta.json +43 -1
  174. package/package.json +8 -3
  175. package/dist/floating-ui.react-dom-cjs.js +0 -2103
  176. package/dist/floating-ui.react-dom-es.js +0 -2072
  177. package/dist/floating-ui.utils-cjs.js +0 -342
  178. package/dist/floating-ui.utils-es.js +0 -300
@@ -0,0 +1,675 @@
1
+ 'use strict';
2
+
3
+ var tslib_es6 = require('./tslib.es6-cjs.js');
4
+ var React = require('react');
5
+ var jobberHooks = require('@jobber/hooks');
6
+ var classnames = require('classnames');
7
+ var getMappedBreakpointWidth = require('./getMappedBreakpointWidth-cjs.js');
8
+ var Button = require('./Button-cjs.js');
9
+ var buttonRenderAdapter = require('./buttonRenderAdapter-cjs.js');
10
+ var ComboboxPrimitive = require('./ComboboxPrimitive-cjs.js');
11
+ var useRenderElement = require('./useRenderElement-cjs.js');
12
+ var Icon = require('./Icon-cjs.js');
13
+ var mergeClassName = require('./mergeClassName-cjs.js');
14
+ var AtlantisContext = require('./AtlantisContext-cjs.js');
15
+ var Glimmer = require('./Glimmer-cjs.js');
16
+ var HelperText = require('./HelperText-cjs.js');
17
+ var FieldDescription = require('./FieldDescription-cjs.js');
18
+
19
+ function defaultIsItemEqual(candidateValue, selectedValue) {
20
+ return Object.is(candidateValue, selectedValue);
21
+ }
22
+ function isValueSelected(candidateValue, selectedValues, isItemEqual = (defaultIsItemEqual)) {
23
+ return selectedValues.some(selectedValue => isItemEqual(candidateValue, selectedValue));
24
+ }
25
+ function getSelectAllState({ candidateValues, isItemEqual = defaultIsItemEqual, selectedValues, }) {
26
+ const selectedCandidateCount = candidateValues.filter(candidateValue => isValueSelected(candidateValue, selectedValues, isItemEqual)).length;
27
+ const candidateCount = candidateValues.length;
28
+ return {
29
+ checked: candidateCount > 0 && selectedCandidateCount === candidateCount,
30
+ indeterminate: selectedCandidateCount > 0 && selectedCandidateCount < candidateCount,
31
+ selectedCandidateCount,
32
+ candidateCount,
33
+ };
34
+ }
35
+ function getNextSelectAllValues({ candidateValues, isItemEqual = defaultIsItemEqual, selectedValues, }) {
36
+ const nextSelectedValues = [...selectedValues];
37
+ for (const candidateValue of candidateValues) {
38
+ if (!isValueSelected(candidateValue, nextSelectedValues, isItemEqual)) {
39
+ nextSelectedValues.push(candidateValue);
40
+ }
41
+ }
42
+ return nextSelectedValues;
43
+ }
44
+
45
+ const DEFAULT_COMBOBOX_RESPONSIVE_CONFIG = {
46
+ defaultModal: false,
47
+ footerActionButtonRecipe: {
48
+ size: "small",
49
+ type: "secondary",
50
+ variation: "work",
51
+ },
52
+ positionerProps: {},
53
+ showChipRemove: true,
54
+ };
55
+ const MOBILE_COMBOBOX_RESPONSIVE_CONFIG = {
56
+ defaultModal: true,
57
+ footerActionButtonRecipe: {
58
+ size: "base",
59
+ type: "secondary",
60
+ variation: "work",
61
+ },
62
+ positionerProps: {
63
+ align: "center",
64
+ positionMethod: "fixed",
65
+ side: "bottom",
66
+ sideOffset: 0,
67
+ style: {
68
+ position: "fixed",
69
+ width: "100dvw",
70
+ maxWidth: "100dvw",
71
+ margin: 0,
72
+ transform: "none",
73
+ inset: "auto 0 0",
74
+ },
75
+ },
76
+ showChipRemove: false,
77
+ };
78
+ function getComboboxResponsiveConfig(width) {
79
+ if (width !== undefined && width <= getMappedBreakpointWidth.AtlantisBreakpoints.sm) {
80
+ return MOBILE_COMBOBOX_RESPONSIVE_CONFIG;
81
+ }
82
+ return DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
83
+ }
84
+
85
+ const ComboboxContext = React.createContext(null);
86
+ function useOptionalComboboxContext() {
87
+ return React.useContext(ComboboxContext);
88
+ }
89
+ function useComboboxContext() {
90
+ const context = React.useContext(ComboboxContext);
91
+ if (!context) {
92
+ throw new Error("Combobox components must be rendered inside Combobox");
93
+ }
94
+ return context;
95
+ }
96
+
97
+ function createComboboxSlotSystem(markerKey) {
98
+ function assignSlot(component, slot) {
99
+ return Object.assign(component, {
100
+ [markerKey]: slot,
101
+ });
102
+ }
103
+ function createSlot(slot) {
104
+ function ComboboxSlot(props) {
105
+ return null;
106
+ }
107
+ return assignSlot(ComboboxSlot, slot);
108
+ }
109
+ function isSlotElement(child) {
110
+ return (React.isValidElement(child) &&
111
+ typeof child.type !== "string" &&
112
+ markerKey in child.type);
113
+ }
114
+ return { assignSlot, createSlot, isSlotElement };
115
+ }
116
+
117
+ const comboboxContentSlotSystem = createComboboxSlotSystem("comboboxContentSlot");
118
+ const assignComboboxContentSlot = comboboxContentSlotSystem.assignSlot;
119
+ const isComboboxContentSlotElement = comboboxContentSlotSystem.isSlotElement;
120
+
121
+ var styles = {"root":"B0QmBtwlnHs-","sizeBase":"RViH4KcR7S4-","sizeSmall":"PhTQQLSQRfU-","sizeLarge":"_2GAP0lCM9iU-","hasLabel":"dCxC3YMhuE8-","label":"_0Ro-CPw-pBk-","innerLabel":"DZ76oTE8arw-","screenReaderOnly":"g6OcEs38-W4-","labelNote":"glfCUzOoqRs-","description":"hJLDca6C4mg-","error":"Otz3vBkHwV4-","itemContent":"CU-nnrvSp74-","itemPrefix":"YSCJxqQHVik-","itemSuffix":"N-6lDLwoViE-","itemIndicator":"UBwTOYJSaBc-","itemText":"TysU0fU7VI0-","itemLabel":"oV92tIYbjmQ-","itemDescription":"xN4obreiDIQ-","clear":"wOdZIAytarU-","triggerIconRotate":"_0jDShCnQjxc-","trigger":"mKKJ60Qxxmw-","triggerValueControl":"v6DatDYO-gk-","triggerValue":"LyrziI4LY5w-","triggerValueText":"ayWSHF3Mwfc-","triggerValueIcon":"Glijnn9-fUw-","mobileBackdrop":"_-0af5xRGjJ8-","input":"-io5LRdyoKw-","actions":"QW4rICN6z4c-","action":"_5BO0h44F148-","actionPrefix":"Anagh40JJn8-","actionLabel":"h7YEFty4FKU-","footer":"_9lX7ptB9-fA-","selectedCount":"OrcuITnCXZk-","empty":"ba6Qla9fx-g-","loading":"_5zl8TjDQSnQ-","loadingRow":"eir2NHzbDEQ-","loadingGlimmer":"eCs-SVKfAYc-","multipleChips":"eGxgqB0y1PA-","multiplePlaceholder":"Z07vGalCLy0-","multipleChip":"d3M1dXi1qlU-","multipleInput":"_-3jWBOtOWpY-","content":"m417c1Vd--E-","list":"zKAmeSlRRN4-","spinning":"mqMvu8yxz2w-"};
122
+
123
+ function renderFooterActionButton(_a) {
124
+ var { actionButtonRecipe, children, label } = _a, buttonProps = tslib_es6.__rest(_a, ["actionButtonRecipe", "children", "label"]);
125
+ if (children) {
126
+ return (React.createElement(Button.Button, Object.assign({}, buttonProps, actionButtonRecipe), children));
127
+ }
128
+ return React.createElement(Button.Button, Object.assign({}, buttonProps, actionButtonRecipe, { label: label }));
129
+ }
130
+ function renderFooterClearButton(_a) {
131
+ var { actionButtonRecipe, children, label } = _a, clearProps = tslib_es6.__rest(_a, ["actionButtonRecipe", "children", "label"]);
132
+ return baseUiProps => {
133
+ const _a = buttonRenderAdapter.normalizeBaseUiButtonProps(baseUiProps), baseButtonProps = tslib_es6.__rest(_a, ["children"]);
134
+ return renderFooterActionButton(Object.assign(Object.assign({}, useRenderElement.mergeProps(baseButtonProps, clearProps)), { actionButtonRecipe,
135
+ children,
136
+ label }));
137
+ };
138
+ }
139
+ function renderFooterChildren(children, multiple) {
140
+ if (typeof children !== "function")
141
+ return children;
142
+ return (React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValue) => children(getComboboxFooterState(selectedValue, multiple))));
143
+ }
144
+ function getSelectedCountContent(selectedCount, children) {
145
+ if (children)
146
+ return children(selectedCount);
147
+ return `${selectedCount} selected`;
148
+ }
149
+ function shouldShowSelectAll({ onSelectAll, selectAllState, }) {
150
+ if (!selectAllState || !onSelectAll)
151
+ return false;
152
+ if (selectAllState.candidateCount === 0)
153
+ return false;
154
+ return !selectAllState.checked;
155
+ }
156
+ function getSelectedCount(value) {
157
+ if (Array.isArray(value))
158
+ return value.length;
159
+ if (value == null)
160
+ return 0;
161
+ return 1;
162
+ }
163
+ function getSelectedValues(value) {
164
+ if (Array.isArray(value))
165
+ return value;
166
+ if (value == null)
167
+ return [];
168
+ return [value];
169
+ }
170
+ function getComboboxFooterState(selectedValue, multiple) {
171
+ const selectedCount = getSelectedCount(selectedValue);
172
+ return {
173
+ selectedCount,
174
+ selectedValue,
175
+ selectedValues: getSelectedValues(selectedValue),
176
+ hasSelection: selectedCount > 0,
177
+ canClearSelection: Boolean(multiple) && selectedCount > 0,
178
+ multiple: Boolean(multiple),
179
+ };
180
+ }
181
+ function ComboboxFooterBase({ children, className, style, }) {
182
+ const { multiple } = useComboboxContext();
183
+ return (React.createElement("div", { className: classnames(styles.footer, className), style: style }, renderFooterChildren(children, multiple)));
184
+ }
185
+ const ComboboxFooter = assignComboboxContentSlot(ComboboxFooterBase, "footer");
186
+ function ComboboxSelectedCount({ children, className, }) {
187
+ const { multiple } = useComboboxContext();
188
+ return (React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValue) => {
189
+ const state = getComboboxFooterState(selectedValue, multiple);
190
+ if (!state.multiple || !state.hasSelection)
191
+ return null;
192
+ return (React.createElement("span", { className: classnames(styles.selectedCount, className) }, getSelectedCountContent(state.selectedCount, children)));
193
+ }));
194
+ }
195
+ const ComboboxSelectionFooter = assignComboboxContentSlot(function ComboboxSelectionFooter({ className, style, showSelectedCount = true, selectAllLabel = "Select all", selectAllState, onSelectAll, }) {
196
+ const { multiple } = useComboboxContext();
197
+ if (!multiple)
198
+ return null;
199
+ return (React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValue) => {
200
+ const state = getComboboxFooterState(selectedValue, multiple);
201
+ const showSelectAll = shouldShowSelectAll({
202
+ onSelectAll,
203
+ selectAllState,
204
+ });
205
+ if (!state.hasSelection && !showSelectAll)
206
+ return null;
207
+ return (React.createElement(ComboboxFooter, { className: className, style: style },
208
+ showSelectedCount && React.createElement(ComboboxSelectedCount, null),
209
+ React.createElement(ComboboxClearSelection, null),
210
+ showSelectAll && (React.createElement(ComboboxSelectAll, { label: selectAllLabel, onClick: onSelectAll }))));
211
+ }));
212
+ }, "footer");
213
+ function ComboboxClearSelection(_a) {
214
+ var { children, label = "Clear", tabIndex } = _a, clearProps = tslib_es6.__rest(_a, ["children", "label", "tabIndex"]);
215
+ const { multiple, responsive } = useComboboxContext();
216
+ return (React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValue) => {
217
+ const state = getComboboxFooterState(selectedValue, multiple);
218
+ if (!state.multiple || !state.hasSelection)
219
+ return null;
220
+ return (React.createElement(ComboboxPrimitive.ComboboxClear, { render: renderFooterClearButton(Object.assign(Object.assign({}, clearProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children,
221
+ label })), tabIndex: tabIndex }));
222
+ }));
223
+ }
224
+ function ComboboxSelectAll(_a) {
225
+ var { children, label = "Select all" } = _a, buttonProps = tslib_es6.__rest(_a, ["children", "label"]);
226
+ const { multiple, responsive } = useComboboxContext();
227
+ if (!multiple)
228
+ return null;
229
+ return renderFooterActionButton(Object.assign(Object.assign({}, buttonProps), { actionButtonRecipe: responsive.footerActionButtonRecipe, children,
230
+ label }));
231
+ }
232
+
233
+ function getFallbackChildren(children) {
234
+ if (children.length === 0)
235
+ return null;
236
+ if (children.length === 1)
237
+ return children[0];
238
+ return children;
239
+ }
240
+ const comboboxItemSlotSystem = createComboboxSlotSystem("comboboxItemSlot");
241
+ const comboboxActionSlotSystem = createComboboxSlotSystem("comboboxActionSlot");
242
+ const createComboboxItemSlot = comboboxItemSlotSystem.createSlot;
243
+ const createComboboxActionSlot = comboboxActionSlotSystem.createSlot;
244
+ function isComboboxItemSlotElement(child) {
245
+ return comboboxItemSlotSystem.isSlotElement(child);
246
+ }
247
+ function isComboboxActionSlotElement(child) {
248
+ return comboboxActionSlotSystem.isSlotElement(child);
249
+ }
250
+ function parseSlottedChildren(children, isSlotElement, getSlotName) {
251
+ const slots = {};
252
+ const unslottedChildren = [];
253
+ React.Children.forEach(children, child => {
254
+ if (!isSlotElement(child)) {
255
+ unslottedChildren.push(child);
256
+ return;
257
+ }
258
+ slots[getSlotName(child)] = {
259
+ children: child.props.children,
260
+ className: child.props.className,
261
+ style: child.props.style,
262
+ };
263
+ });
264
+ return { slots, unslottedChildren };
265
+ }
266
+ function parseComboboxItemChildren(children) {
267
+ const { slots, unslottedChildren } = parseSlottedChildren(children, isComboboxItemSlotElement, child => child.type.comboboxItemSlot);
268
+ if (!slots.label && unslottedChildren.length > 0) {
269
+ slots.label = {
270
+ children: getFallbackChildren(unslottedChildren),
271
+ };
272
+ }
273
+ return slots;
274
+ }
275
+ function parseComboboxActionChildren(children) {
276
+ const { slots, unslottedChildren } = parseSlottedChildren(children, isComboboxActionSlotElement, child => child.type.comboboxActionSlot);
277
+ return { actionSlots: slots, unslottedChildren };
278
+ }
279
+ function getActionLabelChildren(actionSlots, unslottedChildren) {
280
+ if (actionSlots.label)
281
+ return actionSlots.label.children;
282
+ return getFallbackChildren(unslottedChildren);
283
+ }
284
+ function getActionPrefixChildren(actionSlots) {
285
+ if (actionSlots.prefix)
286
+ return actionSlots.prefix.children;
287
+ return (React.createElement(Icon.Icon, { color: "interactive", name: "add", UNSAFE_style: { svg: { width: 24, height: 24 } } }));
288
+ }
289
+ function renderActionPrefix(actionSlots) {
290
+ var _a, _b;
291
+ return (React.createElement("span", { "aria-hidden": "true", className: classnames(styles.actionPrefix, (_a = actionSlots.prefix) === null || _a === void 0 ? void 0 : _a.className), style: (_b = actionSlots.prefix) === null || _b === void 0 ? void 0 : _b.style }, getActionPrefixChildren(actionSlots)));
292
+ }
293
+ function renderActionLabel(actionSlots, labelChildren) {
294
+ var _a, _b;
295
+ if (!labelChildren)
296
+ return null;
297
+ return (React.createElement("span", { className: classnames(styles.actionLabel, (_a = actionSlots.label) === null || _a === void 0 ? void 0 : _a.className), style: (_b = actionSlots.label) === null || _b === void 0 ? void 0 : _b.style }, labelChildren));
298
+ }
299
+ function ComboboxList(_a) {
300
+ var { className } = _a, listProps = tslib_es6.__rest(_a, ["className"]);
301
+ return (React.createElement(ComboboxPrimitive.ComboboxList, Object.assign({}, listProps, { className: mergeClassName.mergeClassName(styles.list, className) })));
302
+ }
303
+ function ComboboxItem(_a) {
304
+ var { children } = _a, itemProps = tslib_es6.__rest(_a, ["children"]);
305
+ const itemSlots = parseComboboxItemChildren(children);
306
+ return (React.createElement(ComboboxPrimitive.ComboboxItem, Object.assign({}, itemProps),
307
+ React.createElement("div", { className: styles.itemContent },
308
+ itemSlots.prefix && (React.createElement("div", { className: classnames(styles.itemPrefix, itemSlots.prefix.className), style: itemSlots.prefix.style }, itemSlots.prefix.children)),
309
+ React.createElement("div", { className: styles.itemText },
310
+ itemSlots.label && (React.createElement("div", { className: classnames(styles.itemLabel, itemSlots.label.className), style: itemSlots.label.style }, itemSlots.label.children)),
311
+ itemSlots.description && (React.createElement("div", { className: classnames(styles.itemDescription, itemSlots.description.className), style: itemSlots.description.style }, itemSlots.description.children))),
312
+ itemSlots.suffix && (React.createElement("div", { className: classnames(styles.itemSuffix, itemSlots.suffix.className), style: itemSlots.suffix.style }, itemSlots.suffix.children))),
313
+ React.createElement(ComboboxItemIndicator, { className: styles.itemIndicator },
314
+ React.createElement(Icon.Icon, { color: "icon", name: "checkmark", size: "base" }))));
315
+ }
316
+ function ComboboxItemIndicator(_a) {
317
+ var { className } = _a, itemIndicatorProps = tslib_es6.__rest(_a, ["className"]);
318
+ return (React.createElement(ComboboxPrimitive.ComboboxItemIndicator, Object.assign({}, itemIndicatorProps, { className: mergeClassName.mergeClassName(styles.itemIndicator, className) })));
319
+ }
320
+ const ComboboxItemPrefixComponent = createComboboxItemSlot("prefix");
321
+ const ComboboxItemLabelComponent = createComboboxItemSlot("label");
322
+ const ComboboxItemDescriptionComponent = createComboboxItemSlot("description");
323
+ const ComboboxItemSuffixComponent = createComboboxItemSlot("suffix");
324
+ const ComboboxActionPrefixComponent = createComboboxActionSlot("prefix");
325
+ const ComboboxActionLabelComponent = createComboboxActionSlot("label");
326
+ function ComboboxRow(props) {
327
+ return React.createElement(ComboboxPrimitive.ComboboxRow, Object.assign({}, props));
328
+ }
329
+ function ComboboxCollection(props) {
330
+ return React.createElement(ComboboxPrimitive.ComboboxCollection, Object.assign({}, props));
331
+ }
332
+ function ComboboxGroup(props) {
333
+ return React.createElement(ComboboxPrimitive.ComboboxGroup, Object.assign({}, props));
334
+ }
335
+ function ComboboxGroupLabel(props) {
336
+ return React.createElement(ComboboxPrimitive.ComboboxGroupLabel, Object.assign({}, props));
337
+ }
338
+ function ComboboxSeparator(props) {
339
+ return React.createElement(ComboboxPrimitive.ComboboxSeparator, Object.assign({}, props));
340
+ }
341
+ const ComboboxActionsComponent = assignComboboxContentSlot(function ComboboxActions({ children, className, style, }) {
342
+ return (React.createElement("div", { className: classnames(styles.actions, className), style: style }, children));
343
+ }, "actions");
344
+ function ComboboxAction(_a) {
345
+ var { children, className, onClick } = _a, buttonProps = tslib_es6.__rest(_a, ["children", "className", "onClick"]);
346
+ const { actionSlots, unslottedChildren } = parseComboboxActionChildren(children);
347
+ const labelChildren = getActionLabelChildren(actionSlots, unslottedChildren);
348
+ return (React.createElement("button", Object.assign({}, buttonProps, { type: "button", className: classnames(styles.action, className), onClick: event => {
349
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
350
+ } }),
351
+ renderActionPrefix(actionSlots),
352
+ renderActionLabel(actionSlots, labelChildren)));
353
+ }
354
+
355
+ const DEFAULT_LOADING_ROWS = 4;
356
+ const DEFAULT_SIZE = "base";
357
+ const DEFAULT_EMPTY_MESSAGE = "No results found";
358
+ function getSizeClass(size) {
359
+ switch (size) {
360
+ case "small":
361
+ return styles.sizeSmall;
362
+ case "large":
363
+ return styles.sizeLarge;
364
+ case "base":
365
+ default:
366
+ return styles.sizeBase;
367
+ }
368
+ }
369
+ function useFilter(options) {
370
+ const { locale } = AtlantisContext.useAtlantisContext();
371
+ return ComboboxPrimitive.useFilter(Object.assign({ locale }, options));
372
+ }
373
+ function getIconSize(size) {
374
+ if (size === "small")
375
+ return "small";
376
+ return "base";
377
+ }
378
+ function shouldRenderInnerLabel(context) {
379
+ return Boolean((context === null || context === void 0 ? void 0 : context.label) && context.size !== "small");
380
+ }
381
+ function shouldRenderRecipeLabel(context) {
382
+ return Boolean(context === null || context === void 0 ? void 0 : context.label);
383
+ }
384
+ function parseComboboxContentChildren(children) {
385
+ const parsedChildren = {
386
+ content: [],
387
+ empty: [],
388
+ actions: [],
389
+ footer: [],
390
+ hasLoading: false,
391
+ };
392
+ React.Children.toArray(children).forEach(child => {
393
+ if (!isComboboxContentSlotElement(child)) {
394
+ parsedChildren.content.push(child);
395
+ return;
396
+ }
397
+ switch (child.type.comboboxContentSlot) {
398
+ case "empty":
399
+ parsedChildren.empty.push(child);
400
+ break;
401
+ case "actions":
402
+ parsedChildren.actions.push(child);
403
+ break;
404
+ case "footer":
405
+ parsedChildren.footer.push(child);
406
+ break;
407
+ case "loading":
408
+ parsedChildren.hasLoading = true;
409
+ parsedChildren.content.push(child);
410
+ break;
411
+ }
412
+ });
413
+ return parsedChildren;
414
+ }
415
+ function getDefaultEmptyChildren({ empty, hasLoading }, emptyContent) {
416
+ if (empty.length > 0)
417
+ return empty;
418
+ if (hasLoading)
419
+ return null;
420
+ if (emptyContent !== undefined) {
421
+ if (emptyContent === null)
422
+ return null;
423
+ return React.createElement(ComboboxEmpty, null, emptyContent);
424
+ }
425
+ return React.createElement(ComboboxEmpty, null, DEFAULT_EMPTY_MESSAGE);
426
+ }
427
+ function ComboboxRoot(_a) {
428
+ var { children, className, description, disabled, error, invalid, label, modal, style, multiple, readOnly, size = DEFAULT_SIZE } = _a, rootProps = tslib_es6.__rest(_a, ["children", "className", "description", "disabled", "error", "invalid", "label", "modal", "style", "multiple", "readOnly", "size"]);
429
+ const { width } = jobberHooks.useWindowDimensions();
430
+ const responsive = getComboboxResponsiveConfig(width);
431
+ const [positionerAnchor, setPositionerAnchor] = React.useState(null);
432
+ const contextValue = React.useMemo(() => ({
433
+ disabled: Boolean(disabled),
434
+ label,
435
+ multiple: Boolean(multiple),
436
+ positionerAnchor,
437
+ readOnly: Boolean(readOnly),
438
+ responsive,
439
+ setPositionerAnchor,
440
+ size,
441
+ }), [disabled, label, multiple, positionerAnchor, readOnly, responsive, size]);
442
+ return (React.createElement(FieldDescription.FieldRoot, { className: classnames(styles.root, className), "data-size": size, disabled: disabled, invalid: Boolean(error || invalid) || undefined, style: style },
443
+ React.createElement(ComboboxContext.Provider, { value: contextValue },
444
+ React.createElement(ComboboxPrimitive.ComboboxRoot, Object.assign({}, rootProps, { disabled: disabled, modal: modal !== null && modal !== void 0 ? modal : responsive.defaultModal, multiple: multiple, readOnly: readOnly }),
445
+ children,
446
+ description && (React.createElement(ComboboxDescription, null, description)),
447
+ error && React.createElement(ComboboxError, null, error)))));
448
+ }
449
+ function ComboboxRecipeLabel({ children, visuallyHidden, }) {
450
+ return (React.createElement(ComboboxLabel, { className: visuallyHidden ? styles.screenReaderOnly : styles.innerLabel }, children));
451
+ }
452
+ function ComboboxLabel(_a) {
453
+ var { className } = _a, labelProps = tslib_es6.__rest(_a, ["className"]);
454
+ return (React.createElement(FieldDescription.FieldLabel, Object.assign({}, labelProps, { className: classnames(styles.label, className) })));
455
+ }
456
+ function ComboboxLabelNote(_a) {
457
+ var { className } = _a, labelNoteProps = tslib_es6.__rest(_a, ["className"]);
458
+ return (React.createElement("span", Object.assign({}, labelNoteProps, { className: classnames(styles.labelNote, className) })));
459
+ }
460
+ function ComboboxDescription(_a) {
461
+ var { children, className } = _a, descriptionProps = tslib_es6.__rest(_a, ["children", "className"]);
462
+ if (!children)
463
+ return null;
464
+ return (React.createElement(FieldDescription.FieldDescription, Object.assign({}, descriptionProps, { className: classnames(styles.description, className), render: React.createElement(HelperText.HelperText, { message: children }) })));
465
+ }
466
+ function ComboboxError(_a) {
467
+ var { children, className, match = true } = _a, errorProps = tslib_es6.__rest(_a, ["children", "className", "match"]);
468
+ if (!children)
469
+ return null;
470
+ return (React.createElement(FieldDescription.FieldError, Object.assign({}, errorProps, { className: classnames(styles.error, className), match: match, render: React.createElement(HelperText.HelperText, { message: children, status: "critical" }) })));
471
+ }
472
+ function ComboboxInputGroup(_a) {
473
+ var { className } = _a, inputGroupProps = tslib_es6.__rest(_a, ["className"]);
474
+ const context = useOptionalComboboxContext();
475
+ return (React.createElement(ComboboxPrimitive.ComboboxInputGroup, Object.assign({}, inputGroupProps, { className: mergeClassName.mergeClassName(getSizeClass(context === null || context === void 0 ? void 0 : context.size), className) })));
476
+ }
477
+ function ComboboxLabeledInputGroup({ children, inputGroupRef, }) {
478
+ const context = useOptionalComboboxContext();
479
+ const showLabel = shouldRenderInnerLabel(context);
480
+ const renderLabel = shouldRenderRecipeLabel(context);
481
+ return (React.createElement(ComboboxInputGroup, { className: showLabel ? styles.hasLabel : undefined, ref: inputGroupRef },
482
+ renderLabel && (React.createElement(ComboboxRecipeLabel, { visuallyHidden: !showLabel }, context === null || context === void 0 ? void 0 : context.label)),
483
+ children));
484
+ }
485
+ function ComboboxInput(_a) {
486
+ var { className } = _a, inputProps = tslib_es6.__rest(_a, ["className"]);
487
+ return (React.createElement(ComboboxPrimitive.ComboboxInput, Object.assign({}, inputProps, { className: mergeClassName.mergeClassName(styles.input, className) })));
488
+ }
489
+ function ComboboxTrigger(_a) {
490
+ var { className, render } = _a, triggerProps = tslib_es6.__rest(_a, ["className", "render"]);
491
+ const context = useOptionalComboboxContext();
492
+ const triggerClassName = render
493
+ ? className
494
+ : mergeClassName.mergeClassName(classnames(styles.trigger, getSizeClass(context === null || context === void 0 ? void 0 : context.size)), className);
495
+ return (React.createElement(ComboboxPrimitive.ComboboxTrigger, Object.assign({}, triggerProps, { render: render, className: triggerClassName })));
496
+ }
497
+ function ComboboxClear(_a) {
498
+ var { className } = _a, clearProps = tslib_es6.__rest(_a, ["className"]);
499
+ const context = useOptionalComboboxContext();
500
+ return (React.createElement(ComboboxPrimitive.ComboboxClear, Object.assign({}, clearProps, { className: mergeClassName.mergeClassName(classnames(styles.clear, getSizeClass(context === null || context === void 0 ? void 0 : context.size)), className) })));
501
+ }
502
+ function DefaultTriggerIcon({ size }) {
503
+ return (React.createElement(ComboboxPrimitive.ComboboxIcon, null,
504
+ React.createElement("span", { className: styles.triggerIconRotate },
505
+ React.createElement(Icon.Icon, { name: "arrowDown", color: "iconSecondary", size: getIconSize(size) }))));
506
+ }
507
+ function DefaultClearIcon() {
508
+ return React.createElement(Icon.Icon, { name: "cross", color: "icon", size: "small" });
509
+ }
510
+ function ComboboxTriggerInput(_a) {
511
+ var { className, clearLabel = "Clear selection", showOptionsLabel = "Open options" } = _a, inputProps = tslib_es6.__rest(_a, ["className", "clearLabel", "showOptionsLabel"]);
512
+ const context = useOptionalComboboxContext();
513
+ return (React.createElement(ComboboxLabeledInputGroup, null,
514
+ React.createElement(ComboboxInput, Object.assign({}, inputProps, { className: className })),
515
+ !(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly) && (React.createElement(ComboboxClear, { "aria-label": clearLabel },
516
+ React.createElement(DefaultClearIcon, null))),
517
+ React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
518
+ React.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
519
+ }
520
+ function ComboboxTriggerValue(_a) {
521
+ var { children, className, placeholder } = _a, triggerProps = tslib_es6.__rest(_a, ["children", "className", "placeholder"]);
522
+ const context = useOptionalComboboxContext();
523
+ const showLabel = shouldRenderInnerLabel(context);
524
+ const renderLabel = shouldRenderRecipeLabel(context);
525
+ return (React.createElement("div", { className: classnames(styles.triggerValueControl, getSizeClass(context === null || context === void 0 ? void 0 : context.size)) },
526
+ renderLabel && (React.createElement(ComboboxRecipeLabel, { visuallyHidden: !showLabel }, context === null || context === void 0 ? void 0 : context.label)),
527
+ React.createElement(ComboboxTrigger, Object.assign({}, triggerProps, { className: mergeClassName.mergeClassName(classnames(styles.triggerValue, getSizeClass(context === null || context === void 0 ? void 0 : context.size), showLabel && styles.hasLabel), className) }),
528
+ React.createElement("span", { className: styles.triggerValueText },
529
+ React.createElement(ComboboxPrimitive.ComboboxValue, { placeholder: placeholder }, children)),
530
+ React.createElement("span", { className: styles.triggerValueIcon },
531
+ React.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size })))));
532
+ }
533
+ function getDefaultItemLabel(value) {
534
+ return String(value);
535
+ }
536
+ function hasPlaceholder(placeholder) {
537
+ return placeholder !== undefined && placeholder !== null;
538
+ }
539
+ function renderMultipleValueChips({ getItemLabel, renderChipContent, resolveRemoveLabel, selectedValues = [], showChipRemove, }) {
540
+ return selectedValues.map((selectedValue, index) => (React.createElement(ComboboxPrimitive.ComboboxChip, { className: styles.multipleChip, key: `${getItemLabel(selectedValue)}-${index}` },
541
+ renderChipContent(selectedValue),
542
+ showChipRemove && (React.createElement(ComboboxPrimitive.ComboboxChipRemove, { "aria-label": resolveRemoveLabel(selectedValue) },
543
+ React.createElement(Icon.Icon, { name: "cross", size: "small" }))))));
544
+ }
545
+ function ComboboxTriggerMultipleWithInput(_a) {
546
+ var _b;
547
+ var { className, getItemLabel = getDefaultItemLabel, getRemoveLabel, renderItem, showOptionsLabel = "Open options" } = _a, inputProps = tslib_es6.__rest(_a, ["className", "getItemLabel", "getRemoveLabel", "renderItem", "showOptionsLabel"]);
548
+ const context = useOptionalComboboxContext();
549
+ const responsive = (_b = context === null || context === void 0 ? void 0 : context.responsive) !== null && _b !== void 0 ? _b : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
550
+ const renderChipContent = renderItem !== null && renderItem !== void 0 ? renderItem : getItemLabel;
551
+ const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) => `Remove ${getItemLabel(value)}`);
552
+ const showChipRemove = responsive.showChipRemove && !(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly);
553
+ return (React.createElement(ComboboxLabeledInputGroup, null,
554
+ React.createElement(ComboboxChips, null,
555
+ React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValues = []) => renderMultipleValueChips({
556
+ getItemLabel,
557
+ renderChipContent,
558
+ resolveRemoveLabel,
559
+ selectedValues,
560
+ showChipRemove,
561
+ })),
562
+ React.createElement(ComboboxPrimitive.ComboboxInput, Object.assign({}, inputProps, { className: mergeClassName.mergeClassName(styles.multipleInput, className) }))),
563
+ React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
564
+ React.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
565
+ }
566
+ function ComboboxTriggerMultipleValue(_a) {
567
+ var _b;
568
+ var { getItemLabel = getDefaultItemLabel, getRemoveLabel, placeholder, renderItem, showOptionsLabel = "Open options" } = _a, chipsProps = tslib_es6.__rest(_a, ["getItemLabel", "getRemoveLabel", "placeholder", "renderItem", "showOptionsLabel"]);
569
+ const context = useOptionalComboboxContext();
570
+ const responsive = (_b = context === null || context === void 0 ? void 0 : context.responsive) !== null && _b !== void 0 ? _b : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
571
+ const renderChipContent = renderItem !== null && renderItem !== void 0 ? renderItem : getItemLabel;
572
+ const resolveRemoveLabel = getRemoveLabel !== null && getRemoveLabel !== void 0 ? getRemoveLabel : ((value) => `Remove ${getItemLabel(value)}`);
573
+ const showChipRemove = responsive.showChipRemove && !(context === null || context === void 0 ? void 0 : context.disabled) && !(context === null || context === void 0 ? void 0 : context.readOnly);
574
+ const setPositionerAnchor = context === null || context === void 0 ? void 0 : context.setPositionerAnchor;
575
+ const inputGroupRef = React.useCallback((anchor) => setPositionerAnchor === null || setPositionerAnchor === void 0 ? void 0 : setPositionerAnchor(anchor), [setPositionerAnchor]);
576
+ return (React.createElement(ComboboxLabeledInputGroup, { inputGroupRef: inputGroupRef },
577
+ React.createElement(ComboboxChips, Object.assign({}, chipsProps),
578
+ React.createElement(ComboboxPrimitive.ComboboxValue, null, (selectedValues = []) => selectedValues.length > 0
579
+ ? renderMultipleValueChips({
580
+ getItemLabel,
581
+ renderChipContent,
582
+ resolveRemoveLabel,
583
+ selectedValues,
584
+ showChipRemove,
585
+ })
586
+ : hasPlaceholder(placeholder) && (React.createElement("span", { className: styles.multiplePlaceholder }, placeholder)))),
587
+ React.createElement(ComboboxTrigger, { "aria-label": showOptionsLabel },
588
+ React.createElement(DefaultTriggerIcon, { size: context === null || context === void 0 ? void 0 : context.size }))));
589
+ }
590
+ function ComboboxContent({ ariaLabel, children, className, empty, style, }) {
591
+ var _a;
592
+ const context = useOptionalComboboxContext();
593
+ const responsive = (_a = context === null || context === void 0 ? void 0 : context.responsive) !== null && _a !== void 0 ? _a : DEFAULT_COMBOBOX_RESPONSIVE_CONFIG;
594
+ const contentChildren = parseComboboxContentChildren(children);
595
+ const emptyChildren = getDefaultEmptyChildren(contentChildren, empty);
596
+ return (React.createElement(ComboboxPrimitive.ComboboxPortal, null,
597
+ React.createElement(ComboboxPrimitive.ComboboxBackdrop, { className: styles.mobileBackdrop }),
598
+ React.createElement(ComboboxPrimitive.ComboboxPositioner, Object.assign({}, responsive.positionerProps, { anchor: context === null || context === void 0 ? void 0 : context.positionerAnchor }),
599
+ React.createElement(ComboboxPrimitive.ComboboxPopup, { "aria-label": ariaLabel, className: classnames(styles.content, className), style: style },
600
+ contentChildren.content,
601
+ emptyChildren,
602
+ contentChildren.actions,
603
+ contentChildren.footer))));
604
+ }
605
+ function ComboboxChips(_a) {
606
+ var { className } = _a, chipsProps = tslib_es6.__rest(_a, ["className"]);
607
+ const context = useOptionalComboboxContext();
608
+ return (React.createElement(ComboboxPrimitive.ComboboxChips, Object.assign({}, chipsProps, { className: mergeClassName.mergeClassName(classnames(styles.multipleChips, getSizeClass(context === null || context === void 0 ? void 0 : context.size)), className) })));
609
+ }
610
+ function ComboboxEmptyComponent({ children, className, style, }) {
611
+ return (React.createElement(ComboboxPrimitive.ComboboxEmpty, { className: classnames(styles.empty, className), style: style }, children));
612
+ }
613
+ const ComboboxEmpty = assignComboboxContentSlot(ComboboxEmptyComponent, "empty");
614
+ function getLoadingRowCount(rows) {
615
+ if (!Number.isFinite(rows))
616
+ return DEFAULT_LOADING_ROWS;
617
+ return Math.max(0, Math.floor(rows));
618
+ }
619
+ function ComboboxLoadingComponent(_a) {
620
+ var { children, className, rows = DEFAULT_LOADING_ROWS, role = "status", "aria-label": ariaLabel = "Loading options" } = _a, loadingProps = tslib_es6.__rest(_a, ["children", "className", "rows", "role", "aria-label"]);
621
+ const rowCount = getLoadingRowCount(rows);
622
+ const content = children !== null && children !== void 0 ? children : Array.from({ length: rowCount }, (_, index) => (React.createElement("div", { "aria-hidden": "true", className: styles.loadingRow, key: `loading-row-${index}` },
623
+ React.createElement("div", { className: styles.loadingGlimmer },
624
+ React.createElement(Glimmer.Glimmer, { shape: "rectangle", size: "auto" })))));
625
+ return (React.createElement("div", Object.assign({}, loadingProps, { "aria-label": ariaLabel, className: classnames(styles.loading, className), role: role }), content));
626
+ }
627
+ const ComboboxLoading = assignComboboxContentSlot(ComboboxLoadingComponent, "loading");
628
+ const Combobox = Object.assign(ComboboxRoot, {
629
+ Label: ComboboxLabel,
630
+ LabelNote: ComboboxLabelNote,
631
+ Description: ComboboxDescription,
632
+ Error: ComboboxError,
633
+ Value: ComboboxPrimitive.ComboboxValue,
634
+ InputGroup: ComboboxInputGroup,
635
+ Input: ComboboxInput,
636
+ Trigger: ComboboxTrigger,
637
+ TriggerInput: ComboboxTriggerInput,
638
+ TriggerValue: ComboboxTriggerValue,
639
+ TriggerMultipleWithInput: ComboboxTriggerMultipleWithInput,
640
+ TriggerMultipleValue: ComboboxTriggerMultipleValue,
641
+ Icon: ComboboxPrimitive.ComboboxIcon,
642
+ Clear: ComboboxClear,
643
+ Content: ComboboxContent,
644
+ List: ComboboxList,
645
+ Item: ComboboxItem,
646
+ ItemDescription: ComboboxItemDescriptionComponent,
647
+ ItemLabel: ComboboxItemLabelComponent,
648
+ ItemPrefix: ComboboxItemPrefixComponent,
649
+ ItemSuffix: ComboboxItemSuffixComponent,
650
+ ActionPrefix: ComboboxActionPrefixComponent,
651
+ ActionLabel: ComboboxActionLabelComponent,
652
+ Row: ComboboxRow,
653
+ Collection: ComboboxCollection,
654
+ Chips: ComboboxChips,
655
+ Chip: ComboboxPrimitive.ComboboxChip,
656
+ ChipRemove: ComboboxPrimitive.ComboboxChipRemove,
657
+ Group: ComboboxGroup,
658
+ GroupLabel: ComboboxGroupLabel,
659
+ Separator: ComboboxSeparator,
660
+ Status: ComboboxPrimitive.ComboboxStatus,
661
+ Empty: ComboboxEmpty,
662
+ Loading: ComboboxLoading,
663
+ Actions: ComboboxActionsComponent,
664
+ Action: ComboboxAction,
665
+ Footer: ComboboxFooter,
666
+ SelectionFooter: ComboboxSelectionFooter,
667
+ SelectedCount: ComboboxSelectedCount,
668
+ ClearSelection: ComboboxClearSelection,
669
+ SelectAll: ComboboxSelectAll,
670
+ useFilter,
671
+ getSelectAllState,
672
+ getNextSelectAllValues,
673
+ });
674
+
675
+ exports.Combobox = Combobox;