@yamada-ui/autocomplete 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/autocomplete-create.js +24 -17
  2. package/dist/autocomplete-create.mjs +1 -1
  3. package/dist/autocomplete-empty.js +24 -17
  4. package/dist/autocomplete-empty.mjs +1 -1
  5. package/dist/autocomplete-icon.js +30 -23
  6. package/dist/autocomplete-icon.mjs +1 -1
  7. package/dist/autocomplete-list.js +4 -1
  8. package/dist/autocomplete-list.mjs +1 -1
  9. package/dist/autocomplete-option-group.d.mts +1 -1
  10. package/dist/autocomplete-option-group.d.ts +1 -1
  11. package/dist/autocomplete-option-group.js +10 -5
  12. package/dist/autocomplete-option-group.mjs +1 -1
  13. package/dist/autocomplete-option.d.mts +1 -1
  14. package/dist/autocomplete-option.d.ts +1 -1
  15. package/dist/autocomplete-option.js +33 -22
  16. package/dist/autocomplete-option.mjs +1 -1
  17. package/dist/autocomplete.d.mts +1 -1
  18. package/dist/autocomplete.d.ts +1 -1
  19. package/dist/autocomplete.js +226 -120
  20. package/dist/autocomplete.mjs +1 -1
  21. package/dist/{chunk-5O3XEEJE.mjs → chunk-ZVZP7IWT.mjs} +352 -229
  22. package/dist/index.d.mts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +345 -229
  25. package/dist/index.mjs +1 -1
  26. package/dist/multi-autocomplete.d.mts +1 -1
  27. package/dist/multi-autocomplete.d.ts +1 -1
  28. package/dist/multi-autocomplete.js +245 -149
  29. package/dist/multi-autocomplete.mjs +1 -1
  30. package/dist/{use-autocomplete-cbe9b443.d.ts → use-autocomplete-2422c1c8.d.ts} +25 -5
  31. package/dist/use-autocomplete.d.mts +1 -1
  32. package/dist/use-autocomplete.d.ts +1 -1
  33. package/dist/use-autocomplete.js +131 -45
  34. package/dist/use-autocomplete.mjs +1 -1
  35. package/package.json +11 -11
package/dist/index.js CHANGED
@@ -142,7 +142,10 @@ var kanaMap = {
142
142
  "\uFF65": "\u30FB"
143
143
  };
144
144
  var defaultFormat = (value) => {
145
- value = value.replace(/[!-~]/g, (v) => String.fromCharCode(v.charCodeAt(0) - 65248));
145
+ value = value.replace(
146
+ /[!-~]/g,
147
+ (v) => String.fromCharCode(v.charCodeAt(0) - 65248)
148
+ );
146
149
  const reg = new RegExp("(" + Object.keys(kanaMap).join("|") + ")", "g");
147
150
  value = value.replace(reg, (v) => kanaMap[v]).replace(/゙/g, "\u309B").replace(/゚/g, "\u309C");
148
151
  value = value.toUpperCase();
@@ -199,7 +202,14 @@ var useAutocomplete = ({
199
202
  const { id } = rest;
200
203
  const formControlProps = (0, import_utils.pickObject)(rest, import_form_control.formControlProperties);
201
204
  const [containerProps, inputProps] = (0, import_utils.splitObject)(
202
- (0, import_utils.omitObject)(rest, ["id", "value", "defaultValue", "onChange", "month", "onChangeMonth"]),
205
+ (0, import_utils.omitObject)(rest, [
206
+ "id",
207
+ "value",
208
+ "defaultValue",
209
+ "onChange",
210
+ "month",
211
+ "onChangeMonth"
212
+ ]),
203
213
  import_core.layoutStylesProperties
204
214
  );
205
215
  const descendants = useAutocompleteDescendants();
@@ -251,9 +261,17 @@ var useAutocomplete = ({
251
261
  if (!(0, import_utils.isArray)(value2)) {
252
262
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutocompleteOption, { value: value2, ...props, children: label }, i);
253
263
  } else {
254
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutocompleteOptionGroup, { label, ...props, children: value2.map(
255
- ({ label: label2, value: value3, ...props2 }, i2) => !(0, import_utils.isArray)(value3) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutocompleteOption, { value: value3, ...props2, children: label2 }, i2) : null
256
- ) }, i);
264
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
265
+ AutocompleteOptionGroup,
266
+ {
267
+ label,
268
+ ...props,
269
+ children: value2.map(
270
+ ({ label: label2, value: value3, ...props2 }, i2) => !(0, import_utils.isArray)(value3) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AutocompleteOption, { value: value3, ...props2, children: label2 }, i2) : null
271
+ )
272
+ },
273
+ i
274
+ );
257
275
  }
