@react-spectrum/tabs 3.8.9-nightly.4555 → 3.8.9-nightly.4558

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 CHANGED
@@ -1,30 +1,14 @@
1
- require("./main.css");
1
+ var $e8d58e7e32285ba6$exports = require("./Tabs.main.js");
2
2
  var $8zXxA$reactstatelycollections = require("@react-stately/collections");
3
- var $8zXxA$reactspectrumutils = require("@react-spectrum/utils");
4
- var $8zXxA$reactariautils = require("@react-aria/utils");
5
- var $8zXxA$reactariafocus = require("@react-aria/focus");
6
- var $8zXxA$reactspectrumpicker = require("@react-spectrum/picker");
7
- var $8zXxA$reactstatelylist = require("@react-stately/list");
8
- var $8zXxA$react = require("react");
9
- var $8zXxA$reactstatelytabs = require("@react-stately/tabs");
10
- var $8zXxA$reactspectrumtext = require("@react-spectrum/text");
11
- var $8zXxA$reactariainteractions = require("@react-aria/interactions");
12
- var $8zXxA$reactariai18n = require("@react-aria/i18n");
13
- var $8zXxA$reactspectrumprovider = require("@react-spectrum/provider");
14
- var $8zXxA$reactariatabs = require("@react-aria/tabs");
15
3
 
16
4
 
17
5
  function $parcel$export(e, n, v, s) {
18
6
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
19
7
  }
20
8
 
21
- function $parcel$interopDefault(a) {
22
- return a && a.__esModule ? a.default : a;
23
- }
24
-
25
- $parcel$export(module.exports, "TabList", () => $e8d58e7e32285ba6$export$e51a686c67fdaa2d);
26
- $parcel$export(module.exports, "TabPanels", () => $e8d58e7e32285ba6$export$5dae8d435677f210);
27
- $parcel$export(module.exports, "Tabs", () => $e8d58e7e32285ba6$export$b2539bed5023c21c);
9
+ $parcel$export(module.exports, "TabList", () => $e8d58e7e32285ba6$exports.TabList);
10
+ $parcel$export(module.exports, "TabPanels", () => $e8d58e7e32285ba6$exports.TabPanels);
11
+ $parcel$export(module.exports, "Tabs", () => $e8d58e7e32285ba6$exports.Tabs);
28
12
  $parcel$export(module.exports, "Item", () => $8zXxA$reactstatelycollections.Item);
29
13
  /*
30
14
  * Copyright 2020 Adobe. All rights reserved.
@@ -37,460 +21,6 @@ $parcel$export(module.exports, "Item", () => $8zXxA$reactstatelycollections.Item
37
21
  * OF ANY KIND, either express or implied. See the License for the specific language
38
22
  * governing permissions and limitations under the License.
39
23
  */ /// <reference types="css-module-types" />
