@yamada-ui/autocomplete 1.5.4-dev-20241005224505 → 1.5.4-dev-20241006032009
Sign up to get free protection for your applications and to get access to all the features.
- 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 +14 -14
- 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 +47 -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 +299 -297
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.mjs +12 -12
- package/dist/{chunk-5GKGL6BL.mjs → chunk-2MVSDK7L.mjs} +16 -16
- package/dist/chunk-2MVSDK7L.mjs.map +1 -0
- package/dist/{chunk-JMX72TSD.mjs → chunk-2SISETLV.mjs} +11 -11
- package/dist/{chunk-JMX72TSD.mjs.map → chunk-2SISETLV.mjs.map} +1 -1
- package/dist/{chunk-OLOU5HFC.mjs → chunk-4APEPTYJ.mjs} +169 -167
- package/dist/chunk-4APEPTYJ.mjs.map +1 -0
- package/dist/{chunk-6F3LT7J6.mjs → chunk-EWV3Q3S4.mjs} +7 -7
- package/dist/{chunk-6F3LT7J6.mjs.map → chunk-EWV3Q3S4.mjs.map} +1 -1
- package/dist/{chunk-Q2HZVVOI.mjs → chunk-I4IW2CW7.mjs} +16 -16
- package/dist/chunk-I4IW2CW7.mjs.map +1 -0
- package/dist/{chunk-7SWSKLSA.mjs → chunk-I5X4WSCX.mjs} +18 -18
- package/dist/chunk-I5X4WSCX.mjs.map +1 -0
- package/dist/{chunk-HZECQUHV.mjs → chunk-PXQD7AV2.mjs} +40 -40
- package/dist/{chunk-HZECQUHV.mjs.map → chunk-PXQD7AV2.mjs.map} +1 -1
- package/dist/{chunk-QPIWG4ZF.mjs → chunk-TJGVRIGK.mjs} +62 -60
- package/dist/chunk-TJGVRIGK.mjs.map +1 -0
- 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-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-S2HFYJVI.mjs → chunk-ZEGANG5C.mjs} +13 -13
- package/dist/chunk-ZEGANG5C.mjs.map +1 -0
- package/dist/{chunk-5LPWFWE6.mjs → chunk-ZJFWWXQM.mjs} +34 -34
- package/dist/chunk-ZJFWWXQM.mjs.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +351 -347
- 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 +321 -317
- 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 +11 -11
- 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 +34 -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 +221 -219
- 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
|
+
focusable: false,
|
85
|
+
"aria-hidden": true
|
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,36 +153,36 @@ 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();
|
@@ -232,27 +232,27 @@ var useAutocompleteOption = (props) => {
|
|
232
232
|
border: "0px",
|
233
233
|
clip: "rect(0px, 0px, 0px, 0px)",
|
234
234
|
height: "1px",
|
235
|
-
width: "1px",
|
236
235
|
margin: "-1px",
|
237
|
-
padding: "0px",
|
238
236
|
overflow: "hidden",
|
237
|
+
padding: "0px",
|
238
|
+
position: "absolute",
|
239
239
|
whiteSpace: "nowrap",
|
240
|
-
|
240
|
+
width: "1px"
|
241
241
|
};
|
242
242
|
return {
|
243
|
-
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
244
243
|
id,
|
244
|
+
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
245
245
|
role: "option",
|
246
246
|
...computedProps,
|
247
247
|
...props2,
|
248
|
-
tabIndex: -1,
|
249
248
|
style: !isTarget || omitSelectedValues && isSelected ? style : void 0,
|
250
|
-
|
251
|
-
"data-value": optionValue != null ? optionValue : "",
|
252
|
-
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
253
|
-
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
249
|
+
tabIndex: -1,
|
254
250
|
"aria-checked": isSelected,
|
255
251
|
"aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
|
252
|
+
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
253
|
+
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
254
|
+
"data-target": (0, import_utils3.dataAttr)(true),
|
255
|
+
"data-value": optionValue != null ? optionValue : "",
|
256
256
|
onClick: (0, import_utils3.handlerAll)(computedProps.onClick, props2.onClick, onClick)
|
257
257
|
};
|
258
258
|
},
|
@@ -270,10 +270,10 @@ var useAutocompleteOption = (props) => {
|
|
270
270
|
]
|
271
271
|
);
|
272
272
|
return {
|
273
|
-
isSelected,
|
274
|
-
isFocused,
|
275
|
-
customIcon,
|
276
273
|
children,
|
274
|
+
customIcon,
|
275
|
+
isFocused,
|
276
|
+
isSelected,
|
277
277
|
getOptionProps
|
278
278
|
};
|
279
279
|
};
|
@@ -283,19 +283,19 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
283
283
|
var AutocompleteOption = (0, import_core2.forwardRef)(
|
284
284
|
({ className, icon, ...rest }, ref) => {
|
285
285
|
const { styles } = useAutocompleteContext();
|
286
|
-
const {
|
286
|
+
const { children, customIcon, isSelected, getOptionProps } = useAutocompleteOption(rest);
|
287
287
|
icon != null ? icon : icon = customIcon;
|
288
288
|
const css = {
|
289
|
-
|
289
|
+
alignItems: "center",
|
290
290
|
color: "inherit",
|
291
|
-
userSelect: "none",
|
292
291
|
display: "flex",
|
293
|
-
width: "100%",
|
294
|
-
alignItems: "center",
|
295
|
-
textAlign: "start",
|
296
292
|
flex: "0 0 auto",
|
297
|
-
outline: 0,
|
298
293
|
gap: "0.75rem",
|
294
|
+
outline: 0,
|
295
|
+
textAlign: "start",
|
296
|
+
textDecoration: "none",
|
297
|
+
userSelect: "none",
|
298
|
+
width: "100%",
|
299
299
|
...styles.item
|
300
300
|
};
|
301
301
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
@@ -314,7 +314,7 @@ var AutocompleteOption = (0, import_core2.forwardRef)(
|
|
314
314
|
);
|
315
315
|
AutocompleteOption.displayName = "AutocompleteOption";
|
316
316
|
AutocompleteOption.__ui__ = "AutocompleteOption";
|
317
|
-
var AutocompleteCheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 14 14", width: "1em",
|
317
|
+
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
318
|
"polygon",
|
319
319
|
{
|
320
320
|
fill: "currentColor",
|
@@ -336,7 +336,7 @@ var useAutocompleteOptionGroup = ({
|
|
336
336
|
label,
|
337
337
|
...rest
|
338
338
|
}) => {
|
339
|
-
const {
|
339
|
+
const { omitSelectedValues, value } = useAutocompleteContext();
|
340
340
|
const isMulti = (0, import_utils5.isArray)(value);
|
341
341
|
const descendants = useAutocompleteDescendantsContext();
|
342
342
|
const values = descendants.values();
|
@@ -348,7 +348,7 @@ var useAutocompleteOptionGroup = ({
|
|
348
348
|
) : [];
|
349
349
|
const selectedIndexes = selectedValues.map(({ index }) => index);
|
350
350
|
const childValues = values.filter(
|
351
|
-
({
|
351
|
+
({ index, node }) => {
|
352
352
|
var _a;
|
353
353
|
return ((_a = node.parentElement) == null ? void 0 : _a.dataset.label) === label && !selectedIndexes.includes(index) && "target" in node.dataset;
|
354
354
|
}
|
@@ -361,20 +361,20 @@ var useAutocompleteOptionGroup = ({
|
|
361
361
|
border: "0px",
|
362
362
|
clip: "rect(0px, 0px, 0px, 0px)",
|
363
363
|
height: "1px",
|
364
|
-
width: "1px",
|
365
364
|
margin: "-1px",
|
366
|
-
padding: "0px",
|
367
365
|
overflow: "hidden",
|
366
|
+
padding: "0px",
|
367
|
+
position: "absolute",
|
368
368
|
whiteSpace: "nowrap",
|
369
|
-
|
369
|
+
width: "1px"
|
370
370
|
};
|
371
371
|
return {
|
372
372
|
ref,
|
373
373
|
...props,
|
374
374
|
...containerProps,
|
375
375
|
style: isEmpty ? style : void 0,
|
376
|
-
"
|
377
|
-
|
376
|
+
role: "autocomplete-group-container",
|
377
|
+
"data-label": label
|
378
378
|
};
|
379
379
|
},
|
380
380
|
[containerProps, isEmpty, label]
|
@@ -384,8 +384,8 @@ var useAutocompleteOptionGroup = ({
|
|
384
384
|
ref,
|
385
385
|
...props,
|
386
386
|
...groupProps,
|
387
|
-
"
|
388
|
-
|
387
|
+
role: "autocomplete-group",
|
388
|
+
"data-label": label
|
389
389
|
}),
|
390
390
|
[groupProps, label]
|
391
391
|
);
|
@@ -401,12 +401,12 @@ var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
401
401
|
var AutocompleteOptionGroup = (0, import_core4.forwardRef)(
|
402
402
|
({
|
403
403
|
className,
|
404
|
+
children,
|
404
405
|
color,
|
405
406
|
h,
|
406
407
|
height,
|
407
408
|
minH,
|
408
409
|
minHeight,
|
409
|
-
children,
|
410
410
|
labelProps,
|
411
411
|
...rest
|
412
412
|
}, ref) => {
|
@@ -422,15 +422,15 @@ var AutocompleteOptionGroup = (0, import_core4.forwardRef)(
|
|
422
422
|
"ui-autocomplete__item--group",
|
423
423
|
className
|
424
424
|
),
|
425
|
-
__css: {
|
425
|
+
__css: { color, h: "fit-content", w: "100%" },
|
426
426
|
...getContainerProps(),
|
427
427
|
children: [
|
428
428
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
429
429
|
import_core4.ui.span,
|
430
430
|
{
|
431
431
|
className: "ui-autocomplete__item__group-label",
|
432
|
-
__css: styles.groupLabel,
|
433
432
|
lineClamp: 1,
|
433
|
+
__css: styles.groupLabel,
|
434
434
|
...labelProps,
|
435
435
|
children: label
|
436
436
|
}
|
@@ -455,64 +455,79 @@ AutocompleteOptionGroup.__ui__ = "AutocompleteOptionGroup";
|
|
455
455
|
// src/use-autocomplete.tsx
|
456
456
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
457
457
|
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",
|
458
|
+
"\uFF61": "\u3002",
|
459
|
+
"\uFF62": "\u300C",
|
460
|
+
"\uFF63": "\u300D",
|
461
|
+
"\uFF64": "\u3001",
|
462
|
+
"\uFF65": "\u30FB",
|
463
|
+
\uFF66: "\u30F2",
|
485
464
|
\uFF66\uFF9E: "\u30FA",
|
465
|
+
\uFF67: "\u30A1",
|
466
|
+
\uFF68: "\u30A3",
|
467
|
+
\uFF69: "\u30A5",
|
468
|
+
\uFF6A: "\u30A7",
|
469
|
+
\uFF6B: "\u30A9",
|
470
|
+
\uFF6C: "\u30E3",
|
471
|
+
\uFF6D: "\u30E5",
|
472
|
+
\uFF6E: "\u30E7",
|
473
|
+
\uFF6F: "\u30C3",
|
474
|
+
\uFF70: "\u30FC",
|
486
475
|
\uFF71: "\u30A2",
|
487
476
|
\uFF72: "\u30A4",
|
488
477
|
\uFF73: "\u30A6",
|
478
|
+
\uFF73\uFF9E: "\u30F4",
|
489
479
|
\uFF74: "\u30A8",
|
490
480
|
\uFF75: "\u30AA",
|
491
481
|
\uFF76: "\u30AB",
|
482
|
+
\uFF76\uFF9E: "\u30AC",
|
492
483
|
\uFF77: "\u30AD",
|
484
|
+
\uFF77\uFF9E: "\u30AE",
|
493
485
|
\uFF78: "\u30AF",
|
486
|
+
\uFF78\uFF9E: "\u30B0",
|
494
487
|
\uFF79: "\u30B1",
|
488
|
+
\uFF79\uFF9E: "\u30B2",
|
495
489
|
\uFF7A: "\u30B3",
|
490
|
+
\uFF7A\uFF9E: "\u30B4",
|
496
491
|
\uFF7B: "\u30B5",
|
492
|
+
\uFF7B\uFF9E: "\u30B6",
|
497
493
|
\uFF7C: "\u30B7",
|
494
|
+
\uFF7C\uFF9E: "\u30B8",
|
498
495
|
\uFF7D: "\u30B9",
|
496
|
+
\uFF7D\uFF9E: "\u30BA",
|
499
497
|
\uFF7E: "\u30BB",
|
498
|
+
\uFF7E\uFF9E: "\u30BC",
|
500
499
|
\uFF7F: "\u30BD",
|
500
|
+
\uFF7F\uFF9E: "\u30BE",
|
501
501
|
\uFF80: "\u30BF",
|
502
|
+
\uFF80\uFF9E: "\u30C0",
|
502
503
|
\uFF81: "\u30C1",
|
504
|
+
\uFF81\uFF9E: "\u30C2",
|
503
505
|
\uFF82: "\u30C4",
|
506
|
+
\uFF82\uFF9E: "\u30C5",
|
504
507
|
\uFF83: "\u30C6",
|
508
|
+
\uFF83\uFF9E: "\u30C7",
|
505
509
|
\uFF84: "\u30C8",
|
510
|
+
\uFF84\uFF9E: "\u30C9",
|
506
511
|
\uFF85: "\u30CA",
|
507
512
|
\uFF86: "\u30CB",
|
508
513
|
\uFF87: "\u30CC",
|
509
514
|
\uFF88: "\u30CD",
|
510
515
|
\uFF89: "\u30CE",
|
511
516
|
\uFF8A: "\u30CF",
|
517
|
+
\uFF8A\uFF9E: "\u30D0",
|
518
|
+
\uFF8A\uFF9F: "\u30D1",
|
512
519
|
\uFF8B: "\u30D2",
|
520
|
+
\uFF8B\uFF9E: "\u30D3",
|
521
|
+
\uFF8B\uFF9F: "\u30D4",
|
513
522
|
\uFF8C: "\u30D5",
|
523
|
+
\uFF8C\uFF9E: "\u30D6",
|
524
|
+
\uFF8C\uFF9F: "\u30D7",
|
514
525
|
\uFF8D: "\u30D8",
|
526
|
+
\uFF8D\uFF9E: "\u30D9",
|
527
|
+
\uFF8D\uFF9F: "\u30DA",
|
515
528
|
\uFF8E: "\u30DB",
|
529
|
+
\uFF8E\uFF9E: "\u30DC",
|
530
|
+
\uFF8E\uFF9F: "\u30DD",
|
516
531
|
\uFF8F: "\u30DE",
|
517
532
|
\uFF90: "\u30DF",
|
518
533
|
\uFF91: "\u30E0",
|
@@ -527,23 +542,8 @@ var kanaMap = {
|
|
527
542
|
\uFF9A: "\u30EC",
|
528
543
|
\uFF9B: "\u30ED",
|
529
544
|
\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"
|
545
|
+
\uFF9C\uFF9E: "\u30F7",
|
546
|
+
\uFF9D: "\u30F3"
|
547
547
|
};
|
548
548
|
var defaultFormat = (value) => {
|
549
549
|
value = value.replace(
|
@@ -571,46 +571,46 @@ var flattenItems = (items) => {
|
|
571
571
|
};
|
572
572
|
var useAutocomplete = (props) => {
|
573
573
|
const {
|
574
|
-
value: valueProp,
|
575
|
-
defaultValue,
|
576
|
-
onChange: onChangeProp,
|
577
|
-
onCreate: onCreateProp,
|
578
|
-
onSearch: onSearchProp,
|
579
|
-
closeOnSelect = true,
|
580
|
-
omitSelectedValues = false,
|
581
|
-
maxSelectValues,
|
582
574
|
allowCreate = false,
|
583
575
|
allowFree = false,
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
placeholder,
|
589
|
-
onKeyDown: onKeyDownProp,
|
590
|
-
isOpen: isOpenProp,
|
591
|
-
defaultIsOpen,
|
592
|
-
onOpen: onOpenProp,
|
593
|
-
onClose: onCloseProp,
|
576
|
+
animation,
|
577
|
+
boundary,
|
578
|
+
children,
|
579
|
+
closeDelay,
|
594
580
|
closeOnBlur = true,
|
595
581
|
closeOnEsc = true,
|
596
|
-
|
597
|
-
|
582
|
+
closeOnSelect = true,
|
583
|
+
defaultIsOpen,
|
584
|
+
defaultValue,
|
585
|
+
duration = 0.2,
|
586
|
+
emptyMessage = "No results found",
|
587
|
+
eventListeners,
|
588
|
+
flip,
|
589
|
+
format = defaultFormat,
|
590
|
+
gutter,
|
591
|
+
insertPositionItem = "first",
|
598
592
|
isLazy,
|
593
|
+
isOpen: isOpenProp,
|
594
|
+
items,
|
599
595
|
lazyBehavior,
|
600
|
-
|
601
|
-
|
596
|
+
matchWidth = true,
|
597
|
+
maxSelectValues,
|
598
|
+
modifiers,
|
602
599
|
offset,
|
603
|
-
|
600
|
+
omitSelectedValues = false,
|
601
|
+
openDelay,
|
602
|
+
placeholder,
|
603
|
+
placement = "bottom-start",
|
604
604
|
preventOverflow,
|
605
|
-
flip,
|
606
|
-
matchWidth = true,
|
607
|
-
boundary,
|
608
|
-
eventListeners,
|
609
605
|
strategy,
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
606
|
+
value: valueProp,
|
607
|
+
optionProps,
|
608
|
+
onChange: onChangeProp,
|
609
|
+
onClose: onCloseProp,
|
610
|
+
onCreate: onCreateProp,
|
611
|
+
onKeyDown: onKeyDownProp,
|
612
|
+
onOpen: onOpenProp,
|
613
|
+
onSearch: onSearchProp,
|
614
614
|
...rest
|
615
615
|
} = (0, import_form_control.useFormControlProps)(props);
|
616
616
|
const {
|
@@ -629,8 +629,8 @@ var useAutocomplete = (props) => {
|
|
629
629
|
const prevValue = (0, import_react4.useRef)(void 0);
|
630
630
|
const [resolvedItems, setResolvedItems] = (0, import_react4.useState)(items ? JSON.parse(JSON.stringify(items)) : void 0);
|
631
631
|
const [value, setValue] = (0, import_use_controllable_state.useControllableState)({
|
632
|
-
value: valueProp,
|
633
632
|
defaultValue,
|
633
|
+
value: valueProp,
|
634
634
|
onChange: onChangeProp
|
635
635
|
});
|
636
636
|
const [label, setLabel] = (0, import_react4.useState)(void 0);
|
@@ -640,13 +640,13 @@ var useAutocomplete = (props) => {
|
|
640
640
|
const [isHit, setIsHit] = (0, import_react4.useState)(true);
|
641
641
|
const {
|
642
642
|
isOpen,
|
643
|
-
|
644
|
-
|
643
|
+
onClose,
|
644
|
+
onOpen: onInternalOpen
|
645
645
|
} = (0, import_use_disclosure.useDisclosure)({
|
646
|
-
isOpen: isOpenProp,
|
647
646
|
defaultIsOpen,
|
648
|
-
|
649
|
-
onClose: onCloseProp
|
647
|
+
isOpen: isOpenProp,
|
648
|
+
onClose: onCloseProp,
|
649
|
+
onOpen: onOpenProp
|
650
650
|
});
|
651
651
|
const isFocused = focusedIndex > -1;
|
652
652
|
const isCreate = focusedIndex === -2 && allowCreate;
|
@@ -672,7 +672,7 @@ var useAutocomplete = (props) => {
|
|
672
672
|
);
|
673
673
|
const selectedIndexes = selectedValues.map(({ index }) => index);
|
674
674
|
const enabledValues = descendants.enabledValues(
|
675
|
-
({
|
675
|
+
({ index, node }) => "target" in node.dataset && !selectedIndexes.includes(index)
|
676
676
|
);
|
677
677
|
const validChildren = (0, import_utils7.getValidChildren)(children);
|
678
678
|
const computedChildren = (0, import_react4.useMemo)(
|
@@ -681,7 +681,7 @@ var useAutocomplete = (props) => {
|
|
681
681
|
const { label: label2, value: value2, ...props2 } = item;
|
682
682
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AutocompleteOption, { value: value2, ...props2, children: label2 }, i);
|
683
683
|
} else if ("items" in item) {
|
684
|
-
const {
|
684
|
+
const { items: items2 = [], label: label2, ...props2 } = item;
|
685
685
|
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
686
|
}
|
687
687
|
}),
|
@@ -696,6 +696,7 @@ var useAutocomplete = (props) => {
|
|
696
696
|
}, [allowCreate, formControlProps, isAllSelected, isEmpty, onInternalOpen]);
|
697
697
|
const onFocusFirst = (0, import_react4.useCallback)(() => {
|
698
698
|
const id2 = setTimeout(() => {
|
699
|
+
var _a;
|
699
700
|
if (isEmpty || isAllSelected) return;
|
700
701
|
const first = descendants.enabledFirstValue(
|
701
702
|
({ node }) => "target" in node.dataset
|
@@ -706,7 +707,7 @@ var useAutocomplete = (props) => {
|
|
706
707
|
} else {
|
707
708
|
if (selectedIndexes.includes(first.index)) {
|
708
709
|
const enabledFirst = enabledValues[0];
|
709
|
-
setFocusedIndex(enabledFirst.index);
|
710
|
+
setFocusedIndex((_a = enabledFirst == null ? void 0 : enabledFirst.index) != null ? _a : -1);
|
710
711
|
} else {
|
711
712
|
setFocusedIndex(first.index);
|
712
713
|
}
|
@@ -724,6 +725,7 @@ var useAutocomplete = (props) => {
|
|
724
725
|
]);
|
725
726
|
const onFocusLast = (0, import_react4.useCallback)(() => {
|
726
727
|
const id2 = setTimeout(() => {
|
728
|
+
var _a;
|
727
729
|
if (isEmpty || isAllSelected) return;
|
728
730
|
const last = descendants.enabledLastValue(
|
729
731
|
({ node }) => "target" in node.dataset
|
@@ -734,7 +736,7 @@ var useAutocomplete = (props) => {
|
|
734
736
|
} else {
|
735
737
|
if (selectedIndexes.includes(last.index)) {
|
736
738
|
const enabledLast = enabledValues.reverse()[0];
|
737
|
-
setFocusedIndex(enabledLast.index);
|
739
|
+
setFocusedIndex((_a = enabledLast == null ? void 0 : enabledLast.index) != null ? _a : -1);
|
738
740
|
} else {
|
739
741
|
setFocusedIndex(last.index);
|
740
742
|
}
|
@@ -766,7 +768,7 @@ var useAutocomplete = (props) => {
|
|
766
768
|
const onFocusNext = (0, import_react4.useCallback)(
|
767
769
|
(index = focusedIndex) => {
|
768
770
|
const id2 = setTimeout(() => {
|
769
|
-
var _a;
|
771
|
+
var _a, _b;
|
770
772
|
const next = descendants.enabledNextValue(
|
771
773
|
index,
|
772
774
|
({ node }) => "target" in node.dataset
|
@@ -777,7 +779,7 @@ var useAutocomplete = (props) => {
|
|
777
779
|
} else {
|
778
780
|
if (selectedIndexes.includes(next.index)) {
|
779
781
|
const enabledNext = (_a = enabledValues.find(({ index: index2 }) => next.index < index2)) != null ? _a : enabledValues[0];
|
780
|
-
setFocusedIndex(enabledNext.index);
|
782
|
+
setFocusedIndex((_b = enabledNext == null ? void 0 : enabledNext.index) != null ? _b : -1);
|
781
783
|
} else {
|
782
784
|
setFocusedIndex(next.index);
|
783
785
|
}
|
@@ -797,7 +799,7 @@ var useAutocomplete = (props) => {
|
|
797
799
|
const onFocusPrev = (0, import_react4.useCallback)(
|
798
800
|
(index = focusedIndex) => {
|
799
801
|
const id2 = setTimeout(() => {
|
800
|
-
var _a;
|
802
|
+
var _a, _b;
|
801
803
|
const prev = descendants.enabledPrevValue(
|
802
804
|
index,
|
803
805
|
({ node }) => "target" in node.dataset
|
@@ -808,7 +810,7 @@ var useAutocomplete = (props) => {
|
|
808
810
|
} else {
|
809
811
|
if (selectedIndexes.includes(prev.index)) {
|
810
812
|
const enabledPrev = (_a = enabledValues.reverse().find(({ index: index2 }) => index2 < prev.index)) != null ? _a : enabledValues[0];
|
811
|
-
setFocusedIndex(enabledPrev.index);
|
813
|
+
setFocusedIndex((_b = enabledPrev == null ? void 0 : enabledPrev.index) != null ? _b : -1);
|
812
814
|
} else {
|
813
815
|
setFocusedIndex(prev.index);
|
814
816
|
}
|
@@ -832,7 +834,7 @@ var useAutocomplete = (props) => {
|
|
832
834
|
const values = descendants.values();
|
833
835
|
let isHit2 = false;
|
834
836
|
let isFocused2 = false;
|
835
|
-
values.forEach(({
|
837
|
+
values.forEach(({ index, node }) => {
|
836
838
|
var _a;
|
837
839
|
if (format((_a = node.textContent) != null ? _a : "").includes(value2)) {
|
838
840
|
isHit2 = true;
|
@@ -890,7 +892,7 @@ var useAutocomplete = (props) => {
|
|
890
892
|
return selectedValues2[0];
|
891
893
|
} else {
|
892
894
|
selectedValues2.forEach((selectedValue) => {
|
893
|
-
const isSelected = (0, import_utils7.isArray)(prev) && prev.includes(selectedValue
|
895
|
+
const isSelected = (0, import_utils7.isArray)(prev) && prev.includes(selectedValue);
|
894
896
|
if (!isSelected) {
|
895
897
|
prev = [...(0, import_utils7.isArray)(prev) ? prev : [], selectedValue];
|
896
898
|
} else if (runOmit) {
|
@@ -995,7 +997,7 @@ var useAutocomplete = (props) => {
|
|
995
997
|
({ label: label2 }) => label2 === firstInsertPositionItem
|
996
998
|
);
|
997
999
|
const targetItem = newItems[i];
|
998
|
-
if (i !== -1 && "items" in targetItem) {
|
1000
|
+
if (i !== -1 && targetItem && "items" in targetItem) {
|
999
1001
|
if (secondInsertPositionItem === "first") {
|
1000
1002
|
targetItem.items = [newItem, ...(_a = targetItem.items) != null ? _a : []];
|
1001
1003
|
} else {
|
@@ -1079,15 +1081,15 @@ var useAutocomplete = (props) => {
|
|
1079
1081
|
const actions = {
|
1080
1082
|
ArrowDown: isFocused ? () => onFocusNext() : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusFirstOrSelected) : void 0,
|
1081
1083
|
ArrowUp: isFocused ? () => onFocusPrev() : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusLastOrSelected) : void 0,
|
1082
|
-
|
1084
|
+
Backspace: !isEmptyValue && enabledDelete ? onDelete : void 0,
|
1085
|
+
End: isOpen ? onFocusLast : void 0,
|
1083
1086
|
Enter: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusFirstOrSelected) : allowFree && isMulti ? () => {
|
1084
1087
|
if (inputValue) onChange(inputValue);
|
1085
1088
|
setFocusedIndex(0);
|
1086
1089
|
} : void 0,
|
1087
|
-
Home: isOpen ? onFocusFirst : void 0,
|
1088
|
-
End: isOpen ? onFocusLast : void 0,
|
1089
1090
|
Escape: closeOnEsc ? onClose : void 0,
|
1090
|
-
|
1091
|
+
Home: isOpen ? onFocusFirst : void 0,
|
1092
|
+
Space: isCreate ? onCreate : isFocused ? onSelect : !isOpen ? (0, import_utils7.funcAll)(onOpen, onFocusFirstOrSelected) : void 0
|
1091
1093
|
};
|
1092
1094
|
const action = actions[ev.key];
|
1093
1095
|
if (!action) return;
|
@@ -1142,7 +1144,7 @@ var useAutocomplete = (props) => {
|
|
1142
1144
|
(0, import_react4.useEffect)(() => {
|
1143
1145
|
var _a;
|
1144
1146
|
if (isMulti) {
|
1145
|
-
if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value
|
1147
|
+
if (JSON.stringify((_a = prevValue.current) != null ? _a : []) === JSON.stringify(value))
|
1146
1148
|
return;
|
1147
1149
|
const label2 = getSelectedValues(value);
|
1148
1150
|
setLabel(label2);
|
@@ -1168,34 +1170,34 @@ var useAutocomplete = (props) => {
|
|
1168
1170
|
});
|
1169
1171
|
(0, import_use_outside_click.useOutsideClick)({
|
1170
1172
|
ref: containerRef,
|
1171
|
-
|
1172
|
-
|
1173
|
+
enabled: isOpen && (closeOnBlur || !isHit),
|
1174
|
+
handler: onClose
|
1173
1175
|
});
|
1174
1176
|
const getPopoverProps = (0, import_react4.useCallback)(
|
1175
1177
|
(props2) => ({
|
1176
|
-
|
1177
|
-
|
1178
|
+
animation,
|
1179
|
+
boundary,
|
1178
1180
|
closeDelay,
|
1181
|
+
closeOnBlur,
|
1182
|
+
duration,
|
1183
|
+
eventListeners,
|
1184
|
+
flip,
|
1185
|
+
gutter,
|
1179
1186
|
isLazy,
|
1180
1187
|
lazyBehavior,
|
1181
|
-
|
1182
|
-
|
1188
|
+
matchWidth,
|
1189
|
+
modifiers,
|
1183
1190
|
offset,
|
1184
|
-
|
1191
|
+
openDelay,
|
1192
|
+
placement,
|
1185
1193
|
preventOverflow,
|
1186
|
-
flip,
|
1187
|
-
matchWidth,
|
1188
|
-
boundary,
|
1189
|
-
eventListeners,
|
1190
1194
|
strategy,
|
1191
|
-
placement,
|
1192
|
-
modifiers,
|
1193
1195
|
...props2,
|
1194
|
-
trigger: "never",
|
1195
1196
|
closeOnButton: false,
|
1196
1197
|
isOpen,
|
1197
|
-
|
1198
|
-
onClose
|
1198
|
+
trigger: "never",
|
1199
|
+
onClose,
|
1200
|
+
onOpen
|
1199
1201
|
}),
|
1200
1202
|
[
|
1201
1203
|
closeOnBlur,
|
@@ -1226,8 +1228,8 @@ var useAutocomplete = (props) => {
|
|
1226
1228
|
...containerProps,
|
1227
1229
|
...props2,
|
1228
1230
|
...formControlProps,
|
1229
|
-
|
1230
|
-
|
1231
|
+
onBlur: (0, import_utils7.handlerAll)(props2.onBlur, rest.onBlur, onBlur),
|
1232
|
+
onClick: (0, import_utils7.handlerAll)(props2.onClick, rest.onClick, onClick)
|
1231
1233
|
}),
|
1232
1234
|
[containerProps, formControlProps, onBlur, onClick, rest]
|
1233
1235
|
);
|
@@ -1238,8 +1240,8 @@ var useAutocomplete = (props) => {
|
|
1238
1240
|
...props2,
|
1239
1241
|
...formControlProps,
|
1240
1242
|
placeholder,
|
1241
|
-
"data-active": (0, import_utils7.dataAttr)(isOpen),
|
1242
1243
|
"aria-expanded": (0, import_utils7.dataAttr)(isOpen),
|
1244
|
+
"data-active": (0, import_utils7.dataAttr)(isOpen),
|
1243
1245
|
onFocus: (0, import_utils7.handlerAll)(props2.onFocus, onFocusProp, onFocus),
|
1244
1246
|
onKeyDown: (0, import_utils7.handlerAll)(props2.onKeyDown, onKeyDownProp, onKeyDown)
|
1245
1247
|
}),
|
@@ -1255,61 +1257,61 @@ var useAutocomplete = (props) => {
|
|
1255
1257
|
);
|
1256
1258
|
return {
|
1257
1259
|
id,
|
1258
|
-
descendants,
|
1259
|
-
value,
|
1260
|
-
label,
|
1261
|
-
inputValue,
|
1262
|
-
isHit,
|
1263
|
-
isEmpty,
|
1264
|
-
computedChildren,
|
1265
|
-
focusedIndex,
|
1266
|
-
omitSelectedValues,
|
1267
|
-
closeOnSelect,
|
1268
1260
|
allowCreate,
|
1269
1261
|
allowFree,
|
1262
|
+
closeOnSelect,
|
1263
|
+
computedChildren,
|
1264
|
+
descendants,
|
1270
1265
|
emptyMessage,
|
1271
|
-
|
1266
|
+
focusedIndex,
|
1267
|
+
inputRef,
|
1268
|
+
inputValue,
|
1272
1269
|
isAllSelected,
|
1270
|
+
isEmpty,
|
1271
|
+
isHit,
|
1272
|
+
isOpen,
|
1273
|
+
label,
|
1273
1274
|
listRef,
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1275
|
+
omitSelectedValues,
|
1276
|
+
pickOptions,
|
1277
|
+
rebirthOptions,
|
1277
1278
|
setFocusedIndex,
|
1278
|
-
|
1279
|
+
value,
|
1280
|
+
formControlProps,
|
1281
|
+
getContainerProps,
|
1282
|
+
getFieldProps,
|
1283
|
+
getPopoverProps,
|
1284
|
+
inputProps,
|
1285
|
+
optionProps,
|
1279
1286
|
onChange,
|
1280
|
-
|
1281
|
-
onCreate,
|
1287
|
+
onChangeLabel,
|
1282
1288
|
onClear,
|
1283
|
-
onCompositionStart,
|
1284
|
-
onCompositionEnd,
|
1285
|
-
pickOptions,
|
1286
|
-
rebirthOptions,
|
1287
|
-
onOpen,
|
1288
1289
|
onClose,
|
1290
|
+
onCompositionEnd,
|
1291
|
+
onCompositionStart,
|
1292
|
+
onCreate,
|
1289
1293
|
onFocusFirst,
|
1290
1294
|
onFocusLast,
|
1291
|
-
onFocusSelected,
|
1292
1295
|
onFocusNext,
|
1293
1296
|
onFocusPrev,
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
inputProps
|
1297
|
+
onFocusSelected,
|
1298
|
+
onOpen,
|
1299
|
+
onSearch
|
1298
1300
|
};
|
1299
1301
|
};
|
1300
1302
|
var useAutocompleteInput = () => {
|
1301
1303
|
const {
|
1302
1304
|
id,
|
1305
|
+
focusedIndex,
|
1303
1306
|
inputRef,
|
1304
|
-
onSearch,
|
1305
|
-
onCompositionStart,
|
1306
|
-
onCompositionEnd,
|
1307
1307
|
isAllSelected,
|
1308
|
+
isOpen,
|
1309
|
+
listRef,
|
1308
1310
|
formControlProps,
|
1309
1311
|
inputProps,
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1312
|
+
onCompositionEnd,
|
1313
|
+
onCompositionStart,
|
1314
|
+
onSearch
|
1313
1315
|
} = useAutocompleteContext();
|
1314
1316
|
const { value } = useAutocompleteDescendantsContext();
|
1315
1317
|
(0, import_utils7.useUpdateEffect)(() => {
|
@@ -1321,15 +1323,15 @@ var useAutocompleteInput = () => {
|
|
1321
1323
|
return {
|
1322
1324
|
ref: (0, import_utils7.mergeRefs)(inputRef, ref),
|
1323
1325
|
...formControlProps,
|
1324
|
-
role: "combobox",
|
1325
|
-
"aria-haspopup": "listbox",
|
1326
|
-
"aria-autocomplete": "list",
|
1327
|
-
"aria-expanded": isOpen,
|
1328
|
-
"aria-activedescendant": (_a = value(focusedIndex)) == null ? void 0 : _a.node.id,
|
1329
|
-
"aria-controls": (_b = listRef.current) == null ? void 0 : _b.id,
|
1330
1326
|
autoCapitalize: "none",
|
1331
1327
|
autoComplete: "off",
|
1328
|
+
role: "combobox",
|
1332
1329
|
spellCheck: "false",
|
1330
|
+
"aria-activedescendant": (_a = value(focusedIndex)) == null ? void 0 : _a.node.id,
|
1331
|
+
"aria-autocomplete": "list",
|
1332
|
+
"aria-controls": (_b = listRef.current) == null ? void 0 : _b.id,
|
1333
|
+
"aria-expanded": isOpen,
|
1334
|
+
"aria-haspopup": "listbox",
|
1333
1335
|
...inputProps,
|
1334
1336
|
...props,
|
1335
1337
|
id,
|
@@ -1337,15 +1339,15 @@ var useAutocompleteInput = () => {
|
|
1337
1339
|
pointerEvents: formControlProps.disabled || isAllSelected ? "none" : "auto",
|
1338
1340
|
tabIndex: isAllSelected ? -1 : 0,
|
1339
1341
|
onChange: (0, import_utils7.handlerAll)(props.onChange, onSearch),
|
1340
|
-
onCompositionStart: (0, import_utils7.handlerAll)(
|
1341
|
-
props.onCompositionStart,
|
1342
|
-
inputProps.onCompositionStart,
|
1343
|
-
onCompositionStart
|
1344
|
-
),
|
1345
1342
|
onCompositionEnd: (0, import_utils7.handlerAll)(
|
1346
1343
|
props.onCompositionEnd,
|
1347
1344
|
inputProps.onCompositionEnd,
|
1348
1345
|
onCompositionEnd
|
1346
|
+
),
|
1347
|
+
onCompositionStart: (0, import_utils7.handlerAll)(
|
1348
|
+
props.onCompositionStart,
|
1349
|
+
inputProps.onCompositionStart,
|
1350
|
+
onCompositionStart
|
1349
1351
|
)
|
1350
1352
|
};
|
1351
1353
|
},
|