258
276
  });
259
277
  const isEmpty = !validChildren.length && !(computedChildren == null ? void 0 : computedChildren.length);
@@ -277,7 +295,9 @@ var useAutocomplete = ({
277
295
  const id2 = setTimeout(() => {
278
296
  if (isEmpty || isAllSelected)
279
297
  return;
280
- const first = descendants.enabledfirstValue(({ node }) => "target" in node.dataset);
298
+ const first = descendants.enabledfirstValue(
299
+ ({ node }) => "target" in node.dataset
300
+ );
281
301
  if (!first)
282
302
  return;
283
303
  if (!isMulti || !omitSelectedValues) {
@@ -305,7 +325,9 @@ var useAutocomplete = ({
305
325
  const id2 = setTimeout(() => {
306
326
  if (isEmpty || isAllSelected)
307
327
  return;
308
- const last = descendants.enabledlastValue(({ node }) => "target" in node.dataset);
328
+ const last = descendants.enabledlastValue(
329
+ ({ node }) => "target" in node.dataset
330
+ );
309
331
  if (!last)
310
332
  return;
311
333
  if (!isMulti || !omitSelectedValues) {
@@ -347,7 +369,10 @@ var useAutocomplete = ({
347
369
  (index = focusedIndex) => {
348
370
  const id2 = setTimeout(() => {
349
371
  var _a;
350
- const next = descendants.enabledNextValue(index, ({ node }) => "target" in node.dataset);
372
+ const next = descendants.enabledNextValue(
373
+ index,
374
+ ({ node }) => "target" in node.dataset
375
+ );
351
376
  if (!next)
352
377
  return;
353
378
  if (!isMulti || !omitSelectedValues) {
@@ -363,13 +388,23 @@ var useAutocomplete = ({
363
388
  });
364
389
  timeoutIds.current.add(id2);
365
390
  },
366
- [descendants, enabledValues, focusedIndex, isMulti, omitSelectedValues, selectedIndexes]
391
+ [
392
+ descendants,
393
+ enabledValues,
394
+ focusedIndex,
395
+ isMulti,
396
+ omitSelectedValues,
397
+ selectedIndexes
398
+ ]
367
399
  );
368
400
  const onFocusPrev = (0, import_react.useCallback)(
369
401
  (index = focusedIndex) => {
370
402
  const id2 = setTimeout(() => {
371
403
  var _a;
372
- const prev = descendants.enabledPrevValue(index, ({ node }) => "target" in node.dataset);
404
+ const prev = descendants.enabledPrevValue(
405
+ index,
406
+ ({ node }) => "target" in node.dataset
407
+ );
373
408
  if (!prev)
374
409
  return;
375
410
  if (!isMulti || !omitSelectedValues) {
@@ -385,7 +420,14 @@ var useAutocomplete = ({
385
420
  });
386
421
  timeoutIds.current.add(id2);
387
422
  },
388
- [descendants, enabledValues, focusedIndex, isMulti, omitSelectedValues, selectedIndexes]
423
+ [
424
+ descendants,
425
+ enabledValues,
426
+ focusedIndex,
427
+ isMulti,
428
+ omitSelectedValues,
429
+ selectedIndexes
430
+ ]
389
431
  );
390
432
  const onFocusFirstOrSelected = isEmptyValue || omitSelectedValues ? onFocusFirst : onFocusSelected;
391
433
  const onFocusLastOrSelected = isEmptyValue || omitSelectedValues ? onFocusLast : onFocusSelected;
@@ -482,7 +524,15 @@ var useAutocomplete = ({
482
524
  onClose();
483
525
  if (omitSelectedValues)
484
526
  onFocusNext();
485
- }, [closeOnSelect, descendants, focusedIndex, omitSelectedValues, onChange, onClose, onFocusNext]);
527
+ }, [
528
+ closeOnSelect,
529
+ descendants,
530
+ focusedIndex,
531
+ omitSelectedValues,
532
+ onChange,
533
+ onClose,
534
+ onFocusNext
535
+ ]);
486
536
  const onSearch = (0, import_react.useCallback)(
487
537
  (ev) => {
488
538
  var _a;
@@ -519,12 +569,20 @@ var useAutocomplete = ({
519
569
  } else if (firstInsertPositionOnCreate === "last") {
520
570
  newOptions = [...newOptions, newOption];
521
571
  } else {
522
- const i = newOptions.findIndex(({ label }) => label === firstInsertPositionOnCreate);
572
+ const i = newOptions.findIndex(
573
+ ({ label }) => label === firstInsertPositionOnCreate
574
+ );
523
575
  if (i !== -1 && (0, import_utils.isArray)(newOptions[i].value)) {
524
576
  if (secondInsertPositionOnCreate === "first") {
525
- newOptions[i].value = [newOption, ...newOptions[i].value];
577
+ newOptions[i].value = [
578
+ newOption,
579
+ ...newOptions[i].value
580
+ ];
526
581
  } else {
527
- newOptions[i].value = [...newOptions[i].value, newOption];
582
+ newOptions[i].value = [
583
+ ...newOptions[i].value,
584
+ newOption
585
+ ];
528
586
  }
529
587
  } else {
530
588
  console.warn(
@@ -535,7 +593,9 @@ var useAutocomplete = ({
535
593
  setOptions(newOptions);
536
594
  onChange(inputValue);
537
595
  rebirthOptions(false);
538
- const index = flattenOptions(newOptions).findIndex(({ value: value2 }) => value2 === inputValue);
596
+ const index = flattenOptions(newOptions).findIndex(
597
+ ({ value: value2 }) => value2 === inputValue
598
+ );
539
599
  setFocusedIndex(index);
540
600
  (_a = rest.onCreate) == null ? void 0 : _a.call(rest, newOption, newOptions);
541
601
  }, [
@@ -654,7 +714,14 @@ var useAutocomplete = ({
654
714
  } else {
655
715
  setIsAllSelected(false);
656
716
  }
657
- }, [omitSelectedValues, value, descendants, isMulti, onClose, maxSelectedValues]);
717
+ }, [
718
+ omitSelectedValues,
719
+ value,
720
+ descendants,
721
+ isMulti,
722
+ onClose,
723
+ maxSelectedValues
724
+ ]);
658
725
  (0, import_utils.useUpdateEffect)(() => {
659
726
  if (isOpen)
660
727
  return;
@@ -856,7 +923,10 @@ var useAutocompleteList = () => {
856
923
  role: "select",
857
924
  tabIndex: -1,
858
925
  ...props,
859
- onAnimationComplete: (0, import_utils.handlerAll)(props.onAnimationComplete, onAnimationComplete)
926
+ onAnimationComplete: (0, import_utils.handlerAll)(
927
+ props.onAnimationComplete,
928
+ onAnimationComplete
929
+ )
860
930
  }),
861
931
  [listRef, onAnimationComplete]
862
932
  );
@@ -864,15 +934,20 @@ var useAutocompleteList = () => {
864
934
  getListProps
865
935
  };
866
936
  };
867
- var useAutocompleteOptionGroup = ({ label, ...rest }) => {
937
+ var useAutocompleteOptionGroup = ({
938
+ label,
939
+ ...rest
940
+ }) => {
868
941
  const { value, omitSelectedValues } = useAutocompleteContext();
869
942
  const isMulti = (0, import_utils.isArray)(value);
870
943
  const descendants = useAutocompleteDescendantsContext();
871
944
  const values = descendants.values();
872
- const selectedValues = isMulti && omitSelectedValues ? descendants.values(({ node }) => {
873
- var _a;
874
- return value.includes((_a = node.dataset.value) != null ? _a : "");
875
- }) : [];
945
+ const selectedValues = isMulti && omitSelectedValues ? descendants.values(
946
+ ({ node }) => {
947
+ var _a;
948
+ return value.includes((_a = node.dataset.value) != null ? _a : "");
949
+ }
950
+ ) : [];
876
951
  const selectedIndexes = selectedValues.map(({ index }) => index);
877
952
  const childValues = values.filter(
878
953
  ({ node, index }) => {
@@ -947,14 +1022,18 @@ var useAutocompleteOption = (props) => {
947
1022
  } = { ...optionProps, ...props };
948
1023
  const trulyDisabled = !!isDisabled && !isFocusable;
949
1024
  const itemRef = (0, import_react.useRef)(null);
950
- const { index, register, descendants } = useAutocompleteDescendant({ disabled: trulyDisabled });
1025
+ const { index, register, descendants } = useAutocompleteDescendant({
1026
+ disabled: trulyDisabled
1027
+ });
951
1028
  const values = descendants.values();
952
1029
  const frontValues = values.slice(0, index);
953
1030
  const isMulti = (0, import_utils.isArray)(value);
954
- const isDuplicated = !isMulti ? frontValues.some(({ node }) => {
955
- var _a2;
956
- return node.dataset.value === ((_a2 = computedProps.value) != null ? _a2 : "");
957
- }) : false;
1031
+ const isDuplicated = !isMulti ? frontValues.some(
1032
+ ({ node }) => {
1033
+ var _a2;
1034
+ return node.dataset.value === ((_a2 = computedProps.value) != null ? _a2 : "");
1035
+ }
1036
+ ) : false;
958
1037
  const isSelected = !isDuplicated && (!isMulti ? ((_a = computedProps.value) != null ? _a : "") === value : value.includes((_b = computedProps.value) != null ? _b : ""));
959
1038
  const isTarget = "target" in ((_d = (_c = itemRef.current) == null ? void 0 : _c.dataset) != null ? _d : {});
960
1039
  const isFocused = index === focusedIndex;
@@ -1133,7 +1212,16 @@ var AutocompleteIcon = (0, import_core2.forwardRef)(
1133
1212
  }
1134
1213
  })
1135
1214
  );
1136
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.div, { ref, className: (0, import_utils2.cx)("ui-autocomplete-icon", className), __css: css, ...rest, children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {}) });
1215
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1216
+ import_core2.ui.div,
1217
+ {
1218
+ ref,
1219
+ className: (0, import_utils2.cx)("ui-autocomplete-icon", className),
1220
+ __css: css,
1221
+ ...rest,
1222
+ children: (0, import_utils2.isValidElement)(children) ? cloneChildren : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icon.ChevronIcon, {})
1223
+ }
1224
+ );
1137
1225
  }
1138
1226
  );
1139
1227
  var AutocompleteClearIcon = ({
@@ -1159,28 +1247,26 @@ var AutocompleteClearIcon = ({
1159
1247
  }
1160
1248
  );
1161
1249
  };
1162
- var AutocompleteItemIcon = (0, import_core2.forwardRef)(
1163
- ({ className, ...rest }, ref) => {
1164
- const { styles } = useAutocompleteContext();
1165
- const css = {
1166
- flexShrink: 0,
1167
- display: "inline-flex",
1168
- justifyContent: "center",
1169
- alignItems: "center",
1170
- fontSize: "0.85em",
1171
- ...styles.itemIcon
1172
- };
1173
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1174
- import_core2.ui.span,
1175
- {
1176
- ref,
1177
- className: (0, import_utils2.cx)("ui-autocomplete-item-icon", className),
1178
- __css: css,
1179
- ...rest
1180
- }
1181
- );
1182
- }
1183
- );
1250
+ var AutocompleteItemIcon = (0, import_core2.forwardRef)(({ className, ...rest }, ref) => {
1251
+ const { styles } = useAutocompleteContext();
1252
+ const css = {
1253
+ flexShrink: 0,
1254
+ display: "inline-flex",
1255
+ justifyContent: "center",
1256
+ alignItems: "center",
1257
+ fontSize: "0.85em",
1258
+ ...styles.itemIcon
1259
+ };
1260
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1261
+ import_core2.ui.span,
1262
+ {
1263
+ ref,
1264
+ className: (0, import_utils2.cx)("ui-autocomplete-item-icon", className),
1265
+ __css: css,
1266
+ ...rest
1267
+ }
1268
+ );
1269
+ });
1184
1270
 
1185
1271
  // src/autocomplete-list.tsx
1186
1272
  var import_core3 = require("@yamada-ui/core");
@@ -1210,75 +1296,84 @@ var AutocompleteList = (0, import_core3.forwardRef)(
1210
1296
 
1211
1297
  // src/autocomplete.tsx
1212
1298
  var import_jsx_runtime4 = require("react/jsx-runtime");
1213
- var Autocomplete = (0, import_core4.forwardRef)((props, ref) => {
1214
- const [styles, mergedProps] = (0, import_core4.useMultiComponentStyle)("Select", props);
1215
- let {
1216
- className,
1217
- defaultValue = "",
1218
- color,
1219
- h,
1220
- height,
1221
- minH,
1222
- minHeight,
1223
- containerProps,
1224
- listProps,
1225
- inputProps,
1226
- iconProps,
1227
- children,
1228
- ...computedProps
1229
- } = (0, import_core4.omitThemeProps)(mergedProps);
1230
- const {
1231
- descendants,
1232
- formControlProps,
1233
- getPopoverProps,
1234
- getContainerProps,
1235
- getFieldProps,
1236
- createOption,
1237
- isEmpty,
1238
- inputValue,
1239
- computedChildren,
1240
- ...rest
1241
- } = useAutocomplete({ ...computedProps, defaultValue, children });
1242
- h = h != null ? h : height;
1243
- minH = minH != null ? minH : minHeight;
1244
- const css = {
1245
- position: "relative",
1246
- w: "100%",
1247
- h: "fit-content",
1248
- color,
1249
- ...styles.container
1250
- };
1251
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1252
- AutocompleteProvider,
1253
- {
1254
- value: { ...rest, formControlProps, inputValue, createOption, isEmpty, styles },
1255
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover2.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1256
- import_core4.ui.div,
1257
- {
1258
- className: (0, import_utils4.cx)("ui-autocomplete", className),
1259
- __css: css,
1260
- ...getContainerProps(containerProps),
1261
- children: [
1262
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1263
- AutocompleteField,
1264
- {
1265
- h,
1266
- minH,
1267
- inputProps,
1268
- ...getFieldProps({}, ref)
1269
- }
1270
- ),
1271
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteIcon, { ...iconProps, ...formControlProps }),
1272
- !isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(AutocompleteList, { ...listProps, children: [
1273
- createOption ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteEmpty, {}),
1274
- children != null ? children : computedChildren
1275
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteList, { ...listProps, children: createOption && inputValue ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteEmpty, {}) })
1276
- ]
1277
- }
1278
- ) })
1279
- }
1280
- ) });
1281
- });
1299
+ var Autocomplete = (0, import_core4.forwardRef)(
1300
+ (props, ref) => {
1301
+ const [styles, mergedProps] = (0, import_core4.useMultiComponentStyle)("Select", props);
1302
+ let {
1303
+ className,
1304
+ defaultValue = "",
1305
+ color,
1306
+ h,
1307
+ height,
1308
+ minH,
1309
+ minHeight,
1310
+ containerProps,
1311
+ listProps,
1312
+ inputProps,
1313
+ iconProps,
1314
+ children,
1315
+ ...computedProps
1316
+ } = (0, import_core4.omitThemeProps)(mergedProps);
1317
+ const {
1318
+ descendants,
1319
+ formControlProps,
1320
+ getPopoverProps,
1321
+ getContainerProps,
1322
+ getFieldProps,
1323
+ createOption,
1324
+ isEmpty,
1325
+ inputValue,
1326
+ computedChildren,
1327
+ ...rest
1328
+ } = useAutocomplete({ ...computedProps, defaultValue, children });
1329
+ h = h != null ? h : height;
1330
+ minH = minH != null ? minH : minHeight;
1331
+ const css = {
1332
+ position: "relative",
1333
+ w: "100%",
1334
+ h: "fit-content",
1335
+ color,
1336
+ ...styles.container
1337
+ };
1338
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1339
+ AutocompleteProvider,
1340
+ {
1341
+ value: {
1342
+ ...rest,
1343
+ formControlProps,
1344
+ inputValue,
1345
+ createOption,
1346
+ isEmpty,
1347
+ styles
1348
+ },
1349
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover2.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1350
+ import_core4.ui.div,
1351
+ {
1352
+ className: (0, import_utils4.cx)("ui-autocomplete", className),
1353
+ __css: css,
1354
+ ...getContainerProps(containerProps),
1355
+ children: [
1356
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1357
+ AutocompleteField,
1358
+ {
1359
+ h,
1360
+ minH,
1361
+ inputProps,
1362
+ ...getFieldProps({}, ref)
1363
+ }
1364
+ ),
1365
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteIcon, { ...iconProps, ...formControlProps }),
1366
+ !isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(AutocompleteList, { ...listProps, children: [
1367
+ createOption ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteEmpty, {}),
1368
+ children != null ? children : computedChildren
1369
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteList, { ...listProps, children: createOption && inputValue ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteEmpty, {}) })
1370
+ ]
1371
+ }
1372
+ ) })
1373
+ }
1374
+ ) });
1375
+ }
1376
+ );
1282
1377
  var AutocompleteField = (0, import_core4.forwardRef)(
1283
1378
  ({ className, h, minH, placeholder, inputProps, ...rest }, ref) => {
1284
1379
  const { displayValue, inputValue, styles } = useAutocompleteContext();
@@ -1292,16 +1387,27 @@ var AutocompleteField = (0, import_core4.forwardRef)(
1292
1387
  ...styles.field,
1293
1388
  cursor: "text"
1294
1389
  };
1295
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover2.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.ui.div, { className: (0, import_utils4.cx)("ui-autocomplete-field", className), __css: css, ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1296
- import_core4.ui.input,
1390
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_popover2.PopoverTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1391
+ import_core4.ui.div,
1297
1392
  {
1298
- className: "ui-autocomplete-input",
1299
- display: "inline-block",
1300
- w: "full",
1301
- placeholder,
1302
- ...getInputProps({ ...inputProps, value: inputValue || displayValue || "" }, ref)
1393
+ className: (0, import_utils4.cx)("ui-autocomplete-field", className),
1394
+ __css: css,
1395
+ ...rest,
1396
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1397
+ import_core4.ui.input,
1398
+ {
1399
+ className: "ui-autocomplete-input",
1400
+ display: "inline-block",
1401
+ w: "full",
1402
+ placeholder,
1403
+ ...getInputProps(
1404
+ { ...inputProps, value: inputValue || displayValue || "" },
1405
+ ref
1406
+ )
1407
+ }
1408
+ )
1303
1409
  }
1304
- ) }) });
1410
+ ) });
1305
1411
  }
