@react-aria/tabs 3.11.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/import.mjs +2 -6
  2. package/dist/main.js +4 -8
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +2 -6
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +3 -0
  7. package/package.json +16 -18
  8. package/src/index.ts +3 -7
  9. package/dist/TabsKeyboardDelegate.main.js +0 -73
  10. package/dist/TabsKeyboardDelegate.main.js.map +0 -1
  11. package/dist/TabsKeyboardDelegate.mjs +0 -68
  12. package/dist/TabsKeyboardDelegate.module.js +0 -68
  13. package/dist/TabsKeyboardDelegate.module.js.map +0 -1
  14. package/dist/types.d.ts +0 -42
  15. package/dist/types.d.ts.map +0 -1
  16. package/dist/useTab.main.js +0 -68
  17. package/dist/useTab.main.js.map +0 -1
  18. package/dist/useTab.mjs +0 -63
  19. package/dist/useTab.module.js +0 -63
  20. package/dist/useTab.module.js.map +0 -1
  21. package/dist/useTabList.main.js +0 -67
  22. package/dist/useTabList.main.js.map +0 -1
  23. package/dist/useTabList.mjs +0 -62
  24. package/dist/useTabList.module.js +0 -62
  25. package/dist/useTabList.module.js.map +0 -1
  26. package/dist/useTabPanel.main.js +0 -47
  27. package/dist/useTabPanel.main.js.map +0 -1
  28. package/dist/useTabPanel.mjs +0 -42
  29. package/dist/useTabPanel.module.js +0 -42
  30. package/dist/useTabPanel.module.js.map +0 -1
  31. package/dist/utils.main.js +0 -29
  32. package/dist/utils.main.js.map +0 -1
  33. package/dist/utils.mjs +0 -23
  34. package/dist/utils.module.js +0 -23
  35. package/dist/utils.module.js.map +0 -1
  36. package/src/TabsKeyboardDelegate.ts +0 -98
  37. package/src/useTab.ts +0 -82
  38. package/src/useTabList.ts +0 -75
  39. package/src/useTabPanel.ts +0 -47
  40. package/src/utils.ts +0 -33
package/dist/import.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import {useTab as $0175d55c2a017ebc$export$fdf4756d5b8ef90a} from "./useTab.mjs";
2
- import {useTabPanel as $34bce698202e07cb$export$fae0121b5afe572d} from "./useTabPanel.mjs";
3
- import {useTabList as $58d314389b21fa3f$export$773e389e644c5874} from "./useTabList.mjs";
1
+ import {useTab as $54f604a4130a0f3c$re_export$useTab, useTabPanel as $54f604a4130a0f3c$re_export$useTabPanel, useTabList as $54f604a4130a0f3c$re_export$useTabList} from "react-aria/useTabList";
4
2
 
5
3
  /*
6
4
  * Copyright 2020 Adobe. All rights reserved.
@@ -15,7 +13,5 @@ import {useTabList as $58d314389b21fa3f$export$773e389e644c5874} from "./useTabL
15
13
  */
16
14
 
17
15
 
18
-
19
-
20
- export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab, $34bce698202e07cb$export$fae0121b5afe572d as useTabPanel, $58d314389b21fa3f$export$773e389e644c5874 as useTabList};
16
+ export {$54f604a4130a0f3c$re_export$useTab as useTab, $54f604a4130a0f3c$re_export$useTabPanel as useTabPanel, $54f604a4130a0f3c$re_export$useTabList as useTabList};
21
17
  //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,15 +1,13 @@
1
- var $4eeea1c984cc0628$exports = require("./useTab.main.js");
2
- var $8db1928b18472a1f$exports = require("./useTabPanel.main.js");
3
- var $f2b4a4926440e901$exports = require("./useTabList.main.js");
1
+ var $98sn8$reactariauseTabList = require("react-aria/useTabList");
4
2
 
5
3
 
6
4
  function $parcel$export(e, n, v, s) {
7
5
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
8
6
  }
9
7
 
10
- $parcel$export(module.exports, "useTab", () => $4eeea1c984cc0628$exports.useTab);
11
- $parcel$export(module.exports, "useTabPanel", () => $8db1928b18472a1f$exports.useTabPanel);
12
- $parcel$export(module.exports, "useTabList", () => $f2b4a4926440e901$exports.useTabList);
8
+ $parcel$export(module.exports, "useTab", function () { return $98sn8$reactariauseTabList.useTab; });
9
+ $parcel$export(module.exports, "useTabPanel", function () { return $98sn8$reactariauseTabList.useTabPanel; });
10
+ $parcel$export(module.exports, "useTabList", function () { return $98sn8$reactariauseTabList.useTabList; });
13
11
  /*
14
12
  * Copyright 2020 Adobe. All rights reserved.
15
13
  * This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -23,6 +21,4 @@ $parcel$export(module.exports, "useTabList", () => $f2b4a4926440e901$exports.use
23
21
  */
24
22
 
