@yamada-ui/progress 2.0.0-next-20240729113003 → 2.0.0-next-20240820160301

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,31 +1,45 @@
1
1
  "use client"
2
2
 
3
3
  // src/circle-progress.tsx
4
- import { ui, forwardRef } from "@yamada-ui/core";
4
+ import {
5
+ ui,
6
+ forwardRef,
7
+ useComponentStyle,
8
+ omitThemeProps
9
+ } from "@yamada-ui/core";
5
10
  import { useAnimation } from "@yamada-ui/use-animation";
6
11
  import { useToken } from "@yamada-ui/use-token";
7
- import { useValue } from "@yamada-ui/use-value";
8
- import { cx, valueToPercent } from "@yamada-ui/utils";
12
+ import { cx, isUnit, replaceObject, valueToPercent } from "@yamada-ui/utils";
9
13
  import { jsx, jsxs } from "react/jsx-runtime";
10
14
  var CircleProgress = forwardRef(
11
- ({
12
- className,
13
- children,
14
- size = "6rem",
15
- thickness = "0.625rem",
16
- color = "primary",
17
- trackColor = "border",
18
- value = 0,
19
- min = 0,
20
- max = 100,
21
- isAnimation = false,
22
- isRounded,
23
- speed = ["1.4s", "2s"],
24
- ...rest
25
- }, ref) => {
26
- var _a, _b;
27
- size = (_a = useToken("sizes", useValue(size))) != null ? _a : size;
28
- thickness = (_b = useToken("sizes", useValue(thickness))) != null ? _b : thickness;
15
+ (props, ref) => {
16
+ const [styles, { size = "6em", ...mergedProps }] = useComponentStyle(
17
+ "CircleProgress",
18
+ props
19
+ );
20
+ let {
21
+ className,
22
+ children,
23
+ boxSize,
24
+ thickness = "0.625rem",
25
+ color = "primary",
26
+ trackColor = "border",
27
+ value = 0,
28
+ min = 0,
29
+ max = 100,
30
+ isAnimation = false,
31
+ isRounded,
32
+ speed = ["1.4s", "2s"],
33
+ ...rest
34
+ } = 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
+ );
29
43
  const isTransparent = value === 0 && !isAnimation;
30
44
  const percent = valueToPercent(value, min, max);
31
45
  const interval = !isAnimation ? percent * 2.64 : void 0;
@@ -49,12 +63,10 @@ var CircleProgress = forwardRef(
49
63
  timingFunction: "linear"
50
64
  });
51
65
  const css = {
52
- display: "inline-block",
53
- position: "relative",
54
- verticalAlign: "middle",
55
- fontSize: size
66
+ ...styles,
67
+ fontSize: boxSize
56
68
  };
57
- const props = isAnimation ? {
69
+ const circleProps = isAnimation ? {
58
70
  animation
59
71
  } : {
60
72
  strokeDashoffset: 66,
@@ -71,7 +83,7 @@ var CircleProgress = forwardRef(
71
83
  __css: css,
72
84
  ...rest,
73
85
  children: [
74
- /* @__PURE__ */ jsxs(Shape, { size, isAnimation, speed, children: [
86
+ /* @__PURE__ */ jsxs(Shape, { boxSize, isAnimation, speed, children: [
75
87
  /* @__PURE__ */ jsx(Circle, { stroke: trackColor, strokeWidth: thickness }),
76
88
  /* @__PURE__ */ jsx(
77
89
  Circle,
@@ -80,7 +92,7 @@ var CircleProgress = forwardRef(
80
92
  strokeWidth: thickness,
81
93
  strokeLinecap: isRounded ? "round" : void 0,
82
94
  opacity: isTransparent ? 0 : void 0,
83
- ...props
95
+ ...circleProps
84
96
  }
85
97
  )
86
98
  ] }),
@@ -91,7 +103,7 @@ var CircleProgress = forwardRef(
91
103
  }
92
104
  );
93
105
  var Circle = ({ ...rest }) => /* @__PURE__ */ jsx(ui.circle, { cx: 50, cy: 50, r: 42, fill: "transparent", ...rest });
94
- var Shape = ({ size, isAnimation, speed, ...rest }) => {
106
+ var Shape = ({ boxSize, isAnimation, speed, ...rest }) => {
95
107
  const animation = useAnimation({
96
108
  keyframes: {
97
109
  "0%": {
@@ -107,7 +119,7 @@ var Shape = ({ size, isAnimation, speed, ...rest }) => {
107
119
  });
108
120
  const css = {
109
121
  display: "block",
110
- boxSize: size,
122
+ boxSize,
111
123
  ...isAnimation ? { animation } : {}
112
124
  };
113
125
  return /* @__PURE__ */ jsx(ui.svg, { viewBox: "0 0 100 100", __css: css, ...rest });
@@ -128,4 +140,4 @@ export {
128
140
  CircleProgress,
129
141
  CircleProgressLabel
130
142
  };
131
- //# sourceMappingURL=chunk-GJAFLWEF.mjs.map
143
+ //# sourceMappingURL=chunk-I3YVVCGV.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 { useToken } from \"@yamada-ui/use-token\"\nimport { cx, isUnit, replaceObject, valueToPercent } from \"@yamada-ui/utils\"\nimport type { FC } from \"react\"\n\ntype 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 type CircleProgressProps = Omit<HTMLUIProps<\"div\">, \"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\ntype CircleProps = HTMLUIProps<\"circle\">\n\nconst Circle: FC<CircleProps> = ({ ...rest }) => (\n <ui.circle cx={50} cy={50} r={42} fill=\"transparent\" {...rest} />\n)\n\ntype ShapeProps = Omit<HTMLUIProps<\"svg\">, \"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;AA2JlD,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,MACA;AAAA,IACF;AACA,QAA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,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":["value"]}
@@ -1,11 +1,12 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
- import { HTMLUIProps, CSSUIProps } from '@yamada-ui/core';
2
+ import { HTMLUIProps, ThemeProps, CSSUIProps } from '@yamada-ui/core';
3
3
 
4
4
  type CircleProgressOptions = {
5
5
  /**
6
6
  * The CSS `box-size` property.
7
7
  *
8
8
  * @default '6rem'
9
+ * @deprecated Use `boxSize` instead.
9
10
  */
10
11
  size?: CSSUIProps["boxSize"];
11
12
  /**
@@ -63,7 +64,7 @@ type CircleProgressOptions = {
63
64
  */
64
65
  speed?: [string | number, string | number];
65
66
  };
66
- type CircleProgressProps = Omit<HTMLUIProps<"div">, "color"> & CircleProgressOptions;
67
+ type CircleProgressProps = Omit<HTMLUIProps<"div">, "color"> & Omit<ThemeProps<"CircleProgress">, "size"> & CircleProgressOptions;
67
68
  /**
68
69
  * `CircleProgress` is a component that displays progress in a circular progress bar.
69
70
  *
@@ -1,11 +1,12 @@
1
1
  import * as _yamada_ui_core from '@yamada-ui/core';
2
- import { HTMLUIProps, CSSUIProps } from '@yamada-ui/core';
2
+ import { HTMLUIProps, ThemeProps, CSSUIProps } from '@yamada-ui/core';
3
3
 
4
4
  type CircleProgressOptions = {
5
5
  /**
6
6
  * The CSS `box-size` property.
7
7
  *
8
8
  * @default '6rem'
9
+ * @deprecated Use `boxSize` instead.
9
10
  */
10
11
  size?: CSSUIProps["boxSize"];
11
12
  /**
@@ -63,7 +64,7 @@ type CircleProgressOptions = {
63
64
  */
64
65
  speed?: [string | number, string | number];
65
66
  };
66
- type CircleProgressProps = Omit<HTMLUIProps<"div">, "color"> & CircleProgressOptions;
67
+ type CircleProgressProps = Omit<HTMLUIProps<"div">, "color"> & Omit<ThemeProps<"CircleProgress">, "size"> & CircleProgressOptions;
67
68
  /**
68
69
  * `CircleProgress` is a component that displays progress in a circular progress bar.
69
70
  *
@@ -28,28 +28,37 @@ 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
30
  var import_use_token = require("@yamada-ui/use-token");
31
- var import_use_value = require("@yamada-ui/use-value");
32
31
  var import_utils = require("@yamada-ui/utils");
33
32
  var import_jsx_runtime = require("react/jsx-runtime");
34
33
  var CircleProgress = (0, import_core.forwardRef)(
35
- ({
36
- className,
37
- children,
38
- size = "6rem",
39
- thickness = "0.625rem",
40
- color = "primary",
41
- trackColor = "border",
42
- value = 0,
43
- min = 0,
44
- max = 100,
45
- isAnimation = false,
46
- isRounded,
47
- speed = ["1.4s", "2s"],
48
- ...rest
49
- }, ref) => {
50
- var _a, _b;
51
- size = (_a = (0, import_use_token.useToken)("sizes", (0, import_use_value.useValue)(size))) != null ? _a : size;
52
- thickness = (_b = (0, import_use_token.useToken)("sizes", (0, import_use_value.useValue)(thickness))) != null ? _b : thickness;
34
+ (props, ref) => {
35
+ const [styles, { size = "6em", ...mergedProps }] = (0, import_core.useComponentStyle)(
36
+ "CircleProgress",
37
+ props
38
+ );
39
+ let {
40
+ className,
41
+ children,
42
+ boxSize,
43
+ thickness = "0.625rem",
44
+ color = "primary",
45
+ trackColor = "border",
46
+ value = 0,
47
+ min = 0,
48
+ max = 100,
49
+ isAnimation = false,
50
+ isRounded,
51
+ speed = ["1.4s", "2s"],
52
+ ...rest
53
+ } = (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
+ );
53
62
  const isTransparent = value === 0 && !isAnimation;
54
63
  const percent = (0, import_utils.valueToPercent)(value, min, max);
55
64
  const interval = !isAnimation ? percent * 2.64 : void 0;
@@ -73,12 +82,10 @@ var CircleProgress = (0, import_core.forwardRef)(
73
82
  timingFunction: "linear"
74
83
  });
75
84
  const css = {
76
- display: "inline-block",
77
- position: "relative",
78
- verticalAlign: "middle",
79
- fontSize: size
85
+ ...styles,
86
+ fontSize: boxSize
80
87
  };
81
- const props = isAnimation ? {
88
+ const circleProps = isAnimation ? {
82
89
  animation
83
90
  } : {
84
91
  strokeDashoffset: 66,
@@ -95,7 +102,7 @@ var CircleProgress = (0, import_core.forwardRef)(
95
102
  __css: css,
96
103
  ...rest,
97
104
  children: [
98
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Shape, { size, isAnimation, speed, children: [
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Shape, { boxSize, isAnimation, speed, children: [
99
106
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Circle, { stroke: trackColor, strokeWidth: thickness }),
100
107
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
101
108
  Circle,
@@ -104,7 +111,7 @@ var CircleProgress = (0, import_core.forwardRef)(
104
111
  strokeWidth: thickness,
105
112
  strokeLinecap: isRounded ? "round" : void 0,
106
113
  opacity: isTransparent ? 0 : void 0,
107
- ...props
114
+ ...circleProps
108
115
  }
109
116
  )
110
117
  ] }),
@@ -115,7 +122,7 @@ var CircleProgress = (0, import_core.forwardRef)(
115
122
  }
116
123
  );
117
124
  var Circle = ({ ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.circle, { cx: 50, cy: 50, r: 42, fill: "transparent", ...rest });
118
- var Shape = ({ size, isAnimation, speed, ...rest }) => {
125
+ var Shape = ({ boxSize, isAnimation, speed, ...rest }) => {
119
126
  const animation = (0, import_use_animation.useAnimation)({
120
127
  keyframes: {
121
128
  "0%": {
@@ -131,7 +138,7 @@ var Shape = ({ size, isAnimation, speed, ...rest }) => {
131
138
  });
132
139
  const css = {
133
140
  display: "block",
134
- boxSize: size,
141
+ boxSize,
135
142
  ...isAnimation ? { animation } : {}
136
143
  };
137
144
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ui.svg, { viewBox: "0 0 100 100", __css: css, ...rest });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/circle-progress.tsx"],"sourcesContent":["import type { HTMLUIProps, CSSUIObject, CSSUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { useAnimation } from \"@yamada-ui/use-animation\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport { cx, valueToPercent } from \"@yamada-ui/utils\"\nimport type { FC } from \"react\"\n\ntype CircleProgressOptions = {\n /**\n * The CSS `box-size` property.\n *\n * @default '6rem'\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 type CircleProgressProps = Omit<HTMLUIProps<\"div\">, \"color\"> &\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 (\n {\n className,\n children,\n size = \"6rem\",\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 },\n ref,\n ) => {\n size = (useToken(\"sizes\", useValue(size)) ?? size) as string | number\n thickness = (useToken(\"sizes\", useValue(thickness)) ?? thickness) as\n | string\n | number\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 display: \"inline-block\",\n position: \"relative\",\n verticalAlign: \"middle\",\n fontSize: size,\n }\n\n const props: 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 size={size} 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 {...props}\n />\n </Shape>\n {children}\n </ui.div>\n )\n },\n)\n\ntype CircleProps = HTMLUIProps<\"circle\">\n\nconst Circle: FC<CircleProps> = ({ ...rest }) => (\n <ui.circle cx={50} cy={50} r={42} fill=\"transparent\" {...rest} />\n)\n\ntype ShapeProps = Omit<HTMLUIProps<\"svg\">, \"speed\"> &\n Pick<\n Required<CircleProgressProps>,\n \"children\" | \"size\" | \"isAnimation\" | \"speed\"\n >\n\nconst Shape: FC<ShapeProps> = ({ size, 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: size,\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;AACA,kBAA+B;AAC/B,2BAA6B;AAC7B,uBAAyB;AACzB,uBAAyB;AACzB,mBAAmC;AAsJ3B;AA5ED,IAAM,qBAAiB;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,cAAc;AAAA,IACd;AAAA,IACA,QAAQ,CAAC,QAAQ,IAAI;AAAA,IACrB,GAAG;AAAA,EACL,GACA,QACG;AAjGP;AAkGI,YAAQ,oCAA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AAAA,gBACR,aAAa;AAAA,gBACb,eAAe,YAAY,UAAU;AAAA,gBACrC,SAAS,gBAAgB,IAAI;AAAA,gBAC5B,GAAG;AAAA;AAAA,YACN;AAAA,aACF;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIA,IAAM,SAA0B,CAAC,EAAE,GAAG,KAAK,MACzC,4CAAC,eAAG,QAAH,EAAU,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,MAAK,eAAe,GAAG,MAAM;AASjE,IAAM,QAAwB,CAAC,EAAE,MAAM,aAAa,OAAO,GAAG,KAAK,MAAM;AACvE,QAAM,gBAAY,mCAAa;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,SAAS;AAAA,IACT,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":[]}
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\ntype 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 type CircleProgressProps = Omit<HTMLUIProps<\"div\">, \"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\ntype CircleProps = HTMLUIProps<\"circle\">\n\nconst Circle: FC<CircleProps> = ({ ...rest }) => (\n <ui.circle cx={50} cy={50} r={42} fill=\"transparent\" {...rest} />\n)\n\ntype ShapeProps = Omit<HTMLUIProps<\"svg\">, \"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;AAMA,kBAKO;AACP,2BAA6B;AAC7B,uBAAyB;AACzB,mBAA0D;AA2JlD;AA/ED,IAAM,qBAAiB;AAAA,EAC5B,CAAC,OAAO,QAAQ;AACd,UAAM,CAAC,QAAQ,EAAE,OAAO,OAAO,GAAG,YAAY,CAAC,QAAI;AAAA,MACjD;AAAA,MACA;AAAA,IACF;AACA,QAAI;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA,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,QAAI,4BAAe,WAAW;AAE9B,8CAAY;AAAA,MAAc;AAAA,MAAM,CAACA,WAC/B,KAAC,qBAAOA,MAAK,QAAI,2BAAS,SAASA,MAAK,IAAIA;AAAA,IAC9C;AACA,oBAAY;AAAA,MAAc;AAAA,M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,gBACrC,SAAS,gBAAgB,IAAI;AAAA,gBAC5B,GAAG;AAAA;AAAA,YACN;AAAA,aACF;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAIA,IAAM,SAA0B,CAAC,EAAE,GAAG,KAAK,MACzC,4CAAC,eAAG,QAAH,EAAU,IAAI,IAAI,IAAI,IAAI,GAAG,IAAI,MAAK,eAAe,GAAG,MAAM;AAMjE,IAAM,QAAwB,CAAC,EAAE,SAAS,aAAa,OAAO,GAAG,KAAK,MAAM;AAC1E,QAAM,gBAAY,mCAAa;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,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":["value"]}
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CircleProgress,
4
4
  CircleProgressLabel
5
- } from "./chunk-GJAFLWEF.mjs";
5
+ } from "./chunk-I3YVVCGV.mjs";
6
6
  export {
7
7
  CircleProgress,
8
8
  CircleProgressLabel
package/dist/index.js CHANGED
@@ -137,28 +137,37 @@ var ProgressFilledTrack = ({
137
137
  var import_core2 = require("@yamada-ui/core");
138
138
  var import_use_animation2 = require("@yamada-ui/use-animation");
139
139
  var import_use_token = require("@yamada-ui/use-token");
140
- var import_use_value = require("@yamada-ui/use-value");
141
140
  var import_utils2 = require("@yamada-ui/utils");
142
141
  var import_jsx_runtime2 = require("react/jsx-runtime");
143
142
  var CircleProgress = (0, import_core2.forwardRef)(
144
- ({
145
- className,
146
- children,
147
- size = "6rem",
148
- thickness = "0.625rem",
149
- color = "primary",
150
- trackColor = "border",
151
- value = 0,
152
- min = 0,
153
- max = 100,
154
- isAnimation = false,
155
- isRounded,
156
- speed = ["1.4s", "2s"],
157
- ...rest
158
- }, ref) => {
159
- var _a, _b;
160
- size = (_a = (0, import_use_token.useToken)("sizes", (0, import_use_value.useValue)(size))) != null ? _a : size;
161
- thickness = (_b = (0, import_use_token.useToken)("sizes", (0, import_use_value.useValue)(thickness))) != null ? _b : thickness;
143
+ (props, ref) => {
144
+ const [styles, { size = "6em", ...mergedProps }] = (0, import_core2.useComponentStyle)(
145
+ "CircleProgress",
146
+ props
147
+ );
148
+ let {
149
+ className,
150
+ children,
151
+ boxSize,
152
+ thickness = "0.625rem",
153
+ color = "primary",
154
+ trackColor = "border",
155
+ value = 0,
156
+ min = 0,
157
+ max = 100,
158
+ isAnimation = false,
159
+ isRounded,
160
+ speed = ["1.4s", "2s"],
161
+ ...rest
162
+ } = (0, import_core2.omitThemeProps)(mergedProps);
163
+ boxSize != null ? boxSize : boxSize = (0, import_utils2.replaceObject)(
164
+ size,
165
+ (value2) => !(0, import_utils2.isUnit)(value2) ? (0, import_use_token.useToken)("sizes", value2) : value2
166
+ );
167
+ thickness = (0, import_utils2.replaceObject)(
168
+ thickness,
169
+ (value2) => !(0, import_utils2.isUnit)(value2) ? (0, import_use_token.useToken)("sizes", value2) : value2
170
+ );
162
171
  const isTransparent = value === 0 && !isAnimation;
163
172
  const percent = (0, import_utils2.valueToPercent)(value, min, max);
164
173
  const interval = !isAnimation ? percent * 2.64 : void 0;
@@ -182,12 +191,10 @@ var CircleProgress = (0, import_core2.forwardRef)(
182
191
  timingFunction: "linear"
183
192
  });
184
193
  const css = {
185
- display: "inline-block",
186
- position: "relative",
187
- verticalAlign: "middle",
188
- fontSize: size
194
+ ...styles,
195
+ fontSize: boxSize
189
196
  };
190
- const props = isAnimation ? {
197
+ const circleProps = isAnimation ? {
191
198
  animation
192
199
  } : {
193
200
  strokeDashoffset: 66,
@@ -204,7 +211,7 @@ var CircleProgress = (0, import_core2.forwardRef)(
204
211
  __css: css,
205
212
  ...rest,
206
213
  children: [
207
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Shape, { size, isAnimation, speed, children: [
214
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Shape, { boxSize, isAnimation, speed, children: [
208
215
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Circle, { stroke: trackColor, strokeWidth: thickness }),
209
216
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
210
217
  Circle,
@@ -213,7 +220,7 @@ var CircleProgress = (0, import_core2.forwardRef)(
213
220
  strokeWidth: thickness,
214
221
  strokeLinecap: isRounded ? "round" : void 0,
215
222
  opacity: isTransparent ? 0 : void 0,
216
- ...props
223
+ ...circleProps
217
224
  }
218
225
  )
219
226
  ] }),
@@ -224,7 +231,7 @@ var CircleProgress = (0, import_core2.forwardRef)(
224
231
  }
225
232
  );
226
233
  var Circle = ({ ...rest }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.circle, { cx: 50, cy: 50, r: 42, fill: "transparent", ...rest });
227
- var Shape = ({ size, isAnimation, speed, ...rest }) => {
234
+ var Shape = ({ boxSize, isAnimation, speed, ...rest }) => {
228
235
  const animation = (0, import_use_animation2.useAnimation)({
229
236
  keyframes: {
230
237
  "0%": {
@@ -240,7 +247,7 @@ var Shape = ({ size, isAnimation, speed, ...rest }) => {
240
247
  });
241
248
  const css = {
242
249
  display: "block",
243
- boxSize: size,
250
+ boxSize,
244
251
  ...isAnimation ? { animation } : {}
245
252
  };
246
253
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.ui.svg, { viewBox: "0 0 100 100", __css: css, ...rest });
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 useMultiComponentStyle,\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 Record<string, CSSUIObject>\n>({\n name: `ProgressStylesContext`,\n errorMessage: `useProgress returned is 'undefined'. Seems you forgot to wrap the components in \"<Progress />\" `,\n})\n\ntype 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 type ProgressProps = HTMLUIProps<\"div\"> &\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] = useMultiComponentStyle(\"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 ...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\ntype ProgressFilledTrackProps = HTMLUIProps<\"div\"> & 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 ...styles.filledTrack,\n }\n\n return <ui.div css={css} __css={__css} {...rest} />\n}\n","import type { HTMLUIProps, CSSUIObject, CSSUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { useAnimation } from \"@yamada-ui/use-animation\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport { cx, valueToPercent } from \"@yamada-ui/utils\"\nimport type { FC } from \"react\"\n\ntype CircleProgressOptions = {\n /**\n * The CSS `box-size` property.\n *\n * @default '6rem'\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 type CircleProgressProps = Omit<HTMLUIProps<\"div\">, \"color\"> &\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 (\n {\n className,\n children,\n size = \"6rem\",\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 },\n ref,\n ) => {\n size = (useToken(\"sizes\", useValue(size)) ?? size) as string | number\n thickness = (useToken(\"sizes\", useValue(thickness)) ?? thickness) as\n | string\n | number\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 display: \"inline-block\",\n position: \"relative\",\n verticalAlign: \"middle\",\n fontSize: size,\n }\n\n const props: 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 size={size} 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 {...props}\n />\n </Shape>\n {children}\n </ui.div>\n )\n },\n)\n\ntype CircleProps = HTMLUIProps<\"circle\">\n\nconst Circle: FC<CircleProps> = ({ ...rest }) => (\n <ui.circle cx={50} cy={50} r={42} fill=\"transparent\" {...rest} />\n)\n\ntype ShapeProps = Omit<HTMLUIProps<\"svg\">, \"speed\"> &\n Pick<\n Required<CircleProgressProps>,\n \"children\" | \"size\" | \"isAnimation\" | \"speed\"\n >\n\nconst Shape: FC<ShapeProps> = ({ size, 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: size,\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;AA8F5C;AA3FN,IAAM,CAAC,kBAAkB,WAAW,QAAI,4BAEtC;AAAA,EACA,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA4DM,IAAM,eAAW,wBAAiC,CAAC,OAAO,QAAQ;AAnFzE;AAoFE,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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vE,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,SAAS;AAAA,IACT,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"]}
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 useMultiComponentStyle,\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 Record<string, CSSUIObject>\n>({\n name: `ProgressStylesContext`,\n errorMessage: `useProgress returned is 'undefined'. Seems you forgot to wrap the components in \"<Progress />\" `,\n})\n\ntype 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 type ProgressProps = HTMLUIProps<\"div\"> &\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] = useMultiComponentStyle(\"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 ...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\ntype ProgressFilledTrackProps = HTMLUIProps<\"div\"> & 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 ...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\ntype 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 type CircleProgressProps = Omit<HTMLUIProps<\"div\">, \"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\ntype CircleProps = HTMLUIProps<\"circle\">\n\nconst Circle: FC<CircleProps> = ({ ...rest }) => (\n <ui.circle cx={50} cy={50} r={42} fill=\"transparent\" {...rest} />\n)\n\ntype ShapeProps = Omit<HTMLUIProps<\"svg\">, \"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;AA8F5C;AA3FN,IAAM,CAAC,kBAAkB,WAAW,QAAI,4BAEtC;AAAA,EACA,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA4DM,IAAM,eAAW,wBAAiC,CAAC,OAAO,QAAQ;AAnFzE;AAoFE,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,OAAO;AAAA,EACZ;AAEA,SACE,4CAAC,oBAAiB,OAAO,QACvB;AAAA,IAAC,eAAG;AAAA,IAAH;AAAA,MACC;AAAA,MACA,eAAW,iBAAG,eAAe,SAAS;AAAA,MACtC,OAAO;AAAA,MACP;AAAA,MACC,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;AAAA,QACC;AAAA;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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"]}
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CircleProgress,
4
4
  CircleProgressLabel
5
- } from "./chunk-GJAFLWEF.mjs";
5
+ } from "./chunk-I3YVVCGV.mjs";
6
6
  import {
7
7
  Progress
8
8
  } from "./chunk-2ERWECSP.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamada-ui/progress",
3
- "version": "2.0.0-next-20240729113003",
3
+ "version": "2.0.0-next-20240820160301",
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.11.0",
40
- "@yamada-ui/use-animation": "1.0.33",
41
- "@yamada-ui/use-token": "1.1.21",
42
- "@yamada-ui/use-value": "1.1.21",
43
- "@yamada-ui/utils": "1.3.2"
39
+ "@yamada-ui/core": "1.13.0-next-20240820160301",
40
+ "@yamada-ui/use-animation": "1.0.35-next-20240820160301",
41
+ "@yamada-ui/use-token": "1.1.23-next-20240820160301",
42
+ "@yamada-ui/use-value": "1.1.23-next-20240820160301",
43
+ "@yamada-ui/utils": "1.4.0-next-20240820160301"
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 { HTMLUIProps, CSSUIObject, CSSUIProps } from \"@yamada-ui/core\"\nimport { ui, forwardRef } from \"@yamada-ui/core\"\nimport { useAnimation } from \"@yamada-ui/use-animation\"\nimport { useToken } from \"@yamada-ui/use-token\"\nimport { useValue } from \"@yamada-ui/use-value\"\nimport { cx, valueToPercent } from \"@yamada-ui/utils\"\nimport type { FC } from \"react\"\n\ntype CircleProgressOptions = {\n /**\n * The CSS `box-size` property.\n *\n * @default '6rem'\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 type CircleProgressProps = Omit<HTMLUIProps<\"div\">, \"color\"> &\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 (\n {\n className,\n children,\n size = \"6rem\",\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 },\n ref,\n ) => {\n size = (useToken(\"sizes\", useValue(size)) ?? size) as string | number\n thickness = (useToken(\"sizes\", useValue(thickness)) ?? thickness) as\n | string\n | number\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 display: \"inline-block\",\n position: \"relative\",\n verticalAlign: \"middle\",\n fontSize: size,\n }\n\n const props: 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 size={size} 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 {...props}\n />\n </Shape>\n {children}\n </ui.div>\n )\n },\n)\n\ntype CircleProps = HTMLUIProps<\"circle\">\n\nconst Circle: FC<CircleProps> = ({ ...rest }) => (\n <ui.circle cx={50} cy={50} r={42} fill=\"transparent\" {...rest} />\n)\n\ntype ShapeProps = Omit<HTMLUIProps<\"svg\">, \"speed\"> &\n Pick<\n Required<CircleProgressProps>,\n \"children\" | \"size\" | \"isAnimation\" | \"speed\"\n >\n\nconst Shape: FC<ShapeProps> = ({ size, 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: size,\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":";;;AACA,SAAS,IAAI,kBAAkB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,IAAI,sBAAsB;AAsJ3B,SACE,KADF;AA5ED,IAAM,iBAAiB;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,cAAc;AAAA,IACd;AAAA,IACA,QAAQ,CAAC,QAAQ,IAAI;AAAA,IACrB,GAAG;AAAA,EACL,GACA,QACG;AAjGP;AAkGI,YAAQ,cAAS,SAAS,SAAS,IAAI,CAAC,MAAhC,YAAqC;AAC7C,iBAAa,cAAS,SAAS,SAAS,SAAS,CAAC,MAArC,YAA0C;AAIvD,UAAM,gBAAgB,UAAU,KAAK,CAAC;AACtC,UAAM,UAAU,eAAe,OAAO,KAAK,GAAG;AAE9C,UAAM,WAAW,CAAC,cAAc,UAAU,OAAO;AAEjD,UAAM,YAAY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