@react-spectrum/s2 0.3.1 → 0.3.2-nightly.5030
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/AvatarGroup.cjs.map +1 -1
- package/dist/AvatarGroup.css.map +1 -1
- package/dist/AvatarGroup.mjs.map +1 -1
- package/dist/Badge.cjs +103 -53
- package/dist/Badge.cjs.map +1 -1
- package/dist/Badge.css +140 -0
- package/dist/Badge.css.map +1 -1
- package/dist/Badge.mjs +103 -53
- package/dist/Badge.mjs.map +1 -1
- package/dist/Meter.cjs +26 -22
- package/dist/Meter.cjs.map +1 -1
- package/dist/Meter.css +59 -47
- package/dist/Meter.css.map +1 -1
- package/dist/Meter.mjs +26 -22
- package/dist/Meter.mjs.map +1 -1
- package/dist/ProgressBar.cjs +31 -23
- package/dist/ProgressBar.cjs.map +1 -1
- package/dist/ProgressBar.css +63 -51
- package/dist/ProgressBar.css.map +1 -1
- package/dist/ProgressBar.mjs +31 -23
- package/dist/ProgressBar.mjs.map +1 -1
- package/dist/Tabs.cjs +2 -2
- package/dist/Tabs.cjs.map +1 -1
- package/dist/Tabs.css.map +1 -1
- package/dist/Tabs.mjs +2 -2
- package/dist/Tabs.mjs.map +1 -1
- package/dist/types.d.ts +16 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -14
- package/src/AvatarGroup.tsx +2 -2
- package/src/Badge.tsx +101 -37
- package/src/Meter.tsx +3 -2
- package/src/ProgressBar.tsx +22 -6
- package/src/Tabs.tsx +6 -5
- package/src/bar-utils.ts +33 -8
package/dist/Meter.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAoCM,MAAM,0DAAe,CAAA,GAAA,oBAAY,EAAyD;AAEjG,MAAM
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;AAoCM,MAAM,0DAAe,CAAA,GAAA,oBA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. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n Meter as AriaMeter,\n MeterProps as AriaMeterProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {size, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface MeterStyleProps {\n /** The [visual style](https://spectrum.adobe.com/page/meter/#-Options) of the Meter.\n * @default 'informative'\n */\n variant?: 'informative' | 'positive' | 'notice' | 'negative',\n /**\n * The size of the Meter.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'white' | 'black'\n}\n\nexport interface MeterProps extends Omit<AriaMeterProps, 'children' | 'className' | 'style'>, MeterStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const MeterContext = createContext<ContextValue<MeterProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst wrapper = style({\n ...bar(),\n width: {\n default: 208,\n size: {\n S: 192,\n L: 224,\n XL: 240\n }\n }\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: size(6),\n size: {\n S: 4, // progress-bar-thickness-small\n M: size(6), // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: size(10) // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fillStyles = style<MeterStyleProps>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: 'informative',\n variant: {\n positive: 'positive',\n notice: 'notice',\n negative: 'negative'\n },\n staticColor: {\n white: {\n default: 'transparent-white-900'\n },\n // TODO: Is there a black static color in S2?\n black: {\n default: 'transparent-black-900'\n }\n },\n forcedColors: 'ButtonText'\n }\n});\n\nfunction Meter(props: MeterProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, MeterContext);\n let domRef = useDOMRef(ref);\n\n let {\n label,\n size = 'M',\n staticColor,\n styles,\n UNSAFE_className = '',\n UNSAFE_style,\n variant = 'informative',\n ...groupProps\n } = props;\n\n return (\n <AriaMeter\n {...groupProps}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({\n size,\n variant,\n staticColor,\n labelPosition: 'top'\n }, styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition=\"top\" staticColor={staticColor}>{label}</FieldLabel>}\n {label && <span className={valueStyles({size, labelAlign: 'end', staticColor})}>{valueText}</span>}\n <div className={trackStyles({staticColor, size})}>\n <div className={fillStyles({staticColor, variant})} style={{width: percentage + '%'}} />\n </div>\n </>\n )}\n </AriaMeter>\n );\n}\n\n/**\n * Meters are visual representations of a quantity or an achievement.\n * Their progress is determined by user actions, rather than system actions.\n */\nlet _Meter = forwardRef(Meter);\nexport {_Meter as Meter};\n"],"names":[],"version":3,"file":"Meter.mjs.map"}
|
package/dist/ProgressBar.cjs
CHANGED
|
@@ -52,36 +52,40 @@ const $83e59061dd392311$var$wrapper = function anonymous(props, overrides) {
|
|
|
52
52
|
}
|
|
53
53
|
if (!$U) rules += ' Uc';
|
|
54
54
|
rules += ' _Zf';
|
|
55
|
-
rules += ' __h-
|
|
56
|
-
rules += '
|
|
55
|
+
if (props.labelPosition === "side") rules += ' __h-jyg4vb';
|
|
56
|
+
else if (props.labelPosition === "top") rules += ' __h-1egg2pz';
|
|
57
|
+
if (props.labelPosition === "side") rules += ' __j-7y9rdj';
|
|
58
|
+
else if (props.labelPosition === "top") rules += ' __j-6w8ip8';
|
|
59
|
+
rules += ' _1d';
|
|
57
60
|
rules += ' __Fa';
|
|
58
61
|
if (!$q) {
|
|
59
62
|
rules += ' qbw';
|
|
60
63
|
rules += ' qv';
|
|
61
64
|
}
|
|
62
65
|
if (!$r) rules += ' r-3bwcc2';
|
|
63
|
-
rules += ' o-375tou';
|
|
64
|
-
rules += ' -_1inj1bc_i--1dbqcch';
|
|
65
|
-
rules += ' jd';
|
|
66
|
-
if (!$l) {
|
|
67
|
-
rules += ' lbO';
|
|
68
|
-
rules += ' lN';
|
|
69
|
-
}
|
|
70
66
|
if (props.size === "XL") {
|
|
71
|
-
rules += ' -
|
|
72
|
-
rules += ' -
|
|
67
|
+
rules += ' -aqrvqh_k-bw';
|
|
68
|
+
rules += ' -aqrvqh_k-v';
|
|
73
69
|
} else if (props.size === "L") {
|
|
74
|
-
rules += ' -
|
|
75
|
-
rules += ' -
|
|
70
|
+
rules += ' -aqrvqh_k-bs';
|
|
71
|
+
rules += ' -aqrvqh_k-p';
|
|
76
72
|
} else if (props.size === "S") {
|
|
77
|
-
rules += ' -
|
|
78
|
-
rules += ' -
|
|
73
|
+
rules += ' -aqrvqh_k-bl';
|
|
74
|
+
rules += ' -aqrvqh_k-k';
|
|
79
75
|
} else if (props.size === "XS") {
|
|
80
|
-
rules += ' -
|
|
81
|
-
rules += ' -
|
|
76
|
+
rules += ' -aqrvqh_k-bj';
|
|
77
|
+
rules += ' -aqrvqh_k-i';
|
|
82
78
|
} else {
|
|
83
|
-
rules += ' -
|
|
84
|
-
rules += ' -
|
|
79
|
+
rules += ' -aqrvqh_k-bp';
|
|
80
|
+
rules += ' -aqrvqh_k-o';
|
|
81
|
+
}
|
|
82
|
+
rules += ' -_1urhtf5_k-bc';
|
|
83
|
+
rules += ' -_1urhtf5_k-b';
|
|
84
|
+
rules += ' -_1inj1bc_i--q18lfg';
|
|
85
|
+
rules += ' jd';
|
|
86
|
+
if (!$l) {
|
|
87
|
+
rules += ' lbO';
|
|
88
|
+
rules += ' lN';
|
|
85
89
|
}
|
|
86
90
|
return rules;
|
|
87
91
|
};
|
|
@@ -139,7 +143,6 @@ const $83e59061dd392311$var$trackStyles = function anonymous(props) {
|
|
|
139
143
|
rules += ' __d-3773ju';
|
|
140
144
|
rules += ' __vb';
|
|
141
145
|
rules += ' __wb';
|
|
142
|
-
rules += ' Ab';
|
|
143
146
|
rules += ' _vf';
|
|
144
147
|
rules += ' _wf';
|
|
145
148
|
rules += ' _xf';
|
|
@@ -177,6 +180,10 @@ const $83e59061dd392311$var$fill = function anonymous(props) {
|
|
|
177
180
|
let rules = " .";
|
|
178
181
|
rules += ' k2';
|
|
179
182
|
rules += ' wf';
|
|
183
|
+
rules += ' _vf';
|
|
184
|
+
rules += ' _wf';
|
|
185
|
+
rules += ' _xf';
|
|
186
|
+
rules += ' _yf';
|
|
180
187
|
rules += ' ba_____x';
|
|
181
188
|
if (props.staticColor === "black") rules += ' b_____s';
|
|
182
189
|
else if (props.staticColor === "white") rules += ' b_____f';
|
|
@@ -194,7 +201,7 @@ const $83e59061dd392311$var$fill = function anonymous(props) {
|
|
|
194
201
|
const $83e59061dd392311$var$indeterminateAnimation = " . _S-16w2la5 _T-yjb9nq _Ya _X-twzmrf __Pd Uc";
|
|
195
202
|
function $83e59061dd392311$var$ProgressBar(props, ref) {
|
|
196
203
|
[props, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props, ref, $83e59061dd392311$export$e9f3bf65a26ce129);
|
|
197
|
-
let { label: label, size: size = 'M', staticColor: staticColor, isIndeterminate: isIndeterminate, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
|
|
204
|
+
let { label: label, size: size = 'M', staticColor: staticColor, isIndeterminate: isIndeterminate, labelPosition: labelPosition = 'top', UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
|
|
198
205
|
let domRef = (0, $gIpiX$reactspectrumutils.useDOMRef)(ref);
|
|
199
206
|
return /*#__PURE__*/ (0, $gIpiX$reactjsxruntime.jsx)((0, $gIpiX$reactariacomponents.ProgressBar), {
|
|
200
207
|
...props,
|
|
@@ -202,14 +209,15 @@ function $83e59061dd392311$var$ProgressBar(props, ref) {
|
|
|
202
209
|
style: UNSAFE_style,
|
|
203
210
|
className: UNSAFE_className + $83e59061dd392311$var$wrapper({
|
|
204
211
|
...props,
|
|
205
|
-
size: size
|
|
212
|
+
size: size,
|
|
213
|
+
labelPosition: labelPosition
|
|
206
214
|
}, props.styles),
|
|
207
215
|
children: ({ percentage: percentage, valueText: valueText })=>/*#__PURE__*/ (0, $gIpiX$reactjsxruntime.jsxs)((0, $gIpiX$reactjsxruntime.Fragment), {
|
|
208
216
|
children: [
|
|
209
217
|
label && /*#__PURE__*/ (0, $gIpiX$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldLabel), {
|
|
210
218
|
size: size,
|
|
211
219
|
labelAlign: "start",
|
|
212
|
-
labelPosition:
|
|
220
|
+
labelPosition: labelPosition,
|
|
213
221
|
staticColor: staticColor,
|
|
214
222
|
children: label
|
|
215
223
|
}),
|
package/dist/ProgressBar.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8CM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAA+D;AAE7G,QAAQ;AACR,sDAAsD;AACtD,sDAAsD;AACtD,MAAM;AAUN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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@react-spectrum/s2/src/ProgressBar.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n ProgressBar as AriaProgressBar,\n ProgressBarProps as AriaProgressBarProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, LabelPosition} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {mergeStyles} from '../style/runtime';\nimport {size, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface ProgressBarStyleProps {\n /**\n * The size of the ProgressBar.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * Whether presentation is indeterminate when progress isn't known.\n */\n isIndeterminate?: boolean,\n /** \n * The static color style to apply. Useful when the button appears over a color background.\n */\n staticColor?: 'white' | 'black',\n /**\n * The label's overall position relative to the element it is labeling.\n * @default 'top'\n */\n labelPosition?: LabelPosition\n\n}\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'children' | 'className' | 'style'>, ProgressBarStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, DOMRefValue<HTMLDivElement>>>(null);\n\n// TODO:\n// var(--spectrum-global-dimension-size-1700) -> 136px\n// var(--spectrum-global-dimension-size-2400) -> 192px\nconst indeterminate = keyframes(`\n from {\n transform: translate(calc(136px * -1));\n }\n\n to {\n transform: translate(192px);\n }\n`);\n\nconst wrapper = style<ProgressBarStyleProps>({\n ...bar(),\n width: {\n default: 192\n }\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: size(6),\n size: {\n S: 4, // progress-bar-thickness-small\n M: size(6), // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: size(10) // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fill = style<ProgressBarStyleProps>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: 'accent',\n staticColor: {\n white: {\n default: 'transparent-white-900'\n },\n // TODO: Is there a black static color in S2?\n black: {\n default: 'transparent-black-900'\n }\n },\n forcedColors: 'ButtonText'\n },\n transition: '[width]',\n transitionDuration: 1000\n});\n\nconst indeterminateAnimation = style({\n animation: indeterminate,\n animationDuration: 1000,\n animationIterationCount: 'infinite',\n animationTimingFunction: 'in-out',\n willChange: 'transform',\n position: 'relative'\n});\n\nfunction ProgressBar(props: ProgressBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ProgressBarContext);\n let {\n label, size = 'M',\n staticColor,\n isIndeterminate,\n labelPosition = 'top',\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n return (\n <AriaProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({...props, size, labelPosition}, props.styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && <span className={valueStyles({size, labelAlign: 'end', staticColor})}>{valueText}</span>}\n <div className={trackStyles({...props})}>\n <div\n className={mergeStyles(fill({...props, staticColor}), (isIndeterminate ? indeterminateAnimation : null))}\n style={{width: isIndeterminate ? `${100 * (136 / 192)}%` : percentage + '%'}} />\n </div>\n </>\n )}\n </AriaProgressBar>\n );\n}\n\n/**\n * ProgressBars show the progression of a system operation: downloading, uploading, processing, etc., in a visual way.\n * They can represent either determinate or indeterminate progress.\n */\nconst _ProgressBar = /*#__PURE__*/ forwardRef(ProgressBar);\nexport {_ProgressBar as ProgressBar};\n\n"],"names":[],"version":3,"file":"ProgressBar.cjs.map"}
|
package/dist/ProgressBar.css
CHANGED
|
@@ -13,15 +13,27 @@
|
|
|
13
13
|
display: grid;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
.__h-
|
|
16
|
+
.__h-1egg2pz {
|
|
17
17
|
grid-template-columns: 1fr auto;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
.__h-jyg4vb {
|
|
21
|
+
grid-template-columns: auto 1fr;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
.__j-6w8ip8 {
|
|
21
25
|
grid-template-areas: "label value"
|
|
22
26
|
"bar bar";
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
.__j-7y9rdj {
|
|
30
|
+
grid-template-areas: "label bar value";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
._1d {
|
|
34
|
+
align-items: baseline;
|
|
35
|
+
}
|
|
36
|
+
|
|
25
37
|
.__Fa {
|
|
26
38
|
isolation: isolate;
|
|
27
39
|
}
|
|
@@ -34,40 +46,40 @@
|
|
|
34
46
|
max-width: 768px;
|
|
35
47
|
}
|
|
36
48
|
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
.-aqrvqh_k-o {
|
|
50
|
+
--field-height: 2rem;
|
|
39
51
|
}
|
|
40
52
|
|
|
41
|
-
.-
|
|
42
|
-
--field-
|
|
53
|
+
.-aqrvqh_k-i {
|
|
54
|
+
--field-height: 1.25rem;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
.-aqrvqh_k-k {
|
|
58
|
+
--field-height: 1.5rem;
|
|
47
59
|
}
|
|
48
60
|
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
.-aqrvqh_k-p {
|
|
62
|
+
--field-height: 2.5rem;
|
|
51
63
|
}
|
|
52
64
|
|
|
53
|
-
.-
|
|
54
|
-
--
|
|
65
|
+
.-aqrvqh_k-v {
|
|
66
|
+
--field-height: 3rem;
|
|
55
67
|
}
|
|
56
68
|
|
|
57
|
-
.-
|
|
58
|
-
--
|
|
69
|
+
.-_1urhtf5_k-b {
|
|
70
|
+
--track-to-label: .25rem;
|
|
59
71
|
}
|
|
60
72
|
|
|
61
|
-
.-
|
|
62
|
-
--
|
|
73
|
+
.-_1inj1bc_i--q18lfg {
|
|
74
|
+
--field-gap: calc((calc(var(--field-height) + var(--track-to-label)) - var(--u, 0px) - var(--v, 0px) - 1lh) / 2);
|
|
63
75
|
}
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
.jd {
|
|
78
|
+
column-gap: .75rem;
|
|
67
79
|
}
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
.lN {
|
|
82
|
+
width: 12rem;
|
|
71
83
|
}
|
|
72
84
|
|
|
73
85
|
._ca {
|
|
@@ -168,26 +180,6 @@
|
|
|
168
180
|
overflow-y: hidden;
|
|
169
181
|
}
|
|
170
182
|
|
|
171
|
-
.Ab {
|
|
172
|
-
margin-top: .25rem;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
._vf {
|
|
176
|
-
border-start-start-radius: 9999px;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
._wf {
|
|
180
|
-
border-start-end-radius: 9999px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
._xf {
|
|
184
|
-
border-end-start-radius: 9999px;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
._yf {
|
|
188
|
-
border-end-end-radius: 9999px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
183
|
.bi {
|
|
192
184
|
background-color: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
|
|
193
185
|
}
|
|
@@ -240,6 +232,22 @@
|
|
|
240
232
|
border-style: none;
|
|
241
233
|
}
|
|
242
234
|
|
|
235
|
+
._vf {
|
|
236
|
+
border-start-start-radius: 9999px;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
._wf {
|
|
240
|
+
border-start-end-radius: 9999px;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
._xf {
|
|
244
|
+
border-end-start-radius: 9999px;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
._yf {
|
|
248
|
+
border-end-end-radius: 9999px;
|
|
249
|
+
}
|
|
250
|
+
|
|
243
251
|
.b_____E {
|
|
244
252
|
background-color: var(--lightningcss-light, #3b63fb) var(--lightningcss-dark, #345bf8);
|
|
245
253
|
}
|
|
@@ -311,28 +319,32 @@
|
|
|
311
319
|
min-width: 3.75rem;
|
|
312
320
|
}
|
|
313
321
|
|
|
314
|
-
|
|
315
|
-
|
|
322
|
+
.-aqrvqh_k-bp {
|
|
323
|
+
--field-height: 2.5rem;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.-aqrvqh_k-bj {
|
|
327
|
+
--field-height: 1.5625rem;
|
|
316
328
|
}
|
|
317
329
|
|
|
318
|
-
.-
|
|
319
|
-
--
|
|
330
|
+
.-aqrvqh_k-bl {
|
|
331
|
+
--field-height: 1.875rem;
|
|
320
332
|
}
|
|
321
333
|
|
|
322
|
-
.-
|
|
323
|
-
--
|
|
334
|
+
.-aqrvqh_k-bs {
|
|
335
|
+
--field-height: 3.125rem;
|
|
324
336
|
}
|
|
325
337
|
|
|
326
|
-
.-
|
|
327
|
-
--
|
|
338
|
+
.-aqrvqh_k-bw {
|
|
339
|
+
--field-height: 3.75rem;
|
|
328
340
|
}
|
|
329
341
|
|
|
330
|
-
.-
|
|
331
|
-
--
|
|
342
|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;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAKA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAaP;;;;;;AAbO","sources":["7293bad37f188837","packages/@react-spectrum/s2/src/ProgressBar.tsx"],"sourcesContent":["@import \"0b8d2821d82ee250\";\n@import \"f2b8eec694697861\";\n@import \"bd67a9a4e04bbe30\";\n@import \"928e619efccddb64\";\n@import \"27fd25d02acf65a5\";\n@import \"47f66b5fa7a24be0\";\n","/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n ProgressBar as AriaProgressBar,\n ProgressBarProps as AriaProgressBarProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, LabelPosition} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {mergeStyles} from '../style/runtime';\nimport {size, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface ProgressBarStyleProps {\n /**\n * The size of the ProgressBar.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * Whether presentation is indeterminate when progress isn't known.\n */\n isIndeterminate?: boolean,\n /** \n * The static color style to apply. Useful when the button appears over a color background.\n */\n staticColor?: 'white' | 'black',\n /**\n * The label's overall position relative to the element it is labeling.\n * @default 'top'\n */\n labelPosition?: LabelPosition\n\n}\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'children' | 'className' | 'style'>, ProgressBarStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, DOMRefValue<HTMLDivElement>>>(null);\n\n// TODO:\n// var(--spectrum-global-dimension-size-1700) -> 136px\n// var(--spectrum-global-dimension-size-2400) -> 192px\nconst indeterminate = keyframes(`\n from {\n transform: translate(calc(136px * -1));\n }\n\n to {\n transform: translate(192px);\n }\n`);\n\nconst wrapper = style<ProgressBarStyleProps>({\n ...bar(),\n width: {\n default: 192\n }\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: size(6),\n size: {\n S: 4, // progress-bar-thickness-small\n M: size(6), // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: size(10) // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fill = style<ProgressBarStyleProps>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: 'accent',\n staticColor: {\n white: {\n default: 'transparent-white-900'\n },\n // TODO: Is there a black static color in S2?\n black: {\n default: 'transparent-black-900'\n }\n },\n forcedColors: 'ButtonText'\n },\n transition: '[width]',\n transitionDuration: 1000\n});\n\nconst indeterminateAnimation = style({\n animation: indeterminate,\n animationDuration: 1000,\n animationIterationCount: 'infinite',\n animationTimingFunction: 'in-out',\n willChange: 'transform',\n position: 'relative'\n});\n\nfunction ProgressBar(props: ProgressBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ProgressBarContext);\n let {\n label, size = 'M',\n staticColor,\n isIndeterminate,\n labelPosition = 'top',\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n return (\n <AriaProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({...props, size, labelPosition}, props.styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && <span className={valueStyles({size, labelAlign: 'end', staticColor})}>{valueText}</span>}\n <div className={trackStyles({...props})}>\n <div\n className={mergeStyles(fill({...props, staticColor}), (isIndeterminate ? indeterminateAnimation : null))}\n style={{width: isIndeterminate ? `${100 * (136 / 192)}%` : percentage + '%'}} />\n </div>\n </>\n )}\n </AriaProgressBar>\n );\n}\n\n/**\n * ProgressBars show the progression of a system operation: downloading, uploading, processing, etc., in a visual way.\n * They can represent either determinate or indeterminate progress.\n */\nconst _ProgressBar = /*#__PURE__*/ forwardRef(ProgressBar);\nexport {_ProgressBar as ProgressBar};\n\n"],"names":[],"version":3,"file":"ProgressBar.css.map"}
|
package/dist/ProgressBar.mjs
CHANGED
|
@@ -45,36 +45,40 @@ const $b847b7cd294eafba$var$wrapper = function anonymous(props, overrides) {
|
|
|
45
45
|
}
|
|
46
46
|
if (!$U) rules += ' Uc';
|
|
47
47
|
rules += ' _Zf';
|
|
48
|
-
rules += ' __h-
|
|
49
|
-
rules += '
|
|
48
|
+
if (props.labelPosition === "side") rules += ' __h-jyg4vb';
|
|
49
|
+
else if (props.labelPosition === "top") rules += ' __h-1egg2pz';
|
|
50
|
+
if (props.labelPosition === "side") rules += ' __j-7y9rdj';
|
|
51
|
+
else if (props.labelPosition === "top") rules += ' __j-6w8ip8';
|
|
52
|
+
rules += ' _1d';
|
|
50
53
|
rules += ' __Fa';
|
|
51
54
|
if (!$q) {
|
|
52
55
|
rules += ' qbw';
|
|
53
56
|
rules += ' qv';
|
|
54
57
|
}
|
|
55
58
|
if (!$r) rules += ' r-3bwcc2';
|
|
56
|
-
rules += ' o-375tou';
|
|
57
|
-
rules += ' -_1inj1bc_i--1dbqcch';
|
|
58
|
-
rules += ' jd';
|
|
59
|
-
if (!$l) {
|
|
60
|
-
rules += ' lbO';
|
|
61
|
-
rules += ' lN';
|
|
62
|
-
}
|
|
63
59
|
if (props.size === "XL") {
|
|
64
|
-
rules += ' -
|
|
65
|
-
rules += ' -
|
|
60
|
+
rules += ' -aqrvqh_k-bw';
|
|
61
|
+
rules += ' -aqrvqh_k-v';
|
|
66
62
|
} else if (props.size === "L") {
|
|
67
|
-
rules += ' -
|
|
68
|
-
rules += ' -
|
|
63
|
+
rules += ' -aqrvqh_k-bs';
|
|
64
|
+
rules += ' -aqrvqh_k-p';
|
|
69
65
|
} else if (props.size === "S") {
|
|
70
|
-
rules += ' -
|
|
71
|
-
rules += ' -
|
|
66
|
+
rules += ' -aqrvqh_k-bl';
|
|
67
|
+
rules += ' -aqrvqh_k-k';
|
|
72
68
|
} else if (props.size === "XS") {
|
|
73
|
-
rules += ' -
|
|
74
|
-
rules += ' -
|
|
69
|
+
rules += ' -aqrvqh_k-bj';
|
|
70
|
+
rules += ' -aqrvqh_k-i';
|
|
75
71
|
} else {
|
|
76
|
-
rules += ' -
|
|
77
|
-
rules += ' -
|
|
72
|
+
rules += ' -aqrvqh_k-bp';
|
|
73
|
+
rules += ' -aqrvqh_k-o';
|
|
74
|
+
}
|
|
75
|
+
rules += ' -_1urhtf5_k-bc';
|
|
76
|
+
rules += ' -_1urhtf5_k-b';
|
|
77
|
+
rules += ' -_1inj1bc_i--q18lfg';
|
|
78
|
+
rules += ' jd';
|
|
79
|
+
if (!$l) {
|
|
80
|
+
rules += ' lbO';
|
|
81
|
+
rules += ' lN';
|
|
78
82
|
}
|
|
79
83
|
return rules;
|
|
80
84
|
};
|
|
@@ -132,7 +136,6 @@ const $b847b7cd294eafba$var$trackStyles = function anonymous(props) {
|
|
|
132
136
|
rules += ' __d-3773ju';
|
|
133
137
|
rules += ' __vb';
|
|
134
138
|
rules += ' __wb';
|
|
135
|
-
rules += ' Ab';
|
|
136
139
|
rules += ' _vf';
|
|
137
140
|
rules += ' _wf';
|
|
138
141
|
rules += ' _xf';
|
|
@@ -170,6 +173,10 @@ const $b847b7cd294eafba$var$fill = function anonymous(props) {
|
|
|
170
173
|
let rules = " .";
|
|
171
174
|
rules += ' k2';
|
|
172
175
|
rules += ' wf';
|
|
176
|
+
rules += ' _vf';
|
|
177
|
+
rules += ' _wf';
|
|
178
|
+
rules += ' _xf';
|
|
179
|
+
rules += ' _yf';
|
|
173
180
|
rules += ' ba_____x';
|
|
174
181
|
if (props.staticColor === "black") rules += ' b_____s';
|
|
175
182
|
else if (props.staticColor === "white") rules += ' b_____f';
|
|
@@ -187,7 +194,7 @@ const $b847b7cd294eafba$var$fill = function anonymous(props) {
|
|
|
187
194
|
const $b847b7cd294eafba$var$indeterminateAnimation = " . _S-16w2la5 _T-yjb9nq _Ya _X-twzmrf __Pd Uc";
|
|
188
195
|
function $b847b7cd294eafba$var$ProgressBar(props, ref) {
|
|
189
196
|
[props, ref] = (0, $5ce63c423902f47d$export$764f6146fadd77f7)(props, ref, $b847b7cd294eafba$export$e9f3bf65a26ce129);
|
|
190
|
-
let { label: label, size: size = 'M', staticColor: staticColor, isIndeterminate: isIndeterminate, UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
|
|
197
|
+
let { label: label, size: size = 'M', staticColor: staticColor, isIndeterminate: isIndeterminate, labelPosition: labelPosition = 'top', UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
|
|
191
198
|
let domRef = (0, $cNVLZ$useDOMRef)(ref);
|
|
192
199
|
return /*#__PURE__*/ (0, $cNVLZ$jsx)((0, $cNVLZ$ProgressBar), {
|
|
193
200
|
...props,
|
|
@@ -195,14 +202,15 @@ function $b847b7cd294eafba$var$ProgressBar(props, ref) {
|
|
|
195
202
|
style: UNSAFE_style,
|
|
196
203
|
className: UNSAFE_className + $b847b7cd294eafba$var$wrapper({
|
|
197
204
|
...props,
|
|
198
|
-
size: size
|
|
205
|
+
size: size,
|
|
206
|
+
labelPosition: labelPosition
|
|
199
207
|
}, props.styles),
|
|
200
208
|
children: ({ percentage: percentage, valueText: valueText })=>/*#__PURE__*/ (0, $cNVLZ$jsxs)((0, $cNVLZ$Fragment), {
|
|
201
209
|
children: [
|
|
202
210
|
label && /*#__PURE__*/ (0, $cNVLZ$jsx)((0, $9afd80978c252040$export$1acdcf5a973a8414), {
|
|
203
211
|
size: size,
|
|
204
212
|
labelAlign: "start",
|
|
205
|
-
labelPosition:
|
|
213
|
+
labelPosition: labelPosition,
|
|
206
214
|
staticColor: staticColor,
|
|
207
215
|
children: label
|
|
208
216
|
}),
|
package/dist/ProgressBar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA8CM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAA+D;AAE7G,QAAQ;AACR,sDAAsD;AACtD,sDAAsD;AACtD,MAAM;AAUN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAON,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaN,MAAM;;;;;;;;;;;;;;;;;;;;;;AAqBN,MAAM;AASN,SAAS,kCAAY,KAAuB,EAAE,GAA2B;IACvE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,SACF,KAAK,QAAE,OAAO,kBACd,WAAW,mBACX,eAAe,iBACf,gBAAgB,qBAChB,YAAY,oBACZ,mBAAmB,IACpB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,qBACE,gBAAC,CAAA,GAAA,kBAAc;QACZ,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,mBAAmB,8BAAQ;YAAC,GAAG,KAAK;kBAAE;2BAAM;QAAa,GAAG,MAAM,MAAM;kBAClF,CAAC,cAAC,UAAU,aAAE,SAAS,EAAC,iBACvB;;oBACG,uBAAS,gBAAC,CAAA,GAAA,yCAAS;wBAAE,MAAM;wBAAM,YAAW;wBAAQ,eAAe;wBAAe,aAAa;kCAAc;;oBAC7G,uBAAS,gBAAC;wBAAK,WAAW,kCAAY;kCAAC;4BAAM,YAAY;yCAAO;wBAAW;kCAAK;;kCACjF,gBAAC;wBAAI,WAAW,kCAAY;4BAAC,GAAG,KAAK;wBAAA;kCACnC,cAAA,gBAAC;4BACC,WAAW,CAAA,GAAA,yCAAU,EAAE,2BAAK;gCAAC,GAAG,KAAK;6CAAE;4BAAW,IAAK,kBAAkB,+CAAyB;4BAClG,OAAO;gCAAC,OAAO,kBAAkB,CAAC,EAAE,MAAO,CAAA,MAAM,GAAE,EAAG,CAAC,CAAC,GAAG,aAAa;4BAAG;;;;;;AAMzF;AAEA;;;CAGC,GACD,MAAM,4CAAe,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/ProgressBar.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n ProgressBar as AriaProgressBar,\n ProgressBarProps as AriaProgressBarProps,\n ContextValue\n} from 'react-aria-components';\nimport {bar, track} from './bar-utils' with {type: 'macro'};\nimport {createContext, forwardRef, ReactNode} from 'react';\nimport {DOMRef, DOMRefValue, LabelPosition} from '@react-types/shared';\nimport {FieldLabel} from './Field';\nimport {fieldLabel, getAllowedOverrides, StyleProps} from './style-utils' with {type: 'macro'};\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {mergeStyles} from '../style/runtime';\nimport {size, style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\ninterface ProgressBarStyleProps {\n /**\n * The size of the ProgressBar.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L' | 'XL',\n /**\n * Whether presentation is indeterminate when progress isn't known.\n */\n isIndeterminate?: boolean,\n /** \n * The static color style to apply. Useful when the button appears over a color background.\n */\n staticColor?: 'white' | 'black',\n /**\n * The label's overall position relative to the element it is labeling.\n * @default 'top'\n */\n labelPosition?: LabelPosition\n\n}\n\nexport interface ProgressBarProps extends Omit<AriaProgressBarProps, 'children' | 'className' | 'style'>, ProgressBarStyleProps, StyleProps {\n /** The content to display as the label. */\n label?: ReactNode\n}\n\nexport const ProgressBarContext = createContext<ContextValue<ProgressBarProps, DOMRefValue<HTMLDivElement>>>(null);\n\n// TODO:\n// var(--spectrum-global-dimension-size-1700) -> 136px\n// var(--spectrum-global-dimension-size-2400) -> 192px\nconst indeterminate = keyframes(`\n from {\n transform: translate(calc(136px * -1));\n }\n\n to {\n transform: translate(192px);\n }\n`);\n\nconst wrapper = style<ProgressBarStyleProps>({\n ...bar(),\n width: {\n default: 192\n }\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: size(6),\n size: {\n S: 4, // progress-bar-thickness-small\n M: size(6), // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: size(10) // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fill = style<ProgressBarStyleProps>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: 'accent',\n staticColor: {\n white: {\n default: 'transparent-white-900'\n },\n // TODO: Is there a black static color in S2?\n black: {\n default: 'transparent-black-900'\n }\n },\n forcedColors: 'ButtonText'\n },\n transition: '[width]',\n transitionDuration: 1000\n});\n\nconst indeterminateAnimation = style({\n animation: indeterminate,\n animationDuration: 1000,\n animationIterationCount: 'infinite',\n animationTimingFunction: 'in-out',\n willChange: 'transform',\n position: 'relative'\n});\n\nfunction ProgressBar(props: ProgressBarProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ProgressBarContext);\n let {\n label, size = 'M',\n staticColor,\n isIndeterminate,\n labelPosition = 'top',\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n return (\n <AriaProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({...props, size, labelPosition}, props.styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && <span className={valueStyles({size, labelAlign: 'end', staticColor})}>{valueText}</span>}\n <div className={trackStyles({...props})}>\n <div\n className={mergeStyles(fill({...props, staticColor}), (isIndeterminate ? indeterminateAnimation : null))}\n style={{width: isIndeterminate ? `${100 * (136 / 192)}%` : percentage + '%'}} />\n </div>\n </>\n )}\n </AriaProgressBar>\n );\n}\n\n/**\n * ProgressBars show the progression of a system operation: downloading, uploading, processing, etc., in a visual way.\n * They can represent either determinate or indeterminate progress.\n */\nconst _ProgressBar = /*#__PURE__*/ forwardRef(ProgressBar);\nexport {_ProgressBar as ProgressBar};\n\n"],"names":[],"version":3,"file":"ProgressBar.mjs.map"}
|
package/dist/Tabs.cjs
CHANGED
|
@@ -138,7 +138,7 @@ const $b27519d6a701105b$var$tab = function anonymous(props, overrides) {
|
|
|
138
138
|
};
|
|
139
139
|
const $b27519d6a701105b$var$icon = " . _8-3t1x -rwx0fg_e-b";
|
|
140
140
|
function $b27519d6a701105b$export$3e41faf802a29e71(props) {
|
|
141
|
-
let { density: density } = (0, $5oxdw$reactariacomponents.useSlottedContext)($b27519d6a701105b$export$cfa7aa87c26e7d1f);
|
|
141
|
+
let { density: density } = (0, $5oxdw$reactariacomponents.useSlottedContext)($b27519d6a701105b$export$cfa7aa87c26e7d1f) ?? {};
|
|
142
142
|
return /*#__PURE__*/ (0, $5oxdw$reactjsxruntime.jsx)((0, $5oxdw$reactariacomponents.Tab), {
|
|
143
143
|
...props,
|
|
144
144
|
style: props.UNSAFE_style,
|
|
@@ -190,7 +190,7 @@ const $b27519d6a701105b$var$tablist = function anonymous(props) {
|
|
|
190
190
|
return rules;
|
|
191
191
|
};
|
|
192
192
|
function $b27519d6a701105b$export$e51a686c67fdaa2d(props1) {
|
|
193
|
-
let { density: density, isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation } = (0, $5oxdw$reactariacomponents.useSlottedContext)($b27519d6a701105b$export$cfa7aa87c26e7d1f);
|
|
193
|
+
let { density: density, isDisabled: isDisabled, disabledKeys: disabledKeys, orientation: orientation } = (0, $5oxdw$reactariacomponents.useSlottedContext)($b27519d6a701105b$export$cfa7aa87c26e7d1f) ?? {};
|
|
194
194
|
let state = (0, $5oxdw$react.useContext)((0, $5oxdw$reactariacomponents.TabListStateContext));
|
|
195
195
|
let [selectedTab, setSelectedTab] = (0, $5oxdw$react.useState)(undefined);
|
|
196
196
|
let tablistRef = (0, $5oxdw$react.useRef)(null);
|
package/dist/Tabs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwDM,MAAM,0DAAc,CAAA,GAAA,0BAAY,EAAwD;AAE/F,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASC,SAAS,0CAAS,KAAoB;IAC3C,qBAC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A;QAAG,WAAW,wCAAkB;wBAAC;yBAAY;QAAW;;AAEjF;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;AAYN,SAAS,2BAAK,KAAgB,EAAE,GAA2B;IACzD,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,WACF,UAAU,uBACV,UAAU,gBACV,YAAY,eACZ,cAAc,cACf,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,qBACE,gCAAC,CAAA,GAAA,+BAAM;QACJ,GAAG,KAAK;QACT,KAAK;QACL,OAAO,MAAM,YAAY;QACzB,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,2BAAK;gBAAC,GAAG,WAAW;YAAA,GAAG,MAAM,MAAM;kBAC9F,cAAA,gCAAC,CAAA,GAAA,mCAAO;YACN,QAAQ;gBACN;oBAAC;oBAAa;iCAAC;oCAAS;sCAAY;qCAAc;oBAAW;iBAAE;aAChE;sBACA,MAAM,QAAQ;;;AAIvB;AAEA;;CAEC,GACD,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TabListProps as AriaTabListProps,\n TabPanel as AriaTabPanel,\n TabPanelProps as AriaTabPanelProps,\n TabProps as AriaTabProps,\n TabsProps as AriaTabsProps, \n ContextValue,\n Provider,\n Tab as RACTab,\n TabList as RACTabList,\n Tabs as RACTabs,\n TabListStateContext,\n useSlottedContext} from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Collection, DOMRef, DOMRefValue, Key, Node, Orientation} from '@react-types/shared';\nimport {createContext, forwardRef, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport {focusRing, getAllowedOverrides, StyleProps, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {Text, TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | 'children'>, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tabs. */\n children?: ReactNode,\n /**\n * The amount of space between the tabs.\n * @default \"regular\"\n */\n density?: 'compact' | 'regular'\n}\n\nexport interface TabProps extends Omit<AriaTabProps, 'children' | 'style' | 'className'>, StyleProps {\n /** The content to display in the tab. */\n children?: ReactNode\n}\n\nexport interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'children' | 'style' | 'className'>, StyleProps {\n /** The content to display in the tablist. */\n children?: ReactNode\n}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'children' | 'style' | 'className'>, UnsafeStyles { \n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tab panels. */\n children?: ReactNode\n}\n\nexport const TabsContext = createContext<ContextValue<TabsProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst tabPanel = style({\n marginTop: 4,\n color: 'gray-800',\n flexGrow: 1,\n flexBasis: '[0%]',\n minHeight: 0,\n minWidth: 0\n}, getAllowedOverrides({height: true}));\n\nexport function TabPanel(props: TabPanelProps) {\n return (\n <AriaTabPanel\n {...props}\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + tabPanel(null, props.styles)} />\n );\n}\n\nconst tab = style({\n ...focusRing(),\n display: 'flex',\n color: {\n default: 'neutral-subdued',\n isSelected: 'neutral',\n isHovered: 'neutral-subdued',\n isDisabled: 'disabled',\n forcedColors: {\n isSelected: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'sm',\n gap: 'text-to-visual',\n height: {\n density: {\n compact: 32,\n regular: 48\n }\n },\n alignItems: 'center',\n position: 'relative',\n cursor: 'default',\n flexShrink: 0,\n transition: 'default'\n}, getAllowedOverrides());\n\nconst icon = style({\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport function Tab(props: TabProps) {\n let {density} = useSlottedContext(TabsContext);\n\n return (\n <RACTab\n {...props}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density}, props.styles)}>\n <Provider\n values={[\n [TextContext, {styles: style({order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: icon\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACTab>\n );\n}\n\nconst tablist = style({\n display: 'flex',\n gap: {\n orientation: {\n horizontal: {\n density: {\n compact: 24,\n regular: 32\n }\n }\n }\n },\n flexDirection: {\n orientation: {\n vertical: 'column'\n }\n },\n paddingEnd: {\n orientation: {\n vertical: 20\n }\n },\n paddingStart: {\n orientation: {\n vertical: 12\n }\n },\n flexShrink: 0,\n flexBasis: '[0%]'\n});\n\nexport function TabList<T extends object>(props: TabListProps<T>) {\n let {density, isDisabled, disabledKeys, orientation} = useSlottedContext(TabsContext);\n let state = useContext(TabListStateContext);\n let [selectedTab, setSelectedTab] = useState<HTMLElement | undefined>(undefined);\n let tablistRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n if (tablistRef?.current) {\n let tab: HTMLElement | null = tablistRef.current.querySelector('[role=tab][data-selected=true]');\n\n if (tab != null) {\n setSelectedTab(tab);\n }\n }\n }, [tablistRef, state?.selectedItem?.key]);\n\n return (\n <div\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + style({position: 'relative'}, getAllowedOverrides())(null, props.styles)}>\n {orientation === 'vertical' &&\n <TabLine disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n <RACTabList\n {...props}\n ref={tablistRef}\n className={renderProps => tablist({...renderProps, density})} />\n {orientation === 'horizontal' &&\n <TabLine disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n </div>\n );\n}\n\nfunction isAllTabsDisabled<T>(collection: Collection<Node<T>> | null, disabledKeys: Set<Key>) {\n let testKey: Key | null = null;\n if (collection && collection.size > 0) {\n testKey = collection.getFirstKey();\n\n let index = 0;\n while (testKey && index < collection.size) {\n // We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it\n if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) {\n return false;\n }\n\n testKey = collection.getKeyAfter(testKey);\n index++;\n }\n return true;\n }\n return false;\n}\n\ninterface TabLineProps {\n disabledKeys: Iterable<Key> | undefined,\n isDisabled: boolean | undefined,\n selectedTab: HTMLElement | undefined,\n orientation?: Orientation,\n density?: 'compact' | 'regular'\n}\n\nconst selectedIndicator = style({\n position: 'absolute',\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: {\n orientation: {\n horizontal: '[2px]'\n }\n },\n width: {\n orientation: {\n vertical: '[2px]'\n }\n },\n bottom: {\n orientation: {\n horizontal: 0\n }\n },\n borderStyle: 'none',\n borderRadius: 'full',\n transitionDuration: 130,\n transitionTimingFunction: 'in-out'\n});\n\nfunction TabLine(props: TabLineProps) {\n let {\n disabledKeys,\n isDisabled: isTabsDisabled,\n selectedTab,\n orientation,\n density\n } = props;\n let {direction} = useLocale();\n let state = useContext(TabListStateContext);\n\n // We want to add disabled styling to the selection indicator only if all the Tabs are disabled\n let [isDisabled, setIsDisabled] = useState<boolean>(false);\n useEffect(() => {\n let isDisabled = isTabsDisabled || isAllTabsDisabled(state?.collection || null, disabledKeys ? new Set(disabledKeys) : new Set(null));\n setIsDisabled(isDisabled);\n }, [state?.collection, disabledKeys, isTabsDisabled, setIsDisabled]);\n\n let [style, setStyle] = useState<{transform: string | undefined, width: string | undefined, height: string | undefined}>({\n transform: undefined,\n width: undefined,\n height: undefined\n });\n\n let onResize = useCallback(() => {\n if (selectedTab) {\n let styleObj: { transform: string | undefined, width: string | undefined, height: string | undefined } = {\n transform: undefined,\n width: undefined,\n height: undefined\n };\n\n // In RTL, calculate the transform from the right edge of the tablist so that resizing the window doesn't break the Tabline position due to offsetLeft changes\n let offset = direction === 'rtl' ? -1 * ((selectedTab.offsetParent as HTMLElement)?.offsetWidth - selectedTab.offsetWidth - selectedTab.offsetLeft) : selectedTab.offsetLeft;\n styleObj.transform = orientation === 'vertical'\n ? `translateY(${selectedTab.offsetTop}px)`\n : `translateX(${offset}px)`;\n\n if (orientation === 'horizontal') {\n styleObj.width = `${selectedTab.offsetWidth}px`;\n } else {\n styleObj.height = `${selectedTab.offsetHeight}px`;\n }\n setStyle(styleObj);\n }\n }, [direction, setStyle, selectedTab, orientation]);\n\n useLayoutEffect(() => {\n onResize();\n }, [onResize, state?.selectedItem?.key, direction, orientation, density]);\n\n return (\n <div style={{...style}} className={selectedIndicator({isDisabled, orientation})} />\n );\n}\n\nconst tabs = style({\n display: 'flex',\n flexShrink: 0,\n fontFamily: 'sans',\n fontWeight: 'normal',\n flexDirection: {\n orientation: {\n horizontal: 'column'\n }\n }\n}, getAllowedOverrides({height: true}));\n\nfunction Tabs(props: TabsProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TabsContext);\n let {\n density = 'regular',\n isDisabled,\n disabledKeys,\n orientation = 'horizontal'\n } = props;\n let domRef = useDOMRef(ref);\n\n return (\n <RACTabs\n {...props}\n ref={domRef}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tabs({...renderProps}, props.styles)}>\n <Provider\n values={[\n [TabsContext, {density, isDisabled, disabledKeys, orientation}]\n ]}>\n {props.children}\n </Provider>\n </RACTabs>\n );\n}\n\n/**\n * Tabs organize content into multiple sections and allow users to navigate between them. The content under the set of tabs should be related and form a coherent unit.\n */\nconst _Tabs = forwardRef(Tabs);\nexport {_Tabs as Tabs};\n"],"names":[],"version":3,"file":"Tabs.cjs.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAyDM,MAAM,0DAAc,CAAA,GAAA,0BAAY,EAAwD;AAE/F,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASC,SAAS,0CAAS,KAAoB;IAC3C,qBACE,gCAAC,CAAA,GAAA,mCAAW;QACT,GAAG,KAAK;QACT,OAAO,MAAM,YAAY;QACzB,WAAW,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,+BAAS,MAAM,MAAM,MAAM;;AAE7E;AAEA,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BN,MAAM;AAQC,SAAS,0CAAI,KAAe;IACjC,IAAI,WAAC,OAAO,EAAC,GAAG,CAAA,GAAA,4CAAgB,EAAE,8CAAgB,CAAC;IAEnD,qBACE,gCAAC,CAAA,GAAA,8BAAK;QACH,GAAG,KAAK;QACT,OAAO,MAAM,YAAY;QACzB,WAAW,CAAA,cAAe,AAAC,CAAA,MAAM,gBAAgB,IAAI,EAAC,IAAK,0BAAI;gBAAC,GAAG,WAAW;yBAAE;YAAO,GAAG,MAAM,MAAM;kBACtG,cAAA,gCAAC,CAAA,GAAA,mCAAO;YACN,QAAQ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oBAAC;oBAAa;iCAAC;oCAAS;sCAAY;qCAAc;oBAAW;iBAAE;aAChE;sBACA,MAAM,QAAQ;;;AAIvB;AAEA;;CAEC,GACD,MAAM,0DAAQ,CAAA,GAAA,uBAAS,EAAE","sources":["packages/@react-spectrum/s2/src/Tabs.tsx"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n TabListProps as AriaTabListProps,\n TabPanel as AriaTabPanel,\n TabPanelProps as AriaTabPanelProps,\n TabProps as AriaTabProps,\n TabsProps as AriaTabsProps,\n ContextValue,\n Provider,\n Tab as RACTab,\n TabList as RACTabList,\n Tabs as RACTabs,\n TabListStateContext,\n useSlottedContext\n } from 'react-aria-components';\nimport {centerBaseline} from './CenterBaseline';\nimport {Collection, DOMRef, DOMRefValue, Key, Node, Orientation} from '@react-types/shared';\nimport {createContext, forwardRef, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport {focusRing, getAllowedOverrides, StyleProps, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {IconContext} from './Icon';\nimport {style} from '../style/spectrum-theme' with {type: 'macro'};\nimport {Text, TextContext} from './Content';\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLayoutEffect} from '@react-aria/utils';\nimport {useLocale} from '@react-aria/i18n';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface TabsProps extends Omit<AriaTabsProps, 'className' | 'style' | 'children'>, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tabs. */\n children?: ReactNode,\n /**\n * The amount of space between the tabs.\n * @default \"regular\"\n */\n density?: 'compact' | 'regular'\n}\n\nexport interface TabProps extends Omit<AriaTabProps, 'children' | 'style' | 'className'>, StyleProps {\n /** The content to display in the tab. */\n children?: ReactNode\n}\n\nexport interface TabListProps<T> extends Omit<AriaTabListProps<T>, 'children' | 'style' | 'className'>, StyleProps {\n /** The content to display in the tablist. */\n children?: ReactNode\n}\n\nexport interface TabPanelProps extends Omit<AriaTabPanelProps, 'children' | 'style' | 'className'>, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight,\n /** The content to display in the tab panels. */\n children?: ReactNode\n}\n\nexport const TabsContext = createContext<ContextValue<TabsProps, DOMRefValue<HTMLDivElement>>>(null);\n\nconst tabPanel = style({\n marginTop: 4,\n color: 'gray-800',\n flexGrow: 1,\n flexBasis: '[0%]',\n minHeight: 0,\n minWidth: 0\n}, getAllowedOverrides({height: true}));\n\nexport function TabPanel(props: TabPanelProps) {\n return (\n <AriaTabPanel\n {...props}\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + tabPanel(null, props.styles)} />\n );\n}\n\nconst tab = style({\n ...focusRing(),\n display: 'flex',\n color: {\n default: 'neutral-subdued',\n isSelected: 'neutral',\n isHovered: 'neutral-subdued',\n isDisabled: 'disabled',\n forcedColors: {\n isSelected: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n borderRadius: 'sm',\n gap: 'text-to-visual',\n height: {\n density: {\n compact: 32,\n regular: 48\n }\n },\n alignItems: 'center',\n position: 'relative',\n cursor: 'default',\n flexShrink: 0,\n transition: 'default'\n}, getAllowedOverrides());\n\nconst icon = style({\n flexShrink: 0,\n '--iconPrimary': {\n type: 'fill',\n value: 'currentColor'\n }\n});\n\nexport function Tab(props: TabProps) {\n let {density} = useSlottedContext(TabsContext) ?? {};\n\n return (\n <RACTab\n {...props}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tab({...renderProps, density}, props.styles)}>\n <Provider\n values={[\n [TextContext, {styles: style({order: 1})}],\n [IconContext, {\n render: centerBaseline({slot: 'icon', styles: style({order: 0})}),\n styles: icon\n }]\n ]}>\n {typeof props.children === 'string' ? <Text>{props.children}</Text> : props.children}\n </Provider>\n </RACTab>\n );\n}\n\nconst tablist = style({\n display: 'flex',\n gap: {\n orientation: {\n horizontal: {\n density: {\n compact: 24,\n regular: 32\n }\n }\n }\n },\n flexDirection: {\n orientation: {\n vertical: 'column'\n }\n },\n paddingEnd: {\n orientation: {\n vertical: 20\n }\n },\n paddingStart: {\n orientation: {\n vertical: 12\n }\n },\n flexShrink: 0,\n flexBasis: '[0%]'\n});\n\nexport function TabList<T extends object>(props: TabListProps<T>) {\n let {density, isDisabled, disabledKeys, orientation} = useSlottedContext(TabsContext) ?? {};\n let state = useContext(TabListStateContext);\n let [selectedTab, setSelectedTab] = useState<HTMLElement | undefined>(undefined);\n let tablistRef = useRef<HTMLDivElement>(null);\n\n useLayoutEffect(() => {\n if (tablistRef?.current) {\n let tab: HTMLElement | null = tablistRef.current.querySelector('[role=tab][data-selected=true]');\n\n if (tab != null) {\n setSelectedTab(tab);\n }\n }\n }, [tablistRef, state?.selectedItem?.key]);\n\n return (\n <div\n style={props.UNSAFE_style}\n className={(props.UNSAFE_className || '') + style({position: 'relative'}, getAllowedOverrides())(null, props.styles)}>\n {orientation === 'vertical' &&\n <TabLine disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n <RACTabList\n {...props}\n ref={tablistRef}\n className={renderProps => tablist({...renderProps, density})} />\n {orientation === 'horizontal' &&\n <TabLine disabledKeys={disabledKeys} isDisabled={isDisabled} selectedTab={selectedTab} orientation={orientation} density={density} />}\n </div>\n );\n}\n\nfunction isAllTabsDisabled<T>(collection: Collection<Node<T>> | null, disabledKeys: Set<Key>) {\n let testKey: Key | null = null;\n if (collection && collection.size > 0) {\n testKey = collection.getFirstKey();\n\n let index = 0;\n while (testKey && index < collection.size) {\n // We have to check if the item in the collection has a key in disabledKeys or has the isDisabled prop set directly on it\n if (!disabledKeys.has(testKey) && !collection.getItem(testKey)?.props?.isDisabled) {\n return false;\n }\n\n testKey = collection.getKeyAfter(testKey);\n index++;\n }\n return true;\n }\n return false;\n}\n\ninterface TabLineProps {\n disabledKeys: Iterable<Key> | undefined,\n isDisabled: boolean | undefined,\n selectedTab: HTMLElement | undefined,\n orientation?: Orientation,\n density?: 'compact' | 'regular'\n}\n\nconst selectedIndicator = style({\n position: 'absolute',\n backgroundColor: {\n default: 'neutral',\n isDisabled: 'disabled',\n forcedColors: {\n default: 'Highlight',\n isDisabled: 'GrayText'\n }\n },\n height: {\n orientation: {\n horizontal: '[2px]'\n }\n },\n width: {\n orientation: {\n vertical: '[2px]'\n }\n },\n bottom: {\n orientation: {\n horizontal: 0\n }\n },\n borderStyle: 'none',\n borderRadius: 'full',\n transitionDuration: 130,\n transitionTimingFunction: 'in-out'\n});\n\nfunction TabLine(props: TabLineProps) {\n let {\n disabledKeys,\n isDisabled: isTabsDisabled,\n selectedTab,\n orientation,\n density\n } = props;\n let {direction} = useLocale();\n let state = useContext(TabListStateContext);\n\n // We want to add disabled styling to the selection indicator only if all the Tabs are disabled\n let [isDisabled, setIsDisabled] = useState<boolean>(false);\n useEffect(() => {\n let isDisabled = isTabsDisabled || isAllTabsDisabled(state?.collection || null, disabledKeys ? new Set(disabledKeys) : new Set(null));\n setIsDisabled(isDisabled);\n }, [state?.collection, disabledKeys, isTabsDisabled, setIsDisabled]);\n\n let [style, setStyle] = useState<{transform: string | undefined, width: string | undefined, height: string | undefined}>({\n transform: undefined,\n width: undefined,\n height: undefined\n });\n\n let onResize = useCallback(() => {\n if (selectedTab) {\n let styleObj: { transform: string | undefined, width: string | undefined, height: string | undefined } = {\n transform: undefined,\n width: undefined,\n height: undefined\n };\n\n // In RTL, calculate the transform from the right edge of the tablist so that resizing the window doesn't break the Tabline position due to offsetLeft changes\n let offset = direction === 'rtl' ? -1 * ((selectedTab.offsetParent as HTMLElement)?.offsetWidth - selectedTab.offsetWidth - selectedTab.offsetLeft) : selectedTab.offsetLeft;\n styleObj.transform = orientation === 'vertical'\n ? `translateY(${selectedTab.offsetTop}px)`\n : `translateX(${offset}px)`;\n\n if (orientation === 'horizontal') {\n styleObj.width = `${selectedTab.offsetWidth}px`;\n } else {\n styleObj.height = `${selectedTab.offsetHeight}px`;\n }\n setStyle(styleObj);\n }\n }, [direction, setStyle, selectedTab, orientation]);\n\n useLayoutEffect(() => {\n onResize();\n }, [onResize, state?.selectedItem?.key, direction, orientation, density]);\n\n return (\n <div style={{...style}} className={selectedIndicator({isDisabled, orientation})} />\n );\n}\n\nconst tabs = style({\n display: 'flex',\n flexShrink: 0,\n fontFamily: 'sans',\n fontWeight: 'normal',\n flexDirection: {\n orientation: {\n horizontal: 'column'\n }\n }\n}, getAllowedOverrides({height: true}));\n\nfunction Tabs(props: TabsProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, TabsContext);\n let {\n density = 'regular',\n isDisabled,\n disabledKeys,\n orientation = 'horizontal'\n } = props;\n let domRef = useDOMRef(ref);\n\n return (\n <RACTabs\n {...props}\n ref={domRef}\n style={props.UNSAFE_style}\n className={renderProps => (props.UNSAFE_className || '') + tabs({...renderProps}, props.styles)}>\n <Provider\n values={[\n [TabsContext, {density, isDisabled, disabledKeys, orientation}]\n ]}>\n {props.children}\n </Provider>\n </RACTabs>\n );\n}\n\n/**\n * Tabs organize content into multiple sections and allow users to navigate between them. The content under the set of tabs should be related and form a coherent unit.\n */\nconst _Tabs = forwardRef(Tabs);\nexport {_Tabs as Tabs};\n"],"names":[],"version":3,"file":"Tabs.cjs.map"}
|