@react-spectrum/listbox 3.15.10 → 3.16.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 (228) hide show
  1. package/dist/import.mjs +6 -4
  2. package/dist/main.js +10 -8
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +6 -4
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +5 -0
  7. package/package.json +14 -42
  8. package/src/index.ts +6 -4
  9. package/dist/ListBox.main.js +0 -43
  10. package/dist/ListBox.main.js.map +0 -1
  11. package/dist/ListBox.mjs +0 -34
  12. package/dist/ListBox.module.js +0 -34
  13. package/dist/ListBox.module.js.map +0 -1
  14. package/dist/ListBoxBase.main.js +0 -165
  15. package/dist/ListBoxBase.main.js.map +0 -1
  16. package/dist/ListBoxBase.mjs +0 -159
  17. package/dist/ListBoxBase.module.js +0 -159
  18. package/dist/ListBoxBase.module.js.map +0 -1
  19. package/dist/ListBoxContext.main.js +0 -27
  20. package/dist/ListBoxContext.main.js.map +0 -1
  21. package/dist/ListBoxContext.mjs +0 -18
  22. package/dist/ListBoxContext.module.js +0 -18
  23. package/dist/ListBoxContext.module.js.map +0 -1
  24. package/dist/ListBoxLayout.main.js +0 -79
  25. package/dist/ListBoxLayout.main.js.map +0 -1
  26. package/dist/ListBoxLayout.mjs +0 -74
  27. package/dist/ListBoxLayout.module.js +0 -74
  28. package/dist/ListBoxLayout.module.js.map +0 -1
  29. package/dist/ListBoxOption.main.js +0 -105
  30. package/dist/ListBoxOption.main.js.map +0 -1
  31. package/dist/ListBoxOption.mjs +0 -100
  32. package/dist/ListBoxOption.module.js +0 -100
  33. package/dist/ListBoxOption.module.js.map +0 -1
  34. package/dist/ListBoxSection.main.js +0 -69
  35. package/dist/ListBoxSection.main.js.map +0 -1
  36. package/dist/ListBoxSection.mjs +0 -64
  37. package/dist/ListBoxSection.module.js +0 -64
  38. package/dist/ListBoxSection.module.js.map +0 -1
  39. package/dist/ar-AE.main.js +0 -7
  40. package/dist/ar-AE.main.js.map +0 -1
  41. package/dist/ar-AE.mjs +0 -9
  42. package/dist/ar-AE.module.js +0 -9
  43. package/dist/ar-AE.module.js.map +0 -1
  44. package/dist/bg-BG.main.js +0 -7
  45. package/dist/bg-BG.main.js.map +0 -1
  46. package/dist/bg-BG.mjs +0 -9
  47. package/dist/bg-BG.module.js +0 -9
  48. package/dist/bg-BG.module.js.map +0 -1
  49. package/dist/cs-CZ.main.js +0 -7
  50. package/dist/cs-CZ.main.js.map +0 -1
  51. package/dist/cs-CZ.mjs +0 -9
  52. package/dist/cs-CZ.module.js +0 -9
  53. package/dist/cs-CZ.module.js.map +0 -1
  54. package/dist/da-DK.main.js +0 -7
  55. package/dist/da-DK.main.js.map +0 -1
  56. package/dist/da-DK.mjs +0 -9
  57. package/dist/da-DK.module.js +0 -9
  58. package/dist/da-DK.module.js.map +0 -1
  59. package/dist/de-DE.main.js +0 -7
  60. package/dist/de-DE.main.js.map +0 -1
  61. package/dist/de-DE.mjs +0 -9
  62. package/dist/de-DE.module.js +0 -9
  63. package/dist/de-DE.module.js.map +0 -1
  64. package/dist/el-GR.main.js +0 -7
  65. package/dist/el-GR.main.js.map +0 -1
  66. package/dist/el-GR.mjs +0 -9
  67. package/dist/el-GR.module.js +0 -9
  68. package/dist/el-GR.module.js.map +0 -1
  69. package/dist/en-US.main.js +0 -7
  70. package/dist/en-US.main.js.map +0 -1
  71. package/dist/en-US.mjs +0 -9
  72. package/dist/en-US.module.js +0 -9
  73. package/dist/en-US.module.js.map +0 -1
  74. package/dist/es-ES.main.js +0 -7
  75. package/dist/es-ES.main.js.map +0 -1
  76. package/dist/es-ES.mjs +0 -9
  77. package/dist/es-ES.module.js +0 -9
  78. package/dist/es-ES.module.js.map +0 -1
  79. package/dist/et-EE.main.js +0 -7
  80. package/dist/et-EE.main.js.map +0 -1
  81. package/dist/et-EE.mjs +0 -9
  82. package/dist/et-EE.module.js +0 -9
  83. package/dist/et-EE.module.js.map +0 -1
  84. package/dist/fi-FI.main.js +0 -7
  85. package/dist/fi-FI.main.js.map +0 -1
  86. package/dist/fi-FI.mjs +0 -9
  87. package/dist/fi-FI.module.js +0 -9
  88. package/dist/fi-FI.module.js.map +0 -1
  89. package/dist/fr-FR.main.js +0 -7
  90. package/dist/fr-FR.main.js.map +0 -1
  91. package/dist/fr-FR.mjs +0 -9
  92. package/dist/fr-FR.module.js +0 -9
  93. package/dist/fr-FR.module.js.map +0 -1
  94. package/dist/he-IL.main.js +0 -7
  95. package/dist/he-IL.main.js.map +0 -1
  96. package/dist/he-IL.mjs +0 -9
  97. package/dist/he-IL.module.js +0 -9
  98. package/dist/he-IL.module.js.map +0 -1
  99. package/dist/hr-HR.main.js +0 -7
  100. package/dist/hr-HR.main.js.map +0 -1
  101. package/dist/hr-HR.mjs +0 -9
  102. package/dist/hr-HR.module.js +0 -9
  103. package/dist/hr-HR.module.js.map +0 -1
  104. package/dist/hu-HU.main.js +0 -7
  105. package/dist/hu-HU.main.js.map +0 -1
  106. package/dist/hu-HU.mjs +0 -9
  107. package/dist/hu-HU.module.js +0 -9
  108. package/dist/hu-HU.module.js.map +0 -1
  109. package/dist/intlStrings.main.js +0 -108
  110. package/dist/intlStrings.main.js.map +0 -1
  111. package/dist/intlStrings.mjs +0 -110
  112. package/dist/intlStrings.module.js +0 -110
  113. package/dist/intlStrings.module.js.map +0 -1
  114. package/dist/it-IT.main.js +0 -7
  115. package/dist/it-IT.main.js.map +0 -1
  116. package/dist/it-IT.mjs +0 -9
  117. package/dist/it-IT.module.js +0 -9
  118. package/dist/it-IT.module.js.map +0 -1
  119. package/dist/ja-JP.main.js +0 -7
  120. package/dist/ja-JP.main.js.map +0 -1
  121. package/dist/ja-JP.mjs +0 -9
  122. package/dist/ja-JP.module.js +0 -9
  123. package/dist/ja-JP.module.js.map +0 -1
  124. package/dist/ko-KR.main.js +0 -7
  125. package/dist/ko-KR.main.js.map +0 -1
  126. package/dist/ko-KR.mjs +0 -9
  127. package/dist/ko-KR.module.js +0 -9
  128. package/dist/ko-KR.module.js.map +0 -1
  129. package/dist/listbox.a566c7a6.css +0 -570
  130. package/dist/listbox.a566c7a6.css.map +0 -1
  131. package/dist/lt-LT.main.js +0 -7
  132. package/dist/lt-LT.main.js.map +0 -1
  133. package/dist/lt-LT.mjs +0 -9
  134. package/dist/lt-LT.module.js +0 -9
  135. package/dist/lt-LT.module.js.map +0 -1
  136. package/dist/lv-LV.main.js +0 -7
  137. package/dist/lv-LV.main.js.map +0 -1
  138. package/dist/lv-LV.mjs +0 -9
  139. package/dist/lv-LV.module.js +0 -9
  140. package/dist/lv-LV.module.js.map +0 -1
  141. package/dist/menu_vars_css.main.js +0 -177
  142. package/dist/menu_vars_css.main.js.map +0 -1
  143. package/dist/menu_vars_css.mjs +0 -179
  144. package/dist/menu_vars_css.module.js +0 -179
  145. package/dist/menu_vars_css.module.js.map +0 -1
  146. package/dist/nb-NO.main.js +0 -7
  147. package/dist/nb-NO.main.js.map +0 -1
  148. package/dist/nb-NO.mjs +0 -9
  149. package/dist/nb-NO.module.js +0 -9
  150. package/dist/nb-NO.module.js.map +0 -1
  151. package/dist/nl-NL.main.js +0 -7
  152. package/dist/nl-NL.main.js.map +0 -1
  153. package/dist/nl-NL.mjs +0 -9
  154. package/dist/nl-NL.module.js +0 -9
  155. package/dist/nl-NL.module.js.map +0 -1
  156. package/dist/pl-PL.main.js +0 -7
  157. package/dist/pl-PL.main.js.map +0 -1
  158. package/dist/pl-PL.mjs +0 -9
  159. package/dist/pl-PL.module.js +0 -9
  160. package/dist/pl-PL.module.js.map +0 -1
  161. package/dist/pt-BR.main.js +0 -7
  162. package/dist/pt-BR.main.js.map +0 -1
  163. package/dist/pt-BR.mjs +0 -9
  164. package/dist/pt-BR.module.js +0 -9
  165. package/dist/pt-BR.module.js.map +0 -1
  166. package/dist/pt-PT.main.js +0 -7
  167. package/dist/pt-PT.main.js.map +0 -1
  168. package/dist/pt-PT.mjs +0 -9
  169. package/dist/pt-PT.module.js +0 -9
  170. package/dist/pt-PT.module.js.map +0 -1
  171. package/dist/ro-RO.main.js +0 -7
  172. package/dist/ro-RO.main.js.map +0 -1
  173. package/dist/ro-RO.mjs +0 -9
  174. package/dist/ro-RO.module.js +0 -9
  175. package/dist/ro-RO.module.js.map +0 -1
  176. package/dist/ru-RU.main.js +0 -7
  177. package/dist/ru-RU.main.js.map +0 -1
  178. package/dist/ru-RU.mjs +0 -9
  179. package/dist/ru-RU.module.js +0 -9
  180. package/dist/ru-RU.module.js.map +0 -1
  181. package/dist/sk-SK.main.js +0 -7
  182. package/dist/sk-SK.main.js.map +0 -1
  183. package/dist/sk-SK.mjs +0 -9
  184. package/dist/sk-SK.module.js +0 -9
  185. package/dist/sk-SK.module.js.map +0 -1
  186. package/dist/sl-SI.main.js +0 -7
  187. package/dist/sl-SI.main.js.map +0 -1
  188. package/dist/sl-SI.mjs +0 -9
  189. package/dist/sl-SI.module.js +0 -9
  190. package/dist/sl-SI.module.js.map +0 -1
  191. package/dist/sr-SP.main.js +0 -7
  192. package/dist/sr-SP.main.js.map +0 -1
  193. package/dist/sr-SP.mjs +0 -9
  194. package/dist/sr-SP.module.js +0 -9
  195. package/dist/sr-SP.module.js.map +0 -1
  196. package/dist/sv-SE.main.js +0 -7
  197. package/dist/sv-SE.main.js.map +0 -1
  198. package/dist/sv-SE.mjs +0 -9
  199. package/dist/sv-SE.module.js +0 -9
  200. package/dist/sv-SE.module.js.map +0 -1
  201. package/dist/tr-TR.main.js +0 -7
  202. package/dist/tr-TR.main.js.map +0 -1
  203. package/dist/tr-TR.mjs +0 -9
  204. package/dist/tr-TR.module.js +0 -9
  205. package/dist/tr-TR.module.js.map +0 -1
  206. package/dist/types.d.ts +0 -52
  207. package/dist/types.d.ts.map +0 -1
  208. package/dist/uk-UA.main.js +0 -7
  209. package/dist/uk-UA.main.js.map +0 -1
  210. package/dist/uk-UA.mjs +0 -9
  211. package/dist/uk-UA.module.js +0 -9
  212. package/dist/uk-UA.module.js.map +0 -1
  213. package/dist/zh-CN.main.js +0 -7
  214. package/dist/zh-CN.main.js.map +0 -1
  215. package/dist/zh-CN.mjs +0 -9
  216. package/dist/zh-CN.module.js +0 -9
  217. package/dist/zh-CN.module.js.map +0 -1
  218. package/dist/zh-TW.main.js +0 -7
  219. package/dist/zh-TW.main.js.map +0 -1
  220. package/dist/zh-TW.mjs +0 -9
  221. package/dist/zh-TW.module.js +0 -9
  222. package/dist/zh-TW.module.js.map +0 -1
  223. package/src/ListBox.tsx +0 -39
  224. package/src/ListBoxBase.tsx +0 -183
  225. package/src/ListBoxContext.ts +0 -23
  226. package/src/ListBoxLayout.ts +0 -88
  227. package/src/ListBoxOption.tsx +0 -113
  228. package/src/ListBoxSection.tsx +0 -85
