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