@react-stately/tabs 3.0.0-rc.0 → 3.0.3
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/main.js +44 -27
- package/dist/main.js.map +1 -1
- package/dist/module.js +35 -21
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +2 -2
- package/src/{useTabsState.ts → useTabListState.ts} +5 -0
package/dist/main.js
CHANGED
|
@@ -1,36 +1,53 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
} = require("react");
|
|
1
|
+
var $2jh56$reactstatelylist = require("@react-stately/list");
|
|
2
|
+
var $2jh56$react = require("react");
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
function $parcel$exportWildcard(dest, source) {
|
|
5
|
+
Object.keys(source).forEach(function(key) {
|
|
6
|
+
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
Object.defineProperty(dest, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return source[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
10
17
|
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
return dest;
|
|
19
|
+
}
|
|
20
|
+
function $parcel$export(e, n, v, s) {
|
|
21
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
22
|
}
|
|
23
|
+
var $c990352501f33d9e$exports = {};
|
|
14
24
|
|
|
15
|
-
|
|
16
|
-
let state = useSingleSelectListState(_babelRuntimeHelpersExtends({}, props, {
|
|
17
|
-
suppressTextValueWarning: true
|
|
18
|
-
}));
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
// Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)
|
|
21
|
-
let selectedKey = state.selectedKey;
|
|
22
|
-
|
|
23
|
-
if (state.selectionManager.isEmpty || !state.collection.getItem(selectedKey)) {
|
|
24
|
-
selectedKey = state.collection.getFirstKey();
|
|
25
|
-
state.selectionManager.replaceSelection(selectedKey);
|
|
26
|
-
}
|
|
25
|
+
$parcel$export($c990352501f33d9e$exports, "useTabListState", () => $c990352501f33d9e$export$4ba071daf4e486);
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
|
|
28
|
+
function $c990352501f33d9e$export$4ba071daf4e486(props) {
|
|
29
|
+
let state = $2jh56$reactstatelylist.useSingleSelectListState({
|
|
30
|
+
...props,
|
|
31
|
+
suppressTextValueWarning: true
|
|
32
|
+
});
|
|
33
|
+
$2jh56$react.useEffect(()=>{
|
|
34
|
+
// Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)
|
|
35
|
+
let selectedKey = state.selectedKey;
|
|
36
|
+
if (state.selectionManager.isEmpty || !state.collection.getItem(selectedKey)) {
|
|
37
|
+
selectedKey = state.collection.getFirstKey();
|
|
38
|
+
state.selectionManager.replaceSelection(selectedKey);
|
|
39
|
+
}
|
|
40
|
+
if (state.selectionManager.focusedKey == null) state.selectionManager.setFocusedKey(selectedKey);
|
|
41
|
+
}, [
|
|
42
|
+
state.selectionManager,
|
|
43
|
+
state.selectedKey,
|
|
44
|
+
state.collection
|
|
45
|
+
]);
|
|
46
|
+
return state;
|
|
33
47
|
}
|
|
34
48
|
|
|
35
|
-
|
|
49
|
+
|
|
50
|
+
$parcel$exportWildcard(module.exports, $c990352501f33d9e$exports);
|
|
51
|
+
|
|
52
|
+
|
|
36
53
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;SCuBgB,uCAAe,CAAmB,KAAsB,EAAmB,CAAC;IAC1F,GAAG,CAAC,KAAK,GAAG,gDAAwB,CAAI,CAAC;WACpC,KAAK;QACR,wBAAwB,EAAE,IAAI;IAChC,CAAC;IAED,sBAAS,KAAO,CAAC;QACf,EAA0H,AAA1H,wHAA0H;QAC1H,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW;QACnC,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,KAAK,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAC7E,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW;YAC1C,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,WAAW;QACrD,CAAC;QAED,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,IAAI,IAAI,EAC3C,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,WAAW;IAEpD,CAAC,EAAE,CAAC;QAAA,KAAK,CAAC,gBAAgB;QAAE,KAAK,CAAC,WAAW;QAAE,KAAK,CAAC,UAAU;IAAA,CAAC;IAEhE,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/tabs/src/index.ts","packages/@react-stately/tabs/src/useTabListState.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\nexport * from './useTabListState';\n","/*\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 {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useEffect} from 'react';\n\n\nexport interface TabListState<T> extends SingleSelectListState<T> {}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true\n });\n\n useEffect(() => {\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = state.selectedKey;\n if (state.selectionManager.isEmpty || !state.collection.getItem(selectedKey)) {\n selectedKey = state.collection.getFirstKey();\n state.selectionManager.replaceSelection(selectedKey);\n }\n\n if (state.selectionManager.focusedKey == null) {\n state.selectionManager.setFocusedKey(selectedKey);\n }\n }, [state.selectionManager, state.selectedKey, state.collection]);\n\n return state;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,23 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import {useSingleSelectListState as $a9c3b$useSingleSelectListState} from "@react-stately/list";
|
|
2
|
+
import {useEffect as $a9c3b$useEffect} from "react";
|
|
3
|
+
|
|
4
|
+
function $parcel$export(e, n, v, s) {
|
|
5
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
|
+
}
|
|
7
|
+
var $ead76093e5740fb6$exports = {};
|
|
8
|
+
|
|
9
|
+
$parcel$export($ead76093e5740fb6$exports, "useTabListState", () => $ead76093e5740fb6$export$4ba071daf4e486);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
function $ead76093e5740fb6$export$4ba071daf4e486(props) {
|
|
13
|
+
let state = $a9c3b$useSingleSelectListState({
|
|
14
|
+
...props,
|
|
15
|
+
suppressTextValueWarning: true
|
|
16
|
+
});
|
|
17
|
+
$a9c3b$useEffect(()=>{
|
|
18
|
+
// Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)
|
|
19
|
+
let selectedKey = state.selectedKey;
|
|
20
|
+
if (state.selectionManager.isEmpty || !state.collection.getItem(selectedKey)) {
|
|
21
|
+
selectedKey = state.collection.getFirstKey();
|
|
22
|
+
state.selectionManager.replaceSelection(selectedKey);
|
|
23
|
+
}
|
|
24
|
+
if (state.selectionManager.focusedKey == null) state.selectionManager.setFocusedKey(selectedKey);
|
|
25
|
+
}, [
|
|
26
|
+
state.selectionManager,
|
|
27
|
+
state.selectedKey,
|
|
28
|
+
state.collection
|
|
29
|
+
]);
|
|
30
|
+
return state;
|
|
22
31
|
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export {$ead76093e5740fb6$export$4ba071daf4e486 as useTabListState};
|
|
23
37
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;;;SCuBgB,uCAAe,CAAmB,KAAsB,EAAmB,CAAC;IAC1F,GAAG,CAAC,KAAK,GAAG,+BAAwB,CAAI,CAAC;WACpC,KAAK;QACR,wBAAwB,EAAE,IAAI;IAChC,CAAC;IAED,gBAAS,KAAO,CAAC;QACf,EAA0H,AAA1H,wHAA0H;QAC1H,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC,WAAW;QACnC,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO,KAAK,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAC7E,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW;YAC1C,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,WAAW;QACrD,CAAC;QAED,EAAE,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,IAAI,IAAI,EAC3C,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,WAAW;IAEpD,CAAC,EAAE,CAAC;QAAA,KAAK,CAAC,gBAAgB;QAAE,KAAK,CAAC,WAAW;QAAE,KAAK,CAAC,UAAU;IAAA,CAAC;IAEhE,MAAM,CAAC,KAAK;AACd,CAAC","sources":["packages/@react-stately/tabs/src/index.ts","packages/@react-stately/tabs/src/useTabListState.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\nexport * from './useTabListState';\n","/*\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 {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useEffect} from 'react';\n\n\nexport interface TabListState<T> extends SingleSelectListState<T> {}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true\n });\n\n useEffect(() => {\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = state.selectedKey;\n if (state.selectionManager.isEmpty || !state.collection.getItem(selectedKey)) {\n selectedKey = state.collection.getFirstKey();\n state.selectionManager.replaceSelection(selectedKey);\n }\n\n if (state.selectionManager.focusedKey == null) {\n state.selectionManager.setFocusedKey(selectedKey);\n }\n }, [state.selectionManager, state.selectedKey, state.collection]);\n\n return state;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { SingleSelectListState } from "@react-stately/list";
|
|
|
2
2
|
import { TabListProps } from "@react-types/tabs";
|
|
3
3
|
export interface TabListState<T> extends SingleSelectListState<T> {
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Provides state management for a Tabs component. Tabs include a TabList which tracks
|
|
7
|
+
* which tab is currently selected and displays the content associated with that Tab in a TabPanel.
|
|
8
|
+
*/
|
|
5
9
|
export function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T>;
|
|
6
10
|
|
|
7
11
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;AAiBA,8BAA8B,CAAC,CAAE,SAAQ,sBAAsB,CAAC,CAAC;CAAG;AAEpE;;;GAGG;AACH,gCAAgC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAoBzF","sources":["packages/@react-stately/tabs/src/packages/@react-stately/tabs/src/useTabListState.ts","packages/@react-stately/tabs/src/packages/@react-stately/tabs/src/index.ts","packages/@react-stately/tabs/src/index.ts"],"sourcesContent":[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 * from './useTabListState';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/tabs",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-stately/list": "^3.
|
|
22
|
-
"@react-stately/utils": "^3.
|
|
23
|
-
"@react-types/tabs": "3.0.
|
|
21
|
+
"@react-stately/list": "^3.4.3",
|
|
22
|
+
"@react-stately/utils": "^3.4.1",
|
|
23
|
+
"@react-types/tabs": "^3.0.3"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
|
|
32
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
8
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
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
12
|
|
|
13
|
-
export * from './
|
|
13
|
+
export * from './useTabListState';
|
|
@@ -14,8 +14,13 @@ import {SingleSelectListState, useSingleSelectListState} from '@react-stately/li
|
|
|
14
14
|
import {TabListProps} from '@react-types/tabs';
|
|
15
15
|
import {useEffect} from 'react';
|
|
16
16
|
|
|
17
|
+
|
|
17
18
|
export interface TabListState<T> extends SingleSelectListState<T> {}
|
|
18
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Provides state management for a Tabs component. Tabs include a TabList which tracks
|
|
22
|
+
* which tab is currently selected and displays the content associated with that Tab in a TabPanel.
|
|
23
|
+
*/
|
|
19
24
|
export function useTabListState<T extends object>(props: TabListProps<T>): TabListState<T> {
|
|
20
25
|
let state = useSingleSelectListState<T>({
|
|
21
26
|
...props,
|