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