1306
1412
  );
1307
1413
 
@@ -1485,106 +1591,108 @@ var import_popover3 = require("@yamada-ui/popover");
1485
1591
  var import_utils9 = require("@yamada-ui/utils");
1486
1592
  var import_react3 = require("react");
1487
1593
  var import_jsx_runtime9 = require("react/jsx-runtime");
1488
- var MultiAutocomplete = (0, import_core9.forwardRef)((props, ref) => {
1489
- const [styles, mergedProps] = (0, import_core9.useMultiComponentStyle)("Select", props);
1490
- let {
1491
- className,
1492
- defaultValue = [],
1493
- component,
1494
- separator,
1495
- isClearable = true,
1496
- color,
1497
- h,
1498
- height,
1499
- minH,
1500
- minHeight,
1501
- closeOnSelect = false,
1502
- keepPlaceholder = false,
1503
- containerProps,
1504
- listProps,
1505
- inputProps,
1506
- iconProps,
1507
- clearIconProps,
1508
- children,
1509
- ...computedProps
1510
- } = (0, import_core9.omitThemeProps)(mergedProps);
1511
- const {
1512
- value,
1513
- descendants,
1514
- formControlProps,
1515
- getPopoverProps,
1516
- getContainerProps,
1517
- getFieldProps,
1518
- createOption,
1519
- isEmpty,
1520
- inputValue,
1521
- computedChildren,
1522
- onClear,
1523
- ...rest
1524
- } = useAutocomplete({
1525
- ...computedProps,
1526
- defaultValue,
1527
- closeOnSelect,
1528
- children
1529
- });
1530
- h = h != null ? h : height;
1531
- minH = minH != null ? minH : minHeight;
1532
- const css = {
1533
- position: "relative",
1534
- w: "100%",
1535
- h: "fit-content",
1536
- color,
1537
- ...styles.container
1538
- };
1539
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1540
- AutocompleteProvider,
1541
- {
1542
- value: {
1543
- ...rest,
1544
- value,
1545
- formControlProps,
1546
- inputValue,
1547
- createOption,
1548
- isEmpty,
1549
- styles
1550
- },
1551
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover3.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1552
- import_core9.ui.div,
1553
- {
1554
- className: (0, import_utils9.cx)("ui-autocomplete", className),
1555
- __css: css,
1556
- ...getContainerProps(containerProps),
1557
- children: [
1558
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1559
- MultiAutocompleteField,
1560
- {
1561
- component,
1562
- separator,
1563
- keepPlaceholder,
1564
- h,
1565
- minH,
1566
- inputProps,
1567
- ...getFieldProps({}, ref)
1568
- }
1569
- ),
1570
- isClearable && value.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1571
- AutocompleteClearIcon,
1572
- {
1573
- ...clearIconProps,
1574
- onClick: (0, import_utils9.handlerAll)(clearIconProps == null ? void 0 : clearIconProps.onClick, onClear),
1575
- ...formControlProps
1576
- }
1577
- ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteIcon, { ...iconProps, ...formControlProps }),
1578
- !isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(AutocompleteList, { ...listProps, children: [
1579
- createOption ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteEmpty, {}),
1580
- children != null ? children : computedChildren
1581
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteList, { ...listProps, children: createOption && inputValue ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteEmpty, {}) })
1582
- ]
1583
- }
1584
- ) })
1585
- }
1586
- ) });
1587
- });
1594
+ var MultiAutocomplete = (0, import_core9.forwardRef)(
1595
+ (props, ref) => {
1596
+ const [styles, mergedProps] = (0, import_core9.useMultiComponentStyle)("Select", props);
1597
+ let {
1598
+ className,
1599
+ defaultValue = [],
1600
+ component,
1601
+ separator,
1602
+ isClearable = true,
1603
+ color,
1604
+ h,
1605
+ height,
1606
+ minH,
1607
+ minHeight,
1608
+ closeOnSelect = false,
1609
+ keepPlaceholder = false,
1610
+ containerProps,
1611
+ listProps,
1612
+ inputProps,
1613
+ iconProps,
1614
+ clearIconProps,
1615
+ children,
1616
+ ...computedProps
1617
+ } = (0, import_core9.omitThemeProps)(mergedProps);
1618
+ const {
1619
+ value,
1620
+ descendants,
1621
+ formControlProps,
1622
+ getPopoverProps,
1623
+ getContainerProps,
1624
+ getFieldProps,
1625
+ createOption,
1626
+ isEmpty,
1627
+ inputValue,
1628
+ computedChildren,
1629
+ onClear,
1630
+ ...rest
1631
+ } = useAutocomplete({
1632
+ ...computedProps,
1633
+ defaultValue,
1634
+ closeOnSelect,
1635
+ children
1636
+ });
1637
+ h = h != null ? h : height;
1638
+ minH = minH != null ? minH : minHeight;
1639
+ const css = {
1640
+ position: "relative",
1641
+ w: "100%",
1642
+ h: "fit-content",
1643
+ color,
1644
+ ...styles.container
1645
+ };
1646
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteDescendantsContextProvider, { value: descendants, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1647
+ AutocompleteProvider,
1648
+ {
1649
+ value: {
1650
+ ...rest,
1651
+ value,
1652
+ formControlProps,
1653
+ inputValue,
1654
+ createOption,
1655
+ isEmpty,
1656
+ styles
1657
+ },
1658
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_popover3.Popover, { ...getPopoverProps(), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1659
+ import_core9.ui.div,
1660
+ {
1661
+ className: (0, import_utils9.cx)("ui-autocomplete", className),
1662
+ __css: css,
1663
+ ...getContainerProps(containerProps),
1664
+ children: [
1665
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1666
+ MultiAutocompleteField,
1667
+ {
1668
+ component,
1669
+ separator,
1670
+ keepPlaceholder,
1671
+ h,
1672
+ minH,
1673
+ inputProps,
1674
+ ...getFieldProps({}, ref)
1675
+ }
1676
+ ),
1677
+ isClearable && value.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1678
+ AutocompleteClearIcon,
1679
+ {
1680
+ ...clearIconProps,
1681
+ onClick: (0, import_utils9.handlerAll)(clearIconProps == null ? void 0 : clearIconProps.onClick, onClear),
1682
+ ...formControlProps
1683
+ }
1684
+ ) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteIcon, { ...iconProps, ...formControlProps }),
1685
+ !isEmpty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(AutocompleteList, { ...listProps, children: [
1686
+ createOption ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteEmpty, {}),
1687
+ children != null ? children : computedChildren
1688
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteList, { ...listProps, children: createOption && inputValue ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteCreate, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AutocompleteEmpty, {}) })
1689
+ ]
1690
+ }
1691
+ ) })
1692
+ }
1693
+ ) });
1694
+ }
1695
+ );
1588
1696
  var MultiAutocompleteField = (0, import_core9.forwardRef)(
1589
1697
  ({
1590
1698
  className,
@@ -1597,7 +1705,15 @@ var MultiAutocompleteField = (0, import_core9.forwardRef)(
1597
1705
  inputProps,
1598
1706
  ...rest
1599
1707
  }, ref) => {
1600
- const { value, displayValue, inputValue, onChange, isOpen, inputRef, styles } = useAutocompleteContext();
1708
+ const {
1709
+ value,
1710
+ displayValue,
1711
+ inputValue,
1712
+ onChange,
1713
+ isOpen,
1714
+ inputRef,
1715
+ styles
1716
+ } = useAutocompleteContext();
1601
1717
  const { getInputProps } = useAutocompleteInput();
1602
1718
  const cloneChildren = (0, import_react3.useMemo)(() => {
1603
1719
  if (!(displayValue == null ? void 0 : displayValue.length))