@react-aria/tree 3.0.2 → 3.1.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.
@@ -1 +1 @@
1
- {"mappings":";;;;AAoBA,2BAA2B,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC;CAAG;AAEzD,+BAA+B,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,4BAA4B,CAAC;CAAG;AACrG,iCAAiC,CAAC,CAAE,SAAQ,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC;IACtG;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAED;IACE,sCAAsC;IACtC,SAAS,EAAE,aAAa,CAAA;CACzB;AAED;;;;;;GAMG;AACH,wBAAwB,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,QAAQ,CAOvH;AC7BD,oCAAqC,SAAQ,IAAI,CAAC,uBAAuB,EAAE,eAAe,CAAC;IACzF,sHAAsH;IACtH,IAAI,EAAE,KAAK,OAAO,CAAC,CAAA;CACpB;AAED,6BAA8B,SAAQ,gBAAgB;IACpD,2CAA2C;IAC3C,QAAQ,EAAE,aAAa,CAAC;IACxB,0EAA0E;IAC1E,aAAa,EAAE,aAAa,CAAC;IAC7B,+DAA+D;IAC/D,gBAAgB,EAAE,aAAa,CAAC;IAChC,iDAAiD;IACjD,iBAAiB,EAAE,eAAe,CAAA;CACnC;AAED;;;;;GAKG;AACH,4BAA4B,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,YAAY,CA4BrI","sources":["packages/@react-aria/tree/src/packages/@react-aria/tree/src/useTree.ts","packages/@react-aria/tree/src/packages/@react-aria/tree/src/useTreeItem.ts","packages/@react-aria/tree/src/packages/@react-aria/tree/src/index.ts","packages/@react-aria/tree/src/index.ts"],"sourcesContent":[null,null,null,"/*\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\nexport {useTree} from './useTree';\nexport {useTreeItem} from './useTreeItem';\n\nexport type {AriaTreeOptions, AriaTreeProps, TreeAria, TreeProps} from './useTree';\nexport type {AriaTreeItemOptions, TreeItemAria} from './useTreeItem';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;;;AAoBA,2BAA2B,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC;CAAG;AAEzD,+BAA+B,CAAC,CAAE,SAAQ,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,4BAA4B,CAAC;CAAG;AACrG,iCAAiC,CAAC,CAAE,SAAQ,IAAI,CAAC,oBAAoB,CAAC,CAAC,EAAE,UAAU,GAAG,iBAAiB,CAAC;IACtG;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAED;IACE,sCAAsC;IACtC,SAAS,EAAE,aAAa,CAAA;CACzB;AAED;;;;;;GAMG;AACH,wBAAwB,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,QAAQ,CAOvH;AC7BD,oCAAqC,SAAQ,IAAI,CAAC,uBAAuB,EAAE,eAAe,CAAC;IACzF,sHAAsH;IACtH,IAAI,EAAE,KAAK,OAAO,CAAC,CAAA;CACpB;AAED,6BAA8B,SAAQ,gBAAgB;IACpD,2CAA2C;IAC3C,QAAQ,EAAE,aAAa,CAAC;IACxB,0EAA0E;IAC1E,aAAa,EAAE,aAAa,CAAC;IAC7B,+DAA+D;IAC/D,gBAAgB,EAAE,aAAa,CAAC;IAChC,iDAAiD;IACjD,iBAAiB,EAAE,eAAe,CAAA;CACnC;AAED;;;;;GAKG;AACH,4BAA4B,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,YAAY,CA6BrI","sources":["packages/@react-aria/tree/src/packages/@react-aria/tree/src/useTree.ts","packages/@react-aria/tree/src/packages/@react-aria/tree/src/useTreeItem.ts","packages/@react-aria/tree/src/packages/@react-aria/tree/src/index.ts","packages/@react-aria/tree/src/index.ts"],"sourcesContent":[null,null,null,"/*\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\nexport {useTree} from './useTree';\nexport {useTreeItem} from './useTreeItem';\n\nexport type {AriaTreeOptions, AriaTreeProps, TreeAria, TreeProps} from './useTree';\nexport type {AriaTreeItemOptions, TreeItemAria} from './useTreeItem';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -44,7 +44,8 @@ function $739d43f6fe8a5583$export$e4bcc4675b2b123a(props, state, ref) {
44
44
  state.selectionManager.setFocusedKey(node.key);
45
45
  }
46
46
  },
47
- tabIndex: (0, $cDrlP$reactariautils.isAndroid)() ? -1 : null,
47
+ excludeFromTabOrder: true,
48
+ preventFocusOnPress: true,
48
49
  'data-react-aria-prevent-focus': true,
49
50
  ...labelProps
50
51
  };
@@ -1 +1 @@
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,UAAU,CAAA,GAAA,+BAAQ,MAAM,KAAK;QAC7B,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 {isAndroid, useLabels} from '@react-aria/utils';\nimport {TreeState} from '@react-stately/tree';\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 tabIndex: isAndroid() ? -1 : null,\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"}
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"}
@@ -1,6 +1,6 @@
1
1
  import $f4zHe$intlStringsmodulejs from "./intlStrings.mjs";
2
2
  import {useGridListItem as $f4zHe$useGridListItem} from "@react-aria/gridlist";
