@react-spectrum/autocomplete 3.0.0-alpha.12 → 3.0.0-alpha.14
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 +270 -234
- package/dist/main.js.map +1 -1
- package/dist/module.js +270 -234
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/MobileSearchAutocomplete.tsx +53 -29
- package/src/SearchAutocomplete.tsx +34 -16
package/dist/module.js
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
|
|
|
@@ -602,14 +633,13 @@ $c14528ddc146317f$export$d35bc1e505d1ebbf = "is-disabled_73bc77";
|
|
|
602
633
|
|
|
603
634
|
|
|
604
635
|
|
|
605
|
-
|
|
606
|
-
props = $aQREU$useProviderProps(props);
|
|
607
|
-
let { isQuiet: isQuiet , isDisabled: isDisabled , validationState: validationState , isReadOnly: isReadOnly , onSubmit: onSubmit = ()=>{
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
sensitivity: 'base'
|
|
636
|
+
function $c940f54e16bafef5$var$_MobileSearchAutocomplete(props, ref) {
|
|
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 @@ const $c940f54e16bafef5$export$e7a90f7d6b078162 = /*#__PURE__*/ $aQREU$react.for
|
|
|
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();
|
|
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
|
-
if (!props.isDisabled) {
|
|
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,126 +686,128 @@ const $c940f54e16bafef5$export$e7a90f7d6b078162 = /*#__PURE__*/ $aQREU$react.for
|
|
|
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
|
-
})))
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
|
|
700
|
+
})));
|
|
701
|
+
}
|
|
702
|
+
let $c940f54e16bafef5$export$e7a90f7d6b078162 = /*#__PURE__*/ (0, $aQREU$react).forwardRef($c940f54e16bafef5$var$_MobileSearchAutocomplete);
|
|
703
|
+
// any type is because we don't want to call useObjectRef because this is an internal component and we know
|
|
704
|
+
// we are always passing an object ref
|
|
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), {
|
|
676
707
|
"data-testid": "searchicon"
|
|
677
708
|
});
|
|
678
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;
|
|
679
|
-
let stringFormatter = $aQREU$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports)));
|
|
680
|
-
let valueId = $aQREU$useId();
|
|
681
|
-
let invalidId = $aQREU$useId();
|
|
682
|
-
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), {
|
|
683
714
|
id: invalidId,
|
|
684
|
-
"aria-label": stringFormatter.format(
|
|
685
|
-
}) : /*#__PURE__*/ $aQREU$react.createElement($aQREU$spectrumiconsuiCheckmarkMedium, null);
|
|
686
|
-
if (icon) icon = /*#__PURE__*/ $aQREU$react.cloneElement(icon, {
|
|
687
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
688
|
-
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"
|
|
689
720
|
});
|
|
690
|
-
let clearButton = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ClearButton, {
|
|
721
|
+
let clearButton = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ClearButton), {
|
|
691
722
|
onPress: (e)=>{
|
|
692
|
-
|
|
693
|
-
|
|
723
|
+
var _props_onPress;
|
|
724
|
+
clearInput === null || clearInput === void 0 ? void 0 : clearInput();
|
|
725
|
+
props === null || props === void 0 ? void 0 : (_props_onPress = props.onPress) === null || _props_onPress === void 0 ? void 0 : _props_onPress.call(props, e);
|
|
694
726
|
},
|
|
695
727
|
preventFocus: true,
|
|
696
|
-
"aria-label": stringFormatter.format(
|
|
728
|
+
"aria-label": stringFormatter.format("clear"),
|
|
697
729
|
excludeFromTabOrder: true,
|
|
698
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
730
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-ClearButton"),
|
|
699
731
|
isDisabled: isDisabled
|
|
700
732
|
});
|
|
701
|
-
let validation = /*#__PURE__*/ $aQREU$react.cloneElement(validationIcon, {
|
|
702
|
-
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"))
|
|
703
735
|
});
|
|
704
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $aQREU$useHover({
|
|
705
|
-
});
|
|
706
|
-
let {
|
|
707
|
-
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)({
|
|
708
739
|
...props,
|
|
709
|
-
|
|
710
|
-
props[
|
|
711
|
-
props[
|
|
740
|
+
"aria-labelledby": [
|
|
741
|
+
props["aria-labelledby"],
|
|
742
|
+
props["aria-label"] && !props["aria-labelledby"] ? props.id : null,
|
|
712
743
|
valueId,
|
|
713
|
-
validationState ===
|
|
714
|
-
].filter(Boolean).join(
|
|
715
|
-
elementType:
|
|
744
|
+
validationState === "invalid" ? invalidId : null
|
|
745
|
+
].filter(Boolean).join(" "),
|
|
746
|
+
elementType: "div"
|
|
716
747
|
}, ref);
|
|
717
|
-
return
|
|
718
|
-
|
|
748
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
749
|
+
...(0, $aQREU$mergeProps)(hoverProps, focusProps, buttonProps),
|
|
719
750
|
"aria-haspopup": "dialog",
|
|
720
751
|
ref: ref,
|
|
721
752
|
style: {
|
|
722
753
|
...style,
|
|
723
|
-
outline:
|
|
754
|
+
outline: "none"
|
|
724
755
|
},
|
|
725
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
733
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
734
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
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
|
|
743
774
|
}))
|
|
744
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
745
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
753
|
-
}, 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", {
|
|
754
785
|
id: valueId,
|
|
755
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
756
|
-
}, 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));
|
|
757
788
|
});
|
|
758
789
|
function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
759
|
-
let searchIcon = /*#__PURE__*/ $aQREU$react.createElement($aQREU$spectrumiconsuiMagnifier, {
|
|
790
|
+
let searchIcon = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$spectrumiconsuiMagnifier), {
|
|
760
791
|
"data-testid": "searchicon"
|
|
761
792
|
});
|
|
762
793
|
let { state: // completionMode = 'suggest',
|
|
763
794
|
state , icon: icon = searchIcon , isDisabled: isDisabled , validationState: validationState , label: label , overlayProps: overlayProps , loadingState: loadingState , onLoadMore: onLoadMore , onClose: onClose , onSubmit: onSubmit } = props;
|
|
764
|
-
let timeout = $aQREU$useRef(null);
|
|
765
|
-
let [showLoading, setShowLoading] = $aQREU$useState(false);
|
|
766
|
-
let inputRef = $aQREU$useRef();
|
|
767
|
-
let popoverRef = $aQREU$useRef();
|
|
768
|
-
let listBoxRef = $aQREU$useRef();
|
|
769
|
-
let layout = $aQREU$useListBoxLayout(state);
|
|
770
|
-
let stringFormatter = $aQREU$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports)));
|
|
771
|
-
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)({
|
|
772
803
|
...props,
|
|
773
804
|
keyboardDelegate: layout,
|
|
774
805
|
popoverRef: popoverRef,
|
|
775
806
|
listBoxRef: listBoxRef,
|
|
776
807
|
inputRef: inputRef
|
|
777
808
|
}, state);
|
|
778
|
-
$aQREU$react.useEffect(()=>{
|
|
779
|
-
$aQREU$focusSafely(inputRef.current);
|
|
809
|
+
(0, $aQREU$react).useEffect(()=>{
|
|
810
|
+
if (inputRef.current) (0, $aQREU$focusSafely)(inputRef.current);
|
|
780
811
|
// When the tray unmounts, set state.isFocused (i.e. the tray input's focus tracker) to false.
|
|
781
812
|
// This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay
|
|
782
813
|
// (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to "contain")
|
|
@@ -786,53 +817,53 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
786
817
|
};
|
|
787
818
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
788
819
|
}, []);
|
|
789
|
-
let { dialogProps: dialogProps } = $aQREU$useDialog({
|
|
790
|
-
|
|
820
|
+
let { dialogProps: dialogProps } = (0, $aQREU$useDialog)({
|
|
821
|
+
"aria-labelledby": (0, $aQREU$useId)(labelProps.id)
|
|
791
822
|
}, popoverRef);
|
|
792
823
|
// Override the role of the input to "searchbox" instead of "combobox".
|
|
793
824
|
// Since the listbox is always visible, the combobox role doesn't really give us anything.
|
|
794
825
|
// VoiceOver on iOS reads "double tap to collapse" when focused on the input rather than
|
|
795
826
|
// "double tap to edit text", as with a textbox or searchbox. We'd like double tapping to
|
|
796
827
|
// open the virtual keyboard rather than closing the tray.
|
|
797
|
-
inputProps.role =
|
|
798
|
-
inputProps[
|
|
828
|
+
inputProps.role = "searchbox";
|
|
829
|
+
inputProps["aria-haspopup"] = "listbox";
|
|
799
830
|
delete inputProps.onTouchEnd;
|
|
800
|
-
let clearButton = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ClearButton, {
|
|
831
|
+
let clearButton = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ClearButton), {
|
|
801
832
|
...clearButtonProps,
|
|
802
833
|
preventFocus: true,
|
|
803
|
-
"aria-label": stringFormatter.format(
|
|
834
|
+
"aria-label": stringFormatter.format("clear"),
|
|
804
835
|
excludeFromTabOrder: true,
|
|
805
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
836
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-ClearButton"),
|
|
806
837
|
isDisabled: isDisabled
|
|
807
838
|
});
|
|
808
|
-
let loadingCircle = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ProgressCircle, {
|
|
809
|
-
"aria-label": stringFormatter.format(
|
|
839
|
+
let loadingCircle = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ProgressCircle), {
|
|
840
|
+
"aria-label": stringFormatter.format("loading"),
|
|
810
841
|
size: "S",
|
|
811
842
|
isIndeterminate: true,
|
|
812
|
-
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"))
|
|
813
844
|
});
|
|
814
845
|
// Close the software keyboard on scroll to give the user a bigger area to scroll.
|
|
815
846
|
// But only do this if scrolling with touch, otherwise it can cause issues with touch
|
|
816
847
|
// screen readers.
|
|
817
|
-
let isTouchDown = $aQREU$useRef(false);
|
|
848
|
+
let isTouchDown = (0, $aQREU$useRef)(false);
|
|
818
849
|
let onTouchStart = ()=>{
|
|
819
850
|
isTouchDown.current = true;
|
|
820
851
|
};
|
|
821
852
|
let onTouchEnd = ()=>{
|
|
822
853
|
isTouchDown.current = false;
|
|
823
854
|
};
|
|
824
|
-
let onScroll = $aQREU$useCallback(()=>{
|
|
855
|
+
let onScroll = (0, $aQREU$useCallback)(()=>{
|
|
825
856
|
if (!inputRef.current || document.activeElement !== inputRef.current || !isTouchDown.current) return;
|
|
826
|
-
popoverRef.current.focus();
|
|
857
|
+
if (popoverRef.current) popoverRef.current.focus();
|
|
827
858
|
}, [
|
|
828
859
|
inputRef,
|
|
829
860
|
popoverRef,
|
|
830
861
|
isTouchDown
|
|
831
862
|
]);
|
|
832
863
|
let inputValue = inputProps.value;
|
|
833
|
-
let lastInputValue = $aQREU$useRef(inputValue);
|
|
834
|
-
$aQREU$useEffect(()=>{
|
|
835
|
-
if (loadingState ===
|
|
864
|
+
let lastInputValue = (0, $aQREU$useRef)(inputValue);
|
|
865
|
+
(0, $aQREU$useEffect)(()=>{
|
|
866
|
+
if (loadingState === "filtering" && !showLoading) {
|
|
836
867
|
if (timeout.current === null) timeout.current = setTimeout(()=>{
|
|
837
868
|
setShowLoading(true);
|
|
838
869
|
}, 500);
|
|
@@ -843,11 +874,13 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
843
874
|
setShowLoading(true);
|
|
844
875
|
}, 500);
|
|
845
876
|
}
|
|
846
|
-
} else if (loadingState !==
|
|
877
|
+
} else if (loadingState !== "filtering") {
|
|
847
878
|
// If loading is no longer happening, clear any timers and hide the loading circle
|
|
848
879
|
setShowLoading(false);
|
|
849
|
-
|
|
850
|
-
|
|
880
|
+
if (timeout.current !== null) {
|
|
881
|
+
clearTimeout(timeout.current);
|
|
882
|
+
timeout.current = null;
|
|
883
|
+
}
|
|
851
884
|
}
|
|
852
885
|
lastInputValue.current = inputValue;
|
|
853
886
|
}, [
|
|
@@ -857,26 +890,27 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
857
890
|
]);
|
|
858
891
|
let onKeyDown = (e)=>{
|
|
859
892
|
// Close virtual keyboard, close tray, and fire onSubmit if user hits Enter w/o any focused options
|
|
860
|
-
if (e.key ===
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
893
|
+
if (e.key === "Enter" && state.selectionManager.focusedKey == null) {
|
|
894
|
+
var _popoverRef_current;
|
|
895
|
+
(_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
|
|
896
|
+
if (onClose) onClose();
|
|
897
|
+
if (onSubmit) onSubmit(inputValue == null ? null : inputValue.toString(), null);
|
|
898
|
+
} else if (inputProps.onKeyDown) inputProps.onKeyDown(e);
|
|
865
899
|
};
|
|
866
|
-
if (icon) icon = /*#__PURE__*/ $aQREU$react.cloneElement(icon, {
|
|
867
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($c14528ddc146317f$exports)),
|
|
868
|
-
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"
|
|
869
903
|
});
|
|
870
|
-
return
|
|
904
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$FocusScope), {
|
|
871
905
|
restoreFocus: true,
|
|
872
906
|
contain: true
|
|
873
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
874
|
-
|
|
907
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
908
|
+
...(0, $aQREU$mergeProps)(overlayProps, dialogProps),
|
|
875
909
|
ref: popoverRef,
|
|
876
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
877
|
-
}, /*#__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), {
|
|
878
912
|
onDismiss: onClose
|
|
879
|
-
}), /*#__PURE__*/ $aQREU$react.createElement($aQREU$TextFieldBase, {
|
|
913
|
+
}), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$TextFieldBase), {
|
|
880
914
|
label: label,
|
|
881
915
|
labelProps: labelProps,
|
|
882
916
|
inputProps: {
|
|
@@ -885,20 +919,20 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
885
919
|
},
|
|
886
920
|
inputRef: inputRef,
|
|
887
921
|
isDisabled: isDisabled,
|
|
888
|
-
isLoading: showLoading && loadingState ===
|
|
889
|
-
loadingIndicator: loadingState != null
|
|
922
|
+
isLoading: showLoading && loadingState === "filtering",
|
|
923
|
+
loadingIndicator: loadingState != null ? loadingCircle : undefined,
|
|
890
924
|
validationState: validationState,
|
|
891
|
-
wrapperChildren: (state.inputValue !==
|
|
925
|
+
wrapperChildren: (state.inputValue !== "" || loadingState === "filtering" || validationState != null) && !props.isReadOnly ? clearButton : undefined,
|
|
892
926
|
icon: icon,
|
|
893
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
897
|
-
|
|
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
|
|
898
932
|
})),
|
|
899
|
-
inputClassName: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
900
|
-
validationIconClassName: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
901
|
-
}), /*#__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), {
|
|
902
936
|
...listBoxProps,
|
|
903
937
|
domProps: {
|
|
904
938
|
onTouchStart: onTouchStart,
|
|
@@ -910,18 +944,17 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
910
944
|
layout: layout,
|
|
911
945
|
state: state,
|
|
912
946
|
shouldUseVirtualFocus: true,
|
|
913
|
-
renderEmptyState: ()=>loadingState !==
|
|
914
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
915
|
-
}, stringFormatter.format(
|
|
916
|
-
,
|
|
917
|
-
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"),
|
|
918
951
|
ref: listBoxRef,
|
|
919
952
|
onScroll: onScroll,
|
|
920
953
|
onLoadMore: onLoadMore,
|
|
921
|
-
isLoading: loadingState ===
|
|
922
|
-
}), /*#__PURE__*/ $aQREU$react.createElement($aQREU$DismissButton, {
|
|
954
|
+
isLoading: loadingState === "loading" || loadingState === "loadingMore"
|
|
955
|
+
}), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$DismissButton), {
|
|
923
956
|
onDismiss: onClose
|
|
924
|
-
})))
|
|
957
|
+
})));
|
|
925
958
|
}
|
|
926
959
|
|
|
927
960
|
|
|
@@ -940,46 +973,44 @@ function $c940f54e16bafef5$var$SearchAutocompleteTray(props) {
|
|
|
940
973
|
|
|
941
974
|
|
|
942
975
|
function $f3f3b62273a2d260$var$SearchAutocomplete(props, ref) {
|
|
943
|
-
props = $aQREU$useProviderProps(props);
|
|
944
|
-
if (props.placeholder) console.warn(
|
|
945
|
-
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)();
|
|
946
979
|
if (isMobile) // menuTrigger=focus/manual don't apply to mobile searchwithin
|
|
947
|
-
return
|
|
980
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $c940f54e16bafef5$export$e7a90f7d6b078162), {
|
|
948
981
|
...props,
|
|
949
982
|
menuTrigger: "input",
|
|
950
983
|
ref: ref
|
|
951
|
-
})
|
|
952
|
-
else return
|
|
984
|
+
});
|
|
985
|
+
else return /*#__PURE__*/ (0, $aQREU$react).createElement($f3f3b62273a2d260$var$SearchAutocompleteBase, {
|
|
953
986
|
...props,
|
|
954
987
|
ref: ref
|
|
955
|
-
})
|
|
988
|
+
});
|
|
956
989
|
}
|
|
957
|
-
|
|
958
|
-
props = $aQREU$useProviderProps(props);
|
|
959
|
-
let { menuTrigger: menuTrigger =
|
|
960
|
-
|
|
961
|
-
let stringFormatter = $aQREU$useLocalizedStringFormatter((/*@__PURE__*/$parcel$interopDefault($06f6e8ce74a28744$exports)));
|
|
990
|
+
function $f3f3b62273a2d260$var$_SearchAutocompleteBase(props, ref) {
|
|
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))));
|
|
962
994
|
let isAsync = loadingState != null;
|
|
963
|
-
let popoverRef = $aQREU$useRef();
|
|
964
|
-
let unwrappedPopoverRef = $aQREU$useUnwrapDOMRef(popoverRef);
|
|
965
|
-
let listBoxRef = $aQREU$useRef();
|
|
966
|
-
let inputRef = $aQREU$useRef();
|
|
967
|
-
let domRef = $aQREU$useFocusableRef(ref, inputRef);
|
|
968
|
-
let { contains: contains } = $aQREU$useFilter({
|
|
969
|
-
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"
|
|
970
1002
|
});
|
|
971
|
-
let state = $aQREU$useComboBoxState({
|
|
1003
|
+
let state = (0, $aQREU$useComboBoxState)({
|
|
972
1004
|
...props,
|
|
973
1005
|
defaultFilter: contains,
|
|
974
1006
|
allowsEmptyCollection: isAsync,
|
|
975
1007
|
allowsCustomValue: true,
|
|
976
|
-
onSelectionChange: (key)=>key !== null && onSubmit(null, key)
|
|
977
|
-
,
|
|
1008
|
+
onSelectionChange: (key)=>key !== null && onSubmit(null, key),
|
|
978
1009
|
selectedKey: undefined,
|
|
979
1010
|
defaultSelectedKey: undefined
|
|
980
1011
|
});
|
|
981
|
-
let layout = $aQREU$useListBoxLayout(state);
|
|
982
|
-
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)({
|
|
983
1014
|
...props,
|
|
984
1015
|
keyboardDelegate: layout,
|
|
985
1016
|
popoverRef: unwrappedPopoverRef,
|
|
@@ -988,9 +1019,9 @@ const $f3f3b62273a2d260$var$SearchAutocompleteBase = /*#__PURE__*/ $aQREU$react.
|
|
|
988
1019
|
menuTrigger: menuTrigger
|
|
989
1020
|
}, state);
|
|
990
1021
|
// Measure the width of the inputfield to inform the width of the menu (below).
|
|
991
|
-
let [menuWidth, setMenuWidth] = $aQREU$useState(
|
|
992
|
-
let { scale: scale } = $aQREU$useProvider();
|
|
993
|
-
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)(()=>{
|
|
994
1025
|
if (inputRef.current) {
|
|
995
1026
|
let inputWidth = inputRef.current.offsetWidth;
|
|
996
1027
|
setMenuWidth(inputWidth);
|
|
@@ -999,34 +1030,34 @@ const $f3f3b62273a2d260$var$SearchAutocompleteBase = /*#__PURE__*/ $aQREU$react.
|
|
|
999
1030
|
inputRef,
|
|
1000
1031
|
setMenuWidth
|
|
1001
1032
|
]);
|
|
1002
|
-
$aQREU$useResizeObserver({
|
|
1033
|
+
(0, $aQREU$useResizeObserver)({
|
|
1003
1034
|
ref: domRef,
|
|
1004
1035
|
onResize: onResize
|
|
1005
1036
|
});
|
|
1006
|
-
$aQREU$useLayoutEffect(onResize, [
|
|
1037
|
+
(0, $aQREU$useLayoutEffect)(onResize, [
|
|
1007
1038
|
scale,
|
|
1008
1039
|
onResize
|
|
1009
1040
|
]);
|
|
1010
1041
|
let style = {
|
|
1011
|
-
width: isQuiet ?
|
|
1042
|
+
width: isQuiet ? undefined : menuWidth,
|
|
1012
1043
|
minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
|
|
1013
1044
|
};
|
|
1014
|
-
return
|
|
1045
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$react).Fragment, null, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Field), {
|
|
1015
1046
|
...props,
|
|
1016
1047
|
labelProps: labelProps,
|
|
1017
1048
|
ref: domRef
|
|
1018
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($f3f3b62273a2d260$var$SearchAutocompleteInput, {
|
|
1049
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement($f3f3b62273a2d260$var$SearchAutocompleteInput, {
|
|
1019
1050
|
...props,
|
|
1020
1051
|
isOpen: state.isOpen,
|
|
1021
1052
|
loadingState: loadingState,
|
|
1022
1053
|
inputProps: inputProps,
|
|
1023
1054
|
inputRef: inputRef,
|
|
1024
1055
|
clearButtonProps: clearButtonProps
|
|
1025
|
-
})), /*#__PURE__*/ $aQREU$react.createElement($aQREU$Popover, {
|
|
1056
|
+
})), /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$Popover), {
|
|
1026
1057
|
state: state,
|
|
1027
1058
|
UNSAFE_style: style,
|
|
1028
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1029
|
-
|
|
1059
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports))), "spectrum-InputGroup-popover", {
|
|
1060
|
+
"spectrum-InputGroup-popover--quiet": isQuiet
|
|
1030
1061
|
}),
|
|
1031
1062
|
ref: popoverRef,
|
|
1032
1063
|
triggerRef: inputRef,
|
|
@@ -1034,7 +1065,7 @@ const $f3f3b62273a2d260$var$SearchAutocompleteBase = /*#__PURE__*/ $aQREU$react.
|
|
|
1034
1065
|
hideArrow: true,
|
|
1035
1066
|
isNonModal: true,
|
|
1036
1067
|
shouldFlip: shouldFlip
|
|
1037
|
-
}, /*#__PURE__*/ $aQREU$react.createElement($aQREU$ListBoxBase, {
|
|
1068
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ListBoxBase), {
|
|
1038
1069
|
...listBoxProps,
|
|
1039
1070
|
ref: listBoxRef,
|
|
1040
1071
|
disallowEmptySelection: true,
|
|
@@ -1044,37 +1075,39 @@ const $f3f3b62273a2d260$var$SearchAutocompleteBase = /*#__PURE__*/ $aQREU$react.
|
|
|
1044
1075
|
layout: layout,
|
|
1045
1076
|
state: state,
|
|
1046
1077
|
shouldUseVirtualFocus: true,
|
|
1047
|
-
isLoading: loadingState ===
|
|
1078
|
+
isLoading: loadingState === "loadingMore",
|
|
1048
1079
|
onLoadMore: onLoadMore,
|
|
1049
|
-
renderEmptyState: ()=>isAsync && /*#__PURE__*/ $aQREU$react.createElement("span", null, stringFormatter.format(
|
|
1050
|
-
})))
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
|
-
|
|
1080
|
+
renderEmptyState: ()=>isAsync && /*#__PURE__*/ (0, $aQREU$react).createElement("span", null, stringFormatter.format("noResults"))
|
|
1081
|
+
})));
|
|
1082
|
+
}
|
|
1083
|
+
let $f3f3b62273a2d260$var$SearchAutocompleteBase = /*#__PURE__*/ (0, $aQREU$react).forwardRef($f3f3b62273a2d260$var$_SearchAutocompleteBase);
|
|
1084
|
+
// any type is because we don't want to call useObjectRef because this is an internal component and we know
|
|
1085
|
+
// we are always passing an object ref
|
|
1086
|
+
function $f3f3b62273a2d260$var$_SearchAutocompleteInput(props, ref) {
|
|
1087
|
+
let searchIcon = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$spectrumiconsuiMagnifier), {
|
|
1054
1088
|
"data-testid": "searchicon"
|
|
1055
1089
|
});
|
|
1056
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;
|
|
1057
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $aQREU$useHover({
|
|
1058
|
-
|
|
1059
|
-
let
|
|
1060
|
-
let
|
|
1061
|
-
let
|
|
1062
|
-
|
|
1063
|
-
"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"),
|
|
1064
1097
|
size: "S",
|
|
1065
1098
|
isIndeterminate: true,
|
|
1066
|
-
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"))
|
|
1067
1100
|
});
|
|
1068
|
-
let clearButton = /*#__PURE__*/ $aQREU$react.createElement($aQREU$ClearButton, {
|
|
1101
|
+
let clearButton = /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$ClearButton), {
|
|
1069
1102
|
...clearButtonProps,
|
|
1070
1103
|
preventFocus: true,
|
|
1071
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
1104
|
+
UNSAFE_className: (0, $aQREU$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports))), "spectrum-ClearButton"),
|
|
1072
1105
|
isDisabled: isDisabled
|
|
1073
1106
|
});
|
|
1074
|
-
let isLoading = loadingState ===
|
|
1107
|
+
let isLoading = loadingState === "loading" || loadingState === "filtering";
|
|
1075
1108
|
let inputValue = inputProps.value;
|
|
1076
|
-
let lastInputValue = $aQREU$useRef(inputValue);
|
|
1077
|
-
$aQREU$useEffect(()=>{
|
|
1109
|
+
let lastInputValue = (0, $aQREU$useRef)(inputValue);
|
|
1110
|
+
(0, $aQREU$useEffect)(()=>{
|
|
1078
1111
|
if (isLoading && !showLoading) {
|
|
1079
1112
|
if (timeout.current === null) timeout.current = setTimeout(()=>{
|
|
1080
1113
|
setShowLoading(true);
|
|
@@ -1089,8 +1122,10 @@ const $f3f3b62273a2d260$var$SearchAutocompleteInput = /*#__PURE__*/ $aQREU$react
|
|
|
1089
1122
|
} else if (!isLoading) {
|
|
1090
1123
|
// If loading is no longer happening, clear any timers and hide the loading circle
|
|
1091
1124
|
setShowLoading(false);
|
|
1092
|
-
|
|
1093
|
-
|
|
1125
|
+
if (timeout.current != null) {
|
|
1126
|
+
clearTimeout(timeout.current);
|
|
1127
|
+
timeout.current = null;
|
|
1128
|
+
}
|
|
1094
1129
|
}
|
|
1095
1130
|
lastInputValue.current = inputValue;
|
|
1096
1131
|
}, [
|
|
@@ -1098,45 +1133,46 @@ const $f3f3b62273a2d260$var$SearchAutocompleteInput = /*#__PURE__*/ $aQREU$react
|
|
|
1098
1133
|
showLoading,
|
|
1099
1134
|
inputValue
|
|
1100
1135
|
]);
|
|
1101
|
-
return
|
|
1136
|
+
return /*#__PURE__*/ (0, $aQREU$react).createElement((0, $aQREU$FocusRing), {
|
|
1102
1137
|
within: true,
|
|
1103
1138
|
isTextInput: true,
|
|
1104
|
-
focusClass: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1105
|
-
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"),
|
|
1106
1141
|
autoFocus: autoFocus
|
|
1107
|
-
}, /*#__PURE__*/ $aQREU$react.createElement("div", {
|
|
1142
|
+
}, /*#__PURE__*/ (0, $aQREU$react).createElement("div", {
|
|
1108
1143
|
...hoverProps,
|
|
1109
1144
|
ref: ref,
|
|
1110
1145
|
style: style,
|
|
1111
|
-
className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($f6bdc9f20ce7ef93$exports)),
|
|
1117
|
-
}, /*#__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), {
|
|
1118
1153
|
inputProps: inputProps,
|
|
1119
1154
|
inputRef: inputRef,
|
|
1120
|
-
UNSAFE_className: $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($5589e2270a5c2f51$exports)),
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
}, $aQREU$classNames((/*@__PURE__*/$parcel$interopDefault($8fb52a80fe52b1c7$exports)),
|
|
1126
|
-
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"),
|
|
1127
1162
|
isDisabled: isDisabled,
|
|
1128
1163
|
isQuiet: isQuiet,
|
|
1129
1164
|
validationState: validationState,
|
|
1130
|
-
isLoading: showLoading && (isOpen || menuTrigger ===
|
|
1131
|
-
loadingIndicator: loadingState != null
|
|
1165
|
+
isLoading: showLoading && (isOpen || menuTrigger === "manual" || loadingState === "loading"),
|
|
1166
|
+
loadingIndicator: loadingState != null ? loadingCircle : undefined,
|
|
1132
1167
|
icon: icon,
|
|
1133
|
-
wrapperChildren: inputValue !==
|
|
1168
|
+
wrapperChildren: inputValue !== "" && !isReadOnly ? clearButton : undefined,
|
|
1134
1169
|
disableFocusRing: true
|
|
1135
|
-
})))
|
|
1136
|
-
}
|
|
1170
|
+
})));
|
|
1171
|
+
}
|
|
1172
|
+
let $f3f3b62273a2d260$var$SearchAutocompleteInput = /*#__PURE__*/ (0, $aQREU$react).forwardRef($f3f3b62273a2d260$var$_SearchAutocompleteInput);
|
|
1137
1173
|
/**
|
|
1138
1174
|
* A SearchAutocomplete is a searchfield that supports a dynamic list of suggestions.
|
|
1139
|
-
*/ let $f3f3b62273a2d260$export$dd65332a5b19fa63 = /*#__PURE__*/ $aQREU$forwardRef($f3f3b62273a2d260$var$SearchAutocomplete);
|
|
1175
|
+
*/ let $f3f3b62273a2d260$export$dd65332a5b19fa63 = /*#__PURE__*/ (0, $aQREU$forwardRef)($f3f3b62273a2d260$var$SearchAutocomplete);
|
|
1140
1176
|
|
|
1141
1177
|
|
|
1142
1178
|
|