@yamada-ui/autocomplete 1.5.4-next-20241005220055 → 1.6.0-dev-20241011151311
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/autocomplete-context.d.mts +115 -115
- package/dist/autocomplete-context.d.ts +115 -115
- package/dist/autocomplete-context.js +2 -2
- package/dist/autocomplete-context.js.map +1 -1
- package/dist/autocomplete-context.mjs +1 -1
- package/dist/autocomplete-create.d.mts +4 -4
- package/dist/autocomplete-create.d.ts +4 -4
- package/dist/autocomplete-create.js +32 -32
- package/dist/autocomplete-create.js.map +1 -1
- package/dist/autocomplete-create.mjs +4 -4
- package/dist/autocomplete-empty.d.mts +4 -4
- package/dist/autocomplete-empty.d.ts +4 -4
- package/dist/autocomplete-empty.js +34 -34
- package/dist/autocomplete-empty.js.map +1 -1
- package/dist/autocomplete-empty.mjs +4 -4
- package/dist/autocomplete-icon.js +17 -17
- package/dist/autocomplete-icon.js.map +1 -1
- package/dist/autocomplete-icon.mjs +2 -2
- package/dist/autocomplete-list.d.mts +2 -2
- package/dist/autocomplete-list.d.ts +2 -2
- package/dist/autocomplete-list.js +18 -18
- package/dist/autocomplete-list.js.map +1 -1
- package/dist/autocomplete-list.mjs +3 -3
- package/dist/autocomplete-option-group.js +10 -10
- package/dist/autocomplete-option-group.js.map +1 -1
- package/dist/autocomplete-option-group.mjs +3 -3
- package/dist/autocomplete-option.d.mts +1 -1
- package/dist/autocomplete-option.d.ts +1 -1
- package/dist/autocomplete-option.js +56 -47
- package/dist/autocomplete-option.js.map +1 -1
- package/dist/autocomplete-option.mjs +4 -4
- package/dist/autocomplete.d.mts +31 -31
- package/dist/autocomplete.d.ts +31 -31
- package/dist/autocomplete.js +303 -292
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.mjs +12 -12
- package/dist/{chunk-5GKGL6BL.mjs → chunk-2HJUFFCU.mjs} +16 -16
- package/dist/chunk-2HJUFFCU.mjs.map +1 -0
- package/dist/{chunk-6F3LT7J6.mjs → chunk-4SBNPEK7.mjs} +7 -7
- package/dist/{chunk-6F3LT7J6.mjs.map → chunk-4SBNPEK7.mjs.map} +1 -1
- package/dist/{chunk-JMX72TSD.mjs → chunk-67X7JKWL.mjs} +7 -7
- package/dist/{chunk-JMX72TSD.mjs.map → chunk-67X7JKWL.mjs.map} +1 -1
- package/dist/{chunk-5LPWFWE6.mjs → chunk-6OLHNK7O.mjs} +46 -34
- package/dist/chunk-6OLHNK7O.mjs.map +1 -0
- package/dist/{chunk-QPIWG4ZF.mjs → chunk-7LZUXESV.mjs} +63 -61
- package/dist/chunk-7LZUXESV.mjs.map +1 -0
- package/dist/{chunk-S2HFYJVI.mjs → chunk-AIBJWPRA.mjs} +13 -13
- package/dist/chunk-AIBJWPRA.mjs.map +1 -0
- package/dist/{chunk-Q2HZVVOI.mjs → chunk-K5HCHHCJ.mjs} +16 -16
- package/dist/chunk-K5HCHHCJ.mjs.map +1 -0
- package/dist/{chunk-HZECQUHV.mjs → chunk-Q33EMTO2.mjs} +40 -40
- package/dist/{chunk-HZECQUHV.mjs.map → chunk-Q33EMTO2.mjs.map} +1 -1
- package/dist/{chunk-R76HPAN4.mjs → chunk-TR4X4EEG.mjs} +7 -7
- package/dist/{chunk-R76HPAN4.mjs.map → chunk-TR4X4EEG.mjs.map} +1 -1
- package/dist/{chunk-7SWSKLSA.mjs → chunk-V6YCG642.mjs} +18 -18
- package/dist/chunk-V6YCG642.mjs.map +1 -0
- package/dist/{chunk-S53LMDD7.mjs → chunk-VTBUO5SK.mjs} +15 -15
- package/dist/chunk-VTBUO5SK.mjs.map +1 -0
- package/dist/{chunk-JPUKYLBW.mjs → chunk-WDQYM4FP.mjs} +5 -5
- package/dist/chunk-WDQYM4FP.mjs.map +1 -0
- package/dist/{chunk-OLOU5HFC.mjs → chunk-WERCEZNJ.mjs} +168 -166
- package/dist/chunk-WERCEZNJ.mjs.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +356 -343
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/multi-autocomplete.d.mts +51 -51
- package/dist/multi-autocomplete.d.ts +51 -51
- package/dist/multi-autocomplete.js +326 -313
- package/dist/multi-autocomplete.js.map +1 -1
- package/dist/multi-autocomplete.mjs +12 -12
- package/dist/use-autocomplete-list.d.mts +1 -1
- package/dist/use-autocomplete-list.d.ts +1 -1
- package/dist/use-autocomplete-list.js +7 -7
- package/dist/use-autocomplete-list.js.map +1 -1
- package/dist/use-autocomplete-list.mjs +2 -2
- package/dist/use-autocomplete-option-group.js +7 -7
- package/dist/use-autocomplete-option-group.js.map +1 -1
- package/dist/use-autocomplete-option-group.mjs +2 -2
- package/dist/use-autocomplete-option.d.mts +12 -12
- package/dist/use-autocomplete-option.d.ts +12 -12
- package/dist/use-autocomplete-option.js +43 -34
- package/dist/use-autocomplete-option.js.map +1 -1
- package/dist/use-autocomplete-option.mjs +2 -2
- package/dist/use-autocomplete.d.mts +86 -86
- package/dist/use-autocomplete.d.ts +86 -86
- package/dist/use-autocomplete.js +225 -214
- package/dist/use-autocomplete.js.map +1 -1
- package/dist/use-autocomplete.mjs +7 -7
- package/package.json +13 -13
- package/dist/chunk-5GKGL6BL.mjs.map +0 -1
- package/dist/chunk-5LPWFWE6.mjs.map +0 -1
- package/dist/chunk-7SWSKLSA.mjs.map +0 -1
- package/dist/chunk-JPUKYLBW.mjs.map +0 -1
- package/dist/chunk-OLOU5HFC.mjs.map +0 -1
- package/dist/chunk-Q2HZVVOI.mjs.map +0 -1
- package/dist/chunk-QPIWG4ZF.mjs.map +0 -1
- package/dist/chunk-S2HFYJVI.mjs.map +0 -1
- package/dist/chunk-S53LMDD7.mjs.map +0 -1
package/dist/use-autocomplete.js
CHANGED
@@ -38,9 +38,9 @@ var import_use_descendant = require("@yamada-ui/use-descendant");
|
|
38
38
|
var import_utils = require("@yamada-ui/utils");
|
39
39
|
var {
|
40
40
|
DescendantsContextProvider: AutocompleteDescendantsContextProvider,
|
41
|
-
|
41
|
+
useDescendant: useAutocompleteDescendant,
|
42
42
|
useDescendants: useAutocompleteDescendants,
|
43
|
-
|
43
|
+
useDescendantsContext: useAutocompleteDescendantsContext
|
44
44
|
} = (0, import_use_descendant.createDescendant)();
|
45
45
|
var [AutocompleteProvider, useAutocompleteContext] = (0, import_utils.createContext)({
|
46
46
|
name: "AutocompleteContext",
|
@@ -62,27 +62,27 @@ var AutocompleteIcon = (0, import_core.forwardRef)(
|
|
62
62
|
({ className, children, __css, ...rest }, ref) => {
|
63
63
|
const { styles } = useAutocompleteContext();
|
64
64
|
const css = {
|
65
|
-
position: "absolute",
|
66
|
-
top: "50%",
|
67
|
-
transform: "translateY(-50%)",
|
68
|
-
display: "inline-flex",
|
69
65
|
alignItems: "center",
|
66
|
+
cursor: "pointer",
|
67
|
+
display: "inline-flex",
|
70
68
|
justifyContent: "center",
|
71
69
|
pointerEvents: "none",
|
72
|
-
|
70
|
+
position: "absolute",
|
71
|
+
top: "50%",
|
72
|
+
transform: "translateY(-50%)",
|
73
73
|
...styles.icon,
|
74
74
|
...__css
|
75
75
|
};
|
76
76
|
const validChildren = (0, import_utils2.getValidChildren)(children);
|
77
77
|
const cloneChildren = validChildren.map(
|
78
78
|
(child) => (0, import_react.cloneElement)(child, {
|
79
|
-
focusable: false,
|
80
|
-
"aria-hidden": true,
|
81
79
|
style: {
|
82
|
-
|
80
|
+
color: "currentColor",
|
83
81
|
maxHeight: "1em",
|
84
|
-
|
85
|
-
}
|
82
|
+
maxWidth: "1em"
|
83
|
+
},
|
84
|
+
"aria-hidden": true,
|
85
|
+
focusable: false
|
86
86
|
})
|
87
87
|
);
|
88
88
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -115,11 +115,11 @@ var AutocompleteClearIcon = ({
|
|
115
115
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
116
116
|
AutocompleteIcon,
|
117
117
|
{
|
118
|
-
"aria-label": "Clear value",
|
119
118
|
className: (0, import_utils2.cx)("ui-autocomplete__icon--clear", className),
|
119
|
+
"aria-label": "Clear value",
|
120
120
|
__css: styles.clearIcon,
|
121
121
|
...rest,
|
122
|
-
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, {
|
122
|
+
children: children != null ? children : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon.CloseIcon, { h: "0.5em", w: "0.5em" })
|
123
123
|
}
|
124
124
|
);
|
125
125
|
};
|
@@ -128,11 +128,11 @@ AutocompleteClearIcon.__ui__ = "AutocompleteClearIcon";
|
|
128
128
|
var AutocompleteItemIcon = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
|
129
129
|
const { styles } = useAutocompleteContext();
|
130
130
|
const css = {
|
131
|
-
flexShrink: 0,
|
132
|
-
display: "inline-flex",
|
133
|
-
justifyContent: "center",
|
134
131
|
alignItems: "center",
|
132
|
+
display: "inline-flex",
|
133
|
+
flexShrink: 0,
|
135
134
|
fontSize: "0.85em",
|
135
|
+
justifyContent: "center",
|
136
136
|
...styles.itemIcon
|
137
137
|
};
|
138
138
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
@@ -153,41 +153,50 @@ var import_utils3 = require("@yamada-ui/utils");
|
|
153
153
|
var import_react2 = require("react");
|
154
154
|
var isTargetOption = (target) => {
|
155
155
|
var _a;
|
156
|
-
return (0, import_utils3.isHTMLElement)(target) && !!((_a = target
|
156
|
+
return (0, import_utils3.isHTMLElement)(target) && !!((_a = target.getAttribute("role")) == null ? void 0 : _a.startsWith("option"));
|
157
157
|
};
|
158
158
|
var useAutocompleteOption = (props) => {
|
159
159
|
var _a, _b;
|
160
160
|
const {
|
161
|
-
|
161
|
+
closeOnSelect: generalCloseOnSelect,
|
162
|
+
focusedIndex,
|
163
|
+
inputRef,
|
162
164
|
omitSelectedValues,
|
165
|
+
setFocusedIndex,
|
166
|
+
value,
|
167
|
+
optionProps,
|
163
168
|
onChange,
|
164
169
|
onChangeLabel,
|
165
|
-
focusedIndex,
|
166
|
-
setFocusedIndex,
|
167
170
|
onClose,
|
168
|
-
closeOnSelect: generalCloseOnSelect,
|
169
|
-
optionProps,
|
170
|
-
inputRef,
|
171
171
|
onFocusNext
|
172
172
|
} = useAutocompleteContext();
|
173
173
|
const id = (0, import_react2.useId)();
|
174
174
|
let {
|
175
|
+
children,
|
176
|
+
closeOnSelect: customCloseOnSelect,
|
175
177
|
icon: customIcon,
|
176
178
|
isDisabled,
|
177
179
|
isFocusable,
|
178
|
-
closeOnSelect: customCloseOnSelect,
|
179
|
-
children,
|
180
180
|
value: optionValue,
|
181
181
|
...computedProps
|
182
182
|
} = { ...optionProps, ...props };
|
183
183
|
const trulyDisabled = !!isDisabled && !isFocusable;
|
184
184
|
const itemRef = (0, import_react2.useRef)(null);
|
185
|
-
const { index, register
|
185
|
+
const { descendants, index, register } = useAutocompleteDescendant({
|
186
186
|
disabled: trulyDisabled
|
187
187
|
});
|
188
188
|
const values = descendants.values();
|
189
189
|
const frontValues = values.slice(0, index);
|
190
190
|
const isMulti = (0, import_utils3.isArray)(value);
|
191
|
+
if ((0, import_utils3.isUndefined)(optionValue)) {
|
192
|
+
if ((0, import_utils3.isString)(children) || (0, import_utils3.isNumber)(children)) {
|
193
|
+
optionValue = children.toString();
|
194
|
+
} else {
|
195
|
+
console.warn(
|
196
|
+
`${!isMulti ? "Autocomplete" : "MultiAutocomplete"}: Cannot infer the option value of complex children. Pass a \`value\` prop or use a plain string as children to <Option>.`
|
197
|
+
);
|
198
|
+
}
|
199
|
+
}
|
191
200
|
const isDuplicated = !isMulti ? frontValues.some(({ node }) => node.dataset.value === (optionValue != null ? optionValue : "")) : false;
|
192
201
|
const isSelected = !isDuplicated && (!isMulti ? (optionValue != null ? optionValue : "") === value : value.includes(optionValue != null ? optionValue : ""));
|
193
202
|
const isTarget = "target" in ((_b = (_a = itemRef.current) == null ? void 0 : _a.dataset) != null ? _b : {});
|
@@ -232,27 +241,27 @@ var useAutocompleteOption = (props) => {
|
|
232
241
|
border: "0px",
|
233
242
|
clip: "rect(0px, 0px, 0px, 0px)",
|
234
243
|
height: "1px",
|
235
|
-
width: "1px",
|
236
244
|
margin: "-1px",
|
237
|
-
padding: "0px",
|
238
245
|
overflow: "hidden",
|
246
|
+
padding: "0px",
|
247
|
+
position: "absolute",
|
239
248
|
whiteSpace: "nowrap",
|
240
|
-
|
249
|
+
width: "1px"
|
241
250
|
};
|
242
251
|
return {
|
243
|
-
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
244
252
|
id,
|
253
|
+
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
245
254
|
role: "option",
|
246
255
|
...computedProps,
|
247
256
|
...props2,
|
248
|
-
tabIndex: -1,
|
249
257
|
style: !isTarget || omitSelectedValues && isSelected ? style : void 0,
|
250
|
-
"data-target": (0, import_utils3.dataAttr)(true),
|
251
|
-
"data-value": optionValue != null ? optionValue : "",
|
252
|
-
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
253
|
-
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
254
258
|
"aria-checked": isSelected,
|
255
259
|
"aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
|
260
|
+
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
261
|
+
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
262
|
+
"data-target": (0, import_utils3.dataAttr)(true),
|
263
|
+
"data-value": optionValue != null ? optionValue : "",
|
264
|
+
tabIndex: -1,
|
256
265
|
onClick: (0, import_utils3.handlerAll)(computedProps.onClick, props2.onClick, onClick)
|
257
266
|
};
|
258
267
|
},
|
@@ -270,10 +279,10 @@ var useAutocompleteOption = (props) => {
|
|
270
279
|
]
|
271
280
|
);
|
272
281
|
return {
|
273
|
-
isSelected,
|
274
|
-
isFocused,
|
275
|
-
customIcon,
|
276
282
|
children,
|
283
|
+
customIcon,
|
284
|
+
isFocused,
|
285
|
+
isSelected,
|
277
286
|
getOptionProps
|
278
287
|
};
|
279
288
|
};
|
@@ -283,19 +292,19 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
283
292
|
var AutocompleteOption = (0, import_core2.forwardRef)(
|
284
293
|
({ className, icon, ...rest }, ref) => {
|
285
294
|
const { styles } = useAutocompleteContext();
|
286
|
-
const {
|
295
|
+
const { children, customIcon, isSelected, getOptionProps } = useAutocompleteOption(rest);
|
287
296
|
icon != null ? icon : icon = customIcon;
|
288
297
|
const css = {
|
289
|
-
|
298
|
+
alignItems: "center",
|
290
299
|
color: "inherit",
|
291
|
-
userSelect: "none",
|
292
300
|
display: "flex",
|
293
|
-
width: "100%",
|
294
|
-
alignItems: "center",
|
295
|
-
textAlign: "start",
|
296
301
|
flex: "0 0 auto",
|
297
|
-
outline: 0,
|
298
302
|
gap: "0.75rem",
|
303
|
+
outline: 0,
|
304
|
+
textAlign: "start",
|
305
|
+
textDecoration: "none",
|
306
|
+
userSelect: "none",
|
307
|
+
width: "100%",
|
299
308
|
...styles.item
|
300
309
|
};
|
301
310
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
@@ -314,7 +323,7 @@ var AutocompleteOption = (0, import_core2.forwardRef)(
|
|
314
323
|
);
|
315
324
|
AutocompleteOption.displayName = "AutocompleteOption";
|
316
325
|
AutocompleteOption.__ui__ = "AutocompleteOption";
|
317
|
-
var AutocompleteCheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 14 14", width: "1em",
|
326
|
+
var AutocompleteCheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { height: "1em", viewBox: "0 0 14 14", width: "1em", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
318
327
|
"polygon",
|
319
328
|
{
|
320
329
|
fill: "currentColor",
|
@@ -336,7 +345,7 @@ var useAutocompleteOptionGroup = ({
|
|
336
345
|
label,
|
337
346
|
...rest
|
338
347
|
}) => {
|
339
|
-
const {
|
348
|
+
const { omitSelectedValues, value } = useAutocompleteContext();
|
340
349
|
const isMulti = (0, import_utils5.isArray)(value);
|
341
350
|
const descendants = useAutocompleteDescendantsContext();
|
342
351
|
const values = descendants.values();
|
@@ -348,7 +357,7 @@ var useAutocompleteOptionGroup = ({
|
|
348
357
|
) : [];
|
349
358
|
const selectedIndexes = selectedValues.map(({ index }) => index);
|
350
359
|
const childValues = values.filter(
|
351
|
-
({
|
360
|
+
({ index, node }) => {
|
352
361
|
var _a;
|
353
362
|
return ((_a = node.parentElement) == null ? void 0 : _a.dataset.label) === label && !selectedIndexes.includes(index) && "target" in node.dataset;
|
354
363
|
}
|
@@ -361,12 +370,12 @@ var useAutocompleteOptionGroup = ({
|
|
361
370
|
border: "0px",
|
362
371
|
clip: "rect(0px, 0px, 0px, 0px)",
|
363
372
|
height: "1px",
|
364
|
-
width: "1px",
|
365
373
|
margin: "-1px",
|
366
|
-
padding: "0px",
|
367
374
|
overflow: "hidden",
|
375
|
+
padding: "0px",
|
376
|
+
position: "absolute",
|
368
377
|
whiteSpace: "nowrap",
|
369
|
-
|
378
|
+
width: "1px"
|
370
379
|
};
|
371
380
|
return {
|
372
381
|
ref,
|
@@ -401,12 +410,12 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
401
410
|
var AutocompleteOptionGroup = (0, import_core4.forwardRef)(
|
402
411
|
({
|
403
412
|
className,
|
413
|
+
children,
|
404
414
|
color,
|
405
415
|
h,
|
406
416
|
height,
|
407
417
|
minH,
|
408
418
|
minHeight,
|
409
|
-
children,
|
410
419
|
labelProps,
|
411
420
|
...rest
|
412
421
|
}, ref) => {
|
@@ -422,15 +431,15 @@ var AutocompleteOptionGroup = (0, import_core4.forwardRef)(
|
|
422
431
|
"ui-autocomplete__item--group",
|
423
432
|
className
|
424
433
|
),
|
425
|
-
__css: {
|
434
|
+
__css: { color, h: "fit-content", w: "100%" },
|
426
435
|
...getContainerProps(),
|
427
436
|
children: [
|
428
437
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
429
438
|
import_core4.ui.span,
|
430
439
|
{
|
431
440
|
className: "ui-autocomplete__item__group-label",
|
432
|
-
__css: styles.groupLabel,
|
433
441
|
lineClamp: 1,
|
442
|
+
__css: styles.groupLabel,
|
434
443
|
...labelProps,
|
435
444
|
children: label
|
436
445
|
}
|
@@ -455,64 +464,79 @@ AutocompleteOptionGroup.__ui__ = "AutocompleteOptionGroup";
|
|
455
464
|
// src/use-autocomplete.tsx
|
456
465
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
457
466
|
var kanaMap = {
|
458
|
-
\
|
459
|
-
\
|
460
|
-
\
|
461
|
-
\
|
462
|
-
\
|
463
|
-
\
|
464
|
-
\uFF7C\uFF9E: "\u30B8",
|
465
|
-
\uFF7D\uFF9E: "\u30BA",
|
466
|
-
\uFF7E\uFF9E: "\u30BC",
|
467
|
-
\uFF7F\uFF9E: "\u30BE",
|
468
|
-
\uFF80\uFF9E: "\u30C0",
|
469
|
-
\uFF81\uFF9E: "\u30C2",
|
470
|
-
\uFF82\uFF9E: "\u30C5",
|
471
|
-
\uFF83\uFF9E: "\u30C7",
|
472
|
-
\uFF84\uFF9E: "\u30C9",
|
473
|
-
\uFF8A\uFF9E: "\u30D0",
|
474
|
-
\uFF8B\uFF9E: "\u30D3",
|
475
|
-
\uFF8C\uFF9E: "\u30D6",
|
476
|
-
\uFF8D\uFF9E: "\u30D9",
|
477
|
-
\uFF8E\uFF9E: "\u30DC",
|
478
|
-
\uFF8A\uFF9F: "\u30D1",
|
479
|
-
\uFF8B\uFF9F: "\u30D4",
|
480
|
-
\uFF8C\uFF9F: "\u30D7",
|
481
|
-
\uFF8D\uFF9F: "\u30DA",
|
482
|
-
\uFF8E\uFF9F: "\u30DD",
|
483
|
-
\uFF73\uFF9E: "\u30F4",
|
484
|
-
\uFF9C\uFF9E: "\u30F7",
|
467
|
+
"\uFF61": "\u3002",
|
468
|
+
"\uFF62": "\u300C",
|
469
|
+
"\uFF63": "\u300D",
|
470
|
+
"\uFF64": "\u3001",
|
471
|
+
"\uFF65": "\u30FB",
|
472
|
+
\uFF66: "\u30F2",
|
485
473
|
\uFF66\uFF9E: "\u30FA",
|
474
|
+
\uFF67: "\u30A1",
|
475
|
+
\uFF68: "\u30A3",
|
476
|
+
\uFF69: "\u30A5",
|
477
|
+
\uFF6A: "\u30A7",
|
478
|
+
\uFF6B: "\u30A9",
|
479
|
+
\uFF6C: "\u30E3",
|
480
|
+
\uFF6D: "\u30E5",
|
481
|
+
\uFF6E: "\u30E7",
|
482
|
+
\uFF6F: "\u30C3",
|
483
|
+
\uFF70: "\u30FC",
|
486
484
|
\uFF71: "\u30A2",
|
487
485
|
\uFF72: "\u30A4",
|
488
486
|
\uFF73: "\u30A6",
|
487
|
+
\uFF73\uFF9E: "\u30F4",
|
489
488
|
\uFF74: "\u30A8",
|
490
489
|
\uFF75: "\u30AA",
|
491
490
|
\uFF76: "\u30AB",
|
491
|
+
\uFF76\uFF9E: "\u30AC",
|
492
492
|
\uFF77: "\u30AD",
|
493
|
+
\uFF77\uFF9E: "\u30AE",
|
493
494
|
\uFF78: "\u30AF",
|
495
|
+
\uFF78\uFF9E: "\u30B0",
|
494
496
|
\uFF79: "\u30B1",
|
497
|
+
\uFF79\uFF9E: "\u30B2",
|
495
498
|
\uFF7A: "\u30B3",
|
499
|
+
\uFF7A\uFF9E: "\u30B4",
|
496
500
|
\uFF7B: "\u30B5",
|
501
|
+
\uFF7B\uFF9E: "\u30B6",
|
497
502
|
\uFF7C: "\u30B7",
|
503
|
+
\uFF7C\uFF9E: "\u30B8",
|
498
504
|
\uFF7D: "\u30B9",
|
505
|
+
\uFF7D\uFF9E: "\u30BA",
|
499
506
|
\uFF7E: "\u30BB",
|
507
|
+
\uFF7E\uFF9E: "\u30BC",
|
500
508
|
\uFF7F: "\u30BD",
|
509
|
+
\uFF7F\uFF9E: "\u30BE",
|
501
510
|
\uFF80: "\u30BF",
|
511
|
+
\uFF80\uFF9E: "\u30C0",
|
502
512
|
\uFF81: "\u30C1",
|
513
|
+
\uFF81\uFF9E: "\u30C2",
|
503
514
|
\uFF82: "\u30C4",
|
515
|
+
\uFF82\uFF9E: "\u30C5",
|
504
516
|
\uFF83: "\u30C6",
|
517
|
+
\uFF83\uFF9E: "\u30C7",
|
505
518
|
\uFF84: "\u30C8",
|
519
|
+
\uFF84\uFF9E: "\u30C9",
|
506
520
|
\uFF85: "\u30CA",
|
507
521
|
\uFF86: "\u30CB",
|
508
522
|
\uFF87: "\u30CC",
|
509
523
|
\uFF88: "\u30CD",
|
510
524
|
\uFF89: "\u30CE",
|
511
525
|
\uFF8A: "\u30CF",
|
526
|
+
\uFF8A\uFF9E: "\u30D0",
|
527
|
+
\uFF8A\uFF9F: "\u30D1",
|
512
528
|
\uFF8B: "\u30D2",
|
529
|
+
\uFF8B\uFF9E: "\u30D3",
|
530
|
+
\uFF8B\uFF9F: "\u30D4",
|
513
531
|
\uFF8C: "\u30D5",
|
532
|
+
\uFF8C\uFF9E: "\u30D6",
|
533
|
+
\uFF8C\uFF9F: "\u30D7",
|
514
534
|
\uFF8D: "\u30D8",
|
535
|
+
\uFF8D\uFF9E: "\u30D9",
|
536
|
+
\uFF8D\uFF9F: "\u30DA",
|
515
537
|
\uFF8E: "\u30DB",
|
538
|
+
\uFF8E\uFF9E: "\u30DC",
|
539
|
+
\uFF8E\uFF9F: "\u30DD",
|
516
540
|
\uFF8F: "\u30DE",
|
517
541
|
\uFF90: "\u30DF",
|
518
542
|
\uFF91: "\u30E0",
|
@@ -527,23 +551,8 @@ var kanaMap = {
|
|
527
551
|
\uFF9A: "\u30EC",
|
528
552
|
\uFF9B: "\u30ED",
|
529
553
|
\uFF9C: "\u30EF",
|
530
|
-
\
|
531
|
-
\uFF9D: "\u30F3"
|
532
|
-
\uFF67: "\u30A1",
|
533
|
-
\uFF68: "\u30A3",
|
534
|
-
\uFF69: "\u30A5",
|
535
|
-
\uFF6A: "\u30A7",
|
536
|
-
\uFF6B: "\u30A9",
|
537
|
-
\uFF6F: "\u30C3",
|
538
|
-
\uFF6C: "\u30E3",
|
539
|
-
\uFF6D: "\u30E5",
|
540
|
-
\uFF6E: "\u30E7",
|
541
|
-
"\uFF61": "\u3002",
|
542
|
-
"\uFF64": "\u3001",
|
543
|
-
\uFF70: "\u30FC",
|
544
|
-
"\uFF62": "\u300C",
|
545
|
-
"\uFF63": "\u300D",
|
546
|
-
"\uFF65": "\u30FB"
|
554
|
+
\uFF9C\uFF9E: "\u30F7",
|
555
|
+
\uFF9D: "\u30F3"
|
547
556
|
};
|
548
557
|
var defaultFormat = (value) => {
|
549
558
|
value = value.replace(
|
@@ -571,46 +580,46 @@ var flattenItems = (items) => {
|
|
571
580
|
};
|
572
581
|
var useAutocomplete = (props) => {
|
573
582
|
const {
|
574
|
-
value: valueProp,
|
575
|
-
defaultValue,
|
576
|
-
onChange: onChangeProp,
|
577
|
-
onCreate: onCreateProp,
|
578
|
-
onSearch: onSearchProp,
|
579
|
-
closeOnSelect = true,
|
580
|
-
omitSelectedValues = false,
|
581
|
-
maxSelectValues,
|
582
583
|
allowCreate = false,
|
583
584
|
allowFree = false,
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
placeholder,
|
589
|
-
onKeyDown: onKeyDownProp,
|
590
|
-
isOpen: isOpenProp,
|
591
|
-
defaultIsOpen,
|
592
|
-
onOpen: onOpenProp,
|
593
|
-
onClose: onCloseProp,
|
585
|
+
animation,
|
586
|
+
boundary,
|
587
|
+
children,
|
588
|
+
closeDelay,
|
594
589
|
closeOnBlur = true,
|
595
590
|
closeOnEsc = true,
|
596
|
-
|
597
|
-
|
591
|
+
closeOnSelect = true,
|
592
|
+
defaultIsOpen,
|
593
|
+
defaultValue,
|
594
|
+
duration = 0.2,
|
595
|
+
emptyMessage = "No results found",
|
596
|
+
eventListeners,
|
597
|
+
flip,
|
598
|
+
format = defaultFormat,
|
599
|
+
gutter,
|
600
|
+
insertPositionItem = "first",
|
598
601
|
isLazy,
|
602
|
+
isOpen: isOpenProp,
|
603
|
+
items,
|
599
604
|
lazyBehavior,
|
600
|
-
|
601
|
-
|
605
|
+
matchWidth = true,
|
606
|
+
maxSelectValues,
|
607
|
+
modifiers,
|
602
608
|
offset,
|
603
|
-
|
609
|
+
omitSelectedValues = false,
|
610
|
+
openDelay,
|
611
|
+
placeholder,
|
612
|
+
placement = "bottom-start",
|
604
613
|
preventOverflow,
|
605
|
-
flip,
|
606
|
-
matchWidth = true,
|
607
|
-
boundary,
|
608
|
-
eventListeners,
|
609
614
|
strategy,
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
615
|
+
value: valueProp,
|
616
|
+
optionProps,
|
617
|
+
onChange: onChangeProp,
|
618
|
+
onClose: onCloseProp,
|
619
|
+
onCreate: onCreateProp,
|
620
|
+
onKeyDown: onKeyDownProp,
|
621
|
+
onOpen: onOpenProp,
|
622
|
+
onSearch: onSearchProp,
|
614
623
|
...rest
|
615
624
|
} = (0, import_form_control.useFormControlProps)(props);
|
616
625
|
const {
|
@@ -629,8 +638,8 @@ var useAutocomplete = (props) => {
|
|
629
638
|
const prevValue = (0, import_react4.useRef)(void 0);
|
630
639
|
const [resolvedItems, setResolvedItems] = (0, import_react4.useState)(items ? JSON.parse(JSON.stringify(items)) : void 0);
|
631
640
|
const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
632
|
-
value: valueProp,
|
633
641
|
defaultValue,
|
642
|
+
value: valueProp,
|
634
643
|
onChange: onChangeProp
|
635
644
|
});
|
636
645
|
const [label, setLabel] = (0, import_react4.useState)(void 0);
|
@@ -640,13 +649,13 @@ var useAutocomplete = (props) => {
|
|
640
649
|
const [isHit, setIsHit] = (0, import_react4.useState)(true);
|
641
650
|
const {
|
642
651
|
isOpen,
|
643
|
-
|
644
|
-
|
652
|
+
onClose,
|
653
|
+
onOpen: onInternalOpen
|
645
654
|
} = (0, import_use_disclosure.useDisclosure)({
|
646
|
-
isOpen: isOpenProp,
|
647
655
|
defaultIsOpen,
|
648
|
-
|
649
|
-
onClose: onCloseProp
|
656
|
+
isOpen: isOpenProp,
|
657
|
+
onClose: onCloseProp,
|
658
|
+
onOpen: onOpenProp
|
650
659
|
});
|
651
660
|
const isFocused = focusedIndex > -1;
|
652
661
|
const isCreate = focusedIndex === -2 && allowCreate;
|
@@ -672,7 +681,7 @@ var useAutocomplete = (props) => {
|
|
672
681
|
);
|
673
682
|
const selectedIndexes = selectedValues.map(({ index }) => index);
|
674
683
|
const enabledValues = descendants.enabledValues(
|
675
|
-
({
|
684
|
+
({ index, node }) => "target" in node.dataset && !selectedIndexes.includes(index)
|
676
685
|
);
|
677
686
|
const validChildren = (0, import_utils7.getValidChildren)(children);
|
678
687
|
const computedChildren = (0, import_react4.useMemo)(
|
@@ -681,7 +690,7 @@ var useAutocomplete = (props) => {
|
|
681
690
|
const { label: label2, value: value2, ...props2 } = item;
|
682
691
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteOption, { value: value2, ...props2, children: label2 }, i);
|
683
692
|
} else if ("items" in item) {
|
684
|
-
const {
|
693
|
+
const { items: items2 = [], label: label2, ...props2 } = item;
|
685
694
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteOptionGroup, { label: label2, ...props2, children: items2.map(({ label: label3, value: value2, ...props3 }, i2) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteOption, { value: value2, ...props3, children: label3 }, i2)) }, i);
|
686
695
|
}
|
687
696
|
}),
|
@@ -696,6 +705,7 @@ var useAutocomplete = (props) => {
|
|
696
705
|
}, [allowCreate, formControlProps, isAllSelected, isEmpty, onInternalOpen]);
|
697
706
|
const onFocusFirst = (0, import_react4.useCallback)(() => {
|
698
707
|
const id2 = setTimeout(() => {
|
708
|
+
var _a;
|
699
709
|
if (isEmpty || isAllSelected) return;
|
700
710
|
const first = descendants.enabledFirstValue(
|
701
711
|
({ node }) => "target" in node.dataset
|
@@ -706,7 +716,7 @@ var useAutocomplete = (props) => {
|
|
706
716
|
} else {
|
707
717
|
if (selectedIndexes.includes(first.index)) {
|
708
718
|
const enabledFirst = enabledValues[0];
|
709
|
-
setFocusedIndex(enabledFirst.index);
|
719
|
+
setFocusedIndex((_a = enabledFirst == null ? void 0 : enabledFirst.index) != null ? _a : -1);
|
710
720
|
} else {
|
711
721
|
setFocusedIndex(first.index);
|
712
722
|
}
|
@@ -724,6 +734,7 @@ var useAutocomplete = (props) => {
|
|
724
734
|
]);
|
725
735
|
const onFocusLast = (0, import_react4.useCallback)(() => {
|
726
736
|
const id2 = setTimeout(() => {
|
737
|
+
var _a;
|
727
738
|
if (isEmpty || isAllSelected) return;
|
728
739
|
const last = descendants.enabledLastValue(
|
729
740
|
({ node }) => "target" in node.dataset
|
@@ -734,7 +745,7 @@ var useAutocomplete = (props) => {
|
|
734
745
|
} else {
|
735
746
|
if (selectedIndexes.includes(last.index)) {
|
736
747
|
const enabledLast = enabledValues.reverse()[0];
|
737
|
-
setFocusedIndex(enabledLast.index);
|
748
|
+
setFocusedIndex((_a = enabledLast == null ? void 0 : enabledLast.index) != null ? _a : -1);
|
738
749
|
} else {
|
739
750
|
setFocusedIndex(last.index);
|
740
751
|
}
|
@@ -766,7 +777,7 @@ var useAutocomplete = (props) => {
|
|
766
777
|
const onFocusNext = (0, import_react4.useCallback)(
|
767
778
|
(index = focusedIndex) => {
|
768
779
|
const id2 = setTimeout(() => {
|
769
|
-
var _a;
|
780
|
+
var _a, _b;
|
770
781
|
const next = descendants.enabledNextValue(
|
771
782
|
index,
|
772
783
|
({ node }) => "target" in node.dataset
|
@@ -777,7 +788,7 @@ var useAutocomplete = (props) => {
|
|
777
788
|
} else {
|
778
789
|
if (selectedIndexes.includes(next.index)) {
|
779
790
|
const enabledNext = (_a = enabledValues.find(({ index: index2 }) => next.index < index2)) != null ? _a : enabledValues[0];
|
780
|
-
setFocusedIndex(enabledNext.index);
|
791
|
+
setFocusedIndex((_b = enabledNext == null ? void 0 : enabledNext.index) != null ? _b : -1);
|
781
792
|
} else {
|
782
793
|
setFocusedIndex(next.index);
|
783
794
|
}
|
@@ -797,7 +808,7 @@ var useAutocomplete = (props) => {
|
|
797
808
|
const onFocusPrev = (0, import_react4.useCallback)(
|
798
809
|
(index = focusedIndex) => {
|
799
810
|
const id2 = setTimeout(() => {
|
800
|
-
var _a;
|
811
|
+
var _a, _b;
|
801
812
|
const prev = descendants.enabledPrevValue(
|
802
813
|
index,
|
803
814
|
({ node }) => "target" in node.dataset
|
@@ -808,7 +819,7 @@ var useAutocomplete = (props) => {
|
|
808
819
|
} else {
|
809
820
|
if (selectedIndexes.includes(prev.index)) {
|
810
821
|
const enabledPrev = (_a = enabledValues.reverse().find(({ index: index2 }) => index2 < prev.index)) != null ? _a : enabledValues[0];
|
811
|
-
setFocusedIndex(enabledPrev.index);
|
822
|
+
setFocusedIndex((_b = enabledPrev == null ? void 0 : enabledPrev.index) != null ? _b : -1);
|
812
823
|
} else {
|
813
824
|
setFocusedIndex(prev.index);
|
814
825
|
}
|
@@ -832,7 +843,7 @@ var useAutocomplete = (props) => {
|
|
832
843
|
const values = descendants.values();
|
833
844
|
let isHit2 = false;
|
834
845
|
let isFocused2 = false;
|
835
|
-
values.forEach(({
|
846
|
+
values.forEach(({ index, node }) => {
|
836
847
|
var _a;
|
837
848
|
if (format((_a = node.textContent) != null ? _a : "").includes(value2)) {
|
838
849
|
isHit2 = true;
|
@@ -890,7 +901,7 @@ var useAutocomplete = (props) => {
|
|
890
901
|
return selectedValues2[0];
|
891
902
|
} else {
|
892
903
|
selectedValues2.forEach((selectedValue) => {
|
893
|
-
const isSelected = (0, import_utils7.isArray)(prev) && prev.includes(selectedValue
|
904
|
+
const isSelected = (0, import_utils7.isArray)(prev) && prev.includes(selectedValue);
|
894
905
|
if (!isSelected) {
|
895
906
|
prev = [...(0, import_utils7.isArray)(prev) ? prev : [], selectedValue];
|
896
907
|
} else if (runOmit) {
|
@@ -995,7 +1006,7 @@ var useAutocomplete = (props) => {
|
|
995
1006
|
({ label: label2 }) => label2 === firstInsertPositionItem
|
996
1007
|
);
|
997
1008
|
const targetItem = newItems[i];
|
998
|
-
if (i !== -1 && "items" in targetItem) {
|
1009
|
+
if (i !== -1 && targetItem && "items" in targetItem) {
|
999
1010
|
if (secondInsertPositionItem === "first") {
|
1000
1011
|
targetItem.items = [newItem, ...(_a = targetItem.items) != null ? _a : []];
|
1001
1012
|
} else {
|
@@ -1079,15 +1090,15 @@ var useAutocomplete = (props) => {
|
|
1079
1090
|
const actions = {
|
1080
1091
|
ArrowDown: isFocused ? () => onFocusNext() : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusFirstOrSelected) : void 0,
|
1081
1092
|
ArrowUp: isFocused ? () => onFocusPrev() : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusLastOrSelected) : void 0,
|
1082
|
-
|
1093
|
+
Backspace: !isEmptyValue && enabledDelete ? onDelete : void 0,
|
1094
|
+
End: isOpen ? onFocusLast : void 0,
|
1083
1095
|
Enter: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusFirstOrSelected) : allowFree && isMulti ? () => {
|
1084
1096
|
if (inputValue) onChange(inputValue);
|
1085
1097
|
setFocusedIndex(0);
|
1086
1098
|
} : void 0,
|
1087
|
-
Home: isOpen ? onFocusFirst : void 0,
|
1088
|
-
End: isOpen ? onFocusLast : void 0,
|
1089
1099
|
Escape: closeOnEsc ? onClose : void 0,
|
1090
|
-
|
1100
|
+
Home: isOpen ? onFocusFirst : void 0,
|
1101
|
+
Space: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusFirstOrSelected) : void 0
|
1091
1102
|
};
|
1092
1103
|
const action = actions[ev.key];
|
1093
1104
|
if (!action) return;
|
@@ -1142,7 +1153,7 @@ var useAutocomplete = (props) => {
|
|
1142
1153
|
(0, import_react4.useEffect)(() => {
|
1143
1154
|
var _a;
|
1144
1155
|
if (isMulti) {
|
1145
|
-
if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value
|
1156
|
+
if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value))
|
1146
1157
|
return;
|
1147
1158
|
const label2 = getSelectedValues(value);
|
1148
1159
|
setLabel(label2);
|
@@ -1168,34 +1179,34 @@ var useAutocomplete = (props) => {
|
|
1168
1179
|
});
|
1169
1180
|
(0, import_use_outside_click.useOutsideClick)({
|
1170
1181
|
ref: containerRef,
|
1171
|
-
|
1172
|
-
|
1182
|
+
enabled: isOpen && (closeOnBlur || !isHit),
|
1183
|
+
handler: onClose
|
1173
1184
|
});
|
1174
1185
|
const getPopoverProps = (0, import_react4.useCallback)(
|
1175
1186
|
(props2) => ({
|
1176
|
-
|
1177
|
-
|
1187
|
+
animation,
|
1188
|
+
boundary,
|
1178
1189
|
closeDelay,
|
1190
|
+
closeOnBlur,
|
1191
|
+
duration,
|
1192
|
+
eventListeners,
|
1193
|
+
flip,
|
1194
|
+
gutter,
|
1179
1195
|
isLazy,
|
1180
1196
|
lazyBehavior,
|
1181
|
-
|
1182
|
-
|
1197
|
+
matchWidth,
|
1198
|
+
modifiers,
|
1183
1199
|
offset,
|
1184
|
-
|
1200
|
+
openDelay,
|
1201
|
+
placement,
|
1185
1202
|
preventOverflow,
|
1186
|
-
flip,
|
1187
|
-
matchWidth,
|
1188
|
-
boundary,
|
1189
|
-
eventListeners,
|
1190
1203
|
strategy,
|
1191
|
-
placement,
|
1192
|
-
modifiers,
|
1193
1204
|
...props2,
|
1194
|
-
trigger: "never",
|
1195
1205
|
closeOnButton: false,
|
1196
1206
|
isOpen,
|
1197
|
-
|
1198
|
-
onClose
|
1207
|
+
trigger: "never",
|
1208
|
+
onClose,
|
1209
|
+
onOpen
|
1199
1210
|
}),
|
1200
1211
|
[
|
1201
1212
|
closeOnBlur,
|
@@ -1226,8 +1237,8 @@ var useAutocomplete = (props) => {
|
|
1226
1237
|
...containerProps,
|
1227
1238
|
...props2,
|
1228
1239
|
...formControlProps,
|
1229
|
-
|
1230
|
-
|
1240
|
+
onBlur: (0, import_utils7.handlerAll)(props2.onBlur, rest.onBlur, onBlur),
|
1241
|
+
onClick: (0, import_utils7.handlerAll)(props2.onClick, rest.onClick, onClick)
|
1231
1242
|
}),
|
1232
1243
|
[containerProps, formControlProps, onBlur, onClick, rest]
|
1233
1244
|
);
|
@@ -1237,9 +1248,9 @@ var useAutocomplete = (props) => {
|
|
1237
1248
|
tabIndex: -1,
|
1238
1249
|
...props2,
|
1239
1250
|
...formControlProps,
|
1240
|
-
placeholder,
|
1241
|
-
"data-active": (0, import_utils7.dataAttr)(isOpen),
|
1242
1251
|
"aria-expanded": (0, import_utils7.dataAttr)(isOpen),
|
1252
|
+
"data-active": (0, import_utils7.dataAttr)(isOpen),
|
1253
|
+
placeholder,
|
1243
1254
|
onFocus: (0, import_utils7.handlerAll)(props2.onFocus, onFocusProp, onFocus),
|
1244
1255
|
onKeyDown: (0, import_utils7.handlerAll)(props2.onKeyDown, onKeyDownProp, onKeyDown)
|
1245
1256
|
}),
|
@@ -1255,61 +1266,61 @@ var useAutocomplete = (props) => {
|
|
1255
1266
|
);
|
1256
1267
|
return {
|
1257
1268
|
id,
|
1258
|
-
descendants,
|
1259
|
-
value,
|
1260
|
-
label,
|
1261
|
-
inputValue,
|
1262
|
-
isHit,
|
1263
|
-
isEmpty,
|
1264
|
-
computedChildren,
|
1265
|
-
focusedIndex,
|
1266
|
-
omitSelectedValues,
|
1267
|
-
closeOnSelect,
|
1268
1269
|
allowCreate,
|
1269
1270
|
allowFree,
|
1271
|
+
closeOnSelect,
|
1272
|
+
computedChildren,
|
1273
|
+
descendants,
|
1270
1274
|
emptyMessage,
|
1271
|
-
|
1275
|
+
focusedIndex,
|
1276
|
+
inputRef,
|
1277
|
+
inputValue,
|
1272
1278
|
isAllSelected,
|
1279
|
+
isEmpty,
|
1280
|
+
isHit,
|
1281
|
+
isOpen,
|
1282
|
+
label,
|
1273
1283
|
listRef,
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1284
|
+
omitSelectedValues,
|
1285
|
+
pickOptions,
|
1286
|
+
rebirthOptions,
|
1277
1287
|
setFocusedIndex,
|
1278
|
-
|
1288
|
+
value,
|
1289
|
+
formControlProps,
|
1290
|
+
getContainerProps,
|
1291
|
+
getFieldProps,
|
1292
|
+
getPopoverProps,
|
1293
|
+
inputProps,
|
1294
|
+
optionProps,
|
1279
1295
|
onChange,
|
1280
|
-
|
1281
|
-
onCreate,
|
1296
|
+
onChangeLabel,
|
1282
1297
|
onClear,
|
1283
|
-
onCompositionStart,
|
1284
|
-
onCompositionEnd,
|
1285
|
-
pickOptions,
|
1286
|
-
rebirthOptions,
|
1287
|
-
onOpen,
|
1288
1298
|
onClose,
|
1299
|
+
onCompositionEnd,
|
1300
|
+
onCompositionStart,
|
1301
|
+
onCreate,
|
1289
1302
|
onFocusFirst,
|
1290
1303
|
onFocusLast,
|
1291
|
-
onFocusSelected,
|
1292
1304
|
onFocusNext,
|
1293
1305
|
onFocusPrev,
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
inputProps
|
1306
|
+
onFocusSelected,
|
1307
|
+
onOpen,
|
1308
|
+
onSearch
|
1298
1309
|
};
|
1299
1310
|
};
|
1300
1311
|
var useAutocompleteInput = () => {
|
1301
1312
|
const {
|
1302
1313
|
id,
|
1314
|
+
focusedIndex,
|
1303
1315
|
inputRef,
|
1304
|
-
onSearch,
|
1305
|
-
onCompositionStart,
|
1306
|
-
onCompositionEnd,
|
1307
1316
|
isAllSelected,
|
1317
|
+
isOpen,
|
1318
|
+
listRef,
|
1308
1319
|
formControlProps,
|
1309
1320
|
inputProps,
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1321
|
+
onCompositionEnd,
|
1322
|
+
onCompositionStart,
|
1323
|
+
onSearch
|
1313
1324
|
} = useAutocompleteContext();
|
1314
1325
|
const { value } = useAutocompleteDescendantsContext();
|
1315
1326
|
(0, import_utils7.useUpdateEffect)(() => {
|
@@ -1321,14 +1332,14 @@ var useAutocompleteInput = () => {
|
|
1321
1332
|
return {
|
1322
1333
|
ref: (0, import_utils7.mergeRefs)(inputRef, ref),
|
1323
1334
|
...formControlProps,
|
1324
|
-
role: "combobox",
|
1325
|
-
"aria-haspopup": "listbox",
|
1326
|
-
"aria-autocomplete": "list",
|
1327
|
-
"aria-expanded": isOpen,
|
1328
1335
|
"aria-activedescendant": (_a = value(focusedIndex)) == null ? void 0 : _a.node.id,
|
1336
|
+
"aria-autocomplete": "list",
|
1329
1337
|
"aria-controls": (_b = listRef.current) == null ? void 0 : _b.id,
|
1338
|
+
"aria-expanded": isOpen,
|
1339
|
+
"aria-haspopup": "listbox",
|
1330
1340
|
autoCapitalize: "none",
|
1331
1341
|
autoComplete: "off",
|
1342
|
+
role: "combobox",
|
1332
1343
|
spellCheck: "false",
|
1333
1344
|
...inputProps,
|
1334
1345
|
...props,
|
@@ -1337,15 +1348,15 @@ var useAutocompleteInput = () => {
|
|
1337
1348
|
pointerEvents: formControlProps.disabled || isAllSelected ? "none" : "auto",
|
1338
1349
|
tabIndex: isAllSelected ? -1 : 0,
|
1339
1350
|
onChange: (0, import_utils7.handlerAll)(props.onChange, onSearch),
|
1340
|
-
onCompositionStart: (0, import_utils7.handlerAll)(
|
1341
|
-
props.onCompositionStart,
|
1342
|
-
inputProps.onCompositionStart,
|
1343
|
-
onCompositionStart
|
1344
|
-
),
|
1345
1351
|
onCompositionEnd: (0, import_utils7.handlerAll)(
|
1346
1352
|
props.onCompositionEnd,
|
1347
1353
|
inputProps.onCompositionEnd,
|
1348
1354
|
onCompositionEnd
|
1355
|
+
),
|
1356
|
+
onCompositionStart: (0, import_utils7.handlerAll)(
|
1357
|
+
props.onCompositionStart,
|
1358
|
+
inputProps.onCompositionStart,
|
1359
|
+
onCompositionStart
|
1349
1360
|
)
|
1350
1361
|
};
|
1351
1362
|
},
|