@react-spectrum/s2 3.0.0-nightly-101d0772b-250112 → 3.0.0-nightly-1b425caa2-250114
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/ActionBar.cjs +11 -8
- package/dist/ActionBar.cjs.map +1 -1
- package/dist/ActionBar.css +15 -32
- package/dist/ActionBar.css.map +1 -1
- package/dist/ActionBar.mjs +12 -9
- package/dist/ActionBar.mjs.map +1 -1
- package/dist/Modal.cjs +15 -21
- package/dist/Modal.cjs.map +1 -1
- package/dist/Modal.css +22 -46
- package/dist/Modal.css.map +1 -1
- package/dist/Modal.mjs +15 -21
- package/dist/Modal.mjs.map +1 -1
- package/dist/Popover.cjs +19 -37
- package/dist/Popover.cjs.map +1 -1
- package/dist/Popover.css +28 -99
- package/dist/Popover.css.map +1 -1
- package/dist/Popover.mjs +19 -37
- package/dist/Popover.mjs.map +1 -1
- package/dist/Tabs.cjs +177 -414
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css +120 -208
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +179 -416
- package/dist/Tabs.mjs.map +1 -1
- package/dist/Tooltip.cjs +19 -16
- package/dist/Tooltip.cjs.map +1 -1
- package/dist/Tooltip.css +25 -40
- package/dist/Tooltip.css.map +1 -1
- package/dist/Tooltip.mjs +19 -16
- package/dist/Tooltip.mjs.map +1 -1
- package/dist/en-US.cjs +0 -1
- package/dist/en-US.cjs.map +1 -1
- package/dist/en-US.mjs +0 -1
- package/dist/en-US.mjs.map +1 -1
- package/dist/he-IL.cjs +0 -1
- package/dist/he-IL.cjs.map +1 -1
- package/dist/he-IL.mjs +0 -1
- package/dist/he-IL.mjs.map +1 -1
- package/dist/types.d.ts +7 -11
- package/dist/types.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/ActionBar.tsx +15 -18
- package/src/Modal.tsx +17 -44
- package/src/Popover.tsx +21 -89
- package/src/Tabs.tsx +156 -427
- package/src/Tooltip.tsx +25 -42
- package/dist/TabsPicker.cjs +0 -388
- package/dist/TabsPicker.cjs.map +0 -1
- package/dist/TabsPicker.css +0 -440
- package/dist/TabsPicker.css.map +0 -1
- package/dist/TabsPicker.mjs +0 -382
- package/dist/TabsPicker.mjs.map +0 -1
- package/src/TabsPicker.tsx +0 -341
package/dist/Tabs.cjs
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
require("./Tabs.css");
|
|
2
2
|
var $e991cbcdf82ced71$exports = require("./CenterBaseline.cjs");
|
|
3
3
|
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
|
|
4
|
-
var $4526404114e78c80$exports = require("./intlStrings.cjs");
|
|
5
|
-
var $9d2c38978395d44a$exports = require("./TabsPicker.cjs");
|
|
6
4
|
var $6367bc87eb7d24ad$exports = require("./Content.cjs");
|
|
7
5
|
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
|
|
8
6
|
var $5oxdw$reactjsxruntime = require("react/jsx-runtime");
|
|
9
|
-
var $5oxdw$react = require("react");
|
|
10
7
|
var $5oxdw$reactariacomponents = require("react-aria-components");
|
|
11
|
-
var $5oxdw$
|
|
8
|
+
var $5oxdw$react = require("react");
|
|
12
9
|
var $5oxdw$reactspectrumutils = require("@react-spectrum/utils");
|
|
13
10
|
var $5oxdw$reactariautils = require("@react-aria/utils");
|
|
14
11
|
var $5oxdw$reactariai18n = require("@react-aria/i18n");
|
|
15
12
|
|
|
16
13
|
|
|
17
|
-
function $parcel$interopDefault(a) {
|
|
18
|
-
return a && a.__esModule ? a.default : a;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
14
|
function $parcel$export(e, n, v, s) {
|
|
22
15
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
23
16
|
}
|
|
24
17
|
|
|
25
18
|
$parcel$export(module.exports, "TabsContext", () => $b27519d6a701105b$export$cfa7aa87c26e7d1f);
|
|
26
|
-
$parcel$export(module.exports, "Tabs", () => $b27519d6a701105b$export$b2539bed5023c21c);
|
|
27
|
-
$parcel$export(module.exports, "TabList", () => $b27519d6a701105b$export$e51a686c67fdaa2d);
|
|
28
|
-
$parcel$export(module.exports, "Tab", () => $b27519d6a701105b$export$3e41faf802a29e71);
|
|
29
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
|
+
$parcel$export(module.exports, "Tabs", () => $b27519d6a701105b$export$b2539bed5023c21c);
|
|
30
23
|
/*
|
|
31
24
|
* Copyright 2024 Adobe. All rights reserved.
|
|
32
25
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -47,92 +40,135 @@ $parcel$export(module.exports, "TabPanel", () => $b27519d6a701105b$export$3d96ec
|
|
|
47
40
|
|
|
48
41
|
|
|
49
42
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
43
|
const $b27519d6a701105b$export$cfa7aa87c26e7d1f = /*#__PURE__*/ (0, $5oxdw$react.createContext)(null);
|
|
54
|
-
const $b27519d6a701105b$var$
|
|
55
|
-
onFocus: ()=>{}
|
|
56
|
-
});
|
|
57
|
-
const $b27519d6a701105b$var$tabs = function anonymous(props, overrides) {
|
|
44
|
+
const $b27519d6a701105b$var$tabPanel = function anonymous(props, overrides) {
|
|
58
45
|
let rules = " .";
|
|
59
46
|
let matches = (overrides || '').match(/(?:^|\s)(?:y|z|A|B|__a|_9|h|_6|_5|__B|__d|__e|__b|__c|V|__R|Y|_a|W|X|l|q|r|k|o|p)[^\s]+/g) || [];
|
|
60
47
|
rules += matches.join('');
|
|
48
|
+
let $A = false;
|
|
49
|
+
let $__a = false;
|
|
50
|
+
let $h = false;
|
|
51
|
+
let $o = false;
|
|
52
|
+
let $q = false;
|
|
53
|
+
for (let p of matches){
|
|
54
|
+
if (/^\s*A/.test(p)) $A = true;
|
|
55
|
+
if (/^\s*__a/.test(p)) $__a = true;
|
|
56
|
+
if (/^\s*h/.test(p)) $h = true;
|
|
57
|
+
if (/^\s*o/.test(p)) $o = true;
|
|
58
|
+
if (/^\s*q/.test(p)) $q = true;
|
|
59
|
+
}
|
|
60
|
+
if (!$A) rules += ' Ac';
|
|
61
|
+
rules += ' an';
|
|
62
|
+
if (!$__a) rules += ' __a-3t1y';
|
|
63
|
+
if (!$h) rules += ' h-3hmsa';
|
|
64
|
+
if (!$o) rules += ' oo';
|
|
65
|
+
if (!$q) rules += ' qo';
|
|
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)(?:y|z|A|B|__a|_9|h|_6|_5|__B|__d|__e|__b|__c|V|__R|Y|_a|W|X|l|q|r)[^\s]+/g) || [];
|
|
78
|
+
rules += matches.join('');
|
|
79
|
+
let $V = false;
|
|
61
80
|
let $_9 = false;
|
|
62
|
-
for (let p of matches)
|
|
81
|
+
for (let p of matches){
|
|
82
|
+
if (/^\s*V/.test(p)) $V = true;
|
|
83
|
+
if (/^\s*_9/.test(p)) $_9 = true;
|
|
84
|
+
}
|
|
85
|
+
if (props.isFocusVisible) rules += ' _Mb';
|
|
86
|
+
else rules += ' _Ma';
|
|
87
|
+
rules += ' da_____M';
|
|
88
|
+
rules += ' dx';
|
|
89
|
+
rules += ' _Oc';
|
|
90
|
+
rules += ' _N-3t1z';
|
|
63
91
|
rules += ' _0d';
|
|
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 += ' _wb';
|
|
110
|
+
rules += ' _xb';
|
|
111
|
+
rules += ' _yb';
|
|
112
|
+
rules += ' _zb';
|
|
113
|
+
rules += ' ibH';
|
|
114
|
+
rules += ' iG';
|
|
115
|
+
rules += ' jbH';
|
|
116
|
+
rules += ' jG';
|
|
117
|
+
if (props.density === "regular") rules += ' k_a';
|
|
118
|
+
else if (props.density === "compact") rules += ' kU';
|
|
119
|
+
rules += ' _2c';
|
|
120
|
+
if (!$V) rules += ' Vc';
|
|
121
|
+
rules += ' __Ib';
|
|
64
122
|
if (!$_9) rules += ' _9-3t1x';
|
|
65
|
-
rules += '
|
|
66
|
-
rules += '
|
|
67
|
-
rules += '
|
|
68
|
-
rules += ' _d-enzzrge';
|
|
69
|
-
rules += ' _d-enzykdd';
|
|
70
|
-
rules += ' _d-enzwzjc';
|
|
71
|
-
rules += ' _d-enzrfpb';
|
|
72
|
-
rules += ' _da';
|
|
73
|
-
rules += ' _ebf';
|
|
74
|
-
rules += ' _ee';
|
|
75
|
-
rules += ' _fb';
|
|
76
|
-
rules += ' _g-1x99dlob';
|
|
77
|
-
rules += ' _ga';
|
|
78
|
-
rules += ' an';
|
|
79
|
-
if (props.orientation === "horizontal") rules += ' _7b';
|
|
123
|
+
rules += ' _Pa';
|
|
124
|
+
rules += ' _R-375x7f';
|
|
125
|
+
rules += ' _Sa';
|
|
80
126
|
return rules;
|
|
81
127
|
};
|
|
82
|
-
const $b27519d6a701105b$
|
|
83
|
-
|
|
84
|
-
let { density: density
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
style: props.UNSAFE_style,
|
|
113
|
-
className: (renderProps)=>(props.UNSAFE_className || '') + $b27519d6a701105b$var$tabs({
|
|
114
|
-
...renderProps
|
|
115
|
-
}, props.styles),
|
|
128
|
+
const $b27519d6a701105b$var$icon = " . _9-3t1x -rwx0fg_e-b";
|
|
129
|
+
function $b27519d6a701105b$export$3e41faf802a29e71(props) {
|
|
130
|
+
let { density: density } = (0, $5oxdw$reactariacomponents.useSlottedContext)($b27519d6a701105b$export$cfa7aa87c26e7d1f) ?? {};
|
|
131
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tab), {
|
|
132
|
+
...props,
|
|
133
|
+
style: props.UNSAFE_style,
|
|
134
|
+
className: (renderProps)=>(props.UNSAFE_className || '') + $b27519d6a701105b$var$tab({
|
|
135
|
+
...renderProps,
|
|
136
|
+
density: density
|
|
137
|
+
}, props.styles),
|
|
138
|
+
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Provider), {
|
|
139
|
+
values: [
|
|
140
|
+
[
|
|
141
|
+
(0, $6367bc87eb7d24ad$exports.TextContext),
|
|
142
|
+
{
|
|
143
|
+
styles: " . __B-3t1y"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
[
|
|
147
|
+
(0, $bde97c91243ed164$exports.IconContext),
|
|
148
|
+
{
|
|
149
|
+
render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
|
|
150
|
+
slot: 'icon',
|
|
151
|
+
styles: " . __B-3t1x"
|
|
152
|
+
}),
|
|
153
|
+
styles: $b27519d6a701105b$var$icon
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
],
|
|
157
|
+
children: typeof props.children === 'string' ? /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
|
|
116
158
|
children: props.children
|
|
117
|
-
})
|
|
159
|
+
}) : props.children
|
|
118
160
|
})
|
|
119
161
|
});
|
|
120
|
-
}
|
|
162
|
+
}
|
|
121
163
|
const $b27519d6a701105b$var$tablist = function anonymous(props) {
|
|
122
164
|
let rules = " .";
|
|
123
165
|
rules += ' _0d';
|
|
124
166
|
if (props.orientation === "horizontal") {
|
|
125
|
-
if (props.
|
|
126
|
-
if (props.density === "regular") rules += ' ih';
|
|
127
|
-
else if (props.density === "compact") rules += ' if';
|
|
128
|
-
} else if (props.density === "regular") rules += ' ij';
|
|
167
|
+
if (props.density === "regular") rules += ' ij';
|
|
129
168
|
else if (props.density === "compact") rules += ' ih';
|
|
130
169
|
}
|
|
131
170
|
if (props.orientation === "horizontal") {
|
|
132
|
-
if (props.
|
|
133
|
-
if (props.density === "regular") rules += ' jh';
|
|
134
|
-
else if (props.density === "compact") rules += ' jf';
|
|
135
|
-
} else if (props.density === "regular") rules += ' jj';
|
|
171
|
+
if (props.density === "regular") rules += ' jj';
|
|
136
172
|
else if (props.density === "compact") rules += ' jh';
|
|
137
173
|
}
|
|
138
174
|
if (props.orientation === "vertical") rules += ' _7b';
|
|
@@ -143,32 +179,18 @@ const $b27519d6a701105b$var$tablist = function anonymous(props) {
|
|
|
143
179
|
return rules;
|
|
144
180
|
};
|
|
145
181
|
function $b27519d6a701105b$export$e51a686c67fdaa2d(props1) {
|
|
146
|
-
let { density: density, isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation
|
|
147
|
-
let { showItems: showItems } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext) ?? {};
|
|
182
|
+
let { density: density, isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation } = (0, $5oxdw$reactariacomponents.useSlottedContext)($b27519d6a701105b$export$cfa7aa87c26e7d1f) ?? {};
|
|
148
183
|
let state = (0, $5oxdw$react.useContext)((0, $5oxdw$reactariacomponents.TabListStateContext));
|
|
149
184
|
let [selectedTab, setSelectedTab] = (0, $5oxdw$react.useState)(undefined);
|
|
150
185
|
let tablistRef = (0, $5oxdw$react.useRef)(null);
|
|
151
186
|
(0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
|
|
152
|
-
if (tablistRef?.current
|
|
187
|
+
if (tablistRef?.current) {
|
|
153
188
|
let tab = tablistRef.current.querySelector('[role=tab][data-selected=true]');
|
|
154
189
|
if (tab != null) setSelectedTab(tab);
|
|
155
|
-
} else if (tablistRef?.current) {
|
|
156
|
-
let picker = tablistRef.current.querySelector('button');
|
|
157
|
-
if (picker != null) setSelectedTab(picker);
|
|
158
190
|
}
|
|
159
191
|
}, [
|
|
160
192
|
tablistRef,
|
|
161
|
-
state?.selectedItem?.key
|
|
162
|
-
showItems
|
|
163
|
-
]);
|
|
164
|
-
let prevFocused = (0, $5oxdw$react.useRef)(false);
|
|
165
|
-
(0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
|
|
166
|
-
if (!showItems && !prevFocused.current && state?.selectionManager.isFocused) onFocus();
|
|
167
|
-
prevFocused.current = state?.selectionManager.isFocused;
|
|
168
|
-
}, [
|
|
169
|
-
state?.selectionManager.isFocused,
|
|
170
|
-
state?.selectionManager.focusedKey,
|
|
171
|
-
showItems
|
|
193
|
+
state?.selectedItem?.key
|
|
172
194
|
]);
|
|
173
195
|
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsxs)("div", {
|
|
174
196
|
style: props1.UNSAFE_style,
|
|
@@ -182,7 +204,7 @@ function $b27519d6a701105b$export$e51a686c67fdaa2d(props1) {
|
|
|
182
204
|
return rules;
|
|
183
205
|
}(null, props1.styles),
|
|
184
206
|
children: [
|
|
185
|
-
|
|
207
|
+
orientation === 'vertical' && /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabLine, {
|
|
186
208
|
disabledKeys: disabledKeys,
|
|
187
209
|
isDisabled: isDisabled,
|
|
188
210
|
selectedTab: selectedTab,
|
|
@@ -194,12 +216,10 @@ function $b27519d6a701105b$export$e51a686c67fdaa2d(props1) {
|
|
|
194
216
|
ref: tablistRef,
|
|
195
217
|
className: (renderProps)=>$b27519d6a701105b$var$tablist({
|
|
196
218
|
...renderProps,
|
|
197
|
-
labelBehavior: labelBehavior,
|
|
198
219
|
density: density
|
|
199
220
|
})
|
|
200
221
|
}),
|
|
201
222
|
orientation === 'horizontal' && /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabLine, {
|
|
202
|
-
showItems: showItems,
|
|
203
223
|
disabledKeys: disabledKeys,
|
|
204
224
|
isDisabled: isDisabled,
|
|
205
225
|
selectedTab: selectedTab,
|
|
@@ -209,6 +229,21 @@ function $b27519d6a701105b$export$e51a686c67fdaa2d(props1) {
|
|
|
209
229
|
]
|
|
210
230
|
});
|
|
211
231
|
}
|
|
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
|
+
}
|
|
212
247
|
const $b27519d6a701105b$var$selectedIndicator = function anonymous(props) {
|
|
213
248
|
let rules = " .";
|
|
214
249
|
rules += ' Va';
|
|
@@ -237,12 +272,16 @@ function $b27519d6a701105b$var$TabLine(props) {
|
|
|
237
272
|
let { disabledKeys: disabledKeys, isDisabled: isTabsDisabled, selectedTab: selectedTab, orientation: orientation, density: density } = props;
|
|
238
273
|
let { direction: direction } = (0, $5oxdw$reactariai18n.useLocale)();
|
|
239
274
|
let state = (0, $5oxdw$react.useContext)((0, $5oxdw$reactariacomponents.TabListStateContext));
|
|
240
|
-
|
|
241
|
-
|
|
275
|
+
// We want to add disabled styling to the selection indicator only if all the Tabs are disabled
|
|
276
|
+
let [isDisabled, setIsDisabled] = (0, $5oxdw$react.useState)(false);
|
|
277
|
+
(0, $5oxdw$react.useEffect)(()=>{
|
|
278
|
+
let isDisabled = isTabsDisabled || $b27519d6a701105b$var$isAllTabsDisabled(state?.collection || null, disabledKeys ? new Set(disabledKeys) : new Set(null));
|
|
279
|
+
setIsDisabled(isDisabled);
|
|
242
280
|
}, [
|
|
243
281
|
state?.collection,
|
|
244
282
|
disabledKeys,
|
|
245
|
-
isTabsDisabled
|
|
283
|
+
isTabsDisabled,
|
|
284
|
+
setIsDisabled
|
|
246
285
|
]);
|
|
247
286
|
let [style, setStyle] = (0, $5oxdw$react.useState)({
|
|
248
287
|
transform: undefined,
|
|
@@ -274,17 +313,10 @@ function $b27519d6a701105b$var$TabLine(props) {
|
|
|
274
313
|
}, [
|
|
275
314
|
onResize,
|
|
276
315
|
state?.selectedItem?.key,
|
|
316
|
+
direction,
|
|
317
|
+
orientation,
|
|
277
318
|
density
|
|
278
319
|
]);
|
|
279
|
-
let ref = (0, $5oxdw$react.useRef)(selectedTab);
|
|
280
|
-
// assign ref before the useResizeObserver useEffect runs
|
|
281
|
-
(0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
|
|
282
|
-
ref.current = selectedTab;
|
|
283
|
-
});
|
|
284
|
-
(0, $5oxdw$reactariautils.useResizeObserver)({
|
|
285
|
-
ref: ref,
|
|
286
|
-
onResize: onResize
|
|
287
|
-
});
|
|
288
320
|
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
289
321
|
style: {
|
|
290
322
|
...style
|
|
@@ -295,322 +327,53 @@ function $b27519d6a701105b$var$TabLine(props) {
|
|
|
295
327
|
})
|
|
296
328
|
});
|
|
297
329
|
}
|
|
298
|
-
const $b27519d6a701105b$var$
|
|
330
|
+
const $b27519d6a701105b$var$tabs = function anonymous(props, overrides) {
|
|
299
331
|
let rules = " .";
|
|
300
|
-
let matches = (overrides || '').match(/(?:^|\s)(?:y|z|A|B|__a|_9|h|_6|_5|__B|__d|__e|__b|__c|V|__R|Y|_a|W|X|l|q|r)[^\s]+/g) || [];
|
|
332
|
+
let matches = (overrides || '').match(/(?:^|\s)(?:y|z|A|B|__a|_9|h|_6|_5|__B|__d|__e|__b|__c|V|__R|Y|_a|W|X|l|q|r|k|o|p)[^\s]+/g) || [];
|
|
301
333
|
rules += matches.join('');
|
|
302
|
-
let $V = false;
|
|
303
334
|
let $_9 = false;
|
|
304
|
-
for (let p of matches)
|
|
305
|
-
if (/^\s*V/.test(p)) $V = true;
|
|
306
|
-
if (/^\s*_9/.test(p)) $_9 = true;
|
|
307
|
-
}
|
|
308
|
-
if (props.isFocusVisible) rules += ' _Mb';
|
|
309
|
-
else rules += ' _Ma';
|
|
310
|
-
rules += ' da_____M';
|
|
311
|
-
rules += ' dx';
|
|
312
|
-
rules += ' _Oc';
|
|
313
|
-
rules += ' _N-3t1z';
|
|
335
|
+
for (let p of matches)if (/^\s*_9/.test(p)) $_9 = true;
|
|
314
336
|
rules += ' _0d';
|
|
315
|
-
if (props.isDisabled) rules += ' aa_____O';
|
|
316
|
-
else if (props.isSelected) rules += ' aa_____M';
|
|
317
|
-
if (props.isDisabled) rules += ' aj';
|
|
318
|
-
else if (props.isHovered) {
|
|
319
|
-
if (props.isPressed) rules += ' an';
|
|
320
|
-
else if (props.isFocusVisible) rules += ' an';
|
|
321
|
-
else if (props.isHovered) rules += ' an';
|
|
322
|
-
else rules += ' am';
|
|
323
|
-
} else if (props.isSelected) {
|
|
324
|
-
if (props.isPressed) rules += ' ao';
|
|
325
|
-
else if (props.isFocusVisible) rules += ' ao';
|
|
326
|
-
else rules += ' an';
|
|
327
|
-
} else {
|
|
328
|
-
if (props.isPressed) rules += ' an';
|
|
329
|
-
else if (props.isFocusVisible) rules += ' an';
|
|
330
|
-
else rules += ' am';
|
|
331
|
-
}
|
|
332
|
-
rules += ' _wb';
|
|
333
|
-
rules += ' _xb';
|
|
334
|
-
rules += ' _yb';
|
|
335
|
-
rules += ' _zb';
|
|
336
|
-
rules += ' ibH';
|
|
337
|
-
rules += ' iG';
|
|
338
|
-
rules += ' jbH';
|
|
339
|
-
rules += ' jG';
|
|
340
|
-
if (props.density === "regular") rules += ' k_a';
|
|
341
|
-
else if (props.density === "compact") rules += ' kU';
|
|
342
|
-
rules += ' _2c';
|
|
343
|
-
if (!$V) rules += ' Vc';
|
|
344
|
-
rules += ' __Ib';
|
|
345
337
|
if (!$_9) rules += ' _9-3t1x';
|
|
346
|
-
rules += '
|
|
347
|
-
rules += '
|
|
348
|
-
rules += '
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tab), {
|
|
357
|
-
...props1,
|
|
358
|
-
// @ts-ignore
|
|
359
|
-
originalProps: props1,
|
|
360
|
-
style: props1.UNSAFE_style,
|
|
361
|
-
className: (renderProps)=>(props1.UNSAFE_className || '') + $b27519d6a701105b$var$tab({
|
|
362
|
-
...renderProps,
|
|
363
|
-
density: density,
|
|
364
|
-
labelBehavior: labelBehavior
|
|
365
|
-
}, props1.styles),
|
|
366
|
-
children: ({ isMenu: // @ts-ignore
|
|
367
|
-
isMenu })=>{
|
|
368
|
-
if (isMenu) return props1.children;
|
|
369
|
-
else return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Provider), {
|
|
370
|
-
values: [
|
|
371
|
-
[
|
|
372
|
-
(0, $6367bc87eb7d24ad$exports.TextContext),
|
|
373
|
-
{
|
|
374
|
-
styles: function anonymous(props) {
|
|
375
|
-
let rules = " .";
|
|
376
|
-
rules += ' __B-3t1y';
|
|
377
|
-
if (props.labelBehavior === "hide") rules += ' _0j';
|
|
378
|
-
return rules;
|
|
379
|
-
}({
|
|
380
|
-
labelBehavior: labelBehavior
|
|
381
|
-
})
|
|
382
|
-
}
|
|
383
|
-
],
|
|
384
|
-
[
|
|
385
|
-
(0, $bde97c91243ed164$exports.IconContext),
|
|
386
|
-
{
|
|
387
|
-
render: (0, $e991cbcdf82ced71$exports.centerBaseline)({
|
|
388
|
-
slot: 'icon',
|
|
389
|
-
styles: " . __B-3t1x"
|
|
390
|
-
}),
|
|
391
|
-
styles: $b27519d6a701105b$var$icon
|
|
392
|
-
}
|
|
393
|
-
]
|
|
394
|
-
],
|
|
395
|
-
children: typeof props1.children === 'string' ? /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $6367bc87eb7d24ad$exports.Text), {
|
|
396
|
-
children: props1.children
|
|
397
|
-
}) : props1.children
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
const $b27519d6a701105b$var$tabPanel = function anonymous(props, overrides) {
|
|
403
|
-
let rules = " .";
|
|
404
|
-
let matches = (overrides || '').match(/(?:^|\s)(?:y|z|A|B|__a|_9|h|_6|_5|__B|__d|__e|__b|__c|V|__R|Y|_a|W|X|l|q|r|k|o|p)[^\s]+/g) || [];
|
|
405
|
-
rules += matches.join('');
|
|
406
|
-
let $A = false;
|
|
407
|
-
let $__a = false;
|
|
408
|
-
let $h = false;
|
|
409
|
-
let $o = false;
|
|
410
|
-
let $q = false;
|
|
411
|
-
for (let p of matches){
|
|
412
|
-
if (/^\s*A/.test(p)) $A = true;
|
|
413
|
-
if (/^\s*__a/.test(p)) $__a = true;
|
|
414
|
-
if (/^\s*h/.test(p)) $h = true;
|
|
415
|
-
if (/^\s*o/.test(p)) $o = true;
|
|
416
|
-
if (/^\s*q/.test(p)) $q = true;
|
|
417
|
-
}
|
|
418
|
-
if (!$A) rules += ' Ac';
|
|
419
|
-
rules += ' an';
|
|
420
|
-
if (!$__a) rules += ' __a-3t1y';
|
|
421
|
-
if (!$h) rules += ' h-3hmsa';
|
|
422
|
-
if (!$o) rules += ' oo';
|
|
423
|
-
if (!$q) rules += ' qo';
|
|
338
|
+
rules += ' _d-bc1l9oh';
|
|
339
|
+
rules += ' _d-1uotwbwg';
|
|
340
|
+
rules += ' _d-eo0c6sf';
|
|
341
|
+
rules += ' _d-enzzrge';
|
|
342
|
+
rules += ' _d-enzykdd';
|
|
343
|
+
rules += ' _d-enzwzjc';
|
|
344
|
+
rules += ' _d-enzrfpb';
|
|
345
|
+
rules += ' _da';
|
|
346
|
+
rules += ' _fb';
|
|
347
|
+
if (props.orientation === "horizontal") rules += ' _7b';
|
|
424
348
|
return rules;
|
|
425
349
|
};
|
|
426
|
-
|
|
427
|
-
|
|
350
|
+
const $b27519d6a701105b$export$b2539bed5023c21c = /*#__PURE__*/ (0, $5oxdw$react.forwardRef)(function Tabs(props, ref) {
|
|
351
|
+
[props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $b27519d6a701105b$export$cfa7aa87c26e7d1f);
|
|
352
|
+
let { density: density = 'regular', isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation = 'horizontal' } = props;
|
|
353
|
+
let domRef = (0, $5oxdw$reactspectrumutils.useDOMRef)(ref);
|
|
354
|
+
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tabs), {
|
|
428
355
|
...props,
|
|
356
|
+
ref: domRef,
|
|
429
357
|
style: props.UNSAFE_style,
|
|
430
|
-
className: (props.UNSAFE_className || '') + $b27519d6a701105b$var$
|
|
431
|
-
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
while(testKey && index < collection.size){
|
|
439
|
-
// We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it
|
|
440
|
-
if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) return false;
|
|
441
|
-
testKey = collection.getKeyAfter(testKey);
|
|
442
|
-
index++;
|
|
443
|
-
}
|
|
444
|
-
return true;
|
|
445
|
-
}
|
|
446
|
-
return false;
|
|
447
|
-
}
|
|
448
|
-
let $b27519d6a701105b$var$HiddenTabs = function(props) {
|
|
449
|
-
let { listRef: listRef, items: items, size: size, density: density } = props;
|
|
450
|
-
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
451
|
-
// @ts-ignore
|
|
452
|
-
inert: "true",
|
|
453
|
-
ref: listRef,
|
|
454
|
-
className: " . _0-17zqamw _7-17zqamw i-17zqamw j-17zqamw _8-17zqamw Va Ya _aa Wa Xa __Fb __wb __xb _L-3t1x",
|
|
455
|
-
children: items.map((item)=>{
|
|
456
|
-
// pull off individual props as an allow list, don't want refs or other props getting through
|
|
457
|
-
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
458
|
-
"data-hidden-tab": true,
|
|
459
|
-
style: item.props.UNSAFE_style,
|
|
460
|
-
className: item.props.className({
|
|
461
|
-
size: size,
|
|
462
|
-
density: density
|
|
463
|
-
}),
|
|
464
|
-
children: item.props.children({
|
|
465
|
-
size: size,
|
|
466
|
-
density: density
|
|
467
|
-
})
|
|
468
|
-
}, item.key);
|
|
469
|
-
})
|
|
470
|
-
});
|
|
471
|
-
};
|
|
472
|
-
let $b27519d6a701105b$var$TabsMenu = (props1)=>{
|
|
473
|
-
let stringFormatter = (0, $5oxdw$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
|
|
474
|
-
let { items: items } = props1;
|
|
475
|
-
let { density: density, onSelectionChange: onSelectionChange, selectedKey: selectedKey, isDisabled: isDisabled, disabledKeys: disabledKeys, pickerRef: pickerRef, labelBehavior: labelBehavior } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
|
|
476
|
-
let state = (0, $5oxdw$react.useContext)((0, $5oxdw$reactariacomponents.TabListStateContext));
|
|
477
|
-
let allKeysDisabled = (0, $5oxdw$react.useMemo)(()=>{
|
|
478
|
-
return $b27519d6a701105b$var$isAllTabsDisabled(state?.collection, disabledKeys ? new Set(disabledKeys) : new Set());
|
|
479
|
-
}, [
|
|
480
|
-
state?.collection,
|
|
481
|
-
disabledKeys
|
|
482
|
-
]);
|
|
483
|
-
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.UNSTABLE_CollectionRendererContext).Provider, {
|
|
484
|
-
value: (0, $5oxdw$reactariacomponents.UNSTABLE_DefaultCollectionRenderer),
|
|
485
|
-
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)("div", {
|
|
486
|
-
className: function anonymous(props) {
|
|
487
|
-
let rules = " .";
|
|
488
|
-
rules += ' _0d';
|
|
489
|
-
rules += ' _2c';
|
|
490
|
-
if (props.density === "regular") rules += ' k_a';
|
|
491
|
-
else if (props.density === "compact") rules += ' kU';
|
|
492
|
-
return rules;
|
|
493
|
-
}({
|
|
494
|
-
density: density
|
|
495
|
-
}),
|
|
496
|
-
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $9d2c38978395d44a$exports.Picker), {
|
|
497
|
-
ref: pickerRef ? pickerRef : undefined,
|
|
498
|
-
isDisabled: isDisabled || allKeysDisabled,
|
|
499
|
-
density: density,
|
|
500
|
-
labelBehavior: labelBehavior,
|
|
501
|
-
items: items,
|
|
502
|
-
disabledKeys: disabledKeys,
|
|
503
|
-
selectedKey: selectedKey,
|
|
504
|
-
onSelectionChange: onSelectionChange,
|
|
505
|
-
"aria-label": stringFormatter.format('tabs.selectorLabel'),
|
|
506
|
-
children: (item)=>{
|
|
507
|
-
// need to determine the best way to handle icon only -> icon and text
|
|
508
|
-
// good enough to aria-label the picker item?
|
|
509
|
-
return /*#__PURE__*/ (0, $5oxdw$react.createElement)((0, $9d2c38978395d44a$exports.PickerItem), {
|
|
510
|
-
...item.props.originalProps,
|
|
511
|
-
isDisabled: isDisabled || allKeysDisabled,
|
|
512
|
-
key: item.key
|
|
513
|
-
}, item.props.children({
|
|
358
|
+
className: (renderProps)=>(props.UNSAFE_className || '') + $b27519d6a701105b$var$tabs({
|
|
359
|
+
...renderProps
|
|
360
|
+
}, props.styles),
|
|
361
|
+
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Provider), {
|
|
362
|
+
values: [
|
|
363
|
+
[
|
|
364
|
+
$b27519d6a701105b$export$cfa7aa87c26e7d1f,
|
|
365
|
+
{
|
|
514
366
|
density: density,
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
367
|
+
isDisabled: isDisabled,
|
|
368
|
+
disabledKeys: disabledKeys,
|
|
369
|
+
orientation: orientation
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
],
|
|
373
|
+
children: props.children
|
|
519
374
|
})
|
|
520
375
|
});
|
|
521
|
-
};
|
|
522
|
-
// Context for passing the count for the custom renderer
|
|
523
|
-
let $b27519d6a701105b$var$CollapseContext = /*#__PURE__*/ (0, $5oxdw$react.createContext)(null);
|
|
524
|
-
function $b27519d6a701105b$var$CollapsingCollection({ children: children, containerRef: containerRef }) {
|
|
525
|
-
let [showItems, _setShowItems] = (0, $5oxdw$react.useState)(true);
|
|
526
|
-
let { orientation: orientation } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
|
|
527
|
-
let setShowItems = (0, $5oxdw$react.useCallback)((value)=>{
|
|
528
|
-
if (orientation === 'vertical') // if orientation is vertical, we always show the items
|
|
529
|
-
_setShowItems(true);
|
|
530
|
-
else _setShowItems(value);
|
|
531
|
-
}, [
|
|
532
|
-
orientation
|
|
533
|
-
]);
|
|
534
|
-
let ctx = (0, $5oxdw$react.useMemo)(()=>({
|
|
535
|
-
containerRef: containerRef,
|
|
536
|
-
showItems: orientation === 'vertical' ? true : showItems,
|
|
537
|
-
setShowItems: setShowItems
|
|
538
|
-
}), [
|
|
539
|
-
containerRef,
|
|
540
|
-
showItems,
|
|
541
|
-
setShowItems
|
|
542
|
-
]);
|
|
543
|
-
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$CollapseContext.Provider, {
|
|
544
|
-
value: ctx,
|
|
545
|
-
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.UNSTABLE_CollectionRendererContext).Provider, {
|
|
546
|
-
value: $b27519d6a701105b$var$CollapsingCollectionRenderer,
|
|
547
|
-
children: children
|
|
548
|
-
})
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
let $b27519d6a701105b$var$CollapsingCollectionRenderer = {
|
|
552
|
-
CollectionRoot ({ collection: collection }) {
|
|
553
|
-
return $b27519d6a701105b$var$useCollectionRender(collection);
|
|
554
|
-
},
|
|
555
|
-
CollectionBranch ({ collection: collection }) {
|
|
556
|
-
return $b27519d6a701105b$var$useCollectionRender(collection);
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
let $b27519d6a701105b$var$useCollectionRender = (collection)=>{
|
|
560
|
-
let { containerRef: containerRef, showItems: showItems, setShowItems: setShowItems } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$CollapseContext) ?? {};
|
|
561
|
-
let { density: density = 'regular', orientation: orientation = 'horizontal', onSelectionChange: onSelectionChange } = (0, $5oxdw$react.useContext)($b27519d6a701105b$var$InternalTabsContext);
|
|
562
|
-
let { direction: direction } = (0, $5oxdw$reactariai18n.useLocale)();
|
|
563
|
-
let children = (0, $5oxdw$react.useMemo)(()=>{
|
|
564
|
-
let result = [];
|
|
565
|
-
for (let key of collection.getKeys())result.push(collection.getItem(key));
|
|
566
|
-
return result;
|
|
567
|
-
}, [
|
|
568
|
-
collection
|
|
569
|
-
]);
|
|
570
|
-
let listRef = (0, $5oxdw$react.useRef)(null);
|
|
571
|
-
let updateOverflow = (0, $5oxdw$reactariautils.useEffectEvent)(()=>{
|
|
572
|
-
if (orientation === 'vertical' || !listRef.current || !containerRef?.current) return;
|
|
573
|
-
let container = listRef.current;
|
|
574
|
-
let containerRect = container.getBoundingClientRect();
|
|
575
|
-
let tabs = container.querySelectorAll('[data-hidden-tab]');
|
|
576
|
-
let lastTab = tabs[tabs.length - 1];
|
|
577
|
-
let lastTabRect = lastTab.getBoundingClientRect();
|
|
578
|
-
if (direction === 'ltr') setShowItems?.(lastTabRect.right <= containerRect.right);
|
|
579
|
-
else setShowItems?.(lastTabRect.left >= containerRect.left);
|
|
580
|
-
});
|
|
581
|
-
(0, $5oxdw$reactariautils.useResizeObserver)({
|
|
582
|
-
ref: containerRef,
|
|
583
|
-
onResize: updateOverflow
|
|
584
|
-
});
|
|
585
|
-
(0, $5oxdw$reactariautils.useLayoutEffect)(()=>{
|
|
586
|
-
if (collection.size > 0) queueMicrotask(updateOverflow);
|
|
587
|
-
}, [
|
|
588
|
-
collection.size,
|
|
589
|
-
updateOverflow
|
|
590
|
-
]);
|
|
591
|
-
(0, $5oxdw$react.useEffect)(()=>{
|
|
592
|
-
// Recalculate visible tags when fonts are loaded.
|
|
593
|
-
document.fonts?.ready.then(()=>updateOverflow());
|
|
594
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
595
|
-
}, []);
|
|
596
|
-
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsxs)((0, $5oxdw$reactjsxruntime.Fragment), {
|
|
597
|
-
children: [
|
|
598
|
-
/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$HiddenTabs, {
|
|
599
|
-
items: children,
|
|
600
|
-
density: density,
|
|
601
|
-
listRef: listRef
|
|
602
|
-
}),
|
|
603
|
-
showItems ? children.map((node)=>/*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$react.Fragment), {
|
|
604
|
-
children: node.render?.(node)
|
|
605
|
-
}, node.key)) : /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactjsxruntime.Fragment), {
|
|
606
|
-
children: /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)($b27519d6a701105b$var$TabsMenu, {
|
|
607
|
-
items: children,
|
|
608
|
-
onSelectionChange: onSelectionChange
|
|
609
|
-
})
|
|
610
|
-
})
|
|
611
|
-
]
|
|
612
|
-
});
|
|
613
|
-
};
|
|
376
|
+
});
|
|
614
377
|
|
|
615
378
|
|
|
616
379
|
//# sourceMappingURL=Tabs.cjs.map
|