@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.
- package/dist/autocomplete-create.js +24 -17
- package/dist/autocomplete-create.mjs +1 -1
- package/dist/autocomplete-empty.js +24 -17
- package/dist/autocomplete-empty.mjs +1 -1
- package/dist/autocomplete-icon.js +30 -23
- package/dist/autocomplete-icon.mjs +1 -1
- package/dist/autocomplete-list.js +4 -1
- package/dist/autocomplete-list.mjs +1 -1
- package/dist/autocomplete-option-group.d.mts +1 -1
- package/dist/autocomplete-option-group.d.ts +1 -1
- package/dist/autocomplete-option-group.js +10 -5
- package/dist/autocomplete-option-group.mjs +1 -1
- package/dist/autocomplete-option.d.mts +1 -1
- package/dist/autocomplete-option.d.ts +1 -1
- package/dist/autocomplete-option.js +33 -22
- package/dist/autocomplete-option.mjs +1 -1
- package/dist/autocomplete.d.mts +1 -1
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.js +226 -120
- package/dist/autocomplete.mjs +1 -1
- package/dist/{chunk-5O3XEEJE.mjs → chunk-ZVZP7IWT.mjs} +352 -229
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +345 -229
- package/dist/index.mjs +1 -1
- package/dist/multi-autocomplete.d.mts +1 -1
- package/dist/multi-autocomplete.d.ts +1 -1
- package/dist/multi-autocomplete.js +245 -149
- package/dist/multi-autocomplete.mjs +1 -1
- package/dist/{use-autocomplete-cbe9b443.d.ts → use-autocomplete-2422c1c8.d.ts} +25 -5
- package/dist/use-autocomplete.d.mts +1 -1
- package/dist/use-autocomplete.d.ts +1 -1
- package/dist/use-autocomplete.js +131 -45
- package/dist/use-autocomplete.mjs +1 -1
- 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(
|
|
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, [
|
|
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)(
|
|
255
|
-
|
|
256
|
-
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
-
[
|
|
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(
|
|
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
|
-
[
|
|
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
|
-
}, [
|
|
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(
|
|
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 = [
|
|
577
|
+
newOptions[i].value = [
|
|
578
|
+
newOption,
|
|
579
|
+
...newOptions[i].value
|
|
580
|
+
];
|
|
526
581
|
} else {
|
|
527
|
-
newOptions[i].value = [
|
|
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(
|
|
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
|
-
}, [
|
|
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)(
|
|
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 = ({
|
|
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(
|
|
873
|
-
|
|
874
|
-
|
|
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({
|
|
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(
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
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)(
|
|
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
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
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)(
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
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)(
|
|
1296
|
-
import_core4.ui.
|
|
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-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
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)(
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
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 {
|
|
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))
|