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