@react-spectrum/s2 3.0.0-nightly-e3ed3c7f6-250130 → 3.0.0-nightly-016590a4a-250131
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/Badge.cjs +2 -1
- package/dist/Badge.cjs.map +1 -1
- package/dist/Badge.css +6 -2
- package/dist/Badge.css.map +1 -1
- package/dist/Badge.mjs +2 -1
- package/dist/Badge.mjs.map +1 -1
- package/dist/Content.cjs.map +1 -1
- package/dist/Content.mjs.map +1 -1
- package/dist/Tabs.cjs +462 -166
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css +232 -116
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +463 -167
- package/dist/Tabs.mjs.map +1 -1
- package/dist/TabsPicker.cjs +415 -0
- package/dist/TabsPicker.cjs.map +1 -0
- package/dist/TabsPicker.css +482 -0
- package/dist/TabsPicker.css.map +1 -0
- package/dist/TabsPicker.mjs +409 -0
- package/dist/TabsPicker.mjs.map +1 -0
- package/dist/types.d.ts +12 -7
- package/dist/types.d.ts.map +1 -1
- package/package.json +21 -20
- package/src/Badge.tsx +4 -1
- package/src/Content.tsx +2 -1
- package/src/Tabs.tsx +450 -144
- package/src/TabsPicker.tsx +350 -0
package/dist/Tabs.cjs
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
require("./Tabs.css");
|
|
2
2
|
var $e991cbcdf82ced71$exports = require("./CenterBaseline.cjs");
|
|
3
3
|
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
|
|
4
|
+
var $9d2c38978395d44a$exports = require("./TabsPicker.cjs");
|
|
4
5
|
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
|
|
5
6
|
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
|
|
6
7
|
var $5oxdw$reactjsxruntime = require("react/jsx-runtime");
|
|
7
|
-
var $5oxdw$reactariacomponents = require("react-aria-components");
|
|
8
8
|
var $5oxdw$react = require("react");
|
|
9
|
+
var $5oxdw$reactariacomponents = require("react-aria-components");
|
|
10
|
+
var $5oxdw$reactariacollections = require("@react-aria/collections");
|
|
11
|
+
var $5oxdw$reactstatelyutils = require("@react-stately/utils");
|
|
9
12
|
var $5oxdw$reactspectrumutils = require("@react-spectrum/utils");
|
|
10
13
|
var $5oxdw$reactariautils = require("@react-aria/utils");
|
|
14
|
+
var $5oxdw$reactariafocus = require("@react-aria/focus");
|
|
11
15
|
var $5oxdw$reactariai18n = require("@react-aria/i18n");
|
|
12
16
|
|
|
13
17
|
|
|
@@ -16,10 +20,10 @@ function $parcel$export(e, n, v, s) {
|
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
$parcel$export(module.exports, "TabsContext", () => $b27519d6a701105b$export$cfa7aa87c26e7d1f);
|
|
19
|
-
$parcel$export(module.exports, "TabPanel", () => $b27519d6a701105b$export$3d96ec278d3efce4);
|
|
20
|
-
$parcel$export(module.exports, "Tab", () => $b27519d6a701105b$export$3e41faf802a29e71);
|
|
21
|
-
$parcel$export(module.exports, "TabList", () => $b27519d6a701105b$export$e51a686c67fdaa2d);
|
|
22
23
|
$parcel$export(module.exports, "Tabs", () => $b27519d6a701105b$export$b2539bed5023c21c);
|
|
24
|
+
$parcel$export(module.exports, "TabList", () => $b27519d6a701105b$export$e51a686c67fdaa2d);
|
|
25
|
+
$parcel$export(module.exports, "Tab", () => $b27519d6a701105b$export$3e41faf802a29e71);
|
|
26
|
+
$parcel$export(module.exports, "TabPanel", () => $b27519d6a701105b$export$3d96ec278d3efce4);
|
|
23
27
|
/*
|
|
24
28
|
* Copyright 2024 Adobe. All rights reserved.
|
|
25
29
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -40,135 +44,97 @@ $parcel$export(module.exports, "Tabs", () => $b27519d6a701105b$export$b2539bed50
|
|
|
40
44
|
|
|
41
45
|
|
|
42
46
|
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
43
51
|
const $b27519d6a701105b$export$cfa7aa87c26e7d1f = /*#__PURE__*/ (0, $5oxdw$react.createContext)(null);
|
|
44
|
-
const $b27519d6a701105b$var$
|
|
52
|
+
const $b27519d6a701105b$var$InternalTabsContext = /*#__PURE__*/ (0, $5oxdw$react.createContext)({});
|
|
53
|
+
const $b27519d6a701105b$var$CollapseContext = /*#__PURE__*/ (0, $5oxdw$react.createContext)({
|
|
54
|
+
showTabs: true,
|
|
55
|
+
menuId: '',
|
|
56
|
+
valueId: ''
|
|
57
|
+
});
|
|
58
|
+
const $b27519d6a701105b$var$tabs = function anonymous(props, overrides) {
|
|
45
59
|
let rules = " .";
|
|
46
60
|
let matches = (overrides || '').match(/(?:^|\s)(?:B|C|D|E|__d|__c|g|_9|_8|__E|__g|__h|__e|__f|Y|__U|_b|_d|Z|_a|k|p|q|j|n|o)[^\s]+/g) || [];
|
|
47
61
|
rules += matches.join('');
|
|
48
|
-
let $D = false;
|
|
49
|
-
let $__d = false;
|
|
50
|
-
let $g = false;
|
|
51
|
-
let $n = false;
|
|
52
|
-
let $p = false;
|
|
53
|
-
for (let p of matches){
|
|
54
|
-
if (/^\s*D/.test(p)) $D = true;
|
|
55
|
-
if (/^\s*__d/.test(p)) $__d = true;
|
|
56
|
-
if (/^\s*g/.test(p)) $g = true;
|
|
57
|
-
if (/^\s*n/.test(p)) $n = true;
|
|
58
|
-
if (/^\s*p/.test(p)) $p = true;
|
|
59
|
-
}
|
|
60
|
-
if (!$D) rules += ' Dc';
|
|
61
|
-
rules += ' an';
|
|
62
|
-
if (!$__d) rules += ' __d-3t1y';
|
|
63
|
-
if (!$g) rules += ' g-3hmsa';
|
|
64
|
-
if (!$n) rules += ' no';
|
|
65
|
-
if (!$p) rules += ' po';
|
|
66
|
-
return rules;
|
|
67
|
-
};
|
|
68
|
-
function $b27519d6a701105b$export$3d96ec278d3efce4(props) {
|
|
69
|
-
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.TabPanel), {
|
|
70
|
-
...props,
|
|
71
|
-
style: props.UNSAFE_style,
|
|
72
|
-
className: (props.UNSAFE_className || '') + $b27519d6a701105b$var$tabPanel(null, props.styles)
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
const $b27519d6a701105b$var$tab = function anonymous(props, overrides) {
|
|
76
|
-
let rules = " .";
|
|
77
|
-
let matches = (overrides || '').match(/(?:^|\s)(?:B|C|D|E|__d|__c|g|_9|_8|__E|__g|__h|__e|__f|Y|__U|_b|_d|Z|_a|k|p|q)[^\s]+/g) || [];
|
|
78
|
-
rules += matches.join('');
|
|
79
62
|
let $Y = false;
|
|
80
63
|
let $__c = false;
|
|
81
64
|
for (let p of matches){
|
|
82
65
|
if (/^\s*Y/.test(p)) $Y = true;
|
|
83
66
|
if (/^\s*__c/.test(p)) $__c = true;
|
|
84
67
|
}
|
|
85
|
-
if (props.isFocusVisible) rules += ' _Pb';
|
|
86
|
-
else rules += ' _Pa';
|
|
87
|
-
rules += ' ca_____M';
|
|
88
|
-
rules += ' cx';
|
|
89
|
-
rules += ' _Rc';
|
|
90
|
-
rules += ' _Q-3t1z';
|
|
91
|
-
rules += ' _3d';
|
|
92
|
-
if (props.isDisabled) rules += ' aa_____O';
|
|
93
|
-
else if (props.isSelected) rules += ' aa_____M';
|
|
94
|
-
if (props.isDisabled) rules += ' aj';
|
|
95
|
-
else if (props.isHovered) {
|
|
96
|
-
if (props.isPressed) rules += ' an';
|
|
97
|
-
else if (props.isFocusVisible) rules += ' an';
|
|
98
|
-
else if (props.isHovered) rules += ' an';
|
|
99
|
-
else rules += ' am';
|
|
100
|
-
} else if (props.isSelected) {
|
|
101
|
-
if (props.isPressed) rules += ' ao';
|
|
102
|
-
else if (props.isFocusVisible) rules += ' ao';
|
|
103
|
-
else rules += ' an';
|
|
104
|
-
} else {
|
|
105
|
-
if (props.isPressed) rules += ' an';
|
|
106
|
-
else if (props.isFocusVisible) rules += ' an';
|
|
107
|
-
else rules += ' am';
|
|
108
|
-
}
|
|
109
|
-
rules += ' _zb';
|
|
110
|
-
rules += ' _Ab';
|
|
111
|
-
rules += ' _Bb';
|
|
112
|
-
rules += ' _Cb';
|
|
113
|
-
rules += ' hbH';
|
|
114
|
-
rules += ' hG';
|
|
115
|
-
rules += ' ibH';
|
|
116
|
-
rules += ' iG';
|
|
117
|
-
if (props.density === "regular") rules += ' j_a';
|
|
118
|
-
else if (props.density === "compact") rules += ' jU';
|
|
119
|
-
rules += ' _5c';
|
|
120
68
|
if (!$Y) rules += ' Yc';
|
|
121
|
-
rules += '
|
|
69
|
+
rules += ' _3d';
|
|
122
70
|
if (!$__c) rules += ' __c-3t1x';
|
|
123
|
-
rules += '
|
|
124
|
-
rules += '
|
|
125
|
-
rules += '
|
|
71
|
+
rules += ' _g-bc1l9oh';
|
|
72
|
+
rules += ' _g-1uotwbwg';
|
|
73
|
+
rules += ' _g-eo0c6sf';
|
|
74
|
+
rules += ' _g-enzzrge';
|
|
75
|
+
rules += ' _g-enzykdd';
|
|
76
|
+
rules += ' _g-enzwzjc';
|
|
77
|
+
rules += ' _g-enzrfpb';
|
|
78
|
+
rules += ' _ga';
|
|
79
|
+
rules += ' _hbf';
|
|
80
|
+
rules += ' _he';
|
|
81
|
+
rules += ' _ib';
|
|
82
|
+
rules += ' _j-1x99dlob';
|
|
83
|
+
rules += ' _ja';
|
|
84
|
+
rules += ' an';
|
|
85
|
+
if (props.orientation === "horizontal") rules += ' __ab';
|
|
126
86
|
return rules;
|
|
127
87
|
};
|
|
128
|
-
const $b27519d6a701105b$
|
|
129
|
-
|
|
130
|
-
let { density: density
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
88
|
+
const $b27519d6a701105b$export$b2539bed5023c21c = /*#__PURE__*/ (0, $5oxdw$react.forwardRef)(function Tabs(props, ref) {
|
|
89
|
+
[props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $b27519d6a701105b$export$cfa7aa87c26e7d1f);
|
|
90
|
+
let { density: density = 'regular', isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation = 'horizontal', labelBehavior: labelBehavior = 'show' } = props;
|
|
91
|
+
let domRef = (0, $5oxdw$reactspectrumutils.useDOMRef)(ref);
|
|
92
|
+
let [value, setValue] = (0, $5oxdw$reactstatelyutils.useControlledState)(props.selectedKey, props.defaultSelectedKey ?? null, props.onSelectionChange);
|
|
93
|
+
if (!props['aria-label'] && !props['aria-labelledby']) throw new Error('An aria-label or aria-labelledby prop is required on Tabs for accessibility.');
|
|
94
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Provider), {
|
|
95
|
+
values: [
|
|
96
|
+
[
|
|
97
|
+
$b27519d6a701105b$var$InternalTabsContext,
|
|
98
|
+
{
|
|
99
|
+
density: density,
|
|
100
|
+
isDisabled: isDisabled,
|
|
101
|
+
orientation: orientation,
|
|
102
|
+
disabledKeys: disabledKeys,
|
|
103
|
+
selectedKey: value,
|
|
104
|
+
onSelectionChange: setValue,
|
|
105
|
+
labelBehavior: labelBehavior,
|
|
106
|
+
'aria-label': props['aria-label'],
|
|
107
|
+
'aria-labelledby': props['aria-labelledby']
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
],
|
|
111
|
+
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacollections.CollectionBuilder), {
|
|
112
|
+
content: props.children,
|
|
113
|
+
children: (collection)=>/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapsingTabs, {
|
|
114
|
+
...props,
|
|
115
|
+
selectedKey: value,
|
|
116
|
+
onSelectionChange: setValue,
|
|
117
|
+
collection: collection,
|
|
118
|
+
containerRef: domRef
|
|
119
|
+
})
|
|
160
120
|
})
|
|
161
121
|
});
|
|
162
|
-
}
|
|
122
|
+
});
|
|
163
123
|
const $b27519d6a701105b$var$tablist = function anonymous(props) {
|
|
164
124
|
let rules = " .";
|
|
165
125
|
rules += ' _3d';
|
|
166
126
|
if (props.orientation === "horizontal") {
|
|
167
|
-
if (props.
|
|
127
|
+
if (props.labelBehavior === "hide") {
|
|
128
|
+
if (props.density === "regular") rules += ' hh';
|
|
129
|
+
else if (props.density === "compact") rules += ' hf';
|
|
130
|
+
} else if (props.density === "regular") rules += ' hj';
|
|
168
131
|
else if (props.density === "compact") rules += ' hh';
|
|
169
132
|
}
|
|
170
133
|
if (props.orientation === "horizontal") {
|
|
171
|
-
if (props.
|
|
134
|
+
if (props.labelBehavior === "hide") {
|
|
135
|
+
if (props.density === "regular") rules += ' ih';
|
|
136
|
+
else if (props.density === "compact") rules += ' if';
|
|
137
|
+
} else if (props.density === "regular") rules += ' ij';
|
|
172
138
|
else if (props.density === "compact") rules += ' ih';
|
|
173
139
|
}
|
|
174
140
|
if (props.orientation === "vertical") rules += ' __ab';
|
|
@@ -178,8 +144,14 @@ const $b27519d6a701105b$var$tablist = function anonymous(props) {
|
|
|
178
144
|
rules += ' g-3hmsa';
|
|
179
145
|
return rules;
|
|
180
146
|
};
|
|
181
|
-
function $b27519d6a701105b$export$e51a686c67fdaa2d(
|
|
182
|
-
let {
|
|
147
|
+
function $b27519d6a701105b$export$e51a686c67fdaa2d(props) {
|
|
148
|
+
let { showTabs: showTabs } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext) ?? {};
|
|
149
|
+
if (showTabs) return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabListInner, {
|
|
150
|
+
...props
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function $b27519d6a701105b$var$TabListInner(props1) {
|
|
154
|
+
let { density: density, isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation, labelBehavior: labelBehavior, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext) ?? {};
|
|
183
155
|
let state = (0, $5oxdw$react.useContext)((0, $5oxdw$reactariacomponents.TabListStateContext));
|
|
184
156
|
let [selectedTab, setSelectedTab] = (0, $5oxdw$react.useState)(undefined);
|
|
185
157
|
let tablistRef = (0, $5oxdw$react.useRef)(null);
|
|
@@ -213,9 +185,12 @@ function $b27519d6a701105b$export$e51a686c67fdaa2d(props1) {
|
|
|
213
185
|
}),
|
|
214
186
|
/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.TabList), {
|
|
215
187
|
...props1,
|
|
188
|
+
"aria-label": ariaLabel,
|
|
189
|
+
"aria-labelledby": ariaLabelledBy,
|
|
216
190
|
ref: tablistRef,
|
|
217
191
|
className: (renderProps)=>$b27519d6a701105b$var$tablist({
|
|
218
192
|
...renderProps,
|
|
193
|
+
labelBehavior: labelBehavior,
|
|
219
194
|
density: density
|
|
220
195
|
})
|
|
221
196
|
}),
|
|
@@ -229,21 +204,6 @@ function $b27519d6a701105b$export$e51a686c67fdaa2d(props1) {
|
|
|
229
204
|
]
|
|
230
205
|
});
|
|
231
206
|
}
|
|
232
|
-
function $b27519d6a701105b$var$isAllTabsDisabled(collection, disabledKeys) {
|
|
233
|
-
let testKey = null;
|
|
234
|
-
if (collection && collection.size > 0) {
|
|
235
|
-
testKey = collection.getFirstKey();
|
|
236
|
-
let index = 0;
|
|
237
|
-
while(testKey && index < collection.size){
|
|
238
|
-
// We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it
|
|
239
|
-
if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) return false;
|
|
240
|
-
testKey = collection.getKeyAfter(testKey);
|
|
241
|
-
index++;
|
|
242
|
-
}
|
|
243
|
-
return true;
|
|
244
|
-
}
|
|
245
|
-
return false;
|
|
246
|
-
}
|
|
247
207
|
const $b27519d6a701105b$var$selectedIndicator = function anonymous(props) {
|
|
248
208
|
let rules = " .";
|
|
249
209
|
rules += ' Ya';
|
|
@@ -275,7 +235,7 @@ function $b27519d6a701105b$var$TabLine(props) {
|
|
|
275
235
|
// We want to add disabled styling to the selection indicator only if all the Tabs are disabled
|
|
276
236
|
let [isDisabled, setIsDisabled] = (0, $5oxdw$react.useState)(false);
|
|
277
237
|
(0, $5oxdw$react.useEffect)(()=>{
|
|
278
|
-
let isDisabled = isTabsDisabled || $b27519d6a701105b$var$isAllTabsDisabled(state?.collection
|
|
238
|
+
let isDisabled = isTabsDisabled || $b27519d6a701105b$var$isAllTabsDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set(null));
|
|
279
239
|
setIsDisabled(isDisabled);
|
|
280
240
|
}, [
|
|
281
241
|
state?.collection,
|
|
@@ -313,9 +273,9 @@ function $b27519d6a701105b$var$TabLine(props) {
|
|
|
313
273
|
}, [
|
|
314
274
|
onResize,
|
|
315
275
|
state?.selectedItem?.key,
|
|
276
|
+
density,
|
|
316
277
|
direction,
|
|
317
|
-
orientation
|
|
318
|
-
density
|
|
278
|
+
orientation
|
|
319
279
|
]);
|
|
320
280
|
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
321
281
|
style: {
|
|
@@ -327,53 +287,389 @@ function $b27519d6a701105b$var$TabLine(props) {
|
|
|
327
287
|
})
|
|
328
288
|
});
|
|
329
289
|
}
|
|
330
|
-
const $b27519d6a701105b$var$
|
|
290
|
+
const $b27519d6a701105b$var$tab = function anonymous(props, overrides) {
|
|
331
291
|
let rules = " .";
|
|
332
|
-
let matches = (overrides || '').match(/(?:^|\s)(?:B|C|D|E|__d|__c|g|_9|_8|__E|__g|__h|__e|__f|Y|__U|_b|_d|Z|_a|k|p|q
|
|
292
|
+
let matches = (overrides || '').match(/(?:^|\s)(?:B|C|D|E|__d|__c|g|_9|_8|__E|__g|__h|__e|__f|Y|__U|_b|_d|Z|_a|k|p|q)[^\s]+/g) || [];
|
|
333
293
|
rules += matches.join('');
|
|
294
|
+
let $Y = false;
|
|
334
295
|
let $__c = false;
|
|
335
|
-
for (let p of matches)
|
|
296
|
+
for (let p of matches){
|
|
297
|
+
if (/^\s*Y/.test(p)) $Y = true;
|
|
298
|
+
if (/^\s*__c/.test(p)) $__c = true;
|
|
299
|
+
}
|
|
300
|
+
if (props.isFocusVisible) rules += ' _Pb';
|
|
301
|
+
else rules += ' _Pa';
|
|
302
|
+
rules += ' ca_____M';
|
|
303
|
+
rules += ' cx';
|
|
304
|
+
rules += ' _Rc';
|
|
305
|
+
rules += ' _Q-3t1z';
|
|
336
306
|
rules += ' _3d';
|
|
307
|
+
if (props.isDisabled) rules += ' aa_____O';
|
|
308
|
+
else if (props.isSelected) rules += ' aa_____M';
|
|
309
|
+
if (props.isDisabled) rules += ' aj';
|
|
310
|
+
else if (props.isHovered) {
|
|
311
|
+
if (props.isPressed) rules += ' an';
|
|
312
|
+
else if (props.isFocusVisible) rules += ' an';
|
|
313
|
+
else if (props.isHovered) rules += ' an';
|
|
314
|
+
else rules += ' am';
|
|
315
|
+
} else if (props.isSelected) {
|
|
316
|
+
if (props.isPressed) rules += ' ao';
|
|
317
|
+
else if (props.isFocusVisible) rules += ' ao';
|
|
318
|
+
else rules += ' an';
|
|
319
|
+
} else {
|
|
320
|
+
if (props.isPressed) rules += ' an';
|
|
321
|
+
else if (props.isFocusVisible) rules += ' an';
|
|
322
|
+
else rules += ' am';
|
|
323
|
+
}
|
|
324
|
+
rules += ' _zb';
|
|
325
|
+
rules += ' _Ab';
|
|
326
|
+
rules += ' _Bb';
|
|
327
|
+
rules += ' _Cb';
|
|
328
|
+
rules += ' hbH';
|
|
329
|
+
rules += ' hG';
|
|
330
|
+
rules += ' ibH';
|
|
331
|
+
rules += ' iG';
|
|
332
|
+
if (props.density === "regular") rules += ' j_a';
|
|
333
|
+
else if (props.density === "compact") rules += ' jU';
|
|
334
|
+
rules += ' _5c';
|
|
335
|
+
if (!$Y) rules += ' Yc';
|
|
336
|
+
rules += ' __Lb';
|
|
337
337
|
if (!$__c) rules += ' __c-3t1x';
|
|
338
|
-
rules += '
|
|
339
|
-
rules += '
|
|
340
|
-
rules += '
|
|
341
|
-
rules += '
|
|
342
|
-
rules += '
|
|
343
|
-
rules += ' _g-enzwzjc';
|
|
344
|
-
rules += ' _g-enzrfpb';
|
|
345
|
-
rules += ' _ga';
|
|
346
|
-
rules += ' _ib';
|
|
347
|
-
if (props.orientation === "horizontal") rules += ' __ab';
|
|
338
|
+
rules += ' _Sa';
|
|
339
|
+
rules += ' _U-375x7f';
|
|
340
|
+
rules += ' _Va';
|
|
341
|
+
if (props.labelBehavior === "hide") rules += ' F-ve8p9e';
|
|
342
|
+
if (props.labelBehavior === "hide") rules += ' G-ve8p9e';
|
|
348
343
|
return rules;
|
|
349
344
|
};
|
|
350
|
-
const $b27519d6a701105b$
|
|
351
|
-
|
|
352
|
-
let { density: density
|
|
353
|
-
let
|
|
354
|
-
|
|
345
|
+
const $b27519d6a701105b$var$icon = " _3a __c-3t1x -rwx0fg_d-b";
|
|
346
|
+
function $b27519d6a701105b$export$3e41faf802a29e71(props1) {
|
|
347
|
+
let { density: density, labelBehavior: labelBehavior } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext) ?? {};
|
|
348
|
+
let contentId = (0, $5oxdw$reactariautils.useId)();
|
|
349
|
+
let ariaLabelledBy = props1['aria-labelledby'] || '';
|
|
350
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tab), {
|
|
351
|
+
...props1,
|
|
352
|
+
// @ts-ignore
|
|
353
|
+
originalProps: props1,
|
|
354
|
+
"aria-labelledby": `${labelBehavior === 'hide' ? contentId : ''} ${ariaLabelledBy}`,
|
|
355
|
+
style: props1.UNSAFE_style,
|
|
356
|
+
className: (renderProps)=>(props1.UNSAFE_className || '') + $b27519d6a701105b$var$tab({
|
|
357
|
+
...renderProps,
|
|
358
|
+
density: density,
|
|
359
|
+
labelBehavior: labelBehavior
|
|
360
|
+
}, props1.styles),
|
|
361
|
+
children: ({ isMenu: // @ts-ignore
|
|
362
|
+
isMenu })=>{
|
|
363
|
+
if (isMenu) return props1.children;
|
|
364
|
+
else return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Provider), {
|
|
365
|
+
values: [
|
|
366
|
+
[
|
|
367
|
+
(0, $6367bc87eb7d24ad$exports.TextContext),
|
|
368
|
+
{
|
|
369
|
+
id: contentId,
|
|
370
|
+
styles: function anonymous(props) {
|
|
371
|
+
let rules = " .";
|
|
372
|
+
rules += ' __E-3t1y';
|
|
373
|
+
if (props.labelBehavior === "hide") rules += ' _3j';
|
|
374
|
+
return rules;
|
|
375
|
+
}({
|
|
376
|
+
labelBehavior: labelBehavior
|
|
377
|
+
})
|
|
378
|
+
}
|
|
379
|
+
],
|
|
380
|
+
[
|
|
381
|
+
(0, $bde97c91243ed164$exports.IconContext),
|
|
382
|
+
{
|
|
383
|
+
render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
|
|
384
|
+
slot: 'icon',
|
|
385
|
+
styles: " __E-3t1x"
|
|
386
|
+
}),
|
|
387
|
+
styles: $b27519d6a701105b$var$icon
|
|
388
|
+
}
|
|
389
|
+
]
|
|
390
|
+
],
|
|
391
|
+
children: typeof props1.children === 'string' ? /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
|
|
392
|
+
children: props1.children
|
|
393
|
+
}) : props1.children
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
const $b27519d6a701105b$var$tabPanel = function anonymous(props, overrides) {
|
|
399
|
+
let rules = " .";
|
|
400
|
+
let matches = (overrides || '').match(/(?:^|\s)(?:B|C|D|E|__d|__c|g|_9|_8|__E|__g|__h|__e|__f|Y|__U|_b|_d|Z|_a|k|p|q|j|n|o)[^\s]+/g) || [];
|
|
401
|
+
rules += matches.join('');
|
|
402
|
+
let $D = false;
|
|
403
|
+
let $B = false;
|
|
404
|
+
let $C = false;
|
|
405
|
+
let $__d = false;
|
|
406
|
+
let $__c = false;
|
|
407
|
+
let $g = false;
|
|
408
|
+
let $n = false;
|
|
409
|
+
let $p = false;
|
|
410
|
+
for (let p of matches){
|
|
411
|
+
if (/^\s*D/.test(p)) $D = true;
|
|
412
|
+
if (/^\s*B/.test(p)) $B = true;
|
|
413
|
+
if (/^\s*C/.test(p)) $C = true;
|
|
414
|
+
if (/^\s*__d/.test(p)) $__d = true;
|
|
415
|
+
if (/^\s*__c/.test(p)) $__c = true;
|
|
416
|
+
if (/^\s*g/.test(p)) $g = true;
|
|
417
|
+
if (/^\s*n/.test(p)) $n = true;
|
|
418
|
+
if (/^\s*p/.test(p)) $p = true;
|
|
419
|
+
}
|
|
420
|
+
if (props.isFocusVisible) rules += ' _Pb';
|
|
421
|
+
else rules += ' _Pa';
|
|
422
|
+
rules += ' ca_____M';
|
|
423
|
+
rules += ' cx';
|
|
424
|
+
rules += ' _Rc';
|
|
425
|
+
rules += ' _Q-3t1z';
|
|
426
|
+
rules += ' _3d';
|
|
427
|
+
if (!$D) rules += ' Dc';
|
|
428
|
+
if (!$B) rules += ' BK';
|
|
429
|
+
if (!$C) rules += ' CK';
|
|
430
|
+
rules += ' Fc';
|
|
431
|
+
rules += ' Gc';
|
|
432
|
+
rules += ' an';
|
|
433
|
+
if (!$__d) rules += ' __d-3t1y';
|
|
434
|
+
if (!$__c) rules += ' __c-3t1y';
|
|
435
|
+
if (!$g) rules += ' g-3hmsa';
|
|
436
|
+
if (!$n) rules += ' no';
|
|
437
|
+
if (!$p) rules += ' po';
|
|
438
|
+
rules += ' __za';
|
|
439
|
+
rules += ' __Aa';
|
|
440
|
+
return rules;
|
|
441
|
+
};
|
|
442
|
+
function $b27519d6a701105b$export$3d96ec278d3efce4(props) {
|
|
443
|
+
let { showTabs: showTabs } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext);
|
|
444
|
+
let { selectedKey: selectedKey } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
|
|
445
|
+
if (showTabs) return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.TabPanel), {
|
|
355
446
|
...props,
|
|
356
|
-
ref: domRef,
|
|
357
447
|
style: props.UNSAFE_style,
|
|
358
|
-
className: (renderProps)=>(props.UNSAFE_className
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
448
|
+
className: (renderProps)=>(props.UNSAFE_className ?? '') + $b27519d6a701105b$var$tabPanel(renderProps, props.styles)
|
|
449
|
+
});
|
|
450
|
+
if (props.id !== selectedKey) return null;
|
|
451
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapsedTabPanel, {
|
|
452
|
+
...props
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
function $b27519d6a701105b$var$CollapsedTabPanel(props) {
|
|
456
|
+
let { UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '', ...otherProps } = props;
|
|
457
|
+
let { menuId: menuId, valueId: valueId } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext);
|
|
458
|
+
let ref = (0, $5oxdw$react.useRef)(null);
|
|
459
|
+
let tabIndex = (0, $5oxdw$reactariafocus.useHasTabbableChild)(ref) ? undefined : 0;
|
|
460
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Group), {
|
|
461
|
+
...otherProps,
|
|
462
|
+
ref: ref,
|
|
463
|
+
"aria-labelledby": menuId + ' ' + valueId,
|
|
464
|
+
tabIndex: tabIndex,
|
|
465
|
+
style: UNSAFE_style,
|
|
466
|
+
className: (renderProps)=>UNSAFE_className + $b27519d6a701105b$var$tabPanel(renderProps, props.styles)
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
function $b27519d6a701105b$var$isAllTabsDisabled(collection, disabledKeys) {
|
|
470
|
+
let testKey = null;
|
|
471
|
+
if (collection && collection.size > 0) {
|
|
472
|
+
testKey = collection.getFirstKey();
|
|
473
|
+
let index = 0;
|
|
474
|
+
while(testKey && index < collection.size){
|
|
475
|
+
// We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it
|
|
476
|
+
if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) return false;
|
|
477
|
+
testKey = collection.getKeyAfter(testKey);
|
|
478
|
+
index++;
|
|
479
|
+
}
|
|
480
|
+
return true;
|
|
481
|
+
}
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
let $b27519d6a701105b$var$HiddenTabs = function(props) {
|
|
485
|
+
let { listRef: listRef, items: items, size: size, density: density } = props;
|
|
486
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
487
|
+
// @ts-ignore
|
|
488
|
+
inert: "true",
|
|
489
|
+
ref: listRef,
|
|
490
|
+
className: " _3-17zqamw __a-17zqamw h-17zqamw i-17zqamw __b-17zqamw Ya _ba _da Za _aa __Ib __zb __Ab _O-3t1x",
|
|
491
|
+
children: items.map((item)=>{
|
|
492
|
+
// pull off individual props as an allow list, don't want refs or other props getting through
|
|
493
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
494
|
+
"data-hidden-tab": true,
|
|
495
|
+
style: item.props.UNSAFE_style,
|
|
496
|
+
className: item.props.className({
|
|
497
|
+
size: size,
|
|
498
|
+
density: density
|
|
499
|
+
}),
|
|
500
|
+
children: item.props.children({
|
|
501
|
+
size: size,
|
|
502
|
+
density: density
|
|
503
|
+
})
|
|
504
|
+
}, item.key);
|
|
374
505
|
})
|
|
375
506
|
});
|
|
376
|
-
}
|
|
507
|
+
};
|
|
508
|
+
let $b27519d6a701105b$var$TabsMenu = (props1)=>{
|
|
509
|
+
let { id: id, items: items, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, valueId: valueId } = props1;
|
|
510
|
+
let { density: density, onSelectionChange: onSelectionChange, selectedKey: selectedKey, isDisabled: isDisabled, disabledKeys: disabledKeys, labelBehavior: labelBehavior } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
|
|
511
|
+
let state = (0, $5oxdw$react.useContext)((0, $5oxdw$reactariacomponents.TabListStateContext));
|
|
512
|
+
let allKeysDisabled = (0, $5oxdw$react.useMemo)(()=>{
|
|
513
|
+
return $b27519d6a701105b$var$isAllTabsDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());
|
|
514
|
+
}, [
|
|
515
|
+
state?.collection,
|
|
516
|
+
disabledKeys
|
|
517
|
+
]);
|
|
518
|
+
let labelProps = (0, $5oxdw$reactariautils.useLabels)({
|
|
519
|
+
id: id,
|
|
520
|
+
'aria-label': ariaLabel,
|
|
521
|
+
'aria-labelledby': ariaLabelledBy
|
|
522
|
+
});
|
|
523
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
524
|
+
className: function anonymous(props) {
|
|
525
|
+
let rules = " .";
|
|
526
|
+
rules += ' _3d';
|
|
527
|
+
rules += ' __c-3t1x';
|
|
528
|
+
rules += ' _5c';
|
|
529
|
+
if (props.density === "regular") rules += ' j_a';
|
|
530
|
+
else if (props.density === "compact") rules += ' jU';
|
|
531
|
+
return rules;
|
|
532
|
+
}({
|
|
533
|
+
density: density
|
|
534
|
+
}),
|
|
535
|
+
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $9d2c38978395d44a$exports.Picker), {
|
|
536
|
+
id: id,
|
|
537
|
+
valueId: valueId,
|
|
538
|
+
...labelProps,
|
|
539
|
+
"aria-describedby": props1['aria-describedby'],
|
|
540
|
+
"aria-details": props1['aria-details'],
|
|
541
|
+
isDisabled: isDisabled || allKeysDisabled,
|
|
542
|
+
density: density,
|
|
543
|
+
labelBehavior: labelBehavior,
|
|
544
|
+
items: items,
|
|
545
|
+
disabledKeys: disabledKeys,
|
|
546
|
+
selectedKey: selectedKey,
|
|
547
|
+
onSelectionChange: onSelectionChange,
|
|
548
|
+
children: (item)=>{
|
|
549
|
+
return /*#__PURE__*/ (0, $5oxdw$react.createElement)((0, $9d2c38978395d44a$exports.PickerItem), {
|
|
550
|
+
...item.props.originalProps,
|
|
551
|
+
isDisabled: isDisabled || allKeysDisabled,
|
|
552
|
+
key: item.key
|
|
553
|
+
}, item.props.children({
|
|
554
|
+
density: density,
|
|
555
|
+
isMenu: true
|
|
556
|
+
}));
|
|
557
|
+
}
|
|
558
|
+
})
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
let $b27519d6a701105b$var$CollapsingTabs = ({ collection: collection, containerRef: containerRef, ...props })=>{
|
|
562
|
+
let { density: density = 'regular', orientation: orientation = 'horizontal', labelBehavior: labelBehavior = 'show', onSelectionChange: onSelectionChange } = props;
|
|
563
|
+
let [showItems, _setShowItems] = (0, $5oxdw$react.useState)(true);
|
|
564
|
+
showItems = orientation === 'vertical' ? true : showItems;
|
|
565
|
+
let setShowItems = (0, $5oxdw$react.useCallback)((value)=>{
|
|
566
|
+
if (orientation === 'vertical') // if orientation is vertical, we always show the items
|
|
567
|
+
_setShowItems(true);
|
|
568
|
+
else _setShowItems(value);
|
|
569
|
+
}, [
|
|
570
|
+
orientation
|
|
571
|
+
]);
|
|
572
|
+
let { direction: direction } = (0, $5oxdw$reactariai18n.useLocale)();
|
|
573
|
+
let children = (0, $5oxdw$react.useMemo)(()=>[
|
|
574
|
+
...collection
|
|
575
|
+
], [
|
|
576
|
+
collection
|
|
577
|
+
]);
|
|
578
|
+
let listRef = (0, $5oxdw$react.useRef)(null);
|
|
579
|
+
let updateOverflow = (0, $5oxdw$reactariautils.useEffectEvent)(()=>{
|
|
580
|
+
if (orientation === 'vertical' || !listRef.current || !containerRef?.current) return;
|
|
581
|
+
let container = listRef.current;
|
|
582
|
+
let containerRect = container.getBoundingClientRect();
|
|
583
|
+
let tabs = container.querySelectorAll('[data-hidden-tab]');
|
|
584
|
+
let lastTab = tabs[tabs.length - 1];
|
|
585
|
+
let lastTabRect = lastTab.getBoundingClientRect();
|
|
586
|
+
if (direction === 'ltr') setShowItems?.(lastTabRect.right <= containerRect.right);
|
|
587
|
+
else setShowItems?.(lastTabRect.left >= containerRect.left);
|
|
588
|
+
});
|
|
589
|
+
(0, $5oxdw$reactariautils.useResizeObserver)({
|
|
590
|
+
ref: containerRef,
|
|
591
|
+
onResize: updateOverflow
|
|
592
|
+
});
|
|
593
|
+
(0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
|
|
594
|
+
if (collection.size > 0) queueMicrotask(updateOverflow);
|
|
595
|
+
}, [
|
|
596
|
+
collection.size,
|
|
597
|
+
updateOverflow
|
|
598
|
+
]);
|
|
599
|
+
let prevOrientation = (0, $5oxdw$react.useRef)(orientation);
|
|
600
|
+
(0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
|
|
601
|
+
if (collection.size > 0 && prevOrientation.current !== orientation) updateOverflow();
|
|
602
|
+
prevOrientation.current = orientation;
|
|
603
|
+
}, [
|
|
604
|
+
collection.size,
|
|
605
|
+
updateOverflow,
|
|
606
|
+
orientation
|
|
607
|
+
]);
|
|
608
|
+
(0, $5oxdw$react.useEffect)(()=>{
|
|
609
|
+
// Recalculate visible tags when fonts are loaded.
|
|
610
|
+
document.fonts?.ready.then(()=>updateOverflow());
|
|
611
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
612
|
+
}, []);
|
|
613
|
+
let menuId = (0, $5oxdw$reactariautils.useId)();
|
|
614
|
+
let valueId = (0, $5oxdw$reactariautils.useId)();
|
|
615
|
+
let contents;
|
|
616
|
+
if (showItems) contents = /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tabs), {
|
|
617
|
+
...props,
|
|
618
|
+
style: {
|
|
619
|
+
display: 'contents'
|
|
620
|
+
},
|
|
621
|
+
children: props.children
|
|
622
|
+
});
|
|
623
|
+
else contents = /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsxs)((0, $5oxdw$reactjsxruntime.Fragment), {
|
|
624
|
+
children: [
|
|
625
|
+
/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabsMenu, {
|
|
626
|
+
id: menuId,
|
|
627
|
+
valueId: valueId,
|
|
628
|
+
items: children,
|
|
629
|
+
onSelectionChange: onSelectionChange,
|
|
630
|
+
"aria-label": props['aria-label'],
|
|
631
|
+
"aria-describedby": props['aria-labelledby']
|
|
632
|
+
}),
|
|
633
|
+
/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapseContext.Provider, {
|
|
634
|
+
value: {
|
|
635
|
+
showTabs: false,
|
|
636
|
+
menuId: menuId,
|
|
637
|
+
valueId: valueId
|
|
638
|
+
},
|
|
639
|
+
children: props.children
|
|
640
|
+
})
|
|
641
|
+
]
|
|
642
|
+
});
|
|
643
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsxs)("div", {
|
|
644
|
+
style: props.UNSAFE_style,
|
|
645
|
+
className: (props.UNSAFE_className || '') + $b27519d6a701105b$var$tabs({
|
|
646
|
+
orientation: orientation
|
|
647
|
+
}, props.styles),
|
|
648
|
+
ref: containerRef,
|
|
649
|
+
children: [
|
|
650
|
+
/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
651
|
+
className: $b27519d6a701105b$var$tablist({
|
|
652
|
+
orientation: orientation,
|
|
653
|
+
labelBehavior: labelBehavior,
|
|
654
|
+
density: density
|
|
655
|
+
}),
|
|
656
|
+
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$HiddenTabs, {
|
|
657
|
+
items: children,
|
|
658
|
+
density: density,
|
|
659
|
+
listRef: listRef
|
|
660
|
+
})
|
|
661
|
+
}),
|
|
662
|
+
/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapseContext.Provider, {
|
|
663
|
+
value: {
|
|
664
|
+
showTabs: true,
|
|
665
|
+
menuId: menuId,
|
|
666
|
+
valueId: valueId
|
|
667
|
+
},
|
|
668
|
+
children: contents
|
|
669
|
+
})
|
|
670
|
+
]
|
|
671
|
+
});
|
|
672
|
+
};
|
|
377
673
|
|
|
378
674
|
|
|
379
675
|
//# sourceMappingURL=Tabs.cjs.map
|