@yamada-ui/autocomplete 1.5.4-dev-20241005224505 → 1.5.4-dev-20241006032009

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/dist/autocomplete-context.d.mts +115 -115
  2. package/dist/autocomplete-context.d.ts +115 -115
  3. package/dist/autocomplete-context.js +2 -2
  4. package/dist/autocomplete-context.js.map +1 -1
  5. package/dist/autocomplete-context.mjs +1 -1
  6. package/dist/autocomplete-create.d.mts +4 -4
  7. package/dist/autocomplete-create.d.ts +4 -4
  8. package/dist/autocomplete-create.js +32 -32
  9. package/dist/autocomplete-create.js.map +1 -1
  10. package/dist/autocomplete-create.mjs +4 -4
  11. package/dist/autocomplete-empty.d.mts +4 -4
  12. package/dist/autocomplete-empty.d.ts +4 -4
  13. package/dist/autocomplete-empty.js +34 -34
  14. package/dist/autocomplete-empty.js.map +1 -1
  15. package/dist/autocomplete-empty.mjs +4 -4
  16. package/dist/autocomplete-icon.js +17 -17
  17. package/dist/autocomplete-icon.js.map +1 -1
  18. package/dist/autocomplete-icon.mjs +2 -2
  19. package/dist/autocomplete-list.d.mts +2 -2
  20. package/dist/autocomplete-list.d.ts +2 -2
  21. package/dist/autocomplete-list.js +18 -18
  22. package/dist/autocomplete-list.js.map +1 -1
  23. package/dist/autocomplete-list.mjs +3 -3
  24. package/dist/autocomplete-option-group.js +14 -14
  25. package/dist/autocomplete-option-group.js.map +1 -1
  26. package/dist/autocomplete-option-group.mjs +3 -3
  27. package/dist/autocomplete-option.d.mts +1 -1
  28. package/dist/autocomplete-option.d.ts +1 -1
  29. package/dist/autocomplete-option.js +47 -47
  30. package/dist/autocomplete-option.js.map +1 -1
  31. package/dist/autocomplete-option.mjs +4 -4
  32. package/dist/autocomplete.d.mts +31 -31
  33. package/dist/autocomplete.d.ts +31 -31
  34. package/dist/autocomplete.js +299 -297
  35. package/dist/autocomplete.js.map +1 -1
  36. package/dist/autocomplete.mjs +12 -12
  37. package/dist/{chunk-5GKGL6BL.mjs → chunk-2MVSDK7L.mjs} +16 -16
  38. package/dist/chunk-2MVSDK7L.mjs.map +1 -0
  39. package/dist/{chunk-JMX72TSD.mjs → chunk-2SISETLV.mjs} +11 -11
  40. package/dist/{chunk-JMX72TSD.mjs.map → chunk-2SISETLV.mjs.map} +1 -1
  41. package/dist/{chunk-OLOU5HFC.mjs → chunk-4APEPTYJ.mjs} +169 -167
  42. package/dist/chunk-4APEPTYJ.mjs.map +1 -0
  43. package/dist/{chunk-6F3LT7J6.mjs → chunk-EWV3Q3S4.mjs} +7 -7
  44. package/dist/{chunk-6F3LT7J6.mjs.map → chunk-EWV3Q3S4.mjs.map} +1 -1
  45. package/dist/{chunk-Q2HZVVOI.mjs → chunk-I4IW2CW7.mjs} +16 -16
  46. package/dist/chunk-I4IW2CW7.mjs.map +1 -0
  47. package/dist/{chunk-7SWSKLSA.mjs → chunk-I5X4WSCX.mjs} +18 -18
  48. package/dist/chunk-I5X4WSCX.mjs.map +1 -0
  49. package/dist/{chunk-HZECQUHV.mjs → chunk-PXQD7AV2.mjs} +40 -40
  50. package/dist/{chunk-HZECQUHV.mjs.map → chunk-PXQD7AV2.mjs.map} +1 -1
  51. package/dist/{chunk-QPIWG4ZF.mjs → chunk-TJGVRIGK.mjs} +62 -60
  52. package/dist/chunk-TJGVRIGK.mjs.map +1 -0
  53. package/dist/{chunk-R76HPAN4.mjs → chunk-TR4X4EEG.mjs} +7 -7
  54. package/dist/{chunk-R76HPAN4.mjs.map → chunk-TR4X4EEG.mjs.map} +1 -1
  55. package/dist/{chunk-S53LMDD7.mjs → chunk-VTBUO5SK.mjs} +15 -15
  56. package/dist/chunk-VTBUO5SK.mjs.map +1 -0
  57. package/dist/{chunk-JPUKYLBW.mjs → chunk-WDQYM4FP.mjs} +5 -5
  58. package/dist/chunk-WDQYM4FP.mjs.map +1 -0
  59. package/dist/{chunk-S2HFYJVI.mjs → chunk-ZEGANG5C.mjs} +13 -13
  60. package/dist/chunk-ZEGANG5C.mjs.map +1 -0
  61. package/dist/{chunk-5LPWFWE6.mjs → chunk-ZJFWWXQM.mjs} +34 -34
  62. package/dist/chunk-ZJFWWXQM.mjs.map +1 -0
  63. package/dist/index.d.mts +4 -4
  64. package/dist/index.d.ts +4 -4
  65. package/dist/index.js +351 -347
  66. package/dist/index.js.map +1 -1
  67. package/dist/index.mjs +13 -13
  68. package/dist/multi-autocomplete.d.mts +51 -51
  69. package/dist/multi-autocomplete.d.ts +51 -51
  70. package/dist/multi-autocomplete.js +321 -317
  71. package/dist/multi-autocomplete.js.map +1 -1
  72. package/dist/multi-autocomplete.mjs +12 -12
  73. package/dist/use-autocomplete-list.d.mts +1 -1
  74. package/dist/use-autocomplete-list.d.ts +1 -1
  75. package/dist/use-autocomplete-list.js +7 -7
  76. package/dist/use-autocomplete-list.js.map +1 -1
  77. package/dist/use-autocomplete-list.mjs +2 -2
  78. package/dist/use-autocomplete-option-group.js +11 -11
  79. package/dist/use-autocomplete-option-group.js.map +1 -1
  80. package/dist/use-autocomplete-option-group.mjs +2 -2
  81. package/dist/use-autocomplete-option.d.mts +12 -12
  82. package/dist/use-autocomplete-option.d.ts +12 -12
  83. package/dist/use-autocomplete-option.js +34 -34
  84. package/dist/use-autocomplete-option.js.map +1 -1
  85. package/dist/use-autocomplete-option.mjs +2 -2
  86. package/dist/use-autocomplete.d.mts +86 -86
  87. package/dist/use-autocomplete.d.ts +86 -86
  88. package/dist/use-autocomplete.js +221 -219
  89. package/dist/use-autocomplete.js.map +1 -1
  90. package/dist/use-autocomplete.mjs +7 -7
  91. package/package.json +13 -13
  92. package/dist/chunk-5GKGL6BL.mjs.map +0 -1
  93. package/dist/chunk-5LPWFWE6.mjs.map +0 -1
  94. package/dist/chunk-7SWSKLSA.mjs.map +0 -1
  95. package/dist/chunk-JPUKYLBW.mjs.map +0 -1
  96. package/dist/chunk-OLOU5HFC.mjs.map +0 -1
  97. package/dist/chunk-Q2HZVVOI.mjs.map +0 -1
  98. package/dist/chunk-QPIWG4ZF.mjs.map +0 -1
  99. package/dist/chunk-S2HFYJVI.mjs.map +0 -1
  100. package/dist/chunk-S53LMDD7.mjs.map +0 -1
package/dist/index.js CHANGED
@@ -41,9 +41,9 @@ var import_use_descendant = require("@yamada-ui/use-descendant");
41
41
  var import_utils = require("@yamada-ui/utils");
42
42
  var {
43
43
  DescendantsContextProvider: AutocompleteDescendantsContextProvider,
44
- useDescendantsContext: useAutocompleteDescendantsContext,
44
+ useDescendant: useAutocompleteDescendant,
45
45
  useDescendants: useAutocompleteDescendants,
46
- useDescendant: useAutocompleteDescendant
46
+ useDescendantsContext: useAutocompleteDescendantsContext
47
47
  } = (0, import_use_descendant.createDescendant)();
