@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
@@ -35,9 +35,9 @@ var import_use_descendant = require("@yamada-ui/use-descendant");
35
35
  var import_utils = require("@yamada-ui/utils");
36
36
  var {
37
37
  DescendantsContextProvider: AutocompleteDescendantsContextProvider,
38
- useDescendantsContext: useAutocompleteDescendantsContext,
38
+ useDescendant: useAutocompleteDescendant,
39
39
  useDescendants: useAutocompleteDescendants,
40
- useDescendant: useAutocompleteDescendant
40
+ useDescendantsContext: useAutocompleteDescendantsContext
41
41
  } = (0, import_use_descendant.createDescendant)();
42
42
  var [AutocompleteProvider, useAutocompleteContext] = (0, import_utils.createContext)({
43
43
  name: "AutocompleteContext",
@@ -59,27 +59,27 @@ var AutocompleteIcon = (0, import_core.forwardRef)(
59
59
  ({ className, children, __css, ...rest }, ref) => {
60
60
  const { styles } = useAutocompleteContext();
61
61
  const css = {
62
- position: "absolute",
63
- top: "50%",
64
- transform: "translateY(-50%)",
65
- display: "inline-flex",
66
62
  alignItems: "center",
63
+ cursor: "pointer",
64
+ display: "inline-flex",
67
65
  justifyContent: "center",
68
66
  pointerEvents: "none",
69
- cursor: "pointer",
67
+ position: "absolute",
68
+ top: "50%",
69
+ transform: "translateY(-50%)",
70
70
  ...styles.icon,
71
71
  ...__css
72
72
  };
73
73
  const validChildren = (0, import_utils2.getValidChildren)(children);
74
74
  const cloneChildren = validChildren.map(
75
75
  (child) => (0, import_react.cloneElement)(child, {
76
- focusable: false,
77
- "aria-hidden": true,
78
76
  style: {
79
- maxWidth: "1em",
77
+ color: "currentColor",
80
78
  maxHeight: "1em",
81
- color: "currentColor"
82
- }
79
+ maxWidth: "1em"
80
+ },
81
+ focusable: false,
82
+ "aria-hidden": true
83
83
  })
84
84
  );
85
85
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -112,11 +112,11 @@ var AutocompleteClearIcon = ({
112
112
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
113
113
  AutocompleteIcon,
114
114
  {
115
- "aria-label": "Clear value",
116
115
  className: (0, import_utils2.cx)("ui-autocomplete__icon--clear", className),
116
+ "aria-label": "Clear value",
117
117
  __css: styles.clearIcon,
118
118
  ...rest,
119
- children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, { w: "0.5em", h: "0.5em" })
119
+ children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, { h: "0.5em", w: "0.5em" })
120
120
  }
121
121
  );
122
122
  };
@@ -125,11 +125,11 @@ AutocompleteClearIcon.__ui__ = "AutocompleteClearIcon";
125
125
  var AutocompleteItemIcon = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
126
126
  const { styles } = useAutocompleteContext();
127
127
  const css = {
128
- flexShrink: 0,
129
- display: "inline-flex",
130
- justifyContent: "center",
131
128
  alignItems: "center",
129
+ display: "inline-flex",
130
+ flexShrink: 0,
132
131
  fontSize: "0.85em",
132
+ justifyContent: "center",
133
133
  ...styles.itemIcon
134
134
  };
135
135
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -150,36 +150,36 @@ var import_utils3 = require("@yamada-ui/utils");
150
150
  var import_react2 = require("react");
151
151
  var isTargetOption = (target) => {
152
152
  var _a;
153
- return (0, import_utils3.isHTMLElement)(target) && !!((_a = target == null ? void 0 : target.getAttribute("role")) == null ? void 0 : _a.startsWith("option"));
153
+ return (0, import_utils3.isHTMLElement)(target) && !!((_a = target.getAttribute("role")) == null ? void 0 : _a.startsWith("option"));
154
154
  };
155
155
  var useAutocompleteOption = (props) => {
156
156
  var _a, _b;
157
157
  const {
158
- value,
158
+ closeOnSelect: generalCloseOnSelect,
159
+ focusedIndex,
160
+ inputRef,
159
161
  omitSelectedValues,
162
+ setFocusedIndex,
163
+ value,
164
+ optionProps,
160
165
  onChange,
161
166
  onChangeLabel,
162
- focusedIndex,
163
- setFocusedIndex,
164
167
  onClose,
165
- closeOnSelect: generalCloseOnSelect,
166
- optionProps,
167
- inputRef,
168
168
  onFocusNext
169
169
  } = useAutocompleteContext();
170
170
  const id = (0, import_react2.useId)();
171
171
  let {
172
+ children,
173
+ closeOnSelect: customCloseOnSelect,
172
174
  icon: customIcon,
173
175
  isDisabled,
174
176
  isFocusable,
175
- closeOnSelect: customCloseOnSelect,
176
- children,
177
177
  value: optionValue,
178
178
  ...computedProps
179
179
  } = { ...optionProps, ...props };
180
180
  const trulyDisabled = !!isDisabled && !isFocusable;
181
181
  const itemRef = (0, import_react2.useRef)(null);
182
- const { index, register, descendants } = useAutocompleteDescendant({
182
+ const { descendants, index, register } = useAutocompleteDescendant({
183
183
  disabled: trulyDisabled
184
184
  });
185
185
  const values = descendants.values();
@@ -229,27 +229,27 @@ var useAutocompleteOption = (props) => {
229
229
  border: "0px",
230
230
  clip: "rect(0px, 0px, 0px, 0px)",
231
231
  height: "1px",
232
- width: "1px",
233
232
  margin: "-1px",
234
- padding: "0px",
235
233
  overflow: "hidden",
234
+ padding: "0px",
235
+ position: "absolute",
236
236
  whiteSpace: "nowrap",
237
- position: "absolute"
237
+ width: "1px"
238
238
  };
239
239
  return {
240
- ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
241
240
  id,
241
+ ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
242
242
  role: "option",
243
243
  ...computedProps,
244
244
  ...props2,
245
- tabIndex: -1,
246
245
  style: !isTarget || omitSelectedValues && isSelected ? style : void 0,
247
- "data-target": (0, import_utils3.dataAttr)(true),
248
- "data-value": optionValue != null ? optionValue : "",
249
- "data-focus": (0, import_utils3.dataAttr)(isFocused),
250
- "data-disabled": (0, import_utils3.dataAttr)(isDisabled),
246
+ tabIndex: -1,
251
247
  "aria-checked": isSelected,
252
248
  "aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
249
+ "data-disabled": (0, import_utils3.dataAttr)(isDisabled),
250
+ "data-focus": (0, import_utils3.dataAttr)(isFocused),
251
+ "data-target": (0, import_utils3.dataAttr)(true),
252
+ "data-value": optionValue != null ? optionValue : "",
253
253
  onClick: (0, import_utils3.handlerAll)(computedProps.onClick, props2.onClick, onClick)
254
254
  };
255
255
  },
@@ -267,10 +267,10 @@ var useAutocompleteOption = (props) => {
267
267
  ]
268
268
  );
269
269
  return {
270
- isSelected,
271
- isFocused,
272
- customIcon,
273
270
  children,
271
+ customIcon,
272
+ isFocused,
273
+ isSelected,
274
274
  getOptionProps
275
275
  };
276
276
  };
@@ -282,18 +282,18 @@ var useAutocompleteCreate = () => {
282
282
  border: "0px",
283
283
  clip: "rect(0px, 0px, 0px, 0px)",
284
284
  height: "1px",
285
- width: "1px",
286
285
  margin: "-1px",
287
- padding: "0px",
288
286
  overflow: "hidden",
287
+ padding: "0px",
288
+ position: "absolute",
289
289
  whiteSpace: "nowrap",
290
- position: "absolute"
290
+ width: "1px"
291
291
  };
292
292
  return {
293
293
  ref,
294
294
  ...props,
295
- tabIndex: -1,
296
295
  style: isHit ? style : void 0,
296
+ tabIndex: -1,
297
297
  "data-focus": (0, import_utils3.dataAttr)(!isHit),
298
298
  onClick: (0, import_utils3.handlerAll)(props.onClick, onCreate)
299
299
  };
@@ -303,25 +303,25 @@ var useAutocompleteCreate = () => {
303
303
  return { getCreateProps };
304
304
  };
305
305
  var useAutocompleteEmpty = () => {
306
- const { isHit, isEmpty } = useAutocompleteContext();
306
+ const { isEmpty, isHit } = useAutocompleteContext();
307
307
  const getEmptyProps = (0, import_react2.useCallback)(
308
308
  (props = {}, ref = null) => {
309
309
  const style = {
310
310
  border: "0px",
311
311
  clip: "rect(0px, 0px, 0px, 0px)",
312
312
  height: "1px",
313
- width: "1px",
314
313
  margin: "-1px",
315
- padding: "0px",
316
314
  overflow: "hidden",
315
+ padding: "0px",
316
+ position: "absolute",
317
317
  whiteSpace: "nowrap",
318
- position: "absolute"
318
+ width: "1px"
319
319
  };
320
320
  return {
321
321
  ref,
322
322
  ...props,
323
- tabIndex: -1,
324
- style: isHit && !isEmpty ? style : void 0
323
+ style: isHit && !isEmpty ? style : void 0,
324
+ tabIndex: -1
325
325
  };
326
326
  },
327
327
  [isHit, isEmpty]
@@ -332,21 +332,21 @@ var useAutocompleteEmpty = () => {
332
332
  // src/autocomplete-create.tsx
333
333
  var import_jsx_runtime2 = require("react/jsx-runtime");
334
334
  var AutocompleteCreate = (0, import_core2.forwardRef)(
335
- ({ className, icon, children, ...rest }, ref) => {
335
+ ({ className, children, icon, ...rest }, ref) => {
336
336
  const { inputValue, styles } = useAutocompleteContext();
337
337
  const { getCreateProps } = useAutocompleteCreate();
338
338
  children != null ? children : children = inputValue;
339
339
  const css = {
340
- textDecoration: "none",
340
+ alignItems: "center",
341
341
  color: "inherit",
342
- userSelect: "none",
343
342
  display: "flex",
344
- width: "100%",
345
- alignItems: "center",
346
- textAlign: "start",
347
343
  flex: "0 0 auto",
348
- outline: 0,
349
344
  gap: "0.75rem",
345
+ outline: 0,
346
+ textAlign: "start",
347
+ textDecoration: "none",
348
+ userSelect: "none",
349
+ width: "100%",
350
350
  ...styles.item
351
351
  };
352
352
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -357,7 +357,7 @@ var AutocompleteCreate = (0, import_core2.forwardRef)(
357
357
  ...getCreateProps(rest, ref),
358
358
  children: [
359
359
  icon !== null ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutocompleteItemIcon, { children: icon || /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AutocompletePlusIcon, {}) }) : null,
360
- 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)
360
+ 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)
361
361
  ]
362
362
  }
363
363
  );
@@ -365,11 +365,11 @@ var AutocompleteCreate = (0, import_core2.forwardRef)(
365
365
  );
366
366
  AutocompleteCreate.displayName = "AutocompleteCreate";
367
367
  AutocompleteCreate.__ui__ = "AutocompleteCreate";
368
- 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)(
368
+ 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)(
369
369
  "path",
370
370
  {
371
- fill: "currentColor",
372
- 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"
371
+ 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",
372
+ fill: "currentColor"
373
373
  }
374
374
  ) });