40
- /*
41
- * Copyright 2020 Adobe. All rights reserved.
42
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
43
- * you may not use this file except in compliance with the License. You may obtain a copy
44
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
45
- *
46
- * Unless required by applicable law or agreed to in writing, software distributed under
47
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
48
- * OF ANY KIND, either express or implied. See the License for the specific language
49
- * governing permissions and limitations under the License.
50
- */
51
-
52
-
53
-
54
-
55
-
56
- var $29add1fad43dc941$exports = {};
57
-
58
- $parcel$export($29add1fad43dc941$exports, "focus-ring", () => $29add1fad43dc941$export$f39a09f249340e2a, (v) => $29add1fad43dc941$export$f39a09f249340e2a = v);
59
- $parcel$export($29add1fad43dc941$exports, "i18nFontFamily", () => $29add1fad43dc941$export$8c4ee2c50c22c514, (v) => $29add1fad43dc941$export$8c4ee2c50c22c514 = v);
60
- $parcel$export($29add1fad43dc941$exports, "is-disabled", () => $29add1fad43dc941$export$d35bc1e505d1ebbf, (v) => $29add1fad43dc941$export$d35bc1e505d1ebbf = v);
61
- $parcel$export($29add1fad43dc941$exports, "is-hovered", () => $29add1fad43dc941$export$b8813cd5d7824ce7, (v) => $29add1fad43dc941$export$b8813cd5d7824ce7 = v);
62
- $parcel$export($29add1fad43dc941$exports, "is-selected", () => $29add1fad43dc941$export$1e0fb04f31d3c22a, (v) => $29add1fad43dc941$export$1e0fb04f31d3c22a = v);
63
- $parcel$export($29add1fad43dc941$exports, "spectrum-FocusRing-ring", () => $29add1fad43dc941$export$4109102f950813a6, (v) => $29add1fad43dc941$export$4109102f950813a6 = v);
64
- $parcel$export($29add1fad43dc941$exports, "spectrum-FocusRing", () => $29add1fad43dc941$export$24c7f46a6e3605dd, (v) => $29add1fad43dc941$export$24c7f46a6e3605dd = v);
65
- $parcel$export($29add1fad43dc941$exports, "spectrum-FocusRing--quiet", () => $29add1fad43dc941$export$2927016961429360, (v) => $29add1fad43dc941$export$2927016961429360 = v);
66
- $parcel$export($29add1fad43dc941$exports, "spectrum-Icon", () => $29add1fad43dc941$export$d374b04f30360026, (v) => $29add1fad43dc941$export$d374b04f30360026 = v);
67
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs", () => $29add1fad43dc941$export$35c105c0d9c8e56f, (v) => $29add1fad43dc941$export$35c105c0d9c8e56f = v);
68
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs--compact", () => $29add1fad43dc941$export$e15c78184ee03abe, (v) => $29add1fad43dc941$export$e15c78184ee03abe = v);
69
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs--emphasized", () => $29add1fad43dc941$export$87b15021e28e067a, (v) => $29add1fad43dc941$export$87b15021e28e067a = v);
70
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs--horizontal", () => $29add1fad43dc941$export$229f1ac4d3d38f0e, (v) => $29add1fad43dc941$export$229f1ac4d3d38f0e = v);
71
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs--isCollapsed", () => $29add1fad43dc941$export$ea514cd060922d6b, (v) => $29add1fad43dc941$export$ea514cd060922d6b = v);
72
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs--quiet", () => $29add1fad43dc941$export$831e830d5828d42b, (v) => $29add1fad43dc941$export$831e830d5828d42b = v);
73
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs--vertical", () => $29add1fad43dc941$export$e415005be3957065, (v) => $29add1fad43dc941$export$e415005be3957065 = v);
74
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs-item", () => $29add1fad43dc941$export$123e4c01a5440a3e, (v) => $29add1fad43dc941$export$123e4c01a5440a3e = v);
75
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs-itemLabel", () => $29add1fad43dc941$export$1f253edac4b98526, (v) => $29add1fad43dc941$export$1f253edac4b98526 = v);
76
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs-picker", () => $29add1fad43dc941$export$12dc6b25c6dddfc1, (v) => $29add1fad43dc941$export$12dc6b25c6dddfc1 = v);
77
- $parcel$export($29add1fad43dc941$exports, "spectrum-Tabs-selectionIndicator", () => $29add1fad43dc941$export$a115f9117a19563e, (v) => $29add1fad43dc941$export$a115f9117a19563e = v);
78
- $parcel$export($29add1fad43dc941$exports, "spectrum-TabsPanel", () => $29add1fad43dc941$export$34f1a65c57bb7bb, (v) => $29add1fad43dc941$export$34f1a65c57bb7bb = v);
79
- $parcel$export($29add1fad43dc941$exports, "spectrum-TabsPanel--horizontal", () => $29add1fad43dc941$export$778fb839eaa0528c, (v) => $29add1fad43dc941$export$778fb839eaa0528c = v);
80
- $parcel$export($29add1fad43dc941$exports, "spectrum-TabsPanel--vertical", () => $29add1fad43dc941$export$9a6e2fb72c648072, (v) => $29add1fad43dc941$export$9a6e2fb72c648072 = v);
81
- $parcel$export($29add1fad43dc941$exports, "spectrum-TabsPanel-collapseWrapper", () => $29add1fad43dc941$export$e09869956b4c96f2, (v) => $29add1fad43dc941$export$e09869956b4c96f2 = v);
82
- $parcel$export($29add1fad43dc941$exports, "spectrum-TabsPanel-tabpanel", () => $29add1fad43dc941$export$acb5da0970288266, (v) => $29add1fad43dc941$export$acb5da0970288266 = v);
83
- $parcel$export($29add1fad43dc941$exports, "spectrum-TabsPanel-tabs", () => $29add1fad43dc941$export$4a157a691c854e23, (v) => $29add1fad43dc941$export$4a157a691c854e23 = v);
84
- var $29add1fad43dc941$export$f39a09f249340e2a;
85
- var $29add1fad43dc941$export$8c4ee2c50c22c514;
86
- var $29add1fad43dc941$export$d35bc1e505d1ebbf;
87
- var $29add1fad43dc941$export$b8813cd5d7824ce7;
88
- var $29add1fad43dc941$export$1e0fb04f31d3c22a;
89
- var $29add1fad43dc941$export$4109102f950813a6;
90
- var $29add1fad43dc941$export$24c7f46a6e3605dd;
91
- var $29add1fad43dc941$export$2927016961429360;
92
- var $29add1fad43dc941$export$d374b04f30360026;
93
- var $29add1fad43dc941$export$35c105c0d9c8e56f;
94
- var $29add1fad43dc941$export$e15c78184ee03abe;
95
- var $29add1fad43dc941$export$87b15021e28e067a;
96
- var $29add1fad43dc941$export$229f1ac4d3d38f0e;
97
- var $29add1fad43dc941$export$ea514cd060922d6b;
98
- var $29add1fad43dc941$export$831e830d5828d42b;
99
- var $29add1fad43dc941$export$e415005be3957065;
100
- var $29add1fad43dc941$export$123e4c01a5440a3e;
101
- var $29add1fad43dc941$export$1f253edac4b98526;
102
- var $29add1fad43dc941$export$12dc6b25c6dddfc1;
103
- var $29add1fad43dc941$export$a115f9117a19563e;
104
- var $29add1fad43dc941$export$34f1a65c57bb7bb;
105
- var $29add1fad43dc941$export$778fb839eaa0528c;
106
- var $29add1fad43dc941$export$9a6e2fb72c648072;
107
- var $29add1fad43dc941$export$e09869956b4c96f2;
108
- var $29add1fad43dc941$export$acb5da0970288266;
109
- var $29add1fad43dc941$export$4a157a691c854e23;
110
- $29add1fad43dc941$export$f39a09f249340e2a = `FzVSrW_focus-ring`;
111
- $29add1fad43dc941$export$8c4ee2c50c22c514 = `FzVSrW_i18nFontFamily`;
112
- $29add1fad43dc941$export$d35bc1e505d1ebbf = `FzVSrW_is-disabled`;
113
- $29add1fad43dc941$export$b8813cd5d7824ce7 = `FzVSrW_is-hovered`;
114
- $29add1fad43dc941$export$1e0fb04f31d3c22a = `FzVSrW_is-selected`;
115
- $29add1fad43dc941$export$4109102f950813a6 = `FzVSrW_spectrum-FocusRing-ring`;
116
- $29add1fad43dc941$export$24c7f46a6e3605dd = `FzVSrW_spectrum-FocusRing ${$29add1fad43dc941$export$4109102f950813a6}`;
117
- $29add1fad43dc941$export$2927016961429360 = `FzVSrW_spectrum-FocusRing--quiet`;
118
- $29add1fad43dc941$export$d374b04f30360026 = `FzVSrW_spectrum-Icon`;
119
- $29add1fad43dc941$export$35c105c0d9c8e56f = `FzVSrW_spectrum-Tabs`;
120
- $29add1fad43dc941$export$e15c78184ee03abe = `FzVSrW_spectrum-Tabs--compact`;
121
- $29add1fad43dc941$export$87b15021e28e067a = `FzVSrW_spectrum-Tabs--emphasized`;
122
- $29add1fad43dc941$export$229f1ac4d3d38f0e = `FzVSrW_spectrum-Tabs--horizontal`;
123
- $29add1fad43dc941$export$ea514cd060922d6b = `FzVSrW_spectrum-Tabs--isCollapsed`;
124
- $29add1fad43dc941$export$831e830d5828d42b = `FzVSrW_spectrum-Tabs--quiet`;
125
- $29add1fad43dc941$export$e415005be3957065 = `FzVSrW_spectrum-Tabs--vertical`;
126
- $29add1fad43dc941$export$123e4c01a5440a3e = `FzVSrW_spectrum-Tabs-item`;
127
- $29add1fad43dc941$export$1f253edac4b98526 = `FzVSrW_spectrum-Tabs-itemLabel`;
128
- $29add1fad43dc941$export$12dc6b25c6dddfc1 = `FzVSrW_spectrum-Tabs-picker`;
129
- $29add1fad43dc941$export$a115f9117a19563e = `FzVSrW_spectrum-Tabs-selectionIndicator`;
130
- $29add1fad43dc941$export$34f1a65c57bb7bb = `FzVSrW_spectrum-TabsPanel`;
131
- $29add1fad43dc941$export$778fb839eaa0528c = `FzVSrW_spectrum-TabsPanel--horizontal`;
132
- $29add1fad43dc941$export$9a6e2fb72c648072 = `FzVSrW_spectrum-TabsPanel--vertical`;
133
- $29add1fad43dc941$export$e09869956b4c96f2 = `FzVSrW_spectrum-TabsPanel-collapseWrapper`;
134
- $29add1fad43dc941$export$acb5da0970288266 = `FzVSrW_spectrum-TabsPanel-tabpanel`;
135
- $29add1fad43dc941$export$4a157a691c854e23 = `FzVSrW_spectrum-TabsPanel-tabs`;
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
- const $e8d58e7e32285ba6$var$TabContext = /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createContext(null);
146
- function $e8d58e7e32285ba6$var$Tabs(props, ref) {
147
- props = (0, $8zXxA$reactspectrumprovider.useProviderProps)(props);
148
- let { orientation: orientation = "horizontal", density: density = "regular", children: children, ...otherProps } = props;
149
- let domRef = (0, $8zXxA$reactspectrumutils.useDOMRef)(ref);
150
- let tablistRef = (0, $8zXxA$react.useRef)();
151
- let wrapperRef = (0, $8zXxA$react.useRef)();
152
- let { direction: direction } = (0, $8zXxA$reactariai18n.useLocale)();
153
- let { styleProps: styleProps } = (0, $8zXxA$reactspectrumutils.useStyleProps)(otherProps);
154
- let [collapsed, setCollapsed] = (0, $8zXxA$react.useState)(false);
155
- let [selectedTab, setSelectedTab] = (0, $8zXxA$react.useState)();
156
- const [tabListState, setTabListState] = (0, $8zXxA$react.useState)(null);
157
- let [tabPositions, setTabPositions] = (0, $8zXxA$react.useState)([]);
158
- let prevTabPositions = (0, $8zXxA$react.useRef)(tabPositions);
159
- (0, $8zXxA$react.useEffect)(()=>{
160
- if (tablistRef.current) {
161
- var _tabListState_selectedKey;
162
- let selectedTab = tablistRef.current.querySelector(`[data-key="${CSS.escape(tabListState === null || tabListState === void 0 ? void 0 : (_tabListState_selectedKey = tabListState.selectedKey) === null || _tabListState_selectedKey === void 0 ? void 0 : _tabListState_selectedKey.toString())}"]`);
163
- if (selectedTab != null) setSelectedTab(selectedTab);
164
- }
165
- // collapse is in the dep array so selectedTab can be updated for TabLine positioning
166
- }, [
167
- children,
168
- tabListState === null || tabListState === void 0 ? void 0 : tabListState.selectedKey,
169
- collapsed,
170
- tablistRef
171
- ]);
172
- let checkShouldCollapse = (0, $8zXxA$react.useCallback)(()=>{
173
- if (wrapperRef.current && orientation !== "vertical") {
174
- let tabsComponent = wrapperRef.current;
175
- let tabs = tablistRef.current.querySelectorAll('[role="tab"]');
176
- let tabDimensions = [
177
- ...tabs
178
- ].map((tab)=>tab.getBoundingClientRect());
179
- let end = direction === "rtl" ? "left" : "right";
180
- let farEdgeTabList = tabsComponent.getBoundingClientRect()[end];
181
- let farEdgeLastTab = tabDimensions[tabDimensions.length - 1][end];
182
- let shouldCollapse = direction === "rtl" ? farEdgeLastTab < farEdgeTabList : farEdgeTabList < farEdgeLastTab;
183
- setCollapsed(shouldCollapse);
184
- if (tabDimensions.length !== prevTabPositions.current.length || tabDimensions.some((box, index)=>{
185
- var _prevTabPositions_current_index, _prevTabPositions_current_index1;
186
- return (box === null || box === void 0 ? void 0 : box.left) !== ((_prevTabPositions_current_index = prevTabPositions.current[index]) === null || _prevTabPositions_current_index === void 0 ? void 0 : _prevTabPositions_current_index.left) || (box === null || box === void 0 ? void 0 : box.right) !== ((_prevTabPositions_current_index1 = prevTabPositions.current[index]) === null || _prevTabPositions_current_index1 === void 0 ? void 0 : _prevTabPositions_current_index1.right);
187
- })) {
188
- setTabPositions(tabDimensions);
189
- prevTabPositions.current = tabDimensions;
190
- }
191
- }
192
- }, [
193
- tablistRef,
194
- wrapperRef,
195
- direction,
196
- orientation,
197
- setCollapsed,
198
- prevTabPositions,
199
- setTabPositions
200
- ]);
201
- (0, $8zXxA$react.useEffect)(()=>{
202
- checkShouldCollapse();
203
- }, [
204
- children,
205
- checkShouldCollapse
206
- ]);
207
- (0, $8zXxA$reactariautils.useResizeObserver)({
208
- ref: wrapperRef,
209
- onResize: checkShouldCollapse
210
- });
211
- let tabPanelProps = {
212
- "aria-labelledby": undefined
213
- };
214
- // When the tabs are collapsed, the tabPanel should be labelled by the Picker button element.
215
- let collapsibleTabListId = (0, $8zXxA$reactariautils.useId)();
216
- if (collapsed && orientation !== "vertical") tabPanelProps["aria-labelledby"] = collapsibleTabListId;
217
- return /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement($e8d58e7e32285ba6$var$TabContext.Provider, {
218
- value: {
219
- tabProps: {
220
- ...props,
221
- orientation: orientation,
222
- density: density
223
- },
224
- tabState: {
225
- tabListState: tabListState,
226
- setTabListState: setTabListState,
227
- selectedTab: selectedTab,
228
- collapsed: collapsed
229
- },
230
- refs: {
231
- tablistRef: tablistRef,
232
- wrapperRef: wrapperRef
233
- },
234
- tabPanelProps: tabPanelProps,
235
- tabLineState: tabPositions
236
- }
237
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement("div", {
238
- ...(0, $8zXxA$reactariautils.filterDOMProps)(otherProps),
239
- ...styleProps,
240
- ref: domRef,
241
- className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-TabsPanel", `spectrum-TabsPanel--${orientation}`, styleProps.className)
242
- }, props.children));
243
- }
244
- // @private
245
- function $e8d58e7e32285ba6$var$Tab(props) {
246
- let { item: item, state: state } = props;
247
- let { key: key, rendered: rendered } = item;
248
- let ref = (0, $8zXxA$react.useRef)();
249
- let { tabProps: tabProps, isSelected: isSelected, isDisabled: isDisabled } = (0, $8zXxA$reactariatabs.useTab)({
250
- key: key
251
- }, state, ref);
252
- let { hoverProps: hoverProps, isHovered: isHovered } = (0, $8zXxA$reactariainteractions.useHover)({
253
- ...props
254
- });
255
- let ElementType = item.props.href ? "a" : "div";
256
- return /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement((0, $8zXxA$reactariafocus.FocusRing), {
257
- focusRingClass: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "focus-ring")
258
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement(ElementType, {
259
- ...(0, $8zXxA$reactariautils.mergeProps)(tabProps, hoverProps),
260
- ref: ref,
261
- className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Tabs-item", {
262
- "is-selected": isSelected,
263
- "is-disabled": isDisabled,
264
- "is-hovered": isHovered
265
- })
266
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement((0, $8zXxA$reactspectrumutils.SlotProvider), {
267
- slots: {
268
- icon: {
269
- size: "S",
270
- UNSAFE_className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Icon")
271
- },
272
- text: {
273
- UNSAFE_className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Tabs-itemLabel")
274
- }
275
- }
276
- }, typeof rendered === "string" ? /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement((0, $8zXxA$reactspectrumtext.Text), null, rendered) : rendered)));
277
- }
278
- // @private
279
- function $e8d58e7e32285ba6$var$TabLine(props) {
280
- let { orientation: orientation, selectedTab: // Is either the tab node (non-collapsed) or the picker node (collapsed)
281
- selectedTab, selectedKey: // selectedKey is provided so that the TabLine styles are updated when the TabPicker's width updates from a selection change
282
- selectedKey } = props;
283
- let { direction: direction } = (0, $8zXxA$reactariai18n.useLocale)();
284
- let { scale: scale } = (0, $8zXxA$reactspectrumprovider.useProvider)();
285
- let { tabLineState: tabLineState } = (0, $8zXxA$react.useContext)($e8d58e7e32285ba6$var$TabContext);
286
- let [style, setStyle] = (0, $8zXxA$react.useState)({
287
- width: undefined,
288
- height: undefined
289
- });
290
- let onResize = (0, $8zXxA$react.useCallback)(()=>{
291
- if (selectedTab) {
292
- var _selectedTab_offsetParent;
293
- let styleObj = {
294
- transform: undefined,
295
- width: undefined,
296
- height: undefined
297
- };
298
- // 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
299
- let offset = direction === "rtl" ? -1 * (((_selectedTab_offsetParent = selectedTab.offsetParent) === null || _selectedTab_offsetParent === void 0 ? void 0 : _selectedTab_offsetParent.offsetWidth) - selectedTab.offsetWidth - selectedTab.offsetLeft) : selectedTab.offsetLeft;
300
- styleObj.transform = orientation === "vertical" ? `translateY(${selectedTab.offsetTop}px)` : `translateX(${offset}px)`;
301
- if (orientation === "horizontal") styleObj.width = `${selectedTab.offsetWidth}px`;
302
- else styleObj.height = `${selectedTab.offsetHeight}px`;
303
- setStyle(styleObj);
304
- }
305
- }, [
306
- direction,
307
- setStyle,
308
- selectedTab,
309
- orientation
310
- ]);
311
- (0, $8zXxA$reactariautils.useLayoutEffect)(()=>{
312
- onResize();
313
- }, [
314
- onResize,
315
- scale,
316
- selectedKey,
317
- tabLineState
318
- ]);
319
- return /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement("div", {
320
- className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Tabs-selectionIndicator"),
321
- role: "presentation",
322
- style: style
323
- });
324
- }
325
- function $e8d58e7e32285ba6$export$e51a686c67fdaa2d(props) {
326
- const tabContext = (0, $8zXxA$react.useContext)($e8d58e7e32285ba6$var$TabContext);
327
- const { refs: refs, tabState: tabState, tabProps: tabProps, tabPanelProps: tabPanelProps } = tabContext;
328
- const { isQuiet: isQuiet, density: density, isEmphasized: isEmphasized, orientation: orientation } = tabProps;
329
- const { selectedTab: selectedTab, collapsed: collapsed, setTabListState: setTabListState } = tabState;
330
- const { tablistRef: tablistRef, wrapperRef: wrapperRef } = refs;
331
- // Pass original Tab props but override children to create the collection.
332
- const state = (0, $8zXxA$reactstatelytabs.useTabListState)({
333
- ...tabProps,
334
- children: props.children
335
- });
336
- let { styleProps: styleProps } = (0, $8zXxA$reactspectrumutils.useStyleProps)(props);
337
- const { tabListProps: tabListProps } = (0, $8zXxA$reactariatabs.useTabList)({
338
- ...tabProps,
339
- ...props
340
- }, state, tablistRef);
341
- (0, $8zXxA$react.useEffect)(()=>{
342
- // Passing back to root as useTabPanel needs the TabListState
343
- setTabListState(state);
344
- // eslint-disable-next-line react-hooks/exhaustive-deps
345
- }, [
346
- state.disabledKeys,
347
- state.selectedItem,
348
- state.selectedKey,
349
- props.children
350
- ]);
351
- let collapseStyle = collapsed && orientation !== "vertical" ? {
352
- maxWidth: "calc(100% + 1px)",
353
- overflow: "hidden",
354
- visibility: "hidden",
355
- position: "absolute"
356
- } : {
357
- maxWidth: "calc(100% + 1px)"
358
- };
359
- let stylePropsFinal = orientation === "vertical" ? styleProps : {
360
- style: collapseStyle
361
- };
362
- if (collapsed && orientation !== "vertical") tabListProps["aria-hidden"] = true;
363
- let tabListclassName = (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-TabsPanel-tabs");
364
- const tabContent = /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement("div", {
365
- ...stylePropsFinal,
366
- ...tabListProps,
367
- ref: tablistRef,
368
- className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Tabs", `spectrum-Tabs--${orientation}`, tabListclassName, {
369
- "spectrum-Tabs--quiet": isQuiet,
370
- "spectrum-Tabs--emphasized": isEmphasized,
371
- ["spectrum-Tabs--compact"]: density === "compact"
372
- }, orientation === "vertical" && styleProps.className)
373
- }, [
374
- ...state.collection
375
- ].map((item)=>/*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement($e8d58e7e32285ba6$var$Tab, {
376
- key: item.key,
377
- item: item,
378
- state: state,
379
- orientation: orientation
380
- })), /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement($e8d58e7e32285ba6$var$TabLine, {
381
- orientation: orientation,
382
- selectedTab: selectedTab
383
- }));
384
- if (orientation === "vertical") return tabContent;
385
- else return /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement("div", {
386
- ...styleProps,
387
- ref: wrapperRef,
388
- className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-TabsPanel-collapseWrapper", styleProps.className)
389
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement($e8d58e7e32285ba6$var$TabPicker, {
390
- ...props,
391
- ...tabProps,
392
- visible: collapsed,
393
- id: tabPanelProps["aria-labelledby"],
394
- state: state,
395
- className: tabListclassName
396
- }), tabContent);
397
- }
398
- function $e8d58e7e32285ba6$export$5dae8d435677f210(props) {
399
- const { tabState: tabState, tabProps: tabProps } = (0, $8zXxA$react.useContext)($e8d58e7e32285ba6$var$TabContext);
400
- const { tabListState: tabListState } = tabState;
401
- const factory = (0, $8zXxA$react.useCallback)((nodes)=>new (0, $8zXxA$reactstatelylist.ListCollection)(nodes), []);
402
- const collection = (0, $8zXxA$reactstatelycollections.useCollection)({
403
- items: tabProps.items,
404
- ...props
405
- }, factory, {
406
- suppressTextValueWarning: true
407
- });
408
- const selectedItem = tabListState ? collection.getItem(tabListState.selectedKey) : null;
409
- return /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement($e8d58e7e32285ba6$var$TabPanel, {
410
- ...props,
411
- key: tabListState === null || tabListState === void 0 ? void 0 : tabListState.selectedKey
412
- }, selectedItem && selectedItem.props.children);
413
- }
414
- // @private
415
- function $e8d58e7e32285ba6$var$TabPanel(props) {
416
- const { tabState: tabState, tabPanelProps: ctxTabPanelProps } = (0, $8zXxA$react.useContext)($e8d58e7e32285ba6$var$TabContext);
417
- const { tabListState: tabListState } = tabState;
418
- let ref = (0, $8zXxA$react.useRef)();
419
- const { tabPanelProps: tabPanelProps } = (0, $8zXxA$reactariatabs.useTabPanel)(props, tabListState, ref);
420
- let { styleProps: styleProps } = (0, $8zXxA$reactspectrumutils.useStyleProps)(props);
421
- if (ctxTabPanelProps["aria-labelledby"]) tabPanelProps["aria-labelledby"] = ctxTabPanelProps["aria-labelledby"];
422
- return /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement((0, $8zXxA$reactariafocus.FocusRing), {
423
- focusRingClass: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "focus-ring")
424
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement("div", {
425
- ...styleProps,
426
- ...tabPanelProps,
427
- ref: ref,
428
- className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-TabsPanel-tabpanel", styleProps.className)
429
- }, props.children));
430
- }
431
- function $e8d58e7e32285ba6$var$TabPicker(props) {
432
- let { isDisabled: isDisabled, isEmphasized: isEmphasized, isQuiet: isQuiet, state: state, "aria-labelledby": ariaLabeledBy, "aria-label": ariaLabel, density: density, className: className, id: id, visible: visible } = props;
433
- let ref = (0, $8zXxA$react.useRef)();
434
- let [pickerNode, setPickerNode] = (0, $8zXxA$react.useState)(null);
435
- (0, $8zXxA$react.useEffect)(()=>{
436
- let node = (0, $8zXxA$reactspectrumutils.unwrapDOMRef)(ref);
437
- setPickerNode(node.current);
438
- }, [
439
- ref
440
- ]);
441
- let items = [
442
- ...state.collection
443
- ];
444
- let pickerProps = {
445
- "aria-labelledby": ariaLabeledBy,
446
- "aria-label": ariaLabel
447
- };
448
- const style = visible ? {} : {
449
- visibility: "hidden",
450
- position: "absolute"
451
- };
452
- // TODO: Figure out if tabListProps should go onto the div here, v2 doesn't do it
453
- return /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement("div", {
454
- className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Tabs", "spectrum-Tabs--horizontal", "spectrum-Tabs--isCollapsed", {
455
- "spectrum-Tabs--quiet": isQuiet,
456
- ["spectrum-Tabs--compact"]: density === "compact",
457
- "spectrum-Tabs--emphasized": isEmphasized
458
- }, className),
459
- style: style,
460
- "aria-hidden": visible ? undefined : true
461
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement((0, $8zXxA$reactspectrumutils.SlotProvider), {
462
- slots: {
463
- icon: {
464
- size: "S",
465
- UNSAFE_className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Icon")
466
- },
467
- button: {
468
- focusRingClass: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "focus-ring")
469
- }
470
- }
471
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement((0, $8zXxA$reactspectrumpicker.Picker), {
472
- ...pickerProps,
473
- id: id,
474
- items: items,
475
- ref: ref,
476
- isQuiet: true,
477
- isDisabled: !visible || isDisabled,
478
- selectedKey: state.selectedKey,
479
- disabledKeys: state.disabledKeys,
480
- onSelectionChange: state.setSelectedKey,
481
- UNSAFE_className: (0, $8zXxA$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($29add1fad43dc941$exports))), "spectrum-Tabs-picker")
482
- }, (item)=>/*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement((0, $8zXxA$reactspectrumpicker.Item), item.props, item.rendered)), pickerNode && /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).createElement($e8d58e7e32285ba6$var$TabLine, {
483
- orientation: "horizontal",
484
- selectedTab: pickerNode,
485
- selectedKey: state.selectedKey
486
- })));
487
- }
488
- /**
489
- * 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.
490
- */ // forwardRef doesn't support generic parameters, so cast the result to the correct type
491
- // https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
492
- const $e8d58e7e32285ba6$export$b2539bed5023c21c = /*#__PURE__*/ (0, ($parcel$interopDefault($8zXxA$react))).forwardRef($e8d58e7e32285ba6$var$Tabs);
493
-
494
24
 
495
25
 
496
26
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;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","packages/@adobe/spectrum-css-temp/components/tabs/vars.css"],"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\n/// <reference types=\"css-module-types\" />\n\nexport {TabList, TabPanels, Tabs} from './Tabs';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTabsProps, SpectrumTabListProps, SpectrumTabPanelsProps} from '@react-types/tabs';\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 {AriaTabPanelProps, SpectrumTabListProps, SpectrumTabPanelsProps, SpectrumTabsProps} from '@react-types/tabs';\nimport {classNames, SlotProvider, unwrapDOMRef, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMProps, DOMRef, Key, Node, Orientation, StyleProps} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useId, useLayoutEffect, useResizeObserver} from '@react-aria/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {Item, Picker} from '@react-spectrum/picker';\nimport {ListCollection} from '@react-stately/list';\nimport React, {\n MutableRefObject,\n ReactElement,\n ReactNode,\n useCallback,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport {SpectrumPickerProps} from '@react-types/select';\nimport styles from '@adobe/spectrum-css-temp/components/tabs/vars.css';\nimport {TabListState, useTabListState} from '@react-stately/tabs';\nimport {Text} from '@react-spectrum/text';\nimport {useCollection} from '@react-stately/collections';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProvider, useProviderProps} from '@react-spectrum/provider';\nimport {useTab, useTabList, useTabPanel} from '@react-aria/tabs';\n\ninterface TabsContext<T> {\n tabProps: SpectrumTabsProps<T>,\n tabState: {\n tabListState: TabListState<T>,\n setTabListState: (state: TabListState<T>) => void,\n selectedTab: HTMLElement,\n collapsed: boolean\n },\n refs: {\n wrapperRef: MutableRefObject<HTMLDivElement>,\n tablistRef: MutableRefObject<HTMLDivElement>\n },\n tabPanelProps: {\n 'aria-labelledby': string\n },\n tabLineState: Array<DOMRect>\n}\n\nconst TabContext = React.createContext<TabsContext<any>>(null);\n\nfunction Tabs<T extends object>(props: SpectrumTabsProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let {\n orientation = 'horizontal' as Orientation,\n density = 'regular',\n children,\n ...otherProps\n } = props;\n\n let domRef = useDOMRef(ref);\n let tablistRef = useRef<HTMLDivElement>();\n let wrapperRef = useRef<HTMLDivElement>();\n\n let {direction} = useLocale();\n let {styleProps} = useStyleProps(otherProps);\n let [collapsed, setCollapsed] = useState(false);\n let [selectedTab, setSelectedTab] = useState<HTMLElement>();\n const [tabListState, setTabListState] = useState<TabListState<T>>(null);\n let [tabPositions, setTabPositions] = useState([]);\n let prevTabPositions = useRef(tabPositions);\n\n useEffect(() => {\n if (tablistRef.current) {\n let selectedTab: HTMLElement = tablistRef.current.querySelector(`[data-key=\"${CSS.escape(tabListState?.selectedKey?.toString())}\"]`);\n\n if (selectedTab != null) {\n setSelectedTab(selectedTab);\n }\n }\n // collapse is in the dep array so selectedTab can be updated for TabLine positioning\n }, [children, tabListState?.selectedKey, collapsed, tablistRef]);\n\n let checkShouldCollapse = useCallback(() => {\n if (wrapperRef.current && orientation !== 'vertical') {\n let tabsComponent = wrapperRef.current;\n let tabs = tablistRef.current.querySelectorAll('[role=\"tab\"]');\n let tabDimensions = [...tabs].map(tab => tab.getBoundingClientRect());\n\n let end = direction === 'rtl' ? 'left' : 'right';\n let farEdgeTabList = tabsComponent.getBoundingClientRect()[end];\n let farEdgeLastTab = tabDimensions[tabDimensions.length - 1][end];\n let shouldCollapse = direction === 'rtl' ? farEdgeLastTab < farEdgeTabList : farEdgeTabList < farEdgeLastTab;\n setCollapsed(shouldCollapse);\n if (tabDimensions.length !== prevTabPositions.current.length || tabDimensions.some((box, index) => box?.left !== prevTabPositions.current[index]?.left || box?.right !== prevTabPositions.current[index]?.right)) {\n setTabPositions(tabDimensions);\n prevTabPositions.current = tabDimensions;\n }\n }\n }, [tablistRef, wrapperRef, direction, orientation, setCollapsed, prevTabPositions, setTabPositions]);\n\n useEffect(() => {\n checkShouldCollapse();\n }, [children, checkShouldCollapse]);\n\n useResizeObserver({ref: wrapperRef, onResize: checkShouldCollapse});\n\n let tabPanelProps = {\n 'aria-labelledby': undefined\n };\n\n // When the tabs are collapsed, the tabPanel should be labelled by the Picker button element.\n let collapsibleTabListId = useId();\n if (collapsed && orientation !== 'vertical') {\n tabPanelProps['aria-labelledby'] = collapsibleTabListId;\n }\n return (\n <TabContext.Provider\n value={{\n tabProps: {...props, orientation, density},\n tabState: {tabListState, setTabListState, selectedTab, collapsed},\n refs: {tablistRef, wrapperRef},\n tabPanelProps,\n tabLineState: tabPositions\n }}>\n <div\n {...filterDOMProps(otherProps)}\n {...styleProps}\n ref={domRef}\n className={classNames(\n styles,\n 'spectrum-TabsPanel',\n `spectrum-TabsPanel--${orientation}`,\n styleProps.className\n )}>\n {props.children}\n </div>\n </TabContext.Provider>\n );\n}\n\ninterface TabProps<T> extends DOMProps {\n item: Node<T>,\n state: TabListState<T>,\n isDisabled?: boolean,\n orientation?: Orientation\n}\n\n// @private\nfunction Tab<T>(props: TabProps<T>) {\n let {item, state} = props;\n let {key, rendered} = item;\n\n let ref = useRef<any>();\n let {tabProps, isSelected, isDisabled} = useTab({key}, state, ref);\n\n let {hoverProps, isHovered} = useHover({\n ...props\n });\n let ElementType: React.ElementType = item.props.href ? 'a' : 'div';\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <ElementType\n {...mergeProps(tabProps, hoverProps)}\n ref={ref}\n className={classNames(\n styles,\n 'spectrum-Tabs-item',\n {\n 'is-selected': isSelected,\n 'is-disabled': isDisabled,\n 'is-hovered': isHovered\n }\n )}>\n <SlotProvider\n slots={{\n icon: {\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n text: {\n UNSAFE_className: classNames(styles, 'spectrum-Tabs-itemLabel')\n }\n }}>\n {typeof rendered === 'string'\n ? <Text>{rendered}</Text>\n : rendered}\n </SlotProvider>\n </ElementType>\n </FocusRing>\n );\n}\n\ninterface TabLineProps {\n orientation?: Orientation,\n selectedTab?: HTMLElement,\n selectedKey?: Key\n}\n\n// @private\nfunction TabLine(props: TabLineProps) {\n let {\n orientation,\n // Is either the tab node (non-collapsed) or the picker node (collapsed)\n selectedTab,\n // selectedKey is provided so that the TabLine styles are updated when the TabPicker's width updates from a selection change\n selectedKey\n } = props;\n\n let {direction} = useLocale();\n let {scale} = useProvider();\n let {tabLineState} = useContext(TabContext);\n\n let [style, setStyle] = useState({\n width: undefined,\n height: undefined\n });\n\n let onResize = useCallback(() => {\n if (selectedTab) {\n let styleObj = {transform: undefined, width: undefined, height: undefined};\n // 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\n let offset = direction === 'rtl' ? -1 * ((selectedTab.offsetParent as HTMLElement)?.offsetWidth - selectedTab.offsetWidth - selectedTab.offsetLeft) : selectedTab.offsetLeft;\n styleObj.transform = orientation === 'vertical'\n ? `translateY(${selectedTab.offsetTop}px)`\n : `translateX(${offset}px)`;\n\n if (orientation === 'horizontal') {\n styleObj.width = `${selectedTab.offsetWidth}px`;\n } else {\n styleObj.height = `${selectedTab.offsetHeight}px`;\n }\n setStyle(styleObj);\n }\n }, [direction, setStyle, selectedTab, orientation]);\n\n useLayoutEffect(() => {\n onResize();\n }, [onResize, scale, selectedKey, tabLineState]);\n\n return <div className={classNames(styles, 'spectrum-Tabs-selectionIndicator')} role=\"presentation\" style={style} />;\n}\n\n/**\n * A TabList is used within Tabs to group tabs that a user can switch between.\n * The keys of the items within the <TabList> must match up with a corresponding item inside the <TabPanels>.\n */\nexport function TabList<T>(props: SpectrumTabListProps<T>) {\n const tabContext = useContext(TabContext);\n const {refs, tabState, tabProps, tabPanelProps} = tabContext;\n const {isQuiet, density, isEmphasized, orientation} = tabProps;\n const {selectedTab, collapsed, setTabListState} = tabState;\n const {tablistRef, wrapperRef} = refs;\n // Pass original Tab props but override children to create the collection.\n const state = useTabListState({...tabProps, children: props.children});\n\n let {styleProps} = useStyleProps(props);\n const {tabListProps} = useTabList({...tabProps, ...props}, state, tablistRef);\n\n useEffect(() => {\n // Passing back to root as useTabPanel needs the TabListState\n setTabListState(state);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.disabledKeys, state.selectedItem, state.selectedKey, props.children]);\n\n let collapseStyle : React.CSSProperties = collapsed && orientation !== 'vertical' ? {maxWidth: 'calc(100% + 1px)', overflow: 'hidden', visibility: 'hidden', position: 'absolute'} : {maxWidth: 'calc(100% + 1px)'};\n let stylePropsFinal = orientation === 'vertical' ? styleProps : {style: collapseStyle};\n\n if (collapsed && orientation !== 'vertical') {\n tabListProps['aria-hidden'] = true;\n }\n\n let tabListclassName = classNames(styles, 'spectrum-TabsPanel-tabs');\n\n const tabContent = (\n <div\n {...stylePropsFinal}\n {...tabListProps}\n ref={tablistRef}\n className={classNames(\n styles,\n 'spectrum-Tabs',\n `spectrum-Tabs--${orientation}`,\n tabListclassName,\n {\n 'spectrum-Tabs--quiet': isQuiet,\n 'spectrum-Tabs--emphasized': isEmphasized,\n ['spectrum-Tabs--compact']: density === 'compact'\n },\n orientation === 'vertical' && styleProps.className\n )\n }>\n {[...state.collection].map((item) => (\n <Tab key={item.key} item={item} state={state} orientation={orientation} />\n ))}\n <TabLine orientation={orientation} selectedTab={selectedTab} />\n </div>\n );\n\n\n if (orientation === 'vertical') {\n return tabContent;\n } else {\n return (\n <div\n {...styleProps}\n ref={wrapperRef}\n className={classNames(\n styles,\n 'spectrum-TabsPanel-collapseWrapper',\n styleProps.className\n )}>\n <TabPicker {...props} {...tabProps} visible={collapsed} id={tabPanelProps['aria-labelledby']} state={state} className={tabListclassName} />\n {tabContent}\n </div>\n );\n }\n}\n\n/**\n * TabPanels is used within Tabs as a container for the content of each tab.\n * The keys of the items within the <TabPanels> must match up with a corresponding item inside the <TabList>.\n */\nexport function TabPanels<T>(props: SpectrumTabPanelsProps<T>) {\n const {tabState, tabProps} = useContext(TabContext);\n const {tabListState} = tabState;\n\n const factory = useCallback(nodes => new ListCollection(nodes), []);\n const collection = useCollection({items: tabProps.items, ...props}, factory, {suppressTextValueWarning: true});\n const selectedItem = tabListState ? collection.getItem(tabListState.selectedKey) : null;\n\n return (\n <TabPanel {...props} key={tabListState?.selectedKey}>\n {selectedItem && selectedItem.props.children}\n </TabPanel>\n );\n}\n\ninterface TabPanelProps extends AriaTabPanelProps, StyleProps {\n children?: ReactNode\n}\n\n// @private\nfunction TabPanel(props: TabPanelProps) {\n const {tabState, tabPanelProps: ctxTabPanelProps} = useContext(TabContext);\n const {tabListState} = tabState;\n let ref = useRef();\n const {tabPanelProps} = useTabPanel(props, tabListState, ref);\n let {styleProps} = useStyleProps(props);\n\n if (ctxTabPanelProps['aria-labelledby']) {\n tabPanelProps['aria-labelledby'] = ctxTabPanelProps['aria-labelledby'];\n }\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <div {...styleProps} {...tabPanelProps} ref={ref} className={classNames(styles, 'spectrum-TabsPanel-tabpanel', styleProps.className)}>\n {props.children}\n </div>\n </FocusRing>\n );\n}\n\ninterface TabPickerProps<T> extends Omit<SpectrumPickerProps<T>, 'children'> {\n density?: 'compact' | 'regular',\n isEmphasized?: boolean,\n state: TabListState<T>,\n className?: string,\n visible: boolean\n}\n\nfunction TabPicker<T>(props: TabPickerProps<T>) {\n let {\n isDisabled,\n isEmphasized,\n isQuiet,\n state,\n 'aria-labelledby': ariaLabeledBy,\n 'aria-label': ariaLabel,\n density,\n className,\n id,\n visible\n } = props;\n\n let ref = useRef();\n let [pickerNode, setPickerNode] = useState(null);\n\n useEffect(() => {\n let node = unwrapDOMRef(ref);\n setPickerNode(node.current);\n }, [ref]);\n\n let items = [...state.collection];\n let pickerProps = {\n 'aria-labelledby': ariaLabeledBy,\n 'aria-label': ariaLabel\n };\n\n const style : React.CSSProperties = visible ? {} : {visibility: 'hidden', position: 'absolute'};\n\n // TODO: Figure out if tabListProps should go onto the div here, v2 doesn't do it\n return (\n <div\n className={classNames(\n styles,\n 'spectrum-Tabs',\n 'spectrum-Tabs--horizontal',\n 'spectrum-Tabs--isCollapsed',\n {\n 'spectrum-Tabs--quiet': isQuiet,\n ['spectrum-Tabs--compact']: density === 'compact',\n 'spectrum-Tabs--emphasized': isEmphasized\n },\n className\n )}\n style={style}\n aria-hidden={visible ? undefined : true}>\n <SlotProvider\n slots={{\n icon: {\n size: 'S',\n UNSAFE_className: classNames(styles, 'spectrum-Icon')\n },\n button: {\n focusRingClass: classNames(styles, 'focus-ring')\n }\n }}>\n <Picker\n {...pickerProps}\n id={id}\n items={items}\n ref={ref}\n isQuiet\n isDisabled={!visible || isDisabled}\n selectedKey={state.selectedKey}\n disabledKeys={state.disabledKeys}\n onSelectionChange={state.setSelectedKey}\n UNSAFE_className={classNames(styles, 'spectrum-Tabs-picker')}>\n {item => <Item {...item.props}>{item.rendered}</Item>}\n </Picker>\n {pickerNode && <TabLine orientation=\"horizontal\" selectedTab={pickerNode} selectedKey={state.selectedKey} />}\n </SlotProvider>\n </div>\n );\n}\n\n/**\n * 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.\n */\n// forwardRef doesn't support generic parameters, so cast the result to the correct type\n// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref\nconst _Tabs = React.forwardRef(Tabs) as <T>(props: SpectrumTabsProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_Tabs as Tabs};\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\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/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 */\n\n/// <reference types=\"css-module-types\" />\n\nexport {TabList, TabPanels, Tabs} from './Tabs';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTabsProps, SpectrumTabListProps, SpectrumTabPanelsProps} from '@react-types/tabs';\n"],"names":[],"version":3,"file":"main.js.map"}