48
48
  var [AutocompleteProvider, useAutocompleteContext] = (0, import_utils.createContext)({
49
49
  name: "AutocompleteContext",
@@ -65,27 +65,27 @@ var AutocompleteIcon = (0, import_core.forwardRef)(
65
65
  ({ className, children, __css, ...rest }, ref) => {
66
66
  const { styles } = useAutocompleteContext();
67
67
  const css = {
68
- position: "absolute",
69
- top: "50%",
70
- transform: "translateY(-50%)",
71
- display: "inline-flex",
72
68
  alignItems: "center",
69
+ cursor: "pointer",
70
+ display: "inline-flex",
73
71
  justifyContent: "center",
74
72
  pointerEvents: "none",
75
- cursor: "pointer",
73
+ position: "absolute",
74
+ top: "50%",
75
+ transform: "translateY(-50%)",
76
76
  ...styles.icon,
77
77
  ...__css
78
78
  };
79
79
  const validChildren = (0, import_utils2.getValidChildren)(children);
80
80
  const cloneChildren = validChildren.map(
81
81
  (child) => (0, import_react.cloneElement)(child, {
82
- focusable: false,
83
- "aria-hidden": true,
84
82
  style: {
85
- maxWidth: "1em",
83
+ color: "currentColor",
86
84
  maxHeight: "1em",
87
- color: "currentColor"
88
- }
85
+ maxWidth: "1em"
86
+ },
87
+ focusable: false,
88
+ "aria-hidden": true
89
89
  })
90
90
  );
91
91
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -118,11 +118,11 @@ var AutocompleteClearIcon = ({
118
118
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
119
119
  AutocompleteIcon,
120
120
  {
121
- "aria-label": "Clear value",
122
121
  className: (0, import_utils2.cx)("ui-autocomplete__icon--clear", className),
122
+ "aria-label": "Clear value",
123
123
  __css: styles.clearIcon,
124
124
  ...rest,
125
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, { w: "0.5em", h: "0.5em" })
125
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, { h: "0.5em", w: "0.5em" })
126
126
  }
127
127
  );
128
128
  };
@@ -131,11 +131,11 @@ AutocompleteClearIcon.__ui__ = "AutocompleteClearIcon";
131
131
  var AutocompleteItemIcon = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
132
132
  const { styles } = useAutocompleteContext();
133
133
  const css = {
134
- flexShrink: 0,
135
- display: "inline-flex",
136
- justifyContent: "center",
137
134
  alignItems: "center",
135
+ display: "inline-flex",
136
+ flexShrink: 0,
138
137
  fontSize: "0.85em",
138
+ justifyContent: "center",
139
139
  ...styles.itemIcon
140
140
  };
141
141
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -156,36 +156,36 @@ var import_utils3 = require("@yamada-ui/utils");
156
156
  var import_react2 = require("react");
157
157
  var isTargetOption = (target) => {
158
158
  var _a;
159
- return (0, import_utils3.isHTMLElement)(target) && !!((_a = target == null ? void 0 : target.getAttribute("role")) == null ? void 0 : _a.startsWith("option"));
159
+ return (0, import_utils3.isHTMLElement)(target) && !!((_a = target.getAttribute("role")) == null ? void 0 : _a.startsWith("option"));
160
160
  };
161
161
  var useAutocompleteOption = (props) => {
162
162
  var _a, _b;
163
163
  const {
164
- value,
164
+ closeOnSelect: generalCloseOnSelect,
165
+ focusedIndex,
166
+ inputRef,
165
167
  omitSelectedValues,
168
+ setFocusedIndex,
169
+ value,
170
+ optionProps,
166
171
  onChange,
167
172
  onChangeLabel,
168
- focusedIndex,
169
- setFocusedIndex,
170
173
  onClose,
171
- closeOnSelect: generalCloseOnSelect,
172
- optionProps,
173
- inputRef,
174
174
  onFocusNext
175
175
  } = useAutocompleteContext();
176
176
  const id = (0, import_react2.useId)();
177
177
  let {
178
+ children,
179
+ closeOnSelect: customCloseOnSelect,
178
180
  icon: customIcon,
179
181
  isDisabled,
180
182
  isFocusable,
181
- closeOnSelect: customCloseOnSelect,
182
- children,
183
183
  value: optionValue,
184
184
  ...computedProps
185
185
  } = { ...optionProps, ...props };
186
186
  const trulyDisabled = !!isDisabled && !isFocusable;
187
187
  const itemRef = (0, import_react2.useRef)(null);
188
- const { index, register, descendants } = useAutocompleteDescendant({
188
+ const { descendants, index, register } = useAutocompleteDescendant({
189
189
  disabled: trulyDisabled
190
190
  });
191
191
  const values = descendants.values();
@@ -235,27 +235,27 @@ var useAutocompleteOption = (props) => {
235
235
  border: "0px",
236
236
  clip: "rect(0px, 0px, 0px, 0px)",
237
237
  height: "1px",
238
- width: "1px",
239
238
  margin: "-1px",
240
- padding: "0px",
241
239
  overflow: "hidden",
240
+ padding: "0px",
241
+ position: "absolute",
242
242
  whiteSpace: "nowrap",
243
- position: "absolute"
243
+ width: "1px"
244
244
  };
245
245
  return {
246
- ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
247
246
  id,
247
+ ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
248
248
  role: "option",
249
249
  ...computedProps,
250
250
  ...props2,
251
- tabIndex: -1,
252
251
  style: !isTarget || omitSelectedValues && isSelected ? style : void 0,
253
- "data-target": (0, import_utils3.dataAttr)(true),
254
- "data-value": optionValue != null ? optionValue : "",
255
- "data-focus": (0, import_utils3.dataAttr)(isFocused),
256
- "data-disabled": (0, import_utils3.dataAttr)(isDisabled),
252
+ tabIndex: -1,
257
253
  "aria-checked": isSelected,
258
254
  "aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
255
+ "data-disabled": (0, import_utils3.dataAttr)(isDisabled),
256
+ "data-focus": (0, import_utils3.dataAttr)(isFocused),
257
+ "data-target": (0, import_utils3.dataAttr)(true),
258
+ "data-value": optionValue != null ? optionValue : "",
259
259
  onClick: (0, import_utils3.handlerAll)(computedProps.onClick, props2.onClick, onClick)
260
260
  };
261
261
  },
@@ -273,10 +273,10 @@ var useAutocompleteOption = (props) => {
273
273
  ]
274
274
  );
275
275
  return {
276
- isSelected,
277
- isFocused,
278
- customIcon,
279
276
  children,
277
+ customIcon,
278
+ isFocused,
279
+ isSelected,
280
280
  getOptionProps
281
281
  };
282
282
  };
@@ -288,18 +288,18 @@ var useAutocompleteCreate = () => {
288
288
  border: "0px",
289
289
  clip: "rect(0px, 0px, 0px, 0px)",
290
290
  height: "1px",
291
- width: "1px",
292
291
  margin: "-1px",
293
- padding: "0px",
294
292
  overflow: "hidden",
293
+ padding: "0px",
294
+ position: "absolute",
295
295
  whiteSpace: "nowrap",
296
- position: "absolute"
296
+ width: "1px"
297
297
  };
298
298
  return {
299
299
  ref,
300
300
  ...props,
301
- tabIndex: -1,
302
301
  style: isHit ? style : void 0,
302
+ tabIndex: -1,
303
303
  "data-focus": (0, import_utils3.dataAttr)(!isHit),
304
304
  onClick: (0, import_utils3.handlerAll)(props.onClick, onCreate)
305
305
  };
@@ -309,25 +309,25 @@ var useAutocompleteCreate = () => {
309
309
  return { getCreateProps };
310
310
  };
311
311
  var useAutocompleteEmpty = () => {
312
- const { isHit, isEmpty } = useAutocompleteContext();
312
+ const { isEmpty, isHit } = useAutocompleteContext();
313
313
  const getEmptyProps = (0, import_react2.useCallback)(
314
314
  (props = {}, ref = null) => {
315
315
  const style = {
316
316
  border: "0px",
317
317
  clip: "rect(0px, 0px, 0px, 0px)",
318
318
  height: "1px",
319
- width: "1px",
320
319
  margin: "-1px",
321
- padding: "0px",
322
320
  overflow: "hidden",
321
+ padding: "0px",
322
+ position: "absolute",
323
323
  whiteSpace: "nowrap",
324
- position: "absolute"
324
+ width: "1px"
325
325
  };
326
326
  return {
327
327
  ref,
328
328
  ...props,
329
- tabIndex: -1,
330
- style: isHit && !isEmpty ? style : void 0
329
+ style: isHit && !isEmpty ? style : void 0,
330
+ tabIndex: -1
331
331
  };
332
332
  },
333
333
  [isHit, isEmpty]
@@ -338,21 +338,21 @@ var useAutocompleteEmpty = () => {
338
338
  // src/autocomplete-create.tsx
339
339
  var import_jsx_runtime2 = require("react/jsx-runtime");
340
340
  var AutocompleteCreate = (0, import_core2.forwardRef)(
341
- ({ className, icon, children, ...rest }, ref) => {
341
+ ({ className, children, icon, ...rest }, ref) => {
342
342
  const { inputValue, styles } = useAutocompleteContext();
343
343
  const { getCreateProps } = useAutocompleteCreate();
344
344
  children != null ? children : children = inputValue;
345
345
  const css = {
346
- textDecoration: "none",
346
+ alignItems: "center",
347
347
  color: "inherit",
348
- userSelect: "none",
349
348
  display: "flex",
350
- width: "100%",
351
- alignItems: "center",
352
- textAlign: "start",
353
349
  flex: "0 0 auto",
354
- outline: 0,
355
350
  gap: "0.75rem",
351
+ outline: 0,
352
+ textAlign: "start",
353
+ textDecoration: "none",
354
+ userSelect: "none",
355
+ width: "100%",
356
356
  ...styles.item
357
357
  };
358
358
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -363,7 +363,7 @@ var AutocompleteCreate = (0, import_core2.forwardRef)(
363
363
  ...getCreateProps(rest, ref),
364
364
  children: [
365
365
  icon !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutocompleteItemIcon, { children: icon || /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutocompletePlusIcon, {}) }) : null,
366
- icon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.span, { style: { pointerEvents: "none", flex: 1 }, lineClamp: 1, children: (0, import_utils4.runIfFunc)(children, inputValue) }) : (0, import_utils4.runIfFunc)(children, inputValue)
366
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.span, { style: { flex: 1, pointerEvents: "none" }, lineClamp: 1, children: (0, import_utils4.runIfFunc)(children, inputValue) }) : (0, import_utils4.runIfFunc)(children, inputValue)
367
367
  ]
368
368
  }
369
369
  );
@@ -371,11 +371,11 @@ var AutocompleteCreate = (0, import_core2.forwardRef)(
371
371
  );
372
372
  AutocompleteCreate.displayName = "AutocompleteCreate";
373
373
  AutocompleteCreate.__ui__ = "AutocompleteCreate";
374
- var AutocompletePlusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 45.402 45.402", width: "1em", height: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
374
+ var AutocompletePlusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { height: "1em", viewBox: "0 0 45.402 45.402", width: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
375
375
  "path",
376
376
  {
377
- fill: "currentColor",
378
- d: "M41.267,18.557H26.832V4.134C26.832,1.851,24.99,0,22.707,0c-2.283,0-4.124,1.851-4.124,4.135v14.432H4.141 c-2.283,0-4.139,1.851-4.138,4.135c-0.001,1.141,0.46,2.187,1.207,2.934c0.748,0.749,1.78,1.222,2.92,1.222h14.453V41.27 c0,1.142,0.453,2.176,1.201,2.922c0.748,0.748,1.777,1.211,2.919,1.211c2.282,0,4.129-1.851,4.129-4.133V26.857h14.435 c2.283,0,4.134-1.867,4.133-4.15C45.399,20.425,43.548,18.557,41.267,18.557z"
377
+ d: "M41.267,18.557H26.832V4.134C26.832,1.851,24.99,0,22.707,0c-2.283,0-4.124,1.851-4.124,4.135v14.432H4.141 c-2.283,0-4.139,1.851-4.138,4.135c-0.001,1.141,0.46,2.187,1.207,2.934c0.748,0.749,1.78,1.222,2.92,1.222h14.453V41.27 c0,1.142,0.453,2.176,1.201,2.922c0.748,0.748,1.777,1.211,2.919,1.211c2.282,0,4.129-1.851,4.129-4.133V26.857h14.435 c2.283,0,4.134-1.867,4.133-4.15C45.399,20.425,43.548,18.557,41.267,18.557z",
378
+ fill: "currentColor"
379
379
  }
380
380
  ) });
