@yamada-ui/autocomplete 1.6.2-dev-20241026093521 → 1.6.2-dev-20241026111932
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/autocomplete-create.d.mts +2 -2
- package/dist/autocomplete-create.d.ts +2 -2
- package/dist/autocomplete-create.js +3 -1
- package/dist/autocomplete-create.js.map +1 -1
- package/dist/autocomplete-create.mjs +2 -2
- package/dist/autocomplete-empty.d.mts +2 -2
- package/dist/autocomplete-empty.d.ts +2 -2
- package/dist/autocomplete-empty.js +5 -2
- package/dist/autocomplete-empty.js.map +1 -1
- package/dist/autocomplete-empty.mjs +2 -2
- package/dist/autocomplete-list.d.mts +2 -2
- package/dist/autocomplete-list.d.ts +2 -2
- package/dist/autocomplete-list.js +16 -19
- package/dist/autocomplete-list.js.map +1 -1
- package/dist/autocomplete-list.mjs +2 -2
- package/dist/autocomplete-option-group.d.mts +3 -3
- package/dist/autocomplete-option-group.d.ts +3 -3
- package/dist/autocomplete-option-group.js +27 -13
- package/dist/autocomplete-option-group.js.map +1 -1
- package/dist/autocomplete-option-group.mjs +2 -2
- package/dist/autocomplete-option.d.mts +1 -1
- package/dist/autocomplete-option.d.ts +1 -1
- package/dist/autocomplete-option.js +18 -12
- package/dist/autocomplete-option.js.map +1 -1
- package/dist/autocomplete-option.mjs +2 -2
- package/dist/autocomplete.js +78 -56
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.mjs +10 -10
- package/dist/{chunk-KWIJUSLC.mjs → chunk-2UKLSSUA.mjs} +3 -3
- package/dist/chunk-2UKLSSUA.mjs.map +1 -0
- package/dist/{chunk-ZXALWDKQ.mjs → chunk-3A2HEULI.mjs} +24 -13
- package/dist/chunk-3A2HEULI.mjs.map +1 -0
- package/dist/{chunk-PKRO525W.mjs → chunk-6II6KCIJ.mjs} +3 -3
- package/dist/chunk-6II6KCIJ.mjs.map +1 -0
- package/dist/{chunk-OY5JVCQQ.mjs → chunk-6WQMVK6S.mjs} +5 -5
- package/dist/{chunk-HUY7Q3WA.mjs → chunk-6ZFQNL3O.mjs} +5 -7
- package/dist/{chunk-HUY7Q3WA.mjs.map → chunk-6ZFQNL3O.mjs.map} +1 -1
- package/dist/{chunk-7QON6ZHO.mjs → chunk-CMFJUJJW.mjs} +25 -11
- package/dist/chunk-CMFJUJJW.mjs.map +1 -0
- package/dist/{chunk-352YZTOO.mjs → chunk-EVGBK5C5.mjs} +12 -12
- package/dist/{chunk-352YZTOO.mjs.map → chunk-EVGBK5C5.mjs.map} +1 -1
- package/dist/{chunk-J6UKIKNL.mjs → chunk-G6SC44LI.mjs} +3 -3
- package/dist/chunk-G6SC44LI.mjs.map +1 -0
- package/dist/{chunk-X2PFHBZY.mjs → chunk-PTPJFYGI.mjs} +15 -17
- package/dist/chunk-PTPJFYGI.mjs.map +1 -0
- package/dist/{chunk-WNN655FX.mjs → chunk-PU6HFINM.mjs} +7 -7
- package/dist/chunk-PU6HFINM.mjs.map +1 -0
- package/dist/{chunk-WJ4P4B2E.mjs → chunk-REPBXBG3.mjs} +5 -6
- package/dist/chunk-REPBXBG3.mjs.map +1 -0
- package/dist/index.js +78 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/dist/multi-autocomplete.js +78 -58
- package/dist/multi-autocomplete.js.map +1 -1
- package/dist/multi-autocomplete.mjs +10 -10
- package/dist/use-autocomplete-list.d.mts +1 -1
- package/dist/use-autocomplete-list.d.ts +1 -1
- package/dist/use-autocomplete-list.js +13 -15
- package/dist/use-autocomplete-list.js.map +1 -1
- package/dist/use-autocomplete-list.mjs +1 -1
- package/dist/use-autocomplete-option-group.d.mts +3 -2
- package/dist/use-autocomplete-option-group.d.ts +3 -2
- package/dist/use-autocomplete-option-group.js +22 -8
- package/dist/use-autocomplete-option-group.js.map +1 -1
- package/dist/use-autocomplete-option-group.mjs +1 -1
- package/dist/use-autocomplete-option.d.mts +6 -4
- package/dist/use-autocomplete-option.d.ts +6 -4
- package/dist/use-autocomplete-option.js +23 -12
- package/dist/use-autocomplete-option.js.map +1 -1
- package/dist/use-autocomplete-option.mjs +1 -1
- package/dist/use-autocomplete.js +54 -34
- package/dist/use-autocomplete.js.map +1 -1
- package/dist/use-autocomplete.mjs +5 -5
- package/package.json +2 -2
- package/dist/chunk-7QON6ZHO.mjs.map +0 -1
- package/dist/chunk-J6UKIKNL.mjs.map +0 -1
- package/dist/chunk-KWIJUSLC.mjs.map +0 -1
- package/dist/chunk-PKRO525W.mjs.map +0 -1
- package/dist/chunk-WJ4P4B2E.mjs.map +0 -1
- package/dist/chunk-WNN655FX.mjs.map +0 -1
- package/dist/chunk-X2PFHBZY.mjs.map +0 -1
- package/dist/chunk-ZXALWDKQ.mjs.map +0 -1
- /package/dist/{chunk-OY5JVCQQ.mjs.map → chunk-6WQMVK6S.mjs.map} +0 -0
package/dist/autocomplete.js
CHANGED
@@ -165,8 +165,10 @@ var useAutocompleteOption = (props) => {
|
|
165
165
|
onClose,
|
166
166
|
onFocusNext
|
167
167
|
} = useAutocompleteContext();
|
168
|
-
const
|
168
|
+
const uuid = (0, import_react2.useId)();
|
169
|
+
const itemRef = (0, import_react2.useRef)(null);
|
169
170
|
let {
|
171
|
+
id,
|
170
172
|
children,
|
171
173
|
closeOnSelect: customCloseOnSelect,
|
172
174
|
icon: customIcon,
|
@@ -176,13 +178,19 @@ var useAutocompleteOption = (props) => {
|
|
176
178
|
...computedProps
|
177
179
|
} = { ...optionProps, ...props };
|
178
180
|
const trulyDisabled = !!isDisabled && !isFocusable;
|
179
|
-
const itemRef = (0, import_react2.useRef)(null);
|
180
181
|
const { descendants, index, register } = useAutocompleteDescendant({
|
181
182
|
disabled: trulyDisabled
|
182
183
|
});
|
183
184
|
const values = descendants.values();
|
184
185
|
const frontValues = values.slice(0, index);
|
185
186
|
const isMulti = (0, import_utils3.isArray)(value);
|
187
|
+
const isDuplicated = frontValues.some(
|
188
|
+
({ node }) => node.dataset.value === (optionValue != null ? optionValue : "")
|
189
|
+
);
|
190
|
+
const isSelected = !isDuplicated && (!isMulti ? (optionValue != null ? optionValue : "") === value : value.includes(optionValue != null ? optionValue : ""));
|
191
|
+
const isTarget = "target" in ((_b = (_a = itemRef.current) == null ? void 0 : _a.dataset) != null ? _b : {});
|
192
|
+
const isFocused = index === focusedIndex;
|
193
|
+
id != null ? id : id = uuid;
|
186
194
|
if ((0, import_utils3.isUndefined)(optionValue)) {
|
187
195
|
if ((0, import_utils3.isString)(children) || (0, import_utils3.isNumber)(children)) {
|
188
196
|
optionValue = children.toString();
|
@@ -192,12 +200,6 @@ var useAutocompleteOption = (props) => {
|
|
192
200
|
);
|
193
201
|
}
|
194
202
|
}
|
195
|
-
const isDuplicated = frontValues.some(
|
196
|
-
({ node }) => node.dataset.value === (optionValue != null ? optionValue : "")
|
197
|
-
);
|
198
|
-
const isSelected = !isDuplicated && (!isMulti ? (optionValue != null ? optionValue : "") === value : value.includes(optionValue != null ? optionValue : ""));
|
199
|
-
const isTarget = "target" in ((_b = (_a = itemRef.current) == null ? void 0 : _a.dataset) != null ? _b : {});
|
200
|
-
const isFocused = index === focusedIndex;
|
201
203
|
const onClick = (0, import_react2.useCallback)(
|
202
204
|
(ev) => {
|
203
205
|
ev.stopPropagation();
|
@@ -228,6 +230,7 @@ var useAutocompleteOption = (props) => {
|
|
228
230
|
);
|
229
231
|
const getOptionProps = (0, import_react2.useCallback)(
|
230
232
|
(props2 = {}, ref = null) => {
|
233
|
+
const isHidden = !isTarget || omitSelectedValues && isSelected;
|
231
234
|
const style = {
|
232
235
|
border: "0px",
|
233
236
|
clip: "rect(0px, 0px, 0px, 0px)",
|
@@ -240,14 +243,15 @@ var useAutocompleteOption = (props) => {
|
|
240
243
|
width: "1px"
|
241
244
|
};
|
242
245
|
return {
|
243
|
-
id,
|
244
246
|
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
245
247
|
role: "option",
|
246
248
|
...computedProps,
|
247
249
|
...props2,
|
248
|
-
|
249
|
-
|
250
|
+
id,
|
251
|
+
style: isHidden ? style : void 0,
|
250
252
|
"aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
|
253
|
+
"aria-hidden": (0, import_utils3.ariaAttr)(isHidden),
|
254
|
+
"aria-selected": isSelected,
|
251
255
|
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
252
256
|
"data-duplicated": (0, import_utils3.dataAttr)(isDuplicated),
|
253
257
|
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
@@ -276,6 +280,8 @@ var useAutocompleteOption = (props) => {
|
|
276
280
|
customIcon,
|
277
281
|
isFocused,
|
278
282
|
isSelected,
|
283
|
+
isTarget,
|
284
|
+
omitSelectedValues,
|
279
285
|
getOptionProps
|
280
286
|
};
|
281
287
|
};
|
@@ -296,8 +302,10 @@ var useAutocompleteCreate = () => {
|
|
296
302
|
};
|
297
303
|
return {
|
298
304
|
ref,
|
305
|
+
role: "option",
|
299
306
|
...props,
|
300
307
|
style: isHit ? style : void 0,
|
308
|
+
"aria-hidden": (0, import_utils3.ariaAttr)(isHit),
|
301
309
|
"data-focus": (0, import_utils3.dataAttr)(!isHit),
|
302
310
|
tabIndex: -1,
|
303
311
|
onClick: (0, import_utils3.handlerAll)(props.onClick, onCreate)
|
@@ -311,6 +319,7 @@ var useAutocompleteEmpty = () => {
|
|
311
319
|
const { isEmpty, isHit } = useAutocompleteContext();
|
312
320
|
const getEmptyProps = (0, import_react2.useCallback)(
|
313
321
|
(props = {}, ref = null) => {
|
322
|
+
const isHidden = isHit && !isEmpty;
|
314
323
|
const style = {
|
315
324
|
border: "0px",
|
316
325
|
clip: "rect(0px, 0px, 0px, 0px)",
|
@@ -324,8 +333,10 @@ var useAutocompleteEmpty = () => {
|
|
324
333
|
};
|
325
334
|
return {
|
326
335
|
ref,
|
336
|
+
role: "presentation",
|
327
337
|
...props,
|
328
|
-
style:
|
338
|
+
style: isHidden ? style : void 0,
|
339
|
+
"aria-hidden": (0, import_utils3.ariaAttr)(isHidden),
|
329
340
|
tabIndex: -1
|
330
341
|
};
|
331
342
|
},
|
@@ -355,7 +366,7 @@ var AutocompleteCreate = (0, import_core2.forwardRef)(
|
|
355
366
|
...styles.item
|
356
367
|
};
|
357
368
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
358
|
-
import_core2.ui.
|
369
|
+
import_core2.ui.div,
|
359
370
|
{
|
360
371
|
className: (0, import_utils4.cx)("ui-autocomplete__item--create", className),
|
361
372
|
__css: css,
|
@@ -404,7 +415,7 @@ var AutocompleteEmpty = (0, import_core3.forwardRef)(
|
|
404
415
|
...styles.item
|
405
416
|
};
|
406
417
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
407
|
-
import_core3.ui.
|
418
|
+
import_core3.ui.div,
|
408
419
|
{
|
409
420
|
className: (0, import_utils5.cx)("ui-autocomplete__item--empty", className),
|
410
421
|
__css: css,
|
@@ -438,11 +449,12 @@ var import_utils7 = require("@yamada-ui/utils");
|
|
438
449
|
var import_utils6 = require("@yamada-ui/utils");
|
439
450
|
var import_react3 = require("react");
|
440
451
|
var useAutocompleteList = () => {
|
441
|
-
const
|
442
|
-
const { focusedIndex, isOpen, listRef, rebirthOptions } = useAutocompleteContext();
|
452
|
+
const { focusedIndex, isOpen, listRef, rebirthOptions, value } = useAutocompleteContext();
|
443
453
|
const descendants = useAutocompleteDescendantsContext();
|
454
|
+
const uuid = (0, import_react3.useId)();
|
444
455
|
const beforeFocusedIndex = (0, import_react3.useRef)(-1);
|
445
456
|
const selectedValue = descendants.value(focusedIndex);
|
457
|
+
const isMulti = (0, import_utils6.isArray)(value);
|
446
458
|
const onAnimationComplete = (0, import_react3.useCallback)(() => {
|
447
459
|
if (!isOpen) rebirthOptions(false);
|
448
460
|
}, [isOpen, rebirthOptions]);
|
@@ -476,19 +488,16 @@ var useAutocompleteList = () => {
|
|
476
488
|
if (!isOpen) beforeFocusedIndex.current = -1;
|
477
489
|
}, [isOpen]);
|
478
490
|
const getListProps = (0, import_react3.useCallback)(
|
479
|
-
(props = {}, ref = null) => {
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
};
|
490
|
-
},
|
491
|
-
[listRef, uuid]
|
491
|
+
({ id, ...props } = {}, ref = null) => ({
|
492
|
+
id: id != null ? id : uuid,
|
493
|
+
ref: (0, import_utils6.mergeRefs)(listRef, ref),
|
494
|
+
"aria-multiselectable": (0, import_utils6.ariaAttr)(isMulti),
|
495
|
+
position: "relative",
|
496
|
+
role: "listbox",
|
497
|
+
tabIndex: -1,
|
498
|
+
...props
|
499
|
+
}),
|
500
|
+
[listRef, uuid, isMulti]
|
492
501
|
);
|
493
502
|
return {
|
494
503
|
getListProps,
|
@@ -525,7 +534,6 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
525
534
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
526
535
|
import_popover.PopoverContent,
|
527
536
|
{
|
528
|
-
as: "div",
|
529
537
|
className: "ui-autocomplete__popover",
|
530
538
|
maxWidth,
|
531
539
|
minWidth,
|
@@ -538,7 +546,7 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
538
546
|
),
|
539
547
|
children: [
|
540
548
|
header ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
541
|
-
import_core4.ui.
|
549
|
+
import_core4.ui.header,
|
542
550
|
{
|
543
551
|
className: "ui-autocomplete__header",
|
544
552
|
__css: { ...styles.header },
|
@@ -546,7 +554,7 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
546
554
|
}
|
547
555
|
) : null,
|
548
556
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
549
|
-
import_core4.ui.
|
557
|
+
import_core4.ui.div,
|
550
558
|
{
|
551
559
|
className: (0, import_utils7.cx)("ui-autocomplete__list", className),
|
552
560
|
__css: { ...styles.list },
|
@@ -555,7 +563,7 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
555
563
|
}
|
556
564
|
),
|
557
565
|
footer ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
558
|
-
import_core4.ui.
|
566
|
+
import_core4.ui.footer,
|
559
567
|
{
|
560
568
|
className: "ui-autocomplete__footer",
|
561
569
|
__css: { ...styles.footer },
|
@@ -602,7 +610,7 @@ var AutocompleteOption = (0, import_core5.forwardRef)(
|
|
602
610
|
...styles.item
|
603
611
|
};
|
604
612
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
605
|
-
import_core5.ui.
|
613
|
+
import_core5.ui.div,
|
606
614
|
{
|
607
615
|
className: (0, import_utils8.cx)("ui-autocomplete__item", className),
|
608
616
|
__css: css,
|
@@ -640,9 +648,11 @@ var useAutocompleteOptionGroup = ({
|
|
640
648
|
...rest
|
641
649
|
}) => {
|
642
650
|
const { omitSelectedValues, value } = useAutocompleteContext();
|
643
|
-
const isMulti = (0, import_utils9.isArray)(value);
|
644
651
|
const descendants = useAutocompleteDescendantsContext();
|
652
|
+
const labelRef = (0, import_react4.useRef)(null);
|
653
|
+
const labelId = (0, import_react4.useId)();
|
645
654
|
const values = descendants.values();
|
655
|
+
const isMulti = (0, import_utils9.isArray)(value);
|
646
656
|
const selectedValues = isMulti && omitSelectedValues ? descendants.values(
|
647
657
|
({ node }) => {
|
648
658
|
var _a;
|
@@ -660,6 +670,7 @@ var useAutocompleteOptionGroup = ({
|
|
660
670
|
const [containerProps, groupProps] = (0, import_utils9.splitObject)(rest, import_core6.layoutStyleProperties);
|
661
671
|
const getContainerProps = (0, import_react4.useCallback)(
|
662
672
|
(props = {}, ref = null) => {
|
673
|
+
var _a;
|
663
674
|
const style = {
|
664
675
|
border: "0px",
|
665
676
|
clip: "rect(0px, 0px, 0px, 0px)",
|
@@ -673,29 +684,40 @@ var useAutocompleteOptionGroup = ({
|
|
673
684
|
};
|
674
685
|
return {
|
675
686
|
ref,
|
687
|
+
"aria-labelledby": (_a = labelRef.current) == null ? void 0 : _a.id,
|
688
|
+
role: "group",
|
676
689
|
...props,
|
677
690
|
...containerProps,
|
678
|
-
style: isEmpty ? style : void 0
|
679
|
-
"data-label": label,
|
680
|
-
role: "autocomplete-group-container"
|
691
|
+
style: isEmpty ? style : void 0
|
681
692
|
};
|
682
693
|
},
|
683
|
-
[containerProps, isEmpty
|
694
|
+
[containerProps, isEmpty]
|
695
|
+
);
|
696
|
+
const getLabelProps = (0, import_react4.useCallback)(
|
697
|
+
({ id, ...props } = {}, ref = null) => {
|
698
|
+
return {
|
699
|
+
id: id != null ? id : labelId,
|
700
|
+
ref: (0, import_utils9.mergeRefs)(ref, labelRef),
|
701
|
+
role: "presentation",
|
702
|
+
...props
|
703
|
+
};
|
704
|
+
},
|
705
|
+
[labelId]
|
684
706
|
);
|
685
707
|
const getGroupProps = (0, import_react4.useCallback)(
|
686
708
|
(props = {}, ref = null) => ({
|
687
709
|
ref,
|
688
710
|
...props,
|
689
711
|
...groupProps,
|
690
|
-
"data-label": label
|
691
|
-
role: "autocomplete-group"
|
712
|
+
"data-label": label
|
692
713
|
}),
|
693
714
|
[groupProps, label]
|
694
715
|
);
|
695
716
|
return {
|
696
717
|
label,
|
697
718
|
getContainerProps,
|
698
|
-
getGroupProps
|
719
|
+
getGroupProps,
|
720
|
+
getLabelProps
|
699
721
|
};
|
700
722
|
};
|
701
723
|
|
@@ -714,11 +736,11 @@ var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
|
|
714
736
|
...rest
|
715
737
|
}, ref) => {
|
716
738
|
const { styles } = useAutocompleteContext();
|
717
|
-
const { label, getContainerProps, getGroupProps } = useAutocompleteOptionGroup(rest);
|
739
|
+
const { label, getContainerProps, getGroupProps, getLabelProps } = useAutocompleteOptionGroup(rest);
|
718
740
|
h != null ? h : h = height;
|
719
741
|
minH != null ? minH : minH = minHeight;
|
720
742
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
721
|
-
import_core7.ui.
|
743
|
+
import_core7.ui.section,
|
722
744
|
{
|
723
745
|
className: (0, import_utils10.cx)(
|
724
746
|
"ui-autocomplete__item",
|
@@ -729,17 +751,17 @@ var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
|
|
729
751
|
...getContainerProps(),
|
730
752
|
children: [
|
731
753
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
732
|
-
import_core7.ui.
|
754
|
+
import_core7.ui.header,
|
733
755
|
{
|
734
756
|
className: "ui-autocomplete__item__group-label",
|
735
757
|
lineClamp: 1,
|
736
758
|
__css: styles.groupLabel,
|
737
|
-
...labelProps,
|
759
|
+
...getLabelProps(labelProps),
|
738
760
|
children: label
|
739
761
|
}
|
740
762
|
),
|
741
763
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
742
|
-
import_core7.ui.
|
764
|
+
import_core7.ui.div,
|
743
765
|
{
|
744
766
|
...getGroupProps({}, ref),
|
745
767
|
className: "ui-autocomplete__item__group",
|
@@ -1519,7 +1541,6 @@ var useAutocomplete = (props) => {
|
|
1519
1541
|
tabIndex: -1,
|
1520
1542
|
...props2,
|
1521
1543
|
...formControlProps,
|
1522
|
-
"aria-expanded": (0, import_utils11.dataAttr)(isOpen),
|
1523
1544
|
"data-active": (0, import_utils11.dataAttr)(isOpen),
|
1524
1545
|
placeholder,
|
1525
1546
|
onFocus: (0, import_utils11.handlerAll)(props2.onFocus, onFocusProp, onFocus),
|
@@ -1579,6 +1600,7 @@ var useAutocomplete = (props) => {
|
|
1579
1600
|
};
|
1580
1601
|
};
|
1581
1602
|
var useAutocompleteInput = () => {
|
1603
|
+
var _a, _b;
|
1582
1604
|
const {
|
1583
1605
|
id,
|
1584
1606
|
focusedIndex,
|
@@ -1592,31 +1614,32 @@ var useAutocompleteInput = () => {
|
|
1592
1614
|
onCompositionStart,
|
1593
1615
|
onSearch
|
1594
1616
|
} = useAutocompleteContext();
|
1595
|
-
const
|
1617
|
+
const descendants = useAutocompleteDescendantsContext();
|
1618
|
+
const activedescendantId = (_a = descendants.value(focusedIndex)) == null ? void 0 : _a.node.id;
|
1619
|
+
const listId = (_b = listRef.current) == null ? void 0 : _b.id;
|
1596
1620
|
(0, import_utils11.useUpdateEffect)(() => {
|
1597
1621
|
if (isAllSelected && inputRef.current) inputRef.current.blur();
|
1598
1622
|
}, [isAllSelected]);
|
1599
1623
|
const getInputProps = (0, import_react5.useCallback)(
|
1600
1624
|
(props = {}, ref = null) => {
|
1601
|
-
var _a, _b;
|
1602
1625
|
return {
|
1603
1626
|
ref: (0, import_utils11.mergeRefs)(inputRef, ref),
|
1604
1627
|
...formControlProps,
|
1605
|
-
"aria-activedescendant":
|
1628
|
+
"aria-activedescendant": activedescendantId,
|
1606
1629
|
"aria-autocomplete": "list",
|
1607
|
-
"aria-controls":
|
1630
|
+
"aria-controls": listId,
|
1608
1631
|
"aria-expanded": isOpen,
|
1609
1632
|
"aria-haspopup": "listbox",
|
1610
1633
|
autoCapitalize: "none",
|
1611
1634
|
autoComplete: "off",
|
1612
1635
|
role: "combobox",
|
1613
1636
|
spellCheck: "false",
|
1637
|
+
tabIndex: isAllSelected ? -1 : 0,
|
1614
1638
|
...inputProps,
|
1615
1639
|
...props,
|
1616
1640
|
id,
|
1617
1641
|
cursor: formControlProps.readOnly ? "default" : "text",
|
1618
1642
|
pointerEvents: formControlProps.disabled || isAllSelected ? "none" : "auto",
|
1619
|
-
tabIndex: isAllSelected ? -1 : 0,
|
1620
1643
|
onChange: (0, import_utils11.handlerAll)(props.onChange, onSearch),
|
1621
1644
|
onCompositionEnd: (0, import_utils11.handlerAll)(
|
1622
1645
|
props.onCompositionEnd,
|
@@ -1631,15 +1654,14 @@ var useAutocompleteInput = () => {
|
|
1631
1654
|
};
|
1632
1655
|
},
|
1633
1656
|
[
|
1634
|
-
|
1635
|
-
|
1657
|
+
listId,
|
1658
|
+
activedescendantId,
|
1636
1659
|
isOpen,
|
1637
1660
|
inputProps,
|
1638
1661
|
inputRef,
|
1639
1662
|
formControlProps,
|
1640
1663
|
id,
|
1641
1664
|
isAllSelected,
|
1642
|
-
value,
|
1643
1665
|
onSearch,
|
1644
1666
|
onCompositionStart,
|
1645
1667
|
onCompositionEnd
|