@react-spectrum/listbox 3.12.8-nightly.4552 → 3.12.8-nightly.4558
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 +48 -0
- package/dist/ListBox.main.js.map +1 -0
- package/dist/ListBox.mjs +39 -0
- package/dist/ListBox.module.js +39 -0
- package/dist/ListBox.module.js.map +1 -0
- package/dist/ListBoxBase.main.js +168 -0
- package/dist/ListBoxBase.main.js.map +1 -0
- package/dist/ListBoxBase.mjs +162 -0
- package/dist/ListBoxBase.module.js +162 -0
- package/dist/ListBoxBase.module.js.map +1 -0
- package/dist/ListBoxContext.main.js +27 -0
- package/dist/ListBoxContext.main.js.map +1 -0
- package/dist/ListBoxContext.mjs +18 -0
- package/dist/ListBoxContext.module.js +18 -0
- package/dist/ListBoxContext.module.js.map +1 -0
- package/dist/ListBoxOption.main.js +108 -0
- package/dist/ListBoxOption.main.js.map +1 -0
- package/dist/ListBoxOption.mjs +103 -0
- package/dist/ListBoxOption.module.js +103 -0
- package/dist/ListBoxOption.module.js.map +1 -0
- package/dist/ListBoxSection.main.js +69 -0
- package/dist/ListBoxSection.main.js.map +1 -0
- package/dist/ListBoxSection.mjs +64 -0
- package/dist/ListBoxSection.module.js +64 -0
- package/dist/ListBoxSection.module.js.map +1 -0
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/import.mjs +2 -615
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/main.js +5 -614
- package/dist/main.js.map +1 -1
- package/dist/menu_vars_css.main.js +177 -0
- package/dist/menu_vars_css.main.js.map +1 -0
- package/dist/menu_vars_css.mjs +179 -0
- package/dist/menu_vars_css.module.js +179 -0
- package/dist/menu_vars_css.module.js.map +1 -0
- package/dist/module.js +2 -615
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/{main.css → vars.5bf8960a.css} +1 -1
- package/dist/{main.css.map → vars.5bf8960a.css.map} +1 -1
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +20 -20
- package/dist/module.css +0 -563
- package/dist/module.css.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var $60eb4b34c53310cb$exports = require("./ListBoxBase.main.js");
|
|
2
|
+
var $kvNjb$react = require("react");
|
|
3
|
+
var $kvNjb$reactspectrumutils = require("@react-spectrum/utils");
|
|
4
|
+
var $kvNjb$reactstatelylist = require("@react-stately/list");
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function $parcel$export(e, n, v, s) {
|
|
12
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
$parcel$export(module.exports, "ListBox", () => $582d86e45be55635$export$41f133550aa26f48);
|
|
16
|
+
/*
|
|
17
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
*
|
|
22
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
* governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function $582d86e45be55635$var$ListBox(props, ref) {
|
|
31
|
+
let state = (0, $kvNjb$reactstatelylist.useListState)(props);
|
|
32
|
+
let layout = (0, $60eb4b34c53310cb$exports.useListBoxLayout)(state, props.isLoading);
|
|
33
|
+
let domRef = (0, $kvNjb$reactspectrumutils.useDOMRef)(ref);
|
|
34
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($kvNjb$react))).createElement((0, $60eb4b34c53310cb$exports.ListBoxBase), {
|
|
35
|
+
...props,
|
|
36
|
+
ref: domRef,
|
|
37
|
+
state: state,
|
|
38
|
+
layout: layout
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
42
|
+
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
43
|
+
/**
|
|
44
|
+
* A list of options that can allow selection of one or more.
|
|
45
|
+
*/ const $582d86e45be55635$export$41f133550aa26f48 = /*#__PURE__*/ (0, ($parcel$interopDefault($kvNjb$react))).forwardRef($582d86e45be55635$var$ListBox);
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=ListBox.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,oCAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,0CAAe,EAAE,OAAO,MAAM,SAAS;IACpD,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, props.isLoading);\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
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {ListBoxBase as $3247d4a89e6094e9$export$1afdcf349979fb7e, useListBoxLayout as $3247d4a89e6094e9$export$25768ea656ae32a7} from "./ListBoxBase.mjs";
|
|
2
|
+
import $7rJGh$react from "react";
|
|
3
|
+
import {useDOMRef as $7rJGh$useDOMRef} from "@react-spectrum/utils";
|
|
4
|
+
import {useListState as $7rJGh$useListState} from "@react-stately/list";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
function $3136257018b1a220$var$ListBox(props, ref) {
|
|
21
|
+
let state = (0, $7rJGh$useListState)(props);
|
|
22
|
+
let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)(state, props.isLoading);
|
|
23
|
+
let domRef = (0, $7rJGh$useDOMRef)(ref);
|
|
24
|
+
return /*#__PURE__*/ (0, $7rJGh$react).createElement((0, $3247d4a89e6094e9$export$1afdcf349979fb7e), {
|
|
25
|
+
...props,
|
|
26
|
+
ref: domRef,
|
|
27
|
+
state: state,
|
|
28
|
+
layout: layout
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
32
|
+
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
33
|
+
/**
|
|
34
|
+
* A list of options that can allow selection of one or more.
|
|
35
|
+
*/ const $3136257018b1a220$export$41f133550aa26f48 = /*#__PURE__*/ (0, $7rJGh$react).forwardRef($3136257018b1a220$var$ListBox);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
export {$3136257018b1a220$export$41f133550aa26f48 as ListBox};
|
|
39
|
+
//# sourceMappingURL=ListBox.mjs.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {ListBoxBase as $3247d4a89e6094e9$export$1afdcf349979fb7e, useListBoxLayout as $3247d4a89e6094e9$export$25768ea656ae32a7} from "./ListBoxBase.module.js";
|
|
2
|
+
import $7rJGh$react from "react";
|
|
3
|
+
import {useDOMRef as $7rJGh$useDOMRef} from "@react-spectrum/utils";
|
|
4
|
+
import {useListState as $7rJGh$useListState} from "@react-stately/list";
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
8
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
* governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
function $3136257018b1a220$var$ListBox(props, ref) {
|
|
21
|
+
let state = (0, $7rJGh$useListState)(props);
|
|
22
|
+
let layout = (0, $3247d4a89e6094e9$export$25768ea656ae32a7)(state, props.isLoading);
|
|
23
|
+
let domRef = (0, $7rJGh$useDOMRef)(ref);
|
|
24
|
+
return /*#__PURE__*/ (0, $7rJGh$react).createElement((0, $3247d4a89e6094e9$export$1afdcf349979fb7e), {
|
|
25
|
+
...props,
|
|
26
|
+
ref: domRef,
|
|
27
|
+
state: state,
|
|
28
|
+
layout: layout
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
32
|
+
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
33
|
+
/**
|
|
34
|
+
* A list of options that can allow selection of one or more.
|
|
35
|
+
*/ const $3136257018b1a220$export$41f133550aa26f48 = /*#__PURE__*/ (0, $7rJGh$react).forwardRef($3136257018b1a220$var$ListBox);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
export {$3136257018b1a220$export$41f133550aa26f48 as ListBox};
|
|
39
|
+
//# sourceMappingURL=ListBox.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AASD,SAAS,8BAA0B,KAA8B,EAAE,GAA2B;IAC5F,IAAI,QAAQ,CAAA,GAAA,mBAAW,EAAE;IACzB,IAAI,SAAS,CAAA,GAAA,yCAAe,EAAE,OAAO,MAAM,SAAS;IACpD,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, props.isLoading);\n let domRef = useDOMRef(ref);\n\n return (\n <ListBoxBase\n {...props}\n ref={domRef}\n state={state}\n layout={layout} />\n );\n}\n\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\n\n\n/**\n * A list of options that can allow selection of one or more.\n */\nconst _ListBox = React.forwardRef(ListBox) as <T>(props: SpectrumListBoxProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_ListBox as ListBox};\n"],"names":[],"version":3,"file":"ListBox.module.js.map"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
var $3d9fe9b46e2d649a$exports = require("./intlStrings.main.js");
|
|
2
|
+
var $611e93c7b7c0413c$exports = require("./ListBoxContext.main.js");
|
|
3
|
+
var $2205d250ee1cb1ac$exports = require("./ListBoxOption.main.js");
|
|
4
|
+
var $0f5fd8483f48ef09$exports = require("./ListBoxSection.main.js");
|
|
5
|
+
require("./vars.5bf8960a.css");
|
|
6
|
+
var $3deee0fd2b46e64f$exports = require("./menu_vars_css.main.js");
|
|
7
|
+
var $7w19U$reactarialistbox = require("@react-aria/listbox");
|
|
8
|
+
var $7w19U$reactspectrumutils = require("@react-spectrum/utils");
|
|
9
|
+
var $7w19U$reactariafocus = require("@react-aria/focus");
|
|
10
|
+
var $7w19U$reactstatelylayout = require("@react-stately/layout");
|
|
11
|
+
var $7w19U$reactariautils = require("@react-aria/utils");
|
|
12
|
+
var $7w19U$reactspectrumprogress = require("@react-spectrum/progress");
|
|
13
|
+
var $7w19U$react = require("react");
|
|
14
|
+
var $7w19U$reactariai18n = require("@react-aria/i18n");
|
|
15
|
+
var $7w19U$reactspectrumprovider = require("@react-spectrum/provider");
|
|
16
|
+
var $7w19U$reactariavirtualizer = require("@react-aria/virtualizer");
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
function $parcel$interopDefault(a) {
|
|
20
|
+
return a && a.__esModule ? a.default : a;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function $parcel$export(e, n, v, s) {
|
|
24
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
$parcel$export(module.exports, "useListBoxLayout", () => $60eb4b34c53310cb$export$25768ea656ae32a7);
|
|
28
|
+
$parcel$export(module.exports, "ListBoxBase", () => $60eb4b34c53310cb$export$1afdcf349979fb7e);
|
|
29
|
+
/*
|
|
30
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
31
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
32
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
33
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
34
|
+
*
|
|
35
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
36
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
37
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
38
|
+
* governing permissions and limitations under the License.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
function $60eb4b34c53310cb$export$25768ea656ae32a7(state, isLoading) {
|
|
55
|
+
let { scale: scale } = (0, $7w19U$reactspectrumprovider.useProvider)();
|
|
56
|
+
let collator = (0, $7w19U$reactariai18n.useCollator)({
|
|
57
|
+
usage: "search",
|
|
58
|
+
sensitivity: "base"
|
|
59
|
+
});
|
|
60
|
+
let layout = (0, $7w19U$react.useMemo)(()=>new (0, $7w19U$reactstatelylayout.ListLayout)({
|
|
61
|
+
estimatedRowHeight: scale === "large" ? 48 : 32,
|
|
62
|
+
estimatedHeadingHeight: scale === "large" ? 33 : 26,
|
|
63
|
+
padding: scale === "large" ? 5 : 4,
|
|
64
|
+
loaderHeight: 40,
|
|
65
|
+
placeholderHeight: scale === "large" ? 48 : 32,
|
|
66
|
+
collator: collator
|
|
67
|
+
}), [
|
|
68
|
+
collator,
|
|
69
|
+
scale
|
|
70
|
+
]);
|
|
71
|
+
layout.collection = state.collection;
|
|
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
|
+
return layout;
|
|
85
|
+
}
|
|
86
|
+
/** @private */ function $60eb4b34c53310cb$var$ListBoxBase(props, ref) {
|
|
87
|
+
let { layout: layout, state: state, shouldSelectOnPressUp: shouldSelectOnPressUp, focusOnPointerEnter: focusOnPointerEnter, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, transitionDuration: transitionDuration = 0, onScroll: onScroll } = props;
|
|
88
|
+
let { listBoxProps: listBoxProps } = (0, $7w19U$reactarialistbox.useListBox)({
|
|
89
|
+
...props,
|
|
90
|
+
keyboardDelegate: layout,
|
|
91
|
+
isVirtualized: true
|
|
92
|
+
}, state, ref);
|
|
93
|
+
let { styleProps: styleProps } = (0, $7w19U$reactspectrumutils.useStyleProps)(props);
|
|
94
|
+
let stringFormatter = (0, $7w19U$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($3d9fe9b46e2d649a$exports))), "@react-spectrum/listbox");
|
|
95
|
+
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
96
|
+
if (reusableView.viewType === "section") return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $0f5fd8483f48ef09$exports.ListBoxSection), {
|
|
97
|
+
key: reusableView.key,
|
|
98
|
+
item: reusableView.content,
|
|
99
|
+
layoutInfo: reusableView.layoutInfo,
|
|
100
|
+
virtualizer: reusableView.virtualizer,
|
|
101
|
+
headerLayoutInfo: children.find((c)=>c.viewType === "header").layoutInfo
|
|
102
|
+
}, renderChildren(children.filter((c)=>c.viewType === "item")));
|
|
103
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariavirtualizer.VirtualizerItem), {
|
|
104
|
+
key: reusableView.key,
|
|
105
|
+
layoutInfo: reusableView.layoutInfo,
|
|
106
|
+
virtualizer: reusableView.virtualizer,
|
|
107
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
108
|
+
}, reusableView.rendered);
|
|
109
|
+
};
|
|
110
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $611e93c7b7c0413c$exports.ListBoxContext).Provider, {
|
|
111
|
+
value: state
|
|
112
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariafocus.FocusScope), null, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactariavirtualizer.Virtualizer), {
|
|
113
|
+
...styleProps,
|
|
114
|
+
...(0, $7w19U$reactariautils.mergeProps)(listBoxProps, domProps),
|
|
115
|
+
ref: ref,
|
|
116
|
+
focusedKey: state.selectionManager.focusedKey,
|
|
117
|
+
autoFocus: !!props.autoFocus,
|
|
118
|
+
sizeToFit: "height",
|
|
119
|
+
scrollDirection: "vertical",
|
|
120
|
+
className: (0, $7w19U$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), "spectrum-Menu", styleProps.className),
|
|
121
|
+
layout: layout,
|
|
122
|
+
collection: state.collection,
|
|
123
|
+
renderWrapper: renderWrapper,
|
|
124
|
+
transitionDuration: transitionDuration,
|
|
125
|
+
isLoading: props.isLoading,
|
|
126
|
+
onLoadMore: props.onLoadMore,
|
|
127
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
128
|
+
onScroll: onScroll
|
|
129
|
+
}, (type, item)=>{
|
|
130
|
+
if (type === "item") return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $2205d250ee1cb1ac$exports.ListBoxOption), {
|
|
131
|
+
item: item,
|
|
132
|
+
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
133
|
+
shouldFocusOnHover: focusOnPointerEnter,
|
|
134
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
135
|
+
});
|
|
136
|
+
else if (type === "loader") return(// aria-selected isn't needed here since this option is not selectable.
|
|
137
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
138
|
+
/*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement("div", {
|
|
139
|
+
role: "option",
|
|
140
|
+
style: {
|
|
141
|
+
display: "flex",
|
|
142
|
+
alignItems: "center",
|
|
143
|
+
justifyContent: "center",
|
|
144
|
+
height: "100%"
|
|
145
|
+
}
|
|
146
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement((0, $7w19U$reactspectrumprogress.ProgressCircle), {
|
|
147
|
+
isIndeterminate: true,
|
|
148
|
+
size: "S",
|
|
149
|
+
"aria-label": state.collection.size > 0 ? stringFormatter.format("loadingMore") : stringFormatter.format("loading"),
|
|
150
|
+
UNSAFE_className: (0, $7w19U$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3deee0fd2b46e64f$exports))), "spectrum-Dropdown-progressCircle")
|
|
151
|
+
})));
|
|
152
|
+
else if (type === "placeholder") {
|
|
153
|
+
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
154
|
+
if (emptyState == null) return null;
|
|
155
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).createElement("div", {
|
|
156
|
+
// aria-selected isn't needed here since this option is not selectable.
|
|
157
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
158
|
+
role: "option"
|
|
159
|
+
}, emptyState);
|
|
160
|
+
}
|
|
161
|
+
})));
|
|
162
|
+
}
|
|
163
|
+
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
164
|
+
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
165
|
+
const $60eb4b34c53310cb$export$1afdcf349979fb7e = /*#__PURE__*/ (0, ($parcel$interopDefault($7w19U$react))).forwardRef($60eb4b34c53310cb$var$ListBoxBase);
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
//# sourceMappingURL=ListBoxBase.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAwCM,SAAS,0CAAoB,KAAmB,EAAE,SAAkB;IACzE,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,wCAAU;IACxB,IAAI,WAAW,CAAA,GAAA,gCAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,SAAS,CAAA,GAAA,oBAAM,EAAE,IACnB,IAAI,CAAA,GAAA,oCAAS,EAAK;YAChB,oBAAoB,UAAU,UAAU,KAAK;YAC7C,wBAAwB,UAAU,UAAU,KAAK;YACjD,SAAS,UAAU,UAAU,IAAI;YACjC,cAAc;YACd,mBAAmB,UAAU,UAAU,KAAK;sBAC5C;QACF,IACA;QAAC;QAAU;KAAM;IAEnB,OAAO,UAAU,GAAG,MAAM,UAAU;IACpC,OAAO,YAAY,GAAG,MAAM,YAAY;IAExC,CAAA,GAAA,qCAAc,EAAE;QACd,sCAAsC;QACtC,IAAI,OAAO,SAAS,KAAK,WAAW;gBAElC;YADA,OAAO,SAAS,GAAG;aACnB,sBAAA,OAAO,WAAW,cAAlB,0CAAA,oBAAoB,WAAW;QACjC;IACF,GAAG;QAAC;QAAQ;KAAU;IACtB,OAAO;AACT;AAEA,aAAa,GACb,SAAS,kCAAe,KAA0B,EAAE,GAA8B;IAChF,IAAI,UAAC,MAAM,SAAE,KAAK,yBAAE,qBAAqB,uBAAE,mBAAmB,yBAAE,qBAAqB,YAAE,WAAW,CAAC,uBAAG,qBAAqB,aAAG,QAAQ,EAAC,GAAG;IAC1I,IAAI,gBAAC,YAAY,EAAC,GAAG,CAAA,GAAA,kCAAS,EAAE;QAC9B,GAAG,KAAK;QACR,kBAAkB;QAClB,eAAe;IACjB,GAAG,OAAO;IACV,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAKhE,IAAI,gBAAgB,CAAC,QAAc,cAAoB,UAAkB;QACvE,IAAI,aAAa,QAAQ,KAAK,WAC5B,qBACE,0DAAC,CAAA,GAAA,wCAAa;YACZ,KAAK,aAAa,GAAG;YACrB,MAAM,aAAa,OAAO;YAC1B,YAAY,aAAa,UAAU;YACnC,aAAa,aAAa,WAAW;YACrC,kBAAkB,SAAS,IAAI,CAAC,CAAA,IAAK,EAAE,QAAQ,KAAK,UAAU,UAAU;WACvE,eAAe,SAAS,MAAM,CAAC,CAAA,IAAK,EAAE,QAAQ,KAAK;QAK1D,qBACE,0DAAC,CAAA,GAAA,2CAAc;YACb,KAAK,aAAa,GAAG;YACrB,YAAY,aAAa,UAAU;YACnC,aAAa,aAAa,WAAW;YACrC,MAAM,EAAE,mBAAA,6BAAA,OAAQ,UAAU;WACzB,aAAa,QAAQ;IAG5B;IAEA,qBACE,0DAAC,CAAA,GAAA,wCAAa,EAAE,QAAQ;QAAC,OAAO;qBAC9B,0DAAC,CAAA,GAAA,gCAAS,uBACR,0DAAC,CAAA,GAAA,uCAAU;QACR,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,gCAAS,EAAE,cAAc,SAAS;QACtC,KAAK;QACL,YAAY,MAAM,gBAAgB,CAAC,UAAU;QAC7C,WAAW,CAAC,CAAC,MAAM,SAAS;QAC5B,WAAU;QACV,iBAAgB;QAChB,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,iBACA,WAAW,SAAS;QAGxB,QAAQ;QACR,YAAY,MAAM,UAAU;QAC5B,eAAe;QACf,oBAAoB;QACpB,WAAW,MAAM,SAAS;QAC1B,YAAY,MAAM,UAAU;QAC5B,uBAAuB;QACvB,UAAU;OACT,CAAC,MAAM;QACN,IAAI,SAAS,QACX,qBACE,0DAAC,CAAA,GAAA,uCAAY;YACX,MAAM;YACN,uBAAuB;YACvB,oBAAoB;YACpB,uBAAuB;;aAEtB,IAAI,SAAS,UAClB,OACE,uEAAuE;QACvE,iEAAiE;sBACjE,0DAAC;YAAI,MAAK;YAAS,OAAO;gBAAC,SAAS;gBAAQ,YAAY;gBAAU,gBAAgB;gBAAU,QAAQ;YAAM;yBACxG,0DAAC,CAAA,GAAA,2CAAa;YACZ,iBAAA;YACA,MAAK;YACL,cAAY,MAAM,UAAU,CAAC,IAAI,GAAG,IAAI,gBAAgB,MAAM,CAAC,iBAAiB,gBAAgB,MAAM,CAAC;YACvG,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;;aAGtC,IAAI,SAAS,eAAe;YACjC,IAAI,aAAa,MAAM,gBAAgB,GAAG,MAAM,gBAAgB,KAAK;YACrE,IAAI,cAAc,MAChB,OAAO;YAGT,qBACE,0DAAC;gBACC,uEAAuE;gBACvE,iEAAiE;gBACjE,MAAK;eACJ;QAGP;IACF;AAKV;AAEA,wFAAwF;AACxF,2GAA2G;AAC3G,MAAM,0DAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","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"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import $gF3QK$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {ListBoxContext as $0c6f792811e33483$export$7ff8f37d2d81a48d} from "./ListBoxContext.mjs";
|
|
3
|
+
import {ListBoxOption as $86983ea1fa3f7312$export$feb3b6b552c14a12} from "./ListBoxOption.mjs";
|
|
4
|
+
import {ListBoxSection as $92d678ed88836094$export$dca12b0bb56e4fc} from "./ListBoxSection.mjs";
|
|
5
|
+
import "./vars.5bf8960a.css";
|
|
6
|
+
import $gF3QK$menu_vars_cssmodulejs from "./menu_vars_css.mjs";
|
|
7
|
+
import {useListBox as $gF3QK$useListBox} from "@react-aria/listbox";
|
|
8
|
+
import {useStyleProps as $gF3QK$useStyleProps, classNames as $gF3QK$classNames} from "@react-spectrum/utils";
|
|
9
|
+
import {FocusScope as $gF3QK$FocusScope} from "@react-aria/focus";
|
|
10
|
+
import {ListLayout as $gF3QK$ListLayout} from "@react-stately/layout";
|
|
11
|
+
import {useLayoutEffect as $gF3QK$useLayoutEffect, 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} from "react";
|
|
14
|
+
import {useCollator as $gF3QK$useCollator, 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(state, isLoading) {
|
|
48
|
+
let { scale: scale } = (0, $gF3QK$useProvider)();
|
|
49
|
+
let collator = (0, $gF3QK$useCollator)({
|
|
50
|
+
usage: "search",
|
|
51
|
+
sensitivity: "base"
|
|
52
|
+
});
|
|
53
|
+
let layout = (0, $gF3QK$useMemo)(()=>new (0, $gF3QK$ListLayout)({
|
|
54
|
+
estimatedRowHeight: scale === "large" ? 48 : 32,
|
|
55
|
+
estimatedHeadingHeight: scale === "large" ? 33 : 26,
|
|
56
|
+
padding: scale === "large" ? 5 : 4,
|
|
57
|
+
loaderHeight: 40,
|
|
58
|
+
placeholderHeight: scale === "large" ? 48 : 32,
|
|
59
|
+
collator: collator
|
|
60
|
+
}), [
|
|
61
|
+
collator,
|
|
62
|
+
scale
|
|
63
|
+
]);
|
|
64
|
+
layout.collection = state.collection;
|
|
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
|
+
return layout;
|
|
78
|
+
}
|
|
79
|
+
/** @private */ function $3247d4a89e6094e9$var$ListBoxBase(props, ref) {
|
|
80
|
+
let { layout: layout, state: state, shouldSelectOnPressUp: shouldSelectOnPressUp, focusOnPointerEnter: focusOnPointerEnter, shouldUseVirtualFocus: shouldUseVirtualFocus, domProps: domProps = {}, transitionDuration: transitionDuration = 0, onScroll: onScroll } = props;
|
|
81
|
+
let { listBoxProps: listBoxProps } = (0, $gF3QK$useListBox)({
|
|
82
|
+
...props,
|
|
83
|
+
keyboardDelegate: layout,
|
|
84
|
+
isVirtualized: true
|
|
85
|
+
}, state, ref);
|
|
86
|
+
let { styleProps: styleProps } = (0, $gF3QK$useStyleProps)(props);
|
|
87
|
+
let stringFormatter = (0, $gF3QK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($gF3QK$intlStringsmodulejs))), "@react-spectrum/listbox");
|
|
88
|
+
let renderWrapper = (parent, reusableView, children, renderChildren)=>{
|
|
89
|
+
if (reusableView.viewType === "section") return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $92d678ed88836094$export$dca12b0bb56e4fc), {
|
|
90
|
+
key: reusableView.key,
|
|
91
|
+
item: reusableView.content,
|
|
92
|
+
layoutInfo: reusableView.layoutInfo,
|
|
93
|
+
virtualizer: reusableView.virtualizer,
|
|
94
|
+
headerLayoutInfo: children.find((c)=>c.viewType === "header").layoutInfo
|
|
95
|
+
}, renderChildren(children.filter((c)=>c.viewType === "item")));
|
|
96
|
+
return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$VirtualizerItem), {
|
|
97
|
+
key: reusableView.key,
|
|
98
|
+
layoutInfo: reusableView.layoutInfo,
|
|
99
|
+
virtualizer: reusableView.virtualizer,
|
|
100
|
+
parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
|
|
101
|
+
}, reusableView.rendered);
|
|
102
|
+
};
|
|
103
|
+
return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $0c6f792811e33483$export$7ff8f37d2d81a48d).Provider, {
|
|
104
|
+
value: state
|
|
105
|
+
}, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$FocusScope), null, /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $gF3QK$Virtualizer), {
|
|
106
|
+
...styleProps,
|
|
107
|
+
...(0, $gF3QK$mergeProps)(listBoxProps, domProps),
|
|
108
|
+
ref: ref,
|
|
109
|
+
focusedKey: state.selectionManager.focusedKey,
|
|
110
|
+
autoFocus: !!props.autoFocus,
|
|
111
|
+
sizeToFit: "height",
|
|
112
|
+
scrollDirection: "vertical",
|
|
113
|
+
className: (0, $gF3QK$classNames)((0, ($parcel$interopDefault($gF3QK$menu_vars_cssmodulejs))), "spectrum-Menu", styleProps.className),
|
|
114
|
+
layout: layout,
|
|
115
|
+
collection: state.collection,
|
|
116
|
+
renderWrapper: renderWrapper,
|
|
117
|
+
transitionDuration: transitionDuration,
|
|
118
|
+
isLoading: props.isLoading,
|
|
119
|
+
onLoadMore: props.onLoadMore,
|
|
120
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus,
|
|
121
|
+
onScroll: onScroll
|
|
122
|
+
}, (type, item)=>{
|
|
123
|
+
if (type === "item") return /*#__PURE__*/ (0, $gF3QK$react).createElement((0, $86983ea1fa3f7312$export$feb3b6b552c14a12), {
|
|
124
|
+
item: item,
|
|
125
|
+
shouldSelectOnPressUp: shouldSelectOnPressUp,
|
|
126
|
+
shouldFocusOnHover: focusOnPointerEnter,
|
|
127
|
+
shouldUseVirtualFocus: shouldUseVirtualFocus
|
|
128
|
+
});
|
|
129
|
+
else if (type === "loader") 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
|
+
else if (type === "placeholder") {
|
|
146
|
+
let emptyState = props.renderEmptyState ? props.renderEmptyState() : null;
|
|
147
|
+
if (emptyState == null) return null;
|
|
148
|
+
return /*#__PURE__*/ (0, $gF3QK$react).createElement("div", {
|
|
149
|
+
// aria-selected isn't needed here since this option is not selectable.
|
|
150
|
+
// eslint-disable-next-line jsx-a11y/role-has-required-aria-props
|
|
151
|
+
role: "option"
|
|
152
|
+
}, emptyState);
|
|
153
|
+
}
|
|
154
|
+
})));
|
|
155
|
+
}
|
|
156
|
+
// forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
157
|
+
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
158
|
+
const $3247d4a89e6094e9$export$1afdcf349979fb7e = /*#__PURE__*/ (0, $gF3QK$react).forwardRef($3247d4a89e6094e9$var$ListBoxBase);
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
export {$3247d4a89e6094e9$export$25768ea656ae32a7 as useListBoxLayout, $3247d4a89e6094e9$export$1afdcf349979fb7e as ListBoxBase};
|
|
162
|
+
//# sourceMappingURL=ListBoxBase.mjs.map
|