@cerberus-design/react 0.18.1 → 0.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/legacy/_tsup-dts-rollup.d.cts +2 -0
- package/build/legacy/components/CircularProgress.cjs +81 -50
- package/build/legacy/components/CircularProgress.cjs.map +1 -1
- package/build/legacy/index.cjs +130 -107
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +2 -0
- package/build/modern/{chunk-URJ6JHLG.js → chunk-A5UXCB4L.js} +4 -4
- package/build/modern/{chunk-IE2HWT3I.js → chunk-PRV3HAK3.js} +65 -41
- package/build/modern/chunk-PRV3HAK3.js.map +1 -0
- package/build/modern/components/CircularProgress.js +2 -1
- package/build/modern/components/cta-dialog/index.js +2 -2
- package/build/modern/components/cta-dialog/provider.js +2 -2
- package/build/modern/index.js +5 -5
- package/package.json +3 -3
- package/src/components/CircularProgress.tsx +57 -33
- package/build/modern/chunk-IE2HWT3I.js.map +0 -1
- /package/build/modern/{chunk-URJ6JHLG.js.map → chunk-A5UXCB4L.js.map} +0 -0
|
@@ -1460,6 +1460,8 @@ declare interface Conditions {
|
|
|
1460
1460
|
"_groupInvalid": string
|
|
1461
1461
|
/** `.group:is([data-checked="true"] &, [aria-checked="true"]) &` */
|
|
1462
1462
|
"_groupChecked": string
|
|
1463
|
+
/** `&:is(:not([disabled]), [data-disabled=false])` */
|
|
1464
|
+
"_notDisabled": string
|
|
1463
1465
|
/** `&:is([data-today=true], [data-date=today])` */
|
|
1464
1466
|
"_today": string
|
|
1465
1467
|
/** `&:is([data-past-day=true], [data-date=past])` */
|
|
@@ -15,15 +15,15 @@ import {
|
|
|
15
15
|
DialogHeading,
|
|
16
16
|
DialogProvider
|
|
17
17
|
} from "./chunk-SSR3CWJZ.js";
|
|
18
|
-
import {
|
|
19
|
-
For
|
|
20
|
-
} from "./chunk-I5RGBB57.js";
|
|
21
18
|
import {
|
|
22
19
|
Avatar
|
|
23
20
|
} from "./chunk-CF4TCMJI.js";
|
|
24
21
|
import {
|
|
25
22
|
useCerberusContext
|
|
26
23
|
} from "./chunk-GITT5645.js";
|
|
24
|
+
import {
|
|
25
|
+
For
|
|
26
|
+
} from "./chunk-I5RGBB57.js";
|
|
27
27
|
import {
|
|
28
28
|
Show
|
|
29
29
|
} from "./chunk-VEAC4I3F.js";
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
CTAModal,
|
|
115
115
|
useCTAModal
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
117
|
+
//# sourceMappingURL=chunk-A5UXCB4L.js.map
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
For
|
|
3
|
+
} from "./chunk-I5RGBB57.js";
|
|
1
4
|
import {
|
|
2
5
|
Show
|
|
3
6
|
} from "./chunk-VEAC4I3F.js";
|
|
@@ -77,48 +80,69 @@ function CircularProgress(props) {
|
|
|
77
80
|
pathLength: "100"
|
|
78
81
|
}
|
|
79
82
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
|
|
83
|
+
/* @__PURE__ */ jsxs(
|
|
84
|
+
Show,
|
|
82
85
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
when: now > 0,
|
|
87
|
+
fallback: /* @__PURE__ */ jsx(
|
|
88
|
+
"text",
|
|
89
|
+
{
|
|
90
|
+
"data-fallback": true,
|
|
91
|
+
className: styles.description,
|
|
92
|
+
x: "50%",
|
|
93
|
+
y: "27%",
|
|
94
|
+
dominantBaseline: "middle",
|
|
95
|
+
textAnchor: "middle",
|
|
96
|
+
textLength: "65%",
|
|
97
|
+
children: /* @__PURE__ */ jsx(For, { each: status.split(" "), children: (word, idx) => /* @__PURE__ */ jsx("tspan", { x: "50%", dy: "1.2em", children: word }, `${word}:${idx}`) })
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ jsx(
|
|
102
|
+
"circle",
|
|
103
|
+
{
|
|
104
|
+
"data-complete": now === 100,
|
|
105
|
+
className: styles.path,
|
|
106
|
+
cx: "50%",
|
|
107
|
+
cy: "50%",
|
|
108
|
+
fill: "none",
|
|
109
|
+
r: radius,
|
|
110
|
+
pathLength: "100",
|
|
111
|
+
strokeDasharray: "100",
|
|
112
|
+
strokeDashoffset: 100 - now,
|
|
113
|
+
transform: "rotate(-90 50 50)"
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
/* @__PURE__ */ jsxs("g", { children: [
|
|
117
|
+
/* @__PURE__ */ jsxs(
|
|
118
|
+
"text",
|
|
119
|
+
{
|
|
120
|
+
className: styles.title,
|
|
121
|
+
x: "50%",
|
|
122
|
+
y: "47%",
|
|
123
|
+
dominantBaseline: "middle",
|
|
124
|
+
textAnchor: "middle",
|
|
125
|
+
children: [
|
|
126
|
+
now,
|
|
127
|
+
"%"
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
"text",
|
|
133
|
+
{
|
|
134
|
+
className: styles.description,
|
|
135
|
+
x: "50%",
|
|
136
|
+
y: "59%",
|
|
137
|
+
dominantBaseline: "middle",
|
|
138
|
+
textAnchor: "middle",
|
|
139
|
+
children: status
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
] })
|
|
143
|
+
]
|
|
93
144
|
}
|
|
94
|
-
)
|
|
95
|
-
/* @__PURE__ */ jsxs("g", { children: [
|
|
96
|
-
/* @__PURE__ */ jsxs(
|
|
97
|
-
"text",
|
|
98
|
-
{
|
|
99
|
-
className: styles.title,
|
|
100
|
-
x: "50%",
|
|
101
|
-
y: "47%",
|
|
102
|
-
dominantBaseline: "middle",
|
|
103
|
-
textAnchor: "middle",
|
|
104
|
-
children: [
|
|
105
|
-
now,
|
|
106
|
-
"%"
|
|
107
|
-
]
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
/* @__PURE__ */ jsx(
|
|
111
|
-
"text",
|
|
112
|
-
{
|
|
113
|
-
className: styles.description,
|
|
114
|
-
x: "50%",
|
|
115
|
-
y: "59%",
|
|
116
|
-
dominantBaseline: "middle",
|
|
117
|
-
textAnchor: "middle",
|
|
118
|
-
children: status
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
] })
|
|
145
|
+
)
|
|
122
146
|
]
|
|
123
147
|
}
|
|
124
148
|
)
|
|
@@ -129,4 +153,4 @@ function CircularProgress(props) {
|
|
|
129
153
|
export {
|
|
130
154
|
CircularProgress
|
|
131
155
|
};
|
|
132
|
-
//# sourceMappingURL=chunk-
|
|
156
|
+
//# sourceMappingURL=chunk-PRV3HAK3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/CircularProgress.tsx"],"sourcesContent":["import { circularProgress } from 'styled-system/recipes'\nimport type { SVGProps } from 'react'\nimport { Show } from './Show'\nimport { For } from './for'\n\n/**\n * This module contains the CircularProgress component.\n * @module\n */\n\nexport interface CircularProgressProps extends SVGProps<SVGSVGElement> {\n /**\n * A unique identifier for the progress bar. Required for accessibility.\n */\n id: string\n /**\n * A description label for the progress bar. Required for accessibility.\n */\n label: string\n /**\n * The current value of the CircularProgress\n */\n now: number\n /**\n * The title of the CircularProgress for a11y\n */\n title: string\n /**\n * What is shown below the now value (default: 'Done')\n */\n syntax?: string\n /**\n * The background style of the CircularProgress\n */\n bgStyle?: 'filled' | 'transparent'\n /**\n * The size of the CircularProgress\n * @default '1.1em'\n */\n size?: string\n}\n\n/**\n * The CircularProgress component is used to display a loading indicator.\n * @param props - SVG element attributes\n * @param props.now - The current value of the CircularProgress\n * @param props.title - The title of the CircularProgress for a11y\n * @param props.label - What is shown below the now value (default: 'Done')\n * @see https://cerberus.digitalu.design/react/progress-indicators\n * @example\n * ```tsx\n * <CircularProgress now={24} title=\"Course completion\" label=\"done\" />\n * ```\n */\nexport function CircularProgress(props: CircularProgressProps) {\n const { size = '1.1em' } = props\n const sizeProps = props.size\n ? {\n height: size,\n width: size,\n }\n : {}\n\n const strokeW: number = 14\n const radius = `calc(50% * (1 - ${strokeW}/100))`\n const status: string = props.syntax ?? 'Done'\n const now: number = props.now >= 100 ? 100 : props.now\n const bgStyle: string = props.bgStyle ?? 'filled'\n\n const styles = circularProgress()\n\n return (\n <div\n id={props.id}\n aria-label={props.label}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={now}\n className={styles.root}\n role=\"progressbar\"\n >\n <svg\n data-complete={now === 100}\n className={styles.group}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeWidth={strokeW}\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...sizeProps}\n >\n <title>{props.title}</title>\n <desc>{`${now}% ${status}`}</desc>\n\n <defs>\n <linearGradient id=\"gradient\">\n <stop\n offset=\"0%\"\n stopColor=\"var(--cerberus-colors-data-viz-progress-start)\"\n />\n <stop\n offset=\"100%\"\n stopColor=\"var(--cerberus-colors-data-viz-progress-end)\"\n />\n </linearGradient>\n </defs>\n\n <Show when={bgStyle === 'filled'}>\n <circle\n className={styles.base}\n cx=\"50%\"\n cy=\"50%\"\n r={`calc(50% * (1 - ${strokeW}/100))`}\n pathLength=\"100\"\n />\n </Show>\n\n <circle\n className={styles.track}\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n pathLength=\"100\"\n />\n\n <Show\n when={now > 0}\n fallback={\n <text\n data-fallback\n className={styles.description}\n x=\"50%\"\n y=\"27%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n textLength=\"65%\"\n >\n <For each={status.split(' ')}>\n {(word, idx) => (\n <tspan key={`${word}:${idx}`} x=\"50%\" dy=\"1.2em\">\n {word}\n </tspan>\n )}\n </For>\n </text>\n }\n >\n <circle\n data-complete={now === 100}\n className={styles.path}\n cx=\"50%\"\n cy=\"50%\"\n fill=\"none\"\n r={radius}\n pathLength=\"100\"\n strokeDasharray=\"100\"\n strokeDashoffset={100 - now}\n transform=\"rotate(-90 50 50)\"\n />\n <g>\n <text\n className={styles.title}\n x=\"50%\"\n y=\"47%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {now}%\n </text>\n <text\n className={styles.description}\n x=\"50%\"\n y=\"59%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {status}\n </text>\n </g>\n </Show>\n </svg>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,wBAAwB;AA2FzB,cAIE,YAJF;AArCD,SAAS,iBAAiB,OAA8B;AAC7D,QAAM,EAAE,OAAO,QAAQ,IAAI;AAC3B,QAAM,YAAY,MAAM,OACpB;AAAA,IACE,QAAQ;AAAA,IACR,OAAO;AAAA,EACT,IACA,CAAC;AAEL,QAAM,UAAkB;AACxB,QAAM,SAAS,mBAAmB,OAAO;AACzC,QAAM,SAAiB,MAAM,UAAU;AACvC,QAAM,MAAc,MAAM,OAAO,MAAM,MAAM,MAAM;AACnD,QAAM,UAAkB,MAAM,WAAW;AAEzC,QAAM,SAAS,iBAAiB;AAEhC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,MAAM;AAAA,MACV,cAAY,MAAM;AAAA,MAClB,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,OAAO;AAAA,MAClB,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACC,iBAAe,QAAQ;AAAA,UACvB,WAAW,OAAO;AAAA,UAClB,MAAK;AAAA,UACL,eAAc;AAAA,UACd,aAAa;AAAA,UACb,SAAQ;AAAA,UACR,OAAM;AAAA,UACL,GAAG;AAAA,UAEJ;AAAA,gCAAC,WAAO,gBAAM,OAAM;AAAA,YACpB,oBAAC,UAAM,aAAG,GAAG,KAAK,MAAM,IAAG;AAAA,YAE3B,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AAAA,kBACA,qBAAC,OACC;AAAA;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAW,OAAO;AAAA,wBAClB,GAAE;AAAA,wBACF,GAAE;AAAA,wBACF,kBAAiB;AAAA,wBACjB,YAAW;AAAA,wBAEV;AAAA;AAAA,0BAAI;AAAA;AAAA;AAAA,oBACP;AAAA,oBACA;AAAA,sBAAC;AAAA;AAAA,wBACC,WAAW,OAAO;AAAA,wBAClB,GAAE;AAAA,wBACF,GAAE;AAAA,wBACF,kBAAiB;AAAA,wBACjB,YAAW;AAAA,wBAEV;AAAA;AAAA,oBACH;AAAA,qBACF;AAAA;AAAA;AAAA,YACF;AAAA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -2,7 +2,7 @@ import "../../chunk-IKDXADLX.js";
|
|
|
2
2
|
import {
|
|
3
3
|
CTAModal,
|
|
4
4
|
useCTAModal
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-A5UXCB4L.js";
|
|
6
6
|
import "../../chunk-4LSTU6WU.js";
|
|
7
7
|
import "../../chunk-QD3WAARV.js";
|
|
8
8
|
import {
|
|
@@ -14,7 +14,6 @@ import "../../chunk-Z2KBUTCO.js";
|
|
|
14
14
|
import "../../chunk-V6EAWUCQ.js";
|
|
15
15
|
import "../../chunk-SSR3CWJZ.js";
|
|
16
16
|
import "../../chunk-GB7W3YNU.js";
|
|
17
|
-
import "../../chunk-I5RGBB57.js";
|
|
18
17
|
import "../../chunk-CF4TCMJI.js";
|
|
19
18
|
import "../../chunk-IUF74GEL.js";
|
|
20
19
|
import "../../chunk-UGFSACHC.js";
|
|
@@ -24,6 +23,7 @@ import "../../chunk-GITT5645.js";
|
|
|
24
23
|
import "../../chunk-UH6XSYYD.js";
|
|
25
24
|
import "../../chunk-53YVHIGJ.js";
|
|
26
25
|
import "../../chunk-AUI74W7J.js";
|
|
26
|
+
import "../../chunk-I5RGBB57.js";
|
|
27
27
|
import "../../chunk-VEAC4I3F.js";
|
|
28
28
|
export {
|
|
29
29
|
CTAModal,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
CTAModal,
|
|
4
4
|
useCTAModal
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-A5UXCB4L.js";
|
|
6
6
|
import "../../chunk-4LSTU6WU.js";
|
|
7
7
|
import "../../chunk-QD3WAARV.js";
|
|
8
8
|
import "../../chunk-DJOYRUNT.js";
|
|
@@ -11,7 +11,6 @@ import "../../chunk-Z2KBUTCO.js";
|
|
|
11
11
|
import "../../chunk-V6EAWUCQ.js";
|
|
12
12
|
import "../../chunk-SSR3CWJZ.js";
|
|
13
13
|
import "../../chunk-GB7W3YNU.js";
|
|
14
|
-
import "../../chunk-I5RGBB57.js";
|
|
15
14
|
import "../../chunk-CF4TCMJI.js";
|
|
16
15
|
import "../../chunk-IUF74GEL.js";
|
|
17
16
|
import "../../chunk-UGFSACHC.js";
|
|
@@ -21,6 +20,7 @@ import "../../chunk-GITT5645.js";
|
|
|
21
20
|
import "../../chunk-UH6XSYYD.js";
|
|
22
21
|
import "../../chunk-53YVHIGJ.js";
|
|
23
22
|
import "../../chunk-AUI74W7J.js";
|
|
23
|
+
import "../../chunk-I5RGBB57.js";
|
|
24
24
|
import "../../chunk-VEAC4I3F.js";
|
|
25
25
|
export {
|
|
26
26
|
CTAModal,
|
package/build/modern/index.js
CHANGED
|
@@ -169,7 +169,7 @@ import "./chunk-IKDXADLX.js";
|
|
|
169
169
|
import {
|
|
170
170
|
CTAModal,
|
|
171
171
|
useCTAModal
|
|
172
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-A5UXCB4L.js";
|
|
173
173
|
import "./chunk-4LSTU6WU.js";
|
|
174
174
|
import "./chunk-QD3WAARV.js";
|
|
175
175
|
import {
|
|
@@ -385,9 +385,6 @@ import {
|
|
|
385
385
|
import {
|
|
386
386
|
Tooltip
|
|
387
387
|
} from "./chunk-L2EGF5AV.js";
|
|
388
|
-
import {
|
|
389
|
-
For
|
|
390
|
-
} from "./chunk-I5RGBB57.js";
|
|
391
388
|
import {
|
|
392
389
|
makeSystemConfig
|
|
393
390
|
} from "./chunk-KDDPAJMR.js";
|
|
@@ -481,7 +478,10 @@ import {
|
|
|
481
478
|
import "./chunk-VV2G62UD.js";
|
|
482
479
|
import {
|
|
483
480
|
CircularProgress
|
|
484
|
-
} from "./chunk-
|
|
481
|
+
} from "./chunk-PRV3HAK3.js";
|
|
482
|
+
import {
|
|
483
|
+
For
|
|
484
|
+
} from "./chunk-I5RGBB57.js";
|
|
485
485
|
import {
|
|
486
486
|
Droppable
|
|
487
487
|
} from "./chunk-TKI2CKHH.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@microsoft/api-extractor": "^7.46.2",
|
|
21
21
|
"@pandacss/dev": "^0.53.2",
|
|
22
|
-
"@types/react": "^19.0.
|
|
22
|
+
"@types/react": "^19.0.12",
|
|
23
23
|
"@types/react-dom": "^19.0.4",
|
|
24
24
|
"react": "^19.0.0",
|
|
25
25
|
"react-dom": "^19.0.0",
|
|
26
26
|
"tsup": "^8.4.0",
|
|
27
27
|
"@cerberus-design/configs": "0.0.0",
|
|
28
|
-
"@cerberus-design/panda-preset": "0.18.
|
|
28
|
+
"@cerberus-design/panda-preset": "0.18.2"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { circularProgress } from 'styled-system/recipes'
|
|
2
2
|
import type { SVGProps } from 'react'
|
|
3
3
|
import { Show } from './Show'
|
|
4
|
+
import { For } from './for'
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* This module contains the CircularProgress component.
|
|
@@ -90,6 +91,7 @@ export function CircularProgress(props: CircularProgressProps) {
|
|
|
90
91
|
>
|
|
91
92
|
<title>{props.title}</title>
|
|
92
93
|
<desc>{`${now}% ${status}`}</desc>
|
|
94
|
+
|
|
93
95
|
<defs>
|
|
94
96
|
<linearGradient id="gradient">
|
|
95
97
|
<stop
|
|
@@ -121,39 +123,61 @@ export function CircularProgress(props: CircularProgressProps) {
|
|
|
121
123
|
pathLength="100"
|
|
122
124
|
/>
|
|
123
125
|
|
|
124
|
-
<
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
className={styles.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
126
|
+
<Show
|
|
127
|
+
when={now > 0}
|
|
128
|
+
fallback={
|
|
129
|
+
<text
|
|
130
|
+
data-fallback
|
|
131
|
+
className={styles.description}
|
|
132
|
+
x="50%"
|
|
133
|
+
y="27%"
|
|
134
|
+
dominantBaseline="middle"
|
|
135
|
+
textAnchor="middle"
|
|
136
|
+
textLength="65%"
|
|
137
|
+
>
|
|
138
|
+
<For each={status.split(' ')}>
|
|
139
|
+
{(word, idx) => (
|
|
140
|
+
<tspan key={`${word}:${idx}`} x="50%" dy="1.2em">
|
|
141
|
+
{word}
|
|
142
|
+
</tspan>
|
|
143
|
+
)}
|
|
144
|
+
</For>
|
|
145
|
+
</text>
|
|
146
|
+
}
|
|
147
|
+
>
|
|
148
|
+
<circle
|
|
149
|
+
data-complete={now === 100}
|
|
150
|
+
className={styles.path}
|
|
151
|
+
cx="50%"
|
|
152
|
+
cy="50%"
|
|
153
|
+
fill="none"
|
|
154
|
+
r={radius}
|
|
155
|
+
pathLength="100"
|
|
156
|
+
strokeDasharray="100"
|
|
157
|
+
strokeDashoffset={100 - now}
|
|
158
|
+
transform="rotate(-90 50 50)"
|
|
159
|
+
/>
|
|
160
|
+
<g>
|
|
161
|
+
<text
|
|
162
|
+
className={styles.title}
|
|
163
|
+
x="50%"
|
|
164
|
+
y="47%"
|
|
165
|
+
dominantBaseline="middle"
|
|
166
|
+
textAnchor="middle"
|
|
167
|
+
>
|
|
168
|
+
{now}%
|
|
169
|
+
</text>
|
|
170
|
+
<text
|
|
171
|
+
className={styles.description}
|
|
172
|
+
x="50%"
|
|
173
|
+
y="59%"
|
|
174
|
+
dominantBaseline="middle"
|
|
175
|
+
textAnchor="middle"
|
|
176
|
+
>
|
|
177
|
+
{status}
|
|
178
|
+
</text>
|
|
179
|
+
</g>
|
|
180
|
+
</Show>
|
|
157
181
|
</svg>
|
|
158
182
|
</div>
|
|
159
183
|
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/CircularProgress.tsx"],"sourcesContent":["import { circularProgress } from 'styled-system/recipes'\nimport type { SVGProps } from 'react'\nimport { Show } from './Show'\n\n/**\n * This module contains the CircularProgress component.\n * @module\n */\n\nexport interface CircularProgressProps extends SVGProps<SVGSVGElement> {\n /**\n * A unique identifier for the progress bar. Required for accessibility.\n */\n id: string\n /**\n * A description label for the progress bar. Required for accessibility.\n */\n label: string\n /**\n * The current value of the CircularProgress\n */\n now: number\n /**\n * The title of the CircularProgress for a11y\n */\n title: string\n /**\n * What is shown below the now value (default: 'Done')\n */\n syntax?: string\n /**\n * The background style of the CircularProgress\n */\n bgStyle?: 'filled' | 'transparent'\n /**\n * The size of the CircularProgress\n * @default '1.1em'\n */\n size?: string\n}\n\n/**\n * The CircularProgress component is used to display a loading indicator.\n * @param props - SVG element attributes\n * @param props.now - The current value of the CircularProgress\n * @param props.title - The title of the CircularProgress for a11y\n * @param props.label - What is shown below the now value (default: 'Done')\n * @see https://cerberus.digitalu.design/react/progress-indicators\n * @example\n * ```tsx\n * <CircularProgress now={24} title=\"Course completion\" label=\"done\" />\n * ```\n */\nexport function CircularProgress(props: CircularProgressProps) {\n const { size = '1.1em' } = props\n const sizeProps = props.size\n ? {\n height: size,\n width: size,\n }\n : {}\n\n const strokeW: number = 14\n const radius = `calc(50% * (1 - ${strokeW}/100))`\n const status: string = props.syntax ?? 'Done'\n const now: number = props.now >= 100 ? 100 : props.now\n const bgStyle: string = props.bgStyle ?? 'filled'\n\n const styles = circularProgress()\n\n return (\n <div\n id={props.id}\n aria-label={props.label}\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={now}\n className={styles.root}\n role=\"progressbar\"\n >\n <svg\n data-complete={now === 100}\n className={styles.group}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeWidth={strokeW}\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...sizeProps}\n >\n <title>{props.title}</title>\n <desc>{`${now}% ${status}`}</desc>\n <defs>\n <linearGradient id=\"gradient\">\n <stop\n offset=\"0%\"\n stopColor=\"var(--cerberus-colors-data-viz-progress-start)\"\n />\n <stop\n offset=\"100%\"\n stopColor=\"var(--cerberus-colors-data-viz-progress-end)\"\n />\n </linearGradient>\n </defs>\n\n <Show when={bgStyle === 'filled'}>\n <circle\n className={styles.base}\n cx=\"50%\"\n cy=\"50%\"\n r={`calc(50% * (1 - ${strokeW}/100))`}\n pathLength=\"100\"\n />\n </Show>\n\n <circle\n className={styles.track}\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n pathLength=\"100\"\n />\n\n <circle\n data-complete={now === 100}\n className={styles.path}\n cx=\"50%\"\n cy=\"50%\"\n fill=\"none\"\n r={radius}\n pathLength=\"100\"\n strokeDasharray=\"100\"\n strokeDashoffset={100 - now}\n transform=\"rotate(-90 50 50)\"\n />\n\n <g>\n <text\n className={styles.title}\n x=\"50%\"\n y=\"47%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {now}%\n </text>\n <text\n className={styles.description}\n x=\"50%\"\n y=\"59%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {status}\n </text>\n </g>\n </svg>\n </div>\n )\n}\n"],"mappings":";;;;;AAAA,SAAS,wBAAwB;AA0FzB,cAGE,YAHF;AArCD,SAAS,iBAAiB,OAA8B;AAC7D,QAAM,EAAE,OAAO,QAAQ,IAAI;AAC3B,QAAM,YAAY,MAAM,OACpB;AAAA,IACE,QAAQ;AAAA,IACR,OAAO;AAAA,EACT,IACA,CAAC;AAEL,QAAM,UAAkB;AACxB,QAAM,SAAS,mBAAmB,OAAO;AACzC,QAAM,SAAiB,MAAM,UAAU;AACvC,QAAM,MAAc,MAAM,OAAO,MAAM,MAAM,MAAM;AACnD,QAAM,UAAkB,MAAM,WAAW;AAEzC,QAAM,SAAS,iBAAiB;AAEhC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,MAAM;AAAA,MACV,cAAY,MAAM;AAAA,MAClB,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,WAAW,OAAO;AAAA,MAClB,MAAK;AAAA,MAEL;AAAA,QAAC;AAAA;AAAA,UACC,iBAAe,QAAQ;AAAA,UACvB,WAAW,OAAO;AAAA,UAClB,MAAK;AAAA,UACL,eAAc;AAAA,UACd,aAAa;AAAA,UACb,SAAQ;AAAA,UACR,OAAM;AAAA,UACL,GAAG;AAAA,UAEJ;AAAA,gCAAC,WAAO,gBAAM,OAAM;AAAA,YACpB,oBAAC,UAAM,aAAG,GAAG,KAAK,MAAM,IAAG;AAAA,YAC3B,oBAAC,UACC,+BAAC,oBAAe,IAAG,YACjB;AAAA;AAAA,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