@cerberus-design/react 0.18.0 → 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.
Files changed (55) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +12 -5
  2. package/build/legacy/components/CircularProgress.cjs +92 -83
  3. package/build/legacy/components/CircularProgress.cjs.map +1 -1
  4. package/build/legacy/index.cjs +380 -378
  5. package/build/legacy/index.cjs.map +1 -1
  6. package/build/modern/_tsup-dts-rollup.d.ts +12 -5
  7. package/build/modern/{chunk-JFSCSAHD.js → chunk-25S67KZH.js} +4 -4
  8. package/build/modern/{chunk-URJ6JHLG.js → chunk-A5UXCB4L.js} +4 -4
  9. package/build/modern/{chunk-H2HP63H4.js → chunk-CJVKAGCJ.js} +4 -4
  10. package/build/modern/{chunk-TGY3RICC.js → chunk-KABRV6TB.js} +4 -4
  11. package/build/modern/chunk-PRV3HAK3.js +156 -0
  12. package/build/modern/chunk-PRV3HAK3.js.map +1 -0
  13. package/build/modern/{chunk-SDV6XUM6.js → chunk-RF4VKGOQ.js} +2 -2
  14. package/build/modern/{chunk-NYRNXRTZ.js → chunk-TS7PAQPV.js} +4 -4
  15. package/build/modern/{chunk-STCGFGTK.js → chunk-TV346AYO.js} +4 -4
  16. package/build/modern/{chunk-6DU5QBPR.js → chunk-UCVB2VOI.js} +4 -4
  17. package/build/modern/components/CircularProgress.js +2 -2
  18. package/build/modern/components/FileStatus.js +4 -4
  19. package/build/modern/components/Tag.js +2 -2
  20. package/build/modern/components/combobox/combobox.js +2 -2
  21. package/build/modern/components/combobox/index.js +2 -2
  22. package/build/modern/components/cta-dialog/index.js +5 -5
  23. package/build/modern/components/cta-dialog/provider.js +5 -5
  24. package/build/modern/components/date-picker/calendar.js +2 -2
  25. package/build/modern/components/date-picker/day-view.js +2 -2
  26. package/build/modern/components/date-picker/index.js +8 -8
  27. package/build/modern/components/date-picker/month-view.js +2 -2
  28. package/build/modern/components/date-picker/view-control-group.js +2 -2
  29. package/build/modern/components/date-picker/year-view.js +2 -2
  30. package/build/modern/components/deprecated/Label.js +1 -1
  31. package/build/modern/components/deprecated/NavMenuTrigger.js +2 -2
  32. package/build/modern/components/dialog/index.js +3 -3
  33. package/build/modern/components/field/index.js +3 -3
  34. package/build/modern/components/notifications/center.js +3 -3
  35. package/build/modern/components/notifications/index.js +4 -4
  36. package/build/modern/components/notifications/match-icon.js +2 -2
  37. package/build/modern/components/select/index.js +2 -2
  38. package/build/modern/components/select/select.js +2 -2
  39. package/build/modern/context/confirm-modal.js +3 -3
  40. package/build/modern/context/prompt-modal.js +4 -4
  41. package/build/modern/index.js +63 -63
  42. package/package.json +6 -7
  43. package/src/components/CircularProgress.tsx +79 -67
  44. package/build/modern/chunk-Q3LUIS3M.js +0 -153
  45. package/build/modern/chunk-Q3LUIS3M.js.map +0 -1
  46. package/src/.DS_Store +0 -0
  47. package/src/components/.DS_Store +0 -0
  48. /package/build/modern/{chunk-JFSCSAHD.js.map → chunk-25S67KZH.js.map} +0 -0
  49. /package/build/modern/{chunk-URJ6JHLG.js.map → chunk-A5UXCB4L.js.map} +0 -0
  50. /package/build/modern/{chunk-H2HP63H4.js.map → chunk-CJVKAGCJ.js.map} +0 -0
  51. /package/build/modern/{chunk-TGY3RICC.js.map → chunk-KABRV6TB.js.map} +0 -0
  52. /package/build/modern/{chunk-SDV6XUM6.js.map → chunk-RF4VKGOQ.js.map} +0 -0
  53. /package/build/modern/{chunk-NYRNXRTZ.js.map → chunk-TS7PAQPV.js.map} +0 -0
  54. /package/build/modern/{chunk-STCGFGTK.js.map → chunk-TV346AYO.js.map} +0 -0
  55. /package/build/modern/{chunk-6DU5QBPR.js.map → chunk-UCVB2VOI.js.map} +0 -0
