@yamada-ui/progress 1.1.3-dev-20240927170756 → 1.1.3-dev-20240927172557
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-323W4LLC.mjs → chunk-M4H5BDZR.mjs} +11 -16
- package/dist/chunk-M4H5BDZR.mjs.map +1 -0
- package/dist/circle-progress.js +9 -14
- package/dist/circle-progress.js.map +1 -1
- package/dist/circle-progress.mjs +1 -1
- package/dist/index.js +9 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +6 -6
- package/dist/chunk-323W4LLC.mjs.map +0 -1
@@ -8,19 +8,18 @@ import {
|
|
8
8
|
omitThemeProps
|
9
9
|
} from "@yamada-ui/core";
|
10
10
|
import { useAnimation } from "@yamada-ui/use-animation";
|
11
|
-
import {
|
12
|
-
import { cx, isUnit, replaceObject, valueToPercent } from "@yamada-ui/utils";
|
11
|
+
import { cx, valueToPercent } from "@yamada-ui/utils";
|
13
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
14
13
|
var CircleProgress = forwardRef(
|
15
14
|
(props, ref) => {
|
16
|
-
const [styles, { size = "
|
15
|
+
const [styles, { size = "6rem", ...mergedProps }] = useComponentStyle(
|
17
16
|
"CircleProgress",
|
18
17
|
props
|
19
18
|
);
|
20
19
|
let {
|
21
20
|
className,
|
22
21
|
children,
|
23
|
-
boxSize,
|
22
|
+
boxSize = size,
|
24
23
|
thickness = "0.625rem",
|
25
24
|
color = "primary",
|
26
25
|
trackColor = "border",
|
@@ -32,14 +31,6 @@ var CircleProgress = forwardRef(
|
|
32
31
|
speed = ["1.4s", "2s"],
|
33
32
|
...rest
|
34
33
|
} = omitThemeProps(mergedProps);
|
35
|
-
boxSize != null ? boxSize : boxSize = replaceObject(
|
36
|
-
size,
|
37
|
-
(value2) => !isUnit(value2) ? useToken("sizes", value2) : value2
|
38
|
-
);
|
39
|
-
thickness = replaceObject(
|
40
|
-
thickness,
|
41
|
-
(value2) => !isUnit(value2) ? useToken("sizes", value2) : value2
|
42
|
-
);
|
43
34
|
const isTransparent = value === 0 && !isAnimation;
|
44
35
|
const percent = valueToPercent(value, min, max);
|
45
36
|
const interval = !isAnimation ? percent * 2.64 : void 0;
|
@@ -64,7 +55,11 @@ var CircleProgress = forwardRef(
|
|
64
55
|
});
|
65
56
|
const css = {
|
66
57
|
...styles,
|
67
|
-
|
58
|
+
vars: [
|
59
|
+
{ name: "boxSize", token: "sizes", value: boxSize },
|
60
|
+
{ name: "thickness", token: "sizes", value: thickness }
|
61
|
+
],
|
62
|
+
fontSize: "$boxSize"
|
68
63
|
};
|
69
64
|
const circleProps = isAnimation ? {
|
70
65
|
animation
|
@@ -84,12 +79,12 @@ var CircleProgress = forwardRef(
|
|
84
79
|
...rest,
|
85
80
|
children: [
|
86
81
|
/* @__PURE__ */ jsxs(Shape, { boxSize, isAnimation, speed, children: [
|
87
|
-
/* @__PURE__ */ jsx(Circle, { stroke: trackColor, strokeWidth: thickness }),
|
82
|
+
/* @__PURE__ */ jsx(Circle, { stroke: trackColor, strokeWidth: "$thickness" }),
|
88
83
|
/* @__PURE__ */ jsx(
|
89
84
|
Circle,
|
90
85
|
{
|
91
86
|
stroke: color,
|
92
|
-
strokeWidth: thickness,
|
87
|
+
strokeWidth: "$thickness",
|
93
88
|
strokeLinecap: isRounded ? "round" : void 0,
|
94
89
|
opacity: isTransparent ? 0 : void 0,
|
95
90
|
...circleProps
|
@@ -140,4 +135,4 @@ export {
|
|
140
135
|
CircleProgress,
|
141
136
|
CircleProgressLabel
|
142
137
|
};
|
143
|
-
//# sourceMappingURL=chunk-
|
138
|
+
//# sourceMappingURL=chunk-M4H5BDZR.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/circle-progress.tsx"],"sourcesContent":["import type {\n HTMLUIProps,\n CSSUIObject,\n CSSUIProps,\n ThemeProps,\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\"\nimport type { FC } from \"react\"\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\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\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\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"],"mappings":";;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,IAAI,sBAAsB;AAyJ3B,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,UACjB,kBAAkB;AAAA,QACpB;A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AG,QAAH,EAAU,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,MAAK,eAAe,GAAG,MAAM;AAOjE,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;AAEO,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;","names":[]}
|
package/dist/circle-progress.js
CHANGED
@@ -27,19 +27,18 @@ __export(circle_progress_exports, {
|
|
27
27
|
module.exports = __toCommonJS(circle_progress_exports);
|
28
28
|
var import_core = require("@yamada-ui/core");
|
29
29
|
var import_use_animation = require("@yamada-ui/use-animation");
|
30
|
-
var import_use_token = require("@yamada-ui/use-token");
|
31
30
|
var import_utils = require("@yamada-ui/utils");
|
32
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
33
32
|
var CircleProgress = (0, import_core.forwardRef)(
|
34
33
|
(props, ref) => {
|
35
|
-
const [styles, { size = "
|
34
|
+
const [styles, { size = "6rem", ...mergedProps }] = (0, import_core.useComponentStyle)(
|
36
35
|
"CircleProgress",
|
37
36
|
props
|
38
37
|
);
|
39
38
|
let {
|
40
39
|
className,
|
41
40
|
children,
|
42
|
-
boxSize,
|
41
|
+
boxSize = size,
|
43
42
|
thickness = "0.625rem",
|
44
43
|
color = "primary",
|
45
44
|
trackColor = "border",
|
@@ -51,14 +50,6 @@ var CircleProgress = (0, import_core.forwardRef)(
|
|
51
50
|
speed = ["1.4s", "2s"],
|
52
51
|
...rest
|
53
52
|
} = (0, import_core.omitThemeProps)(mergedProps);
|
54
|
-
boxSize != null ? boxSize : boxSize = (0, import_utils.replaceObject)(
|
55
|
-
size,
|
56
|
-
(value2) => !(0, import_utils.isUnit)(value2) ? (0, import_use_token.useToken)("sizes", value2) : value2
|
57
|
-
);
|
58
|
-
thickness = (0, import_utils.replaceObject)(
|
59
|
-
thickness,
|
60
|
-
(value2) => !(0, import_utils.isUnit)(value2) ? (0, import_use_token.useToken)("sizes", value2) : value2
|
61
|
-
);
|
62
53
|
const isTransparent = value === 0 && !isAnimation;
|
63
54
|
const percent = (0, import_utils.valueToPercent)(value, min, max);
|
64
55
|
const interval = !isAnimation ? percent * 2.64 : void 0;
|
@@ -83,7 +74,11 @@ var CircleProgress = (0, import_core.forwardRef)(
|
|
83
74
|
});
|
84
75
|
const css = {
|
85
76
|
...styles,
|
86
|
-
|
77
|
+
vars: [
|
78
|
+
{ name: "boxSize", token: "sizes", value: boxSize },
|
79
|
+
{ name: "thickness", token: "sizes", value: thickness }
|
80
|
+
],
|
81
|
+
fontSize: "$boxSize"
|
87
82
|
};
|
88
83
|
const circleProps = isAnimation ? {
|
89
84
|
animation
|
@@ -103,12 +98,12 @@ var CircleProgress = (0, import_core.forwardRef)(
|
|
103
98
|
...rest,
|
104
99
|
children: [
|
105
100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Shape, { boxSize, isAnimation, speed, children: [
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Circle, { stroke: trackColor, strokeWidth: thickness }),
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Circle, { stroke: trackColor, strokeWidth: "$thickness" }),
|
107
102
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
108
103
|
Circle,
|
109
104
|
{
|
110
105
|
stroke: color,
|
111
|
-
strokeWidth: thickness,
|
106
|
+
strokeWidth: "$thickness",
|
112
107
|
strokeLinecap: isRounded ? "round" : void 0,
|
113
108
|
opacity: isTransparent ? 0 : void 0,
|
114
109
|
...circleProps
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/circle-progress.tsx"],"sourcesContent":["import type {\n HTMLUIProps,\n CSSUIObject,\n CSSUIProps,\n ThemeProps,\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 {
|
1
|
+
{"version":3,"sources":["../src/circle-progress.tsx"],"sourcesContent":["import type {\n HTMLUIProps,\n CSSUIObject,\n CSSUIProps,\n ThemeProps,\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\"\nimport type { FC } from \"react\"\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\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\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\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"],"mappings":";;;;;;;;;;;;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,IACvB,SAAS;AAAA,IACT;AAAA,IACA,GAAI,cAAc,EAAE,UAAU,IAAI,CAAC;AAAA,EACrC;AAEA,SAAO,4CAAC,eAAG,KAAH,EAAO,SAAQ,eAAc,OAAO,KAAM,GAAG,MAAM;AAC7D;AAEO,IAAM,0BAAsB,gBAAG,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;","names":[]}
|
package/dist/circle-progress.mjs
CHANGED
package/dist/index.js
CHANGED
@@ -140,19 +140,18 @@ var ProgressFilledTrack = ({
|
|
140
140
|
// src/circle-progress.tsx
|
141
141
|
var import_core2 = require("@yamada-ui/core");
|
142
142
|
var import_use_animation2 = require("@yamada-ui/use-animation");
|
143
|
-
var import_use_token = require("@yamada-ui/use-token");
|
144
143
|
var import_utils2 = require("@yamada-ui/utils");
|
145
144
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
146
145
|
var CircleProgress = (0, import_core2.forwardRef)(
|
147
146
|
(props, ref) => {
|
148
|
-
const [styles, { size = "
|
147
|
+
const [styles, { size = "6rem", ...mergedProps }] = (0, import_core2.useComponentStyle)(
|
149
148
|
"CircleProgress",
|
150
149
|
props
|
151
150
|
);
|
152
151
|
let {
|
153
152
|
className,
|
154
153
|
children,
|
155
|
-
boxSize,
|
154
|
+
boxSize = size,
|
156
155
|
thickness = "0.625rem",
|
157
156
|
color = "primary",
|
158
157
|
trackColor = "border",
|
@@ -164,14 +163,6 @@ var CircleProgress = (0, import_core2.forwardRef)(
|
|
164
163
|
speed = ["1.4s", "2s"],
|
165
164
|
...rest
|
166
165
|
} = (0, import_core2.omitThemeProps)(mergedProps);
|
167
|
-
boxSize != null ? boxSize : boxSize = (0, import_utils2.replaceObject)(
|
168
|
-
size,
|
169
|
-
(value2) => !(0, import_utils2.isUnit)(value2) ? (0, import_use_token.useToken)("sizes", value2) : value2
|
170
|
-
);
|
171
|
-
thickness = (0, import_utils2.replaceObject)(
|
172
|
-
thickness,
|
173
|
-
(value2) => !(0, import_utils2.isUnit)(value2) ? (0, import_use_token.useToken)("sizes", value2) : value2
|
174
|
-
);
|
175
166
|
const isTransparent = value === 0 && !isAnimation;
|
176
167
|
const percent = (0, import_utils2.valueToPercent)(value, min, max);
|
177
168
|
const interval = !isAnimation ? percent * 2.64 : void 0;
|
@@ -196,7 +187,11 @@ var CircleProgress = (0, import_core2.forwardRef)(
|
|
196
187
|
});
|
197
188
|
const css = {
|
198
189
|
...styles,
|
199
|
-
|
190
|
+
vars: [
|
191
|
+
{ name: "boxSize", token: "sizes", value: boxSize },
|
192
|
+
{ name: "thickness", token: "sizes", value: thickness }
|
193
|
+
],
|
194
|
+
fontSize: "$boxSize"
|
200
195
|
};
|
201
196
|
const circleProps = isAnimation ? {
|
202
197
|
animation
|
@@ -216,12 +211,12 @@ var CircleProgress = (0, import_core2.forwardRef)(
|
|
216
211
|
...rest,
|
217
212
|
children: [
|
218
213
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Shape, { boxSize, isAnimation, speed, children: [
|
219
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Circle, { stroke: trackColor, strokeWidth: thickness }),
|
214
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Circle, { stroke: trackColor, strokeWidth: "$thickness" }),
|
220
215
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
221
216
|
Circle,
|
222
217
|
{
|
223
218
|
stroke: color,
|
224
|
-
strokeWidth: thickness,
|
219
|
+
strokeWidth: "$thickness",
|
225
220
|
strokeLinecap: isRounded ? "round" : void 0,
|
226
221
|
opacity: isTransparent ? 0 : void 0,
|
227
222
|
...circleProps
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/progress.tsx","../src/circle-progress.tsx"],"sourcesContent":["export { Progress } from \"./progress\"\nexport type { ProgressProps } from \"./progress\"\nexport { CircleProgress, CircleProgressLabel } from \"./circle-progress\"\nexport type { CircleProgressProps } from \"./circle-progress\"\n","import type {\n HTMLUIProps,\n ThemeProps,\n CSSUIObject,\n Interpolation,\n ColorModeToken,\n CSS,\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\"\nimport type { FC } from \"react\"\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\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","import type {\n HTMLUIProps,\n CSSUIObject,\n CSSUIProps,\n ThemeProps,\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 { useToken } from \"@yamada-ui/use-token\"\nimport { cx, isUnit, replaceObject, valueToPercent } from \"@yamada-ui/utils\"\nimport type { FC } from \"react\"\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 = \"6em\", ...mergedProps }] = useComponentStyle(\n \"CircleProgress\",\n props,\n )\n let {\n className,\n children,\n boxSize,\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 boxSize ??= replaceObject(size, (value) =>\n !isUnit(value) ? useToken(\"sizes\", value) : value,\n )\n thickness = replaceObject(thickness, (value) =>\n !isUnit(value) ? useToken(\"sizes\", value) : value,\n )\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 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\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\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\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQA,kBAKO;AACP,2BAA6B;AAC7B,mBAAkD;AAkG5C;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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc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,aACF;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIA,IAAM,SAA0B,CAAC,EAAE,GAAG,KAAK,MACzC,6CAAC,gBAAG,QAAH,EAAU,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,MAAK,eAAe,GAAG,MAAM;AAOjE,IAAM,QAAwB,CAAC,EAAE,SAAS,aAAa,OAAO,GAAG,KAAK,MAAM;AAC1E,QAAM,gBAAY,oCAAa;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,6CAAC,gBAAG,KAAH,EAAO,SAAQ,eAAc,OAAO,KAAM,GAAG,MAAM;AAC7D;AAEO,IAAM,0BAAsB,iBAAG,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;","names":["import_core","import_use_animation","import_utils","import_jsx_runtime","value"]}
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/progress.tsx","../src/circle-progress.tsx"],"sourcesContent":["export { Progress } from \"./progress\"\nexport type { ProgressProps } from \"./progress\"\nexport { CircleProgress, CircleProgressLabel } from \"./circle-progress\"\nexport type { CircleProgressProps } from \"./circle-progress\"\n","import type {\n HTMLUIProps,\n ThemeProps,\n CSSUIObject,\n Interpolation,\n ColorModeToken,\n CSS,\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\"\nimport type { FC } from \"react\"\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\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","import type {\n HTMLUIProps,\n CSSUIObject,\n CSSUIProps,\n ThemeProps,\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\"\nimport type { FC } from \"react\"\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\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\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\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACQA,kBAKO;AACP,2BAA6B;AAC7B,mBAAkD;AAkG5C;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;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;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,GAAG;AAAA,IACH,UAAU;AAAA,IACV,KAAK;AAAA,IACL,GAAG,OAAO;AAAA,EACZ;AAEA,SACE,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AA,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,6CAAC,gBAAG,KAAH,EAAO,SAAQ,eAAc,OAAO,KAAM,GAAG,MAAM;AAC7D;AAEO,IAAM,0BAAsB,iBAAG,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;","names":["import_core","import_use_animation","import_utils","import_jsx_runtime"]}
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@yamada-ui/progress",
|
3
|
-
"version": "1.1.3-dev-
|
3
|
+
"version": "1.1.3-dev-20240927172557",
|
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.1-dev-
|
40
|
-
"@yamada-ui/use-animation": "1.0.38-dev-
|
41
|
-
"@yamada-ui/use-token": "1.1.26-dev-
|
42
|
-
"@yamada-ui/use-value": "1.1.26-dev-
|
43
|
-
"@yamada-ui/utils": "1.5.2-dev-
|
39
|
+
"@yamada-ui/core": "1.15.1-dev-20240927172557",
|
40
|
+
"@yamada-ui/use-animation": "1.0.38-dev-20240927172557",
|
41
|
+
"@yamada-ui/use-token": "1.1.26-dev-20240927172557",
|
42
|
+
"@yamada-ui/use-value": "1.1.26-dev-20240927172557",
|
43
|
+
"@yamada-ui/utils": "1.5.2-dev-20240927172557"
|
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} 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 { useToken } from \"@yamada-ui/use-token\"\nimport { cx, isUnit, replaceObject, valueToPercent } from \"@yamada-ui/utils\"\nimport type { FC } from \"react\"\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 = \"6em\", ...mergedProps }] = useComponentStyle(\n \"CircleProgress\",\n props,\n )\n let {\n className,\n children,\n boxSize,\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 boxSize ??= replaceObject(size, (value) =>\n !isUnit(value) ? useToken(\"sizes\", value) : value,\n )\n thickness = replaceObject(thickness, (value) =>\n !isUnit(value) ? useToken(\"sizes\", value) : value,\n )\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 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\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\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\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"],"mappings":";;;AAMA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,IAAI,QAAQ,eAAe,sBAAsB;AA4JlD,SACE,KADF;AA/ED,IAAM,iBAAiB;AAAA,EAC5B,CAAC,OAAO,QAAQ;AACd,UAAM,CAAC,QAAQ,EAAE,OAAO,OAAO,GAAG,YAAY,CAAC,IAAI;AAAA,MACjD;AAAA,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