@react-spectrum/autocomplete 3.0.0-nightly.3599 → 3.0.0-nightly.3600
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/main.css +1 -1
- package/dist/main.js +241 -218
- package/dist/main.js.map +1 -1
- package/dist/module.mjs +241 -218
- package/dist/module.mjs.map +1 -1
- package/package.json +29 -29
package/dist/module.mjs
CHANGED
|
@@ -29,7 +29,28 @@ function $parcel$interopDefault(a) {
|
|
|
29
29
|
function $parcel$export(e, n, v, s) {
|
|
30
30
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
/*
|
|
33
|
+
* Copyright 2021 Adobe. All rights reserved.
|
|
34
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
36
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
37
|
+
*
|
|
38
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
39
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
40
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
41
|
+
* governing permissions and limitations under the License.
|
|
42
|
+
*/ /// <reference types="css-module-types" />
|
|
43
|
+
/*
|
|
44
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
45
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
46
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
47
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
48
|
+
*
|
|
49
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
50
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
51
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
52
|
+
* governing permissions and limitations under the License.
|
|
53
|
+
*/
|
|
33
54
|
|
|
34
55
|
|
|
35
56
|
|
|
@@ -380,7 +401,17 @@ $06f6e8ce74a28744$exports = {
|
|
|
380
401
|
|
|
381
402
|
|
|
382
403
|
|
|
383
|
-
|
|
404
|
+
/*
|
|
405
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
406
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
407
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
408
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
409
|
+
*
|
|
410
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
411
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
412
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
413
|
+
* governing permissions and limitations under the License.
|
|
414
|
+
*/
|
|
384
415
|
|
|
385
416
|
|
|
386
417
|
|
|
@@ -603,13 +634,12 @@ $c14528ddc146317f$export$d35bc1e505d1ebbf = "is-disabled_73bc77";
|
|
|
603
634
|
|
|
604
635
|
|
|
605
636
|
function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
606
|
-
props = $aQREU$useProviderProps(props);
|
|
607
|
-
let { isQuiet: isQuiet , isDisabled: isDisabled , validationState: validationState , isReadOnly: isReadOnly , onSubmit: onSubmit = ()=>{
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
sensitivity: 'base'
|
|
637
|
+
props = (0, $aQREU$useProviderProps)(props);
|
|
638
|
+
let { isQuiet: isQuiet , isDisabled: isDisabled , validationState: validationState , isReadOnly: isReadOnly , onSubmit: onSubmit = ()=>{} } = props;
|
|
639
|
+
let { contains: contains } = (0, $aQREU$useFilter)({
|
|
640
|
+
sensitivity: "base"
|
|
611
641
|
});
|
|
612
|
-
let state = $aQREU$useComboBoxState({
|
|
642
|
+
let state = (0, $aQREU$useComboBoxState)({
|
|
613
643
|
...props,
|
|
614
644
|
defaultFilter: contains,
|
|
615
645
|
allowsEmptyCollection: true,
|
|
@@ -618,35 +648,34 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
618
648
|
// then the closing of the tray will call setFocused(false) again due to cleanup effect)
|
|
619
649
|
shouldCloseOnBlur: false,
|
|
620
650
|
allowsCustomValue: true,
|
|
621
|
-
onSelectionChange: (key)=>key !== null && onSubmit(null, key)
|
|
622
|
-
,
|
|
651
|
+
onSelectionChange: (key)=>key !== null && onSubmit(null, key),
|
|
623
652
|
selectedKey: undefined,
|
|
624
653
|
defaultSelectedKey: undefined
|
|
625
654
|
});
|
|
626
|
-
let buttonRef = $aQREU$useRef(null);
|
|
627
|
-
let domRef = $aQREU$useFocusableRef(ref, buttonRef);
|
|
628
|
-
let { triggerProps: triggerProps , overlayProps: overlayProps } = $aQREU$useOverlayTrigger({
|
|
629
|
-
type:
|
|
655
|
+
let buttonRef = (0, $aQREU$useRef)(null);
|
|
656
|
+
let domRef = (0, $aQREU$useFocusableRef)(ref, buttonRef);
|
|
657
|
+
let { triggerProps: triggerProps , overlayProps: overlayProps } = (0, $aQREU$useOverlayTrigger)({
|
|
658
|
+
type: "listbox"
|
|
630
659
|
}, state, buttonRef);
|
|
631
|
-
let { labelProps: labelProps , fieldProps: fieldProps } = $aQREU$useLabel({
|
|
660
|
+
let { labelProps: labelProps , fieldProps: fieldProps } = (0, $aQREU$useLabel)({
|
|
632
661
|
...props,
|
|
633
|
-
labelElementType:
|
|
662
|
+
labelElementType: "span"
|
|
634
663
|
});
|
|
635
664
|
// Focus the button and show focus ring when clicking on the label
|
|
636
665
|
labelProps.onClick = ()=>{
|
|
637
666
|
if (!props.isDisabled && buttonRef.current) {
|
|
638
667
|
buttonRef.current.focus();
|
|
639
|
-
$aQREU$setInteractionModality(
|
|
668
|
+
(0, $aQREU$setInteractionModality)("keyboard");
|
|
640
669
|
}
|
|
641
670
|
};
|
|
642
|
-
return
|
|
671
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$react).Fragment, null, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Field), {
|
|
643
672
|
...props,
|
|
644
673
|
labelProps: labelProps,
|
|
645
674
|
elementType: "span",
|
|
646
675
|
ref: domRef,
|
|
647
676
|
includeNecessityIndicatorInAccessibilityName: true
|
|
648
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($c940f54e16bafef5$var$SearchAutocompleteButton, {
|
|
649
|
-
|
|
677
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement($c940f54e16bafef5$var$SearchAutocompleteButton, {
|
|
678
|
+
...(0, $aQREU$mergeProps)(triggerProps, fieldProps, {
|
|
650
679
|
autoFocus: props.autoFocus,
|
|
651
680
|
icon: props.icon
|
|
652
681
|
}),
|
|
@@ -657,130 +686,128 @@ function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
|
657
686
|
isPlaceholder: !state.inputValue,
|
|
658
687
|
validationState: validationState,
|
|
659
688
|
inputValue: state.inputValue,
|
|
660
|
-
clearInput: ()=>state.setInputValue(
|
|
661
|
-
,
|
|
662
|
-
|
|
663
|
-
}, state.inputValue || props.placeholder || '')), /*#__PURE__*/ $aQREU$react.createElement($aQREU$Tray, {
|
|
689
|
+
clearInput: ()=>state.setInputValue(""),
|
|
690
|
+
onPress: ()=>!isReadOnly && state.open(null, "manual")
|
|
691
|
+
}, state.inputValue || props.placeholder || "")), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Tray), {
|
|
664
692
|
state: state,
|
|
665
693
|
isFixedHeight: true,
|
|
666
694
|
...overlayProps
|
|
667
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($c940f54e16bafef5$var$SearchAutocompleteTray, {
|
|
695
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement($c940f54e16bafef5$var$SearchAutocompleteTray, {
|
|
668
696
|
...props,
|
|
669
697
|
onClose: state.close,
|
|
670
698
|
overlayProps: overlayProps,
|
|
671
699
|
state: state
|
|
672
|
-
})))
|
|
700
|
+
})));
|
|
673
701
|
}
|
|
674
|
-
let $c940f54e16bafef5$export$e7a90f7d6b078162 = /*#__PURE__*/ $aQREU$react.forwardRef($c940f54e16bafef5$var$_MobileSearchAutocomplete);
|
|
702
|
+
let $c940f54e16bafef5$export$e7a90f7d6b078162 = /*#__PURE__*/ (0, $aQREU$react).forwardRef($c940f54e16bafef5$var$_MobileSearchAutocomplete);
|
|
675
703
|
// any type is because we don't want to call useObjectRef because this is an internal component and we know
|
|
676
704
|
// we are always passing an object ref
|
|
677
|
-
const $c940f54e16bafef5$var$SearchAutocompleteButton = /*#__PURE__*/ $aQREU$react.forwardRef(function SearchAutocompleteButton(props,
|
|
678
|
-
let searchIcon = /*#__PURE__*/ $aQREU$react.createElement($aQREU$spectrumiconsuiMagnifier, {
|
|
705
|
+
const $c940f54e16bafef5$var$SearchAutocompleteButton = /*#__PURE__*/ (0, $aQREU$react).forwardRef(function SearchAutocompleteButton(props, ref) {
|
|
706
|
+
let searchIcon = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$spectrumiconsuiMagnifier), {
|
|
679
707
|
"data-testid": "searchicon"
|
|
680
708
|
});
|
|
681
709
|
let { icon: icon = searchIcon , isQuiet: isQuiet , isDisabled: isDisabled , isReadOnly: isReadOnly , isPlaceholder: isPlaceholder , validationState: validationState , inputValue: inputValue , clearInput: clearInput , children: children , style: style , className: className } = props;
|
|
682
|
-
let stringFormatter = $aQREU$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports)));
|
|
683
|
-
let valueId = $aQREU$useId();
|
|
684
|
-
let invalidId = $aQREU$useId();
|
|
685
|
-
let validationIcon = validationState ===
|
|
710
|
+
let stringFormatter = (0, $aQREU$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports))));
|
|
711
|
+
let valueId = (0, $aQREU$useId)();
|
|
712
|
+
let invalidId = (0, $aQREU$useId)();
|
|
713
|
+
let validationIcon = validationState === "invalid" ? /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$spectrumiconsuiAlertMedium), {
|
|
686
714
|
id: invalidId,
|
|
687
|
-
"aria-label": stringFormatter.format(
|
|
688
|
-
}) : /*#__PURE__*/ $aQREU$react.createElement($aQREU$spectrumiconsuiCheckmarkMedium, null);
|
|
689
|
-
if (icon) icon = /*#__PURE__*/ $aQREU$react.cloneElement(icon, {
|
|
690
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
691
|
-
size:
|
|
715
|
+
"aria-label": stringFormatter.format("invalid")
|
|
716
|
+
}) : /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$spectrumiconsuiCheckmarkMedium), null);
|
|
717
|
+
if (icon) icon = /*#__PURE__*/ (0, $aQREU$react).cloneElement(icon, {
|
|
718
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports))), "spectrum-Textfield-icon"),
|
|
719
|
+
size: "S"
|
|
692
720
|
});
|
|
693
|
-
let clearButton = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ClearButton, {
|
|
721
|
+
let clearButton = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ClearButton), {
|
|
694
722
|
onPress: (e)=>{
|
|
695
723
|
var ref;
|
|
696
724
|
clearInput === null || clearInput === void 0 ? void 0 : clearInput();
|
|
697
725
|
props === null || props === void 0 ? void 0 : (ref = props.onPress) === null || ref === void 0 ? void 0 : ref.call(props, e);
|
|
698
726
|
},
|
|
699
727
|
preventFocus: true,
|
|
700
|
-
"aria-label": stringFormatter.format(
|
|
728
|
+
"aria-label": stringFormatter.format("clear"),
|
|
701
729
|
excludeFromTabOrder: true,
|
|
702
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
730
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-ClearButton"),
|
|
703
731
|
isDisabled: isDisabled
|
|
704
732
|
});
|
|
705
|
-
let validation = /*#__PURE__*/ $aQREU$react.cloneElement(validationIcon, {
|
|
706
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
733
|
+
let validation = /*#__PURE__*/ (0, $aQREU$react).cloneElement(validationIcon, {
|
|
734
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports))), "spectrum-Textfield-validationIcon", (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "spectrum-InputGroup-input-validationIcon"))
|
|
707
735
|
});
|
|
708
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $aQREU$useHover({
|
|
709
|
-
});
|
|
710
|
-
let {
|
|
711
|
-
let { buttonProps: buttonProps } = $aQREU$useButton({
|
|
736
|
+
let { hoverProps: hoverProps , isHovered: isHovered } = (0, $aQREU$useHover)({});
|
|
737
|
+
let { isFocused: isFocused , isFocusVisible: isFocusVisible , focusProps: focusProps } = (0, $aQREU$useFocusRing)();
|
|
738
|
+
let { buttonProps: buttonProps } = (0, $aQREU$useButton)({
|
|
712
739
|
...props,
|
|
713
|
-
|
|
714
|
-
props[
|
|
715
|
-
props[
|
|
740
|
+
"aria-labelledby": [
|
|
741
|
+
props["aria-labelledby"],
|
|
742
|
+
props["aria-label"] && !props["aria-labelledby"] ? props.id : null,
|
|
716
743
|
valueId,
|
|
717
|
-
validationState ===
|
|
718
|
-
].filter(Boolean).join(
|
|
719
|
-
elementType:
|
|
720
|
-
},
|
|
721
|
-
return
|
|
722
|
-
|
|
744
|
+
validationState === "invalid" ? invalidId : null
|
|
745
|
+
].filter(Boolean).join(" "),
|
|
746
|
+
elementType: "div"
|
|
747
|
+
}, ref);
|
|
748
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
749
|
+
...(0, $aQREU$mergeProps)(hoverProps, focusProps, buttonProps),
|
|
723
750
|
"aria-haspopup": "dialog",
|
|
724
|
-
ref:
|
|
751
|
+
ref: ref,
|
|
725
752
|
style: {
|
|
726
753
|
...style,
|
|
727
|
-
outline:
|
|
754
|
+
outline: "none"
|
|
728
755
|
},
|
|
729
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
737
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
738
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
756
|
+
className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "spectrum-InputGroup", {
|
|
757
|
+
"spectrum-InputGroup--quiet": isQuiet,
|
|
758
|
+
"is-disabled": isDisabled,
|
|
759
|
+
"spectrum-InputGroup--invalid": validationState === "invalid" && !isDisabled,
|
|
760
|
+
"is-hovered": isHovered,
|
|
761
|
+
"is-focused": isFocused,
|
|
762
|
+
"focus-ring": isFocusVisible
|
|
763
|
+
}, (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "searchautocomplete", "mobile-searchautocomplete"), className)
|
|
764
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
765
|
+
className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports))), "spectrum-Textfield", {
|
|
766
|
+
"spectrum-Textfield--invalid": validationState === "invalid" && !isDisabled,
|
|
767
|
+
"spectrum-Textfield--valid": validationState === "valid" && !isDisabled,
|
|
768
|
+
"spectrum-Textfield--quiet": isQuiet
|
|
769
|
+
}, (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search", {
|
|
770
|
+
"is-disabled": isDisabled,
|
|
771
|
+
"is-quiet": isQuiet,
|
|
772
|
+
"spectrum-Search--invalid": validationState === "invalid" && !isDisabled,
|
|
773
|
+
"spectrum-Search--valid": validationState === "valid" && !isDisabled
|
|
747
774
|
}))
|
|
748
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
749
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
757
|
-
}, icon, /*#__PURE__*/ $aQREU$react.createElement("span", {
|
|
775
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
776
|
+
className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports))), "spectrum-Textfield-input", {
|
|
777
|
+
"spectrum-Textfield-inputIcon": !!icon,
|
|
778
|
+
"is-hovered": isHovered,
|
|
779
|
+
"is-placeholder": isPlaceholder,
|
|
780
|
+
"is-disabled": isDisabled,
|
|
781
|
+
"is-quiet": isQuiet,
|
|
782
|
+
"is-focused": isFocused
|
|
783
|
+
}, (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search-input"), (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "mobile-input"))
|
|
784
|
+
}, icon, /*#__PURE__*/ (0, $aQREU$react).createElement("span", {
|
|
758
785
|
id: valueId,
|
|
759
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
760
|
-
}, children)), validationState && !isDisabled ? validation : null, (inputValue !==
|
|
786
|
+
className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "mobile-value")
|
|
787
|
+
}, children)), validationState && !isDisabled ? validation : null, (inputValue !== "" || validationState != null) && !isReadOnly && clearButton));
|
|
761
788
|
});
|
|
762
789
|
function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
763
|
-
let searchIcon = /*#__PURE__*/ $aQREU$react.createElement($aQREU$spectrumiconsuiMagnifier, {
|
|
790
|
+
let searchIcon = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$spectrumiconsuiMagnifier), {
|
|
764
791
|
"data-testid": "searchicon"
|
|
765
792
|
});
|
|
766
793
|
let { state: // completionMode = 'suggest',
|
|
767
794
|
state , icon: icon = searchIcon , isDisabled: isDisabled , validationState: validationState , label: label , overlayProps: overlayProps , loadingState: loadingState , onLoadMore: onLoadMore , onClose: onClose , onSubmit: onSubmit } = props;
|
|
768
|
-
let timeout = $aQREU$useRef(null);
|
|
769
|
-
let [showLoading, setShowLoading] = $aQREU$useState(false);
|
|
770
|
-
let inputRef = $aQREU$useRef(null);
|
|
771
|
-
let popoverRef = $aQREU$useRef(null);
|
|
772
|
-
let listBoxRef = $aQREU$useRef(null);
|
|
773
|
-
let layout = $aQREU$useListBoxLayout(state);
|
|
774
|
-
let stringFormatter = $aQREU$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports)));
|
|
775
|
-
let { inputProps: inputProps , listBoxProps: listBoxProps , labelProps: labelProps , clearButtonProps: clearButtonProps } = $aQREU$useSearchAutocomplete({
|
|
795
|
+
let timeout = (0, $aQREU$useRef)(null);
|
|
796
|
+
let [showLoading, setShowLoading] = (0, $aQREU$useState)(false);
|
|
797
|
+
let inputRef = (0, $aQREU$useRef)(null);
|
|
798
|
+
let popoverRef = (0, $aQREU$useRef)(null);
|
|
799
|
+
let listBoxRef = (0, $aQREU$useRef)(null);
|
|
800
|
+
let layout = (0, $aQREU$useListBoxLayout)(state);
|
|
801
|
+
let stringFormatter = (0, $aQREU$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports))));
|
|
802
|
+
let { inputProps: inputProps , listBoxProps: listBoxProps , labelProps: labelProps , clearButtonProps: clearButtonProps } = (0, $aQREU$useSearchAutocomplete)({
|
|
776
803
|
...props,
|
|
777
804
|
keyboardDelegate: layout,
|
|
778
805
|
popoverRef: popoverRef,
|
|
779
806
|
listBoxRef: listBoxRef,
|
|
780
807
|
inputRef: inputRef
|
|
781
808
|
}, state);
|
|
782
|
-
$aQREU$react.useEffect(()=>{
|
|
783
|
-
if (inputRef.current) $aQREU$focusSafely(inputRef.current);
|
|
809
|
+
(0, $aQREU$react).useEffect(()=>{
|
|
810
|
+
if (inputRef.current) (0, $aQREU$focusSafely)(inputRef.current);
|
|
784
811
|
// When the tray unmounts, set state.isFocused (i.e. the tray input's focus tracker) to false.
|
|
785
812
|
// This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay
|
|
786
813
|
// (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to "contain")
|
|
@@ -790,42 +817,42 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
790
817
|
};
|
|
791
818
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
792
819
|
}, []);
|
|
793
|
-
let { dialogProps: dialogProps } = $aQREU$useDialog({
|
|
794
|
-
|
|
820
|
+
let { dialogProps: dialogProps } = (0, $aQREU$useDialog)({
|
|
821
|
+
"aria-labelledby": (0, $aQREU$useId)(labelProps.id)
|
|
795
822
|
}, popoverRef);
|
|
796
823
|
// Override the role of the input to "searchbox" instead of "combobox".
|
|
797
824
|
// Since the listbox is always visible, the combobox role doesn't really give us anything.
|
|
798
825
|
// VoiceOver on iOS reads "double tap to collapse" when focused on the input rather than
|
|
799
826
|
// "double tap to edit text", as with a textbox or searchbox. We'd like double tapping to
|
|
800
827
|
// open the virtual keyboard rather than closing the tray.
|
|
801
|
-
inputProps.role =
|
|
802
|
-
inputProps[
|
|
828
|
+
inputProps.role = "searchbox";
|
|
829
|
+
inputProps["aria-haspopup"] = "listbox";
|
|
803
830
|
delete inputProps.onTouchEnd;
|
|
804
|
-
let clearButton = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ClearButton, {
|
|
831
|
+
let clearButton = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ClearButton), {
|
|
805
832
|
...clearButtonProps,
|
|
806
833
|
preventFocus: true,
|
|
807
|
-
"aria-label": stringFormatter.format(
|
|
834
|
+
"aria-label": stringFormatter.format("clear"),
|
|
808
835
|
excludeFromTabOrder: true,
|
|
809
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
836
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-ClearButton"),
|
|
810
837
|
isDisabled: isDisabled
|
|
811
838
|
});
|
|
812
|
-
let loadingCircle = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ProgressCircle, {
|
|
813
|
-
"aria-label": stringFormatter.format(
|
|
839
|
+
let loadingCircle = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ProgressCircle), {
|
|
840
|
+
"aria-label": stringFormatter.format("loading"),
|
|
814
841
|
size: "S",
|
|
815
842
|
isIndeterminate: true,
|
|
816
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
843
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search-circleLoader", (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports))), "spectrum-Textfield-circleLoader"))
|
|
817
844
|
});
|
|
818
845
|
// Close the software keyboard on scroll to give the user a bigger area to scroll.
|
|
819
846
|
// But only do this if scrolling with touch, otherwise it can cause issues with touch
|
|
820
847
|
// screen readers.
|
|
821
|
-
let isTouchDown = $aQREU$useRef(false);
|
|
848
|
+
let isTouchDown = (0, $aQREU$useRef)(false);
|
|
822
849
|
let onTouchStart = ()=>{
|
|
823
850
|
isTouchDown.current = true;
|
|
824
851
|
};
|
|
825
852
|
let onTouchEnd = ()=>{
|
|
826
853
|
isTouchDown.current = false;
|
|
827
854
|
};
|
|
828
|
-
let onScroll = $aQREU$useCallback(()=>{
|
|
855
|
+
let onScroll = (0, $aQREU$useCallback)(()=>{
|
|
829
856
|
if (!inputRef.current || document.activeElement !== inputRef.current || !isTouchDown.current) return;
|
|
830
857
|
if (popoverRef.current) popoverRef.current.focus();
|
|
831
858
|
}, [
|
|
@@ -834,9 +861,9 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
834
861
|
isTouchDown
|
|
835
862
|
]);
|
|
836
863
|
let inputValue = inputProps.value;
|
|
837
|
-
let lastInputValue = $aQREU$useRef(inputValue);
|
|
838
|
-
$aQREU$useEffect(()=>{
|
|
839
|
-
if (loadingState ===
|
|
864
|
+
let lastInputValue = (0, $aQREU$useRef)(inputValue);
|
|
865
|
+
(0, $aQREU$useEffect)(()=>{
|
|
866
|
+
if (loadingState === "filtering" && !showLoading) {
|
|
840
867
|
if (timeout.current === null) timeout.current = setTimeout(()=>{
|
|
841
868
|
setShowLoading(true);
|
|
842
869
|
}, 500);
|
|
@@ -847,7 +874,7 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
847
874
|
setShowLoading(true);
|
|
848
875
|
}, 500);
|
|
849
876
|
}
|
|
850
|
-
} else if (loadingState !==
|
|
877
|
+
} else if (loadingState !== "filtering") {
|
|
851
878
|
// If loading is no longer happening, clear any timers and hide the loading circle
|
|
852
879
|
setShowLoading(false);
|
|
853
880
|
if (timeout.current !== null) {
|
|
@@ -863,27 +890,27 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
863
890
|
]);
|
|
864
891
|
let onKeyDown = (e)=>{
|
|
865
892
|
// Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options
|
|
866
|
-
if (e.key ===
|
|
893
|
+
if (e.key === "Enter" && state.selectionManager.focusedKey == null) {
|
|
867
894
|
var ref;
|
|
868
895
|
(ref = popoverRef.current) === null || ref === void 0 ? void 0 : ref.focus();
|
|
869
896
|
if (onClose) onClose();
|
|
870
897
|
if (onSubmit) onSubmit(inputValue == null ? null : inputValue.toString(), null);
|
|
871
898
|
} else if (inputProps.onKeyDown) inputProps.onKeyDown(e);
|
|
872
899
|
};
|
|
873
|
-
if (icon) icon = /*#__PURE__*/ $aQREU$react.cloneElement(icon, {
|
|
874
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
875
|
-
size:
|
|
900
|
+
if (icon) icon = /*#__PURE__*/ (0, $aQREU$react).cloneElement(icon, {
|
|
901
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports))), "spectrum-Textfield-icon"),
|
|
902
|
+
size: "S"
|
|
876
903
|
});
|
|
877
|
-
return
|
|
904
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$FocusScope), {
|
|
878
905
|
restoreFocus: true,
|
|
879
906
|
contain: true
|
|
880
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
881
|
-
|
|
907
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
908
|
+
...(0, $aQREU$mergeProps)(overlayProps, dialogProps),
|
|
882
909
|
ref: popoverRef,
|
|
883
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
884
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($aQREU$DismissButton, {
|
|
910
|
+
className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "tray-dialog")
|
|
911
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$DismissButton), {
|
|
885
912
|
onDismiss: onClose
|
|
886
|
-
}), /*#__PURE__*/ $aQREU$react.createElement($aQREU$TextFieldBase, {
|
|
913
|
+
}), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$TextFieldBase), {
|
|
887
914
|
label: label,
|
|
888
915
|
labelProps: labelProps,
|
|
889
916
|
inputProps: {
|
|
@@ -892,20 +919,20 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
892
919
|
},
|
|
893
920
|
inputRef: inputRef,
|
|
894
921
|
isDisabled: isDisabled,
|
|
895
|
-
isLoading: showLoading && loadingState ===
|
|
922
|
+
isLoading: showLoading && loadingState === "filtering",
|
|
896
923
|
loadingIndicator: loadingState != null ? loadingCircle : undefined,
|
|
897
924
|
validationState: validationState,
|
|
898
|
-
wrapperChildren: (state.inputValue !==
|
|
925
|
+
wrapperChildren: (state.inputValue !== "" || loadingState === "filtering" || validationState != null) && !props.isReadOnly ? clearButton : undefined,
|
|
899
926
|
icon: icon,
|
|
900
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
904
|
-
|
|
927
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search", "spectrum-Textfield", "spectrum-Search--loadable", {
|
|
928
|
+
"spectrum-Search--invalid": validationState === "invalid" && !isDisabled,
|
|
929
|
+
"spectrum-Search--valid": validationState === "valid" && !isDisabled
|
|
930
|
+
}, (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "tray-textfield", {
|
|
931
|
+
"has-label": !!props.label
|
|
905
932
|
})),
|
|
906
|
-
inputClassName: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
907
|
-
validationIconClassName: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
908
|
-
}), /*#__PURE__*/ $aQREU$react.createElement($aQREU$ListBoxBase, {
|
|
933
|
+
inputClassName: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search-input"),
|
|
934
|
+
validationIconClassName: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search-validationIcon")
|
|
935
|
+
}), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ListBoxBase), {
|
|
909
936
|
...listBoxProps,
|
|
910
937
|
domProps: {
|
|
911
938
|
onTouchStart: onTouchStart,
|
|
@@ -917,18 +944,17 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
917
944
|
layout: layout,
|
|
918
945
|
state: state,
|
|
919
946
|
shouldUseVirtualFocus: true,
|
|
920
|
-
renderEmptyState: ()=>loadingState !==
|
|
921
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
922
|
-
}, stringFormatter.format(
|
|
923
|
-
,
|
|
924
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)), 'tray-listbox'),
|
|
947
|
+
renderEmptyState: ()=>loadingState !== "loading" && /*#__PURE__*/ (0, $aQREU$react).createElement("span", {
|
|
948
|
+
className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "no-results")
|
|
949
|
+
}, stringFormatter.format("noResults")),
|
|
950
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "tray-listbox"),
|
|
925
951
|
ref: listBoxRef,
|
|
926
952
|
onScroll: onScroll,
|
|
927
953
|
onLoadMore: onLoadMore,
|
|
928
|
-
isLoading: loadingState ===
|
|
929
|
-
}), /*#__PURE__*/ $aQREU$react.createElement($aQREU$DismissButton, {
|
|
954
|
+
isLoading: loadingState === "loading" || loadingState === "loadingMore"
|
|
955
|
+
}), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$DismissButton), {
|
|
930
956
|
onDismiss: onClose
|
|
931
|
-
})))
|
|
957
|
+
})));
|
|
932
958
|
}
|
|
933
959
|
|
|
934
960
|
|
|
@@ -947,46 +973,44 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
947
973
|
|
|
948
974
|
|
|
949
975
|
function $f3f3b62273a2d260$var$SearchAutocomplete(props, ref) {
|
|
950
|
-
props = $aQREU$useProviderProps(props);
|
|
951
|
-
if (props.placeholder) console.warn(
|
|
952
|
-
let isMobile = $aQREU$useIsMobileDevice();
|
|
976
|
+
props = (0, $aQREU$useProviderProps)(props);
|
|
977
|
+
if (props.placeholder) console.warn("Placeholders are deprecated due to accessibility issues. Please use help text instead.");
|
|
978
|
+
let isMobile = (0, $aQREU$useIsMobileDevice)();
|
|
953
979
|
if (isMobile) // menuTrigger=focus/manual don't apply to mobile searchwithin
|
|
954
|
-
return
|
|
980
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $c940f54e16bafef5$export$e7a90f7d6b078162), {
|
|
955
981
|
...props,
|
|
956
982
|
menuTrigger: "input",
|
|
957
983
|
ref: ref
|
|
958
|
-
})
|
|
959
|
-
else return
|
|
984
|
+
});
|
|
985
|
+
else return /*#__PURE__*/ (0, $aQREU$react).createElement($f3f3b62273a2d260$var$SearchAutocompleteBase, {
|
|
960
986
|
...props,
|
|
961
987
|
ref: ref
|
|
962
|
-
})
|
|
988
|
+
});
|
|
963
989
|
}
|
|
964
990
|
function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
|
|
965
|
-
props = $aQREU$useProviderProps(props);
|
|
966
|
-
let { menuTrigger: menuTrigger =
|
|
967
|
-
|
|
968
|
-
let stringFormatter = $aQREU$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports)));
|
|
991
|
+
props = (0, $aQREU$useProviderProps)(props);
|
|
992
|
+
let { menuTrigger: menuTrigger = "input" , shouldFlip: shouldFlip = true , direction: direction = "bottom" , isQuiet: isQuiet , loadingState: loadingState , onLoadMore: onLoadMore , onSubmit: onSubmit = ()=>{} } = props;
|
|
993
|
+
let stringFormatter = (0, $aQREU$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports))));
|
|
969
994
|
let isAsync = loadingState != null;
|
|
970
|
-
let popoverRef = $aQREU$useRef(null);
|
|
971
|
-
let unwrappedPopoverRef = $aQREU$useUnwrapDOMRef(popoverRef);
|
|
972
|
-
let listBoxRef = $aQREU$useRef(null);
|
|
973
|
-
let inputRef = $aQREU$useRef(null);
|
|
974
|
-
let domRef = $aQREU$useFocusableRef(ref, inputRef);
|
|
975
|
-
let { contains: contains } = $aQREU$useFilter({
|
|
976
|
-
sensitivity:
|
|
995
|
+
let popoverRef = (0, $aQREU$useRef)(null);
|
|
996
|
+
let unwrappedPopoverRef = (0, $aQREU$useUnwrapDOMRef)(popoverRef);
|
|
997
|
+
let listBoxRef = (0, $aQREU$useRef)(null);
|
|
998
|
+
let inputRef = (0, $aQREU$useRef)(null);
|
|
999
|
+
let domRef = (0, $aQREU$useFocusableRef)(ref, inputRef);
|
|
1000
|
+
let { contains: contains } = (0, $aQREU$useFilter)({
|
|
1001
|
+
sensitivity: "base"
|
|
977
1002
|
});
|
|
978
|
-
let state = $aQREU$useComboBoxState({
|
|
1003
|
+
let state = (0, $aQREU$useComboBoxState)({
|
|
979
1004
|
...props,
|
|
980
1005
|
defaultFilter: contains,
|
|
981
1006
|
allowsEmptyCollection: isAsync,
|
|
982
1007
|
allowsCustomValue: true,
|
|
983
|
-
onSelectionChange: (key)=>key !== null && onSubmit(null, key)
|
|
984
|
-
,
|
|
1008
|
+
onSelectionChange: (key)=>key !== null && onSubmit(null, key),
|
|
985
1009
|
selectedKey: undefined,
|
|
986
1010
|
defaultSelectedKey: undefined
|
|
987
1011
|
});
|
|
988
|
-
let layout = $aQREU$useListBoxLayout(state);
|
|
989
|
-
let { inputProps: inputProps , listBoxProps: listBoxProps , labelProps: labelProps , clearButtonProps: clearButtonProps } = $aQREU$useSearchAutocomplete({
|
|
1012
|
+
let layout = (0, $aQREU$useListBoxLayout)(state);
|
|
1013
|
+
let { inputProps: inputProps , listBoxProps: listBoxProps , labelProps: labelProps , clearButtonProps: clearButtonProps } = (0, $aQREU$useSearchAutocomplete)({
|
|
990
1014
|
...props,
|
|
991
1015
|
keyboardDelegate: layout,
|
|
992
1016
|
popoverRef: unwrappedPopoverRef,
|
|
@@ -995,9 +1019,9 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
|
|
|
995
1019
|
menuTrigger: menuTrigger
|
|
996
1020
|
}, state);
|
|
997
1021
|
// Measure the width of the inputfield to inform the width of the menu (below).
|
|
998
|
-
let [menuWidth, setMenuWidth] = $aQREU$useState(0);
|
|
999
|
-
let { scale: scale } = $aQREU$useProvider();
|
|
1000
|
-
let onResize = $aQREU$useCallback(()=>{
|
|
1022
|
+
let [menuWidth, setMenuWidth] = (0, $aQREU$useState)(0);
|
|
1023
|
+
let { scale: scale } = (0, $aQREU$useProvider)();
|
|
1024
|
+
let onResize = (0, $aQREU$useCallback)(()=>{
|
|
1001
1025
|
if (inputRef.current) {
|
|
1002
1026
|
let inputWidth = inputRef.current.offsetWidth;
|
|
1003
1027
|
setMenuWidth(inputWidth);
|
|
@@ -1006,11 +1030,11 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
|
|
|
1006
1030
|
inputRef,
|
|
1007
1031
|
setMenuWidth
|
|
1008
1032
|
]);
|
|
1009
|
-
$aQREU$useResizeObserver({
|
|
1033
|
+
(0, $aQREU$useResizeObserver)({
|
|
1010
1034
|
ref: domRef,
|
|
1011
1035
|
onResize: onResize
|
|
1012
1036
|
});
|
|
1013
|
-
$aQREU$useLayoutEffect(onResize, [
|
|
1037
|
+
(0, $aQREU$useLayoutEffect)(onResize, [
|
|
1014
1038
|
scale,
|
|
1015
1039
|
onResize
|
|
1016
1040
|
]);
|
|
@@ -1018,22 +1042,22 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
|
|
|
1018
1042
|
width: isQuiet ? undefined : menuWidth,
|
|
1019
1043
|
minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
|
|
1020
1044
|
};
|
|
1021
|
-
return
|
|
1045
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$react).Fragment, null, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Field), {
|
|
1022
1046
|
...props,
|
|
1023
1047
|
labelProps: labelProps,
|
|
1024
1048
|
ref: domRef
|
|
1025
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($f3f3b62273a2d260$var$SearchAutocompleteInput, {
|
|
1049
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement($f3f3b62273a2d260$var$SearchAutocompleteInput, {
|
|
1026
1050
|
...props,
|
|
1027
1051
|
isOpen: state.isOpen,
|
|
1028
1052
|
loadingState: loadingState,
|
|
1029
1053
|
inputProps: inputProps,
|
|
1030
1054
|
inputRef: inputRef,
|
|
1031
1055
|
clearButtonProps: clearButtonProps
|
|
1032
|
-
})), /*#__PURE__*/ $aQREU$react.createElement($aQREU$Popover, {
|
|
1056
|
+
})), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Popover), {
|
|
1033
1057
|
state: state,
|
|
1034
1058
|
UNSAFE_style: style,
|
|
1035
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1036
|
-
|
|
1059
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "spectrum-InputGroup-popover", {
|
|
1060
|
+
"spectrum-InputGroup-popover--quiet": isQuiet
|
|
1037
1061
|
}),
|
|
1038
1062
|
ref: popoverRef,
|
|
1039
1063
|
triggerRef: inputRef,
|
|
@@ -1041,7 +1065,7 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
|
|
|
1041
1065
|
hideArrow: true,
|
|
1042
1066
|
isNonModal: true,
|
|
1043
1067
|
shouldFlip: shouldFlip
|
|
1044
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($aQREU$ListBoxBase, {
|
|
1068
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ListBoxBase), {
|
|
1045
1069
|
...listBoxProps,
|
|
1046
1070
|
ref: listBoxRef,
|
|
1047
1071
|
disallowEmptySelection: true,
|
|
@@ -1051,40 +1075,39 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
|
|
|
1051
1075
|
layout: layout,
|
|
1052
1076
|
state: state,
|
|
1053
1077
|
shouldUseVirtualFocus: true,
|
|
1054
|
-
isLoading: loadingState ===
|
|
1078
|
+
isLoading: loadingState === "loadingMore",
|
|
1055
1079
|
onLoadMore: onLoadMore,
|
|
1056
|
-
renderEmptyState: ()=>isAsync && /*#__PURE__*/ $aQREU$react.createElement("span", null, stringFormatter.format(
|
|
1057
|
-
})))
|
|
1080
|
+
renderEmptyState: ()=>isAsync && /*#__PURE__*/ (0, $aQREU$react).createElement("span", null, stringFormatter.format("noResults"))
|
|
1081
|
+
})));
|
|
1058
1082
|
}
|
|
1059
|
-
let $f3f3b62273a2d260$var$SearchAutocompleteBase = /*#__PURE__*/ $aQREU$react.forwardRef($f3f3b62273a2d260$var$_SearchAutocompleteBase);
|
|
1083
|
+
let $f3f3b62273a2d260$var$SearchAutocompleteBase = /*#__PURE__*/ (0, $aQREU$react).forwardRef($f3f3b62273a2d260$var$_SearchAutocompleteBase);
|
|
1060
1084
|
// any type is because we don't want to call useObjectRef because this is an internal component and we know
|
|
1061
1085
|
// we are always passing an object ref
|
|
1062
1086
|
function $f3f3b62273a2d260$var$_SearchAutocompleteInput(props, ref) {
|
|
1063
|
-
let searchIcon = /*#__PURE__*/ $aQREU$react.createElement($aQREU$spectrumiconsuiMagnifier, {
|
|
1087
|
+
let searchIcon = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$spectrumiconsuiMagnifier), {
|
|
1064
1088
|
"data-testid": "searchicon"
|
|
1065
1089
|
});
|
|
1066
1090
|
let { icon: icon = searchIcon , isQuiet: isQuiet , isDisabled: isDisabled , isReadOnly: isReadOnly , validationState: validationState , inputProps: inputProps , inputRef: inputRef , autoFocus: autoFocus , style: style , className: className , loadingState: loadingState , isOpen: isOpen , menuTrigger: menuTrigger , clearButtonProps: clearButtonProps } = props;
|
|
1067
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $aQREU$useHover({
|
|
1068
|
-
|
|
1069
|
-
let
|
|
1070
|
-
let
|
|
1071
|
-
let
|
|
1072
|
-
|
|
1073
|
-
"aria-label": stringFormatter.format('loading'),
|
|
1091
|
+
let { hoverProps: hoverProps , isHovered: isHovered } = (0, $aQREU$useHover)({});
|
|
1092
|
+
let stringFormatter = (0, $aQREU$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports))));
|
|
1093
|
+
let timeout = (0, $aQREU$useRef)(null);
|
|
1094
|
+
let [showLoading, setShowLoading] = (0, $aQREU$useState)(false);
|
|
1095
|
+
let loadingCircle = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ProgressCircle), {
|
|
1096
|
+
"aria-label": stringFormatter.format("loading"),
|
|
1074
1097
|
size: "S",
|
|
1075
1098
|
isIndeterminate: true,
|
|
1076
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
1099
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports))), "spectrum-Textfield-circleLoader", (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "spectrum-InputGroup-input-circleLoader"))
|
|
1077
1100
|
});
|
|
1078
|
-
let clearButton = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ClearButton, {
|
|
1101
|
+
let clearButton = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ClearButton), {
|
|
1079
1102
|
...clearButtonProps,
|
|
1080
1103
|
preventFocus: true,
|
|
1081
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
1104
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-ClearButton"),
|
|
1082
1105
|
isDisabled: isDisabled
|
|
1083
1106
|
});
|
|
1084
|
-
let isLoading = loadingState ===
|
|
1107
|
+
let isLoading = loadingState === "loading" || loadingState === "filtering";
|
|
1085
1108
|
let inputValue = inputProps.value;
|
|
1086
|
-
let lastInputValue = $aQREU$useRef(inputValue);
|
|
1087
|
-
$aQREU$useEffect(()=>{
|
|
1109
|
+
let lastInputValue = (0, $aQREU$useRef)(inputValue);
|
|
1110
|
+
(0, $aQREU$useEffect)(()=>{
|
|
1088
1111
|
if (isLoading && !showLoading) {
|
|
1089
1112
|
if (timeout.current === null) timeout.current = setTimeout(()=>{
|
|
1090
1113
|
setShowLoading(true);
|
|
@@ -1110,46 +1133,46 @@ function $f3f3b62273a2d260$var$_SearchAutocompleteInput(props, ref) {
|
|
|
1110
1133
|
showLoading,
|
|
1111
1134
|
inputValue
|
|
1112
1135
|
]);
|
|
1113
|
-
return
|
|
1136
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$FocusRing), {
|
|
1114
1137
|
within: true,
|
|
1115
1138
|
isTextInput: true,
|
|
1116
|
-
focusClass: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1117
|
-
focusRingClass: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1139
|
+
focusClass: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "is-focused"),
|
|
1140
|
+
focusRingClass: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "focus-ring"),
|
|
1118
1141
|
autoFocus: autoFocus
|
|
1119
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
1142
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
1120
1143
|
...hoverProps,
|
|
1121
1144
|
ref: ref,
|
|
1122
1145
|
style: style,
|
|
1123
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
1129
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($aQREU$TextFieldBase, {
|
|
1146
|
+
className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "spectrum-InputGroup", {
|
|
1147
|
+
"spectrum-InputGroup--quiet": isQuiet,
|
|
1148
|
+
"is-disabled": isDisabled,
|
|
1149
|
+
"spectrum-InputGroup--invalid": validationState === "invalid" && !isDisabled,
|
|
1150
|
+
"is-hovered": isHovered
|
|
1151
|
+
}, (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports))), "searchautocomplete"), className)
|
|
1152
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$TextFieldBase), {
|
|
1130
1153
|
inputProps: inputProps,
|
|
1131
1154
|
inputRef: inputRef,
|
|
1132
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1138
|
-
inputClassName: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
1155
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search", "spectrum-Textfield", {
|
|
1156
|
+
"is-disabled": isDisabled,
|
|
1157
|
+
"is-quiet": isQuiet,
|
|
1158
|
+
"spectrum-Search--invalid": validationState === "invalid" && !isDisabled,
|
|
1159
|
+
"spectrum-Search--valid": validationState === "valid" && !isDisabled
|
|
1160
|
+
}, (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "spectrum-InputGroup-field")),
|
|
1161
|
+
inputClassName: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-Search-input"),
|
|
1139
1162
|
isDisabled: isDisabled,
|
|
1140
1163
|
isQuiet: isQuiet,
|
|
1141
1164
|
validationState: validationState,
|
|
1142
|
-
isLoading: showLoading && (isOpen || menuTrigger ===
|
|
1165
|
+
isLoading: showLoading && (isOpen || menuTrigger === "manual" || loadingState === "loading"),
|
|
1143
1166
|
loadingIndicator: loadingState != null ? loadingCircle : undefined,
|
|
1144
1167
|
icon: icon,
|
|
1145
|
-
wrapperChildren: inputValue !==
|
|
1168
|
+
wrapperChildren: inputValue !== "" && !isReadOnly ? clearButton : undefined,
|
|
1146
1169
|
disableFocusRing: true
|
|
1147
|
-
})))
|
|
1170
|
+
})));
|
|
1148
1171
|
}
|
|
1149
|
-
let $f3f3b62273a2d260$var$SearchAutocompleteInput = /*#__PURE__*/ $aQREU$react.forwardRef($f3f3b62273a2d260$var$_SearchAutocompleteInput);
|
|
1172
|
+
let $f3f3b62273a2d260$var$SearchAutocompleteInput = /*#__PURE__*/ (0, $aQREU$react).forwardRef($f3f3b62273a2d260$var$_SearchAutocompleteInput);
|
|
1150
1173
|
/**
|
|
1151
1174
|
* A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.
|
|
1152
|
-
*/ let $f3f3b62273a2d260$export$dd65332a5b19fa63 = /*#__PURE__*/ $aQREU$forwardRef($f3f3b62273a2d260$var$SearchAutocomplete);
|
|
1175
|
+
*/ let $f3f3b62273a2d260$export$dd65332a5b19fa63 = /*#__PURE__*/ (0, $aQREU$forwardRef)($f3f3b62273a2d260$var$SearchAutocomplete);
|
|
1153
1176
|
|
|
1154
1177
|
|
|
1155
1178
|
|