381
381
  AutocompletePlusIcon.displayName = "AutocompletePlusIcon";
@@ -386,22 +386,22 @@ var import_core3 = require("@yamada-ui/core");
386
386
  var import_utils5 = require("@yamada-ui/utils");
387
387
  var import_jsx_runtime3 = require("react/jsx-runtime");
388
388
  var AutocompleteEmpty = (0, import_core3.forwardRef)(
389
- ({ className, icon, children, ...rest }, ref) => {
389
+ ({ className, children, icon, ...rest }, ref) => {
390
390
  const { emptyMessage, styles } = useAutocompleteContext();
391
391
  const { getEmptyProps } = useAutocompleteEmpty();
392
392
  children != null ? children : children = emptyMessage;
393
393
  const css = {
394
- textDecoration: "none",
394
+ alignItems: "center",
395
395
  color: "inherit",
396
- userSelect: "none",
397
396
  display: "flex",
398
- width: "100%",
399
- alignItems: "center",
400
- textAlign: "start",
401
397
  flex: "0 0 auto",
402
- outline: 0,
403
398
  gap: "0.75rem",
399
+ outline: 0,
404
400
  pointerEvents: "none",
401
+ textAlign: "start",
402
+ textDecoration: "none",
403
+ userSelect: "none",
404
+ width: "100%",
405
405
  ...styles.item
406
406
  };
407
407
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
@@ -412,7 +412,7 @@ var AutocompleteEmpty = (0, import_core3.forwardRef)(
412
412
  ...getEmptyProps(rest, ref),
413
413
  children: [
414
414
  icon !== null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AutocompleteItemIcon, { children: icon || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AutocompleteMinusIcon, {}) }) : null,
415
- icon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.span, { style: { pointerEvents: "none", flex: 1 }, lineClamp: 1, children }) : children
415
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.span, { style: { flex: 1, pointerEvents: "none" }, lineClamp: 1, children }) : children
416
416
  ]
417
417
  }
418
418
  );
@@ -420,11 +420,11 @@ var AutocompleteEmpty = (0, import_core3.forwardRef)(
420
420
  );
421
421
  AutocompleteEmpty.displayName = "AutocompleteEmpty";
422
422
  AutocompleteEmpty.__ui__ = "AutocompleteEmpty";
423
- var AutocompleteMinusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 448 512", width: "1em", height: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
423
+ var AutocompleteMinusIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { height: "1em", viewBox: "0 0 448 512", width: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
424
424
  "path",
425
425
  {
426
- fill: "currentColor",
427
- d: "M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z"
426
+ d: "M432 256c0 17.7-14.3 32-32 32L48 288c-17.7 0-32-14.3-32-32s14.3-32 32-32l352 0c17.7 0 32 14.3 32 32z",
427
+ fill: "currentColor"
428
428
  }
429
429
  ) });
430
430
  AutocompleteMinusIcon.displayName = "AutocompleteMinusIcon";
@@ -480,20 +480,20 @@ var useAutocompleteList = () => {
480
480
  (props = {}, ref = null) => {
481
481
  var _a;
482
482
  return {
483
- as: "ul",
483
+ id: (_a = props.id) != null ? _a : uuid,
484
484
  ref: (0, import_utils6.mergeRefs)(listRef, ref),
485
+ as: "ul",
486
+ position: "relative",
485
487
  role: "listbox",
486
488
  tabIndex: -1,
487
- position: "relative",
488
- id: (_a = props.id) != null ? _a : uuid,
489
489
  ...props
490
490
  };
491
491
  },
492
492
  [listRef, uuid]
493
493
  );
494
494
  return {
495
- onAnimationComplete,
496
- getListProps
495
+ getListProps,
496
+ onAnimationComplete
497
497
  };
498
498
  };
499
499
 
