@react-aria/tree 3.1.6 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +2 -4
- package/dist/main.js +3 -5
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -4
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +4 -0
- package/package.json +15 -18
- package/src/index.ts +4 -4
- package/dist/ar-AE.main.js +0 -7
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -9
- package/dist/ar-AE.module.js +0 -9
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -7
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -9
- package/dist/bg-BG.module.js +0 -9
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -7
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -9
- package/dist/cs-CZ.module.js +0 -9
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -7
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -9
- package/dist/da-DK.module.js +0 -9
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -7
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -9
- package/dist/de-DE.module.js +0 -9
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -7
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -9
- package/dist/el-GR.module.js +0 -9
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -7
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -9
- package/dist/en-US.module.js +0 -9
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -7
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -9
- package/dist/es-ES.module.js +0 -9
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -7
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -9
- package/dist/et-EE.module.js +0 -9
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -7
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -9
- package/dist/fi-FI.module.js +0 -9
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -7
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -9
- package/dist/fr-FR.module.js +0 -9
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -7
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -9
- package/dist/he-IL.module.js +0 -9
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -7
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -9
- package/dist/hr-HR.module.js +0 -9
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -7
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -9
- package/dist/hu-HU.module.js +0 -9
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -7
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -9
- package/dist/it-IT.module.js +0 -9
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -7
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -9
- package/dist/ja-JP.module.js +0 -9
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -7
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -9
- package/dist/ko-KR.module.js +0 -9
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -7
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -9
- package/dist/lt-LT.module.js +0 -9
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -7
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -9
- package/dist/lv-LV.module.js +0 -9
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -7
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -9
- package/dist/nb-NO.module.js +0 -9
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -7
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -9
- package/dist/nl-NL.module.js +0 -9
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -7
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -9
- package/dist/pl-PL.module.js +0 -9
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -7
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -9
- package/dist/pt-BR.module.js +0 -9
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -7
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -9
- package/dist/pt-PT.module.js +0 -9
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -7
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -9
- package/dist/ro-RO.module.js +0 -9
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -7
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -9
- package/dist/ru-RU.module.js +0 -9
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -7
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -9
- package/dist/sk-SK.module.js +0 -9
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -7
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -9
- package/dist/sl-SI.module.js +0 -9
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -7
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -9
- package/dist/sr-SP.module.js +0 -9
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -7
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -9
- package/dist/sv-SE.module.js +0 -9
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -7
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -9
- package/dist/tr-TR.module.js +0 -9
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -50
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -7
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -9
- package/dist/uk-UA.module.js +0 -9
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/useTree.main.js +0 -29
- package/dist/useTree.main.js.map +0 -1
- package/dist/useTree.mjs +0 -24
- package/dist/useTree.module.js +0 -24
- package/dist/useTree.module.js.map +0 -1
- package/dist/useTreeItem.main.js +0 -60
- package/dist/useTreeItem.main.js.map +0 -1
- package/dist/useTreeItem.mjs +0 -55
- package/dist/useTreeItem.module.js +0 -55
- package/dist/useTreeItem.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -7
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -9
- package/dist/zh-CN.module.js +0 -9
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -7
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -9
- package/dist/zh-TW.module.js +0 -9
- package/dist/zh-TW.module.js.map +0 -1
- package/src/useTree.ts +0 -51
- package/src/useTreeItem.ts +0 -73
package/dist/useTreeItem.main.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
var $6fc07bed32f3daee$exports = require("./intlStrings.main.js");
|
|
2
|
-
var $cDrlP$reactariagridlist = require("@react-aria/gridlist");
|
|
3
|
-
var $cDrlP$reactariautils = require("@react-aria/utils");
|
|
4
|
-
var $cDrlP$reactariai18n = require("@react-aria/i18n");
|
|
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, "useTreeItem", () => $739d43f6fe8a5583$export$e4bcc4675b2b123a);
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2024 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 $739d43f6fe8a5583$export$e4bcc4675b2b123a(props, state, ref) {
|
|
31
|
-
let { node: node } = props;
|
|
32
|
-
let gridListAria = (0, $cDrlP$reactariagridlist.useGridListItem)(props, state, ref);
|
|
33
|
-
let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
|
|
34
|
-
let stringFormatter = (0, $cDrlP$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($6fc07bed32f3daee$exports))), '@react-aria/tree');
|
|
35
|
-
let labelProps = (0, $cDrlP$reactariautils.useLabels)({
|
|
36
|
-
'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
|
|
37
|
-
'aria-labelledby': gridListAria.rowProps.id
|
|
38
|
-
});
|
|
39
|
-
let expandButtonProps = {
|
|
40
|
-
onPress: ()=>{
|
|
41
|
-
if (!gridListAria.isDisabled) {
|
|
42
|
-
state.toggleKey(node.key);
|
|
43
|
-
state.selectionManager.setFocused(true);
|
|
44
|
-
state.selectionManager.setFocusedKey(node.key);
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
excludeFromTabOrder: true,
|
|
48
|
-
preventFocusOnPress: true,
|
|
49
|
-
'data-react-aria-prevent-focus': true,
|
|
50
|
-
...labelProps
|
|
51
|
-
};
|
|
52
|
-
// TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
|
|
53
|
-
return {
|
|
54
|
-
...gridListAria,
|
|
55
|
-
expandButtonProps: expandButtonProps
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//# sourceMappingURL=useTreeItem.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAe,KAA0B,EAAE,KAAmB,EAAE,GAAuC;IACrH,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,eAAe,CAAA,GAAA,wCAAc,EAAE,OAAO,OAAO;IACjD,IAAI,aAAa,aAAa,QAAQ,CAAC,gBAAgB,KAAK;IAC5D,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,aAAa,CAAA,GAAA,+BAAQ,EAAE;QACzB,cAAc,aAAa,gBAAgB,MAAM,CAAC,cAAc,gBAAgB,MAAM,CAAC;QACvF,mBAAmB,aAAa,QAAQ,CAAC,EAAE;IAC7C;IAEA,IAAI,oBAAoB;QACtB,SAAS;YACP,IAAI,CAAC,aAAa,UAAU,EAAE;gBAC5B,MAAM,SAAS,CAAC,KAAK,GAAG;gBACxB,MAAM,gBAAgB,CAAC,UAAU,CAAC;gBAClC,MAAM,gBAAgB,CAAC,aAAa,CAAC,KAAK,GAAG;YAC/C;QACF;QACA,qBAAqB;QACrB,qBAAqB;QACrB,iCAAiC;QACjC,GAAG,UAAU;IACf;IAEA,+FAA+F;IAC/F,OAAO;QACL,GAAG,YAAY;2BACf;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeItem.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaButtonProps} from '@react-types/button';\nimport {AriaGridListItemOptions, GridListItemAria, useGridListItem} from '@react-aria/gridlist';\nimport {DOMAttributes, FocusableElement, Node, RefObject} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {TreeState} from '@react-stately/tree';\nimport {useLabels} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTreeItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {\n /** An object representing the treegrid item. Contains all the relevant information that makes up the treegrid row. */\n node: Node<unknown>\n}\n\nexport interface TreeItemAria extends GridListItemAria {\n /** Props for the tree grid row element. */\n rowProps: DOMAttributes,\n /** Props for the tree grid cell element within the tree grid list row. */\n gridCellProps: DOMAttributes,\n /** Props for the tree grid row description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the tree grid row expand button. */\n expandButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a row in a tree grid list.\n * @param props - Props for the row.\n * @param state - State of the parent list, as returned by `useTreeState`.\n * @param ref - The ref attached to the row element.\n */\nexport function useTreeItem<T>(props: AriaTreeItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement | null>): TreeItemAria {\n let {node} = props;\n let gridListAria = useGridListItem(props, state, ref);\n let isExpanded = gridListAria.rowProps['aria-expanded'] === true;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/tree');\n let labelProps = useLabels({\n 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),\n 'aria-labelledby': gridListAria.rowProps.id\n });\n\n let expandButtonProps = {\n onPress: () => {\n if (!gridListAria.isDisabled) {\n state.toggleKey(node.key);\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(node.key);\n }\n },\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n 'data-react-aria-prevent-focus': true,\n ...labelProps\n };\n\n // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?\n return {\n ...gridListAria,\n expandButtonProps\n };\n}\n"],"names":[],"version":3,"file":"useTreeItem.main.js.map"}
|
package/dist/useTreeItem.mjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import $f4zHe$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
-
import {useGridListItem as $f4zHe$useGridListItem} from "@react-aria/gridlist";
|
|
3
|
-
import {useLabels as $f4zHe$useLabels} from "@react-aria/utils";
|
|
4
|
-
import {useLocalizedStringFormatter as $f4zHe$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function $parcel$interopDefault(a) {
|
|
8
|
-
return a && a.__esModule ? a.default : a;
|
|
9
|
-
}
|
|
10
|
-
/*
|
|
11
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
12
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
-
* governing permissions and limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function $b41e0bc5ca49db3d$export$e4bcc4675b2b123a(props, state, ref) {
|
|
25
|
-
let { node: node } = props;
|
|
26
|
-
let gridListAria = (0, $f4zHe$useGridListItem)(props, state, ref);
|
|
27
|
-
let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
|
|
28
|
-
let stringFormatter = (0, $f4zHe$useLocalizedStringFormatter)((0, ($parcel$interopDefault($f4zHe$intlStringsmodulejs))), '@react-aria/tree');
|
|
29
|
-
let labelProps = (0, $f4zHe$useLabels)({
|
|
30
|
-
'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
|
|
31
|
-
'aria-labelledby': gridListAria.rowProps.id
|
|
32
|
-
});
|
|
33
|
-
let expandButtonProps = {
|
|
34
|
-
onPress: ()=>{
|
|
35
|
-
if (!gridListAria.isDisabled) {
|
|
36
|
-
state.toggleKey(node.key);
|
|
37
|
-
state.selectionManager.setFocused(true);
|
|
38
|
-
state.selectionManager.setFocusedKey(node.key);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
excludeFromTabOrder: true,
|
|
42
|
-
preventFocusOnPress: true,
|
|
43
|
-
'data-react-aria-prevent-focus': true,
|
|
44
|
-
...labelProps
|
|
45
|
-
};
|
|
46
|
-
// TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
|
|
47
|
-
return {
|
|
48
|
-
...gridListAria,
|
|
49
|
-
expandButtonProps: expandButtonProps
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export {$b41e0bc5ca49db3d$export$e4bcc4675b2b123a as useTreeItem};
|
|
55
|
-
//# sourceMappingURL=useTreeItem.module.js.map
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import $f4zHe$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
-
import {useGridListItem as $f4zHe$useGridListItem} from "@react-aria/gridlist";
|
|
3
|
-
import {useLabels as $f4zHe$useLabels} from "@react-aria/utils";
|
|
4
|
-
import {useLocalizedStringFormatter as $f4zHe$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function $parcel$interopDefault(a) {
|
|
8
|
-
return a && a.__esModule ? a.default : a;
|
|
9
|
-
}
|
|
10
|
-
/*
|
|
11
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
12
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
-
* governing permissions and limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function $b41e0bc5ca49db3d$export$e4bcc4675b2b123a(props, state, ref) {
|
|
25
|
-
let { node: node } = props;
|
|
26
|
-
let gridListAria = (0, $f4zHe$useGridListItem)(props, state, ref);
|
|
27
|
-
let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
|
|
28
|
-
let stringFormatter = (0, $f4zHe$useLocalizedStringFormatter)((0, ($parcel$interopDefault($f4zHe$intlStringsmodulejs))), '@react-aria/tree');
|
|
29
|
-
let labelProps = (0, $f4zHe$useLabels)({
|
|
30
|
-
'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
|
|
31
|
-
'aria-labelledby': gridListAria.rowProps.id
|
|
32
|
-
});
|
|
33
|
-
let expandButtonProps = {
|
|
34
|
-
onPress: ()=>{
|
|
35
|
-
if (!gridListAria.isDisabled) {
|
|
36
|
-
state.toggleKey(node.key);
|
|
37
|
-
state.selectionManager.setFocused(true);
|
|
38
|
-
state.selectionManager.setFocusedKey(node.key);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
excludeFromTabOrder: true,
|
|
42
|
-
preventFocusOnPress: true,
|
|
43
|
-
'data-react-aria-prevent-focus': true,
|
|
44
|
-
...labelProps
|
|
45
|
-
};
|
|
46
|
-
// TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
|
|
47
|
-
return {
|
|
48
|
-
...gridListAria,
|
|
49
|
-
expandButtonProps: expandButtonProps
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export {$b41e0bc5ca49db3d$export$e4bcc4675b2b123a as useTreeItem};
|
|
55
|
-
//# sourceMappingURL=useTreeItem.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAiCM,SAAS,0CAAe,KAA0B,EAAE,KAAmB,EAAE,GAAuC;IACrH,IAAI,QAAC,IAAI,EAAC,GAAG;IACb,IAAI,eAAe,CAAA,GAAA,sBAAc,EAAE,OAAO,OAAO;IACjD,IAAI,aAAa,aAAa,QAAQ,CAAC,gBAAgB,KAAK;IAC5D,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,aAAa,CAAA,GAAA,gBAAQ,EAAE;QACzB,cAAc,aAAa,gBAAgB,MAAM,CAAC,cAAc,gBAAgB,MAAM,CAAC;QACvF,mBAAmB,aAAa,QAAQ,CAAC,EAAE;IAC7C;IAEA,IAAI,oBAAoB;QACtB,SAAS;YACP,IAAI,CAAC,aAAa,UAAU,EAAE;gBAC5B,MAAM,SAAS,CAAC,KAAK,GAAG;gBACxB,MAAM,gBAAgB,CAAC,UAAU,CAAC;gBAClC,MAAM,gBAAgB,CAAC,aAAa,CAAC,KAAK,GAAG;YAC/C;QACF;QACA,qBAAqB;QACrB,qBAAqB;QACrB,iCAAiC;QACjC,GAAG,UAAU;IACf;IAEA,+FAA+F;IAC/F,OAAO;QACL,GAAG,YAAY;2BACf;IACF;AACF","sources":["packages/@react-aria/tree/src/useTreeItem.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {AriaButtonProps} from '@react-types/button';\nimport {AriaGridListItemOptions, GridListItemAria, useGridListItem} from '@react-aria/gridlist';\nimport {DOMAttributes, FocusableElement, Node, RefObject} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {TreeState} from '@react-stately/tree';\nimport {useLabels} from '@react-aria/utils';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface AriaTreeItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {\n /** An object representing the treegrid item. Contains all the relevant information that makes up the treegrid row. */\n node: Node<unknown>\n}\n\nexport interface TreeItemAria extends GridListItemAria {\n /** Props for the tree grid row element. */\n rowProps: DOMAttributes,\n /** Props for the tree grid cell element within the tree grid list row. */\n gridCellProps: DOMAttributes,\n /** Props for the tree grid row description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the tree grid row expand button. */\n expandButtonProps: AriaButtonProps\n}\n\n/**\n * Provides the behavior and accessibility implementation for a row in a tree grid list.\n * @param props - Props for the row.\n * @param state - State of the parent list, as returned by `useTreeState`.\n * @param ref - The ref attached to the row element.\n */\nexport function useTreeItem<T>(props: AriaTreeItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement | null>): TreeItemAria {\n let {node} = props;\n let gridListAria = useGridListItem(props, state, ref);\n let isExpanded = gridListAria.rowProps['aria-expanded'] === true;\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/tree');\n let labelProps = useLabels({\n 'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),\n 'aria-labelledby': gridListAria.rowProps.id\n });\n\n let expandButtonProps = {\n onPress: () => {\n if (!gridListAria.isDisabled) {\n state.toggleKey(node.key);\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(node.key);\n }\n },\n excludeFromTabOrder: true,\n preventFocusOnPress: true,\n 'data-react-aria-prevent-focus': true,\n ...labelProps\n };\n\n // TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?\n return {\n ...gridListAria,\n expandButtonProps\n };\n}\n"],"names":[],"version":3,"file":"useTreeItem.module.js.map"}
|
package/dist/zh-CN.main.js
DELETED
package/dist/zh-CN.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-CN.json"],"sourcesContent":["{\n \"collapse\": \"折叠\",\n \"expand\": \"扩展\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
|
package/dist/zh-CN.mjs
DELETED
package/dist/zh-CN.module.js
DELETED
package/dist/zh-CN.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-CN.json"],"sourcesContent":["{\n \"collapse\": \"折叠\",\n \"expand\": \"扩展\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
|
package/dist/zh-TW.main.js
DELETED
package/dist/zh-TW.main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AAAA,iBAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-TW.json"],"sourcesContent":["{\n \"collapse\": \"收合\",\n \"expand\": \"展開\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
|
package/dist/zh-TW.mjs
DELETED
package/dist/zh-TW.module.js
DELETED
package/dist/zh-TW.module.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAAA,4BAAiB;IAAG,YAAY,CAAC,gBAAE,CAAC;IAClC,UAAU,CAAC,gBAAE,CAAC;AAChB","sources":["packages/@react-aria/tree/intl/zh-TW.json"],"sourcesContent":["{\n \"collapse\": \"收合\",\n \"expand\": \"展開\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
|
package/src/useTree.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {AriaGridListOptions, AriaGridListProps, GridListProps, useGridList} from '@react-aria/gridlist';
|
|
14
|
-
import {
|
|
15
|
-
DOMAttributes,
|
|
16
|
-
KeyboardDelegate,
|
|
17
|
-
RefObject
|
|
18
|
-
} from '@react-types/shared';
|
|
19
|
-
import {TreeState} from '@react-stately/tree';
|
|
20
|
-
|
|
21
|
-
export interface TreeProps<T> extends GridListProps<T> {}
|
|
22
|
-
|
|
23
|
-
export interface AriaTreeProps<T> extends Omit<AriaGridListProps<T>, 'keyboardNavigationBehavior'> {}
|
|
24
|
-
export interface AriaTreeOptions<T> extends Omit<AriaGridListOptions<T>, 'children' | 'shouldFocusWrap'> {
|
|
25
|
-
/**
|
|
26
|
-
* An optional keyboard delegate implementation for type to select,
|
|
27
|
-
* to override the default.
|
|
28
|
-
*/
|
|
29
|
-
keyboardDelegate?: KeyboardDelegate
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface TreeAria {
|
|
33
|
-
/** Props for the treegrid element. */
|
|
34
|
-
gridProps: DOMAttributes
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Provides the behavior and accessibility implementation for a single column treegrid component with interactive children.
|
|
39
|
-
* A tree grid provides users with a way to navigate nested hierarchical information.
|
|
40
|
-
* @param props - Props for the treegrid.
|
|
41
|
-
* @param state - State for the treegrid, as returned by `useTreeState`.
|
|
42
|
-
* @param ref - The ref attached to the treegrid element.
|
|
43
|
-
*/
|
|
44
|
-
export function useTree<T>(props: AriaTreeOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement | null>): TreeAria {
|
|
45
|
-
let {gridProps} = useGridList(props, state, ref);
|
|
46
|
-
gridProps.role = 'treegrid';
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
gridProps
|
|
50
|
-
};
|
|
51
|
-
}
|
package/src/useTreeItem.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {AriaButtonProps} from '@react-types/button';
|
|
14
|
-
import {AriaGridListItemOptions, GridListItemAria, useGridListItem} from '@react-aria/gridlist';
|
|
15
|
-
import {DOMAttributes, FocusableElement, Node, RefObject} from '@react-types/shared';
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
import intlMessages from '../intl/*.json';
|
|
18
|
-
import {TreeState} from '@react-stately/tree';
|
|
19
|
-
import {useLabels} from '@react-aria/utils';
|
|
20
|
-
import {useLocalizedStringFormatter} from '@react-aria/i18n';
|
|
21
|
-
|
|
22
|
-
export interface AriaTreeItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {
|
|
23
|
-
/** An object representing the treegrid item. Contains all the relevant information that makes up the treegrid row. */
|
|
24
|
-
node: Node<unknown>
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface TreeItemAria extends GridListItemAria {
|
|
28
|
-
/** Props for the tree grid row element. */
|
|
29
|
-
rowProps: DOMAttributes,
|
|
30
|
-
/** Props for the tree grid cell element within the tree grid list row. */
|
|
31
|
-
gridCellProps: DOMAttributes,
|
|
32
|
-
/** Props for the tree grid row description element, if any. */
|
|
33
|
-
descriptionProps: DOMAttributes,
|
|
34
|
-
/** Props for the tree grid row expand button. */
|
|
35
|
-
expandButtonProps: AriaButtonProps
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Provides the behavior and accessibility implementation for a row in a tree grid list.
|
|
40
|
-
* @param props - Props for the row.
|
|
41
|
-
* @param state - State of the parent list, as returned by `useTreeState`.
|
|
42
|
-
* @param ref - The ref attached to the row element.
|
|
43
|
-
*/
|
|
44
|
-
export function useTreeItem<T>(props: AriaTreeItemOptions, state: TreeState<T>, ref: RefObject<FocusableElement | null>): TreeItemAria {
|
|
45
|
-
let {node} = props;
|
|
46
|
-
let gridListAria = useGridListItem(props, state, ref);
|
|
47
|
-
let isExpanded = gridListAria.rowProps['aria-expanded'] === true;
|
|
48
|
-
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/tree');
|
|
49
|
-
let labelProps = useLabels({
|
|
50
|
-
'aria-label': isExpanded ? stringFormatter.format('collapse') : stringFormatter.format('expand'),
|
|
51
|
-
'aria-labelledby': gridListAria.rowProps.id
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
let expandButtonProps = {
|
|
55
|
-
onPress: () => {
|
|
56
|
-
if (!gridListAria.isDisabled) {
|
|
57
|
-
state.toggleKey(node.key);
|
|
58
|
-
state.selectionManager.setFocused(true);
|
|
59
|
-
state.selectionManager.setFocusedKey(node.key);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
excludeFromTabOrder: true,
|
|
63
|
-
preventFocusOnPress: true,
|
|
64
|
-
'data-react-aria-prevent-focus': true,
|
|
65
|
-
...labelProps
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// TODO: should it return a state specifically for isExpanded? Or is aria attribute sufficient?
|
|
69
|
-
return {
|
|
70
|
-
...gridListAria,
|
|
71
|
-
expandButtonProps
|
|
72
|
-
};
|
|
73
|
-
}
|