@@ -1,159 +0,0 @@
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 "./listbox.a566c7a6.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 {useObjectRef as $gF3QK$useObjectRef, 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
- paddingY: scale === 'large' ? 5 : 4,
53
- placeholderHeight: scale === 'large' ? 48 : 32
54
- }), [
55
- scale
56
- ]);
57
- return layout;
58
- }
59
- const $3247d4a89e6094e9$export$1afdcf349979fb7e = /*#__PURE__*/ (0, $gF3QK$react).forwardRef(function ListBoxBase(props, ref) {
60
- let { layout: layout, state: state, shouldFocusOnHover: shouldFocusOnHover = false, shouldUseVirtualFocus: shouldUseVirtualFocus = false, domProps: domProps = {}, isLoading: isLoading, showLoadingSpinner: showLoadingSpinner = isLoading, onScroll: onScroll, renderEmptyState: renderEmptyState } = props;
61
- let objectRef = (0, $gF3QK$useObjectRef)(ref);
62
- let { listBoxProps: listBoxProps } = (0, $gF3QK$useListBox)({
63
- ...props,
64
- layoutDelegate: layout,
65
- isVirtualized: true
66
- }, state, objectRef);
67
- let { styleProps: styleProps } = (0, $gF3QK$useStyleProps)(props);
68
- let renderWrapper = (0, $gF3QK$useCallback)((parent, reusableView, children, renderChildren)=>{
69
- var _children_find;
70
- var _children_find_layoutInfo;
71
- if (reusableView.viewType === 'section') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $92d678ed88836094$export$dca12b0bb56e4fc), {
72
- key: reusableView.key,
73
- item: reusableView.content,
74
- layoutInfo: reusableView.layoutInfo,
75
- virtualizer: reusableView.virtualizer,
76
- headerLayoutInfo: (_children_find_layoutInfo = (_children_find = children.find((c)=>c.viewType === 'header')) === null || _children_find === void 0 ? void 0 : _children_find.layoutInfo) !== null && _children_find_layoutInfo !== void 0 ? _children_find_layoutInfo : null
77
- }, renderChildren(children.filter((c)=>c.viewType === 'item')));
78
- return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$VirtualizerItem), {
79
- key: reusableView.key,
80
- layoutInfo: reusableView.layoutInfo,
81
- virtualizer: reusableView.virtualizer,
82
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
83
- }, reusableView.rendered);
84
- }, []);
85
- let focusedKey = state.selectionManager.focusedKey;
86
- let persistedKeys = (0, $gF3QK$useMemo)(()=>focusedKey != null ? new Set([
87
- focusedKey
88
- ]) : null, [
89
- focusedKey
90
- ]);
91
- return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $0c6f792811e33483$export$7ff8f37d2d81a48d).Provider, {
92
- value: {
93
- state: state,
94
- renderEmptyState: renderEmptyState,
95
- shouldFocusOnHover: shouldFocusOnHover,
96
- shouldUseVirtualFocus: shouldUseVirtualFocus
97
- }
98
- }, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$FocusScope), null, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$Virtualizer), {
99
- ...styleProps,
100
- ...(0, $gF3QK$mergeProps)(listBoxProps, domProps),
101
- ref: objectRef,
102
- persistedKeys: persistedKeys,
103
- autoFocus: !!props.autoFocus || undefined,
104
- scrollDirection: "vertical",
105
- className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Menu', styleProps.className),
106
- layout: layout,
107
- layoutOptions: (0, $gF3QK$useMemo)(()=>({
108
- isLoading: showLoadingSpinner
109
- }), [
110
- showLoadingSpinner
111
- ]),
112
- collection: state.collection,
113
- renderWrapper: renderWrapper,
114
- isLoading: isLoading,
115
- onLoadMore: props.onLoadMore,
116
- onScroll: onScroll
117
- }, (0, $gF3QK$useCallback)((type, item)=>{
118
- if (type === 'item') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $86983ea1fa3f7312$export$feb3b6b552c14a12), {
119
- item: item
120
- });
121
- else if (type === 'loader') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$LoadingState, null);
122
- else if (type === 'placeholder') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$EmptyState, null);
123
- else return null;
124
- }, []))));
125
- });
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
@@ -1,159 +0,0 @@
1
- import $gF3QK$intlStringsmodulejs from "./intlStrings.module.js";
2
- import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.module.js";
3
- import {ListBoxLayout as $d20755daac213984$export$c7e5f5ea00052bf} from "./ListBoxLayout.module.js";
4
- import {ListBoxOption as $86983ea1fa3f7312$export$feb3b6b552c14a12} from "./ListBoxOption.module.js";
5
- import {ListBoxSection as $92d678ed88836094$export$dca12b0bb56e4fc} from "./ListBoxSection.module.js";
6
- import "./listbox.a566c7a6.css";
7
- import $gF3QK$menu_vars_cssmodulejs from "./menu_vars_css.module.js";
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 {useObjectRef as $gF3QK$useObjectRef, 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
- paddingY: scale === 'large' ? 5 : 4,
53
- placeholderHeight: scale === 'large' ? 48 : 32
54
- }), [
55
- scale
56
- ]);
57
- return layout;
58
- }
59
- const $3247d4a89e6094e9$export$1afdcf349979fb7e = /*#__PURE__*/ (0, $gF3QK$react).forwardRef(function ListBoxBase(props, ref) {
60
- let { layout: layout, state: state, shouldFocusOnHover: shouldFocusOnHover = false, shouldUseVirtualFocus: shouldUseVirtualFocus = false, domProps: domProps = {}, isLoading: isLoading, showLoadingSpinner: showLoadingSpinner = isLoading, onScroll: onScroll, renderEmptyState: renderEmptyState } = props;
61
- let objectRef = (0, $gF3QK$useObjectRef)(ref);
62
- let { listBoxProps: listBoxProps } = (0, $gF3QK$useListBox)({
63
- ...props,
64
- layoutDelegate: layout,
65
- isVirtualized: true
66
- }, state, objectRef);
67
- let { styleProps: styleProps } = (0, $gF3QK$useStyleProps)(props);
68
- let renderWrapper = (0, $gF3QK$useCallback)((parent, reusableView, children, renderChildren)=>{
69
- var _children_find;
70
- var _children_find_layoutInfo;
71
- if (reusableView.viewType === 'section') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $92d678ed88836094$export$dca12b0bb56e4fc), {
72
- key: reusableView.key,
73
- item: reusableView.content,
74
- layoutInfo: reusableView.layoutInfo,
75
- virtualizer: reusableView.virtualizer,
76
- headerLayoutInfo: (_children_find_layoutInfo = (_children_find = children.find((c)=>c.viewType === 'header')) === null || _children_find === void 0 ? void 0 : _children_find.layoutInfo) !== null && _children_find_layoutInfo !== void 0 ? _children_find_layoutInfo : null
77
- }, renderChildren(children.filter((c)=>c.viewType === 'item')));
78
- return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$VirtualizerItem), {
79
- key: reusableView.key,
80
- layoutInfo: reusableView.layoutInfo,
81
- virtualizer: reusableView.virtualizer,
82
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
83
- }, reusableView.rendered);
84
- }, []);
85
- let focusedKey = state.selectionManager.focusedKey;
86
- let persistedKeys = (0, $gF3QK$useMemo)(()=>focusedKey != null ? new Set([
87
- focusedKey
88
- ]) : null, [
89
- focusedKey
90
- ]);
91
- return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $0c6f792811e33483$export$7ff8f37d2d81a48d).Provider, {
92
- value: {
93
- state: state,
94
- renderEmptyState: renderEmptyState,
95
- shouldFocusOnHover: shouldFocusOnHover,
96
- shouldUseVirtualFocus: shouldUseVirtualFocus
97
- }
98
- }, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$FocusScope), null, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$Virtualizer), {
99
- ...styleProps,
100
- ...(0, $gF3QK$mergeProps)(listBoxProps, domProps),
101
- ref: objectRef,
102
- persistedKeys: persistedKeys,
103
- autoFocus: !!props.autoFocus || undefined,
104
- scrollDirection: "vertical",
105
- className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Menu', styleProps.className),
106
- layout: layout,
107
- layoutOptions: (0, $gF3QK$useMemo)(()=>({
108
- isLoading: showLoadingSpinner
109
- }), [
110
- showLoadingSpinner
111
- ]),
112
- collection: state.collection,
113
- renderWrapper: renderWrapper,
114
- isLoading: isLoading,
115
- onLoadMore: props.onLoadMore,
116
- onScroll: onScroll
117
- }, (0, $gF3QK$useCallback)((type, item)=>{
118
- if (type === 'item') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $86983ea1fa3f7312$export$feb3b6b552c14a12), {
119
- item: item
120
- });
121
- else if (type === 'loader') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$LoadingState, null);
122
- else if (type === 'placeholder') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$EmptyState, null);
123
- else return null;
124
- }, []))));
125
- });
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
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAwCM,SAAS;IACd,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,kBAAU;IACxB,IAAI,SAAS,CAAA,GAAA,cAAM,EAAE,IACnB,IAAI,CAAA,GAAA,wCAAY,EAAK;YACnB,oBAAoB,UAAU,UAAU,KAAK;YAC7C,wBAAwB,UAAU,UAAU,KAAK;YACjD,UAAU,UAAU,UAAU,IAAI;YAClC,mBAAmB,UAAU,UAAU,KAAK;QAC9C,IACA;QAAC;KAAM;IAET,OAAO;AACT;AAKO,MAAM,0DAAc,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,YAA8B,KAA0B,EAAE,GAAwC;IACrJ,IAA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AS,EAAE,CAAA,GAAA,sDAAK,GAAG;;AAG7C;AAEA,SAAS;IACP,IAAI,oBAAC,gBAAgB,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAa;IACjD,IAAI,aAAa,mBAAmB,qBAAqB;IACzD,IAAI,cAAc,MAChB,OAAO;IAGT,qBACE,gCAAC;QACC,uEAAuE;QACvE,iEAAiE;QACjE,MAAK;OACJ;AAGP","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, useObjectRef} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {ForwardedRef, 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 paddingY: scale === 'large' ? 5 : 4, // TODO: get from DNA\n placeholderHeight: scale === 'large' ? 48 : 32\n })\n , [scale]);\n\n return layout;\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/** @private */\nexport const ListBoxBase = React.forwardRef(function ListBoxBase<T extends object>(props: ListBoxBaseProps<T>, ref: ForwardedRef<HTMLDivElement | null>) {\n let {layout, state, shouldFocusOnHover = false, shouldUseVirtualFocus = false, domProps = {}, isLoading, showLoadingSpinner = isLoading, onScroll, renderEmptyState} = props;\n let objectRef = useObjectRef(ref);\n let {listBoxProps} = useListBox({\n ...props,\n layoutDelegate: layout,\n isVirtualized: true\n }, state, objectRef);\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>, ReactNode>;\n let renderWrapper = useCallback((parent: View | null, 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 ?? null}>\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={objectRef}\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>): ReactNode => {\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 } else {\n return null;\n }\n }, [])}\n </Virtualizer>\n </FocusScope>\n </ListBoxContext.Provider>\n );\n}) as <T>(props: ListBoxBaseProps<T> & {ref?: RefObject<HTMLDivElement | null>}) => ReactElement;\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.module.js.map"}
@@ -1,27 +0,0 @@
1
- var $497sr$react = require("react");
2
-
3
-
4
- function $parcel$interopDefault(a) {
5
- return a && a.__esModule ? a.default : a;
6
- }
7
-
8
- function $parcel$export(e, n, v, s) {
9
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
10
- }
11
-
12
- $parcel$export(module.exports, "ListBoxContext", () => $611e93c7b7c0413c$export$7ff8f37d2d81a48d);
13
- /*
14
- * Copyright 2020 Adobe. All rights reserved.
15
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
16
- * you may not use this file except in compliance with the License. You may obtain a copy
17
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
18
- *
19
- * Unless required by applicable law or agreed to in writing, software distributed under
20
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21
- * OF ANY KIND, either express or implied. See the License for the specific language
22
- * governing permissions and limitations under the License.
23
- */
24
- const $611e93c7b7c0413c$export$7ff8f37d2d81a48d = (0, ($parcel$interopDefault($497sr$react))).createContext(null);
25
-
26
-
27
- //# sourceMappingURL=ListBoxContext.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;AAYM,MAAM,4CAAiB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAA6B","sources":["packages/@react-spectrum/listbox/src/ListBoxContext.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\nimport {ListState} from '@react-stately/list';\nimport React, {ReactNode} from 'react';\n\ninterface ListBoxContextValue {\n state: ListState<unknown>,\n renderEmptyState?: () => ReactNode,\n shouldFocusOnHover: boolean,\n shouldUseVirtualFocus: boolean\n}\n\nexport const ListBoxContext = React.createContext<ListBoxContextValue | null>(null);\n"],"names":[],"version":3,"file":"ListBoxContext.main.js.map"}
@@ -1,18 +0,0 @@
1
- import $8XLda$react from "react";
2
-
3
- /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- const $0c6f792811e33483$export$7ff8f37d2d81a48d = (0, $8XLda$react).createContext(null);
15
-
16
-
17
- export {$0c6f792811e33483$export$7ff8f37d2d81a48d as ListBoxContext};
18
- //# sourceMappingURL=ListBoxContext.module.js.map
@@ -1,18 +0,0 @@
1
- import $8XLda$react from "react";
2
-
3
- /*
4
- * Copyright 2020 Adobe. All rights reserved.
5
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License. You may obtain a copy
7
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
8
- *
9
- * Unless required by applicable law or agreed to in writing, software distributed under
10
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
11
- * OF ANY KIND, either express or implied. See the License for the specific language
12
- * governing permissions and limitations under the License.
13
- */
14
- const $0c6f792811e33483$export$7ff8f37d2d81a48d = (0, $8XLda$react).createContext(null);
15
-
16
-
17
- export {$0c6f792811e33483$export$7ff8f37d2d81a48d as ListBoxContext};
18
- //# sourceMappingURL=ListBoxContext.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;AAAA;;;;;;;;;;CAUC;AAYM,MAAM,4CAAiB,CAAA,GAAA,YAAI,EAAE,aAAa,CAA6B","sources":["packages/@react-spectrum/listbox/src/ListBoxContext.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\nimport {ListState} from '@react-stately/list';\nimport React, {ReactNode} from 'react';\n\ninterface ListBoxContextValue {\n state: ListState<unknown>,\n renderEmptyState?: () => ReactNode,\n shouldFocusOnHover: boolean,\n shouldUseVirtualFocus: boolean\n}\n\nexport const ListBoxContext = React.createContext<ListBoxContextValue | null>(null);\n"],"names":[],"version":3,"file":"ListBoxContext.module.js.map"}
@@ -1,79 +0,0 @@
1
- var $7VTYQ$reactstatelyvirtualizer = require("@react-stately/virtualizer");
2
- var $7VTYQ$reactstatelylayout = require("@react-stately/layout");
3
-
4
-
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
- }
8
-
9
- $parcel$export(module.exports, "ListBoxLayout", () => $570d5c216669f686$export$c7e5f5ea00052bf);
10
-
11
-
12
- class $570d5c216669f686$export$c7e5f5ea00052bf extends (0, $7VTYQ$reactstatelylayout.ListLayout) {
13
- update(invalidationContext) {
14
- var _invalidationContext_layoutOptions;
15
- this.isLoading = ((_invalidationContext_layoutOptions = invalidationContext.layoutOptions) === null || _invalidationContext_layoutOptions === void 0 ? void 0 : _invalidationContext_layoutOptions.isLoading) || false;
16
- super.update(invalidationContext);
17
- }
18
- buildCollection() {
19
- let nodes = super.buildCollection(this.paddingY);
20
- let y = this.contentSize.height;
21
- if (this.isLoading) {
22
- let rect = new (0, $7VTYQ$reactstatelyvirtualizer.Rect)(0, y, this.virtualizer.visibleRect.width, 40);
23
- let loader = new (0, $7VTYQ$reactstatelyvirtualizer.LayoutInfo)('loader', 'loader', rect);
24
- let node = {
25
- layoutInfo: loader,
26
- validRect: loader.rect
27
- };
28
- nodes.push(node);
29
- this.layoutNodes.set(loader.key, node);
30
- y = loader.rect.maxY;
31
- }
32
- if (nodes.length === 0) {
33
- var _this_placeholderHeight;
34
- let rect = new (0, $7VTYQ$reactstatelyvirtualizer.Rect)(0, y, this.virtualizer.visibleRect.width, (_this_placeholderHeight = this.placeholderHeight) !== null && _this_placeholderHeight !== void 0 ? _this_placeholderHeight : this.virtualizer.visibleRect.height);
35
- let placeholder = new (0, $7VTYQ$reactstatelyvirtualizer.LayoutInfo)('placeholder', 'placeholder', rect);
36
- let node = {
37
- layoutInfo: placeholder,
38
- validRect: placeholder.rect
39
- };
40
- nodes.push(node);
41
- this.layoutNodes.set(placeholder.key, node);
42
- y = placeholder.rect.maxY;
43
- }
44
- this.contentSize.height = y + this.paddingY;
45
- return nodes;
46
- }
47
- buildSection(node, x, y) {
48
- // Synthesize a collection node for the header.
49
- let headerNode = {
50
- type: 'header',
51
- key: node.key + ':header',
52
- parentKey: node.key,
53
- value: null,
54
- level: node.level,
55
- index: node.index,
56
- hasChildNodes: false,
57
- childNodes: [],
58
- rendered: node.rendered,
59
- textValue: node.textValue
60
- };
61
- // Build layout node for it and adjust y offset of section children.
62
- let header = this.buildSectionHeader(headerNode, x, y);
63
- header.node = headerNode;
64
- header.layoutInfo.parentKey = node.key;
65
- this.layoutNodes.set(headerNode.key, header);
66
- y += header.layoutInfo.rect.height;
67
- let section = super.buildSection(node, x, y);
68
- section.children.unshift(header);
69
- return section;
70
- }
71
- constructor(opts){
72
- super(opts), this.isLoading = false;
73
- this.placeholderHeight = opts.placeholderHeight;
74
- this.paddingY = opts.paddingY;
75
- }
76
- }
77
-
78
-
79
- //# sourceMappingURL=ListBoxLayout.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;AAaO,MAAM,iDAAyB,CAAA,GAAA,oCAAS;IAW7C,OAAO,mBAA4D,EAAQ;YACxD;QAAjB,IAAI,CAAC,SAAS,GAAG,EAAA,qCAAA,oBAAoB,aAAa,cAAjC,yDAAA,mCAAmC,SAAS,KAAI;QACjE,KAAK,CAAC,OAAO;IACf;IAEU,kBAAgC;QACxC,IAAI,QAAQ,KAAK,CAAC,gBAAgB,IAAI,CAAC,QAAQ;QAC/C,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM;QAE/B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,IAAI,OAAO,IAAI,CAAA,GAAA,mCAAG,EAAE,GAAG,GAAG,IAAI,CAAC,WAAW,CAAE,WAAW,CAAC,KAAK,EAAE;YAC/D,IAAI,SAAS,IAAI,CAAA,GAAA,yCAAS,EAAE,UAAU,UAAU;YAChD,IAAI,OAAO;gBACT,YAAY;gBACZ,WAAW,OAAO,IAAI;YACxB;YACA,MAAM,IAAI,CAAC;YACX,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,GAAG,EAAE;YACjC,IAAI,OAAO,IAAI,CAAC,IAAI;QACtB;QAEA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EA,YAAY,IAA0B,CAAE;QACtC,KAAK,CAAC,YALA,YAAqB;QAM3B,IAAI,CAAC,iBAAiB,GAAG,KAAK,iBAAiB;QAC/C,IAAI,CAAC,QAAQ,GAAG,KAAK,QAAQ;IAC/B;AAiEF","sources":["packages/@react-spectrum/listbox/src/ListBoxLayout.ts"],"sourcesContent":["import {InvalidationContext, LayoutInfo, Rect} from '@react-stately/virtualizer';\nimport {LayoutNode, ListLayout, ListLayoutOptions} from '@react-stately/layout';\nimport {Node} from '@react-types/shared';\n\ninterface ListBoxLayoutProps extends ListLayoutOptions {\n isLoading?: boolean\n}\n\ninterface ListBoxLayoutOptions extends ListLayoutOptions {\n placeholderHeight: number,\n paddingY: number\n}\n\nexport class ListBoxLayout<T> extends ListLayout<T, ListBoxLayoutProps> {\n private isLoading: boolean = false;\n private placeholderHeight: number;\n private paddingY: number;\n\n constructor(opts: ListBoxLayoutOptions) {\n super(opts);\n this.placeholderHeight = opts.placeholderHeight;\n this.paddingY = opts.paddingY;\n }\n\n update(invalidationContext: InvalidationContext<ListBoxLayoutProps>): void {\n this.isLoading = invalidationContext.layoutOptions?.isLoading || false;\n super.update(invalidationContext);\n }\n\n protected buildCollection(): LayoutNode[] {\n let nodes = super.buildCollection(this.paddingY);\n let y = this.contentSize.height;\n\n if (this.isLoading) {\n let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, 40);\n let loader = new LayoutInfo('loader', 'loader', rect);\n let node = {\n layoutInfo: loader,\n validRect: loader.rect\n };\n nodes.push(node);\n this.layoutNodes.set(loader.key, node);\n y = loader.rect.maxY;\n }\n\n if (nodes.length === 0) {\n let rect = new Rect(0, y, this.virtualizer!.visibleRect.width, this.placeholderHeight ?? this.virtualizer!.visibleRect.height);\n let placeholder = new LayoutInfo('placeholder', 'placeholder', rect);\n let node = {\n layoutInfo: placeholder,\n validRect: placeholder.rect\n };\n nodes.push(node);\n this.layoutNodes.set(placeholder.key, node);\n y = placeholder.rect.maxY;\n }\n\n this.contentSize.height = y + this.paddingY;\n return nodes;\n }\n\n protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n // Synthesize a collection node for the header.\n let headerNode = {\n type: 'header',\n key: node.key + ':header',\n parentKey: node.key,\n value: null,\n level: node.level,\n index: node.index,\n hasChildNodes: false,\n childNodes: [],\n rendered: node.rendered,\n textValue: node.textValue\n };\n\n // Build layout node for it and adjust y offset of section children.\n let header = this.buildSectionHeader(headerNode, x, y);\n header.node = headerNode;\n header.layoutInfo.parentKey = node.key;\n this.layoutNodes.set(headerNode.key, header);\n y += header.layoutInfo.rect.height;\n\n let section = super.buildSection(node, x, y);\n section.children!.unshift(header);\n return section;\n }\n}\n"],"names":[],"version":3,"file":"ListBoxLayout.main.js.map"}
@@ -1,74 +0,0 @@
1
- import {Rect as $3YKfq$Rect, LayoutInfo as $3YKfq$LayoutInfo} from "@react-stately/virtualizer";
2
- import {ListLayout as $3YKfq$ListLayout} from "@react-stately/layout";
3
-
4
-
5
-
6
- class $d20755daac213984$export$c7e5f5ea00052bf extends (0, $3YKfq$ListLayout) {
7
- update(invalidationContext) {
8
- var _invalidationContext_layoutOptions;
9
- this.isLoading = ((_invalidationContext_layoutOptions = invalidationContext.layoutOptions) === null || _invalidationContext_layoutOptions === void 0 ? void 0 : _invalidationContext_layoutOptions.isLoading) || false;
10
- super.update(invalidationContext);
11
- }
12
- buildCollection() {
13
- let nodes = super.buildCollection(this.paddingY);
14
- let y = this.contentSize.height;
15
- if (this.isLoading) {
16
- let rect = new (0, $3YKfq$Rect)(0, y, this.virtualizer.visibleRect.width, 40);
17
- let loader = new (0, $3YKfq$LayoutInfo)('loader', 'loader', rect);
18
- let node = {
19
- layoutInfo: loader,
20
- validRect: loader.rect
21
- };
22
- nodes.push(node);
23
- this.layoutNodes.set(loader.key, node);
24
- y = loader.rect.maxY;
25
- }
26
- if (nodes.length === 0) {
27
- var _this_placeholderHeight;
28
- let rect = new (0, $3YKfq$Rect)(0, y, this.virtualizer.visibleRect.width, (_this_placeholderHeight = this.placeholderHeight) !== null && _this_placeholderHeight !== void 0 ? _this_placeholderHeight : this.virtualizer.visibleRect.height);
29
- let placeholder = new (0, $3YKfq$LayoutInfo)('placeholder', 'placeholder', rect);
30
- let node = {
31
- layoutInfo: placeholder,
32
- validRect: placeholder.rect
33
- };
34
- nodes.push(node);
35
- this.layoutNodes.set(placeholder.key, node);
36
- y = placeholder.rect.maxY;
37
- }
38
- this.contentSize.height = y + this.paddingY;
39
- return nodes;
40
- }
41
- buildSection(node, x, y) {
42
- // Synthesize a collection node for the header.
43
- let headerNode = {
44
- type: 'header',
45
- key: node.key + ':header',
46
- parentKey: node.key,
47
- value: null,
48
- level: node.level,
49
- index: node.index,
50
- hasChildNodes: false,
51
- childNodes: [],
52
- rendered: node.rendered,
53
- textValue: node.textValue
54
- };
55
- // Build layout node for it and adjust y offset of section children.
56
- let header = this.buildSectionHeader(headerNode, x, y);
57
- header.node = headerNode;
58
- header.layoutInfo.parentKey = node.key;
59
- this.layoutNodes.set(headerNode.key, header);
60
- y += header.layoutInfo.rect.height;
61
- let section = super.buildSection(node, x, y);
62
- section.children.unshift(header);
63
- return section;
64
- }
65
- constructor(opts){
66
- super(opts), this.isLoading = false;
67
- this.placeholderHeight = opts.placeholderHeight;
68
- this.paddingY = opts.paddingY;
69
- }
70
- }
71
-
72
-
73
- export {$d20755daac213984$export$c7e5f5ea00052bf as ListBoxLayout};
74
- //# sourceMappingURL=ListBoxLayout.module.js.map