@react-spectrum/s2 3.0.0-nightly-326f48154-241216 → 3.0.0-nightly-fee532d6a-241217
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/ActionButton.cjs +58 -80
- package/dist/ActionButton.cjs.map +1 -1
- package/dist/ActionButton.css +76 -96
- package/dist/ActionButton.css.map +1 -1
- package/dist/ActionButton.mjs +58 -80
- package/dist/ActionButton.mjs.map +1 -1
- package/dist/ActionButtonGroup.cjs.map +1 -1
- package/dist/ActionButtonGroup.css.map +1 -1
- package/dist/ActionButtonGroup.mjs.map +1 -1
- package/dist/Badge.cjs +66 -66
- package/dist/Badge.css +43 -43
- package/dist/Badge.mjs +66 -66
- package/dist/Breadcrumbs.cjs +6 -6
- package/dist/Breadcrumbs.css +4 -4
- package/dist/Breadcrumbs.mjs +6 -6
- package/dist/Button.cjs +89 -134
- package/dist/Button.cjs.map +1 -1
- package/dist/Button.css +102 -134
- package/dist/Button.css.map +1 -1
- package/dist/Button.mjs +89 -134
- package/dist/Button.mjs.map +1 -1
- package/dist/Card.cjs +4 -4
- package/dist/Card.css +3 -3
- package/dist/Card.mjs +4 -4
- package/dist/CardView.cjs +1 -1
- package/dist/CardView.css +1 -1
- package/dist/CardView.mjs +1 -1
- package/dist/Checkbox.cjs +10 -10
- package/dist/Checkbox.css +10 -10
- package/dist/Checkbox.mjs +10 -10
- package/dist/CloseButton.cjs +17 -28
- package/dist/CloseButton.cjs.map +1 -1
- package/dist/CloseButton.css +19 -31
- package/dist/CloseButton.css.map +1 -1
- package/dist/CloseButton.mjs +17 -28
- package/dist/CloseButton.mjs.map +1 -1
- package/dist/ColorArea.cjs +1 -1
- package/dist/ColorArea.css +1 -1
- package/dist/ColorArea.mjs +1 -1
- package/dist/ColorHandle.cjs +3 -3
- package/dist/ColorHandle.css +3 -3
- package/dist/ColorHandle.mjs +3 -3
- package/dist/ColorSlider.cjs +1 -1
- package/dist/ColorSlider.css +1 -1
- package/dist/ColorSlider.mjs +1 -1
- package/dist/ColorSwatchPicker.cjs +1 -1
- package/dist/ColorSwatchPicker.css +1 -1
- package/dist/ColorSwatchPicker.mjs +1 -1
- package/dist/ColorWheel.cjs +2 -2
- package/dist/ColorWheel.css +1 -1
- package/dist/ColorWheel.mjs +2 -2
- package/dist/ComboBox.cjs +5 -5
- package/dist/ComboBox.css +4 -4
- package/dist/ComboBox.mjs +5 -5
- package/dist/Disclosure.cjs +1 -1
- package/dist/Disclosure.css +1 -1
- package/dist/Disclosure.mjs +1 -1
- package/dist/Divider.cjs +8 -8
- package/dist/Divider.cjs.map +1 -1
- package/dist/Divider.css +13 -13
- package/dist/Divider.css.map +1 -1
- package/dist/Divider.mjs +8 -8
- package/dist/Divider.mjs.map +1 -1
- package/dist/DropZone.cjs +4 -4
- package/dist/DropZone.css +2 -2
- package/dist/DropZone.mjs +4 -4
- package/dist/Field.cjs +7 -8
- package/dist/Field.cjs.map +1 -1
- package/dist/Field.css +7 -11
- package/dist/Field.css.map +1 -1
- package/dist/Field.mjs +7 -8
- package/dist/Field.mjs.map +1 -1
- package/dist/InlineAlert.cjs +23 -23
- package/dist/InlineAlert.css +15 -15
- package/dist/InlineAlert.mjs +23 -23
- package/dist/Link.cjs +7 -6
- package/dist/Link.cjs.map +1 -1
- package/dist/Link.css +14 -14
- package/dist/Link.css.map +1 -1
- package/dist/Link.mjs +7 -6
- package/dist/Link.mjs.map +1 -1
- package/dist/Menu.cjs +26 -6
- package/dist/Menu.cjs.map +1 -1
- package/dist/Menu.css +3 -3
- package/dist/Menu.css.map +1 -1
- package/dist/Menu.mjs +27 -7
- package/dist/Menu.mjs.map +1 -1
- package/dist/Meter.cjs +13 -13
- package/dist/Meter.cjs.map +1 -1
- package/dist/Meter.css +18 -22
- package/dist/Meter.css.map +1 -1
- package/dist/Meter.mjs +13 -13
- package/dist/Meter.mjs.map +1 -1
- package/dist/Modal.cjs +1 -1
- package/dist/Modal.css +1 -1
- package/dist/Modal.mjs +1 -1
- package/dist/NumberField.cjs +4 -4
- package/dist/NumberField.css +4 -4
- package/dist/NumberField.mjs +4 -4
- package/dist/Picker.cjs +4 -4
- package/dist/Picker.css +4 -4
- package/dist/Picker.mjs +4 -4
- package/dist/Popover.cjs +3 -3
- package/dist/Popover.css +3 -3
- package/dist/Popover.mjs +3 -3
- package/dist/ProgressBar.cjs +20 -18
- package/dist/ProgressBar.cjs.map +1 -1
- package/dist/ProgressBar.css +20 -24
- package/dist/ProgressBar.css.map +1 -1
- package/dist/ProgressBar.mjs +20 -18
- package/dist/ProgressBar.mjs.map +1 -1
- package/dist/ProgressCircle.cjs +11 -9
- package/dist/ProgressCircle.cjs.map +1 -1
- package/dist/ProgressCircle.css +14 -14
- package/dist/ProgressCircle.css.map +1 -1
- package/dist/ProgressCircle.mjs +11 -9
- package/dist/ProgressCircle.mjs.map +1 -1
- package/dist/Provider.cjs +1 -1
- package/dist/Provider.css +1 -1
- package/dist/Provider.mjs +1 -1
- package/dist/Radio.cjs +6 -6
- package/dist/Radio.css +6 -6
- package/dist/Radio.mjs +6 -6
- package/dist/SearchField.cjs +1 -1
- package/dist/SearchField.css +1 -1
- package/dist/SearchField.mjs +1 -1
- package/dist/SegmentedControl.cjs +8 -8
- package/dist/SegmentedControl.css +8 -8
- package/dist/SegmentedControl.mjs +8 -8
- package/dist/Slider.cjs +8 -8
- package/dist/Slider.css +5 -5
- package/dist/Slider.mjs +8 -8
- package/dist/Switch.cjs +7 -7
- package/dist/Switch.css +6 -6
- package/dist/Switch.mjs +7 -7
- package/dist/TableView.cjs +17 -17
- package/dist/TableView.css +11 -11
- package/dist/TableView.mjs +17 -17
- package/dist/Tabs.cjs +5 -5
- package/dist/Tabs.css +5 -5
- package/dist/Tabs.mjs +5 -5
- package/dist/TabsPicker.cjs +1 -1
- package/dist/TabsPicker.css +1 -1
- package/dist/TabsPicker.mjs +1 -1
- package/dist/TagGroup.cjs +10 -10
- package/dist/TagGroup.css +8 -8
- package/dist/TagGroup.mjs +10 -10
- package/dist/ToggleButton.cjs +1 -0
- package/dist/ToggleButton.cjs.map +1 -1
- package/dist/ToggleButton.css.map +1 -1
- package/dist/ToggleButton.mjs +1 -0
- package/dist/ToggleButton.mjs.map +1 -1
- package/dist/Tooltip.cjs +1 -1
- package/dist/Tooltip.css +1 -1
- package/dist/Tooltip.mjs +1 -1
- package/dist/types.d.ts +9 -9
- package/dist/types.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/ActionButton.tsx +19 -43
- package/src/ActionButtonGroup.tsx +1 -1
- package/src/Button.tsx +36 -79
- package/src/CloseButton.tsx +10 -20
- package/src/Divider.tsx +10 -16
- package/src/Field.tsx +2 -2
- package/src/Link.tsx +7 -12
- package/src/Menu.tsx +22 -6
- package/src/Meter.tsx +7 -14
- package/src/ProgressBar.tsx +8 -15
- package/src/ProgressCircle.tsx +12 -15
- package/src/ToggleButton.tsx +1 -0
- package/src/bar-utils.ts +3 -10
- package/src/style-utils.ts +15 -8
- package/style/dist/spectrum-theme.cjs +15 -1
- package/style/dist/spectrum-theme.cjs.map +1 -1
- package/style/dist/spectrum-theme.mjs +15 -1
- package/style/dist/spectrum-theme.mjs.map +1 -1
- package/style/dist/types.d.ts +40 -27
- package/style/dist/types.d.ts.map +1 -1
- package/style/spectrum-theme.ts +4 -2
- package/style/tokens.ts +30 -0
package/dist/ProgressBar.cjs
CHANGED
|
@@ -48,6 +48,8 @@ const $83e59061dd392311$var$wrapper = function anonymous(props, overrides) {
|
|
|
48
48
|
if (/^\s*q/.test(p)) $q = true;
|
|
49
49
|
if (/^\s*r/.test(p)) $r = true;
|
|
50
50
|
}
|
|
51
|
+
if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
|
|
52
|
+
else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
|
|
51
53
|
if (!$U) rules += ' Uc';
|
|
52
54
|
rules += ' _Zf';
|
|
53
55
|
if (props.isIndeterminate) {
|
|
@@ -107,9 +109,8 @@ const $83e59061dd392311$var$valueStyles = function anonymous(props) {
|
|
|
107
109
|
rules += ' _eb';
|
|
108
110
|
rules += ' _f-1x99dlob';
|
|
109
111
|
rules += ' _fa';
|
|
110
|
-
rules += '
|
|
111
|
-
if (props.
|
|
112
|
-
else if (props.staticColor === "white") rules += ' a_____d';
|
|
112
|
+
rules += ' aa_____K';
|
|
113
|
+
if (props.isStaticColor) rules += ' a_____G';
|
|
113
114
|
else if (props.isDisabled) rules += ' aj';
|
|
114
115
|
else {
|
|
115
116
|
if (props.isPressed) rules += ' an';
|
|
@@ -148,15 +149,14 @@ const $83e59061dd392311$var$trackStyles = function anonymous(props) {
|
|
|
148
149
|
rules += ' _wf';
|
|
149
150
|
rules += ' _xf';
|
|
150
151
|
rules += ' _yf';
|
|
151
|
-
rules += '
|
|
152
|
-
if (props.
|
|
153
|
-
else if (props.staticColor === "white") rules += ' b____7';
|
|
152
|
+
rules += ' ba_____J';
|
|
153
|
+
if (props.isStaticColor) rules += ' b_____z';
|
|
154
154
|
else rules += ' bi';
|
|
155
155
|
rules += ' _Nab';
|
|
156
156
|
rules += ' _Na';
|
|
157
157
|
rules += ' _Lab';
|
|
158
158
|
rules += ' _La';
|
|
159
|
-
rules += '
|
|
159
|
+
rules += ' da_____K';
|
|
160
160
|
rules += ' da';
|
|
161
161
|
rules += ' __Q-3t1y';
|
|
162
162
|
if (props.size === "XL") rules += ' ky';
|
|
@@ -174,14 +174,13 @@ const $83e59061dd392311$var$fill = function anonymous(props) {
|
|
|
174
174
|
rules += ' _wf';
|
|
175
175
|
rules += ' _xf';
|
|
176
176
|
rules += ' _yf';
|
|
177
|
-
rules += '
|
|
178
|
-
if (props.
|
|
179
|
-
else if (props.staticColor === "white") rules += ' b_____f';
|
|
177
|
+
rules += ' ba_____K';
|
|
178
|
+
if (props.isStaticColor) rules += ' b_____F';
|
|
180
179
|
else {
|
|
181
|
-
if (props.isPressed) rules += '
|
|
182
|
-
else if (props.isFocusVisible) rules += '
|
|
183
|
-
else if (props.isHovered) rules += '
|
|
184
|
-
else rules += '
|
|
180
|
+
if (props.isPressed) rules += ' b_____S';
|
|
181
|
+
else if (props.isFocusVisible) rules += ' b_____S';
|
|
182
|
+
else if (props.isHovered) rules += ' b_____S';
|
|
183
|
+
else rules += ' b_____R';
|
|
185
184
|
}
|
|
186
185
|
if (props.isIndeterminate) rules += ' lb';
|
|
187
186
|
if (props.isIndeterminate) rules += ' __Gh';
|
|
@@ -203,6 +202,7 @@ const $83e59061dd392311$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $gIpiX$react
|
|
|
203
202
|
let { label: label, size: size = 'M', staticColor: staticColor, isIndeterminate: isIndeterminate, labelPosition: labelPosition = 'top', UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
|
|
204
203
|
let domRef = (0, $gIpiX$reactspectrumutils.useDOMRef)(ref);
|
|
205
204
|
let { direction: direction } = (0, $gIpiX$reactariai18n.useLocale)();
|
|
205
|
+
let isStaticColor = !!staticColor;
|
|
206
206
|
return /*#__PURE__*/ (0, $gIpiX$reactjsxruntime.jsx)((0, $gIpiX$reactariacomponents.ProgressBar), {
|
|
207
207
|
...props,
|
|
208
208
|
ref: domRef,
|
|
@@ -210,7 +210,8 @@ const $83e59061dd392311$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $gIpiX$react
|
|
|
210
210
|
className: UNSAFE_className + $83e59061dd392311$var$wrapper({
|
|
211
211
|
...props,
|
|
212
212
|
size: size,
|
|
213
|
-
labelPosition: labelPosition
|
|
213
|
+
labelPosition: labelPosition,
|
|
214
|
+
staticColor: staticColor
|
|
214
215
|
}, props.styles),
|
|
215
216
|
children: ({ percentage: percentage, valueText: valueText })=>/*#__PURE__*/ (0, $gIpiX$reactjsxruntime.jsxs)((0, $gIpiX$reactjsxruntime.Fragment), {
|
|
216
217
|
children: [
|
|
@@ -225,18 +226,19 @@ const $83e59061dd392311$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $gIpiX$react
|
|
|
225
226
|
className: $83e59061dd392311$var$valueStyles({
|
|
226
227
|
size: size,
|
|
227
228
|
labelAlign: 'end',
|
|
228
|
-
|
|
229
|
+
isStaticColor: isStaticColor
|
|
229
230
|
}),
|
|
230
231
|
children: valueText
|
|
231
232
|
}),
|
|
232
233
|
/*#__PURE__*/ (0, $gIpiX$reactjsxruntime.jsx)("div", {
|
|
233
234
|
className: $83e59061dd392311$var$trackStyles({
|
|
234
|
-
|
|
235
|
+
isStaticColor: isStaticColor,
|
|
236
|
+
size: size
|
|
235
237
|
}),
|
|
236
238
|
children: /*#__PURE__*/ (0, $gIpiX$reactjsxruntime.jsx)("div", {
|
|
237
239
|
className: (0, $308b180f49d82d28$exports.mergeStyles)($83e59061dd392311$var$fill({
|
|
238
240
|
...props,
|
|
239
|
-
|
|
241
|
+
isStaticColor: isStaticColor
|
|
240
242
|
}), isIndeterminate ? $83e59061dd392311$var$indeterminateAnimation({
|
|
241
243
|
direction: direction
|
|
242
244
|
}) : null),
|
package/dist/ProgressBar.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA+CM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAA+D;AAE7G,MAAM;AASN,MAAM;AASN,MAAM
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA+CM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAA+D;AAE7G,MAAM;AASN,MAAM;AASN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaN,MAAM;;;;;;;;;;;;;;;;;;;;AAiBN,MAAM;;;;;;;;;;;AAkBC,MAAM,4CAAc,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAA2B;IAC3H,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,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,mCAAQ,EAAE;IACvB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,gBAAgB,CAAC,CAAC;IAEtB,qBACE,gCAAC,CAAA,GAAA,sCAAc;QACZ,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,mBAAmB,8BAAQ;YAAC,GAAG,KAAK;kBAAE;2BAAM;yBAAe;QAAW,GAAG,MAAM,MAAM;kBAC/F,CAAC,cAAC,UAAU,aAAE,SAAS,EAAC,iBACvB;;oBACG,uBAAS,gCAAC,CAAA,GAAA,oCAAS;wBAAE,MAAM;wBAAM,YAAW;wBAAQ,eAAe;wBAAe,aAAa;kCAAc;;oBAC7G,SAAS,CAAC,iCAAmB,gCAAC;wBAAK,WAAW,kCAAY;kCAAC;4BAAM,YAAY;2CAAO;wBAAa;kCAAK;;kCACvG,gCAAC;wBAAI,WAAW,kCAAY;2CAAC;kCAAe;wBAAI;kCAC9C,cAAA,gCAAC;4BACC,WAAW,CAAA,GAAA,qCAAU,EAAE,2BAAK;gCAAC,GAAG,KAAK;+CAAE;4BAAa,IAAK,kBAAkB,6CAAuB;2CAAC;4BAAS,KAAK;4BACjH,OAAO;gCAAC,OAAO,kBAAkB,YAAY,aAAa;4BAAG;;;;;;AAM3E","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 {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from '@react-aria/i18n';\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' | 'auto',\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\nconst indeterminateLTR = keyframes(`\n 0% {\n transform: translateX(-70%) scaleX(0.7);\n }\n 100% {\n transform: translateX(100%) scaleX(0.7);\n }\n`);\n\nconst indeterminateRTL = keyframes(`\n 0% {\n transform: translateX(100%) scaleX(0.7);\n }\n 100% {\n transform: translateX(-70%) scaleX(0.7);\n }\n`);\n\nconst wrapper = style({\n ...bar(),\n gridTemplateColumns: {\n default: {\n labelPosition: {\n top: ['1fr', 'auto'],\n side: ['auto', '1fr']\n }\n },\n isIndeterminate: {\n labelPosition: {\n top: ['1fr'],\n side: ['auto', '1fr']\n }\n }\n },\n gridTemplateAreas: {\n default: {\n labelPosition: {\n top: [\n 'label value',\n 'bar bar'\n ],\n side: [\n 'label bar value'\n ]\n }\n },\n isIndeterminate: {\n labelPosition: {\n top: [\n 'label',\n 'bar'\n ],\n side: [\n 'label bar'\n ]\n }\n }\n }\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: 6,\n size: {\n S: 4, // progress-bar-thickness-small\n M: 6, // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: 10 // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fill = style<ProgressBarStyleProps & {isStaticColor: boolean}>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-900',\n forcedColors: 'ButtonText'\n },\n width: {\n isIndeterminate: 'full'\n },\n transformOrigin: {\n isIndeterminate: 'left'\n }\n});\n\nconst indeterminateAnimation = style({\n animation: {\n direction: {\n ltr: indeterminateLTR,\n rtl: indeterminateRTL\n }\n },\n animationDuration: 1000,\n animationIterationCount: 'infinite',\n animationTimingFunction: 'in-out',\n willChange: 'transform',\n position: 'relative'\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 */\nexport const ProgressBar = /*#__PURE__*/ forwardRef(function 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 let {direction} = useLocale();\n let isStaticColor = !!staticColor;\n\n return (\n <AriaProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({...props, size, labelPosition, staticColor}, props.styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && !isIndeterminate && <span className={valueStyles({size, labelAlign: 'end', isStaticColor})}>{valueText}</span>}\n <div className={trackStyles({isStaticColor, size})}>\n <div\n className={mergeStyles(fill({...props, isStaticColor}), (isIndeterminate ? indeterminateAnimation({direction}) : null))}\n style={{width: isIndeterminate ? undefined : percentage + '%'}} />\n </div>\n </>\n )}\n </AriaProgressBar>\n );\n});\n\n"],"names":[],"version":3,"file":"ProgressBar.cjs.map"}
|
package/dist/ProgressBar.css
CHANGED
|
@@ -19,6 +19,14 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
@layer _.a {
|
|
22
|
+
.-_1de2x0q_b-c {
|
|
23
|
+
--s2-container-bg: white;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.-_1de2x0q_b-b {
|
|
27
|
+
--s2-container-bg: black;
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
._Zf {
|
|
23
31
|
display: grid;
|
|
24
32
|
}
|
|
@@ -147,12 +155,8 @@
|
|
|
147
155
|
color: var(--lightningcss-light, #c6c6c6) var(--lightningcss-dark, #444);
|
|
148
156
|
}
|
|
149
157
|
|
|
150
|
-
.
|
|
151
|
-
color:
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.a_____s {
|
|
155
|
-
color: #000000ed;
|
|
158
|
+
.a_____G {
|
|
159
|
+
color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / 1);
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
.__Hb {
|
|
@@ -247,12 +251,8 @@
|
|
|
247
251
|
background-color: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
|
|
248
252
|
}
|
|
249
253
|
|
|
250
|
-
.
|
|
251
|
-
background-color:
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
.b_____n {
|
|
255
|
-
background-color: #00000038;
|
|
254
|
+
.b_____z {
|
|
255
|
+
background-color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .17);
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
._Na {
|
|
@@ -311,20 +311,16 @@
|
|
|
311
311
|
border-end-end-radius: 9999px;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
.
|
|
314
|
+
.b_____R {
|
|
315
315
|
background-color: var(--lightningcss-light, #3b63fb) var(--lightningcss-dark, #4069fd);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
.
|
|
318
|
+
.b_____S {
|
|
319
319
|
background-color: var(--lightningcss-light, #274dea) var(--lightningcss-dark, #345bf8);
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
.
|
|
323
|
-
background-color:
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.b_____s {
|
|
327
|
-
background-color: #000000ed;
|
|
322
|
+
.b_____F {
|
|
323
|
+
background-color: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .94);
|
|
328
324
|
}
|
|
329
325
|
|
|
330
326
|
.lb {
|
|
@@ -438,11 +434,11 @@
|
|
|
438
434
|
|
|
439
435
|
@layer _.b.a {
|
|
440
436
|
@media (forced-colors: active) {
|
|
441
|
-
.
|
|
437
|
+
.aa_____K {
|
|
442
438
|
color: buttontext;
|
|
443
439
|
}
|
|
444
440
|
|
|
445
|
-
.
|
|
441
|
+
.ba_____J {
|
|
446
442
|
background-color: buttonface;
|
|
447
443
|
}
|
|
448
444
|
|
|
@@ -454,11 +450,11 @@
|
|
|
454
450
|
outline-style: solid;
|
|
455
451
|
}
|
|
456
452
|
|
|
457
|
-
.
|
|
453
|
+
.da_____K {
|
|
458
454
|
outline-color: buttontext;
|
|
459
455
|
}
|
|
460
456
|
|
|
461
|
-
.
|
|
457
|
+
.ba_____K {
|
|
462
458
|
background-color: buttontext;
|
|
463
459
|
}
|
|
464
460
|
}
|
package/dist/ProgressBar.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AC2DyB;;;;;;;;;;AASA;;;;;;;;;;AAST;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0CI;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;
|
|
1
|
+
{"mappings":"AC2DyB;;;;;;;;;;AASA;;;;;;;;;;AAST;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EA0CI;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAKA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAaP;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAiBkB;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AA7Ef;EA0CI;;;;EAAA;;;;;AA1CJ;;AA0CI;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;;;;;AAAA;EAAA;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAAA;;;;;;AAAA;EAAA;IAAA;;;;IAKA;;;;IAAA;;;;IAAA;;;;IAAA;;;;IAaP;;;;;;AAbO;EAAA;IAAA;;;;;;AAaP","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@import \"5d9861be4320075f\";\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 {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from '@react-aria/i18n';\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' | 'auto',\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\nconst indeterminateLTR = keyframes(`\n 0% {\n transform: translateX(-70%) scaleX(0.7);\n }\n 100% {\n transform: translateX(100%) scaleX(0.7);\n }\n`);\n\nconst indeterminateRTL = keyframes(`\n 0% {\n transform: translateX(100%) scaleX(0.7);\n }\n 100% {\n transform: translateX(-70%) scaleX(0.7);\n }\n`);\n\nconst wrapper = style({\n ...bar(),\n gridTemplateColumns: {\n default: {\n labelPosition: {\n top: ['1fr', 'auto'],\n side: ['auto', '1fr']\n }\n },\n isIndeterminate: {\n labelPosition: {\n top: ['1fr'],\n side: ['auto', '1fr']\n }\n }\n },\n gridTemplateAreas: {\n default: {\n labelPosition: {\n top: [\n 'label value',\n 'bar bar'\n ],\n side: [\n 'label bar value'\n ]\n }\n },\n isIndeterminate: {\n labelPosition: {\n top: [\n 'label',\n 'bar'\n ],\n side: [\n 'label bar'\n ]\n }\n }\n }\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: 6,\n size: {\n S: 4, // progress-bar-thickness-small\n M: 6, // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: 10 // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fill = style<ProgressBarStyleProps & {isStaticColor: boolean}>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-900',\n forcedColors: 'ButtonText'\n },\n width: {\n isIndeterminate: 'full'\n },\n transformOrigin: {\n isIndeterminate: 'left'\n }\n});\n\nconst indeterminateAnimation = style({\n animation: {\n direction: {\n ltr: indeterminateLTR,\n rtl: indeterminateRTL\n }\n },\n animationDuration: 1000,\n animationIterationCount: 'infinite',\n animationTimingFunction: 'in-out',\n willChange: 'transform',\n position: 'relative'\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 */\nexport const ProgressBar = /*#__PURE__*/ forwardRef(function 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 let {direction} = useLocale();\n let isStaticColor = !!staticColor;\n\n return (\n <AriaProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({...props, size, labelPosition, staticColor}, props.styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && !isIndeterminate && <span className={valueStyles({size, labelAlign: 'end', isStaticColor})}>{valueText}</span>}\n <div className={trackStyles({isStaticColor, size})}>\n <div\n className={mergeStyles(fill({...props, isStaticColor}), (isIndeterminate ? indeterminateAnimation({direction}) : null))}\n style={{width: isIndeterminate ? undefined : percentage + '%'}} />\n </div>\n </>\n )}\n </AriaProgressBar>\n );\n});\n\n"],"names":[],"version":3,"file":"ProgressBar.css.map"}
|
package/dist/ProgressBar.mjs
CHANGED
|
@@ -41,6 +41,8 @@ const $b847b7cd294eafba$var$wrapper = function anonymous(props, overrides) {
|
|
|
41
41
|
if (/^\s*q/.test(p)) $q = true;
|
|
42
42
|
if (/^\s*r/.test(p)) $r = true;
|
|
43
43
|
}
|
|
44
|
+
if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
|
|
45
|
+
else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
|
|
44
46
|
if (!$U) rules += ' Uc';
|
|
45
47
|
rules += ' _Zf';
|
|
46
48
|
if (props.isIndeterminate) {
|
|
@@ -100,9 +102,8 @@ const $b847b7cd294eafba$var$valueStyles = function anonymous(props) {
|
|
|
100
102
|
rules += ' _eb';
|
|
101
103
|
rules += ' _f-1x99dlob';
|
|
102
104
|
rules += ' _fa';
|
|
103
|
-
rules += '
|
|
104
|
-
if (props.
|
|
105
|
-
else if (props.staticColor === "white") rules += ' a_____d';
|
|
105
|
+
rules += ' aa_____K';
|
|
106
|
+
if (props.isStaticColor) rules += ' a_____G';
|
|
106
107
|
else if (props.isDisabled) rules += ' aj';
|
|
107
108
|
else {
|
|
108
109
|
if (props.isPressed) rules += ' an';
|
|
@@ -141,15 +142,14 @@ const $b847b7cd294eafba$var$trackStyles = function anonymous(props) {
|
|
|
141
142
|
rules += ' _wf';
|
|
142
143
|
rules += ' _xf';
|
|
143
144
|
rules += ' _yf';
|
|
144
|
-
rules += '
|
|
145
|
-
if (props.
|
|
146
|
-
else if (props.staticColor === "white") rules += ' b____7';
|
|
145
|
+
rules += ' ba_____J';
|
|
146
|
+
if (props.isStaticColor) rules += ' b_____z';
|
|
147
147
|
else rules += ' bi';
|
|
148
148
|
rules += ' _Nab';
|
|
149
149
|
rules += ' _Na';
|
|
150
150
|
rules += ' _Lab';
|
|
151
151
|
rules += ' _La';
|
|
152
|
-
rules += '
|
|
152
|
+
rules += ' da_____K';
|
|
153
153
|
rules += ' da';
|
|
154
154
|
rules += ' __Q-3t1y';
|
|
155
155
|
if (props.size === "XL") rules += ' ky';
|
|
@@ -167,14 +167,13 @@ const $b847b7cd294eafba$var$fill = function anonymous(props) {
|
|
|
167
167
|
rules += ' _wf';
|
|
168
168
|
rules += ' _xf';
|
|
169
169
|
rules += ' _yf';
|
|
170
|
-
rules += '
|
|
171
|
-
if (props.
|
|
172
|
-
else if (props.staticColor === "white") rules += ' b_____f';
|
|
170
|
+
rules += ' ba_____K';
|
|
171
|
+
if (props.isStaticColor) rules += ' b_____F';
|
|
173
172
|
else {
|
|
174
|
-
if (props.isPressed) rules += '
|
|
175
|
-
else if (props.isFocusVisible) rules += '
|
|
176
|
-
else if (props.isHovered) rules += '
|
|
177
|
-
else rules += '
|
|
173
|
+
if (props.isPressed) rules += ' b_____S';
|
|
174
|
+
else if (props.isFocusVisible) rules += ' b_____S';
|
|
175
|
+
else if (props.isHovered) rules += ' b_____S';
|
|
176
|
+
else rules += ' b_____R';
|
|
178
177
|
}
|
|
179
178
|
if (props.isIndeterminate) rules += ' lb';
|
|
180
179
|
if (props.isIndeterminate) rules += ' __Gh';
|
|
@@ -196,6 +195,7 @@ const $b847b7cd294eafba$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $cNVLZ$forwa
|
|
|
196
195
|
let { label: label, size: size = 'M', staticColor: staticColor, isIndeterminate: isIndeterminate, labelPosition: labelPosition = 'top', UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className = '' } = props;
|
|
197
196
|
let domRef = (0, $cNVLZ$useDOMRef)(ref);
|
|
198
197
|
let { direction: direction } = (0, $cNVLZ$useLocale)();
|
|
198
|
+
let isStaticColor = !!staticColor;
|
|
199
199
|
return /*#__PURE__*/ (0, $cNVLZ$jsx)((0, $cNVLZ$ProgressBar), {
|
|
200
200
|
...props,
|
|
201
201
|
ref: domRef,
|
|
@@ -203,7 +203,8 @@ const $b847b7cd294eafba$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $cNVLZ$forwa
|
|
|
203
203
|
className: UNSAFE_className + $b847b7cd294eafba$var$wrapper({
|
|
204
204
|
...props,
|
|
205
205
|
size: size,
|
|
206
|
-
labelPosition: labelPosition
|
|
206
|
+
labelPosition: labelPosition,
|
|
207
|
+
staticColor: staticColor
|
|
207
208
|
}, props.styles),
|
|
208
209
|
children: ({ percentage: percentage, valueText: valueText })=>/*#__PURE__*/ (0, $cNVLZ$jsxs)((0, $cNVLZ$Fragment), {
|
|
209
210
|
children: [
|
|
@@ -218,18 +219,19 @@ const $b847b7cd294eafba$export$c17561cb55d4db30 = /*#__PURE__*/ (0, $cNVLZ$forwa
|
|
|
218
219
|
className: $b847b7cd294eafba$var$valueStyles({
|
|
219
220
|
size: size,
|
|
220
221
|
labelAlign: 'end',
|
|
221
|
-
|
|
222
|
+
isStaticColor: isStaticColor
|
|
222
223
|
}),
|
|
223
224
|
children: valueText
|
|
224
225
|
}),
|
|
225
226
|
/*#__PURE__*/ (0, $cNVLZ$jsx)("div", {
|
|
226
227
|
className: $b847b7cd294eafba$var$trackStyles({
|
|
227
|
-
|
|
228
|
+
isStaticColor: isStaticColor,
|
|
229
|
+
size: size
|
|
228
230
|
}),
|
|
229
231
|
children: /*#__PURE__*/ (0, $cNVLZ$jsx)("div", {
|
|
230
232
|
className: (0, $feb886035e0d4633$export$e618dc39ac9ad607)($b847b7cd294eafba$var$fill({
|
|
231
233
|
...props,
|
|
232
|
-
|
|
234
|
+
isStaticColor: isStaticColor
|
|
233
235
|
}), isIndeterminate ? $b847b7cd294eafba$var$indeterminateAnimation({
|
|
234
236
|
direction: direction
|
|
235
237
|
}) : null),
|
package/dist/ProgressBar.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA+CM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAA+D;AAE7G,MAAM;AASN,MAAM;AASN,MAAM
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AA+CM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAA+D;AAE7G,MAAM;AASN,MAAM;AASN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaN,MAAM;;;;;;;;;;;;;;;;;;;;AAiBN,MAAM;;;;;;;;;;;AAkBC,MAAM,4CAAc,WAAW,GAAG,CAAA,GAAA,iBAAS,EAAE,SAAS,YAAY,KAAuB,EAAE,GAA2B;IAC3H,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,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,gBAAgB,CAAC,CAAC;IAEtB,qBACE,gBAAC,CAAA,GAAA,kBAAc;QACZ,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,mBAAmB,8BAAQ;YAAC,GAAG,KAAK;kBAAE;2BAAM;yBAAe;QAAW,GAAG,MAAM,MAAM;kBAC/F,CAAC,cAAC,UAAU,aAAE,SAAS,EAAC,iBACvB;;oBACG,uBAAS,gBAAC,CAAA,GAAA,yCAAS;wBAAE,MAAM;wBAAM,YAAW;wBAAQ,eAAe;wBAAe,aAAa;kCAAc;;oBAC7G,SAAS,CAAC,iCAAmB,gBAAC;wBAAK,WAAW,kCAAY;kCAAC;4BAAM,YAAY;2CAAO;wBAAa;kCAAK;;kCACvG,gBAAC;wBAAI,WAAW,kCAAY;2CAAC;kCAAe;wBAAI;kCAC9C,cAAA,gBAAC;4BACC,WAAW,CAAA,GAAA,yCAAU,EAAE,2BAAK;gCAAC,GAAG,KAAK;+CAAE;4BAAa,IAAK,kBAAkB,6CAAuB;2CAAC;4BAAS,KAAK;4BACjH,OAAO;gCAAC,OAAO,kBAAkB,YAAY,aAAa;4BAAG;;;;;;AAM3E","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 {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useLocale} from '@react-aria/i18n';\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' | 'auto',\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\nconst indeterminateLTR = keyframes(`\n 0% {\n transform: translateX(-70%) scaleX(0.7);\n }\n 100% {\n transform: translateX(100%) scaleX(0.7);\n }\n`);\n\nconst indeterminateRTL = keyframes(`\n 0% {\n transform: translateX(100%) scaleX(0.7);\n }\n 100% {\n transform: translateX(-70%) scaleX(0.7);\n }\n`);\n\nconst wrapper = style({\n ...bar(),\n gridTemplateColumns: {\n default: {\n labelPosition: {\n top: ['1fr', 'auto'],\n side: ['auto', '1fr']\n }\n },\n isIndeterminate: {\n labelPosition: {\n top: ['1fr'],\n side: ['auto', '1fr']\n }\n }\n },\n gridTemplateAreas: {\n default: {\n labelPosition: {\n top: [\n 'label value',\n 'bar bar'\n ],\n side: [\n 'label bar value'\n ]\n }\n },\n isIndeterminate: {\n labelPosition: {\n top: [\n 'label',\n 'bar'\n ],\n side: [\n 'label bar'\n ]\n }\n }\n }\n}, getAllowedOverrides());\n\nconst valueStyles = style({\n ...fieldLabel(),\n gridArea: 'value'\n});\n\nconst trackStyles = style({\n ...track(),\n height: {\n default: 6,\n size: {\n S: 4, // progress-bar-thickness-small\n M: 6, // progress-bar-thickness-medium\n L: 8, // progress-bar-thickness-large\n XL: 10 // progress-bar-thickness-extra-large\n }\n }\n});\n\nconst fill = style<ProgressBarStyleProps & {isStaticColor: boolean}>({\n height: 'full',\n borderStyle: 'none',\n borderRadius: 'full',\n backgroundColor: {\n default: 'accent',\n isStaticColor: 'transparent-overlay-900',\n forcedColors: 'ButtonText'\n },\n width: {\n isIndeterminate: 'full'\n },\n transformOrigin: {\n isIndeterminate: 'left'\n }\n});\n\nconst indeterminateAnimation = style({\n animation: {\n direction: {\n ltr: indeterminateLTR,\n rtl: indeterminateRTL\n }\n },\n animationDuration: 1000,\n animationIterationCount: 'infinite',\n animationTimingFunction: 'in-out',\n willChange: 'transform',\n position: 'relative'\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 */\nexport const ProgressBar = /*#__PURE__*/ forwardRef(function 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 let {direction} = useLocale();\n let isStaticColor = !!staticColor;\n\n return (\n <AriaProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={UNSAFE_className + wrapper({...props, size, labelPosition, staticColor}, props.styles)}>\n {({percentage, valueText}) => (\n <>\n {label && <FieldLabel size={size} labelAlign=\"start\" labelPosition={labelPosition} staticColor={staticColor}>{label}</FieldLabel>}\n {label && !isIndeterminate && <span className={valueStyles({size, labelAlign: 'end', isStaticColor})}>{valueText}</span>}\n <div className={trackStyles({isStaticColor, size})}>\n <div\n className={mergeStyles(fill({...props, isStaticColor}), (isIndeterminate ? indeterminateAnimation({direction}) : null))}\n style={{width: isIndeterminate ? undefined : percentage + '%'}} />\n </div>\n </>\n )}\n </AriaProgressBar>\n );\n});\n\n"],"names":[],"version":3,"file":"ProgressBar.mjs.map"}
|
package/dist/ProgressCircle.cjs
CHANGED
|
@@ -39,6 +39,8 @@ const $1c116ea4b0d2d023$var$wrapper = function anonymous(props, overrides) {
|
|
|
39
39
|
if (/^\s*l/.test(p)) $l = true;
|
|
40
40
|
if (/^\s*k/.test(p)) $k = true;
|
|
41
41
|
}
|
|
42
|
+
if (props.staticColor === "white") rules += ' -_1de2x0q_b-b';
|
|
43
|
+
else if (props.staticColor === "black") rules += ' -_1de2x0q_b-c';
|
|
42
44
|
if (!$l) {
|
|
43
45
|
if (props.size === "L") rules += ' l_q';
|
|
44
46
|
else if (props.size === "S") rules += ' lE';
|
|
@@ -54,17 +56,15 @@ const $1c116ea4b0d2d023$var$wrapper = function anonymous(props, overrides) {
|
|
|
54
56
|
};
|
|
55
57
|
const $1c116ea4b0d2d023$var$track = function anonymous(props) {
|
|
56
58
|
let rules = " .";
|
|
57
|
-
rules += '
|
|
58
|
-
if (props.
|
|
59
|
-
else if (props.staticColor === "white") rules += ' f_____b';
|
|
59
|
+
rules += ' fa_____J';
|
|
60
|
+
if (props.isStaticColor) rules += ' f_____B';
|
|
60
61
|
else rules += ' fk';
|
|
61
62
|
return rules;
|
|
62
63
|
};
|
|
63
64
|
const $1c116ea4b0d2d023$var$fill = function anonymous(props) {
|
|
64
65
|
let rules = " .";
|
|
65
|
-
rules += '
|
|
66
|
-
if (props.
|
|
67
|
-
else if (props.staticColor === "white") rules += ' f_____h';
|
|
66
|
+
rules += ' fa_____O';
|
|
67
|
+
if (props.isStaticColor) rules += ' f_____H';
|
|
68
68
|
else rules += ' fA';
|
|
69
69
|
rules += ' R-375ty3';
|
|
70
70
|
rules += ' __Ga';
|
|
@@ -82,13 +82,15 @@ const $1c116ea4b0d2d023$export$c79b9d6b4cc92af7 = /*#__PURE__*/ (0, $5RNes$react
|
|
|
82
82
|
else if (size === 'L') strokeWidth = 4;
|
|
83
83
|
// SVG strokes are centered, so subtract half the stroke width from the radius to create an inner stroke.
|
|
84
84
|
let radius = `calc(50% - ${strokeWidth / 2}px)`;
|
|
85
|
+
let isStaticColor = !!staticColor;
|
|
85
86
|
return /*#__PURE__*/ (0, $5RNes$reactjsxruntime.jsx)((0, $5RNes$reactariacomponents.ProgressBar), {
|
|
86
87
|
...props,
|
|
87
88
|
ref: domRef,
|
|
88
89
|
style: UNSAFE_style,
|
|
89
90
|
className: (renderProps)=>UNSAFE_className + $1c116ea4b0d2d023$var$wrapper({
|
|
90
91
|
...renderProps,
|
|
91
|
-
size: size
|
|
92
|
+
size: size,
|
|
93
|
+
staticColor: staticColor
|
|
92
94
|
}, props.styles),
|
|
93
95
|
children: ({ percentage: percentage, isIndeterminate: isIndeterminate })=>/*#__PURE__*/ (0, $5RNes$reactjsxruntime.jsxs)("svg", {
|
|
94
96
|
fill: "none",
|
|
@@ -101,7 +103,7 @@ const $1c116ea4b0d2d023$export$c79b9d6b4cc92af7 = /*#__PURE__*/ (0, $5RNes$react
|
|
|
101
103
|
r: radius,
|
|
102
104
|
strokeWidth: strokeWidth,
|
|
103
105
|
className: $1c116ea4b0d2d023$var$track({
|
|
104
|
-
|
|
106
|
+
isStaticColor: isStaticColor
|
|
105
107
|
})
|
|
106
108
|
}),
|
|
107
109
|
/*#__PURE__*/ (0, $5RNes$reactjsxruntime.jsx)("circle", {
|
|
@@ -110,7 +112,7 @@ const $1c116ea4b0d2d023$export$c79b9d6b4cc92af7 = /*#__PURE__*/ (0, $5RNes$react
|
|
|
110
112
|
r: radius,
|
|
111
113
|
strokeWidth: strokeWidth,
|
|
112
114
|
className: $1c116ea4b0d2d023$var$fill({
|
|
113
|
-
|
|
115
|
+
isStaticColor: isStaticColor
|
|
114
116
|
}),
|
|
115
117
|
style: {
|
|
116
118
|
// These cubic-bezier timing functions were derived from the previous animation keyframes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,0DAAwB,CAAA,GAAA,0BAAY,EAAkE;AAEnH,yEAAyE;AACzE,MAAM
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AA0BM,MAAM,0DAAwB,CAAA,GAAA,0BAAY,EAAkE;AAEnH,yEAAyE;AACzE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;AAYN,MAAM;;;;;;;AAQN,MAAM;;;;;;;;;AAeN,MAAM;AAUN,iFAAiF;AACjF,MAAM;AAcC,MAAM,4CAAiB,WAAW,GAAG,CAAA,GAAA,uBAAS,EAAE,SAAS,eAAe,KAA0B,EAAE,GAA2B;IACpI,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,iDAAsB,EAAE,OAAO,KAAK;IACnD,IAAI,QACF,OAAO,kBACP,WAAW,gBACX,YAAY,oBACZ,mBAAmB,IACpB,GAAG;IACJ,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IAEvB,IAAI,cAAc;IAClB,IAAI,SAAS,KACX,cAAc;SACT,IAAI,SAAS,KAClB,cAAc;IAGhB,yGAAyG;IACzG,IAAI,SAAS,CAAC,WAAW,EAAE,cAAc,EAAE,GAAG,CAAC;IAC/C,IAAI,gBAAgB,CAAC,CAAC;IAEtB,qBACE,gCAAC,CAAA,GAAA,sCAAa;QACX,GAAG,KAAK;QACT,KAAK;QACL,OAAO;QACP,WAAW,CAAA,cAAe,mBAAmB,8BAAQ;gBACnD,GAAG,WAAW;sBACd;6BACA;YACF,GAAG,MAAM,MAAM;kBACd,CAAC,cAAC,UAAU,mBAAE,eAAe,EAAC,iBAC7B,iCAAC;gBACC,MAAK;gBACL,OAAM;gBACN,QAAO;;kCACP,gCAAC;wBACC,IAAG;wBACH,IAAG;wBACH,GAAG;wBACH,aAAa;wBACb,WAAW,4BAAM;2CAAC;wBAAa;;kCACjC,gCAAC;wBACC,IAAG;wBACH,IAAG;wBACH,GAAG;wBACH,aAAa;wBACb,WAAW,2BAAK;2CAAC;wBAAa;wBAC9B,OAAO;4BACL,yFAAyF;4BACzF,gGAAgG;4BAChG,WAAW,kBAAkB,GAAG,wCAAkB,2CAA2C,EAAE,0CAAoB,4CAA4C,CAAC,GAAG;wBACrK;wBACA,2FAA2F;wBAC3F,YAAW;wBACX,sDAAsD;wBACtD,iBAAgB;wBAChB,kBAAkB,mBAAmB,cAAc,OAAO,YAAY,MAAM;wBAC5E,eAAc;;;;;AAK1B","sources":["packages/@react-spectrum/s2/src/ProgressCircle.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 {ContextValue, ProgressBar as RACProgressBar, ProgressBarProps as RACProgressBarProps} from 'react-aria-components';\nimport {createContext, forwardRef} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {getAllowedOverrides, staticColor, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ProgressCircleStyleProps {\n /**\n * The size of the ProgressCircle.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'black' | 'white' | 'auto',\n /**\n * Whether presentation is indeterminate when progress isn't known.\n */\n isIndeterminate?: boolean\n}\n\nexport const ProgressCircleContext = createContext<ContextValue<ProgressCircleProps, DOMRefValue<HTMLDivElement>>>(null);\n\n// Double check the types passed to each style, may not need all for each\nconst wrapper = style<ProgressCircleStyleProps>({\n ...staticColor(),\n size: {\n default: 32,\n size: {\n S: 16,\n L: 64\n }\n },\n aspectRatio: 'square'\n}, getAllowedOverrides({height: true}));\n\nconst track = style({\n stroke: {\n default: 'gray-300',\n isStaticColor: 'transparent-overlay-300',\n forcedColors: 'Background'\n }\n});\n\nconst fill = style({\n stroke: {\n default: 'blue-900',\n isStaticColor: 'transparent-overlay-900',\n forcedColors: 'Highlight'\n },\n rotate: -90,\n transformOrigin: 'center'\n});\n\nexport interface ProgressCircleProps extends Omit<RACProgressBarProps, 'children' | 'style' | 'valueLabel' | 'formatOptions' | 'label' | 'className'>, ProgressCircleStyleProps, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nconst rotationAnimation = keyframes(`\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n`);\n\n// stroke-dashoffset represents `100 - percentage`. See below for how this works.\nconst dashoffsetAnimation = keyframes(`\n 0%, 100% {\n stroke-dashoffset: 75;\n }\n\n 30% {\n stroke-dashoffset: 20;\n }\n`);\n\n/**\n * ProgressCircles show the progression of a system operation such as downloading, uploading, or processing, in a visual way.\n * They can represent determinate or indeterminate progress.\n */\nexport const ProgressCircle = /*#__PURE__*/ forwardRef(function ProgressCircle(props: ProgressCircleProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ProgressCircleContext);\n let {\n size = 'M',\n staticColor,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let strokeWidth = 3;\n if (size === 'S') {\n strokeWidth = 2;\n } else if (size === 'L') {\n strokeWidth = 4;\n }\n\n // SVG strokes are centered, so subtract half the stroke width from the radius to create an inner stroke.\n let radius = `calc(50% - ${strokeWidth / 2}px)`;\n let isStaticColor = !!staticColor;\n\n return (\n <RACProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + wrapper({\n ...renderProps,\n size,\n staticColor\n }, props.styles)}>\n {({percentage, isIndeterminate}) => (\n <svg\n fill=\"none\"\n width=\"100%\"\n height=\"100%\">\n <circle\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n strokeWidth={strokeWidth}\n className={track({isStaticColor})} />\n <circle\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n strokeWidth={strokeWidth}\n className={fill({isStaticColor})}\n style={{\n // These cubic-bezier timing functions were derived from the previous animation keyframes\n // using a best fit algorithm, and then manually adjusted to approximate the original animation.\n animation: isIndeterminate ? `${rotationAnimation} 1s cubic-bezier(.6, .1, .3, .9) infinite, ${dashoffsetAnimation} 1s cubic-bezier(.25, .1, .25, 1.3) infinite` : undefined\n }}\n // Normalize the path length to 100 so we can easily set stroke-dashoffset to a percentage.\n pathLength=\"100\"\n // Add extra gap between dashes so 0% works in Chrome.\n strokeDasharray=\"100 200\"\n strokeDashoffset={isIndeterminate || percentage == null ? undefined : 100 - percentage}\n strokeLinecap=\"round\" />\n </svg>\n )}\n </RACProgressBar>\n );\n});\n"],"names":[],"version":3,"file":"ProgressCircle.cjs.map"}
|
package/dist/ProgressCircle.css
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
@layer _.a {
|
|
2
|
+
.-_1de2x0q_b-c {
|
|
3
|
+
--s2-container-bg: white;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.-_1de2x0q_b-b {
|
|
7
|
+
--s2-container-bg: black;
|
|
8
|
+
}
|
|
9
|
+
|
|
2
10
|
.lU {
|
|
3
11
|
width: calc(2rem * var(--s2-scale));
|
|
4
12
|
}
|
|
@@ -31,24 +39,16 @@
|
|
|
31
39
|
stroke: var(--lightningcss-light, #dadada) var(--lightningcss-dark, #393939);
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
.
|
|
35
|
-
stroke:
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.f_____o {
|
|
39
|
-
stroke: #00000026;
|
|
42
|
+
.f_____B {
|
|
43
|
+
stroke: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .17);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
.fA {
|
|
43
47
|
stroke: var(--lightningcss-light, #3b63fb) var(--lightningcss-dark, #5681ff);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
.
|
|
47
|
-
stroke:
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.f_____u {
|
|
51
|
-
stroke: #000000ed;
|
|
50
|
+
.f_____H {
|
|
51
|
+
stroke: lch(from var(--s2-container-bg) calc((49.44 - l) * infinity) 0 0 / .94);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
.R-375ty3 {
|
|
@@ -64,11 +64,11 @@
|
|
|
64
64
|
|
|
65
65
|
@layer _.b.a {
|
|
66
66
|
@media (forced-colors: active) {
|
|
67
|
-
.
|
|
67
|
+
.fa_____J {
|
|
68
68
|
stroke: background;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
.
|
|
71
|
+
.fa_____O {
|
|
72
72
|
stroke: highlight;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"ACuCgB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;
|
|
1
|
+
{"mappings":"ACuCgB;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAAA;;;;EAYF;;;;EAAA;;;;EAQD;;;;EAAA;;;;EAAA;;;;EAAA;;;;;AApBG;;AAYF;EAAA;IAAA;;;;IAQD;;;;;;AAAA;;;;AAea;;;;;;;;;;AAWE","sources":["899fc8f7586d17bf","packages/@react-spectrum/s2/src/ProgressCircle.tsx"],"sourcesContent":["@import \"766ebfa3e9b99037\";\n@import \"cdcaa7bc1c97d336\";\n@import \"788ab0411a865673\";\n@import \"73f154e47fb53c5b\";\n@import \"6c6d672d6676880a\";\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 {ContextValue, ProgressBar as RACProgressBar, ProgressBarProps as RACProgressBarProps} from 'react-aria-components';\nimport {createContext, forwardRef} from 'react';\nimport {DOMRef, DOMRefValue} from '@react-types/shared';\nimport {getAllowedOverrides, staticColor, StylesPropWithHeight, UnsafeStyles} from './style-utils' with {type: 'macro'};\nimport {keyframes} from '../style/style-macro' with {type: 'macro'};\nimport {style} from '../style' with {type: 'macro'};\nimport {useDOMRef} from '@react-spectrum/utils';\nimport {useSpectrumContextProps} from './useSpectrumContextProps';\n\nexport interface ProgressCircleStyleProps {\n /**\n * The size of the ProgressCircle.\n *\n * @default 'M'\n */\n size?: 'S' | 'M' | 'L',\n /** The static color style to apply. Useful when the button appears over a color background. */\n staticColor?: 'black' | 'white' | 'auto',\n /**\n * Whether presentation is indeterminate when progress isn't known.\n */\n isIndeterminate?: boolean\n}\n\nexport const ProgressCircleContext = createContext<ContextValue<ProgressCircleProps, DOMRefValue<HTMLDivElement>>>(null);\n\n// Double check the types passed to each style, may not need all for each\nconst wrapper = style<ProgressCircleStyleProps>({\n ...staticColor(),\n size: {\n default: 32,\n size: {\n S: 16,\n L: 64\n }\n },\n aspectRatio: 'square'\n}, getAllowedOverrides({height: true}));\n\nconst track = style({\n stroke: {\n default: 'gray-300',\n isStaticColor: 'transparent-overlay-300',\n forcedColors: 'Background'\n }\n});\n\nconst fill = style({\n stroke: {\n default: 'blue-900',\n isStaticColor: 'transparent-overlay-900',\n forcedColors: 'Highlight'\n },\n rotate: -90,\n transformOrigin: 'center'\n});\n\nexport interface ProgressCircleProps extends Omit<RACProgressBarProps, 'children' | 'style' | 'valueLabel' | 'formatOptions' | 'label' | 'className'>, ProgressCircleStyleProps, UnsafeStyles {\n /** Spectrum-defined styles, returned by the `style()` macro. */\n styles?: StylesPropWithHeight\n}\n\nconst rotationAnimation = keyframes(`\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n`);\n\n// stroke-dashoffset represents `100 - percentage`. See below for how this works.\nconst dashoffsetAnimation = keyframes(`\n 0%, 100% {\n stroke-dashoffset: 75;\n }\n\n 30% {\n stroke-dashoffset: 20;\n }\n`);\n\n/**\n * ProgressCircles show the progression of a system operation such as downloading, uploading, or processing, in a visual way.\n * They can represent determinate or indeterminate progress.\n */\nexport const ProgressCircle = /*#__PURE__*/ forwardRef(function ProgressCircle(props: ProgressCircleProps, ref: DOMRef<HTMLDivElement>) {\n [props, ref] = useSpectrumContextProps(props, ref, ProgressCircleContext);\n let {\n size = 'M',\n staticColor,\n UNSAFE_style,\n UNSAFE_className = ''\n } = props;\n let domRef = useDOMRef(ref);\n\n let strokeWidth = 3;\n if (size === 'S') {\n strokeWidth = 2;\n } else if (size === 'L') {\n strokeWidth = 4;\n }\n\n // SVG strokes are centered, so subtract half the stroke width from the radius to create an inner stroke.\n let radius = `calc(50% - ${strokeWidth / 2}px)`;\n let isStaticColor = !!staticColor;\n\n return (\n <RACProgressBar\n {...props}\n ref={domRef}\n style={UNSAFE_style}\n className={renderProps => UNSAFE_className + wrapper({\n ...renderProps,\n size,\n staticColor\n }, props.styles)}>\n {({percentage, isIndeterminate}) => (\n <svg\n fill=\"none\"\n width=\"100%\"\n height=\"100%\">\n <circle\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n strokeWidth={strokeWidth}\n className={track({isStaticColor})} />\n <circle\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n strokeWidth={strokeWidth}\n className={fill({isStaticColor})}\n style={{\n // These cubic-bezier timing functions were derived from the previous animation keyframes\n // using a best fit algorithm, and then manually adjusted to approximate the original animation.\n animation: isIndeterminate ? `${rotationAnimation} 1s cubic-bezier(.6, .1, .3, .9) infinite, ${dashoffsetAnimation} 1s cubic-bezier(.25, .1, .25, 1.3) infinite` : undefined\n }}\n // Normalize the path length to 100 so we can easily set stroke-dashoffset to a percentage.\n pathLength=\"100\"\n // Add extra gap between dashes so 0% works in Chrome.\n strokeDasharray=\"100 200\"\n strokeDashoffset={isIndeterminate || percentage == null ? undefined : 100 - percentage}\n strokeLinecap=\"round\" />\n </svg>\n )}\n </RACProgressBar>\n );\n});\n"],"names":[],"version":3,"file":"ProgressCircle.css.map"}
|