@react-spectrum/combobox 3.13.3 → 3.14.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2019 Adobe
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -87,14 +87,14 @@ const $e4f518eb9b010873$var$ComboBoxBase = /*#__PURE__*/ (0, ($parcel$interopDef
87
87
  if (allowsCustomValue) formValue = 'text';
88
88
  let stringFormatter = (0, $XxzjX$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($9e627d9ac6346a53$exports))), '@react-spectrum/combobox');
89
89
  let isAsync = loadingState != null;
90
- let popoverRef = (0, $XxzjX$react.useRef)(undefined);
90
+ let popoverRef = (0, $XxzjX$react.useRef)(null);
91
91
  let unwrappedPopoverRef = (0, $XxzjX$reactspectrumutils.useUnwrapDOMRef)(popoverRef);
92
- let buttonRef = (0, $XxzjX$react.useRef)(undefined);
92
+ let buttonRef = (0, $XxzjX$react.useRef)(null);
93
93
  let unwrappedButtonRef = (0, $XxzjX$reactspectrumutils.useUnwrapDOMRef)(buttonRef);
94
- let listBoxRef = (0, $XxzjX$react.useRef)(undefined);
95
- let inputRef = (0, $XxzjX$react.useRef)(undefined);
94
+ let listBoxRef = (0, $XxzjX$react.useRef)(null);
95
+ let inputRef = (0, $XxzjX$react.useRef)(null);
96
96
  // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
97
- let inputGroupRef = (0, $XxzjX$react.useRef)(undefined);
97
+ let inputGroupRef = (0, $XxzjX$react.useRef)(null);
98
98
  let domRef = (0, $XxzjX$reactspectrumutils.useFocusableRef)(ref, inputRef);
