@react-spectrum/listbox 3.12.10-nightly.4649 → 3.12.10-nightly.4656
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ListBox.main.js +1 -1
- package/dist/ListBox.main.js.map +1 -1
- package/dist/ListBox.mjs +1 -1
- package/dist/ListBox.module.js +1 -1
- package/dist/ListBox.module.js.map +1 -1
- package/dist/ListBoxBase.main.js +51 -51
- package/dist/ListBoxBase.main.js.map +1 -1
- package/dist/ListBoxBase.mjs +53 -53
- package/dist/ListBoxBase.module.js +53 -53
- package/dist/ListBoxBase.module.js.map +1 -1
- package/dist/ListBoxContext.main.js.map +1 -1
- package/dist/ListBoxContext.module.js.map +1 -1
- package/dist/ListBoxOption.main.js +3 -6
- package/dist/ListBoxOption.main.js.map +1 -1
- package/dist/ListBoxOption.mjs +3 -6
- package/dist/ListBoxOption.module.js +3 -6
- package/dist/ListBoxOption.module.js.map +1 -1
- package/dist/ListBoxSection.main.js +1 -1
- package/dist/ListBoxSection.main.js.map +1 -1
- package/dist/ListBoxSection.mjs +1 -1
- package/dist/ListBoxSection.module.js +1 -1
- package/dist/ListBoxSection.module.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/ListBox.tsx +1 -1
- package/src/ListBoxBase.tsx +51 -54
- package/src/ListBoxContext.ts +9 -2
- package/src/ListBoxOption.tsx +4 -15
- package/src/ListBoxSection.tsx +1 -1
package/dist/ListBox.main.js
CHANGED
|
@@ -29,7 +29,7 @@ $parcel$export(module.exports, "ListBox", () => $582d86e45be55635$export$41f1335
|
|
|
29
29
|
|
|
30
30
|
function $582d86e45be55635$var$ListBox(props, ref) {
|
|
31
31
|
let state = (0, $kvNjb$reactstatelylist.useListState)(props);
|
|
32
|
-
let layout = (0, $60eb4b34c53310cb$exports.useListBoxLayout)(state
|
|
32
|
+
let layout = (0, $60eb4b34c53310cb$exports.useListBoxLayout)(state);
|
|
33
33
|
let domRef = (0, $kvNjb$reactspectrumutils.useDOMRef)(ref);
|
|
34
34
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($kvNjb$react))).createElement((0, $60eb4b34c53310cb$exports.ListBoxBase), {
|
|
35
35
|
...props,
|
package/dist/ListBox.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,oCAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,0CAAe,EAAE
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,oCAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,0CAAe,EAAE;IAC9B,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(state);\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"}
|
package/dist/ListBox.mjs
CHANGED
|
@@ -19,7 +19,7 @@ import {useListState as $7rJGh$useListState} from "@react-stately/list";
|
|
|
19
19
|
|
|
20
20
|
function $3136257018b1a220$var$ListBox(props, ref) {
|
|
21
21
|
let state = (0, $7rJGh$useListState)(props);
|
|
22
|
-
let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)(state
|
|
22
|
+
let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)(state);
|
|
23
23
|
let domRef = (0, $7rJGh$useDOMRef)(ref);
|
|
24
24
|
return /*#__PURE__*/ (0, $7rJGh$react).createElement((0, $3247d4a89e6094e9$export$1afdcf349979fb7e), {
|
|
25
25
|
...props,
|
package/dist/ListBox.module.js
CHANGED
|
@@ -19,7 +19,7 @@ import {useListState as $7rJGh$useListState} from "@react-stately/list";
|
|
|
19
19
|
|
|
20
20
|
function $3136257018b1a220$var$ListBox(props, ref) {
|
|
21
21
|
let state = (0, $7rJGh$useListState)(props);
|
|
22
|
-
let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)(state
|
|
22
|
+
let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)(state);
|
|
23
23
|
let domRef = (0, $7rJGh$useDOMRef)(ref);
|
|
24
24
|
return /*#__PURE__*/ (0, $7rJGh$react).createElement((0, $3247d4a89e6094e9$export$1afdcf349979fb7e), {
|
|
25
25
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,yCAAe,EAAE
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,yCAAe,EAAE;IAC9B,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(state);\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"}
|
package/dist/ListBoxBase.main.js
CHANGED
|
@@ -51,7 +51,7 @@ $parcel$export(module.exports, "ListBoxBase", () => $60eb4b34c53310cb$export$1af
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
-
function $60eb4b34c53310cb$export$25768ea656ae32a7(state
|
|
54
|
+
function $60eb4b34c53310cb$export$25768ea656ae32a7(state) {
|
|
55
55
|
let { scale: scale } = (0, $7w19U$reactspectrumprovider.useProvider)();
|
|
56
56
|
let collator = (0, $7w19U$reactariai18n.useCollator)({
|
|
57
57
|
usage: 'search',
|
|
@@ -70,29 +70,17 @@ function $60eb4b34c53310cb$export$25768ea656ae32a7(state, isLoading) {
|
|
|
70
70
|
]);
|
|
71
71
|
layout.collection = state.collection;
|
|
72
72
|
layout.disabledKeys = state.disabledKeys;
|
|
73
|
-
(0, $7w19U$reactariautils.useLayoutEffect)(()=>{
|
|
74
|
-
// Sync loading state into the layout.
|
|
75
|
-
if (layout.isLoading !== isLoading) {
|
|
76
|
-
var _layout_virtualizer;
|
|
77
|
-
layout.isLoading = isLoading;
|
|
78
|
-
(_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.relayoutNow();
|
|
79
|
-
}
|
|
80
|
-
}, [
|
|
81
|
-
layout,
|
|
82
|
-
isLoading
|
|
83
|
-
]);
|
|
84
73
|
return layout;
|
|
85
74
|
}
|
|
86
75
|
/** @private */ function $60eb4b34c53310cb$var$ListBoxBase(props, ref) {
|
|
87
|
-
let { layout: layout, state: state,
|
|
76
|
+
let { layout: layout, state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, isLoading: isLoading, showLoadingSpinner: showLoadingSpinner = isLoading, onScroll: onScroll, renderEmptyState: renderEmptyState } = props;
|
|
88
77
|
let { listBoxProps: listBoxProps } = (0, $7w19U$reactarialistbox.useListBox)({
|
|
89
78
|
...props,
|
|
90
79
|
keyboardDelegate: layout,
|
|
91
80
|
isVirtualized: true
|
|
92
81
|
}, state, ref);
|
|
93
82
|
let { styleProps: styleProps } = (0, $7w19U$reactspectrumutils.useStyleProps)(props);
|
|
94
|
-
let
|
|
95
|
-
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
83
|
+
let renderWrapper = (0, $7w19U$react.useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
96
84
|
var _children_find;
|
|
97
85
|
if (reusableView.viewType === 'section') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $0f5fd8483f48ef09$exports.ListBoxSection), {
|
|
98
86
|
key: reusableView.key,
|
|
@@ -107,9 +95,14 @@ function $60eb4b34c53310cb$export$25768ea656ae32a7(state, isLoading) {
|
|
|
107
95
|
virtualizer: reusableView.virtualizer,
|
|
108
96
|
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
109
97
|
}, reusableView.rendered);
|
|
110
|
-
};
|
|
98
|
+
}, []);
|
|
111
99
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $611e93c7b7c0413c$exports.ListBoxContext).Provider, {
|
|
112
|
-
value:
|
|
100
|
+
value: {
|
|
101
|
+
state: state,
|
|
102
|
+
renderEmptyState: renderEmptyState,
|
|
103
|
+
shouldFocusOnHover: shouldFocusOnHover,
|
|
104
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
105
|
+
}
|
|
113
106
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariafocus.FocusScope), null, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariavirtualizer.Virtualizer), {
|
|
114
107
|
...styleProps,
|
|
115
108
|
...(0, $7w19U$reactariautils.mergeProps)(listBoxProps, domProps),
|
|
@@ -120,50 +113,57 @@ function $60eb4b34c53310cb$export$25768ea656ae32a7(state, isLoading) {
|
|
|
120
113
|
scrollDirection: "vertical",
|
|
121
114
|
className: (0, $7w19U$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Menu', styleProps.className),
|
|
122
115
|
layout: layout,
|
|
116
|
+
layoutOptions: (0, $7w19U$react.useMemo)(()=>({
|
|
117
|
+
isLoading: showLoadingSpinner
|
|
118
|
+
}), [
|
|
119
|
+
showLoadingSpinner
|
|
120
|
+
]),
|
|
123
121
|
collection: state.collection,
|
|
124
122
|
renderWrapper: renderWrapper,
|
|
125
|
-
|
|
126
|
-
isLoading: props.isLoading,
|
|
123
|
+
isLoading: isLoading,
|
|
127
124
|
onLoadMore: props.onLoadMore,
|
|
128
|
-
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
129
125
|
onScroll: onScroll
|
|
130
|
-
}, (type, item)=>{
|
|
126
|
+
}, (0, $7w19U$react.useCallback)((type, item)=>{
|
|
131
127
|
if (type === 'item') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $2205d250ee1cb1ac$exports.ListBoxOption), {
|
|
132
|
-
item: item
|
|
133
|
-
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
134
|
-
shouldFocusOnHover: focusOnPointerEnter,
|
|
135
|
-
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
128
|
+
item: item
|
|
136
129
|
});
|
|
137
|
-
else if (type === 'loader') return
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
role: "option",
|
|
141
|
-
style: {
|
|
142
|
-
display: 'flex',
|
|
143
|
-
alignItems: 'center',
|
|
144
|
-
justifyContent: 'center',
|
|
145
|
-
height: '100%'
|
|
146
|
-
}
|
|
147
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactspectrumprogress.ProgressCircle), {
|
|
148
|
-
isIndeterminate: true,
|
|
149
|
-
size: "S",
|
|
150
|
-
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
|
|
151
|
-
UNSAFE_className: (0, $7w19U$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Dropdown-progressCircle')
|
|
152
|
-
})));
|
|
153
|
-
else if (type === 'placeholder') {
|
|
154
|
-
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
155
|
-
if (emptyState == null) return null;
|
|
156
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement("div", {
|
|
157
|
-
// aria-selected isn't needed here since this option is not selectable.
|
|
158
|
-
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
159
|
-
role: "option"
|
|
160
|
-
}, emptyState);
|
|
161
|
-
}
|
|
162
|
-
})));
|
|
130
|
+
else if (type === 'loader') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement($60eb4b34c53310cb$var$LoadingState, null);
|
|
131
|
+
else if (type === 'placeholder') return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement($60eb4b34c53310cb$var$EmptyState, null);
|
|
132
|
+
}, []))));
|
|
163
133
|
}
|
|
164
134
|
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
165
135
|
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
166
136
|
const $60eb4b34c53310cb$export$1afdcf349979fb7e = /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).forwardRef($60eb4b34c53310cb$var$ListBoxBase);
|
|
137
|
+
function $60eb4b34c53310cb$var$LoadingState() {
|
|
138
|
+
let { state: state } = (0, $7w19U$react.useContext)((0, $611e93c7b7c0413c$exports.ListBoxContext));
|
|
139
|
+
let stringFormatter = (0, $7w19U$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($3d9fe9b46e2d649a$exports))), '@react-spectrum/listbox');
|
|
140
|
+
return(// aria-selected isn't needed here since this option is not selectable.
|
|
141
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
142
|
+
/*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement("div", {
|
|
143
|
+
role: "option",
|
|
144
|
+
style: {
|
|
145
|
+
display: 'flex',
|
|
146
|
+
alignItems: 'center',
|
|
147
|
+
justifyContent: 'center',
|
|
148
|
+
height: '100%'
|
|
149
|
+
}
|
|
150
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactspectrumprogress.ProgressCircle), {
|
|
151
|
+
isIndeterminate: true,
|
|
152
|
+
size: "S",
|
|
153
|
+
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
|
|
154
|
+
UNSAFE_className: (0, $7w19U$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), 'spectrum-Dropdown-progressCircle')
|
|
155
|
+
})));
|
|
156
|
+
}
|
|
157
|
+
function $60eb4b34c53310cb$var$EmptyState() {
|
|
158
|
+
let { renderEmptyState: renderEmptyState } = (0, $7w19U$react.useContext)((0, $611e93c7b7c0413c$exports.ListBoxContext));
|
|
159
|
+
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
160
|
+
if (emptyState == null) return null;
|
|
161
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement("div", {
|
|
162
|
+
// aria-selected isn't needed here since this option is not selectable.
|
|
163
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
164
|
+
role: "option"
|
|
165
|
+
}, emptyState);
|
|
166
|
+
}
|
|
167
167
|
|
|
168
168
|
|
|
169
169
|
//# sourceMappingURL=ListBoxBase.main.js.map
|
|
@@ -1 +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, 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 {ListBoxOption} from './ListBoxOption';\nimport {ListBoxSection} from './ListBoxSection';\nimport {ListLayout} from '@react-stately/layout';\nimport {ListState} from '@react-stately/list';\nimport {mergeProps, useLayoutEffect} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {HTMLAttributes, ReactElement, ReactNode, RefObject, useMemo} from 'react';\nimport {ReusableView} from '@react-stately/virtualizer';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useCollator, 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: ListLayout<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 transitionDuration?: number,\n isLoading?: boolean,\n onLoadMore?: () => void,\n renderEmptyState?: () => ReactNode,\n onScroll?: () => void\n}\n\n/** @private */\nexport function useListBoxLayout<T>(state: ListState<T>, isLoading: boolean): ListLayout<T> {\n let {scale} = useProvider();\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let layout = useMemo(() =>\n new ListLayout<T>({\n estimatedRowHeight: scale === 'large' ? 48 : 32,\n estimatedHeadingHeight: scale === 'large' ? 33 : 26,\n padding: scale === 'large' ? 5 : 4, // TODO: get from DNA\n loaderHeight: 40,\n placeholderHeight: scale === 'large' ? 48 : 32,\n collator\n })\n , [collator, scale]);\n\n layout.collection = state.collection;\n layout.disabledKeys = state.disabledKeys;\n\n useLayoutEffect(() => {\n // Sync loading state into the layout.\n if (layout.isLoading !== isLoading) {\n layout.isLoading = isLoading;\n layout.virtualizer?.relayoutNow();\n }\n }, [layout, isLoading]);\n return layout;\n}\n\n/** @private */\nfunction ListBoxBase<T>(props: ListBoxBaseProps<T>, ref: RefObject<HTMLDivElement>) {\n let {layout, state, shouldSelectOnPressUp, focusOnPointerEnter, shouldUseVirtualFocus, domProps = {}, transitionDuration = 0, onScroll} = props;\n let {listBoxProps} = useListBox({\n ...props,\n keyboardDelegate: layout,\n isVirtualized: true\n }, state, ref);\n let {styleProps} = useStyleProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/listbox');\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 = (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 return (\n <ListBoxContext.Provider value={state}>\n <FocusScope>\n <Virtualizer\n {...styleProps}\n {...mergeProps(listBoxProps, domProps)}\n ref={ref}\n focusedKey={state.selectionManager.focusedKey}\n autoFocus={!!props.autoFocus}\n sizeToFit=\"height\"\n scrollDirection=\"vertical\"\n className={\n classNames(\n styles,\n 'spectrum-Menu',\n styleProps.className\n )\n }\n layout={layout}\n collection={state.collection}\n renderWrapper={renderWrapper}\n transitionDuration={transitionDuration}\n isLoading={props.isLoading}\n onLoadMore={props.onLoadMore}\n shouldUseVirtualFocus={shouldUseVirtualFocus}\n onScroll={onScroll}>\n {(type, item: Node<T>) => {\n if (type === 'item') {\n return (\n <ListBoxOption\n item={item}\n shouldSelectOnPressUp={shouldSelectOnPressUp}\n shouldFocusOnHover={focusOnPointerEnter}\n shouldUseVirtualFocus={shouldUseVirtualFocus} />\n );\n } else if (type === 'loader') {\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 } else if (type === 'placeholder') {\n let emptyState = props.renderEmptyState ? props.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 }}\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>}) => ReactElement;\nexport {_ListBoxBase as ListBoxBase};\n"],"names":[],"version":3,"file":"ListBoxBase.main.js.map"}
|
|
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, 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 {ListBoxOption} from './ListBoxOption';\nimport {ListBoxSection} from './ListBoxSection';\nimport {ListLayout} from '@react-stately/layout';\nimport {ListState} from '@react-stately/list';\nimport {mergeProps} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {HTMLAttributes, ReactElement, ReactNode, RefObject, useCallback, useContext, useMemo} from 'react';\nimport {ReusableView} from '@react-stately/virtualizer';\nimport styles from '@adobe/spectrum-css-temp/components/menu/vars.css';\nimport {useCollator, 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: ListLayout<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>(state: ListState<T>): ListLayout<T> {\n let {scale} = useProvider();\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let layout = useMemo(() =>\n new ListLayout<T>({\n estimatedRowHeight: scale === 'large' ? 48 : 32,\n estimatedHeadingHeight: scale === 'large' ? 33 : 26,\n padding: scale === 'large' ? 5 : 4, // TODO: get from DNA\n loaderHeight: 40,\n placeholderHeight: scale === 'large' ? 48 : 32,\n collator\n })\n , [collator, scale]);\n\n layout.collection = state.collection;\n layout.disabledKeys = state.disabledKeys;\n return layout;\n}\n\n/** @private */\nfunction ListBoxBase<T>(props: ListBoxBaseProps<T>, ref: RefObject<HTMLDivElement>) {\n let {layout, state, shouldFocusOnHover, shouldUseVirtualFocus, domProps = {}, isLoading, showLoadingSpinner = isLoading, onScroll, renderEmptyState} = props;\n let {listBoxProps} = useListBox({\n ...props,\n keyboardDelegate: 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 return (\n <ListBoxContext.Provider value={{state, renderEmptyState, shouldFocusOnHover, shouldUseVirtualFocus}}>\n <FocusScope>\n <Virtualizer\n {...styleProps}\n {...mergeProps(listBoxProps, domProps)}\n ref={ref}\n focusedKey={state.selectionManager.focusedKey}\n autoFocus={!!props.autoFocus}\n sizeToFit=\"height\"\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>}) => 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"}
|
package/dist/ListBoxBase.mjs
CHANGED
|
@@ -8,9 +8,9 @@ import {useListBox as $gF3QK$useListBox} from "@react-aria/listbox";
|
|
|
8
8
|
import {useStyleProps as $gF3QK$useStyleProps, classNames as $gF3QK$classNames} from "@react-spectrum/utils";
|
|
9
9
|
import {FocusScope as $gF3QK$FocusScope} from "@react-aria/focus";
|
|
10
10
|
import {ListLayout as $gF3QK$ListLayout} from "@react-stately/layout";
|
|
11
|
-
import {
|
|
11
|
+
import {mergeProps as $gF3QK$mergeProps} from "@react-aria/utils";
|
|
12
12
|
import {ProgressCircle as $gF3QK$ProgressCircle} from "@react-spectrum/progress";
|
|
13
|
-
import $gF3QK$react, {useMemo as $gF3QK$useMemo} from "react";
|
|
13
|
+
import $gF3QK$react, {useMemo as $gF3QK$useMemo, useCallback as $gF3QK$useCallback, useContext as $gF3QK$useContext} from "react";
|
|
14
14
|
import {useCollator as $gF3QK$useCollator, useLocalizedStringFormatter as $gF3QK$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
15
15
|
import {useProvider as $gF3QK$useProvider} from "@react-spectrum/provider";
|
|
16
16
|
import {VirtualizerItem as $gF3QK$VirtualizerItem, Virtualizer as $gF3QK$Virtualizer} from "@react-aria/virtualizer";
|
|
@@ -44,7 +44,7 @@ function $parcel$interopDefault(a) {
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
function $3247d4a89e6094e9$export$25768ea656ae32a7(state
|
|
47
|
+
function $3247d4a89e6094e9$export$25768ea656ae32a7(state) {
|
|
48
48
|
let { scale: scale } = (0, $gF3QK$useProvider)();
|
|
49
49
|
let collator = (0, $gF3QK$useCollator)({
|
|
50
50
|
usage: 'search',
|
|
@@ -63,29 +63,17 @@ function $3247d4a89e6094e9$export$25768ea656ae32a7(state, isLoading) {
|
|
|
63
63
|
]);
|
|
64
64
|
layout.collection = state.collection;
|
|
65
65
|
layout.disabledKeys = state.disabledKeys;
|
|
66
|
-
(0, $gF3QK$useLayoutEffect)(()=>{
|
|
67
|
-
// Sync loading state into the layout.
|
|
68
|
-
if (layout.isLoading !== isLoading) {
|
|
69
|
-
var _layout_virtualizer;
|
|
70
|
-
layout.isLoading = isLoading;
|
|
71
|
-
(_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.relayoutNow();
|
|
72
|
-
}
|
|
73
|
-
}, [
|
|
74
|
-
layout,
|
|
75
|
-
isLoading
|
|
76
|
-
]);
|
|
77
66
|
return layout;
|
|
78
67
|
}
|
|
79
68
|
/** @private */ function $3247d4a89e6094e9$var$ListBoxBase(props, ref) {
|
|
80
|
-
let { layout: layout, state: state,
|
|
69
|
+
let { layout: layout, state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, isLoading: isLoading, showLoadingSpinner: showLoadingSpinner = isLoading, onScroll: onScroll, renderEmptyState: renderEmptyState } = props;
|
|
81
70
|
let { listBoxProps: listBoxProps } = (0, $gF3QK$useListBox)({
|
|
82
71
|
...props,
|
|
83
72
|
keyboardDelegate: layout,
|
|
84
73
|
isVirtualized: true
|
|
85
74
|
}, state, ref);
|
|
86
75
|
let { styleProps: styleProps } = (0, $gF3QK$useStyleProps)(props);
|
|
87
|
-
let
|
|
88
|
-
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
76
|
+
let renderWrapper = (0, $gF3QK$useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
89
77
|
var _children_find;
|
|
90
78
|
if (reusableView.viewType === 'section') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $92d678ed88836094$export$dca12b0bb56e4fc), {
|
|
91
79
|
key: reusableView.key,
|
|
@@ -100,9 +88,14 @@ function $3247d4a89e6094e9$export$25768ea656ae32a7(state, isLoading) {
|
|
|
100
88
|
virtualizer: reusableView.virtualizer,
|
|
101
89
|
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
102
90
|
}, reusableView.rendered);
|
|
103
|
-
};
|
|
91
|
+
}, []);
|
|
104
92
|
return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $0c6f792811e33483$export$7ff8f37d2d81a48d).Provider, {
|
|
105
|
-
value:
|
|
93
|
+
value: {
|
|
94
|
+
state: state,
|
|
95
|
+
renderEmptyState: renderEmptyState,
|
|
96
|
+
shouldFocusOnHover: shouldFocusOnHover,
|
|
97
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
98
|
+
}
|
|
106
99
|
}, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$FocusScope), null, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$Virtualizer), {
|
|
107
100
|
...styleProps,
|
|
108
101
|
...(0, $gF3QK$mergeProps)(listBoxProps, domProps),
|
|
@@ -113,50 +106,57 @@ function $3247d4a89e6094e9$export$25768ea656ae32a7(state, isLoading) {
|
|
|
113
106
|
scrollDirection: "vertical",
|
|
114
107
|
className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Menu', styleProps.className),
|
|
115
108
|
layout: layout,
|
|
109
|
+
layoutOptions: (0, $gF3QK$useMemo)(()=>({
|
|
110
|
+
isLoading: showLoadingSpinner
|
|
111
|
+
}), [
|
|
112
|
+
showLoadingSpinner
|
|
113
|
+
]),
|
|
116
114
|
collection: state.collection,
|
|
117
115
|
renderWrapper: renderWrapper,
|
|
118
|
-
|
|
119
|
-
isLoading: props.isLoading,
|
|
116
|
+
isLoading: isLoading,
|
|
120
117
|
onLoadMore: props.onLoadMore,
|
|
121
|
-
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
122
118
|
onScroll: onScroll
|
|
123
|
-
}, (type, item)=>{
|
|
119
|
+
}, (0, $gF3QK$useCallback)((type, item)=>{
|
|
124
120
|
if (type === 'item') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $86983ea1fa3f7312$export$feb3b6b552c14a12), {
|
|
125
|
-
item: item
|
|
126
|
-
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
127
|
-
shouldFocusOnHover: focusOnPointerEnter,
|
|
128
|
-
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
121
|
+
item: item
|
|
129
122
|
});
|
|
130
|
-
else if (type === 'loader') return
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
role: "option",
|
|
134
|
-
style: {
|
|
135
|
-
display: 'flex',
|
|
136
|
-
alignItems: 'center',
|
|
137
|
-
justifyContent: 'center',
|
|
138
|
-
height: '100%'
|
|
139
|
-
}
|
|
140
|
-
}, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$ProgressCircle), {
|
|
141
|
-
isIndeterminate: true,
|
|
142
|
-
size: "S",
|
|
143
|
-
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
|
|
144
|
-
UNSAFE_className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Dropdown-progressCircle')
|
|
145
|
-
})));
|
|
146
|
-
else if (type === 'placeholder') {
|
|
147
|
-
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
148
|
-
if (emptyState == null) return null;
|
|
149
|
-
return /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
|
|
150
|
-
// aria-selected isn't needed here since this option is not selectable.
|
|
151
|
-
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
152
|
-
role: "option"
|
|
153
|
-
}, emptyState);
|
|
154
|
-
}
|
|
155
|
-
})));
|
|
123
|
+
else if (type === 'loader') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$LoadingState, null);
|
|
124
|
+
else if (type === 'placeholder') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$EmptyState, null);
|
|
125
|
+
}, []))));
|
|
156
126
|
}
|
|
157
127
|
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
158
128
|
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
159
129
|
const $3247d4a89e6094e9$export$1afdcf349979fb7e = /*#__PURE__*/ (0, $gF3QK$react).forwardRef($3247d4a89e6094e9$var$ListBoxBase);
|
|
130
|
+
function $3247d4a89e6094e9$var$LoadingState() {
|
|
131
|
+
let { state: state } = (0, $gF3QK$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
132
|
+
let stringFormatter = (0, $gF3QK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gF3QK$intlStringsmodulejs))), '@react-spectrum/listbox');
|
|
133
|
+
return(// aria-selected isn't needed here since this option is not selectable.
|
|
134
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
135
|
+
/*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
|
|
136
|
+
role: "option",
|
|
137
|
+
style: {
|
|
138
|
+
display: 'flex',
|
|
139
|
+
alignItems: 'center',
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
height: '100%'
|
|
142
|
+
}
|
|
143
|
+
}, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$ProgressCircle), {
|
|
144
|
+
isIndeterminate: true,
|
|
145
|
+
size: "S",
|
|
146
|
+
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
|
|
147
|
+
UNSAFE_className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Dropdown-progressCircle')
|
|
148
|
+
})));
|
|
149
|
+
}
|
|
150
|
+
function $3247d4a89e6094e9$var$EmptyState() {
|
|
151
|
+
let { renderEmptyState: renderEmptyState } = (0, $gF3QK$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
152
|
+
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
153
|
+
if (emptyState == null) return null;
|
|
154
|
+
return /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
|
|
155
|
+
// aria-selected isn't needed here since this option is not selectable.
|
|
156
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
157
|
+
role: "option"
|
|
158
|
+
}, emptyState);
|
|
159
|
+
}
|
|
160
160
|
|
|
161
161
|
|
|
162
162
|
export {$3247d4a89e6094e9$export$25768ea656ae32a7 as useListBoxLayout, $3247d4a89e6094e9$export$1afdcf349979fb7e as ListBoxBase};
|
|
@@ -8,9 +8,9 @@ import {useListBox as $gF3QK$useListBox} from "@react-aria/listbox";
|
|
|
8
8
|
import {useStyleProps as $gF3QK$useStyleProps, classNames as $gF3QK$classNames} from "@react-spectrum/utils";
|
|
9
9
|
import {FocusScope as $gF3QK$FocusScope} from "@react-aria/focus";
|
|
10
10
|
import {ListLayout as $gF3QK$ListLayout} from "@react-stately/layout";
|
|
11
|
-
import {
|
|
11
|
+
import {mergeProps as $gF3QK$mergeProps} from "@react-aria/utils";
|
|
12
12
|
import {ProgressCircle as $gF3QK$ProgressCircle} from "@react-spectrum/progress";
|
|
13
|
-
import $gF3QK$react, {useMemo as $gF3QK$useMemo} from "react";
|
|
13
|
+
import $gF3QK$react, {useMemo as $gF3QK$useMemo, useCallback as $gF3QK$useCallback, useContext as $gF3QK$useContext} from "react";
|
|
14
14
|
import {useCollator as $gF3QK$useCollator, useLocalizedStringFormatter as $gF3QK$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
15
15
|
import {useProvider as $gF3QK$useProvider} from "@react-spectrum/provider";
|
|
16
16
|
import {VirtualizerItem as $gF3QK$VirtualizerItem, Virtualizer as $gF3QK$Virtualizer} from "@react-aria/virtualizer";
|
|
@@ -44,7 +44,7 @@ function $parcel$interopDefault(a) {
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
function $3247d4a89e6094e9$export$25768ea656ae32a7(state
|
|
47
|
+
function $3247d4a89e6094e9$export$25768ea656ae32a7(state) {
|
|
48
48
|
let { scale: scale } = (0, $gF3QK$useProvider)();
|
|
49
49
|
let collator = (0, $gF3QK$useCollator)({
|
|
50
50
|
usage: 'search',
|
|
@@ -63,29 +63,17 @@ function $3247d4a89e6094e9$export$25768ea656ae32a7(state, isLoading) {
|
|
|
63
63
|
]);
|
|
64
64
|
layout.collection = state.collection;
|
|
65
65
|
layout.disabledKeys = state.disabledKeys;
|
|
66
|
-
(0, $gF3QK$useLayoutEffect)(()=>{
|
|
67
|
-
// Sync loading state into the layout.
|
|
68
|
-
if (layout.isLoading !== isLoading) {
|
|
69
|
-
var _layout_virtualizer;
|
|
70
|
-
layout.isLoading = isLoading;
|
|
71
|
-
(_layout_virtualizer = layout.virtualizer) === null || _layout_virtualizer === void 0 ? void 0 : _layout_virtualizer.relayoutNow();
|
|
72
|
-
}
|
|
73
|
-
}, [
|
|
74
|
-
layout,
|
|
75
|
-
isLoading
|
|
76
|
-
]);
|
|
77
66
|
return layout;
|
|
78
67
|
}
|
|
79
68
|
/** @private */ function $3247d4a89e6094e9$var$ListBoxBase(props, ref) {
|
|
80
|
-
let { layout: layout, state: state,
|
|
69
|
+
let { layout: layout, state: state, shouldFocusOnHover: shouldFocusOnHover, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, isLoading: isLoading, showLoadingSpinner: showLoadingSpinner = isLoading, onScroll: onScroll, renderEmptyState: renderEmptyState } = props;
|
|
81
70
|
let { listBoxProps: listBoxProps } = (0, $gF3QK$useListBox)({
|
|
82
71
|
...props,
|
|
83
72
|
keyboardDelegate: layout,
|
|
84
73
|
isVirtualized: true
|
|
85
74
|
}, state, ref);
|
|
86
75
|
let { styleProps: styleProps } = (0, $gF3QK$useStyleProps)(props);
|
|
87
|
-
let
|
|
88
|
-
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
76
|
+
let renderWrapper = (0, $gF3QK$useCallback)((parent, reusableView, children, renderChildren)=>{
|
|
89
77
|
var _children_find;
|
|
90
78
|
if (reusableView.viewType === 'section') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $92d678ed88836094$export$dca12b0bb56e4fc), {
|
|
91
79
|
key: reusableView.key,
|
|
@@ -100,9 +88,14 @@ function $3247d4a89e6094e9$export$25768ea656ae32a7(state, isLoading) {
|
|
|
100
88
|
virtualizer: reusableView.virtualizer,
|
|
101
89
|
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
102
90
|
}, reusableView.rendered);
|
|
103
|
-
};
|
|
91
|
+
}, []);
|
|
104
92
|
return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $0c6f792811e33483$export$7ff8f37d2d81a48d).Provider, {
|
|
105
|
-
value:
|
|
93
|
+
value: {
|
|
94
|
+
state: state,
|
|
95
|
+
renderEmptyState: renderEmptyState,
|
|
96
|
+
shouldFocusOnHover: shouldFocusOnHover,
|
|
97
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
98
|
+
}
|
|
106
99
|
}, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$FocusScope), null, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$Virtualizer), {
|
|
107
100
|
...styleProps,
|
|
108
101
|
...(0, $gF3QK$mergeProps)(listBoxProps, domProps),
|
|
@@ -113,50 +106,57 @@ function $3247d4a89e6094e9$export$25768ea656ae32a7(state, isLoading) {
|
|
|
113
106
|
scrollDirection: "vertical",
|
|
114
107
|
className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Menu', styleProps.className),
|
|
115
108
|
layout: layout,
|
|
109
|
+
layoutOptions: (0, $gF3QK$useMemo)(()=>({
|
|
110
|
+
isLoading: showLoadingSpinner
|
|
111
|
+
}), [
|
|
112
|
+
showLoadingSpinner
|
|
113
|
+
]),
|
|
116
114
|
collection: state.collection,
|
|
117
115
|
renderWrapper: renderWrapper,
|
|
118
|
-
|
|
119
|
-
isLoading: props.isLoading,
|
|
116
|
+
isLoading: isLoading,
|
|
120
117
|
onLoadMore: props.onLoadMore,
|
|
121
|
-
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
122
118
|
onScroll: onScroll
|
|
123
|
-
}, (type, item)=>{
|
|
119
|
+
}, (0, $gF3QK$useCallback)((type, item)=>{
|
|
124
120
|
if (type === 'item') return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $86983ea1fa3f7312$export$feb3b6b552c14a12), {
|
|
125
|
-
item: item
|
|
126
|
-
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
127
|
-
shouldFocusOnHover: focusOnPointerEnter,
|
|
128
|
-
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
121
|
+
item: item
|
|
129
122
|
});
|
|
130
|
-
else if (type === 'loader') return
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
role: "option",
|
|
134
|
-
style: {
|
|
135
|
-
display: 'flex',
|
|
136
|
-
alignItems: 'center',
|
|
137
|
-
justifyContent: 'center',
|
|
138
|
-
height: '100%'
|
|
139
|
-
}
|
|
140
|
-
}, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$ProgressCircle), {
|
|
141
|
-
isIndeterminate: true,
|
|
142
|
-
size: "S",
|
|
143
|
-
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
|
|
144
|
-
UNSAFE_className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Dropdown-progressCircle')
|
|
145
|
-
})));
|
|
146
|
-
else if (type === 'placeholder') {
|
|
147
|
-
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
148
|
-
if (emptyState == null) return null;
|
|
149
|
-
return /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
|
|
150
|
-
// aria-selected isn't needed here since this option is not selectable.
|
|
151
|
-
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
152
|
-
role: "option"
|
|
153
|
-
}, emptyState);
|
|
154
|
-
}
|
|
155
|
-
})));
|
|
123
|
+
else if (type === 'loader') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$LoadingState, null);
|
|
124
|
+
else if (type === 'placeholder') return /*#__PURE__*/ (0, $gF3QK$react).createElement($3247d4a89e6094e9$var$EmptyState, null);
|
|
125
|
+
}, []))));
|
|
156
126
|
}
|
|
157
127
|
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
158
128
|
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
159
129
|
const $3247d4a89e6094e9$export$1afdcf349979fb7e = /*#__PURE__*/ (0, $gF3QK$react).forwardRef($3247d4a89e6094e9$var$ListBoxBase);
|
|
130
|
+
function $3247d4a89e6094e9$var$LoadingState() {
|
|
131
|
+
let { state: state } = (0, $gF3QK$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
132
|
+
let stringFormatter = (0, $gF3QK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gF3QK$intlStringsmodulejs))), '@react-spectrum/listbox');
|
|
133
|
+
return(// aria-selected isn't needed here since this option is not selectable.
|
|
134
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
135
|
+
/*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
|
|
136
|
+
role: "option",
|
|
137
|
+
style: {
|
|
138
|
+
display: 'flex',
|
|
139
|
+
alignItems: 'center',
|
|
140
|
+
justifyContent: 'center',
|
|
141
|
+
height: '100%'
|
|
142
|
+
}
|
|
143
|
+
}, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$ProgressCircle), {
|
|
144
|
+
isIndeterminate: true,
|
|
145
|
+
size: "S",
|
|
146
|
+
"aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading'),
|
|
147
|
+
UNSAFE_className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), 'spectrum-Dropdown-progressCircle')
|
|
148
|
+
})));
|
|
149
|
+
}
|
|
150
|
+
function $3247d4a89e6094e9$var$EmptyState() {
|
|
151
|
+
let { renderEmptyState: renderEmptyState } = (0, $gF3QK$useContext)((0, $0c6f792811e33483$export$7ff8f37d2d81a48d));
|
|
152
|
+
let emptyState = renderEmptyState ? renderEmptyState() : null;
|
|
153
|
+
if (emptyState == null) return null;
|
|
154
|
+
return /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
|
|
155
|
+
// aria-selected isn't needed here since this option is not selectable.
|
|
156
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
157
|
+
role: "option"
|
|
158
|
+
}, emptyState);
|
|
159
|
+
}
|
|
160
160
|
|
|
161
161
|
|
|
162
162
|
export {$3247d4a89e6094e9$export$25768ea656ae32a7 as useListBoxLayout, $3247d4a89e6094e9$export$1afdcf349979fb7e as ListBoxBase};
|