@react-spectrum/listbox 3.0.0-alpha.1 → 3.0.0-nightly-4980928d3-240906

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 (230) hide show
  1. package/README.md +3 -0
  2. package/dist/ListBox.main.js +48 -0
  3. package/dist/ListBox.main.js.map +1 -0
  4. package/dist/ListBox.mjs +39 -0
  5. package/dist/ListBox.module.js +39 -0
  6. package/dist/ListBox.module.js.map +1 -0
  7. package/dist/ListBoxBase.main.js +165 -0
  8. package/dist/ListBoxBase.main.js.map +1 -0
  9. package/dist/ListBoxBase.mjs +159 -0
  10. package/dist/ListBoxBase.module.js +159 -0
  11. package/dist/ListBoxBase.module.js.map +1 -0
  12. package/dist/ListBoxContext.main.js +27 -0
  13. package/dist/ListBoxContext.main.js.map +1 -0
  14. package/dist/ListBoxContext.mjs +18 -0
  15. package/dist/ListBoxContext.module.js +18 -0
  16. package/dist/ListBoxContext.module.js.map +1 -0
  17. package/dist/ListBoxLayout.main.js +79 -0
  18. package/dist/ListBoxLayout.main.js.map +1 -0
  19. package/dist/ListBoxLayout.mjs +74 -0
  20. package/dist/ListBoxLayout.module.js +74 -0
  21. package/dist/ListBoxLayout.module.js.map +1 -0
  22. package/dist/ListBoxOption.main.js +105 -0
  23. package/dist/ListBoxOption.main.js.map +1 -0
  24. package/dist/ListBoxOption.mjs +100 -0
  25. package/dist/ListBoxOption.module.js +100 -0
  26. package/dist/ListBoxOption.module.js.map +1 -0
  27. package/dist/ListBoxSection.main.js +69 -0
  28. package/dist/ListBoxSection.main.js.map +1 -0
  29. package/dist/ListBoxSection.mjs +64 -0
  30. package/dist/ListBoxSection.module.js +64 -0
  31. package/dist/ListBoxSection.module.js.map +1 -0
  32. package/dist/ar-AE.main.js +7 -0
  33. package/dist/ar-AE.main.js.map +1 -0
  34. package/dist/ar-AE.mjs +9 -0
  35. package/dist/ar-AE.module.js +9 -0
  36. package/dist/ar-AE.module.js.map +1 -0
  37. package/dist/bg-BG.main.js +7 -0
  38. package/dist/bg-BG.main.js.map +1 -0
  39. package/dist/bg-BG.mjs +9 -0
  40. package/dist/bg-BG.module.js +9 -0
  41. package/dist/bg-BG.module.js.map +1 -0
  42. package/dist/cs-CZ.main.js +7 -0
  43. package/dist/cs-CZ.main.js.map +1 -0
  44. package/dist/cs-CZ.mjs +9 -0
  45. package/dist/cs-CZ.module.js +9 -0
  46. package/dist/cs-CZ.module.js.map +1 -0
  47. package/dist/da-DK.main.js +7 -0
  48. package/dist/da-DK.main.js.map +1 -0
  49. package/dist/da-DK.mjs +9 -0
  50. package/dist/da-DK.module.js +9 -0
  51. package/dist/da-DK.module.js.map +1 -0
  52. package/dist/de-DE.main.js +7 -0
  53. package/dist/de-DE.main.js.map +1 -0
  54. package/dist/de-DE.mjs +9 -0
  55. package/dist/de-DE.module.js +9 -0
  56. package/dist/de-DE.module.js.map +1 -0
  57. package/dist/el-GR.main.js +7 -0
  58. package/dist/el-GR.main.js.map +1 -0
  59. package/dist/el-GR.mjs +9 -0
  60. package/dist/el-GR.module.js +9 -0
  61. package/dist/el-GR.module.js.map +1 -0
  62. package/dist/en-US.main.js +7 -0
  63. package/dist/en-US.main.js.map +1 -0
  64. package/dist/en-US.mjs +9 -0
  65. package/dist/en-US.module.js +9 -0
  66. package/dist/en-US.module.js.map +1 -0
  67. package/dist/es-ES.main.js +7 -0
  68. package/dist/es-ES.main.js.map +1 -0
  69. package/dist/es-ES.mjs +9 -0
  70. package/dist/es-ES.module.js +9 -0
  71. package/dist/es-ES.module.js.map +1 -0
  72. package/dist/et-EE.main.js +7 -0
  73. package/dist/et-EE.main.js.map +1 -0
  74. package/dist/et-EE.mjs +9 -0
  75. package/dist/et-EE.module.js +9 -0
  76. package/dist/et-EE.module.js.map +1 -0
  77. package/dist/fi-FI.main.js +7 -0
  78. package/dist/fi-FI.main.js.map +1 -0
  79. package/dist/fi-FI.mjs +9 -0
  80. package/dist/fi-FI.module.js +9 -0
  81. package/dist/fi-FI.module.js.map +1 -0
  82. package/dist/fr-FR.main.js +7 -0
  83. package/dist/fr-FR.main.js.map +1 -0
  84. package/dist/fr-FR.mjs +9 -0
  85. package/dist/fr-FR.module.js +9 -0
  86. package/dist/fr-FR.module.js.map +1 -0
  87. package/dist/he-IL.main.js +7 -0
  88. package/dist/he-IL.main.js.map +1 -0
  89. package/dist/he-IL.mjs +9 -0
  90. package/dist/he-IL.module.js +9 -0
  91. package/dist/he-IL.module.js.map +1 -0
  92. package/dist/hr-HR.main.js +7 -0
  93. package/dist/hr-HR.main.js.map +1 -0
  94. package/dist/hr-HR.mjs +9 -0
  95. package/dist/hr-HR.module.js +9 -0
  96. package/dist/hr-HR.module.js.map +1 -0
  97. package/dist/hu-HU.main.js +7 -0
  98. package/dist/hu-HU.main.js.map +1 -0
  99. package/dist/hu-HU.mjs +9 -0
  100. package/dist/hu-HU.module.js +9 -0
  101. package/dist/hu-HU.module.js.map +1 -0
  102. package/dist/import.mjs +22 -0
  103. package/dist/intlStrings.main.js +108 -0
  104. package/dist/intlStrings.main.js.map +1 -0
  105. package/dist/intlStrings.mjs +110 -0
  106. package/dist/intlStrings.module.js +110 -0
  107. package/dist/intlStrings.module.js.map +1 -0
  108. package/dist/it-IT.main.js +7 -0
  109. package/dist/it-IT.main.js.map +1 -0
  110. package/dist/it-IT.mjs +9 -0
  111. package/dist/it-IT.module.js +9 -0
  112. package/dist/it-IT.module.js.map +1 -0
  113. package/dist/ja-JP.main.js +7 -0
  114. package/dist/ja-JP.main.js.map +1 -0
  115. package/dist/ja-JP.mjs +9 -0
  116. package/dist/ja-JP.module.js +9 -0
  117. package/dist/ja-JP.module.js.map +1 -0
  118. package/dist/ko-KR.main.js +7 -0
  119. package/dist/ko-KR.main.js.map +1 -0
  120. package/dist/ko-KR.mjs +9 -0
  121. package/dist/ko-KR.module.js +9 -0
  122. package/dist/ko-KR.module.js.map +1 -0
  123. package/dist/lt-LT.main.js +7 -0
  124. package/dist/lt-LT.main.js.map +1 -0
  125. package/dist/lt-LT.mjs +9 -0
  126. package/dist/lt-LT.module.js +9 -0
  127. package/dist/lt-LT.module.js.map +1 -0
  128. package/dist/lv-LV.main.js +7 -0
  129. package/dist/lv-LV.main.js.map +1 -0
  130. package/dist/lv-LV.mjs +9 -0
  131. package/dist/lv-LV.module.js +9 -0
  132. package/dist/lv-LV.module.js.map +1 -0
  133. package/dist/main.js +22 -298
  134. package/dist/main.js.map +1 -0
  135. package/dist/menu_vars_css.main.js +177 -0
  136. package/dist/menu_vars_css.main.js.map +1 -0
  137. package/dist/menu_vars_css.mjs +179 -0
  138. package/dist/menu_vars_css.module.js +179 -0
  139. package/dist/menu_vars_css.module.js.map +1 -0
  140. package/dist/module.js +16 -250
  141. package/dist/module.js.map +1 -0
  142. package/dist/nb-NO.main.js +7 -0
  143. package/dist/nb-NO.main.js.map +1 -0
  144. package/dist/nb-NO.mjs +9 -0
  145. package/dist/nb-NO.module.js +9 -0
  146. package/dist/nb-NO.module.js.map +1 -0
  147. package/dist/nl-NL.main.js +7 -0
  148. package/dist/nl-NL.main.js.map +1 -0
  149. package/dist/nl-NL.mjs +9 -0
  150. package/dist/nl-NL.module.js +9 -0
  151. package/dist/nl-NL.module.js.map +1 -0
  152. package/dist/pl-PL.main.js +7 -0
  153. package/dist/pl-PL.main.js.map +1 -0
  154. package/dist/pl-PL.mjs +9 -0
  155. package/dist/pl-PL.module.js +9 -0
  156. package/dist/pl-PL.module.js.map +1 -0
  157. package/dist/pt-BR.main.js +7 -0
  158. package/dist/pt-BR.main.js.map +1 -0
  159. package/dist/pt-BR.mjs +9 -0
  160. package/dist/pt-BR.module.js +9 -0
  161. package/dist/pt-BR.module.js.map +1 -0
  162. package/dist/pt-PT.main.js +7 -0
  163. package/dist/pt-PT.main.js.map +1 -0
  164. package/dist/pt-PT.mjs +9 -0
  165. package/dist/pt-PT.module.js +9 -0
  166. package/dist/pt-PT.module.js.map +1 -0
  167. package/dist/ro-RO.main.js +7 -0
  168. package/dist/ro-RO.main.js.map +1 -0
  169. package/dist/ro-RO.mjs +9 -0
  170. package/dist/ro-RO.module.js +9 -0
  171. package/dist/ro-RO.module.js.map +1 -0
  172. package/dist/ru-RU.main.js +7 -0
  173. package/dist/ru-RU.main.js.map +1 -0
  174. package/dist/ru-RU.mjs +9 -0
  175. package/dist/ru-RU.module.js +9 -0
  176. package/dist/ru-RU.module.js.map +1 -0
  177. package/dist/sk-SK.main.js +7 -0
  178. package/dist/sk-SK.main.js.map +1 -0
  179. package/dist/sk-SK.mjs +9 -0
  180. package/dist/sk-SK.module.js +9 -0
  181. package/dist/sk-SK.module.js.map +1 -0
  182. package/dist/sl-SI.main.js +7 -0
  183. package/dist/sl-SI.main.js.map +1 -0
  184. package/dist/sl-SI.mjs +9 -0
  185. package/dist/sl-SI.module.js +9 -0
  186. package/dist/sl-SI.module.js.map +1 -0
  187. package/dist/sr-SP.main.js +7 -0
  188. package/dist/sr-SP.main.js.map +1 -0
  189. package/dist/sr-SP.mjs +9 -0
  190. package/dist/sr-SP.module.js +9 -0
  191. package/dist/sr-SP.module.js.map +1 -0
  192. package/dist/sv-SE.main.js +7 -0
  193. package/dist/sv-SE.main.js.map +1 -0
  194. package/dist/sv-SE.mjs +9 -0
  195. package/dist/sv-SE.module.js +9 -0
  196. package/dist/sv-SE.module.js.map +1 -0
  197. package/dist/tr-TR.main.js +7 -0
  198. package/dist/tr-TR.main.js.map +1 -0
  199. package/dist/tr-TR.mjs +9 -0
  200. package/dist/tr-TR.module.js +9 -0
  201. package/dist/tr-TR.module.js.map +1 -0
  202. package/dist/types.d.ts +35 -11
  203. package/dist/types.d.ts.map +1 -1
  204. package/dist/uk-UA.main.js +7 -0
  205. package/dist/uk-UA.main.js.map +1 -0
  206. package/dist/uk-UA.mjs +9 -0
  207. package/dist/uk-UA.module.js +9 -0
  208. package/dist/uk-UA.module.js.map +1 -0
  209. package/dist/vars.4c57e437.css +568 -0
  210. package/dist/vars.4c57e437.css.map +1 -0
  211. package/dist/zh-CN.main.js +7 -0
  212. package/dist/zh-CN.main.js.map +1 -0
  213. package/dist/zh-CN.mjs +9 -0
  214. package/dist/zh-CN.module.js +9 -0
  215. package/dist/zh-CN.module.js.map +1 -0
  216. package/dist/zh-TW.main.js +7 -0
  217. package/dist/zh-TW.main.js.map +1 -0
  218. package/dist/zh-TW.mjs +9 -0
  219. package/dist/zh-TW.module.js +9 -0
  220. package/dist/zh-TW.module.js.map +1 -0
  221. package/package.json +36 -24
  222. package/src/ListBox.tsx +42 -0
  223. package/src/ListBoxBase.tsx +183 -0
  224. package/src/ListBoxContext.ts +23 -0
  225. package/src/ListBoxLayout.ts +87 -0
  226. package/src/ListBoxOption.tsx +113 -0
  227. package/src/ListBoxSection.tsx +84 -0
  228. package/src/index.ts +18 -0
  229. package/LICENSE +0 -201
  230. package/dist/main.css +0 -295
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @react-spectrum/listbox
2
+
3
+ This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
@@ -0,0 +1,48 @@
1
+ var $60eb4b34c53310cb$exports = require("./ListBoxBase.main.js");
2
+ var $kvNjb$react = require("react");
3
+ var $kvNjb$reactspectrumutils = require("@react-spectrum/utils");
4
+ var $kvNjb$reactstatelylist = require("@react-stately/list");
5
+
6
+
7
+ function $parcel$interopDefault(a) {
8
+ return a && a.__esModule ? a.default : a;
9
+ }
10
+
11
+ function $parcel$export(e, n, v, s) {
12
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
13
+ }
14
+
15
+ $parcel$export(module.exports, "ListBox", () => $582d86e45be55635$export$41f133550aa26f48);
16
+ /*
17
+ * Copyright 2020 Adobe. All rights reserved.
18
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
+ * you may not use this file except in compliance with the License. You may obtain a copy
20
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software distributed under
23
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
+ * OF ANY KIND, either express or implied. See the License for the specific language
25
+ * governing permissions and limitations under the License.
26
+ */
27
+
28
+
29
+
30
+ function $582d86e45be55635$var$ListBox(props, ref) {
31
+ let state = (0, $kvNjb$reactstatelylist.useListState)(props);
32
+ let layout = (0, $60eb4b34c53310cb$exports.useListBoxLayout)();
33
+ let domRef = (0, $kvNjb$reactspectrumutils.useDOMRef)(ref);
34
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($kvNjb$react))).createElement((0, $60eb4b34c53310cb$exports.ListBoxBase), {
35
+ ...props,
36
+ ref: domRef,
37
+ state: state,
38
+ layout: layout
39
+ });
40
+ }
41
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
42
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
43
+ /**
44
+ * A list of options that can allow selection of one or more.
45
+ */ const $582d86e45be55635$export$41f133550aa26f48 = /*#__PURE__*/ (0, ($parcel$interopDefault($kvNjb$react))).forwardRef($582d86e45be55635$var$ListBox);
46
+
47
+
48
+ //# sourceMappingURL=ListBox.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,oCAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,0CAAe;IAC5B,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,qBACE,0DAAC,CAAA,GAAA,qCAAU;QACR,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,QAAQ;;AAEd;AAEA,wFAAwF;AACxF,2GAA2G;AAG3G;;CAEC,GACD,MAAM,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/listbox/src/ListBox.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 {DOMRef} from '@react-types/shared';\nimport {ListBoxBase, useListBoxLayout} from './ListBoxBase';\nimport React, {ReactElement} from 'react';\nimport {SpectrumListBoxProps} from '@react-types/listbox';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useListState} from '@react-stately/list';\n\nfunction ListBox<T extends object>(props: SpectrumListBoxProps<T>, ref: DOMRef<HTMLDivElement>) {\n let state = useListState(props);\n let layout = useListBoxLayout();\n let domRef = useDOMRef(ref);\n\n return (\n <ListBoxBase\n {...props}\n ref={domRef}\n state={state}\n layout={layout} />\n );\n}\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\n\n\n/**\n * A list of options that can allow selection of one or more.\n */\nconst _ListBox = React.forwardRef(ListBox) as <T>(props: SpectrumListBoxProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_ListBox as ListBox};\n"],"names":[],"version":3,"file":"ListBox.main.js.map"}
@@ -0,0 +1,39 @@
1
+ import {ListBoxBase as $3247d4a89e6094e9$export$1afdcf349979fb7e, useListBoxLayout as $3247d4a89e6094e9$export$25768ea656ae32a7} from "./ListBoxBase.mjs";
2
+ import $7rJGh$react from "react";
3
+ import {useDOMRef as $7rJGh$useDOMRef} from "@react-spectrum/utils";
4
+ import {useListState as $7rJGh$useListState} from "@react-stately/list";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $3136257018b1a220$var$ListBox(props, ref) {
21
+ let state = (0, $7rJGh$useListState)(props);
22
+ let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)();
23
+ let domRef = (0, $7rJGh$useDOMRef)(ref);
24
+ return /*#__PURE__*/ (0, $7rJGh$react).createElement((0, $3247d4a89e6094e9$export$1afdcf349979fb7e), {
25
+ ...props,
26
+ ref: domRef,
27
+ state: state,
28
+ layout: layout
29
+ });
30
+ }
31
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
32
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
33
+ /**
34
+ * A list of options that can allow selection of one or more.
35
+ */ const $3136257018b1a220$export$41f133550aa26f48 = /*#__PURE__*/ (0, $7rJGh$react).forwardRef($3136257018b1a220$var$ListBox);
36
+
37
+
38
+ export {$3136257018b1a220$export$41f133550aa26f48 as ListBox};
39
+ //# sourceMappingURL=ListBox.module.js.map
@@ -0,0 +1,39 @@
1
+ import {ListBoxBase as $3247d4a89e6094e9$export$1afdcf349979fb7e, useListBoxLayout as $3247d4a89e6094e9$export$25768ea656ae32a7} from "./ListBoxBase.module.js";
2
+ import $7rJGh$react from "react";
3
+ import {useDOMRef as $7rJGh$useDOMRef} from "@react-spectrum/utils";
4
+ import {useListState as $7rJGh$useListState} from "@react-stately/list";
5
+
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */
17
+
18
+
19
+
20
+ function $3136257018b1a220$var$ListBox(props, ref) {
21
+ let state = (0, $7rJGh$useListState)(props);
22
+ let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)();
23
+ let domRef = (0, $7rJGh$useDOMRef)(ref);
24
+ return /*#__PURE__*/ (0, $7rJGh$react).createElement((0, $3247d4a89e6094e9$export$1afdcf349979fb7e), {
25
+ ...props,
26
+ ref: domRef,
27
+ state: state,
28
+ layout: layout
29
+ });
30
+ }
31
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
32
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
33
+ /**
34
+ * A list of options that can allow selection of one or more.
35
+ */ const $3136257018b1a220$export$41f133550aa26f48 = /*#__PURE__*/ (0, $7rJGh$react).forwardRef($3136257018b1a220$var$ListBox);
36
+
37
+
38
+ export {$3136257018b1a220$export$41f133550aa26f48 as ListBox};
39
+ //# sourceMappingURL=ListBox.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,yCAAe;IAC5B,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,qBACE,gCAAC,CAAA,GAAA,yCAAU;QACR,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,QAAQ;;AAEd;AAEA,wFAAwF;AACxF,2GAA2G;AAG3G;;CAEC,GACD,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/listbox/src/ListBox.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 {DOMRef} from '@react-types/shared';\nimport {ListBoxBase, useListBoxLayout} from './ListBoxBase';\nimport React, {ReactElement} from 'react';\nimport {SpectrumListBoxProps} from '@react-types/listbox';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useListState} from '@react-stately/list';\n\nfunction ListBox<T extends object>(props: SpectrumListBoxProps<T>, ref: DOMRef<HTMLDivElement>) {\n let state = useListState(props);\n let layout = useListBoxLayout();\n let domRef = useDOMRef(ref);\n\n return (\n <ListBoxBase\n {...props}\n ref={domRef}\n state={state}\n layout={layout} />\n );\n}\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\n\n\n/**\n * A list of options that can allow selection of one or more.\n */\nconst _ListBox = React.forwardRef(ListBox) as <T>(props: SpectrumListBoxProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_ListBox as ListBox};\n"],"names":[],"version":3,"file":"ListBox.module.js.map"}
@@ -0,0 +1,165 @@
1
+ var $3d9fe9b46e2d649a$exports = require("./intlStrings.main.js");
2
+ var $611e93c7b7c0413c$exports = require("./ListBoxContext.main.js");
3
+ var $570d5c216669f686$exports = require("./ListBoxLayout.main.js");
4
+ var $2205d250ee1cb1ac$exports = require("./ListBoxOption.main.js");
5
+ var $0f5fd8483f48ef09$exports = require("./ListBoxSection.main.js");
6
+ require("./vars.4c57e437.css");
7
+ var $3deee0fd2b46e64f$exports = require("./menu_vars_css.main.js");
8
+ var $7w19U$reactarialistbox = require("@react-aria/listbox");
9
+ var $7w19U$reactspectrumutils = require("@react-spectrum/utils");
10
+ var $7w19U$reactariafocus = require("@react-aria/focus");
11
+ var $7w19U$reactariautils = require("@react-aria/utils");
12
+ var $7w19U$reactspectrumprogress = require("@react-spectrum/progress");
13
+ var $7w19U$react = require("react");
14
+ var $7w19U$reactariai18n = require("@react-aria/i18n");
15
+ var $7w19U$reactspectrumprovider = require("@react-spectrum/provider");
16
+ var $7w19U$reactariavirtualizer = require("@react-aria/virtualizer");
17
+
18
+
19
+ function $parcel$interopDefault(a) {
20
+ return a && a.__esModule ? a.default : a;
21
+ }
22
+
23
+ function $parcel$export(e, n, v, s) {
24
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
25
+ }
26
+
27
+ $parcel$export(module.exports, "useListBoxLayout", () => $60eb4b34c53310cb$export$25768ea656ae32a7);
28
+ $parcel$export(module.exports, "ListBoxBase", () => $60eb4b34c53310cb$export$1afdcf349979fb7e);
29
+ /*
30
+ * Copyright 2020 Adobe. All rights reserved.
31
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
32
+ * you may not use this file except in compliance with the License. You may obtain a copy
33
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
34
+ *
35
+ * Unless required by applicable law or agreed to in writing, software distributed under
36
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
37
+ * OF ANY KIND, either express or implied. See the License for the specific language
38
+ * governing permissions and limitations under the License.
39
+ */
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+ function $60eb4b34c53310cb$export$25768ea656ae32a7() {
55
+ let { scale: scale } = (0, $7w19U$reactspectrumprovider.useProvider)();
56
+ let layout = (0, $7w19U$react.useMemo)(()=>new (0, $570d5c216669f686$exports.ListBoxLayout)({
57
+ estimatedRowHeight: scale === 'large' ? 48 : 32,
58
+ estimatedHeadingHeight: scale === 'large' ? 33 : 26,
59
+ padding: scale === 'large' ? 5 : 4,
60
+ placeholderHeight: scale === 'large' ? 48 : 32
61
+ }), [
62
+ scale
63
+ ]);
64
+ return layout;
65
+ }
66
+ /** @private */ function $60eb4b34c53310cb$var$ListBoxBase(props, ref) {
67
+ let { layout: layout, state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, isLoading: isLoading, showLoadingSpinner: showLoadingSpinner = isLoading, onScroll: onScroll, renderEmptyState: renderEmptyState } = props;
68
+ let { listBoxProps: listBoxProps } = (0, $7w19U$reactarialistbox.useListBox)({
69
+ ...props,
70
+ layoutDelegate: layout,
71
+ isVirtualized: true
72
+ }, state, ref);
73
+ let { styleProps: styleProps } = (0, $7w19U$reactspectrumutils.useStyleProps)(props);
74
+ let renderWrapper = (0, $7w19U$react.useCallback)((parent, reusableView, children, renderChildren)=>{
75
+ var _children_find;
76
+ if (reusableView.viewType === 'section') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $0f5fd8483f48ef09$exports.ListBoxSection), {
77
+ key: reusableView.key,
78
+ item: reusableView.content,
79
+ layoutInfo: reusableView.layoutInfo,
80
+ virtualizer: reusableView.virtualizer,
81
+ headerLayoutInfo: (_children_find = children.find((c)=>c.viewType === 'header')) === null || _children_find === void 0 ? void 0 : _children_find.layoutInfo
82
+ }, renderChildren(children.filter((c)=>c.viewType === 'item')));
83
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariavirtualizer.VirtualizerItem), {
84
+ key: reusableView.key,
85
+ layoutInfo: reusableView.layoutInfo,
86
+ virtualizer: reusableView.virtualizer,
87
+ parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
88
+ }, reusableView.rendered);
89
+ }, []);
90
+ let focusedKey = state.selectionManager.focusedKey;
91
+ let persistedKeys = (0, $7w19U$react.useMemo)(()=>focusedKey != null ? new Set([
92
+ focusedKey
93
+ ]) : null, [
94
+ focusedKey
95
+ ]);
96
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $611e93c7b7c0413c$exports.ListBoxContext).Provider, {
97
+ value: {
98
+ state: state,
99
+ renderEmptyState: renderEmptyState,
100
+ shouldFocusOnHover: shouldFocusOnHover,
101
+ shouldUseVirtualFocus: shouldUseVirtualFocus
102
+ }
103
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariafocus.FocusScope), null, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariavirtualizer.Virtualizer), {
104
+ ...styleProps,
105
+ ...(0, $7w19U$reactariautils.mergeProps)(listBoxProps, domProps),
106
+ ref: ref,
107
+ persistedKeys: persistedKeys,
108
+ autoFocus: !!props.autoFocus || undefined,
109
+ scrollDirection: "vertical",
110
+ className: (0, $7w19U$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu', styleProps.className),
111
+ layout: layout,
112
+ layoutOptions: (0, $7w19U$react.useMemo)(()=>({
113
+ isLoading: showLoadingSpinner
114
+ }), [
115
+ showLoadingSpinner
116
+ ]),
117
+ collection: state.collection,
118
+ renderWrapper: renderWrapper,
119
+ isLoading: isLoading,
120
+ onLoadMore: props.onLoadMore,
121
+ onScroll: onScroll
122
+ }, (0, $7w19U$react.useCallback)((type, item)=>{
123
+ if (type === 'item') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $2205d250ee1cb1ac$exports.ListBoxOption), {
124
+ item: item
125
+ });
126
+ else if (type === 'loader') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement($60eb4b34c53310cb$var$LoadingState, null);
127
+ else if (type === 'placeholder') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement($60eb4b34c53310cb$var$EmptyState, null);
128
+ }, []))));
129
+ }
130
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
131
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
132
+ const $60eb4b34c53310cb$export$1afdcf349979fb7e = /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).forwardRef($60eb4b34c53310cb$var$ListBoxBase);
133
+ function $60eb4b34c53310cb$var$LoadingState() {
134
+ let { state: state } = (0, $7w19U$react.useContext)((0, $611e93c7b7c0413c$exports.ListBoxContext));
135
+ let stringFormatter = (0, $7w19U$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($3d9fe9b46e2d649a$exports))), '@react-spectrum/listbox');
136
+ return(// aria-selected isn't needed here since this option is not selectable.
137
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
138
+ /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement("div", {
139
+ role: "option",
140
+ style: {
141
+ display: 'flex',
142
+ alignItems: 'center',
143
+ justifyContent: 'center',
144
+ height: '100%'
145
+ }
146
+ }, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactspectrumprogress.ProgressCircle), {
147
+ isIndeterminate: true,
148
+ size: "S",
149
+ "aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
150
+ UNSAFE_className: (0, $7w19U$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Dropdown-progressCircle')
151
+ })));
152
+ }
153
+ function $60eb4b34c53310cb$var$EmptyState() {
154
+ let { renderEmptyState: renderEmptyState } = (0, $7w19U$react.useContext)((0, $611e93c7b7c0413c$exports.ListBoxContext));
155
+ let emptyState = renderEmptyState ? renderEmptyState() : null;
156
+ if (emptyState == null) return null;
157
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement("div", {
158
+ // aria-selected isn't needed here since this option is not selectable.
159
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
160
+ role: "option"
161
+ }, emptyState);
162
+ }
163
+
164
+
165
+ //# sourceMappingURL=ListBoxBase.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"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","sources":["packages/@react-spectrum/listbox/src/ListBoxBase.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 {AriaLabelingProps, DOMProps, FocusStrategy, Node, RefObject, StyleProps} from '@react-types/shared';\nimport {AriaListBoxOptions, useListBox} from '@react-aria/listbox';\nimport {classNames, useStyleProps} from '@react-spectrum/utils';\nimport {FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ListBoxContext} from './ListBoxContext';\nimport {ListBoxLayout} from './ListBoxLayout';\nimport {ListBoxOption} from './ListBoxOption';\nimport {ListBoxSection} from './ListBoxSection';\nimport {ListState} from '@react-stately/list';\nimport {mergeProps} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {HTMLAttributes, ReactElement, ReactNode, useCallback, useContext, useMemo} from 'react';\nimport {ReusableView} from '@react-stately/virtualizer';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProvider} from '@react-spectrum/provider';\nimport {Virtualizer, VirtualizerItem} from '@react-aria/virtualizer';\n\ninterface ListBoxBaseProps<T> extends AriaListBoxOptions<T>, DOMProps, AriaLabelingProps, StyleProps {\n layout: ListBoxLayout<T>,\n state: ListState<T>,\n autoFocus?: boolean | FocusStrategy,\n shouldFocusWrap?: boolean,\n shouldSelectOnPressUp?: boolean,\n focusOnPointerEnter?: boolean,\n domProps?: HTMLAttributes<HTMLElement>,\n disallowEmptySelection?: boolean,\n shouldUseVirtualFocus?: boolean,\n isLoading?: boolean,\n showLoadingSpinner?: boolean,\n onLoadMore?: () => void,\n renderEmptyState?: () => ReactNode,\n onScroll?: () => void\n}\n\n/** @private */\nexport function useListBoxLayout<T>(): ListBoxLayout<T> {\n let {scale} = useProvider();\n let layout = useMemo(() =>\n new ListBoxLayout<T>({\n estimatedRowHeight: scale === 'large' ? 48 : 32,\n estimatedHeadingHeight: scale === 'large' ? 33 : 26,\n padding: scale === 'large' ? 5 : 4, // TODO: get from DNA\n placeholderHeight: scale === 'large' ? 48 : 32\n })\n , [scale]);\n\n return layout;\n}\n\n/** @private */\nfunction ListBoxBase<T>(props: ListBoxBaseProps<T>, ref: RefObject<HTMLDivElement | null>) {\n let {layout, state, shouldFocusOnHover, shouldUseVirtualFocus, domProps = {}, isLoading, showLoadingSpinner = isLoading, onScroll, renderEmptyState} = props;\n let {listBoxProps} = useListBox({\n ...props,\n layoutDelegate: layout,\n isVirtualized: true\n }, state, ref);\n let {styleProps} = useStyleProps(props);\n\n // This overrides collection view's renderWrapper to support hierarchy of items in sections.\n // The header is extracted from the children so it can receive ARIA labeling properties.\n type View = ReusableView<Node<T>, ReactElement>;\n let renderWrapper = useCallback((parent: View, reusableView: View, children: View[], renderChildren: (views: View[]) => ReactElement[]) => {\n if (reusableView.viewType === 'section') {\n return (\n <ListBoxSection\n key={reusableView.key}\n item={reusableView.content}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n headerLayoutInfo={children.find(c => c.viewType === 'header')?.layoutInfo}>\n {renderChildren(children.filter(c => c.viewType === 'item'))}\n </ListBoxSection>\n );\n }\n\n return (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n }, []);\n\n let focusedKey = state.selectionManager.focusedKey;\n let persistedKeys = useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n\n return (\n <ListBoxContext.Provider value={{state, renderEmptyState, shouldFocusOnHover, shouldUseVirtualFocus}}>\n <FocusScope>\n <Virtualizer\n {...styleProps}\n {...mergeProps(listBoxProps, domProps)}\n ref={ref}\n persistedKeys={persistedKeys}\n autoFocus={!!props.autoFocus || undefined}\n scrollDirection=\"vertical\"\n className={\n classNames(\n styles,\n 'spectrum-Menu',\n styleProps.className\n )\n }\n layout={layout}\n layoutOptions={useMemo(() => ({\n isLoading: showLoadingSpinner\n }), [showLoadingSpinner])}\n collection={state.collection}\n renderWrapper={renderWrapper}\n isLoading={isLoading}\n onLoadMore={props.onLoadMore}\n onScroll={onScroll}>\n {useCallback((type, item: Node<T>) => {\n if (type === 'item') {\n return <ListBoxOption item={item} />;\n } else if (type === 'loader') {\n return <LoadingState />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </FocusScope>\n </ListBoxContext.Provider>\n );\n}\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\nconst _ListBoxBase = React.forwardRef(ListBoxBase) as <T>(props: ListBoxBaseProps<T> & {ref?: RefObject<HTMLDivElement | null>}) => ReactElement;\nexport {_ListBoxBase as ListBoxBase};\n\nfunction LoadingState() {\n let {state} = useContext(ListBoxContext);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/listbox');\n return (\n // aria-selected isn't needed here since this option is not selectable.\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n <div role=\"option\" style={{display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%'}}>\n <ProgressCircle\n isIndeterminate\n size=\"S\"\n aria-label={state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')}\n UNSAFE_className={classNames(styles, 'spectrum-Dropdown-progressCircle')} />\n </div>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useContext(ListBoxContext);\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return (\n <div\n // aria-selected isn't needed here since this option is not selectable.\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props\n role=\"option\">\n {emptyState}\n </div>\n );\n}\n"],"names":[],"version":3,"file":"ListBoxBase.main.js.map"}
@@ -0,0 +1,159 @@
1
+ import $gF3QK$intlStringsmodulejs from "./intlStrings.mjs";
2
+ import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.mjs";
3
+ import {ListBoxLayout as $d20755daac213984$export$c7e5f5ea00052bf} from "./ListBoxLayout.mjs";
4
+ import {ListBoxOption as $86983ea1fa3f7312$export$feb3b6b552c14a12} from "./ListBoxOption.mjs";
5
+ import {ListBoxSection as $92d678ed88836094$export$dca12b0bb56e4fc} from "./ListBoxSection.mjs";
6
+ import "./vars.4c57e437.css";
7
+ import $gF3QK$menu_vars_cssmodulejs from "./menu_vars_css.mjs";
8
+ import {useListBox as $gF3QK$useListBox} from "@react-aria/listbox";
9
+ import {useStyleProps as $gF3QK$useStyleProps, classNames as $gF3QK$classNames} from "@react-spectrum/utils";
10
+ import {FocusScope as $gF3QK$FocusScope} from "@react-aria/focus";
11
+ import {mergeProps as $gF3QK$mergeProps} from "@react-aria/utils";
12
+ import {ProgressCircle as $gF3QK$ProgressCircle} from "@react-spectrum/progress";
13
+ import $gF3QK$react, {useMemo as $gF3QK$useMemo, useCallback as $gF3QK$useCallback, useContext as $gF3QK$useContext} from "react";
14
+ import {useLocalizedStringFormatter as $gF3QK$useLocalizedStringFormatter} from "@react-aria/i18n";
15
+ import {useProvider as $gF3QK$useProvider} from "@react-spectrum/provider";
16
+ import {VirtualizerItem as $gF3QK$VirtualizerItem, Virtualizer as $gF3QK$Virtualizer} from "@react-aria/virtualizer";
17
+
18
+
19
+ function $parcel$interopDefault(a) {
20
+ return a && a.__esModule ? a.default : a;
21
+ }
22
+ /*
23
+ * Copyright 2020 Adobe. All rights reserved.
24
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
25
+ * you may not use this file except in compliance with the License. You may obtain a copy
26
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software distributed under
29
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
30
+ * OF ANY KIND, either express or implied. See the License for the specific language
31
+ * governing permissions and limitations under the License.
32
+ */
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+ function $3247d4a89e6094e9$export$25768ea656ae32a7() {
48
+ let { scale: scale } = (0, $gF3QK$useProvider)();
49
+ let layout = (0, $gF3QK$useMemo)(()=>new (0, $d20755daac213984$export$c7e5f5ea00052bf)({
50
+ estimatedRowHeight: scale === 'large' ? 48 : 32,
51
+ estimatedHeadingHeight: scale === 'large' ? 33 : 26,
52
+ padding: scale === 'large' ? 5 : 4,
53
+ placeholderHeight: scale === 'large' ? 48 : 32
54
+ }), [
55
+ scale
56
+ ]);
57
+ return layout;
58
+ }
59
+ /** @private */ function $3247d4a89e6094e9$var$ListBoxBase(props, ref) {
60
+ let { layout: layout, state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, isLoading: isLoading, showLoadingSpinner: showLoadingSpinner = isLoading, onScroll: onScroll, renderEmptyState: renderEmptyState } = props;
61
+ let { listBoxProps: listBoxProps } = (0, $gF3QK$useListBox)({
62
+ ...props,
63
+ layoutDelegate: layout,
64
+ isVirtualized: true
65
+ }, state, ref);
66
+ let { styleProps: styleProps } = (0, $gF3QK$useStyleProps)(props);
67
+ let renderWrapper = (0, $gF3QK$useCallback)((parent, reusableView, children, renderChildren)=>{
68
+ var _children_find;
69
+ if (reusableView.viewType === 'section') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $92d678ed88836094$export$dca12b0bb56e4fc), {
70
+ key: reusableView.key,
71
+ item: reusableView.content,
72
+ layoutInfo: reusableView.layoutInfo,
73
+ virtualizer: reusableView.virtualizer,
74
+ headerLayoutInfo: (_children_find = children.find((c)=>c.viewType === 'header')) === null || _children_find === void 0 ? void 0 : _children_find.layoutInfo
75
+ }, renderChildren(children.filter((c)=>c.viewType === 'item')));
76
+ return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$VirtualizerItem), {
77
+ key: reusableView.key,
78
+ layoutInfo: reusableView.layoutInfo,
79
+ virtualizer: reusableView.virtualizer,
80
+ parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
81
+ }, reusableView.rendered);
82
+ }, []);
83
+ let focusedKey = state.selectionManager.focusedKey;
84
+ let persistedKeys = (0, $gF3QK$useMemo)(()=>focusedKey != null ? new Set([
85
+ focusedKey
86
+ ]) : null, [
87
+ focusedKey
88
+ ]);
89
+ return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $0c6f792811e33483$export$7ff8f37d2d81a48d).Provider, {
90
+ value: {
91
+ state: state,
92
+ renderEmptyState: renderEmptyState,
93
+ shouldFocusOnHover: shouldFocusOnHover,
94
+ shouldUseVirtualFocus: shouldUseVirtualFocus
95
+ }
96
+ }, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$FocusScope), null, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$Virtualizer), {
97
+ ...styleProps,
98
+ ...(0, $gF3QK$mergeProps)(listBoxProps, domProps),
99
+ ref: ref,
100
+ persistedKeys: persistedKeys,
101
+ autoFocus: !!props.autoFocus || undefined,
102
+ scrollDirection: "vertical",
103
+ className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Menu', styleProps.className),
104
+ layout: layout,
105
+ layoutOptions: (0, $gF3QK$useMemo)(()=>({
106
+ isLoading: showLoadingSpinner
107
+ }), [
108
+ showLoadingSpinner
109
+ ]),
110
+ collection: state.collection,
111
+ renderWrapper: renderWrapper,
112
+ isLoading: isLoading,
113
+ onLoadMore: props.onLoadMore,
114
+ onScroll: onScroll
115
+ }, (0, $gF3QK$useCallback)((type, item)=>{
116
+ if (type === 'item') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $86983ea1fa3f7312$export$feb3b6b552c14a12), {
117
+ item: item
118
+ });
119
+ else if (type === 'loader') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$LoadingState, null);
120
+ else if (type === 'placeholder') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$EmptyState, null);
121
+ }, []))));
122
+ }
123
+ // forwardRef doesn't support generic parameters, so cast the result to the correct type
124
+ // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
125
+ const $3247d4a89e6094e9$export$1afdcf349979fb7e = /*#__PURE__*/ (0, $gF3QK$react).forwardRef($3247d4a89e6094e9$var$ListBoxBase);
126
+ function $3247d4a89e6094e9$var$LoadingState() {
127
+ let { state: state } = (0, $gF3QK$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
128
+ let stringFormatter = (0, $gF3QK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gF3QK$intlStringsmodulejs))), '@react-spectrum/listbox');
129
+ return(// aria-selected isn't needed here since this option is not selectable.
130
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
131
+ /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
132
+ role: "option",
133
+ style: {
134
+ display: 'flex',
135
+ alignItems: 'center',
136
+ justifyContent: 'center',
137
+ height: '100%'
138
+ }
139
+ }, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$ProgressCircle), {
140
+ isIndeterminate: true,
141
+ size: "S",
142
+ "aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
143
+ UNSAFE_className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Dropdown-progressCircle')
144
+ })));
145
+ }
146
+ function $3247d4a89e6094e9$var$EmptyState() {
147
+ let { renderEmptyState: renderEmptyState } = (0, $gF3QK$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
148
+ let emptyState = renderEmptyState ? renderEmptyState() : null;
149
+ if (emptyState == null) return null;
150
+ return /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
151
+ // aria-selected isn't needed here since this option is not selectable.
152
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
153
+ role: "option"
154
+ }, emptyState);
155
+ }
156
+
157
+
158
+ export {$3247d4a89e6094e9$export$25768ea656ae32a7 as useListBoxLayout, $3247d4a89e6094e9$export$1afdcf349979fb7e as ListBoxBase};
159
+ //# sourceMappingURL=ListBoxBase.module.js.map