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