@react-spectrum/combobox 3.16.6 → 3.17.0
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/import.mjs +5 -3
- package/dist/main.js +7 -5
- package/dist/main.js.map +1 -1
- package/dist/module.js +5 -3
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +4 -0
- package/package.json +14 -49
- package/src/index.ts +5 -3
- package/dist/ComboBox.main.js +0 -305
- package/dist/ComboBox.main.js.map +0 -1
- package/dist/ComboBox.mjs +0 -300
- package/dist/ComboBox.module.js +0 -300
- package/dist/ComboBox.module.js.map +0 -1
- package/dist/MobileComboBox.main.js +0 -432
- package/dist/MobileComboBox.main.js.map +0 -1
- package/dist/MobileComboBox.mjs +0 -427
- package/dist/MobileComboBox.module.js +0 -427
- package/dist/MobileComboBox.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -10
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -12
- package/dist/ar-AE.module.js +0 -12
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -10
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -12
- package/dist/bg-BG.module.js +0 -12
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/button_vars_css.main.js +0 -125
- package/dist/button_vars_css.main.js.map +0 -1
- package/dist/button_vars_css.mjs +0 -127
- package/dist/button_vars_css.module.js +0 -127
- package/dist/button_vars_css.module.js.map +0 -1
- package/dist/combobox.1c1869da.css +0 -50
- package/dist/combobox.1c1869da.css.map +0 -1
- package/dist/combobox.32e7c48f.css +0 -550
- package/dist/combobox.32e7c48f.css.map +0 -1
- package/dist/combobox.8958325b.css +0 -1669
- package/dist/combobox.8958325b.css.map +0 -1
- package/dist/combobox.a38acc5c.css +0 -649
- package/dist/combobox.a38acc5c.css.map +0 -1
- package/dist/combobox.cab3a9ff.css +0 -271
- package/dist/combobox.cab3a9ff.css.map +0 -1
- package/dist/combobox.cce0a74c.css +0 -223
- package/dist/combobox.cce0a74c.css.map +0 -1
- package/dist/combobox_css.main.js +0 -35
- package/dist/combobox_css.main.js.map +0 -1
- package/dist/combobox_css.mjs +0 -37
- package/dist/combobox_css.module.js +0 -37
- package/dist/combobox_css.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -10
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -12
- package/dist/cs-CZ.module.js +0 -12
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -10
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -12
- package/dist/da-DK.module.js +0 -12
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -10
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -12
- package/dist/de-DE.module.js +0 -12
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -10
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -12
- package/dist/el-GR.module.js +0 -12
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -10
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -12
- package/dist/en-US.module.js +0 -12
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -10
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -12
- package/dist/es-ES.module.js +0 -12
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -10
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -12
- package/dist/et-EE.module.js +0 -12
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -10
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -12
- package/dist/fi-FI.module.js +0 -12
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fieldlabel_vars_css.main.js +0 -95
- package/dist/fieldlabel_vars_css.main.js.map +0 -1
- package/dist/fieldlabel_vars_css.mjs +0 -97
- package/dist/fieldlabel_vars_css.module.js +0 -97
- package/dist/fieldlabel_vars_css.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -10
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -12
- package/dist/fr-FR.module.js +0 -12
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -10
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -12
- package/dist/he-IL.module.js +0 -12
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -10
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -12
- package/dist/hr-HR.module.js +0 -12
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -10
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -12
- package/dist/hu-HU.module.js +0 -12
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/inputgroup_vars_css.main.js +0 -86
- package/dist/inputgroup_vars_css.main.js.map +0 -1
- package/dist/inputgroup_vars_css.mjs +0 -88
- package/dist/inputgroup_vars_css.module.js +0 -88
- package/dist/inputgroup_vars_css.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -10
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -12
- package/dist/it-IT.module.js +0 -12
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -10
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -12
- package/dist/ja-JP.module.js +0 -12
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -10
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -12
- package/dist/ko-KR.module.js +0 -12
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -10
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -12
- package/dist/lt-LT.module.js +0 -12
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -10
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -12
- package/dist/lv-LV.module.js +0 -12
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -10
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -12
- package/dist/nb-NO.module.js +0 -12
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -10
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -12
- package/dist/nl-NL.module.js +0 -12
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -10
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -12
- package/dist/pl-PL.module.js +0 -12
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -10
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -12
- package/dist/pt-BR.module.js +0 -12
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -10
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -12
- package/dist/pt-PT.module.js +0 -12
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -10
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -12
- package/dist/ro-RO.module.js +0 -12
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -10
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -12
- package/dist/ru-RU.module.js +0 -12
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/search_vars_css.main.js +0 -53
- package/dist/search_vars_css.main.js.map +0 -1
- package/dist/search_vars_css.mjs +0 -55
- package/dist/search_vars_css.module.js +0 -55
- package/dist/search_vars_css.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -10
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -12
- package/dist/sk-SK.module.js +0 -12
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -10
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -12
- package/dist/sl-SI.module.js +0 -12
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -10
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -12
- package/dist/sr-SP.module.js +0 -12
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -10
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -12
- package/dist/sv-SE.module.js +0 -12
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/textfield_vars_css.main.js +0 -74
- package/dist/textfield_vars_css.main.js.map +0 -1
- package/dist/textfield_vars_css.mjs +0 -76
- package/dist/textfield_vars_css.module.js +0 -76
- package/dist/textfield_vars_css.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -10
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -12
- package/dist/tr-TR.module.js +0 -12
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -13
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -10
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -12
- package/dist/uk-UA.module.js +0 -12
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -10
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -12
- package/dist/zh-CN.module.js +0 -12
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -10
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -12
- package/dist/zh-TW.module.js +0 -12
- package/dist/zh-TW.module.js.map +0 -1
- package/src/ComboBox.tsx +0 -376
- package/src/MobileComboBox.tsx +0 -571
- package/src/combobox.css +0 -65
package/dist/MobileComboBox.mjs
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
import "./combobox.8958325b.css";
|
|
2
|
-
import $gRayl$button_vars_cssmodulejs from "./button_vars_css.mjs";
|
|
3
|
-
import "./combobox.1c1869da.css";
|
|
4
|
-
import $gRayl$combobox_cssmodulejs from "./combobox_css.mjs";
|
|
5
|
-
import $gRayl$intlStringsmodulejs from "./intlStrings.mjs";
|
|
6
|
-
import "./combobox.cab3a9ff.css";
|
|
7
|
-
import $gRayl$fieldlabel_vars_cssmodulejs from "./fieldlabel_vars_css.mjs";
|
|
8
|
-
import "./combobox.cce0a74c.css";
|
|
9
|
-
import $gRayl$search_vars_cssmodulejs from "./search_vars_css.mjs";
|
|
10
|
-
import "./combobox.a38acc5c.css";
|
|
11
|
-
import $gRayl$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.mjs";
|
|
12
|
-
import "./combobox.32e7c48f.css";
|
|
13
|
-
import $gRayl$textfield_vars_cssmodulejs from "./textfield_vars_css.mjs";
|
|
14
|
-
import $gRayl$spectrumiconsuiAlertMedium from "@spectrum-icons/ui/AlertMedium";
|
|
15
|
-
import $gRayl$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
|
16
|
-
import $gRayl$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
|
|
17
|
-
import {useFocusableRef as $gRayl$useFocusableRef, classNames as $gRayl$classNames, unwrapDOMRef as $gRayl$unwrapDOMRef} from "@react-spectrum/utils";
|
|
18
|
-
import {ClearButton as $gRayl$ClearButton} from "@react-spectrum/button";
|
|
19
|
-
import {useComboBoxState as $gRayl$useComboBoxState} from "@react-stately/combobox";
|
|
20
|
-
import {useOverlayTrigger as $gRayl$useOverlayTrigger, DismissButton as $gRayl$DismissButton} from "@react-aria/overlays";
|
|
21
|
-
import {Field as $gRayl$Field} from "@react-spectrum/label";
|
|
22
|
-
import {FocusRing as $gRayl$FocusRing, FocusScope as $gRayl$FocusScope} from "@react-aria/focus";
|
|
23
|
-
import {setInteractionModality as $gRayl$setInteractionModality, useHover as $gRayl$useHover, focusSafely as $gRayl$focusSafely} from "@react-aria/interactions";
|
|
24
|
-
import {useListBoxLayout as $gRayl$useListBoxLayout, ListBoxBase as $gRayl$ListBoxBase} from "@react-spectrum/listbox";
|
|
25
|
-
import {useFormReset as $gRayl$useFormReset, mergeProps as $gRayl$mergeProps, useId as $gRayl$useId, useObjectRef as $gRayl$useObjectRef} from "@react-aria/utils";
|
|
26
|
-
import {ProgressCircle as $gRayl$ProgressCircle} from "@react-spectrum/progress";
|
|
27
|
-
import $gRayl$react, {useRef as $gRayl$useRef, useState as $gRayl$useState, useCallback as $gRayl$useCallback, useEffect as $gRayl$useEffect} from "react";
|
|
28
|
-
import {TextFieldBase as $gRayl$TextFieldBase} from "@react-spectrum/textfield";
|
|
29
|
-
import {Tray as $gRayl$Tray} from "@react-spectrum/overlays";
|
|
30
|
-
import {useButton as $gRayl$useButton} from "@react-aria/button";
|
|
31
|
-
import {useComboBox as $gRayl$useComboBox} from "@react-aria/combobox";
|
|
32
|
-
import {useDialog as $gRayl$useDialog} from "@react-aria/dialog";
|
|
33
|
-
import {useField as $gRayl$useField} from "@react-aria/label";
|
|
34
|
-
import {useFilter as $gRayl$useFilter, useLocalizedStringFormatter as $gRayl$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
35
|
-
import {useFormValidation as $gRayl$useFormValidation} from "@react-aria/form";
|
|
36
|
-
import {useProviderProps as $gRayl$useProviderProps} from "@react-spectrum/provider";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function $parcel$interopDefault(a) {
|
|
40
|
-
return a && a.__esModule ? a.default : a;
|
|
41
|
-
}
|
|
42
|
-
/*
|
|
43
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
44
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
45
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
46
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
47
|
-
*
|
|
48
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
49
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
50
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
51
|
-
* governing permissions and limitations under the License.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const $a1ae4cad4496428f$export$7637df911c069b4d = /*#__PURE__*/ (0, $gRayl$react).forwardRef(function MobileComboBox(props, ref) {
|
|
83
|
-
props = (0, $gRayl$useProviderProps)(props);
|
|
84
|
-
let { isQuiet: isQuiet, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, validationBehavior: validationBehavior, name: name, formValue: formValue = 'text', allowsCustomValue: allowsCustomValue } = props;
|
|
85
|
-
if (allowsCustomValue) formValue = 'text';
|
|
86
|
-
let { contains: contains } = (0, $gRayl$useFilter)({
|
|
87
|
-
sensitivity: 'base'
|
|
88
|
-
});
|
|
89
|
-
let state = (0, $gRayl$useComboBoxState)({
|
|
90
|
-
...props,
|
|
91
|
-
defaultFilter: contains,
|
|
92
|
-
allowsEmptyCollection: true,
|
|
93
|
-
// Needs to be false here otherwise we double up on commitSelection/commitCustomValue calls when
|
|
94
|
-
// user taps on underlay (i.e. initial tap will call setFocused(false) -> commitSelection/commitCustomValue via onBlur,
|
|
95
|
-
// then the closing of the tray will call setFocused(false) again due to cleanup effect)
|
|
96
|
-
shouldCloseOnBlur: false
|
|
97
|
-
});
|
|
98
|
-
let buttonRef = (0, $gRayl$useRef)(null);
|
|
99
|
-
let domRef = (0, $gRayl$useFocusableRef)(ref, buttonRef);
|
|
100
|
-
let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $gRayl$useOverlayTrigger)({
|
|
101
|
-
type: 'listbox'
|
|
102
|
-
}, state, buttonRef);
|
|
103
|
-
let inputRef = (0, $gRayl$useRef)(null);
|
|
104
|
-
(0, $gRayl$useFormValidation)({
|
|
105
|
-
...props,
|
|
106
|
-
focus: ()=>{
|
|
107
|
-
var _buttonRef_current;
|
|
108
|
-
return (_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.focus();
|
|
109
|
-
}
|
|
110
|
-
}, state, inputRef);
|
|
111
|
-
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
112
|
-
let validationState = props.validationState || (isInvalid ? 'invalid' : undefined);
|
|
113
|
-
var _props_errorMessage;
|
|
114
|
-
let errorMessage = (_props_errorMessage = props.errorMessage) !== null && _props_errorMessage !== void 0 ? _props_errorMessage : validationErrors.join(' ');
|
|
115
|
-
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $gRayl$useField)({
|
|
116
|
-
...props,
|
|
117
|
-
labelElementType: 'span',
|
|
118
|
-
isInvalid: isInvalid,
|
|
119
|
-
errorMessage: errorMessage
|
|
120
|
-
});
|
|
121
|
-
// Focus the button and show focus ring when clicking on the label
|
|
122
|
-
labelProps.onClick = ()=>{
|
|
123
|
-
if (!props.isDisabled) {
|
|
124
|
-
var _buttonRef_current;
|
|
125
|
-
(_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.focus();
|
|
126
|
-
(0, $gRayl$setInteractionModality)('keyboard');
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
let inputProps = {
|
|
130
|
-
type: 'hidden',
|
|
131
|
-
name: name,
|
|
132
|
-
value: formValue === 'text' ? state.inputValue : String(state.selectedKey)
|
|
133
|
-
};
|
|
134
|
-
if (validationBehavior === 'native') {
|
|
135
|
-
// Use a hidden <input type="text"> rather than <input type="hidden">
|
|
136
|
-
// so that an empty value blocks HTML form submission when the field is required.
|
|
137
|
-
inputProps.type = 'text';
|
|
138
|
-
inputProps.hidden = true;
|
|
139
|
-
inputProps.required = isRequired;
|
|
140
|
-
// Ignore react warning.
|
|
141
|
-
inputProps.onChange = ()=>{};
|
|
142
|
-
}
|
|
143
|
-
(0, $gRayl$useFormReset)(inputRef, formValue === 'text' ? state.defaultInputValue : state.defaultSelectedKey, formValue === 'text' ? state.setInputValue : state.setSelectedKey);
|
|
144
|
-
return /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$react).Fragment, null, /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$Field), {
|
|
145
|
-
...props,
|
|
146
|
-
labelProps: labelProps,
|
|
147
|
-
descriptionProps: descriptionProps,
|
|
148
|
-
errorMessageProps: errorMessageProps,
|
|
149
|
-
validationState: validationState,
|
|
150
|
-
isInvalid: isInvalid,
|
|
151
|
-
validationErrors: validationErrors,
|
|
152
|
-
validationDetails: validationDetails,
|
|
153
|
-
elementType: "span",
|
|
154
|
-
ref: domRef,
|
|
155
|
-
includeNecessityIndicatorInAccessibilityName: true
|
|
156
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement($a1ae4cad4496428f$export$adfa0abcd5972f7e, {
|
|
157
|
-
...(0, $gRayl$mergeProps)(triggerProps, fieldProps, {
|
|
158
|
-
autoFocus: props.autoFocus
|
|
159
|
-
}),
|
|
160
|
-
ref: buttonRef,
|
|
161
|
-
isQuiet: isQuiet,
|
|
162
|
-
isDisabled: isDisabled,
|
|
163
|
-
isPlaceholder: !state.inputValue,
|
|
164
|
-
validationState: validationState,
|
|
165
|
-
onPress: ()=>!isReadOnly && state.open(null, 'manual')
|
|
166
|
-
}, state.inputValue || props.placeholder || '')), /*#__PURE__*/ (0, $gRayl$react).createElement("input", {
|
|
167
|
-
...inputProps,
|
|
168
|
-
ref: inputRef
|
|
169
|
-
}), /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$Tray), {
|
|
170
|
-
state: state,
|
|
171
|
-
isFixedHeight: true,
|
|
172
|
-
...overlayProps
|
|
173
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement($a1ae4cad4496428f$var$ComboBoxTray, {
|
|
174
|
-
...props,
|
|
175
|
-
onClose: state.close,
|
|
176
|
-
overlayProps: overlayProps,
|
|
177
|
-
state: state
|
|
178
|
-
})));
|
|
179
|
-
});
|
|
180
|
-
const $a1ae4cad4496428f$export$adfa0abcd5972f7e = /*#__PURE__*/ (0, $gRayl$react).forwardRef(function ComboBoxButton(props, ref) {
|
|
181
|
-
let { isQuiet: isQuiet, isDisabled: isDisabled, isPlaceholder: isPlaceholder, validationState: validationState, children: children, style: style, className: className } = props;
|
|
182
|
-
let stringFormatter = (0, $gRayl$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gRayl$intlStringsmodulejs))), '@react-spectrum/combobox');
|
|
183
|
-
let valueId = (0, $gRayl$useId)();
|
|
184
|
-
let invalidId = (0, $gRayl$useId)();
|
|
185
|
-
let validId = (0, $gRayl$useId)();
|
|
186
|
-
let validationIcon = validationState === 'invalid' ? /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$spectrumiconsuiAlertMedium), {
|
|
187
|
-
id: invalidId,
|
|
188
|
-
"aria-label": stringFormatter.format('invalid')
|
|
189
|
-
}) : /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$spectrumiconsuiCheckmarkMedium), {
|
|
190
|
-
id: validId,
|
|
191
|
-
"aria-label": stringFormatter.format('valid')
|
|
192
|
-
});
|
|
193
|
-
let validation = /*#__PURE__*/ (0, $gRayl$react).cloneElement(validationIcon, {
|
|
194
|
-
UNSAFE_className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$textfield_vars_cssmodulejs))), 'spectrum-Textfield-validationIcon', (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-validationIcon'))
|
|
195
|
-
});
|
|
196
|
-
let objRef = (0, $gRayl$useObjectRef)(ref);
|
|
197
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $gRayl$useHover)({});
|
|
198
|
-
let { buttonProps: buttonProps, isPressed: isPressed } = (0, $gRayl$useButton)({
|
|
199
|
-
...props,
|
|
200
|
-
'aria-labelledby': [
|
|
201
|
-
props['aria-labelledby'],
|
|
202
|
-
props['aria-label'] && !props['aria-labelledby'] ? props.id : null,
|
|
203
|
-
valueId,
|
|
204
|
-
validationState === 'invalid' ? invalidId : null,
|
|
205
|
-
validationState === 'valid' ? validId : null
|
|
206
|
-
].filter(Boolean).join(' '),
|
|
207
|
-
elementType: 'div'
|
|
208
|
-
}, objRef);
|
|
209
|
-
return /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$FocusRing), {
|
|
210
|
-
focusClass: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'is-focused'),
|
|
211
|
-
focusRingClass: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'focus-ring')
|
|
212
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement("div", {
|
|
213
|
-
...(0, $gRayl$mergeProps)(hoverProps, buttonProps),
|
|
214
|
-
"aria-haspopup": "dialog",
|
|
215
|
-
ref: objRef,
|
|
216
|
-
style: {
|
|
217
|
-
...style,
|
|
218
|
-
outline: 'none'
|
|
219
|
-
},
|
|
220
|
-
className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup', {
|
|
221
|
-
'spectrum-InputGroup--quiet': isQuiet,
|
|
222
|
-
'is-disabled': isDisabled,
|
|
223
|
-
'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
|
|
224
|
-
'is-hovered': isHovered
|
|
225
|
-
}, (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'mobile-combobox'), className)
|
|
226
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement("div", {
|
|
227
|
-
className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$textfield_vars_cssmodulejs))), 'spectrum-Textfield', {
|
|
228
|
-
'spectrum-Textfield--invalid': validationState === 'invalid' && !isDisabled,
|
|
229
|
-
'spectrum-Textfield--valid': validationState === 'valid' && !isDisabled,
|
|
230
|
-
'spectrum-Textfield--quiet': isQuiet
|
|
231
|
-
}, (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'))
|
|
232
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement("div", {
|
|
233
|
-
className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$textfield_vars_cssmodulejs))), 'spectrum-Textfield-input', {
|
|
234
|
-
'is-hovered': isHovered,
|
|
235
|
-
'is-placeholder': isPlaceholder,
|
|
236
|
-
'is-disabled': isDisabled
|
|
237
|
-
}, (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input', (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$fieldlabel_vars_cssmodulejs))), 'spectrum-Field-field')), (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'mobile-input'))
|
|
238
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement("span", {
|
|
239
|
-
id: valueId,
|
|
240
|
-
className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'mobile-value')
|
|
241
|
-
}, children)), validationState && !isDisabled ? validation : null), /*#__PURE__*/ (0, $gRayl$react).createElement("div", {
|
|
242
|
-
className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$button_vars_cssmodulejs))), 'spectrum-FieldButton', {
|
|
243
|
-
'spectrum-FieldButton--quiet': isQuiet,
|
|
244
|
-
'is-active': isPressed,
|
|
245
|
-
'is-disabled': isDisabled,
|
|
246
|
-
'spectrum-FieldButton--invalid': validationState === 'invalid' && !isDisabled,
|
|
247
|
-
'is-hovered': isHovered
|
|
248
|
-
}, (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'spectrum-FieldButton'))
|
|
249
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$spectrumiconsuiChevronDownMedium), {
|
|
250
|
-
UNSAFE_className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$inputgroup_vars_cssmodulejs))), 'spectrum-Dropdown-chevron')
|
|
251
|
-
}))));
|
|
252
|
-
});
|
|
253
|
-
function $a1ae4cad4496428f$var$ComboBoxTray(props) {
|
|
254
|
-
let { state: // completionMode = 'suggest',
|
|
255
|
-
state, isDisabled: isDisabled, validationState: validationState, label: label, overlayProps: overlayProps, loadingState: loadingState, onLoadMore: onLoadMore, onClose: onClose } = props;
|
|
256
|
-
let timeout = (0, $gRayl$useRef)(null);
|
|
257
|
-
let [showLoading, setShowLoading] = (0, $gRayl$useState)(false);
|
|
258
|
-
let inputRef = (0, $gRayl$useRef)(null);
|
|
259
|
-
let buttonRef = (0, $gRayl$useRef)(null);
|
|
260
|
-
let popoverRef = (0, $gRayl$useRef)(null);
|
|
261
|
-
let listBoxRef = (0, $gRayl$useRef)(null);
|
|
262
|
-
let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
|
|
263
|
-
let layout = (0, $gRayl$useListBoxLayout)();
|
|
264
|
-
let stringFormatter = (0, $gRayl$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gRayl$intlStringsmodulejs))), '@react-spectrum/combobox');
|
|
265
|
-
let { inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps } = (0, $gRayl$useComboBox)({
|
|
266
|
-
...props,
|
|
267
|
-
// completionMode,
|
|
268
|
-
layoutDelegate: layout,
|
|
269
|
-
buttonRef: (0, $gRayl$unwrapDOMRef)(buttonRef),
|
|
270
|
-
popoverRef: popoverRef,
|
|
271
|
-
listBoxRef: listBoxRef,
|
|
272
|
-
inputRef: inputRef,
|
|
273
|
-
// Handled outside the tray.
|
|
274
|
-
name: undefined
|
|
275
|
-
}, state);
|
|
276
|
-
(0, $gRayl$react).useEffect(()=>{
|
|
277
|
-
if (inputRef.current) (0, $gRayl$focusSafely)(inputRef.current);
|
|
278
|
-
}, []);
|
|
279
|
-
(0, $gRayl$react).useEffect(()=>{
|
|
280
|
-
// When the tray closes, set state.isFocused (i.e. the tray input's focus tracker) to false.
|
|
281
|
-
// This is to prevent state.isFocused from being set to true when the tray closes via tapping on the underlay
|
|
282
|
-
// (FocusScope attempts to restore focus to the tray input when tapping outside the tray due to "contain")
|
|
283
|
-
// Have to do this manually since React doesn't call onBlur when a component is unmounted: https://github.com/facebook/react/issues/12363
|
|
284
|
-
if (!state.isOpen && state.isFocused) state.setFocused(false);
|
|
285
|
-
});
|
|
286
|
-
let { dialogProps: dialogProps } = (0, $gRayl$useDialog)({
|
|
287
|
-
'aria-labelledby': (0, $gRayl$useId)(labelProps.id)
|
|
288
|
-
}, popoverRef);
|
|
289
|
-
// Override the role of the input to "searchbox" instead of "combobox".
|
|
290
|
-
// Since the listbox is always visible, the combobox role doesn't really give us anything.
|
|
291
|
-
// VoiceOver on iOS reads "double tap to collapse" when focused on the input rather than
|
|
292
|
-
// "double tap to edit text", as with a textbox or searchbox. We'd like double tapping to
|
|
293
|
-
// open the virtual keyboard rather than closing the tray.
|
|
294
|
-
// Unlike "combobox", "aria-expanded" is not a valid attribute on "searchbox".
|
|
295
|
-
inputProps.role = 'searchbox';
|
|
296
|
-
inputProps['aria-haspopup'] = 'listbox';
|
|
297
|
-
delete inputProps['aria-expanded'];
|
|
298
|
-
delete inputProps.onTouchEnd;
|
|
299
|
-
let clearButton = /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$ClearButton), {
|
|
300
|
-
preventFocus: true,
|
|
301
|
-
"aria-label": stringFormatter.format('clear'),
|
|
302
|
-
excludeFromTabOrder: true,
|
|
303
|
-
onPress: ()=>{
|
|
304
|
-
var _inputRef_current;
|
|
305
|
-
state.setInputValue('');
|
|
306
|
-
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
307
|
-
},
|
|
308
|
-
UNSAFE_className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$search_vars_cssmodulejs))), 'spectrum-ClearButton'),
|
|
309
|
-
isDisabled: isDisabled
|
|
310
|
-
});
|
|
311
|
-
let loadingCircle = /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$ProgressCircle), {
|
|
312
|
-
"aria-label": stringFormatter.format('loading'),
|
|
313
|
-
size: "S",
|
|
314
|
-
isIndeterminate: true,
|
|
315
|
-
UNSAFE_className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$search_vars_cssmodulejs))), 'spectrum-Search-circleLoader', (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$textfield_vars_cssmodulejs))), 'spectrum-Textfield-circleLoader'))
|
|
316
|
-
});
|
|
317
|
-
// Close the software keyboard on scroll to give the user a bigger area to scroll.
|
|
318
|
-
// But only do this if scrolling with touch, otherwise it can cause issues with touch
|
|
319
|
-
// screen readers.
|
|
320
|
-
let isTouchDown = (0, $gRayl$useRef)(false);
|
|
321
|
-
let onTouchStart = ()=>{
|
|
322
|
-
isTouchDown.current = true;
|
|
323
|
-
};
|
|
324
|
-
let onTouchEnd = ()=>{
|
|
325
|
-
isTouchDown.current = false;
|
|
326
|
-
};
|
|
327
|
-
let onScroll = (0, $gRayl$useCallback)(()=>{
|
|
328
|
-
var _popoverRef_current;
|
|
329
|
-
if (!inputRef.current || document.activeElement !== inputRef.current || !isTouchDown.current) return;
|
|
330
|
-
(_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
|
|
331
|
-
}, [
|
|
332
|
-
inputRef,
|
|
333
|
-
popoverRef,
|
|
334
|
-
isTouchDown
|
|
335
|
-
]);
|
|
336
|
-
let inputValue = inputProps.value;
|
|
337
|
-
let lastInputValue = (0, $gRayl$useRef)(inputValue);
|
|
338
|
-
(0, $gRayl$useEffect)(()=>{
|
|
339
|
-
if (loadingState === 'filtering' && !showLoading) {
|
|
340
|
-
if (timeout.current === null) timeout.current = setTimeout(()=>{
|
|
341
|
-
setShowLoading(true);
|
|
342
|
-
}, 500);
|
|
343
|
-
// If user is typing, clear the timer and restart since it is a new request
|
|
344
|
-
if (inputValue !== lastInputValue.current) {
|
|
345
|
-
clearTimeout(timeout.current);
|
|
346
|
-
timeout.current = setTimeout(()=>{
|
|
347
|
-
setShowLoading(true);
|
|
348
|
-
}, 500);
|
|
349
|
-
}
|
|
350
|
-
} else if (loadingState !== 'filtering') {
|
|
351
|
-
// If loading is no longer happening, clear any timers and hide the loading circle
|
|
352
|
-
setShowLoading(false);
|
|
353
|
-
if (timeout.current) clearTimeout(timeout.current);
|
|
354
|
-
timeout.current = null;
|
|
355
|
-
}
|
|
356
|
-
lastInputValue.current = inputValue;
|
|
357
|
-
}, [
|
|
358
|
-
loadingState,
|
|
359
|
-
inputValue,
|
|
360
|
-
showLoading
|
|
361
|
-
]);
|
|
362
|
-
let onKeyDown = (e)=>{
|
|
363
|
-
var _popoverRef_current, _inputProps_onKeyDown;
|
|
364
|
-
// Close virtual keyboard if user hits Enter w/o any focused options
|
|
365
|
-
if (e.key === 'Enter' && state.selectionManager.focusedKey == null) (_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.focus();
|
|
366
|
-
else (_inputProps_onKeyDown = inputProps.onKeyDown) === null || _inputProps_onKeyDown === void 0 ? void 0 : _inputProps_onKeyDown.call(inputProps, e);
|
|
367
|
-
};
|
|
368
|
-
return /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$FocusScope), {
|
|
369
|
-
restoreFocus: true,
|
|
370
|
-
contain: true
|
|
371
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement("div", {
|
|
372
|
-
...(0, $gRayl$mergeProps)(overlayProps, dialogProps),
|
|
373
|
-
ref: popoverRef,
|
|
374
|
-
className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'tray-dialog')
|
|
375
|
-
}, /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$DismissButton), {
|
|
376
|
-
onDismiss: onClose
|
|
377
|
-
}), /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$TextFieldBase), {
|
|
378
|
-
label: label,
|
|
379
|
-
labelProps: labelProps,
|
|
380
|
-
inputProps: {
|
|
381
|
-
...inputProps,
|
|
382
|
-
onKeyDown: onKeyDown
|
|
383
|
-
},
|
|
384
|
-
inputRef: inputRef,
|
|
385
|
-
isDisabled: isDisabled,
|
|
386
|
-
isLoading: showLoading && loadingState === 'filtering',
|
|
387
|
-
loadingIndicator: loadingState != null ? loadingCircle : undefined,
|
|
388
|
-
validationState: validationState,
|
|
389
|
-
labelAlign: "start",
|
|
390
|
-
labelPosition: "top",
|
|
391
|
-
wrapperChildren: (state.inputValue !== '' || loadingState === 'filtering' || validationState != null) && !props.isReadOnly ? clearButton : undefined,
|
|
392
|
-
UNSAFE_className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$search_vars_cssmodulejs))), 'spectrum-Search', 'spectrum-Textfield', 'spectrum-Search--loadable', {
|
|
393
|
-
'spectrum-Search--invalid': validationState === 'invalid' && !isDisabled,
|
|
394
|
-
'spectrum-Search--valid': validationState === 'valid' && !isDisabled
|
|
395
|
-
}, (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'tray-textfield', {
|
|
396
|
-
'has-label': !!props.label
|
|
397
|
-
})),
|
|
398
|
-
inputClassName: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'tray-textfield-input', (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$search_vars_cssmodulejs))), 'spectrum-Search-input')),
|
|
399
|
-
validationIconClassName: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$search_vars_cssmodulejs))), 'spectrum-Search-validationIcon')
|
|
400
|
-
}), /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$ListBoxBase), {
|
|
401
|
-
...listBoxProps,
|
|
402
|
-
domProps: {
|
|
403
|
-
onTouchStart: onTouchStart,
|
|
404
|
-
onTouchEnd: onTouchEnd
|
|
405
|
-
},
|
|
406
|
-
disallowEmptySelection: true,
|
|
407
|
-
shouldSelectOnPressUp: true,
|
|
408
|
-
focusOnPointerEnter: true,
|
|
409
|
-
layout: layout,
|
|
410
|
-
state: state,
|
|
411
|
-
shouldUseVirtualFocus: true,
|
|
412
|
-
renderEmptyState: ()=>loadingState !== 'loading' && /*#__PURE__*/ (0, $gRayl$react).createElement("span", {
|
|
413
|
-
className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'no-results')
|
|
414
|
-
}, stringFormatter.format('noResults')),
|
|
415
|
-
UNSAFE_className: (0, $gRayl$classNames)((0, ($parcel$interopDefault($gRayl$combobox_cssmodulejs))), 'tray-listbox'),
|
|
416
|
-
ref: listBoxRef,
|
|
417
|
-
onScroll: onScroll,
|
|
418
|
-
onLoadMore: onLoadMore,
|
|
419
|
-
isLoading: isLoading
|
|
420
|
-
}), /*#__PURE__*/ (0, $gRayl$react).createElement((0, $gRayl$DismissButton), {
|
|
421
|
-
onDismiss: onClose
|
|
422
|
-
})));
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
export {$a1ae4cad4496428f$export$7637df911c069b4d as MobileComboBox, $a1ae4cad4496428f$export$adfa0abcd5972f7e as ComboBoxButton};
|
|
427
|
-
//# sourceMappingURL=MobileComboBox.module.js.map
|