@react-spectrum/picker 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 (198) 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 -42
  8. package/src/index.ts +5 -3
  9. package/dist/Picker.main.js +0 -230
  10. package/dist/Picker.main.js.map +0 -1
  11. package/dist/Picker.mjs +0 -225
  12. package/dist/Picker.module.js +0 -225
  13. package/dist/Picker.module.js.map +0 -1
  14. package/dist/ar-AE.main.js +0 -7
  15. package/dist/ar-AE.main.js.map +0 -1
  16. package/dist/ar-AE.mjs +0 -9
  17. package/dist/ar-AE.module.js +0 -9
  18. package/dist/ar-AE.module.js.map +0 -1
  19. package/dist/bg-BG.main.js +0 -7
  20. package/dist/bg-BG.main.js.map +0 -1
  21. package/dist/bg-BG.mjs +0 -9
  22. package/dist/bg-BG.module.js +0 -9
  23. package/dist/bg-BG.module.js.map +0 -1
  24. package/dist/cs-CZ.main.js +0 -7
  25. package/dist/cs-CZ.main.js.map +0 -1
  26. package/dist/cs-CZ.mjs +0 -9
  27. package/dist/cs-CZ.module.js +0 -9
  28. package/dist/cs-CZ.module.js.map +0 -1
  29. package/dist/da-DK.main.js +0 -7
  30. package/dist/da-DK.main.js.map +0 -1
  31. package/dist/da-DK.mjs +0 -9
  32. package/dist/da-DK.module.js +0 -9
  33. package/dist/da-DK.module.js.map +0 -1
  34. package/dist/de-DE.main.js +0 -7
  35. package/dist/de-DE.main.js.map +0 -1
  36. package/dist/de-DE.mjs +0 -9
  37. package/dist/de-DE.module.js +0 -9
  38. package/dist/de-DE.module.js.map +0 -1
  39. package/dist/dropdown_vars_css.main.js +0 -77
  40. package/dist/dropdown_vars_css.main.js.map +0 -1
  41. package/dist/dropdown_vars_css.mjs +0 -79
  42. package/dist/dropdown_vars_css.module.js +0 -79
  43. package/dist/dropdown_vars_css.module.js.map +0 -1
  44. package/dist/el-GR.main.js +0 -7
  45. package/dist/el-GR.main.js.map +0 -1
  46. package/dist/el-GR.mjs +0 -9
  47. package/dist/el-GR.module.js +0 -9
  48. package/dist/el-GR.module.js.map +0 -1
  49. package/dist/en-US.main.js +0 -7
  50. package/dist/en-US.main.js.map +0 -1
  51. package/dist/en-US.mjs +0 -9
  52. package/dist/en-US.module.js +0 -9
  53. package/dist/en-US.module.js.map +0 -1
  54. package/dist/es-ES.main.js +0 -7
  55. package/dist/es-ES.main.js.map +0 -1
  56. package/dist/es-ES.mjs +0 -9
  57. package/dist/es-ES.module.js +0 -9
  58. package/dist/es-ES.module.js.map +0 -1
  59. package/dist/et-EE.main.js +0 -7
  60. package/dist/et-EE.main.js.map +0 -1
  61. package/dist/et-EE.mjs +0 -9
  62. package/dist/et-EE.module.js +0 -9
  63. package/dist/et-EE.module.js.map +0 -1
  64. package/dist/fi-FI.main.js +0 -7
  65. package/dist/fi-FI.main.js.map +0 -1
  66. package/dist/fi-FI.mjs +0 -9
  67. package/dist/fi-FI.module.js +0 -9
  68. package/dist/fi-FI.module.js.map +0 -1
  69. package/dist/fr-FR.main.js +0 -7
  70. package/dist/fr-FR.main.js.map +0 -1
  71. package/dist/fr-FR.mjs +0 -9
  72. package/dist/fr-FR.module.js +0 -9
  73. package/dist/fr-FR.module.js.map +0 -1
  74. package/dist/he-IL.main.js +0 -7
  75. package/dist/he-IL.main.js.map +0 -1
  76. package/dist/he-IL.mjs +0 -9
  77. package/dist/he-IL.module.js +0 -9
  78. package/dist/he-IL.module.js.map +0 -1
  79. package/dist/hr-HR.main.js +0 -7
  80. package/dist/hr-HR.main.js.map +0 -1
  81. package/dist/hr-HR.mjs +0 -9
  82. package/dist/hr-HR.module.js +0 -9
  83. package/dist/hr-HR.module.js.map +0 -1
  84. package/dist/hu-HU.main.js +0 -7
  85. package/dist/hu-HU.main.js.map +0 -1
  86. package/dist/hu-HU.mjs +0 -9
  87. package/dist/hu-HU.module.js +0 -9
  88. package/dist/hu-HU.module.js.map +0 -1
  89. package/dist/intlStrings.main.js +0 -108
  90. package/dist/intlStrings.main.js.map +0 -1
  91. package/dist/intlStrings.mjs +0 -110
  92. package/dist/intlStrings.module.js +0 -110
  93. package/dist/intlStrings.module.js.map +0 -1
  94. package/dist/it-IT.main.js +0 -7
  95. package/dist/it-IT.main.js.map +0 -1
  96. package/dist/it-IT.mjs +0 -9
  97. package/dist/it-IT.module.js +0 -9
  98. package/dist/it-IT.module.js.map +0 -1
  99. package/dist/ja-JP.main.js +0 -7
  100. package/dist/ja-JP.main.js.map +0 -1
  101. package/dist/ja-JP.mjs +0 -9
  102. package/dist/ja-JP.module.js +0 -9
  103. package/dist/ja-JP.module.js.map +0 -1
  104. package/dist/ko-KR.main.js +0 -7
  105. package/dist/ko-KR.main.js.map +0 -1
  106. package/dist/ko-KR.mjs +0 -9
  107. package/dist/ko-KR.module.js +0 -9
  108. package/dist/ko-KR.module.js.map +0 -1
  109. package/dist/lt-LT.main.js +0 -7
  110. package/dist/lt-LT.main.js.map +0 -1
  111. package/dist/lt-LT.mjs +0 -9
  112. package/dist/lt-LT.module.js +0 -9
  113. package/dist/lt-LT.module.js.map +0 -1
  114. package/dist/lv-LV.main.js +0 -7
  115. package/dist/lv-LV.main.js.map +0 -1
  116. package/dist/lv-LV.mjs +0 -9
  117. package/dist/lv-LV.module.js +0 -9
  118. package/dist/lv-LV.module.js.map +0 -1
  119. package/dist/nb-NO.main.js +0 -7
  120. package/dist/nb-NO.main.js.map +0 -1
  121. package/dist/nb-NO.mjs +0 -9
  122. package/dist/nb-NO.module.js +0 -9
  123. package/dist/nb-NO.module.js.map +0 -1
  124. package/dist/nl-NL.main.js +0 -7
  125. package/dist/nl-NL.main.js.map +0 -1
  126. package/dist/nl-NL.mjs +0 -9
  127. package/dist/nl-NL.module.js +0 -9
  128. package/dist/nl-NL.module.js.map +0 -1
  129. package/dist/picker.6ed9ee86.css +0 -288
  130. package/dist/picker.6ed9ee86.css.map +0 -1
  131. package/dist/pl-PL.main.js +0 -7
  132. package/dist/pl-PL.main.js.map +0 -1
  133. package/dist/pl-PL.mjs +0 -9
  134. package/dist/pl-PL.module.js +0 -9
  135. package/dist/pl-PL.module.js.map +0 -1
  136. package/dist/pt-BR.main.js +0 -7
  137. package/dist/pt-BR.main.js.map +0 -1
  138. package/dist/pt-BR.mjs +0 -9
  139. package/dist/pt-BR.module.js +0 -9
  140. package/dist/pt-BR.module.js.map +0 -1
  141. package/dist/pt-PT.main.js +0 -7
  142. package/dist/pt-PT.main.js.map +0 -1
  143. package/dist/pt-PT.mjs +0 -9
  144. package/dist/pt-PT.module.js +0 -9
  145. package/dist/pt-PT.module.js.map +0 -1
  146. package/dist/ro-RO.main.js +0 -7
  147. package/dist/ro-RO.main.js.map +0 -1
  148. package/dist/ro-RO.mjs +0 -9
  149. package/dist/ro-RO.module.js +0 -9
  150. package/dist/ro-RO.module.js.map +0 -1
  151. package/dist/ru-RU.main.js +0 -7
  152. package/dist/ru-RU.main.js.map +0 -1
  153. package/dist/ru-RU.mjs +0 -9
  154. package/dist/ru-RU.module.js +0 -9
  155. package/dist/ru-RU.module.js.map +0 -1
  156. package/dist/sk-SK.main.js +0 -7
  157. package/dist/sk-SK.main.js.map +0 -1
  158. package/dist/sk-SK.mjs +0 -9
  159. package/dist/sk-SK.module.js +0 -9
  160. package/dist/sk-SK.module.js.map +0 -1
  161. package/dist/sl-SI.main.js +0 -7
  162. package/dist/sl-SI.main.js.map +0 -1
  163. package/dist/sl-SI.mjs +0 -9
  164. package/dist/sl-SI.module.js +0 -9
  165. package/dist/sl-SI.module.js.map +0 -1
  166. package/dist/sr-SP.main.js +0 -7
  167. package/dist/sr-SP.main.js.map +0 -1
  168. package/dist/sr-SP.mjs +0 -9
  169. package/dist/sr-SP.module.js +0 -9
  170. package/dist/sr-SP.module.js.map +0 -1
  171. package/dist/sv-SE.main.js +0 -7
  172. package/dist/sv-SE.main.js.map +0 -1
  173. package/dist/sv-SE.mjs +0 -9
  174. package/dist/sv-SE.module.js +0 -9
  175. package/dist/sv-SE.module.js.map +0 -1
  176. package/dist/tr-TR.main.js +0 -7
  177. package/dist/tr-TR.main.js.map +0 -1
  178. package/dist/tr-TR.mjs +0 -9
  179. package/dist/tr-TR.module.js +0 -9
  180. package/dist/tr-TR.module.js.map +0 -1
  181. package/dist/types.d.ts +0 -13
  182. package/dist/types.d.ts.map +0 -1
  183. package/dist/uk-UA.main.js +0 -7
  184. package/dist/uk-UA.main.js.map +0 -1
  185. package/dist/uk-UA.mjs +0 -9
  186. package/dist/uk-UA.module.js +0 -9
  187. package/dist/uk-UA.module.js.map +0 -1
  188. package/dist/zh-CN.main.js +0 -7
  189. package/dist/zh-CN.main.js.map +0 -1
  190. package/dist/zh-CN.mjs +0 -9
  191. package/dist/zh-CN.module.js +0 -9
  192. package/dist/zh-CN.module.js.map +0 -1
  193. package/dist/zh-TW.main.js +0 -7
  194. package/dist/zh-TW.main.js.map +0 -1
  195. package/dist/zh-TW.mjs +0 -9
  196. package/dist/zh-TW.module.js +0 -9
  197. package/dist/zh-TW.module.js.map +0 -1
  198. package/src/Picker.tsx +0 -254
