@react-spectrum/tabs 3.1.3-nightly.3111 → 3.1.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 +169 -168
- package/dist/main.js.map +1 -1
- package/dist/module.js +168 -167
- package/dist/module.js.map +1 -1
- package/package.json +20 -20
package/dist/module.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
|
-
import {Item as $
|
|
3
|
-
import {useDOMRef as $
|
|
4
|
-
import {useValueEffect as $
|
|
5
|
-
import {FocusRing as $
|
|
6
|
-
import {Picker as $
|
|
7
|
-
import {ListCollection as $
|
|
8
|
-
import $
|
|
9
|
-
import {useTabListState as $
|
|
10
|
-
import {Text as $
|
|
11
|
-
import {useHover as $
|
|
12
|
-
import {useLocale as $
|
|
13
|
-
import {useProviderProps as $
|
|
14
|
-
import {useTab as $
|
|
2
|
+
import {Item as $4f74368734f0d919$re_export$Item, useCollection as $1GuAi$useCollection} from "@react-stately/collections";
|
|
3
|
+
import {useDOMRef as $1GuAi$useDOMRef, useStyleProps as $1GuAi$useStyleProps, classNames as $1GuAi$classNames, SlotProvider as $1GuAi$SlotProvider, unwrapDOMRef as $1GuAi$unwrapDOMRef} from "@react-spectrum/utils";
|
|
4
|
+
import {useValueEffect as $1GuAi$useValueEffect, useResizeObserver as $1GuAi$useResizeObserver, useId as $1GuAi$useId, filterDOMProps as $1GuAi$filterDOMProps, mergeProps as $1GuAi$mergeProps, useLayoutEffect as $1GuAi$useLayoutEffect} from "@react-aria/utils";
|
|
5
|
+
import {FocusRing as $1GuAi$FocusRing} from "@react-aria/focus";
|
|
6
|
+
import {Picker as $1GuAi$Picker, Item as $1GuAi$Item} from "@react-spectrum/picker";
|
|
7
|
+
import {ListCollection as $1GuAi$ListCollection} from "@react-stately/list";
|
|
8
|
+
import $1GuAi$react, {useRef as $1GuAi$useRef, useState as $1GuAi$useState, useEffect as $1GuAi$useEffect, useCallback as $1GuAi$useCallback, useContext as $1GuAi$useContext} from "react";
|
|
9
|
+
import {useTabListState as $1GuAi$useTabListState} from "@react-stately/tabs";
|
|
10
|
+
import {Text as $1GuAi$Text} from "@react-spectrum/text";
|
|
11
|
+
import {useHover as $1GuAi$useHover} from "@react-aria/interactions";
|
|
12
|
+
import {useLocale as $1GuAi$useLocale} from "@react-aria/i18n";
|
|
13
|
+
import {useProviderProps as $1GuAi$useProviderProps, useProvider as $1GuAi$useProvider} from "@react-spectrum/provider";
|
|
14
|
+
import {useTab as $1GuAi$useTab, useTabList as $1GuAi$useTabList, useTabPanel as $1GuAi$useTabPanel} from "@react-aria/tabs";
|
|
15
15
|
|
|
16
16
|
function $parcel$interopDefault(a) {
|
|
17
17
|
return a && a.__esModule ? a.default : a;
|
|
@@ -19,11 +19,11 @@ function $parcel$interopDefault(a) {
|
|
|
19
19
|
function $parcel$export(e, n, v, s) {
|
|
20
20
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
21
21
|
}
|
|
22
|
-
var $
|
|
22
|
+
var $25c20e9c619a005c$exports = {};
|
|
23
23
|
|
|
24
|
-
$parcel$export($
|
|
25
|
-
$parcel$export($
|
|
26
|
-
$parcel$export($
|
|
24
|
+
$parcel$export($25c20e9c619a005c$exports, "TabList", () => $25c20e9c619a005c$export$e51a686c67fdaa2d);
|
|
25
|
+
$parcel$export($25c20e9c619a005c$exports, "TabPanels", () => $25c20e9c619a005c$export$5dae8d435677f210);
|
|
26
|
+
$parcel$export($25c20e9c619a005c$exports, "Tabs", () => $25c20e9c619a005c$export$b2539bed5023c21c);
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
@@ -31,68 +31,68 @@ $parcel$export($79ffa4f8dcd384fb$exports, "Tabs", () => $79ffa4f8dcd384fb$export
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
var $
|
|
34
|
+
var $c66643a08e89e28b$exports = {};
|
|
35
35
|
|
|
36
|
-
$parcel$export($
|
|
37
|
-
$parcel$export($
|
|
38
|
-
$parcel$export($
|
|
39
|
-
$parcel$export($
|
|
40
|
-
$parcel$export($
|
|
41
|
-
$parcel$export($
|
|
42
|
-
$parcel$export($
|
|
43
|
-
$parcel$export($
|
|
44
|
-
$parcel$export($
|
|
45
|
-
$parcel$export($
|
|
46
|
-
$parcel$export($
|
|
47
|
-
$parcel$export($
|
|
48
|
-
$parcel$export($
|
|
49
|
-
$parcel$export($
|
|
50
|
-
$parcel$export($
|
|
51
|
-
$parcel$export($
|
|
52
|
-
$parcel$export($
|
|
53
|
-
$parcel$export($
|
|
54
|
-
$parcel$export($
|
|
55
|
-
$parcel$export($
|
|
56
|
-
var $
|
|
57
|
-
var $
|
|
58
|
-
var $
|
|
59
|
-
var $
|
|
60
|
-
var $
|
|
61
|
-
var $
|
|
62
|
-
var $
|
|
63
|
-
var $
|
|
64
|
-
var $
|
|
65
|
-
var $
|
|
66
|
-
var $
|
|
67
|
-
var $
|
|
68
|
-
var $
|
|
69
|
-
var $
|
|
70
|
-
var $
|
|
71
|
-
var $
|
|
72
|
-
var $
|
|
73
|
-
var $
|
|
74
|
-
var $
|
|
75
|
-
var $
|
|
76
|
-
$
|
|
77
|
-
$
|
|
78
|
-
$
|
|
79
|
-
$
|
|
80
|
-
$
|
|
81
|
-
$
|
|
82
|
-
$
|
|
83
|
-
$
|
|
84
|
-
$
|
|
85
|
-
$
|
|
86
|
-
$
|
|
87
|
-
$
|
|
88
|
-
$
|
|
89
|
-
$
|
|
90
|
-
$
|
|
91
|
-
$
|
|
92
|
-
$
|
|
93
|
-
$
|
|
94
|
-
$
|
|
95
|
-
$
|
|
36
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-TabsPanel", () => $c66643a08e89e28b$export$34f1a65c57bb7bb, (v) => $c66643a08e89e28b$export$34f1a65c57bb7bb = v);
|
|
37
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-TabsPanel--horizontal", () => $c66643a08e89e28b$export$778fb839eaa0528c, (v) => $c66643a08e89e28b$export$778fb839eaa0528c = v);
|
|
38
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-TabsPanel--vertical", () => $c66643a08e89e28b$export$9a6e2fb72c648072, (v) => $c66643a08e89e28b$export$9a6e2fb72c648072 = v);
|
|
39
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs", () => $c66643a08e89e28b$export$35c105c0d9c8e56f, (v) => $c66643a08e89e28b$export$35c105c0d9c8e56f = v);
|
|
40
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs-item", () => $c66643a08e89e28b$export$123e4c01a5440a3e, (v) => $c66643a08e89e28b$export$123e4c01a5440a3e = v);
|
|
41
|
+
$parcel$export($c66643a08e89e28b$exports, "is-disabled", () => $c66643a08e89e28b$export$d35bc1e505d1ebbf, (v) => $c66643a08e89e28b$export$d35bc1e505d1ebbf = v);
|
|
42
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs-itemLabel", () => $c66643a08e89e28b$export$1f253edac4b98526, (v) => $c66643a08e89e28b$export$1f253edac4b98526 = v);
|
|
43
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Icon", () => $c66643a08e89e28b$export$d374b04f30360026, (v) => $c66643a08e89e28b$export$d374b04f30360026 = v);
|
|
44
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs-selectionIndicator", () => $c66643a08e89e28b$export$a115f9117a19563e, (v) => $c66643a08e89e28b$export$a115f9117a19563e = v);
|
|
45
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs--horizontal", () => $c66643a08e89e28b$export$229f1ac4d3d38f0e, (v) => $c66643a08e89e28b$export$229f1ac4d3d38f0e = v);
|
|
46
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs--compact", () => $c66643a08e89e28b$export$e15c78184ee03abe, (v) => $c66643a08e89e28b$export$e15c78184ee03abe = v);
|
|
47
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs--isCollapsed", () => $c66643a08e89e28b$export$ea514cd060922d6b, (v) => $c66643a08e89e28b$export$ea514cd060922d6b = v);
|
|
48
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs--quiet", () => $c66643a08e89e28b$export$831e830d5828d42b, (v) => $c66643a08e89e28b$export$831e830d5828d42b = v);
|
|
49
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-Tabs--vertical", () => $c66643a08e89e28b$export$e415005be3957065, (v) => $c66643a08e89e28b$export$e415005be3957065 = v);
|
|
50
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-TabsPanel-collapseWrapper", () => $c66643a08e89e28b$export$e09869956b4c96f2, (v) => $c66643a08e89e28b$export$e09869956b4c96f2 = v);
|
|
51
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-TabsPanel-tabs", () => $c66643a08e89e28b$export$4a157a691c854e23, (v) => $c66643a08e89e28b$export$4a157a691c854e23 = v);
|
|
52
|
+
$parcel$export($c66643a08e89e28b$exports, "spectrum-TabsPanel-tabpanel", () => $c66643a08e89e28b$export$acb5da0970288266, (v) => $c66643a08e89e28b$export$acb5da0970288266 = v);
|
|
53
|
+
$parcel$export($c66643a08e89e28b$exports, "focus-ring", () => $c66643a08e89e28b$export$f39a09f249340e2a, (v) => $c66643a08e89e28b$export$f39a09f249340e2a = v);
|
|
54
|
+
$parcel$export($c66643a08e89e28b$exports, "is-hovered", () => $c66643a08e89e28b$export$b8813cd5d7824ce7, (v) => $c66643a08e89e28b$export$b8813cd5d7824ce7 = v);
|
|
55
|
+
$parcel$export($c66643a08e89e28b$exports, "is-selected", () => $c66643a08e89e28b$export$1e0fb04f31d3c22a, (v) => $c66643a08e89e28b$export$1e0fb04f31d3c22a = v);
|
|
56
|
+
var $c66643a08e89e28b$export$34f1a65c57bb7bb;
|
|
57
|
+
var $c66643a08e89e28b$export$778fb839eaa0528c;
|
|
58
|
+
var $c66643a08e89e28b$export$9a6e2fb72c648072;
|
|
59
|
+
var $c66643a08e89e28b$export$35c105c0d9c8e56f;
|
|
60
|
+
var $c66643a08e89e28b$export$123e4c01a5440a3e;
|
|
61
|
+
var $c66643a08e89e28b$export$d35bc1e505d1ebbf;
|
|
62
|
+
var $c66643a08e89e28b$export$1f253edac4b98526;
|
|
63
|
+
var $c66643a08e89e28b$export$d374b04f30360026;
|
|
64
|
+
var $c66643a08e89e28b$export$a115f9117a19563e;
|
|
65
|
+
var $c66643a08e89e28b$export$229f1ac4d3d38f0e;
|
|
66
|
+
var $c66643a08e89e28b$export$e15c78184ee03abe;
|
|
67
|
+
var $c66643a08e89e28b$export$ea514cd060922d6b;
|
|
68
|
+
var $c66643a08e89e28b$export$831e830d5828d42b;
|
|
69
|
+
var $c66643a08e89e28b$export$e415005be3957065;
|
|
70
|
+
var $c66643a08e89e28b$export$e09869956b4c96f2;
|
|
71
|
+
var $c66643a08e89e28b$export$4a157a691c854e23;
|
|
72
|
+
var $c66643a08e89e28b$export$acb5da0970288266;
|
|
73
|
+
var $c66643a08e89e28b$export$f39a09f249340e2a;
|
|
74
|
+
var $c66643a08e89e28b$export$b8813cd5d7824ce7;
|
|
75
|
+
var $c66643a08e89e28b$export$1e0fb04f31d3c22a;
|
|
76
|
+
$c66643a08e89e28b$export$34f1a65c57bb7bb = "spectrum-TabsPanel_3e140b";
|
|
77
|
+
$c66643a08e89e28b$export$778fb839eaa0528c = "spectrum-TabsPanel--horizontal_3e140b";
|
|
78
|
+
$c66643a08e89e28b$export$9a6e2fb72c648072 = "spectrum-TabsPanel--vertical_3e140b";
|
|
79
|
+
$c66643a08e89e28b$export$35c105c0d9c8e56f = "spectrum-Tabs_3e140b";
|
|
80
|
+
$c66643a08e89e28b$export$123e4c01a5440a3e = "spectrum-Tabs-item_3e140b";
|
|
81
|
+
$c66643a08e89e28b$export$d35bc1e505d1ebbf = "is-disabled_3e140b";
|
|
82
|
+
$c66643a08e89e28b$export$1f253edac4b98526 = "spectrum-Tabs-itemLabel_3e140b";
|
|
83
|
+
$c66643a08e89e28b$export$d374b04f30360026 = "spectrum-Icon_3e140b";
|
|
84
|
+
$c66643a08e89e28b$export$a115f9117a19563e = "spectrum-Tabs-selectionIndicator_3e140b";
|
|
85
|
+
$c66643a08e89e28b$export$229f1ac4d3d38f0e = "spectrum-Tabs--horizontal_3e140b";
|
|
86
|
+
$c66643a08e89e28b$export$e15c78184ee03abe = "spectrum-Tabs--compact_3e140b";
|
|
87
|
+
$c66643a08e89e28b$export$ea514cd060922d6b = "spectrum-Tabs--isCollapsed_3e140b";
|
|
88
|
+
$c66643a08e89e28b$export$831e830d5828d42b = "spectrum-Tabs--quiet_3e140b";
|
|
89
|
+
$c66643a08e89e28b$export$e415005be3957065 = "spectrum-Tabs--vertical_3e140b";
|
|
90
|
+
$c66643a08e89e28b$export$e09869956b4c96f2 = "spectrum-TabsPanel-collapseWrapper_3e140b";
|
|
91
|
+
$c66643a08e89e28b$export$4a157a691c854e23 = "spectrum-TabsPanel-tabs_3e140b";
|
|
92
|
+
$c66643a08e89e28b$export$acb5da0970288266 = "spectrum-TabsPanel-tabpanel_3e140b";
|
|
93
|
+
$c66643a08e89e28b$export$f39a09f249340e2a = "focus-ring_3e140b";
|
|
94
|
+
$c66643a08e89e28b$export$b8813cd5d7824ce7 = "is-hovered_3e140b";
|
|
95
|
+
$c66643a08e89e28b$export$1e0fb04f31d3c22a = "is-selected_3e140b";
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
|
|
@@ -103,31 +103,31 @@ $fd2ec30cf843a8cb$export$1e0fb04f31d3c22a = "is-selected_3e140b";
|
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
const $
|
|
107
|
-
function $
|
|
108
|
-
props = $
|
|
106
|
+
const $25c20e9c619a005c$var$TabContext = /*#__PURE__*/ $1GuAi$react.createContext(null);
|
|
107
|
+
function $25c20e9c619a005c$var$Tabs(props, ref) {
|
|
108
|
+
props = $1GuAi$useProviderProps(props);
|
|
109
109
|
let { orientation: orientation = 'horizontal' , density: density = 'regular' , children: children , ...otherProps } = props;
|
|
110
|
-
let domRef = $
|
|
111
|
-
let tablistRef = $
|
|
112
|
-
let wrapperRef = $
|
|
113
|
-
let { direction: direction } = $
|
|
114
|
-
let { styleProps: styleProps } = $
|
|
115
|
-
let [collapse, setCollapse] = $
|
|
116
|
-
let [selectedTab1, setSelectedTab] = $
|
|
117
|
-
const [tabListState, setTabListState] = $
|
|
118
|
-
$
|
|
110
|
+
let domRef = $1GuAi$useDOMRef(ref);
|
|
111
|
+
let tablistRef = $1GuAi$useRef();
|
|
112
|
+
let wrapperRef = $1GuAi$useRef();
|
|
113
|
+
let { direction: direction } = $1GuAi$useLocale();
|
|
114
|
+
let { styleProps: styleProps } = $1GuAi$useStyleProps(otherProps);
|
|
115
|
+
let [collapse, setCollapse] = $1GuAi$useValueEffect(false);
|
|
116
|
+
let [selectedTab1, setSelectedTab] = $1GuAi$useState();
|
|
117
|
+
const [tabListState, setTabListState] = $1GuAi$useState(null);
|
|
118
|
+
$1GuAi$useEffect(()=>{
|
|
119
119
|
if (tablistRef.current) {
|
|
120
|
-
let selectedTab = tablistRef.current.querySelector(`[data-key="${tabListState
|
|
120
|
+
let selectedTab = tablistRef.current.querySelector(`[data-key="${tabListState === null || tabListState === void 0 ? void 0 : tabListState.selectedKey}"]`);
|
|
121
121
|
if (selectedTab != null) setSelectedTab(selectedTab);
|
|
122
122
|
}
|
|
123
123
|
// collapse is in the dep array so selectedTab can be updated for TabLine positioning
|
|
124
124
|
}, [
|
|
125
125
|
children,
|
|
126
|
-
tabListState
|
|
126
|
+
tabListState === null || tabListState === void 0 ? void 0 : tabListState.selectedKey,
|
|
127
127
|
collapse,
|
|
128
128
|
tablistRef
|
|
129
129
|
]);
|
|
130
|
-
let checkShouldCollapse = $
|
|
130
|
+
let checkShouldCollapse = $1GuAi$useCallback(()=>{
|
|
131
131
|
let computeShouldCollapse = ()=>{
|
|
132
132
|
if (wrapperRef.current) {
|
|
133
133
|
let tabsComponent = wrapperRef.current;
|
|
@@ -135,7 +135,7 @@ function $79ffa4f8dcd384fb$var$Tabs(props, ref) {
|
|
|
135
135
|
let lastTab = tabs[tabs.length - 1];
|
|
136
136
|
let end = direction === 'rtl' ? 'left' : 'right';
|
|
137
137
|
let farEdgeTabList = tabsComponent.getBoundingClientRect()[end];
|
|
138
|
-
let farEdgeLastTab = lastTab
|
|
138
|
+
let farEdgeLastTab = lastTab === null || lastTab === void 0 ? void 0 : lastTab.getBoundingClientRect()[end];
|
|
139
139
|
let shouldCollapse = direction === 'rtl' ? farEdgeLastTab < farEdgeTabList : farEdgeTabList < farEdgeLastTab;
|
|
140
140
|
return shouldCollapse;
|
|
141
141
|
}
|
|
@@ -153,13 +153,13 @@ function $79ffa4f8dcd384fb$var$Tabs(props, ref) {
|
|
|
153
153
|
orientation,
|
|
154
154
|
setCollapse
|
|
155
155
|
]);
|
|
156
|
-
$
|
|
156
|
+
$1GuAi$useEffect(()=>{
|
|
157
157
|
checkShouldCollapse();
|
|
158
158
|
}, [
|
|
159
159
|
children,
|
|
160
160
|
checkShouldCollapse
|
|
161
161
|
]);
|
|
162
|
-
$
|
|
162
|
+
$1GuAi$useResizeObserver({
|
|
163
163
|
ref: wrapperRef,
|
|
164
164
|
onResize: checkShouldCollapse
|
|
165
165
|
});
|
|
@@ -167,9 +167,9 @@ function $79ffa4f8dcd384fb$var$Tabs(props, ref) {
|
|
|
167
167
|
'aria-labelledby': undefined
|
|
168
168
|
};
|
|
169
169
|
// When the tabs are collapsed, the tabPanel should be labelled by the Picker button element.
|
|
170
|
-
let collapsibleTabListId = $
|
|
170
|
+
let collapsibleTabListId = $1GuAi$useId();
|
|
171
171
|
if (collapse && orientation !== 'vertical') tabPanelProps['aria-labelledby'] = collapsibleTabListId;
|
|
172
|
-
return(/*#__PURE__*/ $
|
|
172
|
+
return(/*#__PURE__*/ $1GuAi$react.createElement($25c20e9c619a005c$var$TabContext.Provider, {
|
|
173
173
|
value: {
|
|
174
174
|
tabProps: {
|
|
175
175
|
...props,
|
|
@@ -188,71 +188,72 @@ function $79ffa4f8dcd384fb$var$Tabs(props, ref) {
|
|
|
188
188
|
},
|
|
189
189
|
tabPanelProps: tabPanelProps
|
|
190
190
|
}
|
|
191
|
-
}, /*#__PURE__*/ $
|
|
192
|
-
...$
|
|
191
|
+
}, /*#__PURE__*/ $1GuAi$react.createElement("div", {
|
|
192
|
+
...$1GuAi$filterDOMProps(otherProps),
|
|
193
193
|
...styleProps,
|
|
194
194
|
ref: domRef,
|
|
195
|
-
className: $
|
|
195
|
+
className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-TabsPanel', `spectrum-TabsPanel--${orientation}`, styleProps.className)
|
|
196
196
|
}, props.children)));
|
|
197
197
|
}
|
|
198
198
|
// @private
|
|
199
|
-
function $
|
|
199
|
+
function $25c20e9c619a005c$var$Tab(props) {
|
|
200
200
|
let { item: item , state: state , isDisabled: propsDisabled } = props;
|
|
201
201
|
let { key: key , rendered: rendered } = item;
|
|
202
202
|
let isDisabled = propsDisabled || state.disabledKeys.has(key);
|
|
203
|
-
let ref = $
|
|
204
|
-
let { tabProps: tabProps } = $
|
|
203
|
+
let ref = $1GuAi$useRef();
|
|
204
|
+
let { tabProps: tabProps } = $1GuAi$useTab({
|
|
205
205
|
key: key,
|
|
206
206
|
isDisabled: isDisabled
|
|
207
207
|
}, state, ref);
|
|
208
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $
|
|
208
|
+
let { hoverProps: hoverProps , isHovered: isHovered } = $1GuAi$useHover({
|
|
209
209
|
...props
|
|
210
210
|
});
|
|
211
211
|
let isSelected = state.selectedKey === key;
|
|
212
|
-
let domProps = $
|
|
212
|
+
let domProps = $1GuAi$filterDOMProps(item.props);
|
|
213
213
|
delete domProps.id;
|
|
214
|
-
return(/*#__PURE__*/ $
|
|
215
|
-
focusRingClass: $
|
|
216
|
-
}, /*#__PURE__*/ $
|
|
217
|
-
...$
|
|
214
|
+
return(/*#__PURE__*/ $1GuAi$react.createElement($1GuAi$FocusRing, {
|
|
215
|
+
focusRingClass: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'focus-ring')
|
|
216
|
+
}, /*#__PURE__*/ $1GuAi$react.createElement("div", {
|
|
217
|
+
...$1GuAi$mergeProps(tabProps, hoverProps, domProps),
|
|
218
218
|
ref: ref,
|
|
219
|
-
className: $
|
|
219
|
+
className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-Tabs-item', {
|
|
220
220
|
'is-selected': isSelected,
|
|
221
221
|
'is-disabled': isDisabled,
|
|
222
222
|
'is-hovered': isHovered
|
|
223
223
|
})
|
|
224
|
-
}, /*#__PURE__*/ $
|
|
224
|
+
}, /*#__PURE__*/ $1GuAi$react.createElement($1GuAi$SlotProvider, {
|
|
225
225
|
slots: {
|
|
226
226
|
icon: {
|
|
227
227
|
size: 'S',
|
|
228
|
-
UNSAFE_className: $
|
|
228
|
+
UNSAFE_className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-Icon')
|
|
229
229
|
},
|
|
230
230
|
text: {
|
|
231
|
-
UNSAFE_className: $
|
|
231
|
+
UNSAFE_className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-Tabs-itemLabel')
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
|
-
}, typeof rendered === 'string' ? /*#__PURE__*/ $
|
|
234
|
+
}, typeof rendered === 'string' ? /*#__PURE__*/ $1GuAi$react.createElement($1GuAi$Text, null, rendered) : rendered))));
|
|
235
235
|
}
|
|
236
236
|
// @private
|
|
237
|
-
function $
|
|
237
|
+
function $25c20e9c619a005c$var$TabLine(props) {
|
|
238
238
|
let { orientation: orientation , selectedTab: // Is either the tab node (non-collapsed) or the picker node (collapsed)
|
|
239
239
|
selectedTab , selectedKey: // selectedKey is provided so that the TabLine styles are updated when the TabPicker's width updates from a selection change
|
|
240
240
|
selectedKey } = props;
|
|
241
|
-
let { direction: direction } = $
|
|
242
|
-
let { scale: scale } = $
|
|
243
|
-
let [style, setStyle] = $
|
|
241
|
+
let { direction: direction } = $1GuAi$useLocale();
|
|
242
|
+
let { scale: scale } = $1GuAi$useProvider();
|
|
243
|
+
let [style, setStyle] = $1GuAi$useState({
|
|
244
244
|
width: undefined,
|
|
245
245
|
height: undefined
|
|
246
246
|
});
|
|
247
|
-
$
|
|
247
|
+
$1GuAi$useLayoutEffect(()=>{
|
|
248
248
|
if (selectedTab) {
|
|
249
|
+
var ref;
|
|
249
250
|
let styleObj = {
|
|
250
251
|
transform: undefined,
|
|
251
252
|
width: undefined,
|
|
252
253
|
height: undefined
|
|
253
254
|
};
|
|
254
255
|
// In RTL, calculate the transform from the right edge of the tablist so that resizing the window doesn't break the Tabline position due to offsetLeft changes
|
|
255
|
-
let offset = direction === 'rtl' ? -1 * (selectedTab.offsetParent
|
|
256
|
+
let offset = direction === 'rtl' ? -1 * (((ref = selectedTab.offsetParent) === null || ref === void 0 ? void 0 : ref.offsetWidth) - selectedTab.offsetWidth - selectedTab.offsetLeft) : selectedTab.offsetLeft;
|
|
256
257
|
styleObj.transform = orientation === 'vertical' ? `translateY(${selectedTab.offsetTop}px)` : `translateX(${offset}px)`;
|
|
257
258
|
if (orientation === 'horizontal') styleObj.width = `${selectedTab.offsetWidth}px`;
|
|
258
259
|
else styleObj.height = `${selectedTab.offsetHeight}px`;
|
|
@@ -266,29 +267,29 @@ function $79ffa4f8dcd384fb$var$TabLine(props) {
|
|
|
266
267
|
scale,
|
|
267
268
|
selectedKey
|
|
268
269
|
]);
|
|
269
|
-
return(/*#__PURE__*/ $
|
|
270
|
-
className: $
|
|
270
|
+
return(/*#__PURE__*/ $1GuAi$react.createElement("div", {
|
|
271
|
+
className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-Tabs-selectionIndicator'),
|
|
271
272
|
role: "presentation",
|
|
272
273
|
style: style
|
|
273
274
|
}));
|
|
274
275
|
}
|
|
275
|
-
function $
|
|
276
|
-
const tabContext = $
|
|
276
|
+
function $25c20e9c619a005c$export$e51a686c67fdaa2d(props) {
|
|
277
|
+
const tabContext = $1GuAi$useContext($25c20e9c619a005c$var$TabContext);
|
|
277
278
|
const { refs: refs , tabState: tabState , tabProps: tabProps , tabPanelProps: tabPanelProps } = tabContext;
|
|
278
279
|
const { isQuiet: isQuiet , density: density , isDisabled: isDisabled , orientation: orientation } = tabProps;
|
|
279
280
|
const { selectedTab: selectedTab , collapse: collapse , setTabListState: setTabListState } = tabState;
|
|
280
281
|
const { tablistRef: tablistRef , wrapperRef: wrapperRef } = refs;
|
|
281
282
|
// Pass original Tab props but override children to create the collection.
|
|
282
|
-
const state = $
|
|
283
|
+
const state = $1GuAi$useTabListState({
|
|
283
284
|
...tabProps,
|
|
284
285
|
children: props.children
|
|
285
286
|
});
|
|
286
|
-
let { styleProps: styleProps } = $
|
|
287
|
-
const { tabListProps: tabListProps } = $
|
|
287
|
+
let { styleProps: styleProps } = $1GuAi$useStyleProps(props);
|
|
288
|
+
const { tabListProps: tabListProps } = $1GuAi$useTabList({
|
|
288
289
|
...tabProps,
|
|
289
290
|
...props
|
|
290
291
|
}, state, tablistRef);
|
|
291
|
-
$
|
|
292
|
+
$1GuAi$useEffect(()=>{
|
|
292
293
|
// Passing back to root as useTabPanel needs the TabListState
|
|
293
294
|
setTabListState(state);
|
|
294
295
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -300,34 +301,34 @@ function $79ffa4f8dcd384fb$export$e51a686c67fdaa2d(props) {
|
|
|
300
301
|
]);
|
|
301
302
|
let stylePropsForVertical = orientation === 'vertical' ? styleProps : {
|
|
302
303
|
};
|
|
303
|
-
let tabListclassName = $
|
|
304
|
-
const tabContent = /*#__PURE__*/ $
|
|
304
|
+
let tabListclassName = $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-TabsPanel-tabs');
|
|
305
|
+
const tabContent = /*#__PURE__*/ $1GuAi$react.createElement("div", {
|
|
305
306
|
...stylePropsForVertical,
|
|
306
307
|
...tabListProps,
|
|
307
308
|
ref: tablistRef,
|
|
308
|
-
className: $
|
|
309
|
+
className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-Tabs', `spectrum-Tabs--${orientation}`, tabListclassName, {
|
|
309
310
|
'spectrum-Tabs--quiet': isQuiet,
|
|
310
311
|
['spectrum-Tabs--compact']: density === 'compact'
|
|
311
312
|
}, orientation === 'vertical' && styleProps.className)
|
|
312
313
|
}, [
|
|
313
314
|
...state.collection
|
|
314
|
-
].map((item)=>/*#__PURE__*/ $
|
|
315
|
+
].map((item)=>/*#__PURE__*/ $1GuAi$react.createElement($25c20e9c619a005c$var$Tab, {
|
|
315
316
|
key: item.key,
|
|
316
317
|
item: item,
|
|
317
318
|
state: state,
|
|
318
319
|
isDisabled: isDisabled,
|
|
319
320
|
orientation: orientation
|
|
320
321
|
})
|
|
321
|
-
), /*#__PURE__*/ $
|
|
322
|
+
), /*#__PURE__*/ $1GuAi$react.createElement($25c20e9c619a005c$var$TabLine, {
|
|
322
323
|
orientation: orientation,
|
|
323
324
|
selectedTab: selectedTab
|
|
324
325
|
}));
|
|
325
326
|
if (orientation === 'vertical') return tabContent;
|
|
326
|
-
else return(/*#__PURE__*/ $
|
|
327
|
+
else return(/*#__PURE__*/ $1GuAi$react.createElement("div", {
|
|
327
328
|
...styleProps,
|
|
328
329
|
ref: wrapperRef,
|
|
329
|
-
className: $
|
|
330
|
-
}, collapse ? /*#__PURE__*/ $
|
|
330
|
+
className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-TabsPanel-collapseWrapper', styleProps.className)
|
|
331
|
+
}, collapse ? /*#__PURE__*/ $1GuAi$react.createElement($25c20e9c619a005c$var$TabPicker, {
|
|
331
332
|
...props,
|
|
332
333
|
...tabProps,
|
|
333
334
|
id: tabPanelProps['aria-labelledby'],
|
|
@@ -335,46 +336,46 @@ function $79ffa4f8dcd384fb$export$e51a686c67fdaa2d(props) {
|
|
|
335
336
|
className: tabListclassName
|
|
336
337
|
}) : tabContent));
|
|
337
338
|
}
|
|
338
|
-
function $
|
|
339
|
-
const { tabState: tabState , tabProps: tabProps } = $
|
|
339
|
+
function $25c20e9c619a005c$export$5dae8d435677f210(props) {
|
|
340
|
+
const { tabState: tabState , tabProps: tabProps } = $1GuAi$useContext($25c20e9c619a005c$var$TabContext);
|
|
340
341
|
const { tabListState: tabListState } = tabState;
|
|
341
|
-
const factory = (nodes)=>new $
|
|
342
|
+
const factory = (nodes)=>new $1GuAi$ListCollection(nodes)
|
|
342
343
|
;
|
|
343
|
-
const collection = $
|
|
344
|
+
const collection = $1GuAi$useCollection({
|
|
344
345
|
items: tabProps.items,
|
|
345
346
|
...props
|
|
346
347
|
}, factory, {
|
|
347
348
|
suppressTextValueWarning: true
|
|
348
349
|
});
|
|
349
350
|
const selectedItem = tabListState ? collection.getItem(tabListState.selectedKey) : null;
|
|
350
|
-
return(/*#__PURE__*/ $
|
|
351
|
+
return(/*#__PURE__*/ $1GuAi$react.createElement($25c20e9c619a005c$var$TabPanel, {
|
|
351
352
|
...props,
|
|
352
|
-
key: tabListState
|
|
353
|
+
key: tabListState === null || tabListState === void 0 ? void 0 : tabListState.selectedKey
|
|
353
354
|
}, selectedItem && selectedItem.props.children));
|
|
354
355
|
}
|
|
355
356
|
// @private
|
|
356
|
-
function $
|
|
357
|
-
const { tabState: tabState , tabPanelProps: ctxTabPanelProps } = $
|
|
357
|
+
function $25c20e9c619a005c$var$TabPanel(props) {
|
|
358
|
+
const { tabState: tabState , tabPanelProps: ctxTabPanelProps } = $1GuAi$useContext($25c20e9c619a005c$var$TabContext);
|
|
358
359
|
const { tabListState: tabListState } = tabState;
|
|
359
|
-
let ref = $
|
|
360
|
-
const { tabPanelProps: tabPanelProps } = $
|
|
361
|
-
let { styleProps: styleProps } = $
|
|
360
|
+
let ref = $1GuAi$useRef();
|
|
361
|
+
const { tabPanelProps: tabPanelProps } = $1GuAi$useTabPanel(props, tabListState, ref);
|
|
362
|
+
let { styleProps: styleProps } = $1GuAi$useStyleProps(props);
|
|
362
363
|
if (ctxTabPanelProps['aria-labelledby']) tabPanelProps['aria-labelledby'] = ctxTabPanelProps['aria-labelledby'];
|
|
363
|
-
return(/*#__PURE__*/ $
|
|
364
|
-
focusRingClass: $
|
|
365
|
-
}, /*#__PURE__*/ $
|
|
364
|
+
return(/*#__PURE__*/ $1GuAi$react.createElement($1GuAi$FocusRing, {
|
|
365
|
+
focusRingClass: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'focus-ring')
|
|
366
|
+
}, /*#__PURE__*/ $1GuAi$react.createElement("div", {
|
|
366
367
|
...styleProps,
|
|
367
368
|
...tabPanelProps,
|
|
368
369
|
ref: ref,
|
|
369
|
-
className: $
|
|
370
|
+
className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-TabsPanel-tabpanel', styleProps.className)
|
|
370
371
|
}, props.children)));
|
|
371
372
|
}
|
|
372
|
-
function $
|
|
373
|
+
function $25c20e9c619a005c$var$TabPicker(props) {
|
|
373
374
|
let { isDisabled: isDisabled , isQuiet: isQuiet , state: state , 'aria-labelledby': ariaLabeledBy , 'aria-label': ariaLabel , density: density , className: className , id: id } = props;
|
|
374
|
-
let ref = $
|
|
375
|
-
let [pickerNode, setPickerNode] = $
|
|
376
|
-
$
|
|
377
|
-
let node = $
|
|
375
|
+
let ref = $1GuAi$useRef();
|
|
376
|
+
let [pickerNode, setPickerNode] = $1GuAi$useState(null);
|
|
377
|
+
$1GuAi$useEffect(()=>{
|
|
378
|
+
let node = $1GuAi$unwrapDOMRef(ref);
|
|
378
379
|
setPickerNode(node.current);
|
|
379
380
|
}, [
|
|
380
381
|
ref
|
|
@@ -392,22 +393,22 @@ function $79ffa4f8dcd384fb$var$TabPicker(props) {
|
|
|
392
393
|
'aria-label': ariaLabel
|
|
393
394
|
};
|
|
394
395
|
// TODO: Figure out if tabListProps should go onto the div here, v2 doesn't do it
|
|
395
|
-
return(/*#__PURE__*/ $
|
|
396
|
-
className: $
|
|
396
|
+
return(/*#__PURE__*/ $1GuAi$react.createElement("div", {
|
|
397
|
+
className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-Tabs', 'spectrum-Tabs--horizontal', 'spectrum-Tabs--isCollapsed', {
|
|
397
398
|
'spectrum-Tabs--quiet': isQuiet,
|
|
398
399
|
['spectrum-Tabs--compact']: density === 'compact'
|
|
399
400
|
}, className)
|
|
400
|
-
}, /*#__PURE__*/ $
|
|
401
|
+
}, /*#__PURE__*/ $1GuAi$react.createElement($1GuAi$SlotProvider, {
|
|
401
402
|
slots: {
|
|
402
403
|
icon: {
|
|
403
404
|
size: 'S',
|
|
404
|
-
UNSAFE_className: $
|
|
405
|
+
UNSAFE_className: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'spectrum-Icon')
|
|
405
406
|
},
|
|
406
407
|
button: {
|
|
407
|
-
focusRingClass: $
|
|
408
|
+
focusRingClass: $1GuAi$classNames((/*@__PURE__*/$parcel$interopDefault($c66643a08e89e28b$exports)), 'focus-ring')
|
|
408
409
|
}
|
|
409
410
|
}
|
|
410
|
-
}, /*#__PURE__*/ $
|
|
411
|
+
}, /*#__PURE__*/ $1GuAi$react.createElement($1GuAi$Picker, {
|
|
411
412
|
...pickerProps,
|
|
412
413
|
id: id,
|
|
413
414
|
items: items,
|
|
@@ -417,10 +418,10 @@ function $79ffa4f8dcd384fb$var$TabPicker(props) {
|
|
|
417
418
|
selectedKey: state.selectedKey,
|
|
418
419
|
disabledKeys: state.disabledKeys,
|
|
419
420
|
onSelectionChange: state.setSelectedKey
|
|
420
|
-
}, (item)=>/*#__PURE__*/ $
|
|
421
|
+
}, (item)=>/*#__PURE__*/ $1GuAi$react.createElement($1GuAi$Item, {
|
|
421
422
|
textValue: item.textValue
|
|
422
423
|
}, item.rendered)
|
|
423
|
-
), pickerNode && /*#__PURE__*/ $
|
|
424
|
+
), pickerNode && /*#__PURE__*/ $1GuAi$react.createElement($25c20e9c619a005c$var$TabLine, {
|
|
424
425
|
orientation: "horizontal",
|
|
425
426
|
selectedTab: pickerNode,
|
|
426
427
|
selectedKey: state.selectedKey
|
|
@@ -430,11 +431,11 @@ function $79ffa4f8dcd384fb$var$TabPicker(props) {
|
|
|
430
431
|
* Tabs organize content into multiple sections and allow users to navigate between them. The content under the set of tabs should be related and form a coherent unit.
|
|
431
432
|
*/ // forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
432
433
|
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
433
|
-
const $
|
|
434
|
+
const $25c20e9c619a005c$export$b2539bed5023c21c = /*#__PURE__*/ $1GuAi$react.forwardRef($25c20e9c619a005c$var$Tabs);
|
|
434
435
|
|
|
435
436
|
|
|
436
437
|
|
|
437
438
|
|
|
438
439
|
|
|
439
|
-
export {$
|
|
440
|
+
export {$4f74368734f0d919$re_export$Item as Item, $25c20e9c619a005c$export$e51a686c67fdaa2d as TabList, $25c20e9c619a005c$export$5dae8d435677f210 as TabPanels, $25c20e9c619a005c$export$b2539bed5023c21c as Tabs};
|
|
440
441
|
//# sourceMappingURL=module.js.map
|