25
23
 
26
-
27
-
28
24
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/tabs/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/tabs/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab, useTabPanel, useTabList} from 'react-aria/useTabList';\n\nexport type {AriaTabProps, TabAria, AriaTabPanelProps, TabPanelAria, AriaTabListProps, AriaTabListOptions, TabListAria} from 'react-aria/useTabList';\nexport type {Orientation} from '@react-types/shared';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,6 +1,4 @@
1
- import {useTab as $0175d55c2a017ebc$export$fdf4756d5b8ef90a} from "./useTab.module.js";
2
- import {useTabPanel as $34bce698202e07cb$export$fae0121b5afe572d} from "./useTabPanel.module.js";
3
- import {useTabList as $58d314389b21fa3f$export$773e389e644c5874} from "./useTabList.module.js";
1
+ import {useTab as $54f604a4130a0f3c$re_export$useTab, useTabPanel as $54f604a4130a0f3c$re_export$useTabPanel, useTabList as $54f604a4130a0f3c$re_export$useTabList} from "react-aria/useTabList";
4
2
 
5
3
  /*
6
4
  * Copyright 2020 Adobe. All rights reserved.
@@ -15,7 +13,5 @@ import {useTabList as $58d314389b21fa3f$export$773e389e644c5874} from "./useTabL
15
13
  */
16
14
 
17
15
 
18
-
19
-
20
- export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab, $34bce698202e07cb$export$fae0121b5afe572d as useTabPanel, $58d314389b21fa3f$export$773e389e644c5874 as useTabList};
16
+ export {$54f604a4130a0f3c$re_export$useTab as useTab, $54f604a4130a0f3c$re_export$useTabPanel as useTabPanel, $54f604a4130a0f3c$re_export$useTabList as useTabList};
21
17
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/tabs/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n"],"names":[],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/tabs/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useTab, useTabPanel, useTabList} from 'react-aria/useTabList';\n\nexport type {AriaTabProps, TabAria, AriaTabPanelProps, TabPanelAria, AriaTabListProps, AriaTabListOptions, TabListAria} from 'react-aria/useTabList';\nexport type {Orientation} from '@react-types/shared';\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,3 @@
1
+ export { useTab, useTabPanel, useTabList } from 'react-aria/useTabList';
2
+ export type { AriaTabProps, TabAria, AriaTabPanelProps, TabPanelAria, AriaTabListProps, AriaTabListOptions, TabListAria } from 'react-aria/useTabList';
3
+ export type { Orientation } from '@react-types/shared';
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@react-aria/tabs",
3
- "version": "3.11.0",
3
+ "version": "3.12.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
- "source": "./src/index.ts",
10
- "types": [
11
- "./dist/types.d.ts",
12
- "./src/index.ts"
13
- ],
14
- "import": "./dist/import.mjs",
15
- "require": "./dist/main.js"
9
+ ".": {
10
+ "source": "./src/index.ts",
11
+ "types": "./dist/types/src/index.d.ts",
12
+ "import": "./dist/import.mjs",
13
+ "require": "./dist/main.js"
14
+ },
15
+ "./package.json": "./package.json"
16
16
  },
17
- "types": "dist/types.d.ts",
17
+ "types": "dist/types/src/index.d.ts",
18
18
  "source": "src/index.ts",
19
19
  "files": [
20
20
  "dist",
@@ -26,14 +26,9 @@
26
26
  "url": "https://github.com/adobe/react-spectrum"
27
27
  },
28
28
  "dependencies": {
29
- "@react-aria/focus": "^3.21.4",
30
- "@react-aria/i18n": "^3.12.15",
31
- "@react-aria/selection": "^3.27.1",
32
- "@react-aria/utils": "^3.33.0",
33
- "@react-stately/tabs": "^3.8.8",
34
- "@react-types/shared": "^3.33.0",
35
- "@react-types/tabs": "^3.3.21",
36
- "@swc/helpers": "^0.5.0"
29
+ "@react-types/shared": "^3.34.0",
30
+ "@swc/helpers": "^0.5.0",
31
+ "react-aria": "3.48.0"
37
32
  },
38
33
  "peerDependencies": {
39
34
  "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
@@ -42,5 +37,8 @@
42
37
  "publishConfig": {
43
38
  "access": "public"
44
39
  },
45
- "gitHead": "66e51757606b43a89ed02c574ca24517323a2ab9"
40
+ "targets": {
41
+ "types": false
42
+ },
43
+ "gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
46
44
  }
package/src/index.ts CHANGED
@@ -9,11 +9,7 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- export {useTab} from './useTab';
13
- export {useTabPanel} from './useTabPanel';
14
- export {useTabList} from './useTabList';
15
- export type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';
12
+ export {useTab, useTabPanel, useTabList} from 'react-aria/useTabList';
13
+
14
+ export type {AriaTabProps, TabAria, AriaTabPanelProps, TabPanelAria, AriaTabListProps, AriaTabListOptions, TabListAria} from 'react-aria/useTabList';
16
15
  export type {Orientation} from '@react-types/shared';