package/dist/import.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import {Picker as $51664a9007a3c6f9$export$ba25329847403e11} from "./Picker.mjs";
2
- import {Item as $23896c8062ba3967$re_export$Item, Section as $23896c8062ba3967$re_export$Section} from "@react-stately/collections";
1
+ import {Picker as $a8c83907607ccb3d$re_export$Picker} from "@adobe/react-spectrum/Picker";
2
+ import {Item as $a8c83907607ccb3d$re_export$Item} from "react-stately/Item";
3
+ import {Section as $a8c83907607ccb3d$re_export$Section} from "react-stately/Section";
3
4
 
4
5
  /*
5
6
  * Copyright 2020 Adobe. All rights reserved.
@@ -16,5 +17,6 @@ import {Item as $23896c8062ba3967$re_export$Item, Section as $23896c8062ba3967$r
16
17
 
17
18
 
18
19
 
19
- export {$51664a9007a3c6f9$export$ba25329847403e11 as Picker, $23896c8062ba3967$re_export$Item as Item, $23896c8062ba3967$re_export$Section as Section};
20
+
21
+ export {$a8c83907607ccb3d$re_export$Picker as Picker, $a8c83907607ccb3d$re_export$Item as Item, $a8c83907607ccb3d$re_export$Section as Section};
20
22
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,14 +1,15 @@
1
- var $902e54cfaa4270a9$exports = require("./Picker.main.js");
2
- var $4FjNO$reactstatelycollections = require("@react-stately/collections");
1
+ var $8S7eo$adobereactspectrumPicker = require("@adobe/react-spectrum/Picker");
2
+ var $8S7eo$reactstatelyItem = require("react-stately/Item");
3
+ var $8S7eo$reactstatelySection = require("react-stately/Section");
3
4
 
4
5
 
5
6
  function $parcel$export(e, n, v, s) {
6
7
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
8
  }
8
9
 
9
- $parcel$export(module.exports, "Picker", () => $902e54cfaa4270a9$exports.Picker);
10
- $parcel$export(module.exports, "Item", () => $4FjNO$reactstatelycollections.Item);
11
- $parcel$export(module.exports, "Section", () => $4FjNO$reactstatelycollections.Section);
10
+ $parcel$export(module.exports, "Picker", function () { return $8S7eo$adobereactspectrumPicker.Picker; });
11
+ $parcel$export(module.exports, "Item", function () { return $8S7eo$reactstatelyItem.Item; });
12
+ $parcel$export(module.exports, "Section", function () { return $8S7eo$reactstatelySection.Section; });
12
13
  /*
13
14
  * Copyright 2020 Adobe. All rights reserved.
14
15
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -24,4 +25,5 @@ $parcel$export(module.exports, "Section", () => $4FjNO$reactstatelycollections.S
24
25
 
25
26
 
26
27
 
28
+
27
29
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/picker/src/index.ts"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Picker} from './Picker';\nexport {Item, Section} from '@react-stately/collections';\nexport type {SpectrumPickerProps} from '@react-types/select';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/picker/src/index.ts"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Picker} from '@adobe/react-spectrum/Picker';\n\nexport type {SpectrumPickerProps} from '@adobe/react-spectrum/Picker';\nexport {Item} from 'react-stately/Item';\nexport {Section} from 'react-stately/Section';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,5 +1,6 @@
1
- import {Picker as $51664a9007a3c6f9$export$ba25329847403e11} from "./Picker.module.js";
2
- import {Item as $23896c8062ba3967$re_export$Item, Section as $23896c8062ba3967$re_export$Section} from "@react-stately/collections";
1
+ import {Picker as $a8c83907607ccb3d$re_export$Picker} from "@adobe/react-spectrum/Picker";
2
+ import {Item as $a8c83907607ccb3d$re_export$Item} from "react-stately/Item";
3
+ import {Section as $a8c83907607ccb3d$re_export$Section} from "react-stately/Section";
3
4
 
4
5
  /*
5
6
  * Copyright 2020 Adobe. All rights reserved.
@@ -16,5 +17,6 @@ import {Item as $23896c8062ba3967$re_export$Item, Section as $23896c8062ba3967$r
16
17
 
17
18
 
18
19
 
19
- export {$51664a9007a3c6f9$export$ba25329847403e11 as Picker, $23896c8062ba3967$re_export$Item as Item, $23896c8062ba3967$re_export$Section as Section};
20
+
21
+ export {$a8c83907607ccb3d$re_export$Picker as Picker, $a8c83907607ccb3d$re_export$Item as Item, $a8c83907607ccb3d$re_export$Section as Section};
20
22
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/picker/src/index.ts"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Picker} from './Picker';\nexport {Item, Section} from '@react-stately/collections';\nexport type {SpectrumPickerProps} from '@react-types/select';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/picker/src/index.ts"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {Picker} from '@adobe/react-spectrum/Picker';\n\nexport type {SpectrumPickerProps} from '@adobe/react-spectrum/Picker';\nexport {Item} from 'react-stately/Item';\nexport {Section} from 'react-stately/Section';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,4 @@
1
+ export { Picker } from '@adobe/react-spectrum/Picker';
2
+ export type { SpectrumPickerProps } from '@adobe/react-spectrum/Picker';
3
+ export { Item } from 'react-stately/Item';
4
+ export { Section } from 'react-stately/Section';
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@react-spectrum/picker",
3
- "version": "3.16.6",
3
+ "version": "3.17.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/module.js",
8
8
  "exports": {
9
- "source": "./src/index.ts",
10
- "types": [
11
- "./dist/types.d.ts",
12
- "./src/index.ts"
13
- ],
14
- "import": "./dist/import.mjs",
15
- "require": "./dist/main.js"
9
+ ".": {
10
+ "source": "./src/index.ts",
11
+ "types": "./dist/types/src/index.d.ts",
12
+ "import": "./dist/import.mjs",
13
+ "require": "./dist/main.js"
14
+ },
15
+ "./package.json": "./package.json"
16
16
  },
17
- "types": "dist/types.d.ts",
17
+ "types": "dist/types/src/index.d.ts",
18
18
  "source": "src/index.ts",
19
19
  "files": [
20
20
  "dist",
@@ -24,51 +24,23 @@
24
24
  "*.css"
25
25
  ],
26
26
  "targets": {
27
- "main": {
28
- "includeNodeModules": [
29
- "@adobe/spectrum-css-temp"
30
- ]
31
- },
32
- "module": {
33
- "includeNodeModules": [
34
- "@adobe/spectrum-css-temp"
35
- ]
36
- }
27
+ "types": false
37
28
  },
38
29
  "repository": {
39
30
  "type": "git",
40
31
  "url": "https://github.com/adobe/react-spectrum"
41
32
  },
42
33
  "dependencies": {
43
- "@react-aria/i18n": "^3.12.15",
44
- "@react-aria/interactions": "^3.27.0",
45
- "@react-aria/select": "^3.17.2",
46
- "@react-aria/utils": "^3.33.0",
47
- "@react-spectrum/button": "^3.17.6",
48
- "@react-spectrum/form": "^3.7.21",
49
- "@react-spectrum/label": "^3.16.21",
50
- "@react-spectrum/listbox": "^3.15.10",
51
- "@react-spectrum/overlays": "^5.9.2",
52
- "@react-spectrum/progress": "^3.7.22",
53
- "@react-spectrum/text": "^3.5.24",
54
- "@react-spectrum/utils": "^3.12.11",
55
- "@react-stately/collections": "^3.12.9",
56
- "@react-stately/select": "^3.9.1",
57
- "@react-types/select": "^3.12.1",
58
- "@react-types/shared": "^3.33.0",
59
- "@spectrum-icons/ui": "^3.6.22",
60
- "@swc/helpers": "^0.5.0"
61
- },
62
- "devDependencies": {
63
- "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
34
+ "@adobe/react-spectrum": "3.47.0",
35
+ "@swc/helpers": "^0.5.0",
36
+ "react-stately": "3.46.0"
64
37
  },
65
38
  "peerDependencies": {
66
- "@react-spectrum/provider": "^3.1.4",
67
39
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
68
40
  "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
69
41
  },
70
42
  "publishConfig": {
71
43
  "access": "public"
72
44
  },
73
- "gitHead": "66e51757606b43a89ed02c574ca24517323a2ab9"
45
+ "gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
74
46
  }
package/src/index.ts CHANGED
@@ -12,6 +12,8 @@
12
12
 
13
13
  /// <reference types="css-module-types" />
14
14
 
15
- export {Picker} from './Picker';
16
- export {Item, Section} from '@react-stately/collections';
17
- export type {SpectrumPickerProps} from '@react-types/select';
15
+ export {Picker} from '@adobe/react-spectrum/Picker';
16
+
17
+ export type {SpectrumPickerProps} from '@adobe/react-spectrum/Picker';
18
+ export {Item} from 'react-stately/Item';
19
+ export {Section} from 'react-stately/Section';
@@ -1,230 +0,0 @@
1
- var $b95bf71d4a256ee8$exports = require("./intlStrings.main.js");
2
- require("./picker.6ed9ee86.css");
3
- var $b39b306bfc9a5551$exports = require("./dropdown_vars_css.main.js");
4
- var $3qYcd$spectrumiconsuiAlertMedium = require("@spectrum-icons/ui/AlertMedium");
5
- var $3qYcd$spectrumiconsuiChevronDownMedium = require("@spectrum-icons/ui/ChevronDownMedium");
6
- var $3qYcd$reactspectrumutils = require("@react-spectrum/utils");
7
- var $3qYcd$reactspectrumlabel = require("@react-spectrum/label");
8
- var $3qYcd$reactspectrumbutton = require("@react-spectrum/button");
9
- var $3qYcd$reactariaselect = require("@react-aria/select");
10
- var $3qYcd$reactspectrumlistbox = require("@react-spectrum/listbox");
11
- var $3qYcd$reactariautils = require("@react-aria/utils");
12
- var $3qYcd$reactspectrumoverlays = require("@react-spectrum/overlays");
13
- var $3qYcd$reactariainteractions = require("@react-aria/interactions");
14
- var $3qYcd$reactspectrumprogress = require("@react-spectrum/progress");
15
- var $3qYcd$react = require("react");
16
- var $3qYcd$reactspectrumtext = require("@react-spectrum/text");
17
- var $3qYcd$reactspectrumform = require("@react-spectrum/form");
18
- var $3qYcd$reactariai18n = require("@react-aria/i18n");
19
- var $3qYcd$reactspectrumprovider = require("@react-spectrum/provider");
20
- var $3qYcd$reactstatelyselect = require("@react-stately/select");
21
-
22
-
23
- function $parcel$interopDefault(a) {
24
- return a && a.__esModule ? a.default : a;
25
- }
26
-
27
- function $parcel$export(e, n, v, s) {
28
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
29
- }
30
-
31
- $parcel$export(module.exports, "Picker", () => $902e54cfaa4270a9$export$ba25329847403e11);
32
- /*
33
- * Copyright 2020 Adobe. All rights reserved.
34
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
35
- * you may not use this file except in compliance with the License. You may obtain a copy
36
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
37
- *
38
- * Unless required by applicable law or agreed to in writing, software distributed under
39
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
40
- * OF ANY KIND, either express or implied. See the License for the specific language
41
- * governing permissions and limitations under the License.
42
- */
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
-
60
-
61
- const $902e54cfaa4270a9$export$ba25329847403e11 = /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).forwardRef(function Picker(props, ref) {
62
- props = (0, $3qYcd$reactspectrumutils.useSlotProps)(props, 'picker');
63
- props = (0, $3qYcd$reactspectrumprovider.useProviderProps)(props);
64
- props = (0, $3qYcd$reactspectrumform.useFormProps)(props);
65
- let stringFormatter = (0, $3qYcd$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($b95bf71d4a256ee8$exports))), '@react-spectrum/picker');
66
- let { autoComplete: autoComplete, isDisabled: isDisabled, direction: direction = 'bottom', align: align = 'start', shouldFlip: shouldFlip = true, placeholder: placeholder = stringFormatter.format('placeholder'), isQuiet: isQuiet, labelPosition: labelPosition = 'top', menuWidth: menuWidth, autoFocus: autoFocus } = props;
67
- let state = (0, $3qYcd$reactstatelyselect.useSelectState)(props);
68
- let domRef = (0, $3qYcd$reactspectrumutils.useDOMRef)(ref);
69
- let popoverRef = (0, $3qYcd$react.useRef)(null);
70
- let triggerRef = (0, $3qYcd$react.useRef)(null);
71
- let unwrappedTriggerRef = (0, $3qYcd$reactspectrumutils.useUnwrapDOMRef)(triggerRef);
72
- let listboxRef = (0, $3qYcd$react.useRef)(null);
73
- let isLoadingInitial = props.isLoading && state.collection.size === 0;
74
- let isLoadingMore = props.isLoading && state.collection.size > 0;
75
- let progressCircleId = (0, $3qYcd$reactariautils.useId)();
76
- // We create the listbox layout in Picker and pass it to ListBoxBase below
77
- // so that the layout information can be cached even while the listbox is not mounted.
78
- // We also use the layout as the keyboard delegate for type to select.
79
- let layout = (0, $3qYcd$reactspectrumlistbox.useListBoxLayout)();
80
- let { labelProps: labelProps, triggerProps: triggerProps, valueProps: valueProps, menuProps: menuProps, hiddenSelectProps: hiddenSelectProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps, isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = (0, $3qYcd$reactariaselect.useSelect)({
81
- ...props,
82
- 'aria-describedby': isLoadingInitial ? progressCircleId : undefined
83
- }, state, unwrappedTriggerRef);
84
- let isMobile = (0, $3qYcd$reactspectrumutils.useIsMobileDevice)();
85
- let { hoverProps: hoverProps, isHovered: isHovered } = (0, $3qYcd$reactariainteractions.useHover)({
86
- isDisabled: isDisabled
87
- });
88
- // On small screen devices, the listbox is rendered in a tray, otherwise a popover.
89
- let listbox = /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumlistbox.ListBoxBase), {
90
- ...menuProps,
91
- ref: listboxRef,
92
- disallowEmptySelection: true,
93
- autoFocus: state.focusStrategy || true,
94
- shouldSelectOnPressUp: true,
95
- focusOnPointerEnter: true,
96
- layout: layout,
97
- state: state,
98
- width: isMobile ? '100%' : undefined,
99
- // Set max height: inherit so Tray scrolling works
100
- UNSAFE_style: {
101
- maxHeight: 'inherit'
102
- },
103
- isLoading: props.isLoading,
104
- showLoadingSpinner: isLoadingMore,
105
- onLoadMore: props.onLoadMore
106
- });
107
- // Measure the width of the button to inform the width of the menu (below).
108
- let [buttonWidth, setButtonWidth] = (0, $3qYcd$react.useState)(undefined);
109
- let { scale: scale } = (0, $3qYcd$reactspectrumprovider.useProvider)();
110
- let onResize = (0, $3qYcd$react.useCallback)(()=>{
111
- if (!isMobile && unwrappedTriggerRef.current) {
112
- let width = unwrappedTriggerRef.current.offsetWidth;
113
- setButtonWidth(width);
114
- }
115
- }, [
116
- unwrappedTriggerRef,
117
- setButtonWidth,
118
- isMobile
119
- ]);
120
- (0, $3qYcd$reactariautils.useResizeObserver)({
121
- ref: unwrappedTriggerRef,
122
- onResize: onResize
123
- });
124
- (0, $3qYcd$reactariautils.useLayoutEffect)(onResize, [
125
- scale,
126
- state.selectedKey,
127
- onResize
128
- ]);
129
- let overlay;
130
- if (isMobile) overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumoverlays.Tray), {
131
- state: state
132
- }, listbox);
133
- else {
134
- // If quiet, use the default width, otherwise match the width of the button. This can be overridden by the menuWidth prop.
135
- // Always have a minimum width of the button width. When quiet, there is an extra offset to add.
136
- // Not using style props for this because they don't support `calc`.
137
- let width = isQuiet ? undefined : buttonWidth;
138
- let style = {
139
- width: menuWidth ? (0, $3qYcd$reactspectrumutils.dimensionValue)(menuWidth) : width,
140
- minWidth: isQuiet ? `calc(${buttonWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : buttonWidth
141
- };
142
- overlay = /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumoverlays.Popover), {
143
- UNSAFE_style: style,
144
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown-popover', {
145
- 'spectrum-Dropdown-popover--quiet': isQuiet
146
- }),
147
- ref: popoverRef,
148
- placement: `${direction} ${align}`,
149
- shouldFlip: shouldFlip,
150
- hideArrow: true,
151
- state: state,
152
- triggerRef: unwrappedTriggerRef,
153
- scrollRef: listboxRef,
154
- shouldContainFocus: true
155
- }, listbox);
156
- }
157
- let contents = state.selectedItem ? state.selectedItem.rendered : placeholder;
158
- if (typeof contents === 'string') contents = /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumtext.Text), null, contents);
159
- let picker = /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement("div", {
160
- className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown', {
161
- 'is-invalid': isInvalid && !isDisabled,
162
- 'is-disabled': isDisabled,
163
- 'spectrum-Dropdown--quiet': isQuiet
164
- })
165
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactariaselect.HiddenSelect), {
166
- autoComplete: autoComplete,
167
- ...hiddenSelectProps
168
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactariainteractions.PressResponder), (0, $3qYcd$reactariautils.mergeProps)(hoverProps, triggerProps), /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumbutton.FieldButton), {
169
- ref: triggerRef,
170
- isActive: state.isOpen,
171
- isQuiet: isQuiet,
172
- isDisabled: isDisabled,
173
- isInvalid: isInvalid,
174
- autoFocus: autoFocus,
175
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown-trigger', {
176
- 'is-hovered': isHovered
177
- })
178
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumutils.SlotProvider), {
179
- slots: {
180
- icon: {
181
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Icon'),
182
- size: 'S'
183
- },
184
- avatar: {
185
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown-avatar'),
186
- size: 'avatar-size-100'
187
- },
188
- text: {
189
- ...valueProps,
190
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown-label', {
191
- 'is-placeholder': !state.selectedItem
192
- })
193
- },
194
- description: {
195
- isHidden: true
196
- }
197
- }
198
- }, contents), isLoadingInitial && /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumprogress.ProgressCircle), {
199
- id: progressCircleId,
200
- isIndeterminate: true,
201
- size: "S",
202
- "aria-label": stringFormatter.format('loading'),
203
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown-progressCircle')
204
- }), isInvalid && !isLoadingInitial && !isDisabled && /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, ($parcel$interopDefault($3qYcd$spectrumiconsuiAlertMedium))), {
205
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown-invalidIcon')
206
- }), /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, ($parcel$interopDefault($3qYcd$spectrumiconsuiChevronDownMedium))), {
207
- UNSAFE_className: (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Dropdown-chevron')
208
- }))), state.collection.size === 0 ? null : overlay);
209
- let wrapperClassName = (0, $3qYcd$reactspectrumutils.classNames)((0, ($parcel$interopDefault($b39b306bfc9a5551$exports))), 'spectrum-Field', {
210
- 'spectrum-Dropdown-fieldWrapper--quiet': isQuiet,
211
- 'spectrum-Dropdown-fieldWrapper--positionSide': labelPosition === 'side'
212
- });
213
- return /*#__PURE__*/ (0, ($parcel$interopDefault($3qYcd$react))).createElement((0, $3qYcd$reactspectrumlabel.Field), {
214
- ...props,
215
- ref: domRef,
216
- wrapperClassName: wrapperClassName,
217
- labelProps: labelProps,
218
- descriptionProps: descriptionProps,
219
- errorMessageProps: errorMessageProps,
220
- isInvalid: isInvalid,
221
- validationErrors: validationErrors,
222
- validationDetails: validationDetails,
223
- showErrorIcon: false,
224
- includeNecessityIndicatorInAccessibilityName: true,
225
- elementType: "span"
226
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AE,CAAA,GAAA,mDAAK,GAAG;gBAA6B,MAAM;YAAiB;YAClG,MAAM;gBACJ,GAAG,UAAU;gBACb,kBAAkB,CAAA,GAAA,oCAAS,EACzB,CAAA,GAAA,mDAAK,GACL,2BACA;oBAAC,kBAAkB,CAAC,MAAM,YAAY;gBAAA;YAE1C;YACA,aAAa;gBACX,UAAU;YACZ;QACF;OACC,WAEF,kCACC,0DAAC,CAAA,GAAA,2CAAa;QACZ,IAAI;QACJ,iBAAA;QACA,MAAK;QACL,cAAY,gBAAgB,MAAM,CAAC;QACnC,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;QAExC,aAAa,CAAC,oBAAoB,CAAC,4BAClC,0DAAC,CAAA,GAAA,2DAAU;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;sBAEpD,0DAAC,CAAA,GAAA,iEAAgB;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;UAG3D,MAAM,UAAU,CAAC,IAAI,KAAK,IAAI,OAAO;IAI1C,IAAI,mBAAmB,CAAA,GAAA,oCAAS,EAC9B,CAAA,GAAA,mDAAK,GACL,kBACA;QACE,yCAAyC;QACzC,gDAAgD,kBAAkB;IACpE;IAGF,qBACE,0DAAC,CAAA,GAAA,+BAAI;QACF,GAAG,KAAK;QACT,KAAK;QACL,kBAAkB;QAClB,YAAY;QACZ,kBAAkB;QAClB,mBAAmB;QACnB,WAAW;QACX,kBAAkB;QAClB,mBAAmB;QACnB,eAAe;QACf,8CAAA;QACA,aAAY;OACX;AAGP","sources":["packages/@react-spectrum/picker/src/Picker.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 AlertMedium from '@spectrum-icons/ui/AlertMedium';\nimport ChevronDownMedium from '@spectrum-icons/ui/ChevronDownMedium';\nimport {\n classNames,\n dimensionValue,\n SlotProvider,\n useDOMRef,\n useIsMobileDevice,\n useSlotProps,\n useUnwrapDOMRef\n} from '@react-spectrum/utils';\nimport {DOMRef, DOMRefValue, FocusableRefValue, LabelPosition} from '@react-types/shared';\nimport {Field} from '@react-spectrum/label';\nimport {FieldButton} from '@react-spectrum/button';\nimport {HiddenSelect, useSelect} from '@react-aria/select';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListBoxBase, useListBoxLayout} from '@react-spectrum/listbox';\nimport {mergeProps, useId, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {Popover, Tray} from '@react-spectrum/overlays';\nimport {PressResponder, useHover} from '@react-aria/interactions';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {ReactElement, useCallback, useRef, useState} from 'react';\nimport {SpectrumPickerProps} from '@react-types/select';\nimport styles from '@adobe/spectrum-css-temp/components/dropdown/vars.css';\nimport {Text} from '@react-spectrum/text';\nimport {useFormProps} from '@react-spectrum/form';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProvider, useProviderProps} from '@react-spectrum/provider';\nimport {useSelectState} from '@react-stately/select';\n\n/**\n * Pickers allow users to choose a single option from a collapsible list of options when space is limited.\n */\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nexport const Picker = React.forwardRef(function Picker<T extends object>(props: SpectrumPickerProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useSlotProps(props, 'picker');\n props = useProviderProps(props);\n props = useFormProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/picker');\n let {\n autoComplete,\n isDisabled,\n direction = 'bottom',\n align = 'start',\n shouldFlip = true,\n placeholder = stringFormatter.format('placeholder'),\n isQuiet,\n labelPosition = 'top' as LabelPosition,\n menuWidth,\n autoFocus\n } = props;\n\n let state = useSelectState(props);\n let domRef = useDOMRef(ref);\n\n let popoverRef = useRef<DOMRefValue<HTMLDivElement>>(null);\n let triggerRef = useRef<FocusableRefValue<HTMLElement>>(null);\n let unwrappedTriggerRef = useUnwrapDOMRef(triggerRef);\n let listboxRef = useRef(null);\n\n let isLoadingInitial = props.isLoading && state.collection.size === 0;\n let isLoadingMore = props.isLoading && state.collection.size > 0;\n let progressCircleId = useId();\n\n // We create the listbox layout in Picker and pass it to ListBoxBase below\n // so that the layout information can be cached even while the listbox is not mounted.\n // We also use the layout as the keyboard delegate for type to select.\n let layout = useListBoxLayout();\n let {labelProps, triggerProps, valueProps, menuProps, hiddenSelectProps, descriptionProps, errorMessageProps, isInvalid, validationErrors, validationDetails} = useSelect({\n ...props,\n 'aria-describedby': (isLoadingInitial ? progressCircleId : undefined)\n }, state, unwrappedTriggerRef);\n\n let isMobile = useIsMobileDevice();\n let {hoverProps, isHovered} = useHover({isDisabled});\n\n // On small screen devices, the listbox is rendered in a tray, otherwise a popover.\n let listbox = (\n <ListBoxBase\n {...menuProps}\n ref={listboxRef}\n disallowEmptySelection\n autoFocus={state.focusStrategy || true}\n shouldSelectOnPressUp\n focusOnPointerEnter\n layout={layout}\n state={state}\n width={isMobile ? '100%' : undefined}\n // Set max height: inherit so Tray scrolling works\n UNSAFE_style={{maxHeight: 'inherit'}}\n isLoading={props.isLoading}\n showLoadingSpinner={isLoadingMore}\n onLoadMore={props.onLoadMore} />\n );\n\n // Measure the width of the button to inform the width of the menu (below).\n let [buttonWidth, setButtonWidth] = useState<number | undefined>(undefined);\n let {scale} = useProvider();\n\n let onResize = useCallback(() => {\n if (!isMobile && unwrappedTriggerRef.current) {\n let width = unwrappedTriggerRef.current.offsetWidth;\n setButtonWidth(width);\n }\n }, [unwrappedTriggerRef, setButtonWidth, isMobile]);\n\n useResizeObserver({\n ref: unwrappedTriggerRef,\n onResize: onResize\n });\n\n useLayoutEffect(onResize, [scale, state.selectedKey, onResize]);\n\n let overlay;\n if (isMobile) {\n overlay = (\n <Tray state={state}>\n {listbox}\n </Tray>\n );\n } else {\n // If quiet, use the default width, otherwise match the width of the button. This can be overridden by the menuWidth prop.\n // Always have a minimum width of the button width. When quiet, there is an extra offset to add.\n // Not using style props for this because they don't support `calc`.\n let width = isQuiet ? undefined : buttonWidth;\n let style = {\n width: menuWidth ? dimensionValue(menuWidth) : width,\n minWidth: isQuiet ? `calc(${buttonWidth}px + calc(2 * var(--spectrum-dropdown-quiet-offset)))` : buttonWidth\n };\n\n overlay = (\n <Popover\n UNSAFE_style={style}\n UNSAFE_className={classNames(styles, 'spectrum-Dropdown-popover', {'spectrum-Dropdown-popover--quiet': isQuiet})}\n ref={popoverRef}\n placement={`${direction} ${align}`}\n shouldFlip={shouldFlip}\n hideArrow\n state={state}\n triggerRef={unwrappedTriggerRef}\n scrollRef={listboxRef}\n shouldContainFocus>\n {listbox}\n </Popover>\n );\n }\n\n let contents = state.selectedItem ? state.selectedItem.rendered : placeholder;\n if (typeof contents === 'string') {\n contents = <Text>{contents}</Text>;\n }\n\n let picker = (\n <div\n className={\n classNames(\n styles,\n 'spectrum-Dropdown',\n {\n 'is-invalid': isInvalid && !isDisabled,\n 'is-disabled': isDisabled,\n 'spectrum-Dropdown--quiet': isQuiet\n }\n )\n }>\n <HiddenSelect\n autoComplete={autoComplete}\n {...hiddenSelectProps} />\n <PressResponder {...mergeProps(hoverProps, triggerProps)}>\n <FieldButton\n ref={triggerRef}\n isActive={state.isOpen}\n isQuiet={isQuiet}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n autoFocus={autoFocus}\n UNSAFE_className={classNames(styles, 'spectrum-Dropdown-trigger', {'is-hovered': isHovered})}>\n <SlotProvider\n slots={{\n icon: {UNSAFE_className: classNames(styles, 'spectrum-Icon'), size: 'S'},\n avatar: {UNSAFE_className: classNames(styles, 'spectrum-Dropdown-avatar'), size: 'avatar-size-100'},\n text: {\n ...valueProps,\n UNSAFE_className: classNames(\n styles,\n 'spectrum-Dropdown-label',\n {'is-placeholder': !state.selectedItem}\n )\n },\n description: {\n isHidden: true\n }\n }}>\n {contents}\n </SlotProvider>\n {isLoadingInitial &&\n <ProgressCircle\n id={progressCircleId}\n isIndeterminate\n size=\"S\"\n aria-label={stringFormatter.format('loading')}\n UNSAFE_className={classNames(styles, 'spectrum-Dropdown-progressCircle')} />\n }\n {isInvalid && !isLoadingInitial && !isDisabled &&\n <AlertMedium UNSAFE_className={classNames(styles, 'spectrum-Dropdown-invalidIcon')} />\n }\n <ChevronDownMedium UNSAFE_className={classNames(styles, 'spectrum-Dropdown-chevron')} />\n </FieldButton>\n </PressResponder>\n {state.collection.size === 0 ? null : overlay}\n </div>\n );\n\n let wrapperClassName = classNames(\n styles,\n 'spectrum-Field',\n {\n 'spectrum-Dropdown-fieldWrapper--quiet': isQuiet,\n 'spectrum-Dropdown-fieldWrapper--positionSide': labelPosition === 'side'\n }\n );\n\n return (\n <Field\n {...props}\n ref={domRef}\n wrapperClassName={wrapperClassName}\n labelProps={labelProps}\n descriptionProps={descriptionProps}\n errorMessageProps={errorMessageProps}\n isInvalid={isInvalid}\n validationErrors={validationErrors}\n validationDetails={validationDetails}\n showErrorIcon={false}\n includeNecessityIndicatorInAccessibilityName\n elementType=\"span\">\n {picker}\n </Field>\n );\n}) as <T>(props: SpectrumPickerProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"Picker.main.js.map"}