375
375
  AutocompletePlusIcon.displayName = "AutocompletePlusIcon";
@@ -380,22 +380,22 @@ var import_core3 = require("@yamada-ui/core");
380
380
  var import_utils5 = require("@yamada-ui/utils");
381
381
  var import_jsx_runtime3 = require("react/jsx-runtime");
382
382
  var AutocompleteEmpty = (0, import_core3.forwardRef)(
383
- ({ className, icon, children, ...rest }, ref) => {
383
+ ({ className, children, icon, ...rest }, ref) => {
384
384
  const { emptyMessage, styles } = useAutocompleteContext();
385
385
  const { getEmptyProps } = useAutocompleteEmpty();
386
386
  children != null ? children : children = emptyMessage;
387
387
  const css = {
388
- textDecoration: "none",
388
+ alignItems: "center",
389
389
  color: "inherit",
390
- userSelect: "none",
391
390
  display: "flex",
392
- width: "100%",
393
- alignItems: "center",
394
- textAlign: "start",
395
391
  flex: "0 0 auto",
396
- outline: 0,
397
392
  gap: "0.75rem",
393
+ outline: 0,
398
394
  pointerEvents: "none",
395
+ textAlign: "start",
396
+ textDecoration: "none",
397
+ userSelect: "none",
398
+ width: "100%",
399
399
  ...styles.item
400
400
  };
401
401
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
@@ -406,7 +406,7 @@ var AutocompleteEmpty = (0, import_core3.forwardRef)(
406
406
  ...getEmptyProps(rest, ref),
407
407
  children: [
408
408
  icon !== null ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AutocompleteItemIcon, { children: icon || /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AutocompleteMinusIcon, {}) }) : null,
409
- icon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.span, { style: { pointerEvents: "none", flex: 1 }, lineClamp: 1, children }) : children
409
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.span, { style: { flex: 1, pointerEvents: "none" }, lineClamp: 1, children }) : children
410
410
  ]
411
411
  }
412
412
  );
@@ -414,11 +414,11 @@ var AutocompleteEmpty = (0, import_core3.forwardRef)(
414
414
  );
415
415
  AutocompleteEmpty.displayName = "AutocompleteEmpty";
416
416
  AutocompleteEmpty.__ui__ = "AutocompleteEmpty";
417
- 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)(
417
+ 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)(
418
418
  "path",
419
419
  {
420
- fill: "currentColor",
421
- 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"
420
+ 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",
421
+ fill: "currentColor"
422
422
  }
423
423
  ) });
424
424
  AutocompleteMinusIcon.displayName = "AutocompleteMinusIcon";
@@ -474,20 +474,20 @@ var useAutocompleteList = () => {
474
474
  (props = {}, ref = null) => {
475
475
  var _a;
476
476
  return {
477
- as: "ul",
477
+ id: (_a = props.id) != null ? _a : uuid,
478
478
  ref: (0, import_utils6.mergeRefs)(listRef, ref),
479
+ as: "ul",
480
+ position: "relative",
479
481
  role: "listbox",
480
482
  tabIndex: -1,
481
- position: "relative",
482
- id: (_a = props.id) != null ? _a : uuid,
483
483
  ...props
484
484
  };
485
485
  },
486
486
  [listRef, uuid]
487
487
  );
