@yamada-ui/progress 1.1.4-dev-20241005224505 → 1.1.4-dev-20241006032009
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/{chunk-KPKODACS.mjs → chunk-QOIOQFER.mjs} +29 -29
- package/dist/chunk-QOIOQFER.mjs.map +1 -0
- package/dist/{chunk-ALBGJOCS.mjs → chunk-UD3A4RXP.mjs} +26 -26
- package/dist/chunk-UD3A4RXP.mjs.map +1 -0
- package/dist/circle-progress.d.mts +30 -30
- package/dist/circle-progress.d.ts +30 -30
- package/dist/circle-progress.js +22 -22
- package/dist/circle-progress.js.map +1 -1
- package/dist/circle-progress.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +151 -151
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/progress.d.mts +21 -21
- package/dist/progress.d.ts +21 -21
- package/dist/progress.js +25 -25
- package/dist/progress.js.map +1 -1
- package/dist/progress.mjs +1 -1
- package/package.json +6 -6
- package/dist/chunk-ALBGJOCS.mjs.map +0 -1
- package/dist/chunk-KPKODACS.mjs.map +0 -1
package/dist/progress.d.ts
CHANGED
@@ -3,29 +3,21 @@ import { HTMLUIProps, ThemeProps, ColorModeToken, CSS } from '@yamada-ui/core';
|
|
3
3
|
|
4
4
|
interface ProgressOptions {
|
5
5
|
/**
|
6
|
-
* The
|
7
|
-
*
|
8
|
-
* @default 0
|
9
|
-
*/
|
10
|
-
value?: number;
|
11
|
-
/**
|
12
|
-
* The minimum value of the progress.
|
13
|
-
*
|
14
|
-
* @default 0
|
6
|
+
* The CSS `color` property.
|
15
7
|
*/
|
16
|
-
|
8
|
+
filledTrackColor?: ColorModeToken<CSS.Property.Color, "colors">;
|
17
9
|
/**
|
18
|
-
*
|
10
|
+
* If `true`, the progress bar will show stripe.
|
19
11
|
*
|
20
|
-
* @default
|
12
|
+
* @default false
|
21
13
|
*/
|
22
|
-
|
14
|
+
hasStripe?: boolean;
|
23
15
|
/**
|
24
|
-
* If `true`, the progress
|
16
|
+
* If `true`, the progress will be indeterminate and the `value` prop will be ignored.
|
25
17
|
*
|
26
18
|
* @default false
|
27
19
|
*/
|
28
|
-
|
20
|
+
isAnimation?: boolean;
|
29
21
|
/**
|
30
22
|
* If `true`, and hasStripe is `true`, the stripes will be animated.
|
31
23
|
*
|
@@ -33,21 +25,29 @@ interface ProgressOptions {
|
|
33
25
|
*/
|
34
26
|
isStripeAnimation?: boolean;
|
35
27
|
/**
|
36
|
-
*
|
28
|
+
* The maximum value of the progress.
|
37
29
|
*
|
38
|
-
* @default
|
30
|
+
* @default 100
|
39
31
|
*/
|
40
|
-
|
32
|
+
max?: number;
|
33
|
+
/**
|
34
|
+
* The minimum value of the progress.
|
35
|
+
*
|
36
|
+
* @default 0
|
37
|
+
*/
|
38
|
+
min?: number;
|
41
39
|
/**
|
42
40
|
* The animation speed in seconds.
|
43
41
|
*
|
44
42
|
* @default '1.4s'
|
45
43
|
*/
|
46
|
-
speed?:
|
44
|
+
speed?: number | string;
|
47
45
|
/**
|
48
|
-
* The
|
46
|
+
* The value of the progress.
|
47
|
+
*
|
48
|
+
* @default 0
|
49
49
|
*/
|
50
|
-
|
50
|
+
value?: number;
|
51
51
|
}
|
52
52
|
interface ProgressProps extends HTMLUIProps, ThemeProps<"Progress">, ProgressOptions {
|
53
53
|
}
|
package/dist/progress.js
CHANGED
@@ -37,23 +37,23 @@ var Progress = (0, import_core.forwardRef)((props, ref) => {
|
|
37
37
|
const [styles, mergedProps] = (0, import_core.useComponentMultiStyle)("Progress", props);
|
38
38
|
const {
|
39
39
|
className,
|
40
|
+
borderRadius: _borderRadius,
|
40
41
|
children,
|
41
|
-
value,
|
42
|
-
min,
|
43
|
-
max,
|
44
42
|
hasStripe,
|
45
|
-
isStripeAnimation,
|
46
43
|
isAnimation,
|
47
|
-
|
48
|
-
|
44
|
+
isStripeAnimation,
|
45
|
+
max,
|
46
|
+
min,
|
49
47
|
rounded,
|
48
|
+
speed,
|
49
|
+
value,
|
50
50
|
...rest
|
51
51
|
} = (0, import_core.omitThemeProps)(mergedProps, ["filledTrackColor"]);
|
52
52
|
const borderRadius = (_b = _borderRadius != null ? _borderRadius : rounded) != null ? _b : (_a = styles.track) == null ? void 0 : _a.borderRadius;
|
53
53
|
const css = {
|
54
|
-
w: "100%",
|
55
54
|
overflow: "hidden",
|
56
55
|
pos: "relative",
|
56
|
+
w: "100%",
|
57
57
|
...styles.track
|
58
58
|
};
|
59
59
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
@@ -61,21 +61,21 @@ var Progress = (0, import_core.forwardRef)((props, ref) => {
|
|
61
61
|
{
|
62
62
|
ref,
|
63
63
|
className: (0, import_utils.cx)("ui-progress", className),
|
64
|
-
__css: css,
|
65
64
|
borderRadius,
|
65
|
+
__css: css,
|
66
66
|
...rest,
|
67
67
|
children: [
|
68
68
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
69
69
|
ProgressFilledTrack,
|
70
70
|
{
|
71
|
-
|
72
|
-
max,
|
73
|
-
value,
|
71
|
+
borderRadius,
|
74
72
|
hasStripe,
|
75
|
-
isStripeAnimation,
|
76
73
|
isAnimation,
|
74
|
+
isStripeAnimation,
|
75
|
+
max,
|
76
|
+
min,
|
77
77
|
speed,
|
78
|
-
|
78
|
+
value
|
79
79
|
}
|
80
80
|
),
|
81
81
|
children
|
@@ -86,33 +86,33 @@ var Progress = (0, import_core.forwardRef)((props, ref) => {
|
|
86
86
|
Progress.displayName = "Progress";
|
87
87
|
Progress.__ui__ = "Progress";
|
88
88
|
var ProgressFilledTrack = ({
|
89
|
-
value = 0,
|
90
|
-
min = 0,
|
91
|
-
max = 100,
|
92
89
|
hasStripe,
|
93
|
-
isStripeAnimation,
|
94
90
|
isAnimation,
|
91
|
+
isStripeAnimation,
|
92
|
+
max = 100,
|
93
|
+
min = 0,
|
95
94
|
speed = "1.4s",
|
95
|
+
value = 0,
|
96
96
|
...rest
|
97
97
|
}) => {
|
98
98
|
const percent = (0, import_utils.valueToPercent)(value, min, max);
|
99
99
|
const styles = useProgress();
|
100
100
|
const stripeAnimation = (0, import_use_animation.useAnimation)({
|
101
|
+
duration: typeof speed === "string" ? speed : `${speed}s`,
|
102
|
+
iterationCount: "infinite",
|
101
103
|
keyframes: {
|
102
104
|
"0%": { bgPosition: "1rem 0" },
|
103
105
|
"100%": { bgPosition: "0 0" }
|
104
106
|
},
|
105
|
-
duration: typeof speed === "string" ? speed : `${speed}s`,
|
106
|
-
iterationCount: "infinite",
|
107
107
|
timingFunction: "linear"
|
108
108
|
});
|
109
109
|
const interpolationAnimation = (0, import_use_animation.useAnimation)({
|
110
|
+
duration: typeof speed === "string" ? speed : `${speed}s`,
|
111
|
+
iterationCount: "infinite",
|
110
112
|
keyframes: {
|
111
113
|
"0%": { left: "-40%" },
|
112
114
|
"100%": { left: "100%" }
|
113
115
|
},
|
114
|
-
duration: typeof speed === "string" ? speed : `${speed}s`,
|
115
|
-
iterationCount: "infinite",
|
116
116
|
timingFunction: "ease"
|
117
117
|
});
|
118
118
|
isStripeAnimation = !isAnimation && hasStripe && isStripeAnimation;
|
@@ -121,15 +121,15 @@ var ProgressFilledTrack = ({
|
|
121
121
|
animation: stripeAnimation
|
122
122
|
} : {},
|
123
123
|
...isAnimation ? {
|
124
|
-
|
125
|
-
willChange: "left",
|
124
|
+
animation: interpolationAnimation,
|
126
125
|
minWidth: "50%",
|
127
|
-
|
126
|
+
position: "absolute",
|
127
|
+
willChange: "left"
|
128
128
|
} : {}
|
129
129
|
};
|
130
130
|
const __css = {
|
131
|
-
w: `${percent}%`,
|
132
131
|
h: "100%",
|
132
|
+
w: `${percent}%`,
|
133
133
|
...styles.filledTrack
|
134
134
|
};
|
135
135
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.div, { css, __css, ...rest });
|
package/dist/progress.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/progress.tsx"],"sourcesContent":["import type {\n
|
1
|
+
{"version":3,"sources":["../src/progress.tsx"],"sourcesContent":["import type {\n ColorModeToken,\n CSS,\n CSSUIObject,\n FC,\n HTMLUIProps,\n Interpolation,\n ThemeProps,\n} from \"@yamada-ui/core\"\nimport {\n forwardRef,\n omitThemeProps,\n ui,\n useComponentMultiStyle,\n} from \"@yamada-ui/core\"\nimport { useAnimation } from \"@yamada-ui/use-animation\"\nimport { createContext, cx, valueToPercent } from \"@yamada-ui/utils\"\n\nconst [ProgressProvider, useProgress] = createContext<{\n [key: string]: CSSUIObject | undefined\n}>({\n name: `ProgressStylesContext`,\n errorMessage: `useProgress returned is 'undefined'. Seems you forgot to wrap the components in \"<Progress />\" `,\n})\n\ninterface ProgressOptions {\n /**\n * The CSS `color` property.\n */\n filledTrackColor?: ColorModeToken<CSS.Property.Color, \"colors\">\n /**\n * If `true`, the progress bar will show stripe.\n *\n * @default false\n */\n hasStripe?: boolean\n /**\n * If `true`, the progress will be indeterminate and the `value` prop will be ignored.\n *\n * @default false\n */\n isAnimation?: boolean\n /**\n * If `true`, and hasStripe is `true`, the stripes will be animated.\n *\n * @default false\n */\n isStripeAnimation?: boolean\n /**\n * The maximum value of the progress.\n *\n * @default 100\n */\n max?: number\n /**\n * The minimum value of the progress.\n *\n * @default 0\n */\n min?: number\n /**\n * The animation speed in seconds.\n *\n * @default '1.4s'\n */\n speed?: number | string\n /**\n * The value of the progress.\n *\n * @default 0\n */\n value?: number\n}\n\nexport interface ProgressProps\n extends HTMLUIProps,\n ThemeProps<\"Progress\">,\n ProgressOptions {}\n\n/**\n * `Progress` is a component for visually indicating progress.\n *\n * @see Docs https://yamada-ui.com/components/feedback/progress\n */\nexport const Progress = forwardRef<ProgressProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Progress\", props)\n const {\n className,\n borderRadius: _borderRadius,\n children,\n hasStripe,\n isAnimation,\n isStripeAnimation,\n max,\n min,\n rounded,\n speed,\n value,\n ...rest\n } = omitThemeProps(mergedProps, [\"filledTrackColor\"])\n\n const borderRadius =\n _borderRadius ?? rounded ?? (styles.track?.borderRadius as number | string)\n\n const css: CSSUIObject = {\n overflow: \"hidden\",\n pos: \"relative\",\n w: \"100%\",\n ...styles.track,\n }\n\n return (\n <ProgressProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-progress\", className)}\n borderRadius={borderRadius}\n __css={css}\n {...rest}\n >\n <ProgressFilledTrack\n borderRadius={borderRadius}\n hasStripe={hasStripe}\n isAnimation={isAnimation}\n isStripeAnimation={isStripeAnimation}\n max={max}\n min={min}\n speed={speed}\n value={value}\n />\n {children}\n </ui.div>\n </ProgressProvider>\n )\n})\n\nProgress.displayName = \"Progress\"\nProgress.__ui__ = \"Progress\"\n\ninterface ProgressFilledTrackProps extends HTMLUIProps, ProgressProps {}\n\nconst ProgressFilledTrack: FC<ProgressFilledTrackProps> = ({\n hasStripe,\n isAnimation,\n isStripeAnimation,\n max = 100,\n min = 0,\n speed = \"1.4s\",\n value = 0,\n ...rest\n}) => {\n const percent = valueToPercent(value, min, max)\n\n const styles = useProgress()\n\n const stripeAnimation = useAnimation({\n duration: typeof speed === \"string\" ? speed : `${speed}s`,\n iterationCount: \"infinite\",\n keyframes: {\n \"0%\": { bgPosition: \"1rem 0\" },\n \"100%\": { bgPosition: \"0 0\" },\n },\n timingFunction: \"linear\",\n })\n\n const interpolationAnimation = useAnimation({\n duration: typeof speed === \"string\" ? speed : `${speed}s`,\n iterationCount: \"infinite\",\n keyframes: {\n \"0%\": { left: \"-40%\" },\n \"100%\": { left: \"100%\" },\n },\n timingFunction: \"ease\",\n })\n\n isStripeAnimation = !isAnimation && hasStripe && isStripeAnimation\n\n const css: Interpolation<{}> = {\n ...(isStripeAnimation\n ? {\n animation: stripeAnimation,\n }\n : {}),\n ...(isAnimation\n ? {\n animation: interpolationAnimation,\n minWidth: \"50%\",\n position: \"absolute\",\n willChange: \"left\",\n }\n : {}),\n }\n\n const __css: CSSUIObject = {\n h: \"100%\",\n w: `${percent}%`,\n ...styles.filledTrack,\n }\n\n return <ui.div css={css} __css={__css} {...rest} />\n}\n\nProgressFilledTrack.displayName = \"ProgressFilledTrack\"\nProgressFilledTrack.__ui__ = \"ProgressFilledTrack\"\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,kBAKO;AACP,2BAA6B;AAC7B,mBAAkD;AAiG5C;AA/FN,IAAM,CAAC,kBAAkB,WAAW,QAAI,4BAErC;AAAA,EACD,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA6DM,IAAM,eAAW,wBAAiC,CAAC,OAAO,QAAQ;AApFzE;AAqFE,QAAM,CAAC,QAAQ,WAAW,QAAI,oCAAuB,YAAY,KAAK;AACtE,QAAM;AAAA,IACJ;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,QAAI,4BAAe,aAAa,CAAC,kBAAkB,CAAC;AAEpD,QAAM,gBACJ,6CAAiB,YAAjB,aAA6B,YAAO,UAAP,mBAAc;AAE7C,QAAM,MAAmB;AAAA,IACvB,UAAU;AAAA,IACV,KAAK;AAAA,IACL,GAAG;AAAA,IACH,GAAG,OAAO;AAAA,EACZ;AAEA,SACE,4CAAC,oBAAiB,OAAO,QACvB;AAAA,IAAC,eAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,iBAAG,eAAe,SAAS;AAAA,MACtC;AAAA,MACA,OAAO;AAAA,MACN,GAAG;AAAA,MAEJ;AAAA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF;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ClC,oBAAoB,SAAS;","names":[]}
|
package/dist/progress.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@yamada-ui/progress",
|
3
|
-
"version": "1.1.4-dev-
|
3
|
+
"version": "1.1.4-dev-20241006032009",
|
4
4
|
"description": "Yamada UI progress components",
|
5
5
|
"keywords": [
|
6
6
|
"yamada",
|
@@ -36,11 +36,11 @@
|
|
36
36
|
"url": "https://github.com/yamada-ui/yamada-ui/issues"
|
37
37
|
},
|
38
38
|
"dependencies": {
|
39
|
-
"@yamada-ui/core": "1.15.2-dev-
|
40
|
-
"@yamada-ui/use-animation": "1.0.39-dev-
|
41
|
-
"@yamada-ui/use-token": "1.1.27-dev-
|
42
|
-
"@yamada-ui/use-value": "1.1.27-dev-
|
43
|
-
"@yamada-ui/utils": "1.5.
|
39
|
+
"@yamada-ui/core": "1.15.2-dev-20241006032009",
|
40
|
+
"@yamada-ui/use-animation": "1.0.39-dev-20241006032009",
|
41
|
+
"@yamada-ui/use-token": "1.1.27-dev-20241006032009",
|
42
|
+
"@yamada-ui/use-value": "1.1.27-dev-20241006032009",
|
43
|
+
"@yamada-ui/utils": "1.5.3-dev-20241006032009"
|
44
44
|
},
|
45
45
|
"devDependencies": {
|
46
46
|
"clean-package": "2.2.0",
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/circle-progress.tsx"],"sourcesContent":["import type {\n HTMLUIProps,\n CSSUIObject,\n CSSUIProps,\n ThemeProps,\n FC,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useComponentStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { useAnimation } from \"@yamada-ui/use-animation\"\nimport { cx, valueToPercent } from \"@yamada-ui/utils\"\n\ninterface CircleProgressOptions {\n /**\n * The CSS `box-size` property.\n *\n * @default '6rem'\n * @deprecated Use `boxSize` instead.\n */\n size?: CSSUIProps[\"boxSize\"]\n /**\n * The CSS `width` property.\n *\n * @default '0.625ewm'\n */\n thickness?: CSSUIProps[\"width\"]\n /**\n * The CSS `color` property.\n *\n * @default 'primary'\n */\n color?: CSSUIProps[\"color\"]\n /**\n * The CSS `color` property.\n *\n * @default 'border'\n */\n trackColor?: CSSUIProps[\"color\"]\n /**\n * The value of the progress.\n *\n * @default 0\n */\n value?: number\n /**\n * The minimum value of the progress.\n *\n * @default 0\n */\n min?: number\n /**\n * The maximum value of the progress.\n *\n * @default 100\n */\n max?: number\n /**\n * If `true`, the cap of the progress indicator will be rounded.\n *\n * @default false\n */\n isRounded?: boolean\n /**\n * If `true`, the progress will be indeterminate and the `value` prop will be ignored.\n *\n * @default false\n */\n isAnimation?: boolean\n /**\n * The animation speed in seconds.\n *\n * @default '[1.4s, 2s]'\n */\n speed?: [string | number, string | number]\n}\n\nexport interface CircleProgressProps\n extends Omit<HTMLUIProps, \"color\">,\n Omit<ThemeProps<\"CircleProgress\">, \"size\">,\n CircleProgressOptions {}\n\n/**\n * `CircleProgress` is a component that displays progress in a circular progress bar.\n *\n * @see Docs https://yamada-ui.com/components/feedback/circle-progress\n */\nexport const CircleProgress = forwardRef<CircleProgressProps, \"div\">(\n (props, ref) => {\n const [styles, { size = \"6rem\", ...mergedProps }] = useComponentStyle(\n \"CircleProgress\",\n props,\n )\n let {\n className,\n children,\n boxSize = size,\n thickness = \"0.625rem\",\n color = \"primary\",\n trackColor = \"border\",\n value = 0,\n min = 0,\n max = 100,\n isAnimation = false,\n isRounded,\n speed = [\"1.4s\", \"2s\"],\n ...rest\n } = omitThemeProps(mergedProps)\n\n const isTransparent = value === 0 && !isAnimation\n const percent = valueToPercent(value, min, max)\n\n const interval = !isAnimation ? percent * 2.64 : undefined\n\n const animation = useAnimation({\n keyframes: {\n \"0%\": {\n strokeDasharray: \"1, 400\",\n strokeDashoffset: \"0\",\n },\n \"50%\": {\n strokeDasharray: \"400, 400\",\n strokeDashoffset: \"-100\",\n },\n \"100%\": {\n strokeDasharray: \"400, 400\",\n strokeDashoffset: \"-260\",\n },\n },\n duration: typeof speed[0] === \"string\" ? speed[0] : `${speed[0]}s`,\n iterationCount: \"infinite\",\n timingFunction: \"linear\",\n })\n\n const css: CSSUIObject = {\n ...styles,\n vars: [\n { name: \"boxSize\", token: \"sizes\", value: boxSize },\n { name: \"thickness\", token: \"sizes\", value: thickness },\n ],\n fontSize: \"$boxSize\",\n }\n\n const circleProps: CircleProps = isAnimation\n ? {\n animation,\n }\n : {\n strokeDashoffset: 66,\n strokeDasharray:\n interval == null ? undefined : `${interval} ${264 - interval}`,\n transitionProperty: \"stroke-dasharray, stroke\",\n transitionDuration: \"0.6s\",\n transitionTimingFunction: \"ease\",\n }\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-circle-progress\", className)}\n __css={css}\n {...rest}\n >\n <Shape boxSize={boxSize} isAnimation={isAnimation} speed={speed}>\n <Circle stroke={trackColor} strokeWidth=\"$thickness\" />\n <Circle\n stroke={color}\n strokeWidth=\"$thickness\"\n strokeLinecap={isRounded ? \"round\" : undefined}\n opacity={isTransparent ? 0 : undefined}\n {...circleProps}\n />\n </Shape>\n {children}\n </ui.div>\n )\n },\n)\n\nCircleProgress.displayName = \"CircleProgress\"\nCircleProgress.__ui__ = \"CircleProgress\"\n\ninterface CircleProps extends HTMLUIProps<\"circle\"> {}\n\nconst Circle: FC<CircleProps> = ({ ...rest }) => (\n <ui.circle cx={50} cy={50} r={42} fill=\"transparent\" {...rest} />\n)\n\nCircle.displayName = \"Circle\"\nCircle.__ui__ = \"Circle\"\n\ninterface ShapeProps\n extends Omit<HTMLUIProps<\"svg\">, \"children\" | \"speed\">,\n Pick<Required<CircleProgressProps>, \"children\" | \"isAnimation\" | \"speed\"> {}\n\nconst Shape: FC<ShapeProps> = ({ boxSize, isAnimation, speed, ...rest }) => {\n const animation = useAnimation({\n keyframes: {\n \"0%\": {\n transform: \"rotate(0deg)\",\n },\n \"100%\": {\n transform: \"rotate(360deg)\",\n },\n },\n duration: typeof speed[1] === \"string\" ? speed[1] : `${speed[1]}s`,\n iterationCount: \"infinite\",\n timingFunction: \"linear\",\n })\n\n const css: CSSUIObject = {\n display: \"block\",\n boxSize,\n ...(isAnimation ? { animation } : {}),\n }\n\n return <ui.svg viewBox=\"0 0 100 100\" __css={css} {...rest} />\n}\n\nShape.displayName = \"Shape\"\nShape.__ui__ = \"Shape\"\n\nexport const CircleProgressLabel = ui(\"span\", {\n baseStyle: {\n position: \"absolute\",\n top: \"50%\",\n left: \"50%\",\n transform: \"translate(-50%, -50%)\",\n width: \"100%\",\n fontSize: \"0.25em\",\n textAlign: \"center\",\n },\n})\n\nCircleProgressLabel.displayName = \"CircleProgressLabel\"\nCircleProgressLabel.__ui__ = \"CircleProgressLabel\"\n"],"mappings":";;;AAOA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,IAAI,sBAAsB;AAwJ3B,SACE,KADF;AA5ED,IAAM,iBAAiB;AAAA,EAC5B,CAAC,OAAO,QAAQ;AACd,UAAM,CAAC,QAAQ,EAAE,OAAO,QAAQ,GAAG,YAAY,CAAC,IAAI;AAAA,MAClD;AAAA,MACA;AAAA,IACF;AACA,QAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,MAAM;AAAA,MACN,cAAc;AAAA,MACd;AAAA,MACA,QAAQ,CAAC,QAAQ,IAAI;AAAA,MACrB,GAAG;AAAA,IACL,IAAI,eAAe,WAAW;AAE9B,UAAM,gBAAgB,UAAU,KAAK,CAAC;AACtC,UAAM,UAAU,eAAe,OAAO,KAAK,GAAG;AAE9C,UAAM,WAAW,CAAC,cAAc,UAAU,OAAO;AAEjD,UAAM,YAAY,aAAa;AAAA,MAC7B,WAAW;AAAA,QACT,MAAM;AAAA,UACJ,iBAAiB;AAAA,UACj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S;AAIxB,IAAM,SAA0B,CAAC,EAAE,GAAG,KAAK,MACzC,oBAAC,GAAG,QAAH,EAAU,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,MAAK,eAAe,GAAG,MAAM;AAGjE,OAAO,cAAc;AACrB,OAAO,SAAS;AAMhB,IAAM,QAAwB,CAAC,EAAE,SAAS,aAAa,OAAO,GAAG,KAAK,MAAM;AAC1E,QAAM,YAAY,aAAa;AAAA,IAC7B,WAAW;AAAA,MACT,MAAM;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MACA,QAAQ;AAAA,QACN,WAAW;AAAA,MACb;AAAA,IACF;AAAA,IACA,UAAU,OAAO,MAAM,CAAC,MAAM,WAAW,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;AAAA,IAC/D,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,EAClB,CAAC;AAED,QAAM,MAAmB;AAAA,IACvB,SAAS;AAAA,IACT;AAAA,IACA,GAAI,cAAc,EAAE,UAAU,IAAI,CAAC;AAAA,EACrC;AAEA,SAAO,oBAAC,GAAG,KAAH,EAAO,SAAQ,eAAc,OAAO,KAAM,GAAG,MAAM;AAC7D;AAEA,MAAM,cAAc;AACpB,MAAM,SAAS;AAER,IAAM,sBAAsB,GAAG,QAAQ;AAAA,EAC5C,WAAW;AAAA,IACT,UAAU;AAAA,IACV,KAAK;AAAA,IACL,MAAM;AAAA,IACN,WAAW;AAAA,IACX,OAAO;AAAA,IACP,UAAU;AAAA,IACV,WAAW;AAAA,EACb;AACF,CAAC;AAED,oBAAoB,cAAc;AAClC,oBAAoB,SAAS;","names":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/progress.tsx"],"sourcesContent":["import type {\n HTMLUIProps,\n ThemeProps,\n CSSUIObject,\n Interpolation,\n ColorModeToken,\n CSS,\n FC,\n} from \"@yamada-ui/core\"\nimport {\n ui,\n forwardRef,\n useComponentMultiStyle,\n omitThemeProps,\n} from \"@yamada-ui/core\"\nimport { useAnimation } from \"@yamada-ui/use-animation\"\nimport { createContext, cx, valueToPercent } from \"@yamada-ui/utils\"\n\nconst [ProgressProvider, useProgress] = createContext<{\n [key: string]: CSSUIObject\n}>({\n name: `ProgressStylesContext`,\n errorMessage: `useProgress returned is 'undefined'. Seems you forgot to wrap the components in \"<Progress />\" `,\n})\n\ninterface ProgressOptions {\n /**\n * The value of the progress.\n *\n * @default 0\n */\n value?: number\n /**\n * The minimum value of the progress.\n *\n * @default 0\n */\n min?: number\n /**\n * The maximum value of the progress.\n *\n * @default 100\n */\n max?: number\n /**\n * If `true`, the progress bar will show stripe.\n *\n * @default false\n */\n hasStripe?: boolean\n /**\n * If `true`, and hasStripe is `true`, the stripes will be animated.\n *\n * @default false\n */\n isStripeAnimation?: boolean\n /**\n * If `true`, the progress will be indeterminate and the `value` prop will be ignored.\n *\n * @default false\n */\n isAnimation?: boolean\n /**\n * The animation speed in seconds.\n *\n * @default '1.4s'\n */\n speed?: string | number\n /**\n * The CSS `color` property.\n */\n filledTrackColor?: ColorModeToken<CSS.Property.Color, \"colors\">\n}\n\nexport interface ProgressProps\n extends HTMLUIProps,\n ThemeProps<\"Progress\">,\n ProgressOptions {}\n\n/**\n * `Progress` is a component for visually indicating progress.\n *\n * @see Docs https://yamada-ui.com/components/feedback/progress\n */\nexport const Progress = forwardRef<ProgressProps, \"div\">((props, ref) => {\n const [styles, mergedProps] = useComponentMultiStyle(\"Progress\", props)\n const {\n className,\n children,\n value,\n min,\n max,\n hasStripe,\n isStripeAnimation,\n isAnimation,\n speed,\n borderRadius: _borderRadius,\n rounded,\n ...rest\n } = omitThemeProps(mergedProps, [\"filledTrackColor\"])\n\n const borderRadius =\n _borderRadius ?? rounded ?? (styles.track?.borderRadius as string | number)\n\n const css: CSSUIObject = {\n w: \"100%\",\n overflow: \"hidden\",\n pos: \"relative\",\n ...styles.track,\n }\n\n return (\n <ProgressProvider value={styles}>\n <ui.div\n ref={ref}\n className={cx(\"ui-progress\", className)}\n __css={css}\n borderRadius={borderRadius}\n {...rest}\n >\n <ProgressFilledTrack\n min={min}\n max={max}\n value={value}\n hasStripe={hasStripe}\n isStripeAnimation={isStripeAnimation}\n isAnimation={isAnimation}\n speed={speed}\n borderRadius={borderRadius}\n />\n {children}\n </ui.div>\n </ProgressProvider>\n )\n})\n\nProgress.displayName = \"Progress\"\nProgress.__ui__ = \"Progress\"\n\ninterface ProgressFilledTrackProps extends HTMLUIProps, ProgressProps {}\n\nconst ProgressFilledTrack: FC<ProgressFilledTrackProps> = ({\n value = 0,\n min = 0,\n max = 100,\n hasStripe,\n isStripeAnimation,\n isAnimation,\n speed = \"1.4s\",\n ...rest\n}) => {\n const percent = valueToPercent(value, min, max)\n\n const styles = useProgress()\n\n const stripeAnimation = useAnimation({\n keyframes: {\n \"0%\": { bgPosition: \"1rem 0\" },\n \"100%\": { bgPosition: \"0 0\" },\n },\n duration: typeof speed === \"string\" ? speed : `${speed}s`,\n iterationCount: \"infinite\",\n timingFunction: \"linear\",\n })\n\n const interpolationAnimation = useAnimation({\n keyframes: {\n \"0%\": { left: \"-40%\" },\n \"100%\": { left: \"100%\" },\n },\n duration: typeof speed === \"string\" ? speed : `${speed}s`,\n iterationCount: \"infinite\",\n timingFunction: \"ease\",\n })\n\n isStripeAnimation = !isAnimation && hasStripe && isStripeAnimation\n\n const css: Interpolation<{}> = {\n ...(isStripeAnimation\n ? {\n animation: stripeAnimation,\n }\n : {}),\n ...(isAnimation\n ? {\n position: \"absolute\",\n willChange: \"left\",\n minWidth: \"50%\",\n animation: interpolationAnimation,\n }\n : {}),\n }\n\n const __css: CSSUIObject = {\n w: `${percent}%`,\n h: \"100%\",\n ...styles.filledTrack,\n }\n\n return <ui.div css={css} __css={__css} {...rest} />\n}\n\nProgressFilledTrack.displayName = \"ProgressFilledTrack\"\nProgressFilledTrack.__ui__ = \"ProgressFilledTrack\"\n"],"mappings":";;;AASA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,O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