17
- export type {TabAria} from './useTab';
18
- export type {TabPanelAria} from './useTabPanel';
19
- export type {AriaTabListOptions, TabListAria} from './useTabList';
@@ -1,73 +0,0 @@
1
-
2
- function $parcel$export(e, n, v, s) {
3
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
- }
5
-
6
- $parcel$export(module.exports, "TabsKeyboardDelegate", () => $283e5d8830177ead$export$15010ca3c1abe90b);
7
- /*
8
- * Copyright 2020 Adobe. All rights reserved.
9
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
- * you may not use this file except in compliance with the License. You may obtain a copy
11
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing, software distributed under
14
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
- * OF ANY KIND, either express or implied. See the License for the specific language
16
- * governing permissions and limitations under the License.
17
- */ class $283e5d8830177ead$export$15010ca3c1abe90b {
18
- getKeyLeftOf(key) {
19
- if (this.flipDirection) return this.getNextKey(key);
20
- return this.getPreviousKey(key);
21
- }
22
- getKeyRightOf(key) {
23
- if (this.flipDirection) return this.getPreviousKey(key);
24
- return this.getNextKey(key);
25
- }
26
- isDisabled(key) {
27
- var _this_collection_getItem_props, _this_collection_getItem;
28
- return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
29
- }
30
- getFirstKey() {
31
- let key = this.collection.getFirstKey();
32
- if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
33
- return key;
34
- }
35
- getLastKey() {
36
- let key = this.collection.getLastKey();
37
- if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
38
- return key;
39
- }
40
- getKeyAbove(key) {
41
- if (this.tabDirection) return null;
42
- return this.getPreviousKey(key);
43
- }
44
- getKeyBelow(key) {
45
- if (this.tabDirection) return null;
46
- return this.getNextKey(key);
47
- }
48
- getNextKey(startKey) {
49
- let key = startKey;
50
- do {
51
- key = this.collection.getKeyAfter(key);
52
- if (key == null) key = this.collection.getFirstKey();
53
- }while (key != null && this.isDisabled(key));
54
- return key;
55
- }
56
- getPreviousKey(startKey) {
57
- let key = startKey;
58
- do {
59
- key = this.collection.getKeyBefore(key);
60
- if (key == null) key = this.collection.getLastKey();
61
- }while (key != null && this.isDisabled(key));
62
- return key;
63
- }
64
- constructor(collection, direction, orientation, disabledKeys = new Set()){
65
- this.collection = collection;
66
- this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
67
- this.disabledKeys = disabledKeys;
68
- this.tabDirection = orientation === 'horizontal';
69
- }
70
- }
71
-
72
-
73
- //# sourceMappingURL=TabsKeyboardDelegate.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAaX,aAAa,GAAQ,EAAc;QACjC,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,UAAU,CAAC;QAEzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,cAAc,GAAQ,EAAc;QAClC,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,cAAc,CAAC;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAGQ,WAAW,GAAQ,EAAE;YACY,gCAAA;QAAvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAC,2BAAA,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAxB,gDAAA,iCAAA,yBAA8B,KAAK,cAAnC,qDAAA,+BAAqC,UAAU;IACxF;IAEA,cAA0B;QACxB,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QACrC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,UAAU,CAAC;QAExB,OAAO;IACT;IAEA,aAAyB;QACvB,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QACpC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,cAAc,CAAC;QAE5B,OAAO;IACT;IAEA,YAAY,GAAQ,EAAc;QAChC,IAAI,IAAI,CAAC,YAAY,EACnB,OAAO;QAET,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,YAAY,GAAQ,EAAc;QAChC,IAAI,IAAI,CAAC,YAAY,EACnB,OAAO;QAET,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEA,WAAW,QAAa,EAAc;QACpC,IAAI,MAAkB;QACtB,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAClC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QAErC,QAAS,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MAAM;QAC9C,OAAO;IACT;IAEA,eAAe,QAAa,EAAc;QACxC,IAAI,MAAkB;QACtB,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YACnC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QAEpC,QAAS,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MAAM;QAC9C,OAAO;IACT;IA5EA,YAAY,UAA+B,EAAE,SAAoB,EAAE,WAAwB,EAAE,eAAyB,IAAI,KAAK,CAAE;QAC/H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,GAAG,cAAc,SAAS,gBAAgB;QAC5D,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,YAAY,GAAG,gBAAgB;IACtC;AAwEF","sources":["packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n private tabDirection: boolean;\n\n constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal';\n this.disabledKeys = disabledKeys;\n this.tabDirection = orientation === 'horizontal';\n }\n\n getKeyLeftOf(key: Key): Key | null {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key): Key | null {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n }\n return this.getNextKey(key);\n }\n\n\n private isDisabled(key: Key) {\n return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;\n }\n\n getFirstKey(): Key | null {\n let key = this.collection.getFirstKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey(): Key | null {\n let key = this.collection.getLastKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getKeyAbove(key: Key): Key | null {\n if (this.tabDirection) {\n return null;\n }\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key): Key | null {\n if (this.tabDirection) {\n return null;\n }\n return this.getNextKey(key);\n }\n\n getNextKey(startKey: Key): Key | null {\n let key: Key | null = startKey;\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (key != null && this.isDisabled(key));\n return key;\n }\n\n getPreviousKey(startKey: Key): Key | null {\n let key: Key | null = startKey;\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (key != null && this.isDisabled(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"TabsKeyboardDelegate.main.js.map"}
@@ -1,68 +0,0 @@
1
- /*
2
- * Copyright 2020 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
- */ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
12
- getKeyLeftOf(key) {
13
- if (this.flipDirection) return this.getNextKey(key);
14
- return this.getPreviousKey(key);
15
- }
16
- getKeyRightOf(key) {
17
- if (this.flipDirection) return this.getPreviousKey(key);
18
- return this.getNextKey(key);
19
- }
20
- isDisabled(key) {
21
- var _this_collection_getItem_props, _this_collection_getItem;
22
- return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
23
- }
24
- getFirstKey() {
25
- let key = this.collection.getFirstKey();
26
- if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
27
- return key;
28
- }
29
- getLastKey() {
30
- let key = this.collection.getLastKey();
31
- if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
32
- return key;
33
- }
34
- getKeyAbove(key) {
35
- if (this.tabDirection) return null;
36
- return this.getPreviousKey(key);
37
- }
38
- getKeyBelow(key) {
39
- if (this.tabDirection) return null;
40
- return this.getNextKey(key);
41
- }
42
- getNextKey(startKey) {
43
- let key = startKey;
44
- do {
45
- key = this.collection.getKeyAfter(key);
46
- if (key == null) key = this.collection.getFirstKey();
47
- }while (key != null && this.isDisabled(key));
48
- return key;
49
- }
50
- getPreviousKey(startKey) {
51
- let key = startKey;
52
- do {
53
- key = this.collection.getKeyBefore(key);
54
- if (key == null) key = this.collection.getLastKey();
55
- }while (key != null && this.isDisabled(key));
56
- return key;
57
- }
58
- constructor(collection, direction, orientation, disabledKeys = new Set()){
59
- this.collection = collection;
60
- this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
61
- this.disabledKeys = disabledKeys;
62
- this.tabDirection = orientation === 'horizontal';
63
- }
64
- }
65
-
66
-
67
- export {$bfc6f2d60b8a4c40$export$15010ca3c1abe90b as TabsKeyboardDelegate};
68
- //# sourceMappingURL=TabsKeyboardDelegate.module.js.map
@@ -1,68 +0,0 @@
1
- /*
2
- * Copyright 2020 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
- */ class $bfc6f2d60b8a4c40$export$15010ca3c1abe90b {
12
- getKeyLeftOf(key) {
13
- if (this.flipDirection) return this.getNextKey(key);
14
- return this.getPreviousKey(key);
15
- }
16
- getKeyRightOf(key) {
17
- if (this.flipDirection) return this.getPreviousKey(key);
18
- return this.getNextKey(key);
19
- }
20
- isDisabled(key) {
21
- var _this_collection_getItem_props, _this_collection_getItem;
22
- return this.disabledKeys.has(key) || !!((_this_collection_getItem = this.collection.getItem(key)) === null || _this_collection_getItem === void 0 ? void 0 : (_this_collection_getItem_props = _this_collection_getItem.props) === null || _this_collection_getItem_props === void 0 ? void 0 : _this_collection_getItem_props.isDisabled);
23
- }
24
- getFirstKey() {
25
- let key = this.collection.getFirstKey();
26
- if (key != null && this.isDisabled(key)) key = this.getNextKey(key);
27
- return key;
28
- }
29
- getLastKey() {
30
- let key = this.collection.getLastKey();
31
- if (key != null && this.isDisabled(key)) key = this.getPreviousKey(key);
32
- return key;
33
- }
34
- getKeyAbove(key) {
35
- if (this.tabDirection) return null;
36
- return this.getPreviousKey(key);
37
- }
38
- getKeyBelow(key) {
39
- if (this.tabDirection) return null;
40
- return this.getNextKey(key);
41
- }
42
- getNextKey(startKey) {
43
- let key = startKey;
44
- do {
45
- key = this.collection.getKeyAfter(key);
46
- if (key == null) key = this.collection.getFirstKey();
47
- }while (key != null && this.isDisabled(key));
48
- return key;
49
- }
50
- getPreviousKey(startKey) {
51
- let key = startKey;
52
- do {
53
- key = this.collection.getKeyBefore(key);
54
- if (key == null) key = this.collection.getLastKey();
55
- }while (key != null && this.isDisabled(key));
56
- return key;
57
- }
58
- constructor(collection, direction, orientation, disabledKeys = new Set()){
59
- this.collection = collection;
60
- this.flipDirection = direction === 'rtl' && orientation === 'horizontal';
61
- this.disabledKeys = disabledKeys;
62
- this.tabDirection = orientation === 'horizontal';
63
- }
64
- }
65
-
66
-
67
- export {$bfc6f2d60b8a4c40$export$15010ca3c1abe90b as TabsKeyboardDelegate};
68
- //# sourceMappingURL=TabsKeyboardDelegate.module.js.map
@@ -1 +0,0 @@
1
- {"mappings":"AAAA;;;;;;;;;;CAUC,GAIM,MAAM;IAaX,aAAa,GAAQ,EAAc;QACjC,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,UAAU,CAAC;QAEzB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,cAAc,GAAQ,EAAc;QAClC,IAAI,IAAI,CAAC,aAAa,EACpB,OAAO,IAAI,CAAC,cAAc,CAAC;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAGQ,WAAW,GAAQ,EAAE;YACY,gCAAA;QAAvC,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAC,2BAAA,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAxB,gDAAA,iCAAA,yBAA8B,KAAK,cAAnC,qDAAA,+BAAqC,UAAU;IACxF;IAEA,cAA0B;QACxB,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QACrC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,UAAU,CAAC;QAExB,OAAO;IACT;IAEA,aAAyB;QACvB,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QACpC,IAAI,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MACjC,MAAM,IAAI,CAAC,cAAc,CAAC;QAE5B,OAAO;IACT;IAEA,YAAY,GAAQ,EAAc;QAChC,IAAI,IAAI,CAAC,YAAY,EACnB,OAAO;QAET,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B;IAEA,YAAY,GAAQ,EAAc;QAChC,IAAI,IAAI,CAAC,YAAY,EACnB,OAAO;QAET,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB;IAEA,WAAW,QAAa,EAAc;QACpC,IAAI,MAAkB;QACtB,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC;YAClC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW;QAErC,QAAS,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MAAM;QAC9C,OAAO;IACT;IAEA,eAAe,QAAa,EAAc;QACxC,IAAI,MAAkB;QACtB,GAAG;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC;YACnC,IAAI,OAAO,MACT,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU;QAEpC,QAAS,OAAO,QAAQ,IAAI,CAAC,UAAU,CAAC,MAAM;QAC9C,OAAO;IACT;IA5EA,YAAY,UAA+B,EAAE,SAAoB,EAAE,WAAwB,EAAE,eAAyB,IAAI,KAAK,CAAE;QAC/H,IAAI,CAAC,UAAU,GAAG;QAClB,IAAI,CAAC,aAAa,GAAG,cAAc,SAAS,gBAAgB;QAC5D,IAAI,CAAC,YAAY,GAAG;QACpB,IAAI,CAAC,YAAY,GAAG,gBAAgB;IACtC;AAwEF","sources":["packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, Direction, Key, KeyboardDelegate, Node, Orientation} from '@react-types/shared';\n\nexport class TabsKeyboardDelegate<T> implements KeyboardDelegate {\n private collection: Collection<Node<T>>;\n private flipDirection: boolean;\n private disabledKeys: Set<Key>;\n private tabDirection: boolean;\n\n constructor(collection: Collection<Node<T>>, direction: Direction, orientation: Orientation, disabledKeys: Set<Key> = new Set()) {\n this.collection = collection;\n this.flipDirection = direction === 'rtl' && orientation === 'horizontal';\n this.disabledKeys = disabledKeys;\n this.tabDirection = orientation === 'horizontal';\n }\n\n getKeyLeftOf(key: Key): Key | null {\n if (this.flipDirection) {\n return this.getNextKey(key);\n }\n return this.getPreviousKey(key);\n }\n\n getKeyRightOf(key: Key): Key | null {\n if (this.flipDirection) {\n return this.getPreviousKey(key);\n }\n return this.getNextKey(key);\n }\n\n\n private isDisabled(key: Key) {\n return this.disabledKeys.has(key) || !!this.collection.getItem(key)?.props?.isDisabled;\n }\n\n getFirstKey(): Key | null {\n let key = this.collection.getFirstKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getNextKey(key);\n }\n return key;\n }\n\n getLastKey(): Key | null {\n let key = this.collection.getLastKey();\n if (key != null && this.isDisabled(key)) {\n key = this.getPreviousKey(key);\n }\n return key;\n }\n\n getKeyAbove(key: Key): Key | null {\n if (this.tabDirection) {\n return null;\n }\n return this.getPreviousKey(key);\n }\n\n getKeyBelow(key: Key): Key | null {\n if (this.tabDirection) {\n return null;\n }\n return this.getNextKey(key);\n }\n\n getNextKey(startKey: Key): Key | null {\n let key: Key | null = startKey;\n do {\n key = this.collection.getKeyAfter(key);\n if (key == null) {\n key = this.collection.getFirstKey();\n }\n } while (key != null && this.isDisabled(key));\n return key;\n }\n\n getPreviousKey(startKey: Key): Key | null {\n let key: Key | null = startKey;\n do {\n key = this.collection.getKeyBefore(key);\n if (key == null) {\n key = this.collection.getLastKey();\n }\n } while (key != null && this.isDisabled(key));\n return key;\n }\n}\n"],"names":[],"version":3,"file":"TabsKeyboardDelegate.module.js.map"}
package/dist/types.d.ts DELETED
@@ -1,42 +0,0 @@
1
- import { AriaTabProps, AriaTabPanelProps, AriaTabListProps } from "@react-types/tabs";
2
- import { DOMAttributes, FocusableElement, RefObject } from "@react-types/shared";
3
- import { TabListState } from "@react-stately/tabs";
4
- export interface TabAria {
5
- /** Props for the tab element. */
6
- tabProps: DOMAttributes;
7
- /** Whether the tab is currently selected. */
8
- isSelected: boolean;
9
- /** Whether the tab is disabled. */
10
- isDisabled: boolean;
11
- /** Whether the tab is currently in a pressed state. */
12
- isPressed: boolean;
13
- }
14
- /**
15
- * Provides the behavior and accessibility implementation for a tab.
16
- * When selected, the associated tab panel is shown.
17
- */
18
- export function useTab<T>(props: AriaTabProps, state: TabListState<T>, ref: RefObject<FocusableElement | null>): TabAria;
19
- export interface TabPanelAria {
20
- /** Props for the tab panel element. */
21
- tabPanelProps: DOMAttributes;
22
- }
23
- /**
24
- * Provides the behavior and accessibility implementation for a tab panel. A tab panel is a container for
25
- * the contents of a tab, and is shown when the tab is selected.
26
- */
27
- export function useTabPanel<T>(props: AriaTabPanelProps, state: TabListState<T> | null, ref: RefObject<Element | null>): TabPanelAria;
28
- export interface AriaTabListOptions<T> extends Omit<AriaTabListProps<T>, 'children'> {
29
- }
30
- export interface TabListAria {
31
- /** Props for the tablist container. */
32
- tabListProps: DOMAttributes;
33
- }
34
- /**
35
- * Provides the behavior and accessibility implementation for a tab list.
36
- * Tabs organize content into multiple sections and allow users to navigate between them.
37
- */
38
- export function useTabList<T>(props: AriaTabListOptions<T>, state: TabListState<T>, ref: RefObject<HTMLElement | null>): TabListAria;
39
- export type { AriaTabListProps, AriaTabPanelProps, AriaTabProps } from '@react-types/tabs';
40
- export type { Orientation } from '@react-types/shared';
41
-
42
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"mappings":";;;ACoBA;IACE,iCAAiC;IACjC,QAAQ,EAAE,aAAa,CAAC;IACxB,6CAA6C;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB,mCAAmC;IACnC,UAAU,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,uBAAuB,CAAC,EACtB,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,aAAa,CAAC,CAAC,EACtB,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GACtC,OAAO,CA0CT;AC9DD;IACE,uCAAuC;IACvC,aAAa,EAAE,aAAa,CAAA;CAC7B;AAGD;;;GAGG;AACH,4BAA4B,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,UAAU,OAAO,GAAG,IAAI,CAAC,GAAG,YAAY,CAiBpI;AExBD,oCAAoC,CAAC,CAAE,SAAQ,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,UAAU,CAAC;CAAG;AAEvF;IACE,uCAAuC;IACvC,YAAY,EAAE,aAAa,CAAA;CAC5B;AAED;;;GAGG;AACH,2BAA2B,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,GAAG,IAAI,CAAC,GAAG,WAAW,CAyCnI;AC5DD,YAAY,EAAC,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AACzF,YAAY,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/utils.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/useTab.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/useTabPanel.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/TabsKeyboardDelegate.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/useTabList.ts","packages/@react-aria/tabs/src/packages/@react-aria/tabs/src/index.ts","packages/@react-aria/tabs/src/index.ts"],"sourcesContent":[null,null,null,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 */\nexport {useTab} from './useTab';\nexport {useTabPanel} from './useTabPanel';\nexport {useTabList} from './useTabList';\nexport type {AriaTabListProps, AriaTabPanelProps, AriaTabProps} from '@react-types/tabs';\nexport type {Orientation} from '@react-types/shared';\nexport type {TabAria} from './useTab';\nexport type {TabPanelAria} from './useTabPanel';\nexport type {AriaTabListOptions, TabListAria} from './useTabList';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -1,68 +0,0 @@
1
- var $a217ebca77471970$exports = require("./utils.main.js");
2
- var $dX61C$reactariautils = require("@react-aria/utils");
3
- var $dX61C$reactariafocus = require("@react-aria/focus");
4
- var $dX61C$reactariaselection = require("@react-aria/selection");
5
-
6
-
7
- function $parcel$export(e, n, v, s) {
8
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
9
- }
10
-
11
- $parcel$export(module.exports, "useTab", () => $4eeea1c984cc0628$export$fdf4756d5b8ef90a);
12
- /*
13
- * Copyright 2020 Adobe. All rights reserved.
14
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
15
- * you may not use this file except in compliance with the License. You may obtain a copy
16
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software distributed under
19
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
20
- * OF ANY KIND, either express or implied. See the License for the specific language
21
- * governing permissions and limitations under the License.
22
- */
23
-
24
-
25
-
26
- function $4eeea1c984cc0628$export$fdf4756d5b8ef90a(props, state, ref) {
27
- let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
28
- let { selectionManager: manager, selectedKey: selectedKey } = state;
29
- let isSelected = key === selectedKey;
30
- let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
31
- let { itemProps: itemProps, isPressed: isPressed } = (0, $dX61C$reactariaselection.useSelectableItem)({
32
- selectionManager: manager,
33
- key: key,
34
- ref: ref,
35
- isDisabled: isDisabled,
36
- shouldSelectOnPressUp: shouldSelectOnPressUp,
37
- linkBehavior: 'selection'
38
- });
39
- let tabId = (0, $a217ebca77471970$exports.generateId)(state, key, 'tab');
40
- let tabPanelId = (0, $a217ebca77471970$exports.generateId)(state, key, 'tabpanel');
41
- let { tabIndex: tabIndex } = itemProps;
42
- let item = state.collection.getItem(key);
43
- let domProps = (0, $dX61C$reactariautils.filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
44
- labelable: true
45
- });
46
- delete domProps.id;
47
- let linkProps = (0, $dX61C$reactariautils.useLinkProps)(item === null || item === void 0 ? void 0 : item.props);
48
- let { focusableProps: focusableProps } = (0, $dX61C$reactariafocus.useFocusable)({
49
- ...item === null || item === void 0 ? void 0 : item.props,
50
- isDisabled: isDisabled
51
- }, ref);
52
- return {
53
- tabProps: (0, $dX61C$reactariautils.mergeProps)(domProps, focusableProps, linkProps, itemProps, {
54
- id: tabId,
55
- 'aria-selected': isSelected,
56
- 'aria-disabled': isDisabled || undefined,
57
- 'aria-controls': isSelected ? tabPanelId : undefined,
58
- tabIndex: isDisabled ? undefined : tabIndex,
59
- role: 'tab'
60
- }),
61
- isSelected: isSelected,
62
- isDisabled: isDisabled,
63
- isPressed: isPressed
64
- };
65
- }
66
-
67
-
68
- //# sourceMappingURL=useTab.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;AAyBM,SAAS,0CACd,KAAmB,EACnB,KAAsB,EACtB,GAAuC;IAEvC,IAAI,OAAC,GAAG,EAAE,YAAY,aAAa,yBAAE,qBAAqB,EAAC,GAAG;IAC9D,IAAI,EAAC,kBAAkB,OAAO,eAAE,WAAW,EAAC,GAAG;IAE/C,IAAI,aAAa,QAAQ;IAEzB,IAAI,aAAa,iBAAiB,MAAM,UAAU,IAAI,MAAM,gBAAgB,CAAC,UAAU,CAAC;IACxF,IAAI,aAAC,SAAS,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE;QAC7C,kBAAkB;aAClB;aACA;oBACA;+BACA;QACA,cAAc;IAChB;IAEA,IAAI,QAAQ,CAAA,GAAA,oCAAS,EAAE,OAAO,KAAK;IACnC,IAAI,aAAa,CAAA,GAAA,oCAAS,EAAE,OAAO,KAAK;IACxC,IAAI,YAAC,QAAQ,EAAC,GAAG;IAEjB,IAAI,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC;IACpC,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,iBAAA,2BAAA,KAAM,KAAK,EAAE;QAAC,WAAW;IAAI;IAC3D,OAAO,SAAS,EAAE;IAClB,IAAI,YAAY,CAAA,GAAA,kCAAW,EAAE,iBAAA,2BAAA,KAAM,KAAK;IACxC,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,kCAAW,EAAE;WAC/B,iBAAA,2BAAA,KAAM,KAAK,AAAd;oBACA;IACF,GAAG;IAEH,OAAO;QACL,UAAU,CAAA,GAAA,gCAAS,EAAE,UAAU,gBAAgB,WAAW,WAAW;YACnE,IAAI;YACJ,iBAAiB;YACjB,iBAAiB,cAAc;YAC/B,iBAAiB,aAAa,aAAa;YAC3C,UAAU,aAAa,YAAY;YACnC,MAAM;QACR;oBACA;oBACA;mBACA;IACF;AACF","sources":["packages/@react-aria/tabs/src/useTab.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaTabProps} from '@react-types/tabs';\nimport {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useLinkProps} from '@react-aria/utils';\nimport {generateId} from './utils';\nimport {TabListState} from '@react-stately/tabs';\nimport {useFocusable} from '@react-aria/focus';\nimport {useSelectableItem} from '@react-aria/selection';\n\nexport interface TabAria {\n /** Props for the tab element. */\n tabProps: DOMAttributes,\n /** Whether the tab is currently selected. */\n isSelected: boolean,\n /** Whether the tab is disabled. */\n isDisabled: boolean,\n /** Whether the tab is currently in a pressed state. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a tab.\n * When selected, the associated tab panel is shown.\n */\nexport function useTab<T>(\n props: AriaTabProps,\n state: TabListState<T>,\n ref: RefObject<FocusableElement | null>\n): TabAria {\n let {key, isDisabled: propsDisabled, shouldSelectOnPressUp} = props;\n let {selectionManager: manager, selectedKey} = state;\n\n let isSelected = key === selectedKey;\n\n let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);\n let {itemProps, isPressed} = useSelectableItem({\n selectionManager: manager,\n key,\n ref,\n isDisabled,\n shouldSelectOnPressUp,\n linkBehavior: 'selection'\n });\n\n let tabId = generateId(state, key, 'tab');\n let tabPanelId = generateId(state, key, 'tabpanel');\n let {tabIndex} = itemProps;\n\n let item = state.collection.getItem(key);\n let domProps = filterDOMProps(item?.props, {labelable: true});\n delete domProps.id;\n let linkProps = useLinkProps(item?.props);\n let {focusableProps} = useFocusable({\n ...item?.props,\n isDisabled\n }, ref);\n\n return {\n tabProps: mergeProps(domProps, focusableProps, linkProps, itemProps, {\n id: tabId,\n 'aria-selected': isSelected,\n 'aria-disabled': isDisabled || undefined,\n 'aria-controls': isSelected ? tabPanelId : undefined,\n tabIndex: isDisabled ? undefined : tabIndex,\n role: 'tab'\n }),\n isSelected,\n isDisabled,\n isPressed\n };\n}\n"],"names":[],"version":3,"file":"useTab.main.js.map"}
package/dist/useTab.mjs DELETED
@@ -1,63 +0,0 @@
1
- import {generateId as $99b62ae3ff97ec45$export$567fc7097e064344} from "./utils.mjs";
2
- import {filterDOMProps as $dObGJ$filterDOMProps, useLinkProps as $dObGJ$useLinkProps, mergeProps as $dObGJ$mergeProps} from "@react-aria/utils";
3
- import {useFocusable as $dObGJ$useFocusable} from "@react-aria/focus";
4
- import {useSelectableItem as $dObGJ$useSelectableItem} from "@react-aria/selection";
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 $0175d55c2a017ebc$export$fdf4756d5b8ef90a(props, state, ref) {
21
- let { key: key, isDisabled: propsDisabled, shouldSelectOnPressUp: shouldSelectOnPressUp } = props;
22
- let { selectionManager: manager, selectedKey: selectedKey } = state;
23
- let isSelected = key === selectedKey;
24
- let isDisabled = propsDisabled || state.isDisabled || state.selectionManager.isDisabled(key);
25
- let { itemProps: itemProps, isPressed: isPressed } = (0, $dObGJ$useSelectableItem)({
26
- selectionManager: manager,
27
- key: key,
28
- ref: ref,
29
- isDisabled: isDisabled,
30
- shouldSelectOnPressUp: shouldSelectOnPressUp,
31
- linkBehavior: 'selection'
32
- });
33
- let tabId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, 'tab');
34
- let tabPanelId = (0, $99b62ae3ff97ec45$export$567fc7097e064344)(state, key, 'tabpanel');
35
- let { tabIndex: tabIndex } = itemProps;
36
- let item = state.collection.getItem(key);
37
- let domProps = (0, $dObGJ$filterDOMProps)(item === null || item === void 0 ? void 0 : item.props, {
38
- labelable: true
39
- });
40
- delete domProps.id;
41
- let linkProps = (0, $dObGJ$useLinkProps)(item === null || item === void 0 ? void 0 : item.props);
42
- let { focusableProps: focusableProps } = (0, $dObGJ$useFocusable)({
43
- ...item === null || item === void 0 ? void 0 : item.props,
44
- isDisabled: isDisabled
45
- }, ref);
46
- return {
47
- tabProps: (0, $dObGJ$mergeProps)(domProps, focusableProps, linkProps, itemProps, {
48
- id: tabId,
49
- 'aria-selected': isSelected,
50
- 'aria-disabled': isDisabled || undefined,
51
- 'aria-controls': isSelected ? tabPanelId : undefined,
52
- tabIndex: isDisabled ? undefined : tabIndex,
53
- role: 'tab'
54
- }),
55
- isSelected: isSelected,
56
- isDisabled: isDisabled,
57
- isPressed: isPressed
58
- };
59
- }
60
-
61
-
62
- export {$0175d55c2a017ebc$export$fdf4756d5b8ef90a as useTab};
63
- //# sourceMappingURL=useTab.module.js.map