488
488
  return {
489
- onAnimationComplete,
490
- getListProps
489
+ getListProps,
490
+ onAnimationComplete
491
491
  };
492
492
  };
493
493
 
@@ -496,21 +496,21 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
496
496
  var AutocompleteList = (0, import_core4.forwardRef)(
497
497
  ({
498
498
  className,
499
- w,
500
- width,
501
- minW,
502
- minWidth,
499
+ children,
500
+ footer,
501
+ header,
503
502
  maxW,
504
503
  maxWidth,
504
+ minW,
505
+ minWidth,
506
+ w,
507
+ width,
505
508
  contentProps,
506
- header,
507
- footer,
508
- children,
509
509
  ...rest
510
510
  }, ref) => {
511
511
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
512
512
  const { styles } = useAutocompleteContext();
513
- const { onAnimationComplete, getListProps } = useAutocompleteList();
513
+ const { getListProps, onAnimationComplete } = useAutocompleteList();
514
514
  width != null ? width : width = w;
515
515
  width != null ? width : width = (_c = (_a = styles.list) == null ? void 0 : _a.width) != null ? _c : (_b = styles.list) == null ? void 0 : _b.w;
516
516
  minWidth != null ? minWidth : minWidth = minW;
@@ -522,10 +522,10 @@ var AutocompleteList = (0, import_core4.forwardRef)(
522
522
  {
523
523
  as: "div",
524
524
  className: "ui-autocomplete__popover",
525
- width,
526
- minWidth,
527
525
  maxWidth,
528
- __css: { ...styles.content, width, minWidth, maxWidth },
526
+ minWidth,
527
+ width,
528
+ __css: { ...styles.content, maxWidth, minWidth, width },
529
529
  ...contentProps,
530
530
  onAnimationComplete: (0, import_utils7.handlerAll)(
531
531
  contentProps == null ? void 0 : contentProps.onAnimationComplete,
@@ -581,19 +581,19 @@ var import_jsx_runtime5 = require("react/jsx-runtime");
581
581
  var AutocompleteOption = (0, import_core5.forwardRef)(
582
582
  ({ className, icon, ...rest }, ref) => {
583
583
  const { styles } = useAutocompleteContext();
584
- const { isSelected, customIcon, children, getOptionProps } = useAutocompleteOption(rest);
584
+ const { children, customIcon, isSelected, getOptionProps } = useAutocompleteOption(rest);
585
585
  icon != null ? icon : icon = customIcon;
586
586
  const css = {
587
- textDecoration: "none",
587
+ alignItems: "center",
588
588
  color: "inherit",
589
- userSelect: "none",
590
589
  display: "flex",
591
- width: "100%",
592
- alignItems: "center",
593
- textAlign: "start",
594
590
  flex: "0 0 auto",
595
- outline: 0,
596
591
  gap: "0.75rem",
592
+ outline: 0,
593
+ textAlign: "start",
594
+ textDecoration: "none",
595
+ userSelect: "none",
596
+ width: "100%",
597
597
  ...styles.item
598
598
  };
599
599
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
@@ -612,7 +612,7 @@ var AutocompleteOption = (0, import_core5.forwardRef)(
612
612
  );
613
613
  AutocompleteOption.displayName = "AutocompleteOption";
614
614
  AutocompleteOption.__ui__ = "AutocompleteOption";
615
- 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)(
615
+ 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)(
616
616
  "polygon",
617
617
  {
618
618
  fill: "currentColor",
@@ -634,7 +634,7 @@ var useAutocompleteOptionGroup = ({
634
634
  label,
635
635
  ...rest
636
636
  }) => {
637
- const { value, omitSelectedValues } = useAutocompleteContext();
637
+ const { omitSelectedValues, value } = useAutocompleteContext();
638
638
  const isMulti = (0, import_utils9.isArray)(value);
639
639
  const descendants = useAutocompleteDescendantsContext();
640
640
  const values = descendants.values();
@@ -646,7 +646,7 @@ var useAutocompleteOptionGroup = ({
646
646
  ) : [];
647
647
  const selectedIndexes = selectedValues.map(({ index }) => index);
648
648
  const childValues = values.filter(
649
- ({ node, index }) => {
649
+ ({ index, node }) => {
650
650
  var _a;
651
651
  return ((_a = node.parentElement) == null ? void 0 : _a.dataset.label) === label && !selectedIndexes.includes(index) && "target" in node.dataset;
652
652
  }
@@ -659,20 +659,20 @@ var useAutocompleteOptionGroup = ({
659
659
  border: "0px",
660
660
  clip: "rect(0px, 0px, 0px, 0px)",
661
661
  height: "1px",
662
- width: "1px",
663
662
  margin: "-1px",
664
- padding: "0px",
665
663
  overflow: "hidden",
664
+ padding: "0px",
665
+ position: "absolute",
666
666
  whiteSpace: "nowrap",
667
- position: "absolute"
667
+ width: "1px"
668
668
  };
669
669
  return {
670
670
  ref,
671
671
  ...props,
672
672
  ...containerProps,
673
673
  style: isEmpty ? style : void 0,
674
- "data-label": label,
675
- role: "autocomplete-group-container"
674
+ role: "autocomplete-group-container",
675
+ "data-label": label
676
676
  };
677
677
  },
678
678
  [containerProps, isEmpty, label]
@@ -682,8 +682,8 @@ var useAutocompleteOptionGroup = ({
682
682
  ref,
683
683
  ...props,
684
684
  ...groupProps,
685
- "data-label": label,
686
- role: "autocomplete-group"
685
+ role: "autocomplete-group",
686
+ "data-label": label
687
687
  }),
688
688
  [groupProps, label]
689
689
  );
@@ -699,12 +699,12 @@ var import_jsx_runtime6 = require("react/jsx-runtime");
699
699
  var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
700
700
  ({
701
701
  className,
702
+ children,
702
703
  color,
703
704
  h,
704
705
  height,
705
706
  minH,
706
707
  minHeight,
707
- children,
708
708
  labelProps,
709
709
  ...rest
710
710
  }, ref) => {
@@ -720,15 +720,15 @@ var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
720
720
  "ui-autocomplete__item--group",
721
721
  className
722
722
  ),
723
- __css: { w: "100%", h: "fit-content", color },
723
+ __css: { color, h: "fit-content", w: "100%" },
724
724
  ...getContainerProps(),
725
725
  children: [
726
726
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
727
727
  import_core7.ui.span,
728
728
  {
729
729
  className: "ui-autocomplete__item__group-label",
730
- __css: styles.groupLabel,
731
730
  lineClamp: 1,
731
+ __css: styles.groupLabel,
732
732
  ...labelProps,
733
733
  children: label
734
734
  }
@@ -753,64 +753,79 @@ AutocompleteOptionGroup.__ui__ = "AutocompleteOptionGroup";
753
753
  // src/use-autocomplete.tsx
754
754
  var import_jsx_runtime7 = require("react/jsx-runtime");
755
755
  var kanaMap = {
756
- \uFF76\uFF9E: "\u30AC",
757
- \uFF77\uFF9E: "\u30AE",
758
- \uFF78\uFF9E: "\u30B0",
759
- \uFF79\uFF9E: "\u30B2",
760
- \uFF7A\uFF9E: "\u30B4",
761
- \uFF7B\uFF9E: "\u30B6",
762
- \uFF7C\uFF9E: "\u30B8",
763
- \uFF7D\uFF9E: "\u30BA",
764
- \uFF7E\uFF9E: "\u30BC",
765
- \uFF7F\uFF9E: "\u30BE",
766
- \uFF80\uFF9E: "\u30C0",
767
- \uFF81\uFF9E: "\u30C2",
768
- \uFF82\uFF9E: "\u30C5",
769
- \uFF83\uFF9E: "\u30C7",
770
- \uFF84\uFF9E: "\u30C9",
771
- \uFF8A\uFF9E: "\u30D0",
772
- \uFF8B\uFF9E: "\u30D3",
773
- \uFF8C\uFF9E: "\u30D6",
774
- \uFF8D\uFF9E: "\u30D9",
775
- \uFF8E\uFF9E: "\u30DC",
776
- \uFF8A\uFF9F: "\u30D1",
777
- \uFF8B\uFF9F: "\u30D4",
778
- \uFF8C\uFF9F: "\u30D7",
779
- \uFF8D\uFF9F: "\u30DA",
780
- \uFF8E\uFF9F: "\u30DD",
781
- \uFF73\uFF9E: "\u30F4",
782
- \uFF9C\uFF9E: "\u30F7",
756
+ "\uFF61": "\u3002",
757
+ "\uFF62": "\u300C",
758
+ "\uFF63": "\u300D",
759
+ "\uFF64": "\u3001",
760
+ "\uFF65": "\u30FB",
761
+ \uFF66: "\u30F2",
783
762
  \uFF66\uFF9E: "\u30FA",
763
+ \uFF67: "\u30A1",
764
+ \uFF68: "\u30A3",
765
+ \uFF69: "\u30A5",
766
+ \uFF6A: "\u30A7",
767
+ \uFF6B: "\u30A9",
768
+ \uFF6C: "\u30E3",
769
+ \uFF6D: "\u30E5",
770
+ \uFF6E: "\u30E7",
771
+ \uFF6F: "\u30C3",
772
+ \uFF70: "\u30FC",
784
773
  \uFF71: "\u30A2",
785
774
  \uFF72: "\u30A4",
786
775
  \uFF73: "\u30A6",
776
+ \uFF73\uFF9E: "\u30F4",
787
777
  \uFF74: "\u30A8",
788
778
  \uFF75: "\u30AA",
789
779
  \uFF76: "\u30AB",
780
+ \uFF76\uFF9E: "\u30AC",
790
781
  \uFF77: "\u30AD",
782
+ \uFF77\uFF9E: "\u30AE",
791
783
  \uFF78: "\u30AF",
784
+ \uFF78\uFF9E: "\u30B0",
792
785
  \uFF79: "\u30B1",
786
+ \uFF79\uFF9E: "\u30B2",
793
787
  \uFF7A: "\u30B3",
788
+ \uFF7A\uFF9E: "\u30B4",
794
789
  \uFF7B: "\u30B5",
790
+ \uFF7B\uFF9E: "\u30B6",
795
791
  \uFF7C: "\u30B7",
792
+ \uFF7C\uFF9E: "\u30B8",
796
793
  \uFF7D: "\u30B9",
794
+ \uFF7D\uFF9E: "\u30BA",
797
795
  \uFF7E: "\u30BB",
796
+ \uFF7E\uFF9E: "\u30BC",
798
797
  \uFF7F: "\u30BD",
798
+ \uFF7F\uFF9E: "\u30BE",
799
799
  \uFF80: "\u30BF",
800
+ \uFF80\uFF9E: "\u30C0",
800
801
  \uFF81: "\u30C1",
802
+ \uFF81\uFF9E: "\u30C2",
801
803
  \uFF82: "\u30C4",
804
+ \uFF82\uFF9E: "\u30C5",
802
805
  \uFF83: "\u30C6",
806
+ \uFF83\uFF9E: "\u30C7",
803
807
  \uFF84: "\u30C8",
808
+ \uFF84\uFF9E: "\u30C9",
804
809
  \uFF85: "\u30CA",
805
810
  \uFF86: "\u30CB",
806
811
  \uFF87: "\u30CC",
807
812
  \uFF88: "\u30CD",
808
813
  \uFF89: "\u30CE",
809
814
  \uFF8A: "\u30CF",
815
+ \uFF8A\uFF9E: "\u30D0",
816
+ \uFF8A\uFF9F: "\u30D1",
810
817
  \uFF8B: "\u30D2",
818
+ \uFF8B\uFF9E: "\u30D3",
819
+ \uFF8B\uFF9F: "\u30D4",
811
820
  \uFF8C: "\u30D5",
821
+ \uFF8C\uFF9E: "\u30D6",
822
+ \uFF8C\uFF9F: "\u30D7",
812
823
  \uFF8D: "\u30D8",
824
+ \uFF8D\uFF9E: "\u30D9",
825
+ \uFF8D\uFF9F: "\u30DA",
813
826
  \uFF8E: "\u30DB",
827
+ \uFF8E\uFF9E: "\u30DC",
828
+ \uFF8E\uFF9F: "\u30DD",
814
829
  \uFF8F: "\u30DE",
815
830
  \uFF90: "\u30DF",
816
831
  \uFF91: "\u30E0",
@@ -825,23 +840,8 @@ var kanaMap = {
825
840
  \uFF9A: "\u30EC",
826
841
  \uFF9B: "\u30ED",
827
842
  \uFF9C: "\u30EF",
828
- \uFF66: "\u30F2",
829
- \uFF9D: "\u30F3",
830
- \uFF67: "\u30A1",
831
- \uFF68: "\u30A3",
832
- \uFF69: "\u30A5",
833
- \uFF6A: "\u30A7",
834
- \uFF6B: "\u30A9",
835
- \uFF6F: "\u30C3",
836
- \uFF6C: "\u30E3",
837
- \uFF6D: "\u30E5",
838
- \uFF6E: "\u30E7",
839
- "\uFF61": "\u3002",
840
- "\uFF64": "\u3001",
841
- \uFF70: "\u30FC",
842
- "\uFF62": "\u300C",
843
- "\uFF63": "\u300D",
844
- "\uFF65": "\u30FB"
843
+ \uFF9C\uFF9E: "\u30F7",
844
+ \uFF9D: "\u30F3"
845
845
  };
846
846
  var defaultFormat = (value) => {
847
847
  value = value.replace(
@@ -869,46 +869,46 @@ var flattenItems = (items) => {
869
869
  };
870
870
  var useAutocomplete = (props) => {
871
871
  const {
872
- value: valueProp,
873
- defaultValue,
874
- onChange: onChangeProp,
875
- onCreate: onCreateProp,
876
- onSearch: onSearchProp,
877
- closeOnSelect = true,
878
- omitSelectedValues = false,
879
- maxSelectValues,
880
872
  allowCreate = false,
881
873
  allowFree = false,
882
- insertPositionItem = "first",
883
- emptyMessage = "No results found",
884
- format = defaultFormat,
885
- optionProps,
886
- placeholder,
887
- onKeyDown: onKeyDownProp,
888
- isOpen: isOpenProp,
889
- defaultIsOpen,
890
- onOpen: onOpenProp,
891
- onClose: onCloseProp,
874
+ animation,
875
+ boundary,
876
+ children,
877
+ closeDelay,
892
878
  closeOnBlur = true,
893
879
  closeOnEsc = true,
894
- openDelay,
895
- closeDelay,
880
+ closeOnSelect = true,
881
+ defaultIsOpen,
882
+ defaultValue,
883
+ duration = 0.2,
884
+ emptyMessage = "No results found",
885
+ eventListeners,
886
+ flip,
887
+ format = defaultFormat,
888
+ gutter,
889
+ insertPositionItem = "first",
896
890
  isLazy,
891
+ isOpen: isOpenProp,
892
+ items,
897
893
  lazyBehavior,
898
- animation,
899
- duration = 0.2,
894
+ matchWidth = true,
895
+ maxSelectValues,
896
+ modifiers,
900
897
  offset,
901
- gutter,
898
+ omitSelectedValues = false,
899
+ openDelay,
900
+ placeholder,
901
+ placement = "bottom-start",
902
902
  preventOverflow,
903
- flip,
904
- matchWidth = true,
905
- boundary,
906
- eventListeners,
907
903
  strategy,
908
- placement = "bottom-start",
909
- modifiers,
910
- items,
911
- children,
904
+ value: valueProp,
905
+ optionProps,
906
+ onChange: onChangeProp,
907
+ onClose: onCloseProp,
908
+ onCreate: onCreateProp,
909
+ onKeyDown: onKeyDownProp,
910
+ onOpen: onOpenProp,
911
+ onSearch: onSearchProp,
912
912
  ...rest
913
913
  } = (0, import_form_control.useFormControlProps)(props);
914
914
  const {
@@ -927,8 +927,8 @@ var useAutocomplete = (props) => {
927
927
  const prevValue = (0, import_react5.useRef)(void 0);
928
928
  const [resolvedItems, setResolvedItems] = (0, import_react5.useState)(items ? JSON.parse(JSON.stringify(items)) : void 0);
929
929
  const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
930
- value: valueProp,
931
930
  defaultValue,
931
+ value: valueProp,
932
932
  onChange: onChangeProp
933
933
  });
934
934
  const [label, setLabel] = (0, import_react5.useState)(void 0);
@@ -938,13 +938,13 @@ var useAutocomplete = (props) => {
938
938
  const [isHit, setIsHit] = (0, import_react5.useState)(true);
939
939
  const {
940
940
  isOpen,
941
- onOpen: onInternalOpen,
942
- onClose
941
+ onClose,
942
+ onOpen: onInternalOpen
943
943
  } = (0, import_use_disclosure.useDisclosure)({
944
- isOpen: isOpenProp,
945
944
  defaultIsOpen,
946
- onOpen: onOpenProp,
947
- onClose: onCloseProp
945
+ isOpen: isOpenProp,
946
+ onClose: onCloseProp,
947
+ onOpen: onOpenProp
948
948
  });
949
949
  const isFocused = focusedIndex > -1;
950
950
  const isCreate = focusedIndex === -2 && allowCreate;
@@ -970,7 +970,7 @@ var useAutocomplete = (props) => {
970
970
  );
971
971
  const selectedIndexes = selectedValues.map(({ index }) => index);
972
972
  const enabledValues = descendants.enabledValues(
973
- ({ node, index }) => "target" in node.dataset && !selectedIndexes.includes(index)
973
+ ({ index, node }) => "target" in node.dataset && !selectedIndexes.includes(index)
974
974
  );
975
975
  const validChildren = (0, import_utils11.getValidChildren)(children);
976
976
  const computedChildren = (0, import_react5.useMemo)(
@@ -979,7 +979,7 @@ var useAutocomplete = (props) => {
979
979
  const { label: label2, value: value2, ...props2 } = item;
980
980
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AutocompleteOption, { value: value2, ...props2, children: label2 }, i);
981
981
  } else if ("items" in item) {
982
- const { label: label2, items: items2 = [], ...props2 } = item;
982
+ const { items: items2 = [], label: label2, ...props2 } = item;
983
983
  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);
984
984
  }
985
985
  }),
@@ -994,6 +994,7 @@ var useAutocomplete = (props) => {
994
994
  }, [allowCreate, formControlProps, isAllSelected, isEmpty, onInternalOpen]);
995
995
  const onFocusFirst = (0, import_react5.useCallback)(() => {
996
996
  const id2 = setTimeout(() => {
997
+ var _a;
997
998
  if (isEmpty || isAllSelected) return;
998
999
  const first = descendants.enabledFirstValue(
999
1000
  ({ node }) => "target" in node.dataset
@@ -1004,7 +1005,7 @@ var useAutocomplete = (props) => {
1004
1005
  } else {
1005
1006
  if (selectedIndexes.includes(first.index)) {
1006
1007
  const enabledFirst = enabledValues[0];
1007
- setFocusedIndex(enabledFirst.index);
1008
+ setFocusedIndex((_a = enabledFirst == null ? void 0 : enabledFirst.index) != null ? _a : -1);
1008
1009
  } else {
1009
1010
  setFocusedIndex(first.index);
1010
1011
  }
@@ -1022,6 +1023,7 @@ var useAutocomplete = (props) => {
1022
1023
  ]);
1023
1024
  const onFocusLast = (0, import_react5.useCallback)(() => {
1024
1025
  const id2 = setTimeout(() => {
1026
+ var _a;
1025
1027
  if (isEmpty || isAllSelected) return;
1026
1028
  const last = descendants.enabledLastValue(
1027
1029
  ({ node }) => "target" in node.dataset
@@ -1032,7 +1034,7 @@ var useAutocomplete = (props) => {
1032
1034
  } else {
1033
1035
  if (selectedIndexes.includes(last.index)) {
1034
1036
  const enabledLast = enabledValues.reverse()[0];
1035
- setFocusedIndex(enabledLast.index);
1037
+ setFocusedIndex((_a = enabledLast == null ? void 0 : enabledLast.index) != null ? _a : -1);
1036
1038
  } else {
1037
1039
  setFocusedIndex(last.index);
1038
1040
  }
@@ -1064,7 +1066,7 @@ var useAutocomplete = (props) => {
1064
1066
  const onFocusNext = (0, import_react5.useCallback)(
1065
1067
  (index = focusedIndex) => {
1066
1068
  const id2 = setTimeout(() => {
1067
- var _a;
1069
+ var _a, _b;
1068
1070
  const next = descendants.enabledNextValue(
1069
1071
  index,
1070
1072
  ({ node }) => "target" in node.dataset
@@ -1075,7 +1077,7 @@ var useAutocomplete = (props) => {
1075
1077
  } else {
1076
1078
  if (selectedIndexes.includes(next.index)) {
1077
1079
  const enabledNext = (_a = enabledValues.find(({ index: index2 }) => next.index < index2)) != null ? _a : enabledValues[0];
1078
- setFocusedIndex(enabledNext.index);
1080
+ setFocusedIndex((_b = enabledNext == null ? void 0 : enabledNext.index) != null ? _b : -1);
1079
1081
  } else {
1080
1082
  setFocusedIndex(next.index);
1081
1083
  }
@@ -1095,7 +1097,7 @@ var useAutocomplete = (props) => {
1095
1097
  const onFocusPrev = (0, import_react5.useCallback)(
1096
1098
  (index = focusedIndex) => {
1097
1099
  const id2 = setTimeout(() => {
1098
- var _a;
1100
+ var _a, _b;
1099
1101
  const prev = descendants.enabledPrevValue(
1100
1102
  index,
1101
1103
  ({ node }) => "target" in node.dataset
@@ -1106,7 +1108,7 @@ var useAutocomplete = (props) => {
1106
1108
  } else {
1107
1109
  if (selectedIndexes.includes(prev.index)) {
1108
1110
  const enabledPrev = (_a = enabledValues.reverse().find(({ index: index2 }) => index2 < prev.index)) != null ? _a : enabledValues[0];
1109
- setFocusedIndex(enabledPrev.index);
1111
+ setFocusedIndex((_b = enabledPrev == null ? void 0 : enabledPrev.index) != null ? _b : -1);
1110
1112
  } else {
1111
1113
  setFocusedIndex(prev.index);
1112
1114
  }
@@ -1130,7 +1132,7 @@ var useAutocomplete = (props) => {
1130
1132
  const values = descendants.values();
1131
1133
  let isHit2 = false;
1132
1134
  let isFocused2 = false;
1133
- values.forEach(({ node, index }) => {
1135
+ values.forEach(({ index, node }) => {
1134
1136
  var _a;
1135
1137
  if (format((_a = node.textContent) != null ? _a : "").includes(value2)) {
1136
1138
  isHit2 = true;
@@ -1188,7 +1190,7 @@ var useAutocomplete = (props) => {
1188
1190
  return selectedValues2[0];
1189
1191
  } else {
1190
1192
  selectedValues2.forEach((selectedValue) => {
1191
- const isSelected = (0, import_utils11.isArray)(prev) && prev.includes(selectedValue != null ? selectedValue : "");
1193
+ const isSelected = (0, import_utils11.isArray)(prev) && prev.includes(selectedValue);
1192
1194
  if (!isSelected) {
1193
1195
  prev = [...(0, import_utils11.isArray)(prev) ? prev : [], selectedValue];
1194
1196
  } else if (runOmit) {
@@ -1293,7 +1295,7 @@ var useAutocomplete = (props) => {
1293
1295
  ({ label: label2 }) => label2 === firstInsertPositionItem
1294
1296
  );
1295
1297
  const targetItem = newItems[i];
1296
- if (i !== -1 && "items" in targetItem) {
1298
+ if (i !== -1 && targetItem && "items" in targetItem) {
1297
1299
  if (secondInsertPositionItem === "first") {
1298
1300
  targetItem.items = [newItem, ...(_a = targetItem.items) != null ? _a : []];
1299
1301
  } else {
@@ -1377,15 +1379,15 @@ var useAutocomplete = (props) => {
1377
1379
  const actions = {
1378
1380
  ArrowDown: isFocused ? () => onFocusNext() : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : void 0,
1379
1381
  ArrowUp: isFocused ? () => onFocusPrev() : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusLastOrSelected) : void 0,
1380
- Space: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : void 0,
1382
+ Backspace: !isEmptyValue && enabledDelete ? onDelete : void 0,
1383
+ End: isOpen ? onFocusLast : void 0,
1381
1384
  Enter: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : allowFree && isMulti ? () => {
1382
1385
  if (inputValue) onChange(inputValue);
1383
1386
  setFocusedIndex(0);
1384
1387
  } : void 0,
1385
- Home: isOpen ? onFocusFirst : void 0,
1386
- End: isOpen ? onFocusLast : void 0,
1387
1388
  Escape: closeOnEsc ? onClose : void 0,
1388
- Backspace: !isEmptyValue && enabledDelete ? onDelete : void 0
1389
+ Home: isOpen ? onFocusFirst : void 0,
1390
+ Space: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils11.funcAll)(onOpen, onFocusFirstOrSelected) : void 0
1389
1391
  };
1390
1392
  const action = actions[ev.key];
1391
1393
  if (!action) return;
@@ -1440,7 +1442,7 @@ var useAutocomplete = (props) => {
1440
1442
  (0, import_react5.useEffect)(() => {
1441
1443
  var _a;
1442
1444
  if (isMulti) {
1443
- if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value != null ? value : []))
1445
+ if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value))
1444
1446
  return;
1445
1447
  const label2 = getSelectedValues(value);
1446
1448
  setLabel(label2);
@@ -1466,34 +1468,34 @@ var useAutocomplete = (props) => {
1466
1468
  });
1467
1469
  (0, import_use_outside_click.useOutsideClick)({
1468
1470
  ref: containerRef,
1469
- handler: onClose,
1470
- enabled: isOpen && (closeOnBlur || !isHit)
1471
+ enabled: isOpen && (closeOnBlur || !isHit),
1472
+ handler: onClose
1471
1473
  });
1472
1474
  const getPopoverProps = (0, import_react5.useCallback)(
1473
1475
  (props2) => ({
1474
- closeOnBlur,
1475
- openDelay,
1476
+ animation,
1477
+ boundary,
1476
1478
  closeDelay,
1479
+ closeOnBlur,
1480
+ duration,
1481
+ eventListeners,
1482
+ flip,
1483
+ gutter,
1477
1484
  isLazy,
1478
1485
  lazyBehavior,
1479
- animation,
1480
- duration,
1486
+ matchWidth,
1487
+ modifiers,
1481
1488
  offset,
1482
- gutter,
1489
+ openDelay,
1490
+ placement,
1483
1491
  preventOverflow,
1484
- flip,
1485
- matchWidth,
1486
- boundary,
1487
- eventListeners,
1488
1492
  strategy,
1489
- placement,
1490
- modifiers,
1491
1493
  ...props2,
1492
- trigger: "never",
1493
1494
  closeOnButton: false,
1494
1495
  isOpen,
1495
- onOpen,
1496
- onClose
1496
+ trigger: "never",
1497
+ onClose,
1498
+ onOpen
1497
1499
  }),
1498
1500
  [
1499
1501
  closeOnBlur,
@@ -1524,8 +1526,8 @@ var useAutocomplete = (props) => {
1524
1526
  ...containerProps,
1525
1527
  ...props2,
1526
1528
  ...formControlProps,
1527
- onClick: (0, import_utils11.handlerAll)(props2.onClick, rest.onClick, onClick),
1528
- onBlur: (0, import_utils11.handlerAll)(props2.onBlur, rest.onBlur, onBlur)
1529
+ onBlur: (0, import_utils11.handlerAll)(props2.onBlur, rest.onBlur, onBlur),
1530
+ onClick: (0, import_utils11.handlerAll)(props2.onClick, rest.onClick, onClick)
1529
1531
  }),
1530
1532
  [containerProps, formControlProps, onBlur, onClick, rest]
1531
1533
  );
@@ -1536,8 +1538,8 @@ var useAutocomplete = (props) => {
1536
1538
  ...props2,
1537
1539
  ...formControlProps,
1538
1540
  placeholder,
1539
- "data-active": (0, import_utils11.dataAttr)(isOpen),
1540
1541
  "aria-expanded": (0, import_utils11.dataAttr)(isOpen),
1542
+ "data-active": (0, import_utils11.dataAttr)(isOpen),
1541
1543
  onFocus: (0, import_utils11.handlerAll)(props2.onFocus, onFocusProp, onFocus),
1542
1544
  onKeyDown: (0, import_utils11.handlerAll)(props2.onKeyDown, onKeyDownProp, onKeyDown)
1543
1545
  }),
@@ -1553,61 +1555,61 @@ var useAutocomplete = (props) => {
1553
1555
  );
1554
1556
  return {
1555
1557
  id,
1556
- descendants,
1557
- value,
1558
- label,
1559
- inputValue,
1560
- isHit,
1561
- isEmpty,
1562
- computedChildren,
1563
- focusedIndex,
1564
- omitSelectedValues,
1565
- closeOnSelect,
1566
1558
  allowCreate,
1567
1559
  allowFree,
1560
+ closeOnSelect,
1561
+ computedChildren,
1562
+ descendants,
1568
1563
  emptyMessage,
1569
- isOpen,
1564
+ focusedIndex,
1565
+ inputRef,
1566
+ inputValue,
1570
1567
  isAllSelected,
1568
+ isEmpty,
1569
+ isHit,
1570
+ isOpen,
1571
+ label,
1571
1572
  listRef,
1572
- inputRef,
1573
- optionProps,
1574
- formControlProps,
1573
+ omitSelectedValues,
1574
+ pickOptions,
1575
+ rebirthOptions,
1575
1576
  setFocusedIndex,
1576
- onChangeLabel,
1577
+ value,
1578
+ formControlProps,
1579
+ getContainerProps,
1580
+ getFieldProps,
1581
+ getPopoverProps,
1582
+ inputProps,
1583
+ optionProps,
1577
1584
  onChange,
1578
- onSearch,
1579
- onCreate,
1585
+ onChangeLabel,
1580
1586
  onClear,
1581
- onCompositionStart,
1582
- onCompositionEnd,
1583
- pickOptions,
1584
- rebirthOptions,
1585
- onOpen,
1586
1587
  onClose,
1588
+ onCompositionEnd,
1589
+ onCompositionStart,
1590
+ onCreate,
1587
1591
  onFocusFirst,
1588
1592
  onFocusLast,
1589
- onFocusSelected,
1590
1593
  onFocusNext,
1591
1594
  onFocusPrev,
1592
- getPopoverProps,
1593
- getContainerProps,
1594
- getFieldProps,
1595
- inputProps
1595
+ onFocusSelected,
1596
+ onOpen,
1597
+ onSearch
1596
1598
  };
1597
1599
  };
1598
1600
  var useAutocompleteInput = () => {
1599
1601
  const {
1600
1602
  id,
1603
+ focusedIndex,
1601
1604
  inputRef,
1602
- onSearch,
1603
- onCompositionStart,
1604
- onCompositionEnd,
1605
1605
  isAllSelected,
1606
+ isOpen,
1607
+ listRef,
1606
1608
  formControlProps,
1607
1609
  inputProps,
1608
- isOpen,
1609
- focusedIndex,
1610
- listRef
1610
+ onCompositionEnd,
1611
+ onCompositionStart,
1612
+ onSearch
1611
1613
  } = useAutocompleteContext();
1612
1614
  const { value } = useAutocompleteDescendantsContext();
1613
1615
  (0, import_utils11.useUpdateEffect)(() => {
@@ -1619,15 +1621,15 @@ var useAutocompleteInput = () => {
1619
1621
  return {
1620
1622
  ref: (0, import_utils11.mergeRefs)(inputRef, ref),
1621
1623
  ...formControlProps,
1622
- role: "combobox",
1623
- "aria-haspopup": "listbox",
1624
- "aria-autocomplete": "list",
1625
- "aria-expanded": isOpen,
1626
- "aria-activedescendant": (_a = value(focusedIndex)) == null ? void 0 : _a.node.id,
1627
- "aria-controls": (_b = listRef.current) == null ? void 0 : _b.id,
1628
1624
  autoCapitalize: "none",
1629
1625
  autoComplete: "off",
1626
+ role: "combobox",
1630
1627
  spellCheck: "false",
1628
+ "aria-activedescendant": (_a = value(focusedIndex)) == null ? void 0 : _a.node.id,
1629
+ "aria-autocomplete": "list",
1630
+ "aria-controls": (_b = listRef.current) == null ? void 0 : _b.id,
1631
+ "aria-expanded": isOpen,
1632
+ "aria-haspopup": "listbox",
1631
1633
  ...inputProps,
1632
1634
  ...props,
1633
1635
  id,
@@ -1635,15 +1637,15 @@ var useAutocompleteInput = () => {
1635
1637
  pointerEvents: formControlProps.disabled || isAllSelected ? "none" : "auto",
1636
1638
  tabIndex: isAllSelected ? -1 : 0,
1637
1639
  onChange: (0, import_utils11.handlerAll)(props.onChange, onSearch),
1638
- onCompositionStart: (0, import_utils11.handlerAll)(
1639
- props.onCompositionStart,
1640
- inputProps.onCompositionStart,
1641
- onCompositionStart
1642
- ),
1643
1640
  onCompositionEnd: (0, import_utils11.handlerAll)(
1644
1641
  props.onCompositionEnd,
1645
1642
  inputProps.onCompositionEnd,
1646
1643
  onCompositionEnd
1644
+ ),
1645
+ onCompositionStart: (0, import_utils11.handlerAll)(
1646
+ props.onCompositionStart,
1647
+ inputProps.onCompositionStart,
1648
+ onCompositionStart
1647
1649
  )
1648
1650
  };
1649
1651
  },
@@ -1677,58 +1679,58 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
1677
1679
  );
1678
1680
  let {
1679
1681
  className,
1680
- defaultValue = [],
1681
- component,
1682
- separator,
1683
- isClearable = true,
1682
+ children,
1683
+ closeOnSelect = false,
1684
1684
  color,
1685
+ component,
1686
+ defaultValue = [],
1687
+ footer,
1685
1688
  h,
1689
+ header,
1686
1690
  height,
1691
+ isClearable = true,
1692
+ keepPlaceholder = false,
1687
1693
  minH,
1688
1694
  minHeight,
1689
- closeOnSelect = false,
1690
- keepPlaceholder = false,
1695
+ separator,
1696
+ clearIconProps,
1691
1697
  containerProps,
1692
1698
  contentProps,
1693
- listProps,
1699
+ createProps,
1700
+ emptyProps,
1694
1701
  fieldProps,
1695
- inputProps,
1696
1702
  iconProps,
1697
- clearIconProps,
1703
+ inputProps,
1704
+ listProps,
1698
1705
  portalProps = { isDisabled: true },
1699
- createProps,
1700
- emptyProps,
1701
- header,
1702
- footer,
1703
- children,
1704
1706
  ...computedProps
1705
1707
  } = (0, import_core9.omitThemeProps)(mergedProps);
1706
1708
  const {
1707
- value,
1708
- onClose,
1709
+ allowCreate,
1710
+ computedChildren,
1709
1711
  descendants,
1712
+ inputValue,
1713
+ isEmpty,
1714
+ value,
1710
1715
  formControlProps,
1711
- getPopoverProps,
1712
1716
  getContainerProps,
1713
1717
  getFieldProps,
1714
- allowCreate,
1715
- isEmpty,
1716
- inputValue,
1717
- computedChildren,
1718
+ getPopoverProps,
1718
1719
  onClear,
1720
+ onClose,
1719
1721
  ...rest
1720
1722
  } = useAutocomplete({
1721
1723
  ...computedProps,
1722
- defaultValue,
1724
+ children,
1723
1725
  closeOnSelect,
1724
- children
1726
+ defaultValue
1725
1727
  });
1726
1728
  h != null ? h : h = height;
1727
1729
  minH != null ? minH : minH = minHeight;
1728
1730
  const css = {
1729
- w: "100%",
1730
- h: "fit-content",
1731
1731
  color,
1732
+ h: "fit-content",
1733
+ w: "100%",
1732
1734
  ...styles.container
1733
1735
  };
1734
1736
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
@@ -1736,13 +1738,13 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
1736
1738
  {
1737
1739
  value: {
1738
1740
  ...rest,
1739
- value,
1740
- onClose,
1741
- formControlProps,
1742
- inputValue,
1743
1741
  allowCreate,
1742
+ inputValue,
1744
1743
  isEmpty,
1745
- styles
1744
+ styles,
1745
+ value,
1746
+ formControlProps,
1747
+ onClose
1746
1748
  },
1747
1749
  children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_popover2.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1748
1750
  import_core9.ui.div,
@@ -1761,10 +1763,10 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
1761
1763
  MultiAutocompleteField,
1762
1764
  {
1763
1765
  component,
1764
- separator,
1765
- keepPlaceholder,
1766
1766
  h,
1767
+ keepPlaceholder,
1767
1768
  minH,
1769
+ separator,
1768
1770
  inputProps,
1769
1771
  ...getFieldProps(fieldProps, ref)
1770
1772
  }
@@ -1783,8 +1785,8 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
1783
1785
  !isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1784
1786
  AutocompleteList,
1785
1787
  {
1786
- header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1787
1788
  footer: (0, import_utils12.runIfFunc)(footer, { value, onClose }),
1789
+ header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1788
1790
  contentProps,
1789
1791
  ...listProps,
1790
1792
  children: [
@@ -1795,8 +1797,8 @@ var MultiAutocomplete = (0, import_core9.forwardRef)(
1795
1797
  ) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1796
1798
  AutocompleteList,
1797
1799
  {
1798
- header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1799
1800
  footer: (0, import_utils12.runIfFunc)(footer, { value, onClose }),
1801
+ header: (0, import_utils12.runIfFunc)(header, { value, onClose }),
1800
1802
  contentProps,
1801
1803
  ...listProps,
1802
1804
  children: allowCreate && inputValue ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AutocompleteCreate, { ...createProps }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AutocompleteEmpty, { ...emptyProps })
@@ -1815,34 +1817,36 @@ var MultiAutocompleteField = (0, import_core9.forwardRef)(
1815
1817
  ({
1816
1818
  className,
1817
1819
  component,
1818
- separator = ",",
1819
- keepPlaceholder,
1820
1820
  h,
1821
+ keepPlaceholder,
1821
1822
  minH,
1822
1823
  placeholder,
1824
+ separator = ",",
1823
1825
  inputProps,
1824
1826
  ...rest
1825
1827
  }, ref) => {
1826
- const { value, label, inputValue, onChange, isOpen, inputRef, styles } = useAutocompleteContext();
1828
+ const { inputRef, inputValue, isOpen, label, styles, value, onChange } = useAutocompleteContext();
1827
1829
  const { getInputProps } = useAutocompleteInput();
1828
1830
  const cloneChildren = (0, import_react6.useMemo)(() => {
1829
1831
  if (!(label == null ? void 0 : label.length)) return null;
1830
1832
  if (component) {
1831
1833
  return label.map((label2, index) => {
1834
+ if (!value[index]) return null;
1832
1835
  const onRemove = (ev) => {
1836
+ if (!value[index]) return;
1833
1837
  ev.stopPropagation();
1834
1838
  onChange(value[index]);
1835
1839
  if (inputRef.current) inputRef.current.focus();
1836
1840
  };
1837
1841
  const el = component({
1838
- value: value[index],
1839
- label: label2,
1840
1842
  index,
1843
+ label: label2,
1844
+ value: value[index],
1841
1845
  onRemove
1842
1846
  });
1843
1847
  const style = {
1844
- marginBlockStart: "0.125rem",
1845
1848
  marginBlockEnd: "0.125rem",
1849
+ marginBlockStart: "0.125rem",
1846
1850
  marginInlineEnd: "0.25rem"
1847
1851
  };
1848
1852
  return el ? (0, import_react6.cloneElement)(el, { key: index, style }) : null;
@@ -1858,12 +1862,12 @@ var MultiAutocompleteField = (0, import_core9.forwardRef)(
1858
1862
  }
1859
1863
  }, [label, component, value, onChange, isOpen, inputRef, separator]);
1860
1864
  const css = {
1861
- pe: "2rem",
1862
- h,
1863
- minH,
1865
+ alignItems: "center",
1864
1866
  display: "flex",
1865
1867
  flexWrap: "wrap",
1866
- alignItems: "center",
1868
+ h,
1869
+ minH,
1870
+ pe: "2rem",
1867
1871
  ...styles.field,
1868
1872
  cursor: "text"
1869
1873
  };
@@ -1871,25 +1875,25 @@ var MultiAutocompleteField = (0, import_core9.forwardRef)(
1871
1875
  import_core9.ui.div,
1872
1876
  {
1873
1877
  className: (0, import_utils12.cx)("ui-multi-autocomplete__field", className),
1874
- __css: css,
1875
1878
  py: (label == null ? void 0 : label.length) && component ? "0.125rem" : void 0,
1879
+ __css: css,
1876
1880
  ...rest,
1877
1881
  children: [
1878
1882
  cloneChildren,
1879
1883
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1880
1884
  import_core9.ui.input,
1881
1885
  {
1882
- "aria-label": "Input value",
1883
1886
  className: "ui-multi-autocomplete__field__input",
1884
1887
  display: "inline-block",
1885
1888
  flex: "1",
1889
+ marginBlockEnd: "0.125rem",
1890
+ marginBlockStart: "0.125rem",
1886
1891
  minW: "0px",
1887
1892
  overflow: "hidden",
1888
- marginBlockStart: "0.125rem",
1889
- marginBlockEnd: "0.125rem",
1893
+ placeholder: !(label == null ? void 0 : label.length) || keepPlaceholder && isOpen ? placeholder : void 0,
1894
+ "aria-label": "Input value",
1890
1895
  "aria-multiselectable": "true",
1891
- placeholder: !label || !(label == null ? void 0 : label.length) || keepPlaceholder && isOpen ? placeholder : void 0,
1892
- ...getInputProps({ ...inputProps, value: inputValue != null ? inputValue : "" }, ref)
1896
+ ...getInputProps({ ...inputProps, value: inputValue }, ref)
1893
1897
  }
1894
1898
  )
1895
1899
  ]