@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.
Files changed (240) hide show
  1. package/dist/import.mjs +5 -3
  2. package/dist/main.js +7 -5
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +5 -3
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +4 -0
  7. package/package.json +14 -49
  8. package/src/index.ts +5 -3
  9. package/dist/ComboBox.main.js +0 -305
  10. package/dist/ComboBox.main.js.map +0 -1
  11. package/dist/ComboBox.mjs +0 -300
  12. package/dist/ComboBox.module.js +0 -300
  13. package/dist/ComboBox.module.js.map +0 -1
  14. package/dist/MobileComboBox.main.js +0 -432
  15. package/dist/MobileComboBox.main.js.map +0 -1
  16. package/dist/MobileComboBox.mjs +0 -427
  17. package/dist/MobileComboBox.module.js +0 -427
  18. package/dist/MobileComboBox.module.js.map +0 -1
  19. package/dist/ar-AE.main.js +0 -10
  20. package/dist/ar-AE.main.js.map +0 -1
  21. package/dist/ar-AE.mjs +0 -12
  22. package/dist/ar-AE.module.js +0 -12
  23. package/dist/ar-AE.module.js.map +0 -1
  24. package/dist/bg-BG.main.js +0 -10
  25. package/dist/bg-BG.main.js.map +0 -1
  26. package/dist/bg-BG.mjs +0 -12
  27. package/dist/bg-BG.module.js +0 -12
  28. package/dist/bg-BG.module.js.map +0 -1
  29. package/dist/button_vars_css.main.js +0 -125
  30. package/dist/button_vars_css.main.js.map +0 -1
  31. package/dist/button_vars_css.mjs +0 -127
  32. package/dist/button_vars_css.module.js +0 -127
  33. package/dist/button_vars_css.module.js.map +0 -1
  34. package/dist/combobox.1c1869da.css +0 -50
  35. package/dist/combobox.1c1869da.css.map +0 -1
  36. package/dist/combobox.32e7c48f.css +0 -550
  37. package/dist/combobox.32e7c48f.css.map +0 -1
  38. package/dist/combobox.8958325b.css +0 -1669
  39. package/dist/combobox.8958325b.css.map +0 -1
  40. package/dist/combobox.a38acc5c.css +0 -649
  41. package/dist/combobox.a38acc5c.css.map +0 -1
  42. package/dist/combobox.cab3a9ff.css +0 -271
  43. package/dist/combobox.cab3a9ff.css.map +0 -1
  44. package/dist/combobox.cce0a74c.css +0 -223
  45. package/dist/combobox.cce0a74c.css.map +0 -1
  46. package/dist/combobox_css.main.js +0 -35
  47. package/dist/combobox_css.main.js.map +0 -1
  48. package/dist/combobox_css.mjs +0 -37
  49. package/dist/combobox_css.module.js +0 -37
  50. package/dist/combobox_css.module.js.map +0 -1
  51. package/dist/cs-CZ.main.js +0 -10
  52. package/dist/cs-CZ.main.js.map +0 -1
  53. package/dist/cs-CZ.mjs +0 -12
  54. package/dist/cs-CZ.module.js +0 -12
  55. package/dist/cs-CZ.module.js.map +0 -1
  56. package/dist/da-DK.main.js +0 -10
  57. package/dist/da-DK.main.js.map +0 -1
  58. package/dist/da-DK.mjs +0 -12
  59. package/dist/da-DK.module.js +0 -12
  60. package/dist/da-DK.module.js.map +0 -1
  61. package/dist/de-DE.main.js +0 -10
  62. package/dist/de-DE.main.js.map +0 -1
  63. package/dist/de-DE.mjs +0 -12
  64. package/dist/de-DE.module.js +0 -12
  65. package/dist/de-DE.module.js.map +0 -1
  66. package/dist/el-GR.main.js +0 -10
  67. package/dist/el-GR.main.js.map +0 -1
  68. package/dist/el-GR.mjs +0 -12
  69. package/dist/el-GR.module.js +0 -12
  70. package/dist/el-GR.module.js.map +0 -1
  71. package/dist/en-US.main.js +0 -10
  72. package/dist/en-US.main.js.map +0 -1
  73. package/dist/en-US.mjs +0 -12
  74. package/dist/en-US.module.js +0 -12
  75. package/dist/en-US.module.js.map +0 -1
  76. package/dist/es-ES.main.js +0 -10
  77. package/dist/es-ES.main.js.map +0 -1
  78. package/dist/es-ES.mjs +0 -12
  79. package/dist/es-ES.module.js +0 -12
  80. package/dist/es-ES.module.js.map +0 -1
  81. package/dist/et-EE.main.js +0 -10
  82. package/dist/et-EE.main.js.map +0 -1
  83. package/dist/et-EE.mjs +0 -12
  84. package/dist/et-EE.module.js +0 -12
  85. package/dist/et-EE.module.js.map +0 -1
  86. package/dist/fi-FI.main.js +0 -10
  87. package/dist/fi-FI.main.js.map +0 -1
  88. package/dist/fi-FI.mjs +0 -12
  89. package/dist/fi-FI.module.js +0 -12
  90. package/dist/fi-FI.module.js.map +0 -1
  91. package/dist/fieldlabel_vars_css.main.js +0 -95
  92. package/dist/fieldlabel_vars_css.main.js.map +0 -1
  93. package/dist/fieldlabel_vars_css.mjs +0 -97
  94. package/dist/fieldlabel_vars_css.module.js +0 -97
  95. package/dist/fieldlabel_vars_css.module.js.map +0 -1
  96. package/dist/fr-FR.main.js +0 -10
  97. package/dist/fr-FR.main.js.map +0 -1
  98. package/dist/fr-FR.mjs +0 -12
  99. package/dist/fr-FR.module.js +0 -12
  100. package/dist/fr-FR.module.js.map +0 -1
  101. package/dist/he-IL.main.js +0 -10
  102. package/dist/he-IL.main.js.map +0 -1
  103. package/dist/he-IL.mjs +0 -12
  104. package/dist/he-IL.module.js +0 -12
  105. package/dist/he-IL.module.js.map +0 -1
  106. package/dist/hr-HR.main.js +0 -10
  107. package/dist/hr-HR.main.js.map +0 -1
  108. package/dist/hr-HR.mjs +0 -12
  109. package/dist/hr-HR.module.js +0 -12
  110. package/dist/hr-HR.module.js.map +0 -1
  111. package/dist/hu-HU.main.js +0 -10
  112. package/dist/hu-HU.main.js.map +0 -1
  113. package/dist/hu-HU.mjs +0 -12
  114. package/dist/hu-HU.module.js +0 -12
  115. package/dist/hu-HU.module.js.map +0 -1
  116. package/dist/inputgroup_vars_css.main.js +0 -86
  117. package/dist/inputgroup_vars_css.main.js.map +0 -1
  118. package/dist/inputgroup_vars_css.mjs +0 -88
  119. package/dist/inputgroup_vars_css.module.js +0 -88
  120. package/dist/inputgroup_vars_css.module.js.map +0 -1
  121. package/dist/intlStrings.main.js +0 -108
  122. package/dist/intlStrings.main.js.map +0 -1
  123. package/dist/intlStrings.mjs +0 -110
  124. package/dist/intlStrings.module.js +0 -110
  125. package/dist/intlStrings.module.js.map +0 -1
  126. package/dist/it-IT.main.js +0 -10
  127. package/dist/it-IT.main.js.map +0 -1
  128. package/dist/it-IT.mjs +0 -12
  129. package/dist/it-IT.module.js +0 -12
  130. package/dist/it-IT.module.js.map +0 -1
  131. package/dist/ja-JP.main.js +0 -10
  132. package/dist/ja-JP.main.js.map +0 -1
  133. package/dist/ja-JP.mjs +0 -12
  134. package/dist/ja-JP.module.js +0 -12
  135. package/dist/ja-JP.module.js.map +0 -1
  136. package/dist/ko-KR.main.js +0 -10
  137. package/dist/ko-KR.main.js.map +0 -1
  138. package/dist/ko-KR.mjs +0 -12
  139. package/dist/ko-KR.module.js +0 -12
  140. package/dist/ko-KR.module.js.map +0 -1
  141. package/dist/lt-LT.main.js +0 -10
  142. package/dist/lt-LT.main.js.map +0 -1
  143. package/dist/lt-LT.mjs +0 -12
  144. package/dist/lt-LT.module.js +0 -12
  145. package/dist/lt-LT.module.js.map +0 -1
  146. package/dist/lv-LV.main.js +0 -10
  147. package/dist/lv-LV.main.js.map +0 -1
  148. package/dist/lv-LV.mjs +0 -12
  149. package/dist/lv-LV.module.js +0 -12
  150. package/dist/lv-LV.module.js.map +0 -1
  151. package/dist/nb-NO.main.js +0 -10
  152. package/dist/nb-NO.main.js.map +0 -1
  153. package/dist/nb-NO.mjs +0 -12
  154. package/dist/nb-NO.module.js +0 -12
  155. package/dist/nb-NO.module.js.map +0 -1
  156. package/dist/nl-NL.main.js +0 -10
  157. package/dist/nl-NL.main.js.map +0 -1
  158. package/dist/nl-NL.mjs +0 -12
  159. package/dist/nl-NL.module.js +0 -12
  160. package/dist/nl-NL.module.js.map +0 -1
  161. package/dist/pl-PL.main.js +0 -10
  162. package/dist/pl-PL.main.js.map +0 -1
  163. package/dist/pl-PL.mjs +0 -12
  164. package/dist/pl-PL.module.js +0 -12
  165. package/dist/pl-PL.module.js.map +0 -1
  166. package/dist/pt-BR.main.js +0 -10
  167. package/dist/pt-BR.main.js.map +0 -1
  168. package/dist/pt-BR.mjs +0 -12
  169. package/dist/pt-BR.module.js +0 -12
  170. package/dist/pt-BR.module.js.map +0 -1
  171. package/dist/pt-PT.main.js +0 -10
  172. package/dist/pt-PT.main.js.map +0 -1
  173. package/dist/pt-PT.mjs +0 -12
  174. package/dist/pt-PT.module.js +0 -12
  175. package/dist/pt-PT.module.js.map +0 -1
  176. package/dist/ro-RO.main.js +0 -10
  177. package/dist/ro-RO.main.js.map +0 -1
  178. package/dist/ro-RO.mjs +0 -12
  179. package/dist/ro-RO.module.js +0 -12
  180. package/dist/ro-RO.module.js.map +0 -1
  181. package/dist/ru-RU.main.js +0 -10
  182. package/dist/ru-RU.main.js.map +0 -1
  183. package/dist/ru-RU.mjs +0 -12
  184. package/dist/ru-RU.module.js +0 -12
  185. package/dist/ru-RU.module.js.map +0 -1
  186. package/dist/search_vars_css.main.js +0 -53
  187. package/dist/search_vars_css.main.js.map +0 -1
  188. package/dist/search_vars_css.mjs +0 -55
  189. package/dist/search_vars_css.module.js +0 -55
  190. package/dist/search_vars_css.module.js.map +0 -1
  191. package/dist/sk-SK.main.js +0 -10
  192. package/dist/sk-SK.main.js.map +0 -1
  193. package/dist/sk-SK.mjs +0 -12
  194. package/dist/sk-SK.module.js +0 -12
  195. package/dist/sk-SK.module.js.map +0 -1
  196. package/dist/sl-SI.main.js +0 -10
  197. package/dist/sl-SI.main.js.map +0 -1
  198. package/dist/sl-SI.mjs +0 -12
  199. package/dist/sl-SI.module.js +0 -12
  200. package/dist/sl-SI.module.js.map +0 -1
  201. package/dist/sr-SP.main.js +0 -10
  202. package/dist/sr-SP.main.js.map +0 -1
  203. package/dist/sr-SP.mjs +0 -12
  204. package/dist/sr-SP.module.js +0 -12
  205. package/dist/sr-SP.module.js.map +0 -1
  206. package/dist/sv-SE.main.js +0 -10
  207. package/dist/sv-SE.main.js.map +0 -1
  208. package/dist/sv-SE.mjs +0 -12
  209. package/dist/sv-SE.module.js +0 -12
  210. package/dist/sv-SE.module.js.map +0 -1
  211. package/dist/textfield_vars_css.main.js +0 -74
  212. package/dist/textfield_vars_css.main.js.map +0 -1
  213. package/dist/textfield_vars_css.mjs +0 -76
  214. package/dist/textfield_vars_css.module.js +0 -76
  215. package/dist/textfield_vars_css.module.js.map +0 -1
  216. package/dist/tr-TR.main.js +0 -10
  217. package/dist/tr-TR.main.js.map +0 -1
  218. package/dist/tr-TR.mjs +0 -12
  219. package/dist/tr-TR.module.js +0 -12
  220. package/dist/tr-TR.module.js.map +0 -1
  221. package/dist/types.d.ts +0 -13
  222. package/dist/types.d.ts.map +0 -1
  223. package/dist/uk-UA.main.js +0 -10
  224. package/dist/uk-UA.main.js.map +0 -1
  225. package/dist/uk-UA.mjs +0 -12
  226. package/dist/uk-UA.module.js +0 -12
  227. package/dist/uk-UA.module.js.map +0 -1
  228. package/dist/zh-CN.main.js +0 -10
  229. package/dist/zh-CN.main.js.map +0 -1
  230. package/dist/zh-CN.mjs +0 -12
  231. package/dist/zh-CN.module.js +0 -12
  232. package/dist/zh-CN.module.js.map +0 -1
  233. package/dist/zh-TW.main.js +0 -10
  234. package/dist/zh-TW.main.js.map +0 -1
  235. package/dist/zh-TW.mjs +0 -12
  236. package/dist/zh-TW.module.js +0 -12
  237. package/dist/zh-TW.module.js.map +0 -1
  238. package/src/ComboBox.tsx +0 -376
  239. package/src/MobileComboBox.tsx +0 -571
  240. package/src/combobox.css +0 -65
