@yamada-ui/autocomplete 1.6.2-dev-20241026093521 → 1.6.2-dev-20241026111932
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/autocomplete-create.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.js
CHANGED
|
@@ -172,8 +172,10 @@ var useAutocompleteOption = (props) => {
|
|
|
172
172
|
onClose,
|
|
173
173
|
onFocusNext
|
|
174
174
|
} = useAutocompleteContext();
|
|
175
|
-
const
|
|
175
|
+
const uuid = (0, import_react2.useId)();
|
|
176
|
+
const itemRef = (0, import_react2.useRef)(null);
|
|
176
177
|
let {
|
|
178
|
+
id,
|
|
177
179
|
children,
|
|
178
180
|
closeOnSelect: customCloseOnSelect,
|
|
179
181
|
icon: customIcon,
|
|
@@ -183,13 +185,19 @@ var useAutocompleteOption = (props) => {
|
|
|
183
185
|
...computedProps
|
|
184
186
|
} = { ...optionProps, ...props };
|
|
185
187
|
const trulyDisabled = !!isDisabled && !isFocusable;
|
|
186
|
-
const itemRef = (0, import_react2.useRef)(null);
|
|
187
188
|
const { descendants, index, register } = useAutocompleteDescendant({
|
|
188
189
|
disabled: trulyDisabled
|
|
189
190
|
});
|
|
190
191
|
const values = descendants.values();
|
|
191
192
|
const frontValues = values.slice(0, index);
|
|
192
193
|
const isMulti = (0, import_utils3.isArray)(value);
|
|
194
|
+
const isDuplicated = frontValues.some(
|
|
195
|
+
({ node }) => node.dataset.value === (optionValue != null ? optionValue : "")
|
|
196
|
+
);
|
|
197
|
+
const isSelected = !isDuplicated && (!isMulti ? (optionValue != null ? optionValue : "") === value : value.includes(optionValue != null ? optionValue : ""));
|
|
198
|
+
const isTarget = "target" in ((_b = (_a = itemRef.current) == null ? void 0 : _a.dataset) != null ? _b : {});
|
|
199
|
+
const isFocused = index === focusedIndex;
|
|
200
|
+
id != null ? id : id = uuid;
|
|
193
201
|
if ((0, import_utils3.isUndefined)(optionValue)) {
|
|
194
202
|
if ((0, import_utils3.isString)(children) || (0, import_utils3.isNumber)(children)) {
|
|
195
203
|
optionValue = children.toString();
|
|
@@ -199,12 +207,6 @@ var useAutocompleteOption = (props) => {
|
|
|
199
207
|
);
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
|
-
const isDuplicated = frontValues.some(
|
|
203
|
-
({ node }) => node.dataset.value === (optionValue != null ? optionValue : "")
|
|
204
|
-
);
|
|
205
|
-
const isSelected = !isDuplicated && (!isMulti ? (optionValue != null ? optionValue : "") === value : value.includes(optionValue != null ? optionValue : ""));
|
|
206
|
-
const isTarget = "target" in ((_b = (_a = itemRef.current) == null ? void 0 : _a.dataset) != null ? _b : {});
|
|
207
|
-
const isFocused = index === focusedIndex;
|
|
208
210
|
const onClick = (0, import_react2.useCallback)(
|
|
209
211
|
(ev) => {
|
|
210
212
|
ev.stopPropagation();
|
|
@@ -235,6 +237,7 @@ var useAutocompleteOption = (props) => {
|
|
|
235
237
|
);
|
|
236
238
|
const getOptionProps = (0, import_react2.useCallback)(
|
|
237
239
|
(props2 = {}, ref = null) => {
|
|
240
|
+
const isHidden = !isTarget || omitSelectedValues && isSelected;
|
|
238
241
|
const style = {
|
|
239
242
|
border: "0px",
|
|
240
243
|
clip: "rect(0px, 0px, 0px, 0px)",
|
|
@@ -247,14 +250,15 @@ var useAutocompleteOption = (props) => {
|
|
|
247
250
|
width: "1px"
|
|
248
251
|
};
|
|
249
252
|
return {
|
|
250
|
-
id,
|
|
251
253
|
ref: (0, import_utils3.mergeRefs)(itemRef, ref, register),
|
|
252
254
|
role: "option",
|
|
253
255
|
...computedProps,
|
|
254
256
|
...props2,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
+
id,
|
|
258
|
+
style: isHidden ? style : void 0,
|
|
257
259
|
"aria-disabled": (0, import_utils3.ariaAttr)(isDisabled),
|
|
260
|
+
"aria-hidden": (0, import_utils3.ariaAttr)(isHidden),
|
|
261
|
+
"aria-selected": isSelected,
|
|
258
262
|
"data-disabled": (0, import_utils3.dataAttr)(isDisabled),
|
|
259
263
|
"data-duplicated": (0, import_utils3.dataAttr)(isDuplicated),
|
|
260
264
|
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
|
@@ -283,6 +287,8 @@ var useAutocompleteOption = (props) => {
|
|
|
283
287
|
customIcon,
|
|
284
288
|
isFocused,
|
|
285
289
|
isSelected,
|
|
290
|
+
isTarget,
|
|
291
|
+
omitSelectedValues,
|
|
286
292
|
getOptionProps
|
|
287
293
|
};
|
|
288
294
|
};
|
|
@@ -303,8 +309,10 @@ var useAutocompleteCreate = () => {
|
|
|
303
309
|
};
|
|
304
310
|
return {
|
|
305
311
|
ref,
|
|
312
|
+
role: "option",
|
|
306
313
|
...props,
|
|
307
314
|
style: isHit ? style : void 0,
|
|
315
|
+
"aria-hidden": (0, import_utils3.ariaAttr)(isHit),
|
|
308
316
|
"data-focus": (0, import_utils3.dataAttr)(!isHit),
|
|
309
317
|
tabIndex: -1,
|
|
310
318
|
onClick: (0, import_utils3.handlerAll)(props.onClick, onCreate)
|
|
@@ -318,6 +326,7 @@ var useAutocompleteEmpty = () => {
|
|
|
318
326
|
const { isEmpty, isHit } = useAutocompleteContext();
|
|
319
327
|
const getEmptyProps = (0, import_react2.useCallback)(
|
|
320
328
|
(props = {}, ref = null) => {
|
|
329
|
+
const isHidden = isHit && !isEmpty;
|
|
321
330
|
const style = {
|
|
322
331
|
border: "0px",
|
|
323
332
|
clip: "rect(0px, 0px, 0px, 0px)",
|
|
@@ -331,8 +340,10 @@ var useAutocompleteEmpty = () => {
|
|
|
331
340
|
};
|
|
332
341
|
return {
|
|
333
342
|
ref,
|
|
343
|
+
role: "presentation",
|
|
334
344
|
...props,
|
|
335
|
-
style:
|
|
345
|
+
style: isHidden ? style : void 0,
|
|
346
|
+
"aria-hidden": (0, import_utils3.ariaAttr)(isHidden),
|
|
336
347
|
tabIndex: -1
|
|
337
348
|
};
|
|
338
349
|
},
|
|
@@ -362,7 +373,7 @@ var AutocompleteCreate = (0, import_core2.forwardRef)(
|
|
|
362
373
|
...styles.item
|
|
363
374
|
};
|
|
364
375
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
365
|
-
import_core2.ui.
|
|
376
|
+
import_core2.ui.div,
|
|
366
377
|
{
|
|
367
378
|
className: (0, import_utils4.cx)("ui-autocomplete__item--create", className),
|
|
368
379
|
__css: css,
|
|
@@ -411,7 +422,7 @@ var AutocompleteEmpty = (0, import_core3.forwardRef)(
|
|
|
411
422
|
...styles.item
|
|
412
423
|
};
|
|
413
424
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
414
|
-
import_core3.ui.
|
|
425
|
+
import_core3.ui.div,
|
|
415
426
|
{
|
|
416
427
|
className: (0, import_utils5.cx)("ui-autocomplete__item--empty", className),
|
|
417
428
|
__css: css,
|
|
@@ -445,11 +456,12 @@ var import_utils7 = require("@yamada-ui/utils");
|
|
|
445
456
|
var import_utils6 = require("@yamada-ui/utils");
|
|
446
457
|
var import_react3 = require("react");
|
|
447
458
|
var useAutocompleteList = () => {
|
|
448
|
-
const
|
|
449
|
-
const { focusedIndex, isOpen, listRef, rebirthOptions } = useAutocompleteContext();
|
|
459
|
+
const { focusedIndex, isOpen, listRef, rebirthOptions, value } = useAutocompleteContext();
|
|
450
460
|
const descendants = useAutocompleteDescendantsContext();
|
|
461
|
+
const uuid = (0, import_react3.useId)();
|
|
451
462
|
const beforeFocusedIndex = (0, import_react3.useRef)(-1);
|
|
452
463
|
const selectedValue = descendants.value(focusedIndex);
|
|
464
|
+
const isMulti = (0, import_utils6.isArray)(value);
|
|
453
465
|
const onAnimationComplete = (0, import_react3.useCallback)(() => {
|
|
454
466
|
if (!isOpen) rebirthOptions(false);
|
|
455
467
|
}, [isOpen, rebirthOptions]);
|
|
@@ -483,19 +495,16 @@ var useAutocompleteList = () => {
|
|
|
483
495
|
if (!isOpen) beforeFocusedIndex.current = -1;
|
|
484
496
|
}, [isOpen]);
|
|
485
497
|
const getListProps = (0, import_react3.useCallback)(
|
|
486
|
-
(props = {}, ref = null) => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
};
|
|
497
|
-
},
|
|
498
|
-
[listRef, uuid]
|
|
498
|
+
({ id, ...props } = {}, ref = null) => ({
|
|
499
|
+
id: id != null ? id : uuid,
|
|
500
|
+
ref: (0, import_utils6.mergeRefs)(listRef, ref),
|
|
501
|
+
"aria-multiselectable": (0, import_utils6.ariaAttr)(isMulti),
|
|
502
|
+
position: "relative",
|
|
503
|
+
role: "listbox",
|
|
504
|
+
tabIndex: -1,
|
|
505
|
+
...props
|
|
506
|
+
}),
|
|
507
|
+
[listRef, uuid, isMulti]
|
|
499
508
|
);
|
|
500
509
|
return {
|
|
501
510
|
getListProps,
|
|
@@ -532,7 +541,6 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
|
532
541
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
533
542
|
import_popover.PopoverContent,
|
|
534
543
|
{
|
|
535
|
-
as: "div",
|
|
536
544
|
className: "ui-autocomplete__popover",
|
|
537
545
|
maxWidth,
|
|
538
546
|
minWidth,
|
|
@@ -545,7 +553,7 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
|
545
553
|
),
|
|
546
554
|
children: [
|
|
547
555
|
header ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
548
|
-
import_core4.ui.
|
|
556
|
+
import_core4.ui.header,
|
|
549
557
|
{
|
|
550
558
|
className: "ui-autocomplete__header",
|
|
551
559
|
__css: { ...styles.header },
|
|
@@ -553,7 +561,7 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
|
553
561
|
}
|
|
554
562
|
) : null,
|
|
555
563
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
556
|
-
import_core4.ui.
|
|
564
|
+
import_core4.ui.div,
|
|
557
565
|
{
|
|
558
566
|
className: (0, import_utils7.cx)("ui-autocomplete__list", className),
|
|
559
567
|
__css: { ...styles.list },
|
|
@@ -562,7 +570,7 @@ var AutocompleteList = (0, import_core4.forwardRef)(
|
|
|
562
570
|
}
|
|
563
571
|
),
|
|
564
572
|
footer ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
565
|
-
import_core4.ui.
|
|
573
|
+
import_core4.ui.footer,
|
|
566
574
|
{
|
|
567
575
|
className: "ui-autocomplete__footer",
|
|
568
576
|
__css: { ...styles.footer },
|
|
@@ -609,7 +617,7 @@ var AutocompleteOption = (0, import_core5.forwardRef)(
|
|
|
609
617
|
...styles.item
|
|
610
618
|
};
|
|
611
619
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
612
|
-
import_core5.ui.
|
|
620
|
+
import_core5.ui.div,
|
|
613
621
|
{
|
|
614
622
|
className: (0, import_utils8.cx)("ui-autocomplete__item", className),
|
|
615
623
|
__css: css,
|
|
@@ -647,9 +655,11 @@ var useAutocompleteOptionGroup = ({
|
|
|
647
655
|
...rest
|
|
648
656
|
}) => {
|
|
649
657
|
const { omitSelectedValues, value } = useAutocompleteContext();
|
|
650
|
-
const isMulti = (0, import_utils9.isArray)(value);
|
|
651
658
|
const descendants = useAutocompleteDescendantsContext();
|
|
659
|
+
const labelRef = (0, import_react4.useRef)(null);
|
|
660
|
+
const labelId = (0, import_react4.useId)();
|
|
652
661
|
const values = descendants.values();
|
|
662
|
+
const isMulti = (0, import_utils9.isArray)(value);
|
|
653
663
|
const selectedValues = isMulti && omitSelectedValues ? descendants.values(
|
|
654
664
|
({ node }) => {
|
|
655
665
|
var _a;
|
|
@@ -667,6 +677,7 @@ var useAutocompleteOptionGroup = ({
|
|
|
667
677
|
const [containerProps, groupProps] = (0, import_utils9.splitObject)(rest, import_core6.layoutStyleProperties);
|
|
668
678
|
const getContainerProps = (0, import_react4.useCallback)(
|
|
669
679
|
(props = {}, ref = null) => {
|
|
680
|
+
var _a;
|
|
670
681
|
const style = {
|
|
671
682
|
border: "0px",
|
|
672
683
|
clip: "rect(0px, 0px, 0px, 0px)",
|
|
@@ -680,29 +691,40 @@ var useAutocompleteOptionGroup = ({
|
|
|
680
691
|
};
|
|
681
692
|
return {
|
|
682
693
|
ref,
|
|
694
|
+
"aria-labelledby": (_a = labelRef.current) == null ? void 0 : _a.id,
|
|
695
|
+
role: "group",
|
|
683
696
|
...props,
|
|
684
697
|
...containerProps,
|
|
685
|
-
style: isEmpty ? style : void 0
|
|
686
|
-
"data-label": label,
|
|
687
|
-
role: "autocomplete-group-container"
|
|
698
|
+
style: isEmpty ? style : void 0
|
|
688
699
|
};
|
|
689
700
|
},
|
|
690
|
-
[containerProps, isEmpty
|
|
701
|
+
[containerProps, isEmpty]
|
|
702
|
+
);
|
|
703
|
+
const getLabelProps = (0, import_react4.useCallback)(
|
|
704
|
+
({ id, ...props } = {}, ref = null) => {
|
|
705
|
+
return {
|
|
706
|
+
id: id != null ? id : labelId,
|
|
707
|
+
ref: (0, import_utils9.mergeRefs)(ref, labelRef),
|
|
708
|
+
role: "presentation",
|
|
709
|
+
...props
|
|
710
|
+
};
|
|
711
|
+
},
|
|
712
|
+
[labelId]
|
|
691
713
|
);
|
|
692
714
|
const getGroupProps = (0, import_react4.useCallback)(
|
|
693
715
|
(props = {}, ref = null) => ({
|
|
694
716
|
ref,
|
|
695
717
|
...props,
|
|
696
718
|
...groupProps,
|
|
697
|
-
"data-label": label
|
|
698
|
-
role: "autocomplete-group"
|
|
719
|
+
"data-label": label
|
|
699
720
|
}),
|
|
700
721
|
[groupProps, label]
|
|
701
722
|
);
|
|
702
723
|
return {
|
|
703
724
|
label,
|
|
704
725
|
getContainerProps,
|
|
705
|
-
getGroupProps
|
|
726
|
+
getGroupProps,
|
|
727
|
+
getLabelProps
|
|
706
728
|
};
|
|
707
729
|
};
|
|
708
730
|
|
|
@@ -721,11 +743,11 @@ var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
|
|
|
721
743
|
...rest
|
|
722
744
|
}, ref) => {
|
|
723
745
|
const { styles } = useAutocompleteContext();
|
|
724
|
-
const { label, getContainerProps, getGroupProps } = useAutocompleteOptionGroup(rest);
|
|
746
|
+
const { label, getContainerProps, getGroupProps, getLabelProps } = useAutocompleteOptionGroup(rest);
|
|
725
747
|
h != null ? h : h = height;
|
|
726
748
|
minH != null ? minH : minH = minHeight;
|
|
727
749
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
728
|
-
import_core7.ui.
|
|
750
|
+
import_core7.ui.section,
|
|
729
751
|
{
|
|
730
752
|
className: (0, import_utils10.cx)(
|
|
731
753
|
"ui-autocomplete__item",
|
|
@@ -736,17 +758,17 @@ var AutocompleteOptionGroup = (0, import_core7.forwardRef)(
|
|
|
736
758
|
...getContainerProps(),
|
|
737
759
|
children: [
|
|
738
760
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
739
|
-
import_core7.ui.
|
|
761
|
+
import_core7.ui.header,
|
|
740
762
|
{
|
|
741
763
|
className: "ui-autocomplete__item__group-label",
|
|
742
764
|
lineClamp: 1,
|
|
743
765
|
__css: styles.groupLabel,
|
|
744
|
-
...labelProps,
|
|
766
|
+
...getLabelProps(labelProps),
|
|
745
767
|
children: label
|
|
746
768
|
}
|
|
747
769
|
),
|
|
748
770
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
749
|
-
import_core7.ui.
|
|
771
|
+
import_core7.ui.div,
|
|
750
772
|
{
|
|
751
773
|
...getGroupProps({}, ref),
|
|
752
774
|
className: "ui-autocomplete__item__group",
|
|
@@ -1526,7 +1548,6 @@ var useAutocomplete = (props) => {
|
|
|
1526
1548
|
tabIndex: -1,
|
|
1527
1549
|
...props2,
|
|
1528
1550
|
...formControlProps,
|
|
1529
|
-
"aria-expanded": (0, import_utils11.dataAttr)(isOpen),
|
|
1530
1551
|
"data-active": (0, import_utils11.dataAttr)(isOpen),
|
|
1531
1552
|
placeholder,
|
|
1532
1553
|
onFocus: (0, import_utils11.handlerAll)(props2.onFocus, onFocusProp, onFocus),
|
|
@@ -1586,6 +1607,7 @@ var useAutocomplete = (props) => {
|
|
|
1586
1607
|
};
|
|
1587
1608
|
};
|
|
1588
1609
|
var useAutocompleteInput = () => {
|
|
1610
|
+
var _a, _b;
|
|
1589
1611
|
const {
|
|
1590
1612
|
id,
|
|
1591
1613
|
focusedIndex,
|
|
@@ -1599,31 +1621,32 @@ var useAutocompleteInput = () => {
|
|
|
1599
1621
|
onCompositionStart,
|
|
1600
1622
|
onSearch
|
|
1601
1623
|
} = useAutocompleteContext();
|
|
1602
|
-
const
|
|
1624
|
+
const descendants = useAutocompleteDescendantsContext();
|
|
1625
|
+
const activedescendantId = (_a = descendants.value(focusedIndex)) == null ? void 0 : _a.node.id;
|
|
1626
|
+
const listId = (_b = listRef.current) == null ? void 0 : _b.id;
|
|
1603
1627
|
(0, import_utils11.useUpdateEffect)(() => {
|
|
1604
1628
|
if (isAllSelected && inputRef.current) inputRef.current.blur();
|
|
1605
1629
|
}, [isAllSelected]);
|
|
1606
1630
|
const getInputProps = (0, import_react5.useCallback)(
|
|
1607
1631
|
(props = {}, ref = null) => {
|
|
1608
|
-
var _a, _b;
|
|
1609
1632
|
return {
|
|
1610
1633
|
ref: (0, import_utils11.mergeRefs)(inputRef, ref),
|
|
1611
1634
|
...formControlProps,
|
|
1612
|
-
"aria-activedescendant":
|
|
1635
|
+
"aria-activedescendant": activedescendantId,
|
|
1613
1636
|
"aria-autocomplete": "list",
|
|
1614
|
-
"aria-controls":
|
|
1637
|
+
"aria-controls": listId,
|
|
1615
1638
|
"aria-expanded": isOpen,
|
|
1616
1639
|
"aria-haspopup": "listbox",
|
|
1617
1640
|
autoCapitalize: "none",
|
|
1618
1641
|
autoComplete: "off",
|
|
1619
1642
|
role: "combobox",
|
|
1620
1643
|
spellCheck: "false",
|
|
1644
|
+
tabIndex: isAllSelected ? -1 : 0,
|
|
1621
1645
|
...inputProps,
|
|
1622
1646
|
...props,
|
|
1623
1647
|
id,
|
|
1624
1648
|
cursor: formControlProps.readOnly ? "default" : "text",
|
|
1625
1649
|
pointerEvents: formControlProps.disabled || isAllSelected ? "none" : "auto",
|
|
1626
|
-
tabIndex: isAllSelected ? -1 : 0,
|
|
1627
1650
|
onChange: (0, import_utils11.handlerAll)(props.onChange, onSearch),
|
|
1628
1651
|
onCompositionEnd: (0, import_utils11.handlerAll)(
|
|
1629
1652
|
props.onCompositionEnd,
|
|
@@ -1638,15 +1661,14 @@ var useAutocompleteInput = () => {
|
|
|
1638
1661
|
};
|
|
1639
1662
|
},
|
|
1640
1663
|
[
|
|
1641
|
-
|
|
1642
|
-
|
|
1664
|
+
listId,
|
|
1665
|
+
activedescendantId,
|
|
1643
1666
|
isOpen,
|
|
1644
1667
|
inputProps,
|
|
1645
1668
|
inputRef,
|
|
1646
1669
|
formControlProps,
|
|
1647
1670
|
id,
|
|
1648
1671
|
isAllSelected,
|
|
1649
|
-
value,
|
|
1650
1672
|
onSearch,
|
|
1651
1673
|
onCompositionStart,
|
|
1652
1674
|
onCompositionEnd
|
|
@@ -2014,8 +2036,6 @@ var MultiAutocompleteField = (0, import_core10.forwardRef)(
|
|
|
2014
2036
|
import_core10.ui.input,
|
|
2015
2037
|
{
|
|
2016
2038
|
className: "ui-multi-autocomplete__field__input",
|
|
2017
|
-
"aria-label": "Input value",
|
|
2018
|
-
"aria-multiselectable": "true",
|
|
2019
2039
|
display: "inline-block",
|
|
2020
2040
|
flex: "1",
|
|
2021
2041
|
marginBlockEnd: "0.125rem",
|