99
99
  let { contains: contains } = (0, $XxzjX$reactariai18n.useFilter)({
100
100
  sensitivity: 'base'
@@ -116,7 +116,7 @@ const $e4f518eb9b010873$var$ComboBoxBase = /*#__PURE__*/ (0, ($parcel$interopDef
116
116
  name: formValue === 'text' ? name : undefined
117
117
  }, state);
118
118
  // Measure the width of the inputfield and the button to inform the width of the menu (below).
119
- let [menuWidth, setMenuWidth] = (0, $XxzjX$react.useState)(null);
119
+ let [menuWidth, setMenuWidth] = (0, $XxzjX$react.useState)(undefined);
120
120
  let { scale: scale } = (0, $XxzjX$reactspectrumprovider.useProvider)();
121
121
  let onResize = (0, $XxzjX$react.useCallback)(()=>{
122
122
  if (unwrappedButtonRef.current && inputRef.current) {
@@ -137,12 +137,16 @@ const $e4f518eb9b010873$var$ComboBoxBase = /*#__PURE__*/ (0, ($parcel$interopDef
137
137
  scale,
138
138
  onResize
139
139
  ]);
140
- let width = isQuiet ? null : menuWidth;
140
+ let width = isQuiet ? undefined : menuWidth;
141
141
  let style = {
142
142
  width: customMenuWidth ? (0, $XxzjX$reactspectrumutils.dimensionValue)(customMenuWidth) : width,
143
143
  minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
144
144
  };
145
- var _state_selectedKey;
145
+ let cbInputProps = {
146
+ ...props,
147
+ children: null
148
+ };
149
+ var _state_selectedKey, _state_focusStrategy;
146
150
  return /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, ($parcel$interopDefault($XxzjX$react))).Fragment, null, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactspectrumlabel.Field), {
147
151
  ...props,
148
152
  descriptionProps: descriptionProps,
@@ -153,14 +157,14 @@ const $e4f518eb9b010873$var$ComboBoxBase = /*#__PURE__*/ (0, ($parcel$interopDef
153
157
  labelProps: labelProps,
154
158
  ref: domRef
155
159
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement($e4f518eb9b010873$var$ComboBoxInput, {
156
- ...props,
160
+ ...cbInputProps,
157
161
  isOpen: state.isOpen,
158
162
  loadingState: loadingState,
159
163
  inputProps: inputProps,
160
164
  inputRef: inputRef,
161
165
  triggerProps: buttonProps,
162
166
  triggerRef: buttonRef,
163
- validationState: props.validationState || (isInvalid ? 'invalid' : null),
167
+ validationState: props.validationState || (isInvalid ? 'invalid' : undefined),
164
168
  ref: inputGroupRef
165
169
  })), name && formValue === 'key' && /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement("input", {
166
170
  type: "hidden",
@@ -183,7 +187,7 @@ const $e4f518eb9b010873$var$ComboBoxBase = /*#__PURE__*/ (0, ($parcel$interopDef
183
187
  ...listBoxProps,
184
188
  ref: listBoxRef,
185
189
  disallowEmptySelection: true,
186
- autoFocus: state.focusStrategy,
190
+ autoFocus: (_state_focusStrategy = state.focusStrategy) !== null && _state_focusStrategy !== void 0 ? _state_focusStrategy : undefined,
187
191
  shouldSelectOnPressUp: true,
188
192
  focusOnPointerEnter: true,
189
193
  layout: layout,
@@ -227,7 +231,7 @@ const $e4f518eb9b010873$var$ComboBoxInput = /*#__PURE__*/ (0, ($parcel$interopDe
227
231
  } else if (!isLoading) {
228
232
  // If loading is no longer happening, clear any timers and hide the loading circle
229
233
  setShowLoading(false);
230
- clearTimeout(timeout.current);
234
+ if (timeout.current) clearTimeout(timeout.current);
231
235
  timeout.current = null;
232
236
  }
233
237
  lastInputValue.current = inputValue;
@@ -238,7 +242,7 @@ const $e4f518eb9b010873$var$ComboBoxInput = /*#__PURE__*/ (0, ($parcel$interopDe
238
242
  ]);
239
243
  (0, $XxzjX$react.useEffect)(()=>{
240
244
  return ()=>{
241
- clearTimeout(timeout.current);
245
+ if (timeout.current) clearTimeout(timeout.current);
242
246
  timeout.current = null;
243
247
  };
244
248
  }, []);
@@ -270,7 +274,7 @@ const $e4f518eb9b010873$var$ComboBoxInput = /*#__PURE__*/ (0, ($parcel$interopDe
270
274
  // loading circle should only be displayed if menu is open, if menuTrigger is "manual", or first time load (to stop circle from showing up when user selects an option)
271
275
  // TODO: add special case for completionMode: complete as well
272
276
  isLoading: showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'),
273
- loadingIndicator: loadingState != null && loadingCircle,
277
+ loadingIndicator: loadingState != null ? loadingCircle : undefined,
274
278
  disableFocusRing: true
275
279
  }), /*#__PURE__*/ (0, ($parcel$interopDefault($XxzjX$react))).createElement((0, $XxzjX$reactariainteractions.PressResponder), {
276
280
  preventFocusOnPress: true,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AA4CD,SAAS,+BAA2B,KAA+B,EAAE,GAA8B;IACjG,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IAErB,IAAI,MAAM,WAAW,EACnB,QAAQ,IAAI,CAAC;IAGf,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,UACF,0DAA0D;IAC1D,qBAAO,0DAAC,CAAA,GAAA,wCAAa;QAAG,GAAG,KAAK;QAAE,aAAY;QAAQ,KAAK;;SAE3D,qBAAO,0DAAC;QAAc,GAAG,KAAK;QAAE,KAAK;;AAEzC;AAEA,MAAM,mDAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,aAA+B,KAA+B,EAAE,GAA8B;IAC3I,IAAI,eACF,cAAc,qBACd,aAAa,iBACb,YAAY,iBACZ,QAAQ,kBACR,OAAO,gBACP,YAAY,cACZ,UAAU,qBACV,iBAAiB,EACjB,WAAW,eAAe,QAC1B,IAAI,aACJ,YAAY,QACb,GAAG;IACJ,IAAI,mBACF,YAAY;IAGd,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,UAAU,gBAAgB;IAC9B,IAAI,aAAa,CAAA,GAAA,mBAAK,EAA+B;IACrD,IAAI,sBAAsB,CAAA,GAAA,yCAAc,EAAE;IAC1C,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAkC;IACvD,IAAI,qBAAqB,CAAA,GAAA,yCAAc,E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CAAA,GAAA,mDAAK,GACL;QAGJ,SAAS;QACT,iBAAiB;qBACjB,0DAAC,CAAA,GAAA,iEAAgB;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAMpE;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/combobox/src/ComboBox.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport ChevronDownMedium from '@spectrum-icons/ui/ChevronDownMedium';\nimport {\n classNames,\n dimensionValue,\n useFocusableRef,\n useIsMobileDevice,\n useResizeObserver,\n useUnwrapDOMRef\n} from '@react-spectrum/utils';\nimport comboboxStyles from './combobox.css';\nimport {DOMRefValue, FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {FocusRing} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListBoxBase, useListBoxLayout} from '@react-spectrum/listbox';\nimport {MobileComboBox} from './MobileComboBox';\nimport {Popover} from '@react-spectrum/overlays';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {\n InputHTMLAttributes,\n ReactElement,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {SpectrumComboBoxProps} from '@react-types/combobox';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TextFieldBase} from '@react-spectrum/textfield';\nimport textfieldStyles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useComboBoxState} from '@react-stately/combobox';\nimport {useFilter, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider, useProviderProps} from '@react-spectrum/provider';\n\nfunction ComboBox<T extends object>(props: SpectrumComboBoxProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n if (props.placeholder) {\n console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/ComboBox.html#help-text');\n }\n\n let isMobile = useIsMobileDevice();\n if (isMobile) {\n // menuTrigger=focus/manual don't apply to mobile combobox\n return <MobileComboBox {...props} menuTrigger=\"input\" ref={ref} />;\n } else {\n return <ComboBoxBase {...props} ref={ref} />;\n }\n}\n\nconst ComboBoxBase = React.forwardRef(function ComboBoxBase<T extends object>(props: SpectrumComboBoxProps<T>, ref: FocusableRef<HTMLElement>) {\n let {\n menuTrigger = 'input',\n shouldFlip = true,\n direction = 'bottom',\n align = 'start',\n isQuiet,\n loadingState,\n onLoadMore,\n allowsCustomValue,\n menuWidth: customMenuWidth,\n name,\n formValue = 'text'\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n let isAsync = loadingState != null;\n let popoverRef = useRef<DOMRefValue<HTMLDivElement>>(undefined);\n let unwrappedPopoverRef = useUnwrapDOMRef(popoverRef);\n let buttonRef = useRef<FocusableRefValue<HTMLElement>>(undefined);\n let unwrappedButtonRef = useUnwrapDOMRef(buttonRef);\n let listBoxRef = useRef(undefined);\n let inputRef = useRef<HTMLInputElement>(undefined);\n // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.\n let inputGroupRef = useRef<HTMLDivElement>(undefined);\n let domRef = useFocusableRef(ref, inputRef);\n\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState(\n {\n ...props,\n defaultFilter: contains,\n allowsEmptyCollection: isAsync\n }\n );\n let layout = useListBoxLayout();\n\n let {buttonProps, inputProps, listBoxProps, labelProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useComboBox(\n {\n ...props,\n layoutDelegate: layout,\n buttonRef: unwrappedButtonRef,\n popoverRef: unwrappedPopoverRef,\n listBoxRef,\n inputRef: inputRef,\n menuTrigger,\n name: formValue === 'text' ? name : undefined\n },\n state\n );\n\n // Measure the width of the inputfield and the button to inform the width of the menu (below).\n let [menuWidth, setMenuWidth] = useState(null);\n let {scale} = useProvider();\n\n let onResize = useCallback(() => {\n if (unwrappedButtonRef.current && inputRef.current) {\n let buttonWidth = unwrappedButtonRef.current.offsetWidth;\n let inputWidth = inputRef.current.offsetWidth;\n setMenuWidth(buttonWidth + inputWidth);\n }\n }, [unwrappedButtonRef, inputRef, setMenuWidth]);\n\n useResizeObserver({\n ref: domRef,\n onResize: onResize\n });\n\n useLayoutEffect(onResize, [scale, onResize]);\n\n let width = isQuiet ? null : menuWidth;\n let style = {\n width: customMenuWidth ? dimensionValue(customMenuWidth) : width,\n minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth\n };\n\n return (\n <>\n <Field\n {...props}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n labelProps={labelProps}\n ref={domRef}>\n <ComboBoxInput\n {...props}\n isOpen={state.isOpen}\n loadingState={loadingState}\n inputProps={inputProps}\n inputRef={inputRef}\n triggerProps={buttonProps}\n triggerRef={buttonRef}\n validationState={props.validationState || (isInvalid ? 'invalid' : null)}\n ref={inputGroupRef} />\n </Field>\n {name && formValue === 'key' && <input type=\"hidden\" name={name} value={state.selectedKey ?? ''} />}\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {'spectrum-InputGroup-popover--quiet': isQuiet})}\n ref={popoverRef}\n triggerRef={inputGroupRef}\n scrollRef={listBoxRef}\n placement={`${direction} ${align}`}\n hideArrow\n isNonModal\n shouldFlip={shouldFlip}>\n <ListBoxBase\n {...listBoxProps}\n ref={listBoxRef}\n disallowEmptySelection\n autoFocus={state.focusStrategy}\n shouldSelectOnPressUp\n focusOnPointerEnter\n layout={layout}\n state={state}\n shouldUseVirtualFocus\n isLoading={loadingState === 'loading' || loadingState === 'loadingMore'}\n showLoadingSpinner={loadingState === 'loadingMore'}\n onLoadMore={onLoadMore}\n renderEmptyState={() => isAsync && (\n <span className={classNames(comboboxStyles, 'no-results')}>\n {loadingState === 'loading' ? stringFormatter.format('loading') : stringFormatter.format('noResults')}\n </span>\n )} />\n </Popover>\n </>\n );\n});\n\ninterface ComboBoxInputProps extends SpectrumComboBoxProps<unknown> {\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>,\n triggerProps: AriaButtonProps,\n triggerRef: RefObject<FocusableRefValue<HTMLElement> | null>,\n style?: React.CSSProperties,\n className?: string,\n isOpen?: boolean\n}\n\nconst ComboBoxInput = React.forwardRef(function ComboBoxInput(props: ComboBoxInputProps, ref: RefObject<HTMLElement | null>) {\n let {\n isQuiet,\n isDisabled,\n validationState,\n inputProps,\n inputRef,\n triggerProps,\n triggerRef,\n autoFocus,\n style,\n className,\n loadingState,\n isOpen,\n menuTrigger\n } = props;\n let {hoverProps, isHovered} = useHover({});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n let timeout = useRef(null);\n let [showLoading, setShowLoading] = useState(false);\n\n let loadingCircle = (\n <ProgressCircle\n aria-label={stringFormatter.format('loading')}\n size=\"S\"\n isIndeterminate\n UNSAFE_className={classNames(\n textfieldStyles,\n 'spectrum-Textfield-circleLoader',\n classNames(\n styles,\n 'spectrum-InputGroup-input-circleLoader'\n )\n )} />\n );\n\n let isLoading = loadingState === 'loading' || loadingState === 'filtering';\n let inputValue = inputProps.value;\n let lastInputValue = useRef(inputValue);\n useEffect(() => {\n if (isLoading && !showLoading) {\n if (timeout.current === null) {\n timeout.current = setTimeout(() => {\n setShowLoading(true);\n }, 500);\n }\n\n // If user is typing, clear the timer and restart since it is a new request\n if (inputValue !== lastInputValue.current) {\n clearTimeout(timeout.current);\n timeout.current = setTimeout(() => {\n setShowLoading(true);\n }, 500);\n }\n } else if (!isLoading) {\n // If loading is no longer happening, clear any timers and hide the loading circle\n setShowLoading(false);\n clearTimeout(timeout.current);\n timeout.current = null;\n }\n\n lastInputValue.current = inputValue;\n }, [isLoading, showLoading, inputValue]);\n\n useEffect(() => {\n return () => {\n clearTimeout(timeout.current);\n timeout.current = null;\n };\n }, []);\n\n return (\n (<FocusRing\n within\n isTextInput\n focusClass={classNames(styles, 'is-focused')}\n focusRingClass={classNames(styles, 'focus-ring')}\n autoFocus={autoFocus}>\n <div\n {...hoverProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n style={style}\n className={\n classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'is-disabled': isDisabled,\n 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,\n 'is-hovered': isHovered\n },\n className\n )\n }>\n <TextFieldBase\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-InputGroup-field'\n )\n }\n inputClassName={\n classNames(\n styles,\n 'spectrum-InputGroup-input'\n )\n }\n validationIconClassName={\n classNames(\n styles,\n 'spectrum-InputGroup-input-validationIcon'\n )\n }\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n // loading circle should only be displayed if menu is open, if menuTrigger is \"manual\", or first time load (to stop circle from showing up when user selects an option)\n // TODO: add special case for completionMode: complete as well\n isLoading={showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')}\n loadingIndicator={loadingState != null && loadingCircle}\n disableFocusRing />\n <PressResponder preventFocusOnPress isPressed={isOpen}>\n <FieldButton\n {...triggerProps}\n ref={triggerRef}\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-FieldButton'\n )\n }\n isQuiet={isQuiet}\n validationState={validationState}>\n <ChevronDownMedium UNSAFE_className={classNames(styles, 'spectrum-Dropdown-chevron')} />\n </FieldButton>\n </PressResponder>\n </div>\n </FocusRing>)\n );\n});\n\n/**\n * ComboBoxes combine a text entry with a picker menu, allowing users to filter longer lists to only the selections matching a query.\n */\nconst _ComboBox = React.forwardRef(ComboBox) as <T>(props: SpectrumComboBoxProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_ComboBox as ComboBox};\n"],"names":[],"version":3,"file":"ComboBox.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AA6CD,SAAS,+BAA2B,KAA+B,EAAE,GAA8B;IACjG,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,qCAAW,EAAE;IAErB,IAAI,MAAM,WAAW,EACnB,QAAQ,IAAI,CAAC;IAGf,IAAI,WAAW,CAAA,GAAA,2CAAgB;IAC/B,IAAI,UACF,0DAA0D;IAC1D,qBAAO,0DAAC,CAAA,GAAA,wCAAa;QAAG,GAAG,KAAK;QAAE,aAAY;QAAQ,KAAK;;SAE3D,qBAAO,0DAAC;QAAc,GAAG,KAAK;QAAE,KAAK;;AAEzC;AAEA,MAAM,mDAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,aAAa,KAAiC,EAAE,GAA8B;IAC3H,IAAI,eACF,cAAc,qBACd,aAAa,iBACb,YAAY,iBACZ,QAAQ,kBACR,OAAO,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QACX,YAAY;QACZ,UAAU;QACV,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,gBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,yBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,YAAY;QACZ,SAAS;QACT,iBAAiB;QACjB,uKAAuK;QACvK,8DAA8D;QAC9D,WAAW,eAAgB,CAAA,UAAU,gBAAgB,YAAY,iBAAiB,SAAQ;QAC1F,kBAAkB,gBAAgB,OAAO,gBAAgB;QACzD,kBAAA;sBACF,0DAAC,CAAA,GAAA,2CAAa;QAAE,qBAAA;QAAoB,WAAW;qBAC7C,0DAAC,CAAA,GAAA,sCAAU;QACR,GAAG,YAAY;QAChB,KAAK;QACL,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;QAGJ,SAAS;QACT,iBAAiB;qBACjB,0DAAC,CAAA,GAAA,iEAAgB;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;AAMpE;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/combobox/src/ComboBox.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport ChevronDownMedium from '@spectrum-icons/ui/ChevronDownMedium';\nimport {\n classNames,\n dimensionValue,\n useFocusableRef,\n useIsMobileDevice,\n useResizeObserver,\n useUnwrapDOMRef\n} from '@react-spectrum/utils';\nimport comboboxStyles from './combobox.css';\nimport {DOMRefValue, FocusableRef, FocusableRefValue} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {FocusRing} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListBoxBase, useListBoxLayout} from '@react-spectrum/listbox';\nimport {MobileComboBox} from './MobileComboBox';\nimport {Popover} from '@react-spectrum/overlays';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {\n ForwardedRef,\n InputHTMLAttributes,\n ReactElement,\n RefObject,\n useCallback,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {SpectrumComboBoxProps} from '@react-types/combobox';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TextFieldBase} from '@react-spectrum/textfield';\nimport textfieldStyles from '@adobe/spectrum-css-temp/components/textfield/vars.css';\nimport {useComboBox} from '@react-aria/combobox';\nimport {useComboBoxState} from '@react-stately/combobox';\nimport {useFilter, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useProvider, useProviderProps} from '@react-spectrum/provider';\n\nfunction ComboBox<T extends object>(props: SpectrumComboBoxProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n if (props.placeholder) {\n console.warn('Placeholders are deprecated due to accessibility issues. Please use help text instead. See the docs for details: https://react-spectrum.adobe.com/react-spectrum/ComboBox.html#help-text');\n }\n\n let isMobile = useIsMobileDevice();\n if (isMobile) {\n // menuTrigger=focus/manual don't apply to mobile combobox\n return <MobileComboBox {...props} menuTrigger=\"input\" ref={ref} />;\n } else {\n return <ComboBoxBase {...props} ref={ref} />;\n }\n}\n\nconst ComboBoxBase = React.forwardRef(function ComboBoxBase(props: SpectrumComboBoxProps<any>, ref: FocusableRef<HTMLElement>) {\n let {\n menuTrigger = 'input',\n shouldFlip = true,\n direction = 'bottom',\n align = 'start',\n isQuiet,\n loadingState,\n onLoadMore,\n allowsCustomValue,\n menuWidth: customMenuWidth,\n name,\n formValue = 'text'\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n let isAsync = loadingState != null;\n let popoverRef = useRef<DOMRefValue<HTMLDivElement>>(null);\n let unwrappedPopoverRef = useUnwrapDOMRef(popoverRef);\n let buttonRef = useRef<FocusableRefValue<HTMLElement>>(null);\n let unwrappedButtonRef = useUnwrapDOMRef(buttonRef);\n let listBoxRef = useRef(null);\n let inputRef = useRef<HTMLInputElement>(null);\n // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.\n let inputGroupRef = useRef<HTMLDivElement>(null);\n let domRef = useFocusableRef(ref, inputRef);\n\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState(\n {\n ...props,\n defaultFilter: contains,\n allowsEmptyCollection: isAsync\n }\n );\n let layout = useListBoxLayout();\n\n let {buttonProps, inputProps, listBoxProps, labelProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useComboBox(\n {\n ...props,\n layoutDelegate: layout,\n buttonRef: unwrappedButtonRef,\n popoverRef: unwrappedPopoverRef,\n listBoxRef,\n inputRef: inputRef,\n menuTrigger,\n name: formValue === 'text' ? name : undefined\n },\n state\n );\n\n // Measure the width of the inputfield and the button to inform the width of the menu (below).\n let [menuWidth, setMenuWidth] = useState<number | undefined>(undefined);\n let {scale} = useProvider();\n\n let onResize = useCallback(() => {\n if (unwrappedButtonRef.current && inputRef.current) {\n let buttonWidth = unwrappedButtonRef.current.offsetWidth;\n let inputWidth = inputRef.current.offsetWidth;\n setMenuWidth(buttonWidth + inputWidth);\n }\n }, [unwrappedButtonRef, inputRef, setMenuWidth]);\n\n useResizeObserver({\n ref: domRef,\n onResize: onResize\n });\n\n useLayoutEffect(onResize, [scale, onResize]);\n\n let width = isQuiet ? undefined : menuWidth;\n let style = {\n width: customMenuWidth ? dimensionValue(customMenuWidth) : width,\n minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth\n };\n let cbInputProps = {...props, children: null};\n\n return (\n <>\n <Field\n {...props}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n labelProps={labelProps}\n ref={domRef}>\n <ComboBoxInput\n {...cbInputProps}\n isOpen={state.isOpen}\n loadingState={loadingState}\n inputProps={inputProps}\n inputRef={inputRef}\n triggerProps={buttonProps}\n triggerRef={buttonRef}\n validationState={props.validationState || (isInvalid ? 'invalid' : undefined)}\n ref={inputGroupRef} />\n </Field>\n {name && formValue === 'key' && <input type=\"hidden\" name={name} value={state.selectedKey ?? ''} />}\n <Popover\n state={state}\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-InputGroup-popover', {'spectrum-InputGroup-popover--quiet': isQuiet})}\n ref={popoverRef}\n triggerRef={inputGroupRef}\n scrollRef={listBoxRef}\n placement={`${direction} ${align}`}\n hideArrow\n isNonModal\n shouldFlip={shouldFlip}>\n <ListBoxBase\n {...listBoxProps}\n ref={listBoxRef}\n disallowEmptySelection\n autoFocus={state.focusStrategy ?? undefined}\n shouldSelectOnPressUp\n focusOnPointerEnter\n layout={layout}\n state={state}\n shouldUseVirtualFocus\n isLoading={loadingState === 'loading' || loadingState === 'loadingMore'}\n showLoadingSpinner={loadingState === 'loadingMore'}\n onLoadMore={onLoadMore}\n renderEmptyState={() => isAsync && (\n <span className={classNames(comboboxStyles, 'no-results')}>\n {loadingState === 'loading' ? stringFormatter.format('loading') : stringFormatter.format('noResults')}\n </span>\n )} />\n </Popover>\n </>\n );\n});\n\ninterface ComboBoxInputProps extends SpectrumComboBoxProps<unknown> {\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n inputRef: RefObject<HTMLInputElement | HTMLTextAreaElement | null>,\n triggerProps: AriaButtonProps,\n triggerRef: RefObject<FocusableRefValue<HTMLElement> | null>,\n style?: React.CSSProperties,\n className?: string,\n isOpen?: boolean\n}\n\nconst ComboBoxInput = React.forwardRef(function ComboBoxInput(props: ComboBoxInputProps, ref: ForwardedRef<HTMLElement | null>) {\n let {\n isQuiet,\n isDisabled,\n validationState,\n inputProps,\n inputRef,\n triggerProps,\n triggerRef,\n autoFocus,\n style,\n className,\n loadingState,\n isOpen,\n menuTrigger\n } = props;\n let {hoverProps, isHovered} = useHover({});\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/combobox');\n let timeout = useRef<ReturnType<typeof setTimeout> | null>(null);\n let [showLoading, setShowLoading] = useState(false);\n\n let loadingCircle = (\n <ProgressCircle\n aria-label={stringFormatter.format('loading')}\n size=\"S\"\n isIndeterminate\n UNSAFE_className={classNames(\n textfieldStyles,\n 'spectrum-Textfield-circleLoader',\n classNames(\n styles,\n 'spectrum-InputGroup-input-circleLoader'\n )\n )} />\n );\n\n let isLoading = loadingState === 'loading' || loadingState === 'filtering';\n let inputValue = inputProps.value;\n let lastInputValue = useRef(inputValue);\n useEffect(() => {\n if (isLoading && !showLoading) {\n if (timeout.current === null) {\n timeout.current = setTimeout(() => {\n setShowLoading(true);\n }, 500);\n }\n\n // If user is typing, clear the timer and restart since it is a new request\n if (inputValue !== lastInputValue.current) {\n clearTimeout(timeout.current);\n timeout.current = setTimeout(() => {\n setShowLoading(true);\n }, 500);\n }\n } else if (!isLoading) {\n // If loading is no longer happening, clear any timers and hide the loading circle\n setShowLoading(false);\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n timeout.current = null;\n }\n\n lastInputValue.current = inputValue;\n }, [isLoading, showLoading, inputValue]);\n\n useEffect(() => {\n return () => {\n if (timeout.current) {\n clearTimeout(timeout.current);\n }\n timeout.current = null;\n };\n }, []);\n\n return (\n (<FocusRing\n within\n isTextInput\n focusClass={classNames(styles, 'is-focused')}\n focusRingClass={classNames(styles, 'focus-ring')}\n autoFocus={autoFocus}>\n <div\n {...hoverProps}\n ref={ref as RefObject<HTMLDivElement | null>}\n style={style}\n className={\n classNames(\n styles,\n 'spectrum-InputGroup',\n {\n 'spectrum-InputGroup--quiet': isQuiet,\n 'is-disabled': isDisabled,\n 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,\n 'is-hovered': isHovered\n },\n className\n )\n }>\n <TextFieldBase\n inputProps={inputProps}\n inputRef={inputRef}\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-InputGroup-field'\n )\n }\n inputClassName={\n classNames(\n styles,\n 'spectrum-InputGroup-input'\n )\n }\n validationIconClassName={\n classNames(\n styles,\n 'spectrum-InputGroup-input-validationIcon'\n )\n }\n isDisabled={isDisabled}\n isQuiet={isQuiet}\n validationState={validationState}\n // loading circle should only be displayed if menu is open, if menuTrigger is \"manual\", or first time load (to stop circle from showing up when user selects an option)\n // TODO: add special case for completionMode: complete as well\n isLoading={showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading')}\n loadingIndicator={loadingState != null ? loadingCircle : undefined}\n disableFocusRing />\n <PressResponder preventFocusOnPress isPressed={isOpen}>\n <FieldButton\n {...triggerProps}\n ref={triggerRef}\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-FieldButton'\n )\n }\n isQuiet={isQuiet}\n validationState={validationState}>\n <ChevronDownMedium UNSAFE_className={classNames(styles, 'spectrum-Dropdown-chevron')} />\n </FieldButton>\n </PressResponder>\n </div>\n </FocusRing>)\n );\n});\n\n/**\n * ComboBoxes combine a text entry with a picker menu, allowing users to filter longer lists to only the selections matching a query.\n */\nconst _ComboBox = React.forwardRef(ComboBox) as <T>(props: SpectrumComboBoxProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_ComboBox as ComboBox};\n"],"names":[],"version":3,"file":"ComboBox.main.js.map"}
package/dist/ComboBox.mjs CHANGED
@@ -81,14 +81,14 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
81
81
  if (allowsCustomValue) formValue = 'text';
82
82
  let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
83
83
  let isAsync = loadingState != null;
84
- let popoverRef = (0, $c3ZYr$useRef)(undefined);
84
+ let popoverRef = (0, $c3ZYr$useRef)(null);
85
85
  let unwrappedPopoverRef = (0, $c3ZYr$useUnwrapDOMRef)(popoverRef);
86
- let buttonRef = (0, $c3ZYr$useRef)(undefined);
86
+ let buttonRef = (0, $c3ZYr$useRef)(null);
87
87
  let unwrappedButtonRef = (0, $c3ZYr$useUnwrapDOMRef)(buttonRef);
88
- let listBoxRef = (0, $c3ZYr$useRef)(undefined);
89
- let inputRef = (0, $c3ZYr$useRef)(undefined);
88
+ let listBoxRef = (0, $c3ZYr$useRef)(null);
89
+ let inputRef = (0, $c3ZYr$useRef)(null);
90
90
  // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
91
- let inputGroupRef = (0, $c3ZYr$useRef)(undefined);
91
+ let inputGroupRef = (0, $c3ZYr$useRef)(null);
92
92
  let domRef = (0, $c3ZYr$useFocusableRef)(ref, inputRef);
93
93
  let { contains: contains } = (0, $c3ZYr$useFilter)({
94
94
  sensitivity: 'base'
@@ -110,7 +110,7 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
110
110
  name: formValue === 'text' ? name : undefined
111
111
  }, state);
112
112
  // Measure the width of the inputfield and the button to inform the width of the menu (below).
113
- let [menuWidth, setMenuWidth] = (0, $c3ZYr$useState)(null);
113
+ let [menuWidth, setMenuWidth] = (0, $c3ZYr$useState)(undefined);
114
114
  let { scale: scale } = (0, $c3ZYr$useProvider)();
115
115
  let onResize = (0, $c3ZYr$useCallback)(()=>{
116
116
  if (unwrappedButtonRef.current && inputRef.current) {
@@ -131,12 +131,16 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
131
131
  scale,
132
132
  onResize
133
133
  ]);
134
- let width = isQuiet ? null : menuWidth;
134
+ let width = isQuiet ? undefined : menuWidth;
135
135
  let style = {
136
136
  width: customMenuWidth ? (0, $c3ZYr$dimensionValue)(customMenuWidth) : width,
137
137
  minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
138
138
  };
139
- var _state_selectedKey;
139
+ let cbInputProps = {
140
+ ...props,
141
+ children: null
142
+ };
143
+ var _state_selectedKey, _state_focusStrategy;
140
144
  return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$react).Fragment, null, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Field), {
141
145
  ...props,
142
146
  descriptionProps: descriptionProps,
@@ -147,14 +151,14 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
147
151
  labelProps: labelProps,
148
152
  ref: domRef
149
153
  }, /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxInput, {
150
- ...props,
154
+ ...cbInputProps,
151
155
  isOpen: state.isOpen,
152
156
  loadingState: loadingState,
153
157
  inputProps: inputProps,
154
158
  inputRef: inputRef,
155
159
  triggerProps: buttonProps,
156
160
  triggerRef: buttonRef,
157
- validationState: props.validationState || (isInvalid ? 'invalid' : null),
161
+ validationState: props.validationState || (isInvalid ? 'invalid' : undefined),
158
162
  ref: inputGroupRef
159
163
  })), name && formValue === 'key' && /*#__PURE__*/ (0, $c3ZYr$react).createElement("input", {
160
164
  type: "hidden",
@@ -177,7 +181,7 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
177
181
  ...listBoxProps,
178
182
  ref: listBoxRef,
179
183
  disallowEmptySelection: true,
180
- autoFocus: state.focusStrategy,
184
+ autoFocus: (_state_focusStrategy = state.focusStrategy) !== null && _state_focusStrategy !== void 0 ? _state_focusStrategy : undefined,
181
185
  shouldSelectOnPressUp: true,
182
186
  focusOnPointerEnter: true,
183
187
  layout: layout,
@@ -221,7 +225,7 @@ const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forw
221
225
  } else if (!isLoading) {
222
226
  // If loading is no longer happening, clear any timers and hide the loading circle
223
227
  setShowLoading(false);
224
- clearTimeout(timeout.current);
228
+ if (timeout.current) clearTimeout(timeout.current);
225
229
  timeout.current = null;
226
230
  }
227
231
  lastInputValue.current = inputValue;
@@ -232,7 +236,7 @@ const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forw
232
236
  ]);
233
237
  (0, $c3ZYr$useEffect)(()=>{
234
238
  return ()=>{
235
- clearTimeout(timeout.current);
239
+ if (timeout.current) clearTimeout(timeout.current);
236
240
  timeout.current = null;
237
241
  };
238
242
  }, []);
@@ -264,7 +268,7 @@ const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forw
264
268
  // loading circle should only be displayed if menu is open, if menuTrigger is "manual", or first time load (to stop circle from showing up when user selects an option)
265
269
  // TODO: add special case for completionMode: complete as well
266
270
  isLoading: showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'),
267
- loadingIndicator: loadingState != null && loadingCircle,
271
+ loadingIndicator: loadingState != null ? loadingCircle : undefined,
268
272
  disableFocusRing: true
269
273
  }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$PressResponder), {
270
274
  preventFocusOnPress: true,
@@ -81,14 +81,14 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
81
81
  if (allowsCustomValue) formValue = 'text';
82
82
  let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
83
83
  let isAsync = loadingState != null;
84
- let popoverRef = (0, $c3ZYr$useRef)(undefined);
84
+ let popoverRef = (0, $c3ZYr$useRef)(null);
85
85
  let unwrappedPopoverRef = (0, $c3ZYr$useUnwrapDOMRef)(popoverRef);
86
- let buttonRef = (0, $c3ZYr$useRef)(undefined);
86
+ let buttonRef = (0, $c3ZYr$useRef)(null);
87
87
  let unwrappedButtonRef = (0, $c3ZYr$useUnwrapDOMRef)(buttonRef);
88
- let listBoxRef = (0, $c3ZYr$useRef)(undefined);
89
- let inputRef = (0, $c3ZYr$useRef)(undefined);
88
+ let listBoxRef = (0, $c3ZYr$useRef)(null);
89
+ let inputRef = (0, $c3ZYr$useRef)(null);
90
90
  // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
91
- let inputGroupRef = (0, $c3ZYr$useRef)(undefined);
91
+ let inputGroupRef = (0, $c3ZYr$useRef)(null);
92
92
  let domRef = (0, $c3ZYr$useFocusableRef)(ref, inputRef);
93
93
  let { contains: contains } = (0, $c3ZYr$useFilter)({
94
94
  sensitivity: 'base'
@@ -110,7 +110,7 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
110
110
  name: formValue === 'text' ? name : undefined
111
111
  }, state);
112
112
  // Measure the width of the inputfield and the button to inform the width of the menu (below).
113
- let [menuWidth, setMenuWidth] = (0, $c3ZYr$useState)(null);
113
+ let [menuWidth, setMenuWidth] = (0, $c3ZYr$useState)(undefined);
114
114
  let { scale: scale } = (0, $c3ZYr$useProvider)();
115
115
  let onResize = (0, $c3ZYr$useCallback)(()=>{
116
116
  if (unwrappedButtonRef.current && inputRef.current) {
@@ -131,12 +131,16 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
131
131
  scale,
132
132
  onResize
133
133
  ]);
134
- let width = isQuiet ? null : menuWidth;
134
+ let width = isQuiet ? undefined : menuWidth;
135
135
  let style = {
136
136
  width: customMenuWidth ? (0, $c3ZYr$dimensionValue)(customMenuWidth) : width,
137
137
  minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
138
138
  };
139
- var _state_selectedKey;
139
+ let cbInputProps = {
140
+ ...props,
141
+ children: null
142
+ };
143
+ var _state_selectedKey, _state_focusStrategy;
140
144
  return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$react).Fragment, null, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Field), {
141
145
  ...props,
142
146
  descriptionProps: descriptionProps,
@@ -147,14 +151,14 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
147
151
  labelProps: labelProps,
148
152
  ref: domRef
149
153
  }, /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxInput, {
150
- ...props,
154
+ ...cbInputProps,
151
155
  isOpen: state.isOpen,
152
156
  loadingState: loadingState,
153
157
  inputProps: inputProps,
154
158
  inputRef: inputRef,
155
159
  triggerProps: buttonProps,
156
160
  triggerRef: buttonRef,
157
- validationState: props.validationState || (isInvalid ? 'invalid' : null),
161
+ validationState: props.validationState || (isInvalid ? 'invalid' : undefined),
158
162
  ref: inputGroupRef
159
163
  })), name && formValue === 'key' && /*#__PURE__*/ (0, $c3ZYr$react).createElement("input", {
160
164
  type: "hidden",
@@ -177,7 +181,7 @@ const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwa
177
181
  ...listBoxProps,
178
182
  ref: listBoxRef,
179
183
  disallowEmptySelection: true,
180
- autoFocus: state.focusStrategy,
184
+ autoFocus: (_state_focusStrategy = state.focusStrategy) !== null && _state_focusStrategy !== void 0 ? _state_focusStrategy : undefined,
181
185
  shouldSelectOnPressUp: true,
182
186
  focusOnPointerEnter: true,
183
187
  layout: layout,
@@ -221,7 +225,7 @@ const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forw
221
225
  } else if (!isLoading) {
222
226
  // If loading is no longer happening, clear any timers and hide the loading circle
223
227
  setShowLoading(false);
224
- clearTimeout(timeout.current);
228
+ if (timeout.current) clearTimeout(timeout.current);
225
229
  timeout.current = null;
226
230
  }
227
231
  lastInputValue.current = inputValue;
@@ -232,7 +236,7 @@ const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forw
232
236
  ]);
233
237
  (0, $c3ZYr$useEffect)(()=>{
234
238
  return ()=>{
235
- clearTimeout(timeout.current);
239
+ if (timeout.current) clearTimeout(timeout.current);
236
240
  timeout.current = null;
237
241
  };
238
242
  }, []);
@@ -264,7 +268,7 @@ const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forw
264
268
  // loading circle should only be displayed if menu is open, if menuTrigger is "manual", or first time load (to stop circle from showing up when user selects an option)
265
269
  // TODO: add special case for completionMode: complete as well
266
270
  isLoading: showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'),
267
- loadingIndicator: loadingState != null && loadingCircle,
271
+ loadingIndicator: loadingState != null ? loadingCircle : undefined,
268
272
  disableFocusRing: true
269
273
  }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$PressResponder), {
270
274
  preventFocusOnPress: true,