@@ -1093,6 +1093,11 @@ declare interface CircularProgressProps extends SVGProps<SVGSVGElement> {
1093
1093
  * The background style of the CircularProgress
1094
1094
  */
1095
1095
  bgStyle?: 'filled' | 'transparent';
1096
+ /**
1097
+ * The size of the CircularProgress
1098
+ * @default '1.1em'
1099
+ */
1100
+ size?: string;
1096
1101
  }
1097
1102
  export { CircularProgressProps }
1098
1103
  export { CircularProgressProps as CircularProgressProps_alias_1 }
@@ -1447,8 +1452,6 @@ declare interface Conditions {
1447
1452
  "_isDropped": string
1448
1453
  /** `&:is([data-complete=true])` */
1449
1454
  "_isComplete": string
1450
- /** `&:is(:disabled, [disabled], [data-disabled], [aria-disabled])` */
1451
- "_disabled": string
1452
1455
  /** `&:is([data-readonly])` */
1453
1456
  "_dataReadOnly": string
1454
1457
  /** `&:is(:user-invalid, [aria-invalid], [data-invalid])` */
@@ -1457,6 +1460,8 @@ declare interface Conditions {
1457
1460
  "_groupInvalid": string
1458
1461
  /** `.group:is([data-checked="true"] &, [aria-checked="true"]) &` */
1459
1462
  "_groupChecked": string
1463
+ /** `&:is(:not([disabled]), [data-disabled=false])` */
1464
+ "_notDisabled": string
1460
1465
  /** `&:is([data-today=true], [data-date=today])` */
1461
1466
  "_today": string
1462
1467
  /** `&:is([data-past-day=true], [data-date=past])` */
@@ -1537,6 +1542,8 @@ declare interface Conditions {
1537
1542
  "_focusWithin": string
1538
1543
  /** `&:is(:focus-visible, [data-focus-visible])` */
1539
1544
  "_focusVisible": string
1545
+ /** `&:is(:disabled, [disabled], [data-disabled])` */
1546
+ "_disabled": string
1540
1547
  /** `&:is(:active, [data-active])` */
1541
1548
  "_active": string
1542
1549
  /** `&:visited` */
@@ -1872,15 +1879,15 @@ declare interface CssProperties extends PropertiesFallback<String_2 | Number_2>,
1872
1879
 
1873
1880
  declare type CssVarKeys = `--${CssVarName}`
1874
1881
 
1875
- declare type CssVarName = | AnyString
1882
+ declare type CssVarName = "font-display" | "font-sans" | "font-mono" | AnyString
1876
1883
 
1877
1884
  declare type CssVarProperties = {
1878
1885
  [key in CssVarKeys]?: CssVarValue
1879
1886
  }
1880
1887
 
1881
- declare type CssVars = `var(--${string})`
1888
+ declare type CssVars = "var(--font-display)" | "var(--font-sans)" | "var(--font-mono)"
1882
1889
 
1883
- declare type CssVarValue = ConditionalValue<Token | AnyString | (number & {})>
1890
+ declare type CssVarValue = ConditionalValue<Token | CssVars | AnyString | (number & {})>
1884
1891
 
1885
1892
  /**
1886
1893
  * This module provide utility functions for the cta modal.
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- "use client";
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -24,8 +23,7 @@ __export(CircularProgress_exports, {
24
23
  CircularProgress: () => CircularProgress
25
24
  });
26
25
  module.exports = __toCommonJS(CircularProgress_exports);
27
- var import_patterns = require("styled-system/patterns");
28
- var import_css = require("styled-system/css");
26
+ var import_recipes = require("styled-system/recipes");
29
27
 
30
28
  // src/components/Show.tsx
31
29
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -40,15 +38,31 @@ function Show(props) {
40
38
  return null;
41
39
  }
42
40
 
43
- // src/components/CircularProgress.tsx
41
+ // src/components/for.tsx
44
42
  var import_jsx_runtime2 = require("react/jsx-runtime");
43
+ function For(props) {
44
+ var _a;
45
+ if (!props.each || !props.each.length) {
46
+ return props.fallback || null;
47
+ }
48
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: (_a = props.each) == null ? void 0 : _a.map(props.children) });
49
+ }
50
+
51
+ // src/components/CircularProgress.tsx
52
+ var import_jsx_runtime3 = require("react/jsx-runtime");
45
53
  function CircularProgress(props) {
54
+ const { size = "1.1em" } = props;
55
+ const sizeProps = props.size ? {
56
+ height: size,
57
+ width: size
58
+ } : {};
46
59
  const strokeW = 14;
47
60
  const radius = `calc(50% * (1 - ${strokeW}/100))`;
48
61
  const status = props.syntax ?? "Done";
49
62
  const now = props.now >= 100 ? 100 : props.now;
50
63
  const bgStyle = props.bgStyle ?? "filled";
51
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
64
+ const styles = (0, import_recipes.circularProgress)();
65
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
52
66
  "div",
53
67
  {
54
68
  id: props.id,
@@ -56,39 +70,31 @@ function CircularProgress(props) {
56
70
  "aria-valuemin": 0,
57
71
  "aria-valuemax": 100,
58
72
  "aria-valuenow": now,
59
- className: (0, import_patterns.cq)({
60
- alignSelf: "stretch",
61
- flex: 1,
62
- m: "4px",
63
- position: "relative"
64
- }),
73
+ className: styles.root,
65
74
  role: "progressbar",
66
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
75
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
67
76
  "svg",
68
77
  {
69
78
  "data-complete": now === 100,
70
- className: (0, import_css.css)({
71
- display: "block",
72
- rounded: "full",
73
- transition: "all 0.5s ease"
74
- }),
79
+ className: styles.group,
75
80
  fill: "none",
76
81
  strokeLinecap: "round",
77
82
  strokeWidth: strokeW,
78
83
  viewBox: "0 0 100 100",
79
84
  xmlns: "http://www.w3.org/2000/svg",
85
+ ...sizeProps,
80
86
  children: [
81
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("title", { children: props.title }),
82
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("desc", { children: `${now}% ${status}` }),
83
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("linearGradient", { id: "gradient", children: [
84
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
87
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("title", { children: props.title }),
88
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("desc", { children: `${now}% ${status}` }),
89
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("linearGradient", { id: "gradient", children: [
90
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
85
91
  "stop",
86
92
  {
87
93
  offset: "0%",
88
94
  stopColor: "var(--cerberus-colors-data-viz-progress-start)"
89
95
  }
90
96
  ),
91
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
97
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
92
98
  "stop",
93
99
  {
94
100
  offset: "100%",
@@ -96,86 +102,89 @@ function CircularProgress(props) {
96
102
  }
97
103
  )
98
104
  ] }) }),
99
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: bgStyle === "filled", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
105
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Show, { when: bgStyle === "filled", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
100
106
  "circle",
101
107
  {
102
- className: (0, import_css.css)({
103
- fill: "page.surface.initial"
104
- }),
108
+ className: styles.base,
105
109
  cx: "50%",
106
110
  cy: "50%",
107
111
  r: `calc(50% * (1 - ${strokeW}/100))`,
108
112
  pathLength: "100"
109
113
  }
110
114
  ) }),
111
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
115
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
112
116
  "circle",
113
117
  {
114
- className: (0, import_css.css)({
115
- stroke: "page.bg.100"
116
- }),
118
+ className: styles.track,
117
119
  cx: "50%",
118
120
  cy: "50%",
119
121
  r: radius,
120
122
  pathLength: "100"
121
123
  }
122
124
  ),
123
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
124
- "circle",
125
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
126
+ Show,
125
127
  {
126
- "data-complete": now === 100,
127
- className: (0, import_css.css)({
128
- stroke: "url(#gradient)",
129
- transition: "stroke-dashoffset, stroke 0.5s ease",
130
- _isComplete: {
131
- stroke: "success.bg.initial"
128
+ when: now > 0,
129
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
130
+ "text",
131
+ {
132
+ "data-fallback": true,
133
+ className: styles.description,
134
+ x: "50%",
135
+ y: "27%",
136
+ dominantBaseline: "middle",
137
+ textAnchor: "middle",
138
+ textLength: "65%",
139
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(For, { each: status.split(" "), children: (word, idx) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tspan", { x: "50%", dy: "1.2em", children: word }, `${word}:${idx}`) })
132
140
  }
133
- }),
134
- cx: "50%",
135
- cy: "50%",
136
- fill: "none",
137
- r: radius,
138
- pathLength: "100",
139
- strokeDasharray: "100",
140
- strokeDashoffset: 100 - now,
141
- transform: "rotate(-90 50 50)"
141
+ ),
142
+ children: [
143
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
144
+ "circle",
145
+ {
146
+ "data-complete": now === 100,
147
+ className: styles.path,
148
+ cx: "50%",
149
+ cy: "50%",
150
+ fill: "none",
151
+ r: radius,
152
+ pathLength: "100",
153
+ strokeDasharray: "100",
154
+ strokeDashoffset: 100 - now,
155
+ transform: "rotate(-90 50 50)"
156
+ }
157
+ ),
158
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
159
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
160
+ "text",
161
+ {
162
+ className: styles.title,
163
+ x: "50%",
164
+ y: "47%",
165
+ dominantBaseline: "middle",
166
+ textAnchor: "middle",
167
+ children: [
168
+ now,
169
+ "%"
170
+ ]
171
+ }
172
+ ),
173
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
174
+ "text",
175
+ {
176
+ className: styles.description,
177
+ x: "50%",
178
+ y: "59%",
179
+ dominantBaseline: "middle",
180
+ textAnchor: "middle",
181
+ children: status
182
+ }
183
+ )
184
+ ] })
185
+ ]
142
186
  }
143
- ),
144
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { children: [
145
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
146
- "text",
147
- {
148
- className: (0, import_css.css)({
149
- fill: "page.text.initial",
150
- fontFamily: "mono",
151
- textStyle: "1.25rem"
152
- }),
153
- x: "50%",
154
- y: "47%",
155
- dominantBaseline: "middle",
156
- textAnchor: "middle",
157
- children: [
158
- now,
159
- "%"
160
- ]
161
- }
162
- ),
163
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
164
- "text",
165
- {
166
- className: (0, import_css.css)({
167
- fill: "page.text.100",
168
- fontSize: "0.5rem",
169
- fontWeight: 600
170
- }),
171
- x: "50%",
172
- y: "59%",
173
- dominantBaseline: "middle",
174
- textAnchor: "middle",
175
- children: status
176
- }
177
- )
178
- ] })
187
+ )
179
188
  ]
180
189
  }
181
190
  )
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/CircularProgress.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport { cq } from 'styled-system/patterns'\nimport { css } from 'styled-system/css'\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\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 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 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={cq({\n alignSelf: 'stretch',\n flex: 1,\n m: '4px',\n position: 'relative',\n })}\n role=\"progressbar\"\n >\n <svg\n data-complete={now === 100}\n className={css({\n display: 'block',\n rounded: 'full',\n transition: 'all 0.5s ease',\n })}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeWidth={strokeW}\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\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={css({\n fill: 'page.surface.initial',\n })}\n cx=\"50%\"\n cy=\"50%\"\n r={`calc(50% * (1 - ${strokeW}/100))`}\n pathLength=\"100\"\n />\n </Show>\n <circle\n className={css({\n stroke: 'page.bg.100',\n })}\n cx=\"50%\"\n cy=\"50%\"\n r={radius}\n pathLength=\"100\"\n />\n <circle\n data-complete={now === 100}\n className={css({\n stroke: 'url(#gradient)',\n transition: 'stroke-dashoffset, stroke 0.5s ease',\n _isComplete: {\n stroke: 'success.bg.initial',\n },\n })}\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={css({\n fill: 'page.text.initial',\n fontFamily: 'mono',\n textStyle: '1.25rem',\n })}\n x=\"50%\"\n y=\"47%\"\n dominantBaseline=\"middle\"\n textAnchor=\"middle\"\n >\n {now}%\n </text>\n <text\n className={css({\n fill: 'page.text.100',\n fontSize: '0.5rem',\n fontWeight: 600,\n })}\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","import { type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps<T> {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: T | boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show<T>(props: PropsWithChildren<ShowProps<T>>) {\n const { when, children, fallback } = props\n\n if (when) {\n return <>{children}</>\n }\n\n if (fallback) {\n return <>{fallback}</>\n }\n\n return null\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAAmB;AACnB,iBAAoB;;;AC6BT;AAJJ,SAAS,KAAQ,OAAwC;AAC9D,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AAErC,MAAI,MAAM;AACR,WAAO,2EAAG,UAAS;AAAA,EACrB;AAEA,MAAI,UAAU;AACZ,WAAO,2EAAG,oBAAS;AAAA,EACrB;AAEA,SAAO;AACT;;;AD8CQ,IAAAA,sBAAA;AAnCD,SAAS,iBAAiB,OAA8B;AAC7D,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,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI,MAAM;AAAA,MACV,cAAY,MAAM;AAAA,MAClB,iBAAe;AAAA,MACf,iBAAe;AAAA,MACf,iBAAe;AAAA,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aAAa;AAAA,oBACX,QAAQ;AAAA,kBACV;AAAA,gBACF,CAAC;AAAA,gBACD,IAAG;AAAA,gBACH,IAAG;AAAA,gBACH,MAAK;AAAA,gBACL,GAAG;AAAA,gBACH,YAAW;AAAA,gBACX,iBAAgB;AAAA,gBAChB,kBAAkB,MAAM;AAAA,gBACxB,WAAU;AAAA;AAAA,YACZ;AAAA,YAEA,8CAAC,OACC;AAAA;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAW,gBAAI;AAAA,oBACb,MAAM;AAAA,oBACN,YAAY;AAAA,oBACZ,WAAW;AAAA,kBACb,CAAC;AAAA,kBACD,GAAE;AAAA,kBACF,GAAE;AAAA,kBACF,kBAAiB;AAAA,kBACjB,YAAW;AAAA,kBAEV;AAAA;AAAA,oBAAI;AAAA;AAAA;AAAA,cACP;AAAA,cACA;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAW,gBAAI;AAAA,oBACb,MAAM;AAAA,oBACN,UAAU;AAAA,oBACV,YAAY;AAAA,kBACd,CAAC;AAAA,kBACD,GAAE;AAAA,kBACF,GAAE;AAAA,kBACF,kBAAiB;AAAA,kBACjB,YAAW;AAAA,kBAEV;AAAA;AAAA,cACH;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA;AAAA,EACF;AAEJ;","names":["import_jsx_runtime"]}
1
+ {"version":3,"sources":["../../../src/components/CircularProgress.tsx","../../../src/components/Show.tsx","../../../src/components/for.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","import { type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps<T> {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: T | boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show<T>(props: PropsWithChildren<ShowProps<T>>) {\n const { when, children, fallback } = props\n\n if (when) {\n return <>{children}</>\n }\n\n if (fallback) {\n return <>{fallback}</>\n }\n\n return null\n}\n","import type { ReactNode, JSX } from 'react'\n\nexport interface ForProps<T extends readonly unknown[], U extends JSX.Element> {\n /**\n * The array to iterate over.\n */\n each: T | undefined | null | false\n /**\n * The fallback to render when the array is empty.\n */\n fallback?: JSX.Element\n /**\n * The children to render for each item in the array.\n */\n children: (item: T[number], index: number) => U\n}\n\n/**\n * The For component is used to iterate over an array and render a list of\n * components or display a fallback when the array is empty.\n * Inspired by the `<For>` component from SolidJS.\n *\n * @example\n * ```tsx\n * <For each={['a', 'b', 'c']}>\n * {(item, index) => <div key={index}>{item}</div>}\n * </For>\n * ```\n */\nexport function For<T extends readonly unknown[], U extends JSX.Element>(\n props: ForProps<T, U>,\n) {\n if (!props.each || !props.each.length) {\n return props.fallback || null\n }\n\n return <>{props.each?.map(props.children) as ReactNode}</>\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiC;;;ACgCtB;AAJJ,SAAS,KAAQ,OAAwC;AAC9D,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AAErC,MAAI,MAAM;AACR,WAAO,2EAAG,UAAS;AAAA,EACrB;AAEA,MAAI,UAAU;AACZ,WAAO,2EAAG,oBAAS;AAAA,EACrB;AAEA,SAAO;AACT;;;ACJS,IAAAA,sBAAA;AAPF,SAAS,IACd,OACA;AA/BF;AAgCE,MAAI,CAAC,MAAM,QAAQ,CAAC,MAAM,KAAK,QAAQ;AACrC,WAAO,MAAM,YAAY;AAAA,EAC3B;AAEA,SAAO,6EAAG,sBAAM,SAAN,mBAAY,IAAI,MAAM,WAAuB;AACzD;;;AFsDQ,IAAAC,sBAAA;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,aAAS,iCAAiB;AAE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