3
- import {useLabels as $f4zHe$useLabels, isAndroid as $f4zHe$isAndroid} from "@react-aria/utils";
3
+ import {useLabels as $f4zHe$useLabels} from "@react-aria/utils";
4
4
  import {useLocalizedStringFormatter as $f4zHe$useLocalizedStringFormatter} from "@react-aria/i18n";
5
5
 
6
6
 
@@ -38,7 +38,8 @@ function $b41e0bc5ca49db3d$export$e4bcc4675b2b123a(props, state, ref) {
38
38
  state.selectionManager.setFocusedKey(node.key);
39
39
  }
40
40
  },
41
- tabIndex: (0, $f4zHe$isAndroid)() ? -1 : null,
41
+ excludeFromTabOrder: true,
42
+ preventFocusOnPress: true,
42
43
  'data-react-aria-prevent-focus': true,
43
44
  ...labelProps
44
45
  };
@@ -1,6 +1,6 @@
1
1
  import $f4zHe$intlStringsmodulejs from "./intlStrings.module.js";
2
2
  import {useGridListItem as $f4zHe$useGridListItem} from "@react-aria/gridlist";
3
- import {useLabels as $f4zHe$useLabels, isAndroid as $f4zHe$isAndroid} from "@react-aria/utils";
3
+ import {useLabels as $f4zHe$useLabels} from "@react-aria/utils";
4
4
  import {useLocalizedStringFormatter as $f4zHe$useLocalizedStringFormatter} from "@react-aria/i18n";
5
5
 
6
6
 
@@ -38,7 +38,8 @@ function $b41e0bc5ca49db3d$export$e4bcc4675b2b123a(props, state, ref) {
38
38
  state.selectionManager.setFocusedKey(node.key);
39
39
  }
40
40
  },
41
- tabIndex: (0, $f4zHe$isAndroid)() ? -1 : null,
41
+ excludeFromTabOrder: true,
42
+ preventFocusOnPress: true,
42
43
  'data-react-aria-prevent-focus': true,
43
44
  ...labelProps
44
45
  };
@@ -1 +1 @@
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,UAAU,CAAA,GAAA,gBAAQ,MAAM,KAAK;QAC7B,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 {isAndroid, useLabels} from '@react-aria/utils';\nimport {TreeState} from '@react-stately/tree';\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 tabIndex: isAndroid() ? -1 : null,\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"}
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/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@react-aria/tree",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/module.js",
8
8
  "exports": {
9
- "types": "./dist/types.d.ts",
9
+ "source": "./src/index.ts",
10
+ "types": [
11
+ "./dist/types.d.ts",
12
+ "./src/index.ts"
13
+ ],
10
14
  "import": "./dist/import.mjs",
11
15
  "require": "./dist/main.js"
12
16
  },
@@ -22,13 +26,13 @@
22
26
  "url": "https://github.com/adobe/react-spectrum"
23
27
  },
24
28
  "dependencies": {
25
- "@react-aria/gridlist": "^3.12.0",
26
- "@react-aria/i18n": "^3.12.8",
27
- "@react-aria/selection": "^3.24.0",
28
- "@react-aria/utils": "^3.28.2",
29
- "@react-stately/tree": "^3.8.9",
30
- "@react-types/button": "^3.12.0",
31
- "@react-types/shared": "^3.29.0",
29
+ "@react-aria/gridlist": "^3.13.1",
30
+ "@react-aria/i18n": "^3.12.10",
31
+ "@react-aria/selection": "^3.24.2",
32
+ "@react-aria/utils": "^3.29.1",
33
+ "@react-stately/tree": "^3.9.0",
34
+ "@react-types/button": "^3.12.2",
35
+ "@react-types/shared": "^3.30.0",
32
36
  "@swc/helpers": "^0.5.0"
33
37
  },
34
38
  "peerDependencies": {
@@ -38,5 +42,5 @@
38
42
  "publishConfig": {
39
43
  "access": "public"
40
44
  },
41
- "gitHead": "9b66d270572f482948afee95622a85cdf68ed408"
45
+ "gitHead": "265b4d7f107905ee1c6e87a8af1613ab440a6849"
42
46
  }
@@ -15,8 +15,8 @@ import {AriaGridListItemOptions, GridListItemAria, useGridListItem} from '@react
15
15
  import {DOMAttributes, FocusableElement, Node, RefObject} from '@react-types/shared';
16
16
  // @ts-ignore
17
17
  import intlMessages from '../intl/*.json';
18
- import {isAndroid, useLabels} from '@react-aria/utils';
19
18
  import {TreeState} from '@react-stately/tree';
19
+ import {useLabels} from '@react-aria/utils';
20
20
  import {useLocalizedStringFormatter} from '@react-aria/i18n';
21
21
 
22
22
  export interface AriaTreeItemOptions extends Omit<AriaGridListItemOptions, 'isVirtualized'> {
@@ -59,7 +59,8 @@ export function useTreeItem<T>(props: AriaTreeItemOptions, state: TreeState<T>,
59
59
  state.selectionManager.setFocusedKey(node.key);
60
60
  }
61
61
  },
62
- tabIndex: isAndroid() ? -1 : null,
62
+ excludeFromTabOrder: true,
63
+ preventFocusOnPress: true,
63
64
  'data-react-aria-prevent-focus': true,
64
65
  ...labelProps
65
66
  };