@@ -502,21 +502,21 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
502
502
  var AutocompleteList = (0, import_core4.forwardRef)(
503
503
  ({
504
504
  className,
505
- w,
506
- width,
507
- minW,
508
- minWidth,
505
+ children,
506
+ footer,
507
+ header,
509
508
  maxW,
510
509
  maxWidth,
510
+ minW,
511
+ minWidth,
512
+ w,
513
+ width,
511
514
  contentProps,
512
- header,
513
- footer,
514
- children,
515
515
  ...rest
516
516
  }, ref) => {
517
517
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
518
518
  const { styles } = useAutocompleteContext();
519
- const { onAnimationComplete, getListProps } = useAutocompleteList();
519
+ const { getListProps, onAnimationComplete } = useAutocompleteList();
520
520
  width != null ? width : width = w;
521
521
  width != null ? width : width = (_c = (_a = styles.list) == null ? void 0 : _a.width) != null ? _c : (_b = styles.list) == null ? void 0 : _b.w;
522
522
  minWidth != null ? minWidth : minWidth = minW;
@@ -528,10 +528,10 @@ var AutocompleteList = (0, import_core4.forwardRef)(
528
528
  {
529
529
  as: "div",
530
530
  className: "ui-autocomplete__popover",
531
- width,
532
- minWidth,
533
531
  maxWidth,
534
- __css: { ...styles.content, width, minWidth, maxWidth },
532
+ minWidth,
533
+ width,
534
+ __css: { ...styles.content, maxWidth, minWidth, width },
535
535
  ...contentProps,
536
536
  onAnimationComplete: (0, import_utils7.handlerAll)(
537
537
  contentProps == null ? void 0 : contentProps.onAnimationComplete,
@@ -587,19 +587,19 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
587
587
  var AutocompleteOption = (0, import_core5.forwardRef)(
588
588
  ({ className, icon, ...rest }, ref) => {
589
589
  const { styles } = useAutocompleteContext();
590
- const { isSelected, customIcon, children, getOptionProps } = useAutocompleteOption(rest);
590
+ const { children, customIcon, isSelected, getOptionProps } = useAutocompleteOption(rest);
591
591
  icon != null ? icon : icon = customIcon;
592
592
  const css = {
593
- textDecoration: "none",
593
+ alignItems: "center",
594
594
  color: "inherit",
595
- userSelect: "none",
596
595
  display: "flex",
597
- width: "100%",
598
- alignItems: "center",
599
- textAlign: "start",
600
596
  flex: "0 0 auto",
601
- outline: 0,
602
597
  gap: "0.75rem",
598
+ outline: 0,
599
+ textAlign: "start",
600
+ textDecoration: "none",
601
+ userSelect: "none",
602
+ width: "100%",
603
603
  ...styles.item
604
604
  };
605
605
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
@@ -618,7 +618,7 @@ var AutocompleteOption = (0, import_core5.forwardRef)(
618
618
  );
619
619
  AutocompleteOption.displayName = "AutocompleteOption";
620
620
  AutocompleteOption.__ui__ = "AutocompleteOption";
621
- var AutocompleteCheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 14 14", width: "1em", height: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
621
+ var AutocompleteCheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { height: "1em", viewBox: "0 0 14 14", width: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
622
622
  "polygon",
623
623
  {
624
624
  fill: "currentColor",
@@ -640,7 +640,7 @@ var useAutocompleteOptionGroup = ({
640
640
  label,
641
641
  ...rest
642
642
  }) => {
643
- const { value, omitSelectedValues } = useAutocompleteContext();
643
+ const { omitSelectedValues, value } = useAutocompleteContext();
644
644
  const isMulti = (0, import_utils9.isArray)(value);
645
645
  const descendants = useAutocompleteDescendantsContext();
646
646
  const values = descendants.values();
@@ -652,7 +652,7 @@ var useAutocompleteOptionGroup = ({
652
652
  ) : [];
653
653
  const selectedIndexes = selectedValues.map(({ index }) => index);
654
654
  const childValues = values.filter(
655
- ({ node, index }) => {
655
+ ({ index, node }) => {
656
656
  var _a;
657
657
  return ((_a = node.parentElement) == null ? void 0 : _a.dataset.label) === label && !selectedIndexes.includes(index) && "target" in node.dataset;
658
658
  }
@@ -665,20 +665,20 @@ var useAutocompleteOptionGroup = ({
665
665
  border: "0px",
666
666
  clip: "rect(0px, 0px, 0px, 0px)",
667
667
  height: "1px",
668
- width: "1px",
669
668
  margin: "-1px",
670
- padding: "0px",
671
669
  overflow: "hidden",
670
+ padding: "0px",
671
+ position: "absolute",
672
672
  whiteSpace: "nowrap",
673
- position: "absolute"
673
+ width: "1px"
674
674
  };
675
675
  return {
676
676
  ref,
677
677
  ...props,
678
678
  ...containerProps,
679
679
  style: isEmpty ? style : void 0,
680
- "data-label": label,
681
- role: "autocomplete-group-container"
680
+ role: "autocomplete-group-container",
681
+ "data-label": label
682
682
  };
683
683
  },
684
684
  [containerProps, isEmpty, label]
@@ -688,8 +688,8 @@ var useAutocompleteOptionGroup = ({
688
688
  ref,
689
689
  ...props,
690
690
  ...groupProps,
691
- "data-label": label,
692
- role: "autocomplete-group"
691
+ role: "autocomplete-group",
692
+ "data-label": label
693
693
  }),
694
694
  [groupProps, label]
695
695
  );
@@ -705,12 +705,12 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
705
705
  var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
706
706
  ({
707
707
  className,
708
+ children,
708
709
  color,
709
710
  h,
710
711
  height,
711
712
  minH,
712
713
  minHeight,
713
- children,
714
714
  labelProps,
715
715
  ...rest
716
716
  }, ref) => {
@@ -726,15 +726,15 @@ var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
726
726
  "ui-autocomplete__item--group",
727
727
  className
728
728
  ),
729
- __css: { w: "100%", h: "fit-content", color },
729
+ __css: { color, h: "fit-content", w: "100%" },
730
730
  ...getContainerProps(),
731
731
  children: [
732
732
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
733
733
  import_core7.ui.span,
734
734
  {
735
735
  className: "ui-autocomplete__item__group-label",
736
- __css: styles.groupLabel,
737
736
  lineClamp: 1,
737
+ __css: styles.groupLabel,
738
738
  ...labelProps,
739
739
  children: label
740
740
  }
@@ -759,64 +759,79 @@ AutocompleteOptionGroup.__ui__ = "AutocompleteOptionGroup";
759
759
  // src/use-autocomplete.tsx
760
760
  var import_jsx_runtime7 = require("react/jsx-runtime");
761
761
  var kanaMap = {
762
- \uFF76\uFF9E: "\u30AC",
763
- \uFF77\uFF9E: "\u30AE",
764
- \uFF78\uFF9E: "\u30B0",
765
- \uFF79\uFF9E: "\u30B2",
766
- \uFF7A\uFF9E: "\u30B4",
767
- \uFF7B\uFF9E: "\u30B6",
768
- \uFF7C\uFF9E: "\u30B8",
769
- \uFF7D\uFF9E: "\u30BA",
770
- \uFF7E\uFF9E: "\u30BC",
771
- \uFF7F\uFF9E: "\u30BE",
772
- \uFF80\uFF9E: "\u30C0",
773
- \uFF81\uFF9E: "\u30C2",
774
- \uFF82\uFF9E: "\u30C5",
775
- \uFF83\uFF9E: "\u30C7",
776
- \uFF84\uFF9E: "\u30C9",
777
- \uFF8A\uFF9E: "\u30D0",
778
- \uFF8B\uFF9E: "\u30D3",
779
- \uFF8C\uFF9E: "\u30D6",
780
- \uFF8D\uFF9E: "\u30D9",
781
- \uFF8E\uFF9E: "\u30DC",
782
- \uFF8A\uFF9F: "\u30D1",
783
- \uFF8B\uFF9F: "\u30D4",
784
- \uFF8C\uFF9F: "\u30D7",
785
- \uFF8D\uFF9F: "\u30DA",
786
- \uFF8E\uFF9F: "\u30DD",
787
- \uFF73\uFF9E: "\u30F4",
788
- \uFF9C\uFF9E: "\u30F7",
762
+ "\uFF61": "\u3002",
763
+ "\uFF62": "\u300C",
764
+ "\uFF63": "\u300D",
765
+ "\uFF64": "\u3001",
766
+ "\uFF65": "\u30FB",
767
+ \uFF66: "\u30F2",
789
768
  \uFF66\uFF9E: "\u30FA",
769
+ \uFF67: "\u30A1",
770
+ \uFF68: "\u30A3",
771
+ \uFF69: "\u30A5",
772
+ \uFF6A: "\u30A7",
773
+ \uFF6B: "\u30A9",
774
+ \uFF6C: "\u30E3",
775
+ \uFF6D: "\u30E5",
776
+ \uFF6E: "\u30E7",
777
+ \uFF6F: "\u30C3",
778
+ \uFF70: "\u30FC",
790
779
  \uFF71: "\u30A2",
791
780
  \uFF72: "\u30A4",
792
781
  \uFF73: "\u30A6",
782
+ \uFF73\uFF9E: "\u30F4",
793
783
  \uFF74: "\u30A8",
794
784
  \uFF75: "\u30AA",
795
785
  \uFF76: "\u30AB",
786
+ \uFF76\uFF9E: "\u30AC",
796
787
  \uFF77: "\u30AD",
788
+ \uFF77\uFF9E: "\u30AE",
797
789
  \uFF78: "\u30AF",
790
+ \uFF78\uFF9E: "\u30B0",
798
791
  \uFF79: "\u30B1",
792
+ \uFF79\uFF9E: "\u30B2",
799
793
  \uFF7A: "\u30B3",
794
+ \uFF7A\uFF9E: "\u30B4",
800
795
  \uFF7B: "\u30B5",
796
+ \uFF7B\uFF9E: "\u30B6",
801
797
  \uFF7C: "\u30B7",
798
+ \uFF7C\uFF9E: "\u30B8",
802
799
  \uFF7D: "\u30B9",
800
+ \uFF7D\uFF9E: "\u30BA",
803
801
  \uFF7E: "\u30BB",
802
+ \uFF7E\uFF9E: "\u30BC",
804
803
  \uFF7F: "\u30BD",
804
+ \uFF7F\uFF9E: "\u30BE",
805
805
  \uFF80: "\u30BF",
806
+ \uFF80\uFF9E: "\u30C0",
806
807
  \uFF81: "\u30C1",
808
+ \uFF81\uFF9E: "\u30C2",
807
809
  \uFF82: "\u30C4",
810
+ \uFF82\uFF9E: "\u30C5",
808
811
  \uFF83: "\u30C6",
812
+ \uFF83\uFF9E: "\u30C7",
809
813
  \uFF84: "\u30C8",
814
+ \uFF84\uFF9E: "\u30C9",
810
815
  \uFF85: "\u30CA",
811
816
  \uFF86: "\u30CB",
812
817
  \uFF87: "\u30CC",
813
818
  \uFF88: "\u30CD",
814
819
  \uFF89: "\u30CE",
815
820
  \uFF8A: "\u30CF",
821
+ \uFF8A\uFF9E: "\u30D0",
822
+ \uFF8A\uFF9F: "\u30D1",
816
823
  \uFF8B: "\u30D2",
824
+ \uFF8B\uFF9E: "\u30D3",
825
+ \uFF8B\uFF9F: "\u30D4",
817
826
  \uFF8C: "\u30D5",
827
+ \uFF8C\uFF9E: "\u30D6",
828
+ \uFF8C\uFF9F: "\u30D7",
818
829
  \uFF8D: "\u30D8",
830
+ \uFF8D\uFF9E: "\u30D9",
831
+ \uFF8D\uFF9F: "\u30DA",
819
832
  \uFF8E: "\u30DB",
833
+ \uFF8E\uFF9E: "\u30DC",
834
+ \uFF8E\uFF9F: "\u30DD",
820
835
  \uFF8F: "\u30DE",
821
836
  \uFF90: "\u30DF",
822
837
  \uFF91: "\u30E0",
@@ -831,23 +846,8 @@ var kanaMap = {
831
846
  \uFF9A: "\u30EC",
832
847
  \uFF9B: "\u30ED",
833
848
  \uFF9C: "\u30EF",
834
- \uFF66: "\u30F2",
835
- \uFF9D: "\u30F3",
836
- \uFF67: "\u30A1",
837
- \uFF68: "\u30A3",
838
- \uFF69: "\u30A5",
839
- \uFF6A: "\u30A7",
840
- \uFF6B: "\u30A9",
841
- \uFF6F: "\u30C3",
842
- \uFF6C: "\u30E3",
843
- \uFF6D: "\u30E5",
844
- \uFF6E: "\u30E7",
845
- "\uFF61": "\u3002",
846
- "\uFF64": "\u3001",
847
- \uFF70: "\u30FC",
848
- "\uFF62": "\u300C",
849
- "\uFF63": "\u300D",
850
- "\uFF65": "\u30FB"
849
+ \uFF9C\uFF9E: "\u30F7",
850
+ \uFF9D: "\u30F3"
851
851
  };
852
852
  var defaultFormat = (value) => {
853
853
  value = value.replace(
@@ -875,46 +875,46 @@ var flattenItems = (items) => {
875
875
  };
876
876
  var useAutocomplete = (props) => {
877
877
  const {
878
- value: valueProp,
879
- defaultValue,
880
- onChange: onChangeProp,
881
- onCreate: onCreateProp,
882
- onSearch: onSearchProp,
883
- closeOnSelect = true,
884
- omitSelectedValues = false,
885
- maxSelectValues,
886
878
  allowCreate = false,
887
879
  allowFree = false,
888
- insertPositionItem = "first",
889
- emptyMessage = "No results found",
890
- format = defaultFormat,
891
- optionProps,
892
- placeholder,
893
- onKeyDown: onKeyDownProp,
894
- isOpen: isOpenProp,
895
- defaultIsOpen,
896
- onOpen: onOpenProp,
897
- onClose: onCloseProp,
880
+ animation,
881
+ boundary,
882
+ children,
883
+ closeDelay,
898
884
  closeOnBlur = true,
899
885
  closeOnEsc = true,
900
- openDelay,
901
- closeDelay,
886
+ closeOnSelect = true,
887
+ defaultIsOpen,
888
+ defaultValue,
889
+ duration = 0.2,
890
+ emptyMessage = "No results found",
891
+ eventListeners,
892
+ flip,
893
+ format = defaultFormat,
894
+ gutter,
895
+ insertPositionItem = "first",
902
896
  isLazy,
897
+ isOpen: isOpenProp,
898
+ items,
903
899
  lazyBehavior,
904
- animation,
905
- duration = 0.2,
900
+ matchWidth = true,
901
+ maxSelectValues,
902
+ modifiers,
906
903
  offset,
907
- gutter,
904
+ omitSelectedValues = false,
905
+ openDelay,
906
+ placeholder,
907
+ placement = "bottom-start",
908
908
  preventOverflow,
909
- flip,
910
- matchWidth = true,
911
- boundary,
912
- eventListeners,
913
909
  strategy,
914
- placement = "bottom-start",
915
- modifiers,
916
- items,
917
- children,
910
+ value: valueProp,
911
+ optionProps,
912
+ onChange: onChangeProp,
913
+ onClose: onCloseProp,
914
+ onCreate: onCreateProp,
915
+ onKeyDown: onKeyDownProp,
916
+ onOpen: onOpenProp,
917
+ onSearch: onSearchProp,
918
918
  ...rest
919
919
  } = (0, import_form_control.useFormControlProps)(props);
920
920
  const {
@@ -933,8 +933,8 @@ var useAutocomplete = (props) => {
933
933
  const prevValue = (0, import_react5.useRef)(void 0);
934
934
  const [resolvedItems, setResolvedItems] = (0, import_react5.useState)(items ? JSON.parse(JSON.stringify(items)) : void 0);
935
935
  const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
936
- value: valueProp,
937
936
  defaultValue,
937
+ value: valueProp,
938
938
  onChange: onChangeProp
939
939
  });
940
940
  const [label, setLabel] = (0, import_react5.useState)(void 0);
@@ -944,13 +944,13 @@ var useAutocomplete = (props) => {
944
944
  const [isHit, setIsHit] = (0, import_react5.useState)(true);
945
945
  const {
946
946
  isOpen,
947
- onOpen: onInternalOpen,
948
- onClose
947
+ onClose,
948
+ onOpen: onInternalOpen
949
949
  } = (0, import_use_disclosure.useDisclosure)({
950
- isOpen: isOpenProp,
951
950
  defaultIsOpen,
952
- onOpen: onOpenProp,
953
- onClose: onCloseProp
951
+ isOpen: isOpenProp,
952
+ onClose: onCloseProp,
953
+ onOpen: onOpenProp
954
954
  });
955
955
  const isFocused = focusedIndex > -1;
956
956
  const isCreate = focusedIndex === -2 && allowCreate;
@@ -976,7 +976,7 @@ var useAutocomplete = (props) => {
976
976
  );
977
977
  const selectedIndexes = selectedValues.map(({ index }) => index);
978
978
  const enabledValues = descendants.enabledValues(
979
- ({ node, index }) => "target" in node.dataset && !selectedIndexes.includes(index)
979
+ ({ index, node }) => "target" in node.dataset && !selectedIndexes.includes(index)
980
980
  );
981
981
  const validChildren = (0, import_utils11.getValidChildren)(children);
982
982
  const computedChildren = (0, import_react5.useMemo)(
@@ -985,7 +985,7 @@ var useAutocomplete = (props) => {
985
985
  const { label: label2, value: value2, ...props2 } = item;
986
986
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AutocompleteOption, { value: value2, ...props2, children: label2 }, i);
987
987
  } else if ("items" in item) {
988
- const { label: label2, items: items2 = [], ...props2 } = item;
988
+ const { items: items2 = [], label: label2, ...props2 } = item;
989
989
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AutocompleteOptionGroup, { label: label2, ...props2, children: items2.map(({ label: label3, value: value2, ...props3 }, i2) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AutocompleteOption, { value: value2, ...props3, children: label3 }, i2)) }, i);
990
990
  }
991
991
  }),
@@ -1000,6 +1000,7 @@ var useAutocomplete = (props) => {
1000
1000
  }, [allowCreate, formControlProps, isAllSelected, isEmpty, onInternalOpen]);
1001
1001
  const onFocusFirst = (0, import_react5.useCallback)(() => {
1002
1002
  const id2 = setTimeout(() => {
1003
+ var _a;
1003
1004
  if (isEmpty || isAllSelected) return;
1004
1005
  const first = descendants.enabledFirstValue(
1005
1006
  ({ node }) => "target" in node.dataset
@@ -1010,7 +1011,7 @@ var useAutocomplete = (props) => {
1010
1011
  } else {
1011
1012
  if (selectedIndexes.includes(first.index)) {
1012
1013
  const enabledFirst = enabledValues[0];
1013
- setFocusedIndex(enabledFirst.index);
1014
+ setFocusedIndex((_a = enabledFirst == null ? void 0 : enabledFirst.index) != null ? _a : -1);
1014
1015
  } else {
1015
1016
  setFocusedIndex(first.index);
1016
1017
  }
@@ -1028,6 +1029,7 @@ var useAutocomplete = (props) => {
1028
1029
  ]);
1029
1030
  const onFocusLast = (0, import_react5.useCallback)(() => {
1030
1031
  const id2 = setTimeout(() => {
1032
+ var _a;
1031
1033
  if (isEmpty || isAllSelected) return;
1032
1034
  const last = descendants.enabledLastValue(
1033
1035
  ({ node }) => "target" in node.dataset
@@ -1038,7 +1040,7 @@ var useAutocomplete = (props) => {
1038
1040
  } else {
1039
1041
  if (selectedIndexes.includes(last.index)) {
1040
1042
  const enabledLast = enabledValues.reverse()[0];
1041
- setFocusedIndex(enabledLast.index);
1043
+ setFocusedIndex((_a = enabledLast == null ? void 0 : enabledLast.index) != null ? _a : -1);
1042
1044
  } else {
1043
1045
  setFocusedIndex(last.index);
1044
1046
  }
@@ -1070,7 +1072,7 @@ var useAutocomplete = (props) => {
1070
1072
  const onFocusNext = (0, import_react5.useCallback)(
1071
1073
  (index = focusedIndex) => {
1072
1074
  const id2 = setTimeout(() => {
1073
- var _a;
1075
+ var _a, _b;
1074
1076
  const next = descendants.enabledNextValue(
1075
1077
  index,
1076
1078
  ({ node }) => "target" in node.dataset
@@ -1081,7 +1083,7 @@ var useAutocomplete = (props) => {
1081
1083
  } else {
1082
1084
  if (selectedIndexes.includes(next.index)) {
1083
1085
  const enabledNext = (_a = enabledValues.find(({ index: index2 }) => next.index < index2)) != null ? _a : enabledValues[0];
1084
- setFocusedIndex(enabledNext.index);
1086
+ setFocusedIndex((_b = enabledNext == null ? void 0 : enabledNext.index) != null ? _b : -1);
1085
1087
  } else {
1086
1088
  setFocusedIndex(next.index);
1087
1089
  }
@@ -1101,7 +1103,7 @@ var useAutocomplete = (props) => {
1101
1103
  const onFocusPrev = (0, import_react5.useCallback)(
1102
1104
  (index = focusedIndex) => {
1103
1105
  const id2 = setTimeout(() => {
1104
- var _a;
1106
+ var _a, _b;
1105
1107
  const prev = descendants.enabledPrevValue(
1106
1108
  index,
1107
1109
  ({ node }) => "target" in node.dataset
@@ -1112,7 +1114,7 @@ var useAutocomplete = (props) => {
1112
1114
  } else {
1113
1115
  if (selectedIndexes.includes(prev.index)) {
1114
1116
  const enabledPrev = (_a = enabledValues.reverse().find(({ index: index2 }) => index2 < prev.index)) != null ? _a : enabledValues[0];
1115
- setFocusedIndex(enabledPrev.index);
1117
+ setFocusedIndex((_b = enabledPrev == null ? void 0 : enabledPrev.index) != null ? _b : -1);
1116
1118
  } else {
1117
1119
  setFocusedIndex(prev.index);
1118
1120
  }
@@ -1136,7 +1138,7 @@ var useAutocomplete = (props) => {
1136
1138
  const values = descendants.values();
1137
1139
  let isHit2 = false;
1138
1140
  let isFocused2 = false;
1139
- values.forEach(({ node, index }) => {
1141
+ values.forEach(({ index, node }) => {
1140
1142
  var _a;
1141
1143
  if (format((_a = node.textContent) != null ? _a : "").includes(value2)) {
1142
1144
  isHit2 = true;
@@ -1194,7 +1196,7 @@ var useAutocomplete = (props) => {
1194
1196
  return selectedValues2[0];
1195
1197
  } else {
1196
1198
  selectedValues2.forEach((selectedValue) => {
1197
- const isSelected = (0, import_utils11.isArray)(prev) && prev.includes(selectedValue != null ? selectedValue : "");
1199
+ const isSelected = (0, import_utils11.isArray)(prev) && prev.includes(selectedValue);
1198
1200
  if (!isSelected) {
1199
1201
  prev = [...(0, import_utils11.isArray)(prev) ? prev : [], selectedValue];
1200
1202
  } else if (runOmit) {
@@ -1299,7 +1301,7 @@ var useAutocomplete = (props) => {
1299
1301
  ({ label: label2 }) => label2 === firstInsertPositionItem
1300
1302
  );
1301
1303
  const targetItem = newItems[i];
1302
- if (i !== -1 && "items" in targetItem) {
1304
+ if (i !== -1 && targetItem && "items" in targetItem) {
1303
1305
  if (secondInsertPositionItem === "first") {
1304
1306
  targetItem.items = [newItem, ...(_a = targetItem.items) != null ? _a : []];
1305
1307
  } else {
@@ -1383,15 +1385,15 @@ var useAutocomplete = (props) => {
1383
1385
  const actions = {
1384
1386
  ArrowDown: isFocused ? () => onFocusNext() : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : void 0,
1385
1387
  ArrowUp: isFocused ? () => onFocusPrev() : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusLastOrSelected) : void 0,
1386
- Space: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : void 0,
1388
+ Backspace: !isEmptyValue && enabledDelete ? onDelete : void 0,
1389
+ End: isOpen ? onFocusLast : void 0,
1387
1390
  Enter: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : allowFree && isMulti ? () => {
1388
1391
  if (inputValue) onChange(inputValue);
1389
1392
  setFocusedIndex(0);
1390
1393
  } : void 0,
1391
- Home: isOpen ? onFocusFirst : void 0,
1392
- End: isOpen ? onFocusLast : void 0,
1393
1394
  Escape: closeOnEsc ? onClose : void 0,
1394
- Backspace: !isEmptyValue && enabledDelete ? onDelete : void 0
1395
+ Home: isOpen ? onFocusFirst : void 0,
1396
+ Space: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : void 0
1395
1397
  };
1396
1398
  const action = actions[ev.key];
1397
1399
  if (!action) return;
@@ -1446,7 +1448,7 @@ var useAutocomplete = (props) => {
1446
1448
  (0, import_react5.useEffect)(() => {
1447
1449
  var _a;
1448
1450
  if (isMulti) {
1449
- if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value != null ? value : []))
1451
+ if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value))
1450
1452
  return;
1451
1453
  const label2 = getSelectedValues(value);
1452
1454
  setLabel(label2);
@@ -1472,34 +1474,34 @@ var useAutocomplete = (props) => {
1472
1474
  });
1473
1475
  (0, import_use_outside_click.useOutsideClick)({
1474
1476
  ref: containerRef,
1475
- handler: onClose,
1476
- enabled: isOpen && (closeOnBlur || !isHit)
1477
+ enabled: isOpen && (closeOnBlur || !isHit),
1478
+ handler: onClose
1477
1479
  });
1478
1480
  const getPopoverProps = (0, import_react5.useCallback)(
1479
1481
  (props2) => ({
1480
- closeOnBlur,
1481
- openDelay,
1482
+ animation,
1483
+ boundary,
1482
1484
  closeDelay,
1485
+ closeOnBlur,
1486
+ duration,
1487
+ eventListeners,
1488
+ flip,
1489
+ gutter,
1483
1490
  isLazy,
1484
1491
  lazyBehavior,
1485
- animation,
1486
- duration,
1492
+ matchWidth,
1493
+ modifiers,
1487
1494
  offset,
1488
- gutter,
1495
+ openDelay,
1496
+ placement,
1489
1497
  preventOverflow,
1490
- flip,
1491
- matchWidth,
1492
- boundary,
1493
- eventListeners,
1494
1498
  strategy,
1495
- placement,
1496
- modifiers,
1497
1499
  ...props2,
1498
- trigger: "never",
1499
1500
  closeOnButton: false,
1500
1501
  isOpen,
1501
- onOpen,
1502
- onClose
1502
+ trigger: "never",
1503
+ onClose,
1504
+ onOpen
1503
1505
  }),
1504
1506
  [
1505
1507
  closeOnBlur,
@@ -1530,8 +1532,8 @@ var useAutocomplete = (props) => {
1530
1532
  ...containerProps,
1531
1533
  ...props2,
1532
1534
  ...formControlProps,
1533
- onClick: (0, import_utils11.handlerAll)(props2.onClick, rest.onClick, onClick),
1534
- onBlur: (0, import_utils11.handlerAll)(props2.onBlur, rest.onBlur, onBlur)
1535
+ onBlur: (0, import_utils11.handlerAll)(props2.onBlur, rest.onBlur, onBlur),
1536
+ onClick: (0, import_utils11.handlerAll)(props2.onClick, rest.onClick, onClick)
1535
1537
  }),
1536
1538
  [containerProps, formControlProps, onBlur, onClick, rest]
1537
1539
  );
@@ -1542,8 +1544,8 @@ var useAutocomplete = (props) => {
1542
1544
  ...props2,
1543
1545
  ...formControlProps,
1544
1546
  placeholder,
1545
- "data-active": (0, import_utils11.dataAttr)(isOpen),
1546
1547
  "aria-expanded": (0, import_utils11.dataAttr)(isOpen),
1548
+ "data-active": (0, import_utils11.dataAttr)(isOpen),
1547
1549
  onFocus: (0, import_utils11.handlerAll)(props2.onFocus, onFocusProp, onFocus),
1548
1550
  onKeyDown: (0, import_utils11.handlerAll)(props2.onKeyDown, onKeyDownProp, onKeyDown)
1549
1551
  }),
@@ -1559,61 +1561,61 @@ var useAutocomplete = (props) => {
1559
1561
  );
1560
1562
  return {
1561
1563
  id,
1562
- descendants,
1563
- value,
1564
- label,
1565
- inputValue,
1566
- isHit,
1567
- isEmpty,
1568
- computedChildren,
1569
- focusedIndex,
1570
- omitSelectedValues,
1571
- closeOnSelect,
1572
1564
  allowCreate,
1573
1565
  allowFree,
1566
+ closeOnSelect,
1567
+ computedChildren,
1568
+ descendants,
1574
1569
  emptyMessage,
1575
- isOpen,
1570
+ focusedIndex,
1571
+ inputRef,
1572
+ inputValue,
1576
1573
  isAllSelected,
1574
+ isEmpty,
1575
+ isHit,
1576
+ isOpen,
1577
+ label,
1577
1578
  listRef,
1578
- inputRef,
1579
- optionProps,
1580
- formControlProps,
1579
+ omitSelectedValues,
1580
+ pickOptions,
1581
+ rebirthOptions,
1581
1582
  setFocusedIndex,
1582
- onChangeLabel,
1583
+ value,
1584
+ formControlProps,
1585
+ getContainerProps,
1586
+ getFieldProps,
1587
+ getPopoverProps,
1588
+ inputProps,
1589
+ optionProps,
1583
1590
  onChange,
1584
- onSearch,
1585
- onCreate,
1591
+ onChangeLabel,
1586
1592
  onClear,
1587
- onCompositionStart,
1588
- onCompositionEnd,
1589
- pickOptions,
1590
- rebirthOptions,
1591
- onOpen,
1592
1593
  onClose,
1594
+ onCompositionEnd,
1595
+ onCompositionStart,
1596
+ onCreate,
1593
1597
  onFocusFirst,
1594
1598
  onFocusLast,
1595
- onFocusSelected,
1596
1599
  onFocusNext,
1597
1600
  onFocusPrev,
1598
- getPopoverProps,
1599
- getContainerProps,
1600
- getFieldProps,
1601
- inputProps
1601
+ onFocusSelected,
1602
+ onOpen,
1603
+ onSearch
1602
1604
  };
1603
1605
  };
1604
1606
  var useAutocompleteInput = () => {
1605
1607
  const {
1606
1608
  id,
1609
+ focusedIndex,
1607
1610
  inputRef,
1608
- onSearch,
1609
- onCompositionStart,
1610
- onCompositionEnd,
1611
1611
  isAllSelected,
1612
+ isOpen,
1613
+ listRef,
1612
1614
  formControlProps,
1613
1615
  inputProps,
1614
- isOpen,
1615
- focusedIndex,
1616
- listRef
1616
+ onCompositionEnd,
1617
+ onCompositionStart,
1618
+ onSearch
1617
1619
  } = useAutocompleteContext();
1618
1620
  const { value } = useAutocompleteDescendantsContext();
1619
1621
  (0, import_utils11.useUpdateEffect)(() => {
@@ -1625,15 +1627,15 @@ var useAutocompleteInput = () => {
1625
1627
  return {
1626
1628
  ref: (0, import_utils11.mergeRefs)(inputRef, ref),
1627
1629
  ...formControlProps,
1628
- role: "combobox",
1629
- "aria-haspopup": "listbox",
1630
- "aria-autocomplete": "list",
1631
- "aria-expanded": isOpen,
1632
- "aria-activedescendant": (_a = value(focusedIndex)) == null ? void 0 : _a.node.id,
1633
- "aria-controls": (_b = listRef.current) == null ? void 0 : _b.id,
1634
1630
  autoCapitalize: "none",
1635
1631
  autoComplete: "off",
1632
+ role: "combobox",
1636
1633
  spellCheck: "false",
1634
+ "aria-activedescendant": (_a = value(focusedIndex)) == null ? void 0 : _a.node.id,
1635
+ "aria-autocomplete": "list",
1636
+ "aria-controls": (_b = listRef.current) == null ? void 0 : _b.id,
1637
+ "aria-expanded": isOpen,
1638
+ "aria-haspopup": "listbox",
1637
1639
  ...inputProps,
1638
1640
  ...props,
1639
1641
  id,
@@ -1641,15 +1643,15 @@ var useAutocompleteInput = () => {
1641
1643
  pointerEvents: formControlProps.disabled || isAllSelected ? "none" : "auto",
1642
1644
  tabIndex: isAllSelected ? -1 : 0,
1643
1645
  onChange: (0, import_utils11.handlerAll)(props.onChange, onSearch),
1644
- onCompositionStart: (0, import_utils11.handlerAll)(
1645
- props.onCompositionStart,
1646
- inputProps.onCompositionStart,
1647
- onCompositionStart
1648
- ),
1649
1646
  onCompositionEnd: (0, import_utils11.handlerAll)(
1650
1647
  props.onCompositionEnd,
1651
1648
  inputProps.onCompositionEnd,
1652
1649
  onCompositionEnd
1650
+ ),
1651
+ onCompositionStart: (0, import_utils11.handlerAll)(
1652
+ props.onCompositionStart,
1653
+ inputProps.onCompositionStart,
1654
+ onCompositionStart
1653
1655
  )
1654
1656
  };
1655
1657
  },
@@ -1680,46 +1682,46 @@ var Autocomplete = (0, import_core9.forwardRef)(
1680
1682
  const [styles, mergedProps] = (0, import_core9.useComponentMultiStyle)("Autocomplete", props);
1681
1683
  let {
1682
1684
  className,
1683
- defaultValue = "",
1685
+ children,
1684
1686
  color,
1687
+ defaultValue = "",
1688
+ footer,
1685
1689
  h,
1690
+ header,
1686
1691
  height,
1687
1692
  minH,
1688
1693
  minHeight,
1689
1694
  containerProps,
1690
1695
  contentProps,
1691
- listProps,
1696
+ createProps,
1697
+ emptyProps,
1692
1698
  fieldProps,
1693
- inputProps,
1694
1699
  iconProps,
1700
+ inputProps,
1701
+ listProps,
1695
1702
  portalProps = { isDisabled: true },
1696
- createProps,
1697
- emptyProps,
1698
- header,
1699
- footer,
1700
- children,
1701
1703
  ...computedProps
1702
1704
  } = (0, import_core9.omitThemeProps)(mergedProps);
1703
1705
  const {
1704
- value,
1705
- onClose,
1706
+ allowCreate,
1707
+ computedChildren,
1706
1708
  descendants,
1709
+ inputValue,
1710
+ isEmpty,
1711
+ value,
1707
1712
  formControlProps,
1708
- getPopoverProps,
1709
1713
  getContainerProps,
1710
1714
  getFieldProps,
1711
- allowCreate,
1712
- isEmpty,
1713
- inputValue,
1714
- computedChildren,
1715
+ getPopoverProps,
1716
+ onClose,
1715
1717
  ...rest
1716
- } = useAutocomplete({ ...computedProps, defaultValue, children });
1718
+ } = useAutocomplete({ ...computedProps, children, defaultValue });
1717
1719
  h != null ? h : h = height;
1718
1720
  minH != null ? minH : minH = minHeight;
1719
1721
  const css = {
1720
- w: "100%",
1721
- h: "fit-content",
1722
1722
  color,
1723
+ h: "fit-content",
1724
+ w: "100%",
1723
1725
  ...styles.container
1724
1726
  };
1725
1727
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
@@ -1727,13 +1729,13 @@ var Autocomplete = (0, import_core9.forwardRef)(
1727
1729
  {
1728
1730
  value: {
1729
1731
  ...rest,
1730
- value,
1731
- onClose,
1732
- formControlProps,
1733
- inputValue,
1734
1732
  allowCreate,
1733
+ inputValue,
1735
1734
  isEmpty,
1736
- styles
1735
+ styles,
1736
+ value,
1737
+ formControlProps,
1738
+ onClose
1737
1739
  },
1738
1740
  children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_popover2.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1739
1741
  import_core9.ui.div,
@@ -1764,8 +1766,8 @@ var Autocomplete = (0, import_core9.forwardRef)(
1764
1766
  !isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1765
1767
  AutocompleteList,
1766
1768
  {
1767
- header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1768
1769
  footer: (0, import_utils12.runIfFunc)(footer, { value, onClose }),
1770
+ header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1769
1771
  contentProps,
1770
1772
  ...listProps,
1771
1773
  children: [
@@ -1776,8 +1778,8 @@ var Autocomplete = (0, import_core9.forwardRef)(
1776
1778
  ) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1777
1779
  AutocompleteList,
1778
1780
  {
1779
- header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1780
1781
  footer: (0, import_utils12.runIfFunc)(footer, { value, onClose }),
1782
+ header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1781
1783
  contentProps,
1782
1784
  ...listProps,
1783
1785
  children: allowCreate && inputValue ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AutocompleteCreate, { ...createProps }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AutocompleteEmpty, { ...emptyProps })
@@ -1794,14 +1796,14 @@ Autocomplete.displayName = "Autocomplete";
1794
1796
  Autocomplete.__ui__ = "Autocomplete";
1795
1797
  var AutocompleteField = (0, import_core9.forwardRef)(
1796
1798
  ({ className, h, minH, placeholder, inputProps, ...rest }, ref) => {
1797
- const { label, inputValue, styles } = useAutocompleteContext();
1799
+ const { inputValue, label, styles } = useAutocompleteContext();
1798
1800
  const { getInputProps } = useAutocompleteInput();
1799
1801
  const css = {
1800
- pe: "2rem",
1802
+ alignItems: "center",
1803
+ display: "flex",
1801
1804
  h,
1802
1805
  minH,
1803
- display: "flex",
1804
- alignItems: "center",
1806
+ pe: "2rem",
1805
1807
  ...styles.field,
1806
1808
  cursor: "text"
1807
1809
  };
@@ -1816,8 +1818,8 @@ var AutocompleteField = (0, import_core9.forwardRef)(
1816
1818
  {
1817
1819
  className: "ui-autocomplete__field__input",
1818
1820
  display: "inline-block",
1819
- w: "100%",
1820
1821
  placeholder,
1822
+ w: "100%",
1821
1823
  ...getInputProps(
1822
1824
  { ...inputProps, value: inputValue || label || "" },
1823
1825
  ref
@@ -1846,58 +1848,58 @@ var MultiAutocomplete = (0, import_core10.forwardRef)(
1846
1848
  );
1847
1849
  let {
1848
1850
  className,
1849
- defaultValue = [],
1850
- component,
1851
- separator,
1852
- isClearable = true,
1851
+ children,
1852
+ closeOnSelect = false,
1853
1853
  color,
1854
+ component,
1855
+ defaultValue = [],
1856
+ footer,
1854
1857
  h,
1858
+ header,
1855
1859
  height,
1860
+ isClearable = true,
1861
+ keepPlaceholder = false,
1856
1862
  minH,
1857
1863
  minHeight,
1858
- closeOnSelect = false,
1859
- keepPlaceholder = false,
1864
+ separator,
1865
+ clearIconProps,
1860
1866
  containerProps,
1861
1867
  contentProps,
1862
- listProps,
1868
+ createProps,
1869
+ emptyProps,
1863
1870
  fieldProps,
1864
- inputProps,
1865
1871
  iconProps,
1866
- clearIconProps,
1872
+ inputProps,
1873
+ listProps,
1867
1874
  portalProps = { isDisabled: true },
1868
- createProps,
1869
- emptyProps,
1870
- header,
1871
- footer,
1872
- children,
1873
1875
  ...computedProps
1874
1876
  } = (0, import_core10.omitThemeProps)(mergedProps);
1875
1877
  const {
1876
- value,
1877
- onClose,
1878
+ allowCreate,
1879
+ computedChildren,
1878
1880
  descendants,
1881
+ inputValue,
1882
+ isEmpty,
1883
+ value,
1879
1884
  formControlProps,
1880
- getPopoverProps,
1881
1885
  getContainerProps,
1882
1886
  getFieldProps,
1883
- allowCreate,
1884
- isEmpty,
1885
- inputValue,
1886
- computedChildren,
1887
+ getPopoverProps,
1887
1888
  onClear,
1889
+ onClose,
1888
1890
  ...rest
1889
1891
  } = useAutocomplete({
1890
1892
  ...computedProps,
1891
- defaultValue,
1893
+ children,
1892
1894
  closeOnSelect,
1893
- children
1895
+ defaultValue
1894
1896
  });
1895
1897
  h != null ? h : h = height;
1896
1898
  minH != null ? minH : minH = minHeight;
1897
1899
  const css = {
1898
- w: "100%",
1899
- h: "fit-content",
1900
1900
  color,
1901
+ h: "fit-content",
1902
+ w: "100%",
1901
1903
  ...styles.container
1902
1904
  };
1903
1905
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1905,13 +1907,13 @@ var MultiAutocomplete = (0, import_core10.forwardRef)(
1905
1907
  {
1906
1908
  value: {
1907
1909
  ...rest,
1908
- value,
1909
- onClose,
1910
- formControlProps,
1911
- inputValue,
1912
1910
  allowCreate,
1911
+ inputValue,
1913
1912
  isEmpty,
1914
- styles
1913
+ styles,
1914
+ value,
1915
+ formControlProps,
1916
+ onClose
1915
1917
  },
1916
1918
  children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover3.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1917
1919
  import_core10.ui.div,
@@ -1930,10 +1932,10 @@ var MultiAutocomplete = (0, import_core10.forwardRef)(
1930
1932
  MultiAutocompleteField,
1931
1933
  {
1932
1934
  component,
1933
- separator,
1934
- keepPlaceholder,
1935
1935
  h,
1936
+ keepPlaceholder,
1936
1937
  minH,
1938
+ separator,
1937
1939
  inputProps,
1938
1940
  ...getFieldProps(fieldProps, ref)
1939
1941
  }
@@ -1952,8 +1954,8 @@ var MultiAutocomplete = (0, import_core10.forwardRef)(
1952
1954
  !isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_portal2.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1953
1955
  AutocompleteList,
1954
1956
  {
1955
- header: (0, import_utils13.runIfFunc)(header, { value, onClose }),
1956
1957
  footer: (0, import_utils13.runIfFunc)(footer, { value, onClose }),
1958
+ header: (0, import_utils13.runIfFunc)(header, { value, onClose }),
1957
1959
  contentProps,
1958
1960
  ...listProps,
1959
1961
  children: [
@@ -1964,8 +1966,8 @@ var MultiAutocomplete = (0, import_core10.forwardRef)(
1964
1966
  ) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_portal2.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1965
1967
  AutocompleteList,
1966
1968
  {
1967
- header: (0, import_utils13.runIfFunc)(header, { value, onClose }),
1968
1969
  footer: (0, import_utils13.runIfFunc)(footer, { value, onClose }),
1970
+ header: (0, import_utils13.runIfFunc)(header, { value, onClose }),
1969
1971
  contentProps,
1970
1972
  ...listProps,
1971
1973
  children: allowCreate && inputValue ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteCreate, { ...createProps }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteEmpty, { ...emptyProps })
@@ -1984,34 +1986,36 @@ var MultiAutocompleteField = (0, import_core10.forwardRef)(
1984
1986
  ({
1985
1987
  className,
1986
1988
  component,
1987
- separator = ",",
1988
- keepPlaceholder,
1989
1989
  h,
1990
+ keepPlaceholder,
1990
1991
  minH,
1991
1992
  placeholder,
1993
+ separator = ",",
1992
1994
  inputProps,
1993
1995
  ...rest
1994
1996
  }, ref) => {
1995
- const { value, label, inputValue, onChange, isOpen, inputRef, styles } = useAutocompleteContext();
1997
+ const { inputRef, inputValue, isOpen, label, styles, value, onChange } = useAutocompleteContext();
1996
1998
  const { getInputProps } = useAutocompleteInput();
1997
1999
  const cloneChildren = (0, import_react6.useMemo)(() => {
1998
2000
  if (!(label == null ? void 0 : label.length)) return null;
1999
2001
  if (component) {
2000
2002
  return label.map((label2, index) => {
2003
+ if (!value[index]) return null;
2001
2004
  const onRemove = (ev) => {
2005
+ if (!value[index]) return;
2002
2006
  ev.stopPropagation();
2003
2007
  onChange(value[index]);
2004
2008
  if (inputRef.current) inputRef.current.focus();
2005
2009
  };
2006
2010
  const el = component({
2007
- value: value[index],
2008
- label: label2,
2009
2011
  index,
2012
+ label: label2,
2013
+ value: value[index],
2010
2014
  onRemove
2011
2015
  });
2012
2016
  const style = {
2013
- marginBlockStart: "0.125rem",
2014
2017
  marginBlockEnd: "0.125rem",
2018
+ marginBlockStart: "0.125rem",
2015
2019
  marginInlineEnd: "0.25rem"
2016
2020
  };
2017
2021
  return el ? (0, import_react6.cloneElement)(el, { key: index, style }) : null;
@@ -2027,12 +2031,12 @@ var MultiAutocompleteField = (0, import_core10.forwardRef)(
2027
2031
  }
2028
2032
  }, [label, component, value, onChange, isOpen, inputRef, separator]);
2029
2033
  const css = {
2030
- pe: "2rem",
2031
- h,
2032
- minH,
2034
+ alignItems: "center",
2033
2035
  display: "flex",
2034
2036
  flexWrap: "wrap",
2035
- alignItems: "center",
2037
+ h,
2038
+ minH,
2039
+ pe: "2rem",
2036
2040
  ...styles.field,
2037
2041
  cursor: "text"
2038
2042
  };
@@ -2040,25 +2044,25 @@ var MultiAutocompleteField = (0, import_core10.forwardRef)(
2040
2044
  import_core10.ui.div,
2041
2045
  {
2042
2046
  className: (0, import_utils13.cx)("ui-multi-autocomplete__field", className),
2043
- __css: css,
2044
2047
  py: (label == null ? void 0 : label.length) && component ? "0.125rem" : void 0,
2048
+ __css: css,
2045
2049
  ...rest,
2046
2050
  children: [
2047
2051
  cloneChildren,
2048
2052
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2049
2053
  import_core10.ui.input,
2050
2054
  {
2051
- "aria-label": "Input value",
2052
2055
  className: "ui-multi-autocomplete__field__input",
2053
2056
  display: "inline-block",
2054
2057
  flex: "1",
2058
+ marginBlockEnd: "0.125rem",
2059
+ marginBlockStart: "0.125rem",
2055
2060
  minW: "0px",
2056
2061
  overflow: "hidden",
2057
- marginBlockStart: "0.125rem",
2058
- marginBlockEnd: "0.125rem",
2062
+ placeholder: !(label == null ? void 0 : label.length) || keepPlaceholder && isOpen ? placeholder : void 0,
2063
+ "aria-label": "Input value",
2059
2064
  "aria-multiselectable": "true",
2060
- placeholder: !label || !(label == null ? void 0 : label.length) || keepPlaceholder && isOpen ? placeholder : void 0,
2061
- ...getInputProps({ ...inputProps, value: inputValue != null ? inputValue : "" }, ref)
2065
+ ...getInputProps({ ...inputProps, value: inputValue }, ref)
2062
2066
  }
2063
2067
  )
2064
2068
  ]