package/dist/ComboBox.mjs DELETED
@@ -1,300 +0,0 @@
1
- import "./combobox.1c1869da.css";
2
- import $c3ZYr$combobox_cssmodulejs from "./combobox_css.mjs";
3
- import $c3ZYr$intlStringsmodulejs from "./intlStrings.mjs";
4
- import {MobileComboBox as $a1ae4cad4496428f$export$7637df911c069b4d} from "./MobileComboBox.mjs";
5
- import "./combobox.a38acc5c.css";
6
- import $c3ZYr$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.mjs";
7
- import "./combobox.32e7c48f.css";
8
- import $c3ZYr$textfield_vars_cssmodulejs from "./textfield_vars_css.mjs";
9
- import $c3ZYr$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
10
- import {useIsMobileDevice as $c3ZYr$useIsMobileDevice, useUnwrapDOMRef as $c3ZYr$useUnwrapDOMRef, useFocusableRef as $c3ZYr$useFocusableRef, useResizeObserver as $c3ZYr$useResizeObserver, dimensionValue as $c3ZYr$dimensionValue, classNames as $c3ZYr$classNames} from "@react-spectrum/utils";
11
- import {Field as $c3ZYr$Field} from "@react-spectrum/label";
12
- import {FieldButton as $c3ZYr$FieldButton} from "@react-spectrum/button";
13
- import {FocusRing as $c3ZYr$FocusRing} from "@react-aria/focus";
14
- import {useListBoxLayout as $c3ZYr$useListBoxLayout, ListBoxBase as $c3ZYr$ListBoxBase} from "@react-spectrum/listbox";
15
- import {Popover as $c3ZYr$Popover} from "@react-spectrum/overlays";
16
- import {useHover as $c3ZYr$useHover, PressResponder as $c3ZYr$PressResponder} from "@react-aria/interactions";
17
- import {ProgressCircle as $c3ZYr$ProgressCircle} from "@react-spectrum/progress";
18
- import $c3ZYr$react, {useRef as $c3ZYr$useRef, useEffect as $c3ZYr$useEffect, useState as $c3ZYr$useState, useCallback as $c3ZYr$useCallback} from "react";
19
- import {TextFieldBase as $c3ZYr$TextFieldBase} from "@react-spectrum/textfield";
20
- import {useComboBox as $c3ZYr$useComboBox} from "@react-aria/combobox";
21
- import {useComboBoxState as $c3ZYr$useComboBoxState} from "@react-stately/combobox";
22
- import {useLocalizedStringFormatter as $c3ZYr$useLocalizedStringFormatter, useFilter as $c3ZYr$useFilter} from "@react-aria/i18n";
23
- import {useFormProps as $c3ZYr$useFormProps} from "@react-spectrum/form";
24
- import {useLayoutEffect as $c3ZYr$useLayoutEffect} from "@react-aria/utils";
25
- import {useProviderProps as $c3ZYr$useProviderProps, useProvider as $c3ZYr$useProvider} from "@react-spectrum/provider";
26
-
27
-
28
- function $parcel$interopDefault(a) {
29
- return a && a.__esModule ? a.default : a;
30
- }
31
- /*
32
- * Copyright 2020 Adobe. All rights reserved.
33
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
34
- * you may not use this file except in compliance with the License. You may obtain a copy
35
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing, software distributed under
38
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
39
- * OF ANY KIND, either express or implied. See the License for the specific language
40
- * governing permissions and limitations under the License.
41
- */
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
- const $2289f375e813f187$export$72b9695b8216309a = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBox(props, ref) {
64
- props = (0, $c3ZYr$useProviderProps)(props);
65
- props = (0, $c3ZYr$useFormProps)(props);
66
- let hasWarned = (0, $c3ZYr$useRef)(false);
67
- (0, $c3ZYr$useEffect)(()=>{
68
- if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
69
- 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');
70
- hasWarned.current = true;
71
- }
72
- }, [
73
- props.placeholder
74
- ]);
75
- let isMobile = (0, $c3ZYr$useIsMobileDevice)();
76
- if (isMobile) // menuTrigger=focus/manual don't apply to mobile combobox
77
- return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $a1ae4cad4496428f$export$7637df911c069b4d), {
78
- ...props,
79
- menuTrigger: "input",
80
- ref: ref
81
- });
82
- else return /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxBase, {
83
- ...props,
84
- ref: ref
85
- });
86
- });
87
- const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBoxBase(props, ref) {
88
- let { menuTrigger: menuTrigger = 'input', shouldFlip: shouldFlip = true, direction: direction = 'bottom', align: align = 'start', isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, allowsCustomValue: allowsCustomValue, menuWidth: customMenuWidth, name: name, formValue: formValue = 'text' } = props;
89
- if (allowsCustomValue) formValue = 'text';
90
- let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
91
- let isAsync = loadingState != null;
92
- let popoverRef = (0, $c3ZYr$useRef)(null);
93
- let unwrappedPopoverRef = (0, $c3ZYr$useUnwrapDOMRef)(popoverRef);
94
- let buttonRef = (0, $c3ZYr$useRef)(null);
95
- let unwrappedButtonRef = (0, $c3ZYr$useUnwrapDOMRef)(buttonRef);
96
- let listBoxRef = (0, $c3ZYr$useRef)(null);
97
- let inputRef = (0, $c3ZYr$useRef)(null);
98
- // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
99
- let inputGroupRef = (0, $c3ZYr$useRef)(null);
100
- let domRef = (0, $c3ZYr$useFocusableRef)(ref, inputRef);
101
- let { contains: contains } = (0, $c3ZYr$useFilter)({
102
- sensitivity: 'base'
103
- });
104
- let state = (0, $c3ZYr$useComboBoxState)({
105
- ...props,
106
- defaultFilter: contains,
107
- allowsEmptyCollection: isAsync
108
- });
109
- let layout = (0, $c3ZYr$useListBoxLayout)();
110
- let { buttonProps: buttonProps, inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $c3ZYr$useComboBox)({
111
- ...props,
112
- layoutDelegate: layout,
113
- buttonRef: unwrappedButtonRef,
114
- popoverRef: unwrappedPopoverRef,
115
- listBoxRef: listBoxRef,
116
- inputRef: inputRef,
117
- menuTrigger: menuTrigger,
118
- name: formValue === 'text' ? name : undefined
119
- }, state);
120
- // Measure the width of the inputfield and the button to inform the width of the menu (below).
121
- let [menuWidth, setMenuWidth] = (0, $c3ZYr$useState)(undefined);
122
- let { scale: scale } = (0, $c3ZYr$useProvider)();
123
- let onResize = (0, $c3ZYr$useCallback)(()=>{
124
- if (unwrappedButtonRef.current && inputRef.current) {
125
- let buttonWidth = unwrappedButtonRef.current.offsetWidth;
126
- let inputWidth = inputRef.current.offsetWidth;
127
- setMenuWidth(buttonWidth + inputWidth);
128
- }
129
- }, [
130
- unwrappedButtonRef,
131
- inputRef,
132
- setMenuWidth
133
- ]);
134
- (0, $c3ZYr$useResizeObserver)({
135
- ref: domRef,
136
- onResize: onResize
137
- });
138
- (0, $c3ZYr$useLayoutEffect)(onResize, [
139
- scale,
140
- onResize
141
- ]);
142
- let width = isQuiet ? undefined : menuWidth;
143
- let style = {
144
- width: customMenuWidth ? (0, $c3ZYr$dimensionValue)(customMenuWidth) : width,
145
- minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
146
- };
147
- let cbInputProps = {
148
- ...props,
149
- children: null
150
- };
151
- var _state_selectedKey;
152
- return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$react).Fragment, null, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Field), {
153
- ...props,
154
- descriptionProps: descriptionProps,
155
- errorMessageProps: errorMessageProps,
156
- isInvalid: isInvalid,
157
- validationErrors: validationErrors,
158
- validationDetails: validationDetails,
159
- labelProps: labelProps,
160
- ref: domRef
161
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxInput, {
162
- ...cbInputProps,
163
- isOpen: state.isOpen,
164
- loadingState: loadingState,
165
- inputProps: inputProps,
166
- inputRef: inputRef,
167
- triggerProps: buttonProps,
168
- triggerRef: buttonRef,
169
- validationState: props.validationState || (isInvalid ? 'invalid' : undefined),
170
- ref: inputGroupRef
171
- })), name && formValue === 'key' && /*#__PURE__*/ (0, $c3ZYr$react).createElement("input", {
172
- type: "hidden",
173
- name: name,
174
- form: props.form,
175
- value: (_state_selectedKey = state.selectedKey) !== null && _state_selectedKey !== void 0 ? _state_selectedKey : ''
176
- }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Popover), {
177
- state: state,
178
- UNSAFE_style: style,
179
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-popover', {
180
- 'spectrum-InputGroup-popover--quiet': isQuiet
181
- }),
182
- ref: popoverRef,
183
- triggerRef: inputGroupRef,
184
- scrollRef: listBoxRef,
185
- placement: `${direction} ${align}`,
186
- hideArrow: true,
187
- isNonModal: true,
188
- shouldFlip: shouldFlip
189
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$ListBoxBase), {
190
- ...listBoxProps,
191
- ref: listBoxRef,
192
- disallowEmptySelection: true,
193
- shouldSelectOnPressUp: true,
194
- focusOnPointerEnter: true,
195
- layout: layout,
196
- state: state,
197
- shouldUseVirtualFocus: true,
198
- isLoading: loadingState === 'loading' || loadingState === 'loadingMore',
199
- showLoadingSpinner: loadingState === 'loadingMore',
200
- onLoadMore: onLoadMore,
201
- renderEmptyState: ()=>isAsync && /*#__PURE__*/ (0, $c3ZYr$react).createElement("span", {
202
- className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$combobox_cssmodulejs))), 'no-results')
203
- }, loadingState === 'loading' ? stringFormatter.format('loading') : stringFormatter.format('noResults'))
204
- })));
205
- });
206
- const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBoxInput(props, ref) {
207
- let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, inputProps: inputProps, inputRef: inputRef, triggerProps: triggerProps, triggerRef: triggerRef, autoFocus: autoFocus, style: style, className: className, loadingState: loadingState, isOpen: isOpen, menuTrigger: menuTrigger } = props;
208
- let { hoverProps: hoverProps, isHovered: isHovered } = (0, $c3ZYr$useHover)({});
209
- let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
210
- let timeout = (0, $c3ZYr$useRef)(null);
211
- let [showLoading, setShowLoading] = (0, $c3ZYr$useState)(false);
212
- let loadingCircle = /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$ProgressCircle), {
213
- "aria-label": stringFormatter.format('loading'),
214
- size: "S",
215
- isIndeterminate: true,
216
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$textfield_vars_cssmodulejs))), 'spectrum-Textfield-circleLoader', (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-circleLoader'))
217
- });
218
- let isLoading = loadingState === 'loading' || loadingState === 'filtering';
219
- let inputValue = inputProps.value;
220
- let lastInputValue = (0, $c3ZYr$useRef)(inputValue);
221
- (0, $c3ZYr$useEffect)(()=>{
222
- if (isLoading && !showLoading) {
223
- if (timeout.current === null) timeout.current = setTimeout(()=>{
224
- setShowLoading(true);
225
- }, 500);
226
- // If user is typing, clear the timer and restart since it is a new request
227
- if (inputValue !== lastInputValue.current) {
228
- clearTimeout(timeout.current);
229
- timeout.current = setTimeout(()=>{
230
- setShowLoading(true);
231
- }, 500);
232
- }
233
- } else if (!isLoading) {
234
- if (timeout.current) clearTimeout(timeout.current);
235
- timeout.current = null;
236
- }
237
- lastInputValue.current = inputValue;
238
- }, [
239
- isLoading,
240
- showLoading,
241
- inputValue
242
- ]);
243
- let [prevIsLoading, setPrevIsLoading] = (0, $c3ZYr$useState)(isLoading);
244
- if (prevIsLoading !== isLoading && !isLoading) {
245
- setShowLoading(false);
246
- setPrevIsLoading(isLoading);
247
- }
248
- (0, $c3ZYr$useEffect)(()=>{
249
- return ()=>{
250
- if (timeout.current) clearTimeout(timeout.current);
251
- timeout.current = null;
252
- };
253
- }, []);
254
- return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$FocusRing), {
255
- within: true,
256
- isTextInput: true,
257
- focusClass: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'is-focused'),
258
- focusRingClass: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'focus-ring'),
259
- autoFocus: autoFocus
260
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement("div", {
261
- ...hoverProps,
262
- ref: ref,
263
- style: style,
264
- className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup', {
265
- 'spectrum-InputGroup--quiet': isQuiet,
266
- 'is-disabled': isDisabled,
267
- 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
268
- 'is-hovered': isHovered
269
- }, className)
270
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$TextFieldBase), {
271
- inputProps: inputProps,
272
- inputRef: inputRef,
273
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'),
274
- inputClassName: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input'),
275
- validationIconClassName: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-validationIcon'),
276
- isDisabled: isDisabled,
277
- isQuiet: isQuiet,
278
- validationState: validationState,
279
- // 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)
280
- // TODO: add special case for completionMode: complete as well
281
- isLoading: showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'),
282
- loadingIndicator: loadingState != null ? loadingCircle : undefined,
283
- disableFocusRing: true
284
- }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$PressResponder), {
285
- preventFocusOnPress: true,
286
- isPressed: isOpen
287
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$FieldButton), {
288
- ...triggerProps,
289
- ref: triggerRef,
290
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-FieldButton'),
291
- isQuiet: isQuiet,
292
- validationState: validationState
293
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$spectrumiconsuiChevronDownMedium), {
294
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-Dropdown-chevron')
295
- })))));
296
- });
297
-
298
-
299
- export {$2289f375e813f187$export$72b9695b8216309a as ComboBox};
300
- //# sourceMappingURL=ComboBox.module.js.map
@@ -1,300 +0,0 @@
1
- import "./combobox.1c1869da.css";
2
- import $c3ZYr$combobox_cssmodulejs from "./combobox_css.module.js";
3
- import $c3ZYr$intlStringsmodulejs from "./intlStrings.module.js";
4
- import {MobileComboBox as $a1ae4cad4496428f$export$7637df911c069b4d} from "./MobileComboBox.module.js";
5
- import "./combobox.a38acc5c.css";
6
- import $c3ZYr$inputgroup_vars_cssmodulejs from "./inputgroup_vars_css.module.js";
7
- import "./combobox.32e7c48f.css";
8
- import $c3ZYr$textfield_vars_cssmodulejs from "./textfield_vars_css.module.js";
9
- import $c3ZYr$spectrumiconsuiChevronDownMedium from "@spectrum-icons/ui/ChevronDownMedium";
10
- import {useIsMobileDevice as $c3ZYr$useIsMobileDevice, useUnwrapDOMRef as $c3ZYr$useUnwrapDOMRef, useFocusableRef as $c3ZYr$useFocusableRef, useResizeObserver as $c3ZYr$useResizeObserver, dimensionValue as $c3ZYr$dimensionValue, classNames as $c3ZYr$classNames} from "@react-spectrum/utils";
11
- import {Field as $c3ZYr$Field} from "@react-spectrum/label";
12
- import {FieldButton as $c3ZYr$FieldButton} from "@react-spectrum/button";
13
- import {FocusRing as $c3ZYr$FocusRing} from "@react-aria/focus";
14
- import {useListBoxLayout as $c3ZYr$useListBoxLayout, ListBoxBase as $c3ZYr$ListBoxBase} from "@react-spectrum/listbox";
15
- import {Popover as $c3ZYr$Popover} from "@react-spectrum/overlays";
16
- import {useHover as $c3ZYr$useHover, PressResponder as $c3ZYr$PressResponder} from "@react-aria/interactions";
17
- import {ProgressCircle as $c3ZYr$ProgressCircle} from "@react-spectrum/progress";
18
- import $c3ZYr$react, {useRef as $c3ZYr$useRef, useEffect as $c3ZYr$useEffect, useState as $c3ZYr$useState, useCallback as $c3ZYr$useCallback} from "react";
19
- import {TextFieldBase as $c3ZYr$TextFieldBase} from "@react-spectrum/textfield";
20
- import {useComboBox as $c3ZYr$useComboBox} from "@react-aria/combobox";
21
- import {useComboBoxState as $c3ZYr$useComboBoxState} from "@react-stately/combobox";
22
- import {useLocalizedStringFormatter as $c3ZYr$useLocalizedStringFormatter, useFilter as $c3ZYr$useFilter} from "@react-aria/i18n";
23
- import {useFormProps as $c3ZYr$useFormProps} from "@react-spectrum/form";
24
- import {useLayoutEffect as $c3ZYr$useLayoutEffect} from "@react-aria/utils";
25
- import {useProviderProps as $c3ZYr$useProviderProps, useProvider as $c3ZYr$useProvider} from "@react-spectrum/provider";
26
-
27
-
28
- function $parcel$interopDefault(a) {
29
- return a && a.__esModule ? a.default : a;
30
- }
31
- /*
32
- * Copyright 2020 Adobe. All rights reserved.
33
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
34
- * you may not use this file except in compliance with the License. You may obtain a copy
35
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
36
- *
37
- * Unless required by applicable law or agreed to in writing, software distributed under
38
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
39
- * OF ANY KIND, either express or implied. See the License for the specific language
40
- * governing permissions and limitations under the License.
41
- */
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
- const $2289f375e813f187$export$72b9695b8216309a = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBox(props, ref) {
64
- props = (0, $c3ZYr$useProviderProps)(props);
65
- props = (0, $c3ZYr$useFormProps)(props);
66
- let hasWarned = (0, $c3ZYr$useRef)(false);
67
- (0, $c3ZYr$useEffect)(()=>{
68
- if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {
69
- 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');
70
- hasWarned.current = true;
71
- }
72
- }, [
73
- props.placeholder
74
- ]);
75
- let isMobile = (0, $c3ZYr$useIsMobileDevice)();
76
- if (isMobile) // menuTrigger=focus/manual don't apply to mobile combobox
77
- return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $a1ae4cad4496428f$export$7637df911c069b4d), {
78
- ...props,
79
- menuTrigger: "input",
80
- ref: ref
81
- });
82
- else return /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxBase, {
83
- ...props,
84
- ref: ref
85
- });
86
- });
87
- const $2289f375e813f187$var$ComboBoxBase = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBoxBase(props, ref) {
88
- let { menuTrigger: menuTrigger = 'input', shouldFlip: shouldFlip = true, direction: direction = 'bottom', align: align = 'start', isQuiet: isQuiet, loadingState: loadingState, onLoadMore: onLoadMore, allowsCustomValue: allowsCustomValue, menuWidth: customMenuWidth, name: name, formValue: formValue = 'text' } = props;
89
- if (allowsCustomValue) formValue = 'text';
90
- let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
91
- let isAsync = loadingState != null;
92
- let popoverRef = (0, $c3ZYr$useRef)(null);
93
- let unwrappedPopoverRef = (0, $c3ZYr$useUnwrapDOMRef)(popoverRef);
94
- let buttonRef = (0, $c3ZYr$useRef)(null);
95
- let unwrappedButtonRef = (0, $c3ZYr$useUnwrapDOMRef)(buttonRef);
96
- let listBoxRef = (0, $c3ZYr$useRef)(null);
97
- let inputRef = (0, $c3ZYr$useRef)(null);
98
- // serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
99
- let inputGroupRef = (0, $c3ZYr$useRef)(null);
100
- let domRef = (0, $c3ZYr$useFocusableRef)(ref, inputRef);
101
- let { contains: contains } = (0, $c3ZYr$useFilter)({
102
- sensitivity: 'base'
103
- });
104
- let state = (0, $c3ZYr$useComboBoxState)({
105
- ...props,
106
- defaultFilter: contains,
107
- allowsEmptyCollection: isAsync
108
- });
109
- let layout = (0, $c3ZYr$useListBoxLayout)();
110
- let { buttonProps: buttonProps, inputProps: inputProps, listBoxProps: listBoxProps, labelProps: labelProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $c3ZYr$useComboBox)({
111
- ...props,
112
- layoutDelegate: layout,
113
- buttonRef: unwrappedButtonRef,
114
- popoverRef: unwrappedPopoverRef,
115
- listBoxRef: listBoxRef,
116
- inputRef: inputRef,
117
- menuTrigger: menuTrigger,
118
- name: formValue === 'text' ? name : undefined
119
- }, state);
120
- // Measure the width of the inputfield and the button to inform the width of the menu (below).
121
- let [menuWidth, setMenuWidth] = (0, $c3ZYr$useState)(undefined);
122
- let { scale: scale } = (0, $c3ZYr$useProvider)();
123
- let onResize = (0, $c3ZYr$useCallback)(()=>{
124
- if (unwrappedButtonRef.current && inputRef.current) {
125
- let buttonWidth = unwrappedButtonRef.current.offsetWidth;
126
- let inputWidth = inputRef.current.offsetWidth;
127
- setMenuWidth(buttonWidth + inputWidth);
128
- }
129
- }, [
130
- unwrappedButtonRef,
131
- inputRef,
132
- setMenuWidth
133
- ]);
134
- (0, $c3ZYr$useResizeObserver)({
135
- ref: domRef,
136
- onResize: onResize
137
- });
138
- (0, $c3ZYr$useLayoutEffect)(onResize, [
139
- scale,
140
- onResize
141
- ]);
142
- let width = isQuiet ? undefined : menuWidth;
143
- let style = {
144
- width: customMenuWidth ? (0, $c3ZYr$dimensionValue)(customMenuWidth) : width,
145
- minWidth: isQuiet ? `calc(${menuWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : menuWidth
146
- };
147
- let cbInputProps = {
148
- ...props,
149
- children: null
150
- };
151
- var _state_selectedKey;
152
- return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$react).Fragment, null, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Field), {
153
- ...props,
154
- descriptionProps: descriptionProps,
155
- errorMessageProps: errorMessageProps,
156
- isInvalid: isInvalid,
157
- validationErrors: validationErrors,
158
- validationDetails: validationDetails,
159
- labelProps: labelProps,
160
- ref: domRef
161
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement($2289f375e813f187$var$ComboBoxInput, {
162
- ...cbInputProps,
163
- isOpen: state.isOpen,
164
- loadingState: loadingState,
165
- inputProps: inputProps,
166
- inputRef: inputRef,
167
- triggerProps: buttonProps,
168
- triggerRef: buttonRef,
169
- validationState: props.validationState || (isInvalid ? 'invalid' : undefined),
170
- ref: inputGroupRef
171
- })), name && formValue === 'key' && /*#__PURE__*/ (0, $c3ZYr$react).createElement("input", {
172
- type: "hidden",
173
- name: name,
174
- form: props.form,
175
- value: (_state_selectedKey = state.selectedKey) !== null && _state_selectedKey !== void 0 ? _state_selectedKey : ''
176
- }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$Popover), {
177
- state: state,
178
- UNSAFE_style: style,
179
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-popover', {
180
- 'spectrum-InputGroup-popover--quiet': isQuiet
181
- }),
182
- ref: popoverRef,
183
- triggerRef: inputGroupRef,
184
- scrollRef: listBoxRef,
185
- placement: `${direction} ${align}`,
186
- hideArrow: true,
187
- isNonModal: true,
188
- shouldFlip: shouldFlip
189
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$ListBoxBase), {
190
- ...listBoxProps,
191
- ref: listBoxRef,
192
- disallowEmptySelection: true,
193
- shouldSelectOnPressUp: true,
194
- focusOnPointerEnter: true,
195
- layout: layout,
196
- state: state,
197
- shouldUseVirtualFocus: true,
198
- isLoading: loadingState === 'loading' || loadingState === 'loadingMore',
199
- showLoadingSpinner: loadingState === 'loadingMore',
200
- onLoadMore: onLoadMore,
201
- renderEmptyState: ()=>isAsync && /*#__PURE__*/ (0, $c3ZYr$react).createElement("span", {
202
- className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$combobox_cssmodulejs))), 'no-results')
203
- }, loadingState === 'loading' ? stringFormatter.format('loading') : stringFormatter.format('noResults'))
204
- })));
205
- });
206
- const $2289f375e813f187$var$ComboBoxInput = /*#__PURE__*/ (0, $c3ZYr$react).forwardRef(function ComboBoxInput(props, ref) {
207
- let { isQuiet: isQuiet, isDisabled: isDisabled, validationState: validationState, inputProps: inputProps, inputRef: inputRef, triggerProps: triggerProps, triggerRef: triggerRef, autoFocus: autoFocus, style: style, className: className, loadingState: loadingState, isOpen: isOpen, menuTrigger: menuTrigger } = props;
208
- let { hoverProps: hoverProps, isHovered: isHovered } = (0, $c3ZYr$useHover)({});
209
- let stringFormatter = (0, $c3ZYr$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c3ZYr$intlStringsmodulejs))), '@react-spectrum/combobox');
210
- let timeout = (0, $c3ZYr$useRef)(null);
211
- let [showLoading, setShowLoading] = (0, $c3ZYr$useState)(false);
212
- let loadingCircle = /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$ProgressCircle), {
213
- "aria-label": stringFormatter.format('loading'),
214
- size: "S",
215
- isIndeterminate: true,
216
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$textfield_vars_cssmodulejs))), 'spectrum-Textfield-circleLoader', (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-circleLoader'))
217
- });
218
- let isLoading = loadingState === 'loading' || loadingState === 'filtering';
219
- let inputValue = inputProps.value;
220
- let lastInputValue = (0, $c3ZYr$useRef)(inputValue);
221
- (0, $c3ZYr$useEffect)(()=>{
222
- if (isLoading && !showLoading) {
223
- if (timeout.current === null) timeout.current = setTimeout(()=>{
224
- setShowLoading(true);
225
- }, 500);
226
- // If user is typing, clear the timer and restart since it is a new request
227
- if (inputValue !== lastInputValue.current) {
228
- clearTimeout(timeout.current);
229
- timeout.current = setTimeout(()=>{
230
- setShowLoading(true);
231
- }, 500);
232
- }
233
- } else if (!isLoading) {
234
- if (timeout.current) clearTimeout(timeout.current);
235
- timeout.current = null;
236
- }
237
- lastInputValue.current = inputValue;
238
- }, [
239
- isLoading,
240
- showLoading,
241
- inputValue
242
- ]);
243
- let [prevIsLoading, setPrevIsLoading] = (0, $c3ZYr$useState)(isLoading);
244
- if (prevIsLoading !== isLoading && !isLoading) {
245
- setShowLoading(false);
246
- setPrevIsLoading(isLoading);
247
- }
248
- (0, $c3ZYr$useEffect)(()=>{
249
- return ()=>{
250
- if (timeout.current) clearTimeout(timeout.current);
251
- timeout.current = null;
252
- };
253
- }, []);
254
- return /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$FocusRing), {
255
- within: true,
256
- isTextInput: true,
257
- focusClass: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'is-focused'),
258
- focusRingClass: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'focus-ring'),
259
- autoFocus: autoFocus
260
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement("div", {
261
- ...hoverProps,
262
- ref: ref,
263
- style: style,
264
- className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup', {
265
- 'spectrum-InputGroup--quiet': isQuiet,
266
- 'is-disabled': isDisabled,
267
- 'spectrum-InputGroup--invalid': validationState === 'invalid' && !isDisabled,
268
- 'is-hovered': isHovered
269
- }, className)
270
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$TextFieldBase), {
271
- inputProps: inputProps,
272
- inputRef: inputRef,
273
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-field'),
274
- inputClassName: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input'),
275
- validationIconClassName: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-InputGroup-input-validationIcon'),
276
- isDisabled: isDisabled,
277
- isQuiet: isQuiet,
278
- validationState: validationState,
279
- // 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)
280
- // TODO: add special case for completionMode: complete as well
281
- isLoading: showLoading && (isOpen || menuTrigger === 'manual' || loadingState === 'loading'),
282
- loadingIndicator: loadingState != null ? loadingCircle : undefined,
283
- disableFocusRing: true
284
- }), /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$PressResponder), {
285
- preventFocusOnPress: true,
286
- isPressed: isOpen
287
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$FieldButton), {
288
- ...triggerProps,
289
- ref: triggerRef,
290
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-FieldButton'),
291
- isQuiet: isQuiet,
292
- validationState: validationState
293
- }, /*#__PURE__*/ (0, $c3ZYr$react).createElement((0, $c3ZYr$spectrumiconsuiChevronDownMedium), {
294
- UNSAFE_className: (0, $c3ZYr$classNames)((0, ($parcel$interopDefault($c3ZYr$inputgroup_vars_cssmodulejs))), 'spectrum-Dropdown-chevron')
295
- })))));
296
- });
297
-
298
-
299
- export {$2289f375e813f187$export$72b9695b8216309a as ComboBox};
300
- //# sourceMappingURL=ComboBox.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;;;;;;;AAgDM,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAA2B,KAA+B,EAAE,GAA8B;IAC1I,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE;IAErB,IAAI,YAAY,CAAA,GAAA,aAAK,EAAE;IACvB,CAAA,GAAA,gBAAQ,EAAE;QACR,IAAI,MAAM,WAAW,IAAI,CAAC,UAAU,OAAO,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAAc;YACpF,QAAQ,IAAI,CAAC;YACb,UAAU,OAAO,GAAG;QACtB;IACF,GAAG;QAAC,MAAM,WAAW;KAAC;IAEtB,IAAI,WAAW,CAAA,GAAA,wBAAgB;IAC/B,IAAI,UACF,0DAA0D;IAC1D,qBAAO,gCAAC,CAAA,GAAA,yCAAa;QAAG,GAAG,KAAK;QAAE,aAAY;QAAQ,KAAK;;SAE3D,qBAAO,gCAAC;QAAc,GAAG,KAAK;QAAE,KAAK;;AAEzC;AAEA,MAAM,mDAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,aAAa,KAAiC,EAAE,GAA8B;IAC3H,IAAI,eACF,cAAc,qBACd,aAAa,iBACb,YAAY,iBACZ,QAAQ,kBACR,OAAO,gBAC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ChB,GACA;qBAGJ,gCAAC,CAAA,GAAA,oBAAY;QACX,YAAY;QACZ,UAAU;QACV,kBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,4DAAK,GACL;QAGJ,gBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,4DAAK,GACL;QAGJ,yBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,4DAAK,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,gCAAC,CAAA,GAAA,qBAAa;QAAE,qBAAA;QAAoB,WAAW;qBAC7C,gCAAC,CAAA,GAAA,kBAAU;QACR,GAAG,YAAY;QAChB,KAAK;QACL,kBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,4DAAK,GACL;QAGJ,SAAS;QACT,iBAAiB;qBACjB,gCAAC,CAAA,GAAA,uCAAgB;QAAE,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAK,GAAG;;AAMpE","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\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 */\nexport const ComboBox = React.forwardRef(function ComboBox<T extends object>(props: SpectrumComboBoxProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n props = useFormProps(props);\n\n let hasWarned = useRef(false);\n useEffect(() => {\n if (props.placeholder && !hasWarned.current && process.env.NODE_ENV !== 'production') {\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 hasWarned.current = true;\n }\n }, [props.placeholder]);\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}) as <T>(props: SpectrumComboBoxProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\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} form={props.form} 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 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 (timeout.current) {\n clearTimeout(timeout.current);\n }\n timeout.current = null;\n }\n\n lastInputValue.current = inputValue;\n }, [isLoading, showLoading, inputValue]);\n\n let [prevIsLoading, setPrevIsLoading] = useState(isLoading);\n if (prevIsLoading !== isLoading && !isLoading) {\n setShowLoading(false);\n setPrevIsLoading(isLoading);\n }\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"],"names":[],"version":3,"file":"ComboBox.module.js.map"}