@yamada-ui/autocomplete 1.6.5-next-20241118225020 → 1.6.5
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/autocomplete-context.d.mts +0 -1
- package/dist/autocomplete-context.d.ts +0 -1
- package/dist/autocomplete-context.js.map +1 -1
- package/dist/autocomplete-context.mjs +1 -1
- package/dist/autocomplete-create.js.map +1 -1
- package/dist/autocomplete-create.mjs +4 -4
- package/dist/autocomplete-empty.js.map +1 -1
- package/dist/autocomplete-empty.mjs +4 -4
- package/dist/autocomplete-icon.js.map +1 -1
- package/dist/autocomplete-icon.mjs +2 -2
- package/dist/autocomplete-list.js +22 -15
- package/dist/autocomplete-list.js.map +1 -1
- package/dist/autocomplete-list.mjs +3 -3
- package/dist/autocomplete-option-group.js.map +1 -1
- package/dist/autocomplete-option-group.mjs +3 -3
- package/dist/autocomplete-option.js +10 -6
- package/dist/autocomplete-option.js.map +1 -1
- package/dist/autocomplete-option.mjs +4 -4
- package/dist/autocomplete.js +78 -84
- package/dist/autocomplete.js.map +1 -1
- package/dist/autocomplete.mjs +12 -12
- package/dist/{chunk-JYPMXZG4.mjs → chunk-2CVB4NO5.mjs} +7 -7
- package/dist/{chunk-3A2HEULI.mjs → chunk-2LP57WVB.mjs} +12 -8
- package/dist/chunk-2LP57WVB.mjs.map +1 -0
- package/dist/{chunk-PTPJFYGI.mjs → chunk-4GVV3HBE.mjs} +29 -13
- package/dist/chunk-4GVV3HBE.mjs.map +1 -0
- package/dist/{chunk-6OTUOEYS.mjs → chunk-7QCZ5NGS.mjs} +2 -2
- package/dist/{chunk-PU6HFINM.mjs → chunk-ABCTEZN5.mjs} +3 -3
- package/dist/{chunk-NOSATNDY.mjs → chunk-IFH3PPSD.mjs} +10 -8
- package/dist/chunk-IFH3PPSD.mjs.map +1 -0
- package/dist/{chunk-REPBXBG3.mjs → chunk-LIBFONYN.mjs} +7 -10
- package/dist/chunk-LIBFONYN.mjs.map +1 -0
- package/dist/{chunk-2UKLSSUA.mjs → chunk-PWV7X7G6.mjs} +4 -4
- package/dist/{chunk-G6SC44LI.mjs → chunk-RK5E5J5E.mjs} +4 -4
- package/dist/{chunk-ZNO5RUVT.mjs → chunk-TP5VZFO3.mjs} +1 -1
- package/dist/chunk-TP5VZFO3.mjs.map +1 -0
- package/dist/{chunk-CMFJUJJW.mjs → chunk-UX5QECNB.mjs} +2 -2
- package/dist/{chunk-6II6KCIJ.mjs → chunk-YPKDYYEV.mjs} +4 -4
- package/dist/{chunk-75VF5Q5W.mjs → chunk-ZR77IT3O.mjs} +51 -69
- package/dist/chunk-ZR77IT3O.mjs.map +1 -0
- package/dist/index.js +81 -85
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/multi-autocomplete.d.mts +8 -0
- package/dist/multi-autocomplete.d.ts +8 -0
- package/dist/multi-autocomplete.js +81 -85
- package/dist/multi-autocomplete.js.map +1 -1
- package/dist/multi-autocomplete.mjs +12 -12
- package/dist/use-autocomplete-list.d.mts +2 -1
- package/dist/use-autocomplete-list.d.ts +2 -1
- package/dist/use-autocomplete-list.js +19 -9
- package/dist/use-autocomplete-list.js.map +1 -1
- package/dist/use-autocomplete-list.mjs +2 -2
- 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 +16 -0
- package/dist/use-autocomplete-option.d.ts +16 -0
- package/dist/use-autocomplete-option.js +10 -6
- package/dist/use-autocomplete-option.js.map +1 -1
- package/dist/use-autocomplete-option.mjs +2 -2
- package/dist/use-autocomplete.d.mts +3 -5
- package/dist/use-autocomplete.d.ts +3 -5
- package/dist/use-autocomplete.js +56 -69
- package/dist/use-autocomplete.js.map +1 -1
- package/dist/use-autocomplete.mjs +7 -7
- package/package.json +4 -4
- package/dist/chunk-3A2HEULI.mjs.map +0 -1
- package/dist/chunk-75VF5Q5W.mjs.map +0 -1
- package/dist/chunk-NOSATNDY.mjs.map +0 -1
- package/dist/chunk-PTPJFYGI.mjs.map +0 -1
- package/dist/chunk-REPBXBG3.mjs.map +0 -1
- package/dist/chunk-ZNO5RUVT.mjs.map +0 -1
- /package/dist/{chunk-JYPMXZG4.mjs.map → chunk-2CVB4NO5.mjs.map} +0 -0
- /package/dist/{chunk-6OTUOEYS.mjs.map → chunk-7QCZ5NGS.mjs.map} +0 -0
- /package/dist/{chunk-PU6HFINM.mjs.map → chunk-ABCTEZN5.mjs.map} +0 -0
- /package/dist/{chunk-2UKLSSUA.mjs.map → chunk-PWV7X7G6.mjs.map} +0 -0
- /package/dist/{chunk-G6SC44LI.mjs.map → chunk-RK5E5J5E.mjs.map} +0 -0
- /package/dist/{chunk-CMFJUJJW.mjs.map → chunk-UX5QECNB.mjs.map} +0 -0
- /package/dist/{chunk-6II6KCIJ.mjs.map → chunk-YPKDYYEV.mjs.map} +0 -0
package/dist/use-autocomplete.js
CHANGED
@@ -175,13 +175,17 @@ var useAutocompleteOption = (props) => {
|
|
175
175
|
id,
|
176
176
|
children,
|
177
177
|
closeOnSelect: customCloseOnSelect,
|
178
|
+
disabled,
|
179
|
+
focusable,
|
178
180
|
icon: customIcon,
|
179
181
|
isDisabled,
|
180
182
|
isFocusable,
|
181
183
|
value: optionValue,
|
182
184
|
...computedProps
|
183
185
|
} = { ...optionProps, ...props };
|
184
|
-
|
186
|
+
disabled != null ? disabled : disabled = isDisabled;
|
187
|
+
focusable != null ? focusable : focusable = isFocusable;
|
188
|
+
const trulyDisabled = !!disabled && !focusable;
|
185
189
|
const { descendants, index, register } = useAutocompleteDescendant({
|
186
190
|
disabled: trulyDisabled
|
187
191
|
});
|
@@ -207,7 +211,7 @@ var useAutocompleteOption = (props) => {
|
|
207
211
|
const onClick = (0, import_react2.useCallback)(
|
208
212
|
(ev) => {
|
209
213
|
ev.stopPropagation();
|
210
|
-
if (
|
214
|
+
if (disabled || !isTargetOption(ev.currentTarget)) {
|
211
215
|
if (inputRef.current) inputRef.current.focus();
|
212
216
|
return;
|
213
217
|
}
|
@@ -221,7 +225,7 @@ var useAutocompleteOption = (props) => {
|
|
221
225
|
isDuplicated,
|
222
226
|
onFocusNext,
|
223
227
|
omitSelectedValues,
|
224
|
-
|
228
|
+
disabled,
|
225
229
|
optionValue,
|
226
230
|
setFocusedIndex,
|
227
231
|
index,
|
@@ -253,10 +257,10 @@ var useAutocompleteOption = (props) => {
|
|
253
257
|
...props2,
|
254
258
|
id,
|
255
259
|
style: isHidden ? style : void 0,
|
256
|
-
"aria-disabled": (0, import_utils3.ariaAttr)(
|
260
|
+
"aria-disabled": (0, import_utils3.ariaAttr)(disabled),
|
257
261
|
"aria-hidden": (0, import_utils3.ariaAttr)(isHidden),
|
258
262
|
"aria-selected": isSelected,
|
259
|
-
"data-disabled": (0, import_utils3.dataAttr)(
|
263
|
+
"data-disabled": (0, import_utils3.dataAttr)(disabled),
|
260
264
|
"data-duplicated": (0, import_utils3.dataAttr)(isDuplicated),
|
261
265
|
"data-focus": (0, import_utils3.dataAttr)(isFocused),
|
262
266
|
"data-target": (0, import_utils3.dataAttr)(true),
|
@@ -270,7 +274,7 @@ var useAutocompleteOption = (props) => {
|
|
270
274
|
isDuplicated,
|
271
275
|
optionValue,
|
272
276
|
computedProps,
|
273
|
-
|
277
|
+
disabled,
|
274
278
|
isFocused,
|
275
279
|
isSelected,
|
276
280
|
isTarget,
|
@@ -584,8 +588,8 @@ var defaultFormat = (value) => {
|
|
584
588
|
var flattenItems = (items) => {
|
585
589
|
const filterItems = (items2) => items2.map((item) => {
|
586
590
|
var _a;
|
587
|
-
const {
|
588
|
-
const trulyDisabled = !!
|
591
|
+
const { disabled, focusable } = item;
|
592
|
+
const trulyDisabled = !!disabled && !focusable;
|
589
593
|
if (trulyDisabled) return;
|
590
594
|
if ("items" in item) {
|
591
595
|
return filterItems((_a = item.items) != null ? _a : []);
|
@@ -596,6 +600,7 @@ var flattenItems = (items) => {
|
|
596
600
|
return filterItems(items).flat(Infinity);
|
597
601
|
};
|
598
602
|
var useAutocomplete = (props) => {
|
603
|
+
var _a;
|
599
604
|
const {
|
600
605
|
allowCreate = false,
|
601
606
|
allowFree = false,
|
@@ -639,16 +644,8 @@ var useAutocomplete = (props) => {
|
|
639
644
|
onSearch: onSearchProp,
|
640
645
|
...rest
|
641
646
|
} = (0, import_form_control.useFormControlProps)(props);
|
642
|
-
const {
|
643
|
-
"aria-readonly": _ariaReadonly,
|
644
|
-
onFocus: onFocusProp,
|
645
|
-
...formControlProps
|
646
|
-
} = (0, import_utils7.pickObject)(rest, import_form_control.formControlProperties);
|
647
|
-
const [containerProps, inputProps] = (0, import_utils7.splitObject)(rest, import_core5.layoutStyleProperties);
|
648
|
-
const { id } = rest;
|
649
647
|
const descendants = useAutocompleteDescendants();
|
650
648
|
const containerRef = (0, import_react4.useRef)(null);
|
651
|
-
const listRef = (0, import_react4.useRef)(null);
|
652
649
|
const inputRef = (0, import_react4.useRef)(null);
|
653
650
|
const timeoutIds = (0, import_react4.useRef)(/* @__PURE__ */ new Set([]));
|
654
651
|
const isComposition = (0, import_react4.useRef)(false);
|
@@ -674,6 +671,12 @@ var useAutocomplete = (props) => {
|
|
674
671
|
onClose: onCloseProp,
|
675
672
|
onOpen: onOpenProp
|
676
673
|
});
|
674
|
+
const {
|
675
|
+
"aria-readonly": _ariaReadonly,
|
676
|
+
onFocus: onFocusProp,
|
677
|
+
...formControlProps
|
678
|
+
} = (0, import_utils7.pickObject)(rest, import_form_control.formControlProperties);
|
679
|
+
const [containerProps, inputProps] = (0, import_utils7.splitObject)(rest, import_core5.layoutStyleProperties);
|
677
680
|
const isFocused = focusedIndex > -1;
|
678
681
|
const isCreate = focusedIndex === -2 && allowCreate;
|
679
682
|
const isMulti = (0, import_utils7.isArray)(value);
|
@@ -692,14 +695,15 @@ var useAutocomplete = (props) => {
|
|
692
695
|
}
|
693
696
|
const selectedValues = descendants.enabledValues(
|
694
697
|
({ node }) => {
|
695
|
-
var
|
696
|
-
return isMulti && value.includes((
|
698
|
+
var _a2;
|
699
|
+
return isMulti && value.includes((_a2 = node.dataset.value) != null ? _a2 : "");
|
697
700
|
}
|
698
701
|
);
|
699
702
|
const selectedIndexes = selectedValues.map(({ index }) => index);
|
700
703
|
const enabledValues = descendants.enabledValues(
|
701
704
|
({ index, node }) => "target" in node.dataset && !selectedIndexes.includes(index)
|
702
705
|
);
|
706
|
+
const activedescendantId = (_a = descendants.value(focusedIndex)) == null ? void 0 : _a.node.id;
|
703
707
|
const validChildren = (0, import_utils7.getValidChildren)(children);
|
704
708
|
const computedChildren = (0, import_react4.useMemo)(
|
705
709
|
() => resolvedItems == null ? void 0 : resolvedItems.map((item, index) => {
|
@@ -729,8 +733,8 @@ var useAutocomplete = (props) => {
|
|
729
733
|
if (inputRef.current) inputRef.current.focus();
|
730
734
|
}, [allowCreate, formControlProps, isAllSelected, isEmpty, onInternalOpen]);
|
731
735
|
const onFocusFirst = (0, import_react4.useCallback)(() => {
|
732
|
-
const
|
733
|
-
var
|
736
|
+
const id = setTimeout(() => {
|
737
|
+
var _a2;
|
734
738
|
if (isEmpty || isAllSelected) return;
|
735
739
|
const first = descendants.enabledFirstValue(
|
736
740
|
({ node }) => "target" in node.dataset
|
@@ -741,13 +745,13 @@ var useAutocomplete = (props) => {
|
|
741
745
|
} else {
|
742
746
|
if (selectedIndexes.includes(first.index)) {
|
743
747
|
const enabledFirst = enabledValues[0];
|
744
|
-
setFocusedIndex((
|
748
|
+
setFocusedIndex((_a2 = enabledFirst == null ? void 0 : enabledFirst.index) != null ? _a2 : -1);
|
745
749
|
} else {
|
746
750
|
setFocusedIndex(first.index);
|
747
751
|
}
|
748
752
|
}
|
749
753
|
});
|
750
|
-
timeoutIds.current.add(
|
754
|
+
timeoutIds.current.add(id);
|
751
755
|
}, [
|
752
756
|
descendants,
|
753
757
|
enabledValues,
|
@@ -758,8 +762,8 @@ var useAutocomplete = (props) => {
|
|
758
762
|
selectedIndexes
|
759
763
|
]);
|
760
764
|
const onFocusLast = (0, import_react4.useCallback)(() => {
|
761
|
-
const
|
762
|
-
var
|
765
|
+
const id = setTimeout(() => {
|
766
|
+
var _a2;
|
763
767
|
if (isEmpty || isAllSelected) return;
|
764
768
|
const last = descendants.enabledLastValue(
|
765
769
|
({ node }) => "target" in node.dataset
|
@@ -770,13 +774,13 @@ var useAutocomplete = (props) => {
|
|
770
774
|
} else {
|
771
775
|
if (selectedIndexes.includes(last.index)) {
|
772
776
|
const enabledLast = enabledValues.reverse()[0];
|
773
|
-
setFocusedIndex((
|
777
|
+
setFocusedIndex((_a2 = enabledLast == null ? void 0 : enabledLast.index) != null ? _a2 : -1);
|
774
778
|
} else {
|
775
779
|
setFocusedIndex(last.index);
|
776
780
|
}
|
777
781
|
}
|
778
782
|
});
|
779
|
-
timeoutIds.current.add(
|
783
|
+
timeoutIds.current.add(id);
|
780
784
|
}, [
|
781
785
|
descendants,
|
782
786
|
enabledValues,
|
@@ -787,22 +791,22 @@ var useAutocomplete = (props) => {
|
|
787
791
|
selectedIndexes
|
788
792
|
]);
|
789
793
|
const onFocusSelected = (0, import_react4.useCallback)(() => {
|
790
|
-
const
|
794
|
+
const id = setTimeout(() => {
|
791
795
|
const values = descendants.enabledValues();
|
792
796
|
const selected = values.find(
|
793
797
|
({ node }) => {
|
794
|
-
var
|
795
|
-
return !isMulti ? node.dataset.value === value : value.includes((
|
798
|
+
var _a2;
|
799
|
+
return !isMulti ? node.dataset.value === value : value.includes((_a2 = node.dataset.value) != null ? _a2 : "");
|
796
800
|
}
|
797
801
|
);
|
798
802
|
if (selected) setFocusedIndex(selected.index);
|
799
803
|
});
|
800
|
-
timeoutIds.current.add(
|
804
|
+
timeoutIds.current.add(id);
|
801
805
|
}, [descendants, isMulti, value]);
|
802
806
|
const onFocusNext = (0, import_react4.useCallback)(
|
803
807
|
(index = focusedIndex) => {
|
804
|
-
const
|
805
|
-
var
|
808
|
+
const id = setTimeout(() => {
|
809
|
+
var _a2, _b;
|
806
810
|
const next = descendants.enabledNextValue(
|
807
811
|
index,
|
808
812
|
({ node }) => "target" in node.dataset
|
@@ -812,14 +816,14 @@ var useAutocomplete = (props) => {
|
|
812
816
|
setFocusedIndex(next.index);
|
813
817
|
} else {
|
814
818
|
if (selectedIndexes.includes(next.index)) {
|
815
|
-
const enabledNext = (
|
819
|
+
const enabledNext = (_a2 = enabledValues.find(({ index: index2 }) => next.index < index2)) != null ? _a2 : enabledValues[0];
|
816
820
|
setFocusedIndex((_b = enabledNext == null ? void 0 : enabledNext.index) != null ? _b : -1);
|
817
821
|
} else {
|
818
822
|
setFocusedIndex(next.index);
|
819
823
|
}
|
820
824
|
}
|
821
825
|
});
|
822
|
-
timeoutIds.current.add(
|
826
|
+
timeoutIds.current.add(id);
|
823
827
|
},
|
824
828
|
[
|
825
829
|
descendants,
|
@@ -832,8 +836,8 @@ var useAutocomplete = (props) => {
|
|
832
836
|
);
|
833
837
|
const onFocusPrev = (0, import_react4.useCallback)(
|
834
838
|
(index = focusedIndex) => {
|
835
|
-
const
|
836
|
-
var
|
839
|
+
const id = setTimeout(() => {
|
840
|
+
var _a2, _b;
|
837
841
|
const prev = descendants.enabledPrevValue(
|
838
842
|
index,
|
839
843
|
({ node }) => "target" in node.dataset
|
@@ -843,14 +847,14 @@ var useAutocomplete = (props) => {
|
|
843
847
|
setFocusedIndex(prev.index);
|
844
848
|
} else {
|
845
849
|
if (selectedIndexes.includes(prev.index)) {
|
846
|
-
const enabledPrev = (
|
850
|
+
const enabledPrev = (_a2 = enabledValues.reverse().find(({ index: index2 }) => index2 < prev.index)) != null ? _a2 : enabledValues[0];
|
847
851
|
setFocusedIndex((_b = enabledPrev == null ? void 0 : enabledPrev.index) != null ? _b : -1);
|
848
852
|
} else {
|
849
853
|
setFocusedIndex(prev.index);
|
850
854
|
}
|
851
855
|
}
|
852
856
|
});
|
853
|
-
timeoutIds.current.add(
|
857
|
+
timeoutIds.current.add(id);
|
854
858
|
},
|
855
859
|
[
|
856
860
|
descendants,
|
@@ -869,8 +873,8 @@ var useAutocomplete = (props) => {
|
|
869
873
|
let isHit2 = false;
|
870
874
|
let isFocused2 = false;
|
871
875
|
values.forEach(({ index, node }) => {
|
872
|
-
var
|
873
|
-
if (format((
|
876
|
+
var _a2;
|
877
|
+
if (format((_a2 = node.textContent) != null ? _a2 : "").includes(value2)) {
|
874
878
|
isHit2 = true;
|
875
879
|
const isDisabled = "disabled" in node.dataset;
|
876
880
|
node.dataset.target = "";
|
@@ -903,8 +907,8 @@ var useAutocomplete = (props) => {
|
|
903
907
|
if (!values.length) return;
|
904
908
|
const resolvedValues = (0, import_utils7.isArray)(newValue) ? newValue : [newValue];
|
905
909
|
const selectedLabel = resolvedValues.map((value2) => {
|
906
|
-
var
|
907
|
-
const { node } = (
|
910
|
+
var _a2, _b;
|
911
|
+
const { node } = (_a2 = values.find(({ node: node2 }) => node2.dataset.value === value2)) != null ? _a2 : {};
|
908
912
|
if (node) {
|
909
913
|
const { textContent } = (_b = Array.from(node.children).find(
|
910
914
|
(child) => child.getAttribute("data-label") !== null
|
@@ -941,9 +945,9 @@ var useAutocomplete = (props) => {
|
|
941
945
|
[isMulti, rebirthOptions, setValue]
|
942
946
|
);
|
943
947
|
const onSelect = (0, import_react4.useCallback)(() => {
|
944
|
-
var
|
948
|
+
var _a2, _b;
|
945
949
|
let enabledValue = descendants.value(focusedIndex);
|
946
|
-
if ("disabled" in ((
|
950
|
+
if ("disabled" in ((_a2 = enabledValue == null ? void 0 : enabledValue.node.dataset) != null ? _a2 : {}))
|
947
951
|
enabledValue = void 0;
|
948
952
|
if (!enabledValue) return;
|
949
953
|
const value2 = (_b = enabledValue.node.dataset.value) != null ? _b : "";
|
@@ -981,8 +985,7 @@ var useAutocomplete = (props) => {
|
|
981
985
|
isComposition.current = false;
|
982
986
|
}, []);
|
983
987
|
const onCreate = (0, import_react4.useCallback)(() => {
|
984
|
-
var
|
985
|
-
if (!listRef.current) return;
|
988
|
+
var _a2, _b;
|
986
989
|
const newItem = { label: inputValue, value: inputValue };
|
987
990
|
let newItems = [];
|
988
991
|
if (resolvedItems) newItems = [...resolvedItems];
|
@@ -997,7 +1000,7 @@ var useAutocomplete = (props) => {
|
|
997
1000
|
const targetItem = newItems[i];
|
998
1001
|
if (i !== -1 && targetItem && "items" in targetItem) {
|
999
1002
|
if (secondInsertPositionItem === "first") {
|
1000
|
-
targetItem.items = [newItem, ...(
|
1003
|
+
targetItem.items = [newItem, ...(_a2 = targetItem.items) != null ? _a2 : []];
|
1001
1004
|
} else {
|
1002
1005
|
targetItem.items = [...(_b = targetItem.items) != null ? _b : [], newItem];
|
1003
1006
|
}
|
@@ -1154,7 +1157,7 @@ var useAutocomplete = (props) => {
|
|
1154
1157
|
setResolvedItems(items ? JSON.parse(JSON.stringify(items)) : void 0);
|
1155
1158
|
}, [items]);
|
1156
1159
|
(0, import_utils7.useUnmountEffect)(() => {
|
1157
|
-
timeoutIds.current.forEach((
|
1160
|
+
timeoutIds.current.forEach((id) => clearTimeout(id));
|
1158
1161
|
timeoutIds.current.clear();
|
1159
1162
|
});
|
1160
1163
|
(0, import_use_outside_click.useOutsideClick)({
|
@@ -1225,6 +1228,10 @@ var useAutocomplete = (props) => {
|
|
1225
1228
|
const getFieldProps = (0, import_react4.useCallback)(
|
1226
1229
|
(props2 = {}, ref = null) => ({
|
1227
1230
|
ref,
|
1231
|
+
"aria-activedescendant": activedescendantId,
|
1232
|
+
"aria-autocomplete": "list",
|
1233
|
+
"aria-haspopup": "listbox",
|
1234
|
+
role: "combobox",
|
1228
1235
|
tabIndex: -1,
|
1229
1236
|
...props2,
|
1230
1237
|
...formControlProps,
|
@@ -1234,6 +1241,7 @@ var useAutocomplete = (props) => {
|
|
1234
1241
|
onKeyDown: (0, import_utils7.handlerAll)(props2.onKeyDown, onKeyDownProp, onKeyDown)
|
1235
1242
|
}),
|
1236
1243
|
[
|
1244
|
+
activedescendantId,
|
1237
1245
|
formControlProps,
|
1238
1246
|
placeholder,
|
1239
1247
|
isOpen,
|
@@ -1244,7 +1252,6 @@ var useAutocomplete = (props) => {
|
|
1244
1252
|
]
|
1245
1253
|
);
|
1246
1254
|
return {
|
1247
|
-
id,
|
1248
1255
|
allowCreate,
|
1249
1256
|
allowFree,
|
1250
1257
|
children: children != null ? children : computedChildren,
|
@@ -1259,7 +1266,6 @@ var useAutocomplete = (props) => {
|
|
1259
1266
|
isHit,
|
1260
1267
|
isOpen,
|
1261
1268
|
label,
|
1262
|
-
listRef,
|
1263
1269
|
omitSelectedValues,
|
1264
1270
|
pickOptions,
|
1265
1271
|
rebirthOptions,
|
@@ -1287,23 +1293,15 @@ var useAutocomplete = (props) => {
|
|
1287
1293
|
};
|
1288
1294
|
};
|
1289
1295
|
var useAutocompleteInput = () => {
|
1290
|
-
var _a, _b;
|
1291
1296
|
const {
|
1292
|
-
id,
|
1293
|
-
focusedIndex,
|
1294
1297
|
inputRef,
|
1295
1298
|
isAllSelected,
|
1296
|
-
isOpen,
|
1297
|
-
listRef,
|
1298
1299
|
formControlProps,
|
1299
1300
|
inputProps,
|
1300
1301
|
onCompositionEnd,
|
1301
1302
|
onCompositionStart,
|
1302
1303
|
onSearch
|
1303
1304
|
} = useAutocompleteContext();
|
1304
|
-
const descendants = useAutocompleteDescendantsContext();
|
1305
|
-
const activedescendantId = (_a = descendants.value(focusedIndex)) == null ? void 0 : _a.node.id;
|
1306
|
-
const listId = (_b = listRef.current) == null ? void 0 : _b.id;
|
1307
1305
|
(0, import_utils7.useUpdateEffect)(() => {
|
1308
1306
|
if (isAllSelected && inputRef.current) inputRef.current.blur();
|
1309
1307
|
}, [isAllSelected]);
|
@@ -1312,19 +1310,12 @@ var useAutocompleteInput = () => {
|
|
1312
1310
|
return {
|
1313
1311
|
ref: (0, import_utils7.mergeRefs)(inputRef, ref),
|
1314
1312
|
...formControlProps,
|
1315
|
-
"aria-activedescendant": activedescendantId,
|
1316
|
-
"aria-autocomplete": "list",
|
1317
|
-
"aria-controls": listId,
|
1318
|
-
"aria-expanded": isOpen,
|
1319
|
-
"aria-haspopup": "listbox",
|
1320
1313
|
autoCapitalize: "none",
|
1321
1314
|
autoComplete: "off",
|
1322
|
-
role: "combobox",
|
1323
1315
|
spellCheck: "false",
|
1324
1316
|
tabIndex: isAllSelected ? -1 : 0,
|
1325
1317
|
...inputProps,
|
1326
1318
|
...props,
|
1327
|
-
id,
|
1328
1319
|
cursor: formControlProps.readOnly ? "default" : "text",
|
1329
1320
|
pointerEvents: formControlProps.disabled || isAllSelected ? "none" : "auto",
|
1330
1321
|
onChange: (0, import_utils7.handlerAll)(props.onChange, onSearch),
|
@@ -1341,13 +1332,9 @@ var useAutocompleteInput = () => {
|
|
1341
1332
|
};
|
1342
1333
|
},
|
1343
1334
|
[
|
1344
|
-
listId,
|
1345
|
-
activedescendantId,
|
1346
|
-
isOpen,
|
1347
1335
|
inputProps,
|
1348
1336
|
inputRef,
|
1349
1337
|
formControlProps,
|
1350
|
-
id,
|
1351
1338
|
isAllSelected,
|
1352
1339
|
onSearch,
|
1353
1340
|
onCompositionStart,
|