@salt-ds/lab 1.0.0-alpha.30 → 1.0.0-alpha.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/css/salt-lab.css +101 -160
  2. package/dist-cjs/combo-box-next/ComboBoxNext.js +288 -290
  3. package/dist-cjs/combo-box-next/ComboBoxNext.js.map +1 -1
  4. package/dist-cjs/combo-box-next/useComboBoxNext.js.map +1 -1
  5. package/dist-cjs/content-status/internal/StatusIndicator.js +1 -3
  6. package/dist-cjs/content-status/internal/StatusIndicator.js.map +1 -1
  7. package/dist-cjs/dialog/Dialog.css.js +1 -1
  8. package/dist-cjs/dialog/Dialog.js +53 -48
  9. package/dist-cjs/dialog/Dialog.js.map +1 -1
  10. package/dist-cjs/dialog/DialogActions.js.map +1 -1
  11. package/dist-cjs/dialog/DialogContent.css.js +1 -1
  12. package/dist-cjs/dialog/DialogContent.js +17 -8
  13. package/dist-cjs/dialog/DialogContent.js.map +1 -1
  14. package/dist-cjs/dialog/DialogContext.js +3 -1
  15. package/dist-cjs/dialog/DialogContext.js.map +1 -1
  16. package/dist-cjs/dialog/DialogTitle.js +4 -5
  17. package/dist-cjs/dialog/DialogTitle.js.map +1 -1
  18. package/dist-cjs/dropdown-next/DropdownNext.js +303 -308
  19. package/dist-cjs/dropdown-next/DropdownNext.js.map +1 -1
  20. package/dist-cjs/index.js +0 -6
  21. package/dist-cjs/index.js.map +1 -1
  22. package/dist-cjs/list-control/ListControlContext.js.map +1 -1
  23. package/dist-cjs/list-control/ListControlState.js.map +1 -1
  24. package/dist-cjs/option/Option.js.map +1 -1
  25. package/dist-cjs/parent-child-layout/ParentChildLayout.css.js +1 -1
  26. package/dist-cjs/parent-child-layout/ParentChildLayout.js +30 -38
  27. package/dist-cjs/parent-child-layout/ParentChildLayout.js.map +1 -1
  28. package/dist-cjs/slider/Slider.css.js +1 -1
  29. package/dist-cjs/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
  30. package/dist-es/combo-box-next/ComboBoxNext.js +288 -290
  31. package/dist-es/combo-box-next/ComboBoxNext.js.map +1 -1
  32. package/dist-es/combo-box-next/useComboBoxNext.js.map +1 -1
  33. package/dist-es/content-status/internal/StatusIndicator.js +1 -3
  34. package/dist-es/content-status/internal/StatusIndicator.js.map +1 -1
  35. package/dist-es/dialog/Dialog.css.js +1 -1
  36. package/dist-es/dialog/Dialog.js +55 -50
  37. package/dist-es/dialog/Dialog.js.map +1 -1
  38. package/dist-es/dialog/DialogActions.js.map +1 -1
  39. package/dist-es/dialog/DialogContent.css.js +1 -1
  40. package/dist-es/dialog/DialogContent.js +19 -10
  41. package/dist-es/dialog/DialogContent.js.map +1 -1
  42. package/dist-es/dialog/DialogContext.js +3 -1
  43. package/dist-es/dialog/DialogContext.js.map +1 -1
  44. package/dist-es/dialog/DialogTitle.js +4 -5
  45. package/dist-es/dialog/DialogTitle.js.map +1 -1
  46. package/dist-es/dropdown-next/DropdownNext.js +303 -308
  47. package/dist-es/dropdown-next/DropdownNext.js.map +1 -1
  48. package/dist-es/index.js +0 -3
  49. package/dist-es/index.js.map +1 -1
  50. package/dist-es/list-control/ListControlContext.js.map +1 -1
  51. package/dist-es/list-control/ListControlState.js.map +1 -1
  52. package/dist-es/option/Option.js.map +1 -1
  53. package/dist-es/parent-child-layout/ParentChildLayout.css.js +1 -1
  54. package/dist-es/parent-child-layout/ParentChildLayout.js +32 -40
  55. package/dist-es/parent-child-layout/ParentChildLayout.js.map +1 -1
  56. package/dist-es/slider/Slider.css.js +1 -1
  57. package/dist-es/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
  58. package/dist-types/combo-box-next/ComboBoxNext.d.ts +5 -3
  59. package/dist-types/combo-box-next/useComboBoxNext.d.ts +11 -11
  60. package/dist-types/content-status/internal/StatusIndicator.d.ts +1 -1
  61. package/dist-types/dialog/Dialog.d.ts +9 -1
  62. package/dist-types/dialog/DialogContext.d.ts +0 -2
  63. package/dist-types/dialog/DialogTitle.d.ts +9 -3
  64. package/dist-types/dropdown-next/DropdownNext.d.ts +5 -3
  65. package/dist-types/index.d.ts +0 -2
  66. package/dist-types/list-control/ListControlContext.d.ts +10 -10
  67. package/dist-types/list-control/ListControlState.d.ts +15 -15
  68. package/dist-types/option/Option.d.ts +1 -1
  69. package/dist-types/parent-child-layout/ParentChildLayout.d.ts +8 -13
  70. package/package.json +2 -2
  71. package/dist-cjs/dialog/useDialog.js +0 -31
  72. package/dist-cjs/dialog/useDialog.js.map +0 -1
  73. package/dist-cjs/parent-child-item/ParentChildItem.css.js +0 -6
  74. package/dist-cjs/parent-child-item/ParentChildItem.css.js.map +0 -1
  75. package/dist-cjs/parent-child-item/ParentChildItem.js +0 -48
  76. package/dist-cjs/parent-child-item/ParentChildItem.js.map +0 -1
  77. package/dist-cjs/progress/CircularProgress/CircularProgress.css.js +0 -6
  78. package/dist-cjs/progress/CircularProgress/CircularProgress.css.js.map +0 -1
  79. package/dist-cjs/progress/CircularProgress/CircularProgress.js +0 -89
  80. package/dist-cjs/progress/CircularProgress/CircularProgress.js.map +0 -1
  81. package/dist-cjs/progress/Info.js +0 -20
  82. package/dist-cjs/progress/Info.js.map +0 -1
  83. package/dist-cjs/progress/LinearProgress/LinearProgress.css.js +0 -6
  84. package/dist-cjs/progress/LinearProgress/LinearProgress.css.js.map +0 -1
  85. package/dist-cjs/progress/LinearProgress/LinearProgress.js +0 -63
  86. package/dist-cjs/progress/LinearProgress/LinearProgress.js.map +0 -1
  87. package/dist-es/dialog/useDialog.js +0 -27
  88. package/dist-es/dialog/useDialog.js.map +0 -1
  89. package/dist-es/parent-child-item/ParentChildItem.css.js +0 -4
  90. package/dist-es/parent-child-item/ParentChildItem.css.js.map +0 -1
  91. package/dist-es/parent-child-item/ParentChildItem.js +0 -44
  92. package/dist-es/parent-child-item/ParentChildItem.js.map +0 -1
  93. package/dist-es/progress/CircularProgress/CircularProgress.css.js +0 -4
  94. package/dist-es/progress/CircularProgress/CircularProgress.css.js.map +0 -1
  95. package/dist-es/progress/CircularProgress/CircularProgress.js +0 -85
  96. package/dist-es/progress/CircularProgress/CircularProgress.js.map +0 -1
  97. package/dist-es/progress/Info.js +0 -16
  98. package/dist-es/progress/Info.js.map +0 -1
  99. package/dist-es/progress/LinearProgress/LinearProgress.css.js +0 -4
  100. package/dist-es/progress/LinearProgress/LinearProgress.css.js.map +0 -1
  101. package/dist-es/progress/LinearProgress/LinearProgress.js +0 -59
  102. package/dist-es/progress/LinearProgress/LinearProgress.js.map +0 -1
  103. package/dist-types/dialog/useDialog.d.ts +0 -25
  104. package/dist-types/parent-child-item/ParentChildItem.d.ts +0 -31
  105. package/dist-types/parent-child-item/index.d.ts +0 -1
  106. package/dist-types/progress/CircularProgress/CircularProgress.d.ts +0 -25
  107. package/dist-types/progress/Info.d.ts +0 -6
  108. package/dist-types/progress/LinearProgress/LinearProgress.d.ts +0 -26
  109. package/dist-types/progress/index.d.ts +0 -2
@@ -9,308 +9,306 @@ import { useComboBoxNext } from './useComboBoxNext.js';
9
9
  import { OptionList } from '../option/OptionList.js';
10
10
 
11
11
  const withBaseName = makePrefixer("saltComboBoxNext");
12
- const ComboBoxNext = forwardRef(
13
- function ComboBox(props, ref) {
14
- var _a, _b;
15
- const {
16
- children,
17
- className,
18
- disabled: disabledProp,
19
- endAdornment,
20
- readOnly: readOnlyProp,
21
- multiselect,
22
- onSelectionChange,
23
- selected,
24
- defaultSelected,
25
- defaultOpen,
26
- onOpenChange,
27
- onChange,
28
- open,
29
- inputProps: inputPropsProp,
30
- variant = "primary",
31
- onClick,
32
- onKeyDown,
33
- onFocus,
34
- onBlur,
35
- value,
36
- defaultValue,
37
- ...rest
38
- } = props;
39
- const {
40
- a11yProps: { "aria-labelledby": formFieldLabelledBy } = {},
41
- disabled: formFieldDisabled,
42
- readOnly: formFieldReadOnly
43
- } = useFormFieldProps();
44
- const disabled = Boolean(disabledProp) || formFieldDisabled;
45
- const readOnly = Boolean(readOnlyProp) || formFieldReadOnly;
46
- const listControl = useComboBoxNext({
47
- open,
48
- defaultOpen,
49
- onOpenChange,
50
- multiselect,
51
- defaultSelected,
52
- selected,
53
- onSelectionChange,
54
- value,
55
- defaultValue
56
- });
57
- const {
58
- activeState,
59
- setActive,
60
- openState,
61
- setOpen,
62
- openKey,
63
- getOptionAtIndex,
64
- getIndexOfOption,
65
- getOptionsMatching,
66
- options,
67
- selectedState,
68
- select,
69
- clear,
70
- setFocusVisibleState,
71
- focusedState,
72
- setFocusedState,
73
- listRef,
74
- valueState,
75
- setValueState
76
- } = listControl;
77
- const { Component: FloatingComponent } = useFloatingComponent();
78
- const { x, y, strategy, elements, floating, reference } = useFloatingUI({
79
- open,
80
- placement: "bottom-start",
81
- middleware: [
82
- size({
83
- apply({ rects, elements: elements2, availableHeight }) {
84
- Object.assign(elements2.floating.style, {
85
- minWidth: `${rects.reference.width}px`,
86
- maxHeight: `max(calc(${availableHeight}px - var(--salt-spacing-100)), calc((var(--salt-size-base) + var(--salt-spacing-100)) * 5))`
87
- });
88
- }
89
- }),
90
- flip({ fallbackStrategy: "initialPlacement" })
91
- ]
92
- });
93
- const handleRef = useForkRef(reference, ref);
94
- const inputRef = useRef(null);
95
- const handleButtonClick = (event) => {
96
- if (!readOnly) {
97
- event.stopPropagation();
98
- setFocusVisibleState(false);
99
- setOpen(event, !openState);
100
- }
101
- };
102
- const handleButtonFocus = () => {
103
- var _a2;
104
- (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
105
- };
106
- const handleKeyDown = (event) => {
107
- const currentIndex = activeState ? getIndexOfOption(activeState) : -1;
108
- const count = options.length - 1;
109
- if (readOnly) {
12
+ const ComboBoxNext = forwardRef(function ComboBox(props, ref) {
13
+ var _a, _b;
14
+ const {
15
+ children,
16
+ className,
17
+ disabled: disabledProp,
18
+ endAdornment,
19
+ readOnly: readOnlyProp,
20
+ multiselect,
21
+ onSelectionChange,
22
+ selected,
23
+ defaultSelected,
24
+ defaultOpen,
25
+ onOpenChange,
26
+ onChange,
27
+ open,
28
+ inputProps: inputPropsProp,
29
+ variant = "primary",
30
+ onClick,
31
+ onKeyDown,
32
+ onFocus,
33
+ onBlur,
34
+ value,
35
+ defaultValue,
36
+ ...rest
37
+ } = props;
38
+ const {
39
+ a11yProps: { "aria-labelledby": formFieldLabelledBy } = {},
40
+ disabled: formFieldDisabled,
41
+ readOnly: formFieldReadOnly
42
+ } = useFormFieldProps();
43
+ const disabled = Boolean(disabledProp) || formFieldDisabled;
44
+ const readOnly = Boolean(readOnlyProp) || formFieldReadOnly;
45
+ const listControl = useComboBoxNext({
46
+ open,
47
+ defaultOpen,
48
+ onOpenChange,
49
+ multiselect,
50
+ defaultSelected,
51
+ selected,
52
+ onSelectionChange,
53
+ value,
54
+ defaultValue
55
+ });
56
+ const {
57
+ activeState,
58
+ setActive,
59
+ openState,
60
+ setOpen,
61
+ openKey,
62
+ getOptionAtIndex,
63
+ getIndexOfOption,
64
+ getOptionsMatching,
65
+ options,
66
+ selectedState,
67
+ select,
68
+ clear,
69
+ setFocusVisibleState,
70
+ focusedState,
71
+ setFocusedState,
72
+ listRef,
73
+ valueState,
74
+ setValueState
75
+ } = listControl;
76
+ const { Component: FloatingComponent } = useFloatingComponent();
77
+ const { x, y, strategy, elements, floating, reference } = useFloatingUI({
78
+ open,
79
+ placement: "bottom-start",
80
+ middleware: [
81
+ size({
82
+ apply({ rects, elements: elements2, availableHeight }) {
83
+ Object.assign(elements2.floating.style, {
84
+ minWidth: `${rects.reference.width}px`,
85
+ maxHeight: `max(calc(${availableHeight}px - var(--salt-spacing-100)), calc((var(--salt-size-base) + var(--salt-spacing-100)) * 5))`
86
+ });
87
+ }
88
+ }),
89
+ flip({ fallbackStrategy: "initialPlacement" })
90
+ ]
91
+ });
92
+ const handleRef = useForkRef(reference, ref);
93
+ const inputRef = useRef(null);
94
+ const handleButtonClick = (event) => {
95
+ if (!readOnly) {
96
+ event.stopPropagation();
97
+ setFocusVisibleState(false);
98
+ setOpen(event, !openState);
99
+ }
100
+ };
101
+ const handleButtonFocus = () => {
102
+ var _a2;
103
+ (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
104
+ };
105
+ const handleKeyDown = (event) => {
106
+ const currentIndex = activeState ? getIndexOfOption(activeState) : -1;
107
+ const count = options.length - 1;
108
+ if (readOnly) {
109
+ return;
110
+ }
111
+ if (!openState) {
112
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
113
+ setOpen(event, true);
110
114
  return;
111
115
  }
112
- if (!openState) {
113
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
114
- setOpen(event, true);
116
+ }
117
+ let newActive;
118
+ switch (event.key) {
119
+ case "ArrowDown":
120
+ newActive = getOptionAtIndex(Math.min(count, currentIndex + 1));
121
+ break;
122
+ case "ArrowUp":
123
+ newActive = getOptionAtIndex(Math.max(0, currentIndex - 1));
124
+ break;
125
+ case "Home":
126
+ newActive = getOptionAtIndex(0);
127
+ break;
128
+ case "End":
129
+ newActive = getOptionAtIndex(count);
130
+ break;
131
+ case "PageUp":
132
+ newActive = getOptionAtIndex(Math.max(0, currentIndex - 10));
133
+ break;
134
+ case "PageDown":
135
+ newActive = getOptionAtIndex(Math.min(count, currentIndex + 10));
136
+ break;
137
+ case "Enter":
138
+ if (openState && (activeState == null ? void 0 : activeState.disabled)) {
139
+ event.preventDefault();
115
140
  return;
116
141
  }
117
- }
118
- let newActive;
119
- switch (event.key) {
120
- case "ArrowDown":
121
- newActive = getOptionAtIndex(Math.min(count, currentIndex + 1));
122
- break;
123
- case "ArrowUp":
124
- newActive = getOptionAtIndex(Math.max(0, currentIndex - 1));
125
- break;
126
- case "Home":
127
- newActive = getOptionAtIndex(0);
128
- break;
129
- case "End":
130
- newActive = getOptionAtIndex(count);
131
- break;
132
- case "PageUp":
133
- newActive = getOptionAtIndex(Math.max(0, currentIndex - 10));
134
- break;
135
- case "PageDown":
136
- newActive = getOptionAtIndex(Math.min(count, currentIndex + 10));
137
- break;
138
- case "Enter":
139
- if (openState && (activeState == null ? void 0 : activeState.disabled)) {
140
- event.preventDefault();
141
- return;
142
- }
143
- if (!openState || !activeState) {
144
- return;
145
- }
146
- select(event, activeState);
147
- if (!multiselect) {
148
- event.preventDefault();
149
- setOpen(event, false);
150
- }
151
- break;
152
- case "Escape":
142
+ if (!openState || !activeState) {
143
+ return;
144
+ }
145
+ select(event, activeState);
146
+ if (!multiselect) {
147
+ event.preventDefault();
153
148
  setOpen(event, false);
154
- break;
155
- case "Tab":
156
- if (!multiselect && activeState) {
157
- select(event, activeState);
158
- }
159
- break;
160
- }
161
- if (newActive && (newActive == null ? void 0 : newActive.id) != (activeState == null ? void 0 : activeState.id)) {
162
- event.preventDefault();
163
- setActive(newActive);
164
- setFocusVisibleState(true);
165
- }
166
- onKeyDown == null ? void 0 : onKeyDown(event);
167
- };
168
- const handleFocus = (event) => {
169
- setFocusedState(true);
170
- onFocus == null ? void 0 : onFocus(event);
171
- };
172
- const ignoreBlur = useRef(false);
173
- const handleBlur = (event) => {
174
- if (!ignoreBlur.current) {
149
+ }
150
+ break;
151
+ case "Escape":
175
152
  setOpen(event, false);
176
- }
177
- ignoreBlur.current = false;
178
- setFocusedState(false);
179
- onBlur == null ? void 0 : onBlur(event);
180
- };
181
- const handleClick = (event) => {
182
- if (!readOnly) {
183
- setOpen(event, true);
184
- }
185
- onClick == null ? void 0 : onClick(event);
186
- };
187
- const handleChange = (event) => {
188
- if (!openState) {
189
- setOpen(event, true);
190
- }
191
- if (event.target.value === "" && !multiselect) {
192
- clear(event);
193
- }
194
- setValueState(event.target.value);
195
- queueMicrotask(() => {
196
- const newOption = getOptionAtIndex(0);
197
- if (newOption) {
198
- setActive(newOption);
153
+ break;
154
+ case "Tab":
155
+ if (!multiselect && activeState) {
156
+ select(event, activeState);
199
157
  }
200
- });
201
- onChange == null ? void 0 : onChange(event);
202
- };
203
- const handleListMouseOver = () => {
204
- setFocusVisibleState(false);
205
- };
206
- const handleListMouseDown = () => {
207
- ignoreBlur.current = true;
208
- };
209
- const handleListFocus = () => {
210
- var _a2;
211
- (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
212
- };
213
- const handleListClick = () => {
214
- var _a2;
215
- (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
216
- };
217
- useEffect(() => {
218
- const activeIndex = activeState ? getIndexOfOption(activeState) : -1;
219
- if (openState && activeIndex < 0) {
220
- if (openKey.current.key === "ArrowDown") {
221
- setActive(getOptionAtIndex(0));
222
- } else if (openKey.current.key === "ArrowUp") {
223
- setActive(getOptionAtIndex(options.length - 1));
224
- } else {
225
- if (selectedState.length > 0) {
226
- const selected2 = getOptionsMatching(
227
- (option) => option.value === selectedState[0]
228
- ).pop();
229
- if (selected2) {
230
- setActive(selected2);
231
- }
232
- } else {
233
- setActive(getOptionAtIndex(0));
158
+ break;
159
+ }
160
+ if (newActive && (newActive == null ? void 0 : newActive.id) != (activeState == null ? void 0 : activeState.id)) {
161
+ event.preventDefault();
162
+ setActive(newActive);
163
+ setFocusVisibleState(true);
164
+ }
165
+ onKeyDown == null ? void 0 : onKeyDown(event);
166
+ };
167
+ const handleFocus = (event) => {
168
+ setFocusedState(true);
169
+ onFocus == null ? void 0 : onFocus(event);
170
+ };
171
+ const ignoreBlur = useRef(false);
172
+ const handleBlur = (event) => {
173
+ if (!ignoreBlur.current) {
174
+ setOpen(event, false);
175
+ }
176
+ ignoreBlur.current = false;
177
+ setFocusedState(false);
178
+ onBlur == null ? void 0 : onBlur(event);
179
+ };
180
+ const handleClick = (event) => {
181
+ if (!readOnly) {
182
+ setOpen(event, true);
183
+ }
184
+ onClick == null ? void 0 : onClick(event);
185
+ };
186
+ const handleChange = (event) => {
187
+ if (!openState) {
188
+ setOpen(event, true);
189
+ }
190
+ if (event.target.value === "" && !multiselect) {
191
+ clear(event);
192
+ }
193
+ setValueState(event.target.value);
194
+ queueMicrotask(() => {
195
+ const newOption = getOptionAtIndex(0);
196
+ if (newOption) {
197
+ setActive(newOption);
198
+ }
199
+ });
200
+ onChange == null ? void 0 : onChange(event);
201
+ };
202
+ const handleListMouseOver = () => {
203
+ setFocusVisibleState(false);
204
+ };
205
+ const handleListMouseDown = () => {
206
+ ignoreBlur.current = true;
207
+ };
208
+ const handleListFocus = () => {
209
+ var _a2;
210
+ (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
211
+ };
212
+ const handleListClick = () => {
213
+ var _a2;
214
+ (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
215
+ };
216
+ useEffect(() => {
217
+ const activeIndex = activeState ? getIndexOfOption(activeState) : -1;
218
+ if (openState && activeIndex < 0) {
219
+ if (openKey.current.key === "ArrowDown") {
220
+ setActive(getOptionAtIndex(0));
221
+ } else if (openKey.current.key === "ArrowUp") {
222
+ setActive(getOptionAtIndex(options.length - 1));
223
+ } else {
224
+ if (selectedState.length > 0) {
225
+ const selected2 = getOptionsMatching(
226
+ (option) => option.value === selectedState[0]
227
+ ).pop();
228
+ if (selected2) {
229
+ setActive(selected2);
234
230
  }
231
+ } else {
232
+ setActive(getOptionAtIndex(0));
235
233
  }
236
- } else if (!openState) {
237
- setActive(void 0);
238
234
  }
239
- }, [openState, children]);
240
- const buttonId = useId();
241
- const listId = useId();
242
- return /* @__PURE__ */ jsxs(ListControlContext.Provider, {
243
- value: listControl,
244
- children: [
245
- /* @__PURE__ */ jsx(Input, {
246
- className: clsx(withBaseName(), className),
247
- endAdornment: /* @__PURE__ */ jsxs(Fragment, {
248
- children: [
249
- endAdornment,
250
- !readOnly ? /* @__PURE__ */ jsx(Button, {
251
- "aria-labelledby": clsx(buttonId, formFieldLabelledBy),
252
- "aria-label": "Show options",
253
- "aria-expanded": openState,
254
- "aria-controls": openState ? listId : void 0,
255
- "aria-haspopup": "listbox",
256
- disabled,
257
- variant: "secondary",
258
- onClick: handleButtonClick,
259
- onFocus: handleButtonFocus,
260
- tabIndex: -1,
261
- children: openState ? /* @__PURE__ */ jsx(ChevronUpIcon, {
262
- "aria-hidden": true
263
- }) : /* @__PURE__ */ jsx(ChevronDownIcon, {
264
- "aria-hidden": true
265
- })
266
- }) : void 0
267
- ]
268
- }),
269
- onClick: handleClick,
270
- onBlur: handleBlur,
271
- onFocus: handleFocus,
272
- onKeyDown: handleKeyDown,
273
- onChange: handleChange,
274
- role: "combobox",
275
- disabled,
276
- readOnly,
277
- inputProps: {
278
- role: "combobox",
279
- "aria-expanded": openState,
280
- "aria-multiselectable": multiselect,
281
- "aria-controls": openState ? listId : void 0,
282
- ...inputPropsProp
283
- },
284
- "aria-activedescendant": activeState == null ? void 0 : activeState.id,
285
- variant,
286
- inputRef,
287
- value: valueState,
288
- ...rest,
289
- ref: handleRef
235
+ } else if (!openState) {
236
+ setActive(void 0);
237
+ }
238
+ }, [openState, children]);
239
+ const buttonId = useId();
240
+ const listId = useId();
241
+ return /* @__PURE__ */ jsxs(ListControlContext.Provider, {
242
+ value: listControl,
243
+ children: [
244
+ /* @__PURE__ */ jsx(Input, {
245
+ className: clsx(withBaseName(), className),
246
+ endAdornment: /* @__PURE__ */ jsxs(Fragment, {
247
+ children: [
248
+ endAdornment,
249
+ !readOnly ? /* @__PURE__ */ jsx(Button, {
250
+ "aria-labelledby": clsx(buttonId, formFieldLabelledBy),
251
+ "aria-label": "Show options",
252
+ "aria-expanded": openState,
253
+ "aria-controls": openState ? listId : void 0,
254
+ "aria-haspopup": "listbox",
255
+ disabled,
256
+ variant: "secondary",
257
+ onClick: handleButtonClick,
258
+ onFocus: handleButtonFocus,
259
+ tabIndex: -1,
260
+ children: openState ? /* @__PURE__ */ jsx(ChevronUpIcon, {
261
+ "aria-hidden": true
262
+ }) : /* @__PURE__ */ jsx(ChevronDownIcon, {
263
+ "aria-hidden": true
264
+ })
265
+ }) : void 0
266
+ ]
290
267
  }),
291
- /* @__PURE__ */ jsx(FloatingComponent, {
292
- open: (openState || focusedState) && !readOnly,
293
- left: x != null ? x : 0,
294
- top: y != null ? y : 0,
295
- position: strategy,
296
- width: (_a = elements.floating) == null ? void 0 : _a.offsetWidth,
297
- height: (_b = elements.floating) == null ? void 0 : _b.offsetHeight,
298
- ref: floating,
299
- children: /* @__PURE__ */ jsx(OptionList, {
300
- collapsed: !openState,
301
- ref: listRef,
302
- id: listId,
303
- onMouseOver: handleListMouseOver,
304
- onMouseDown: handleListMouseDown,
305
- onFocus: handleListFocus,
306
- onClick: handleListClick,
307
- children
308
- })
268
+ onClick: handleClick,
269
+ onBlur: handleBlur,
270
+ onFocus: handleFocus,
271
+ onKeyDown: handleKeyDown,
272
+ onChange: handleChange,
273
+ role: "combobox",
274
+ disabled,
275
+ readOnly,
276
+ inputProps: {
277
+ role: "combobox",
278
+ "aria-expanded": openState,
279
+ "aria-multiselectable": multiselect,
280
+ "aria-controls": openState ? listId : void 0,
281
+ ...inputPropsProp
282
+ },
283
+ "aria-activedescendant": activeState == null ? void 0 : activeState.id,
284
+ variant,
285
+ inputRef,
286
+ value: valueState,
287
+ ...rest,
288
+ ref: handleRef
289
+ }),
290
+ /* @__PURE__ */ jsx(FloatingComponent, {
291
+ open: (openState || focusedState) && !readOnly && children != void 0,
292
+ left: x != null ? x : 0,
293
+ top: y != null ? y : 0,
294
+ position: strategy,
295
+ width: (_a = elements.floating) == null ? void 0 : _a.offsetWidth,
296
+ height: (_b = elements.floating) == null ? void 0 : _b.offsetHeight,
297
+ ref: floating,
298
+ children: /* @__PURE__ */ jsx(OptionList, {
299
+ collapsed: !openState,
300
+ ref: listRef,
301
+ id: listId,
302
+ onMouseOver: handleListMouseOver,
303
+ onMouseDown: handleListMouseDown,
304
+ onFocus: handleListFocus,
305
+ onClick: handleListClick,
306
+ children
309
307
  })
310
- ]
311
- });
312
- }
313
- );
308
+ })
309
+ ]
310
+ });
311
+ });
314
312
 
315
313
  export { ComboBoxNext };
316
314
  //# sourceMappingURL=ComboBoxNext.js.map