@cerberus-design/react 0.18.0 → 0.18.1
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 +10 -5
- package/build/legacy/components/CircularProgress.cjs +15 -37
- package/build/legacy/components/CircularProgress.cjs.map +1 -1
- package/build/legacy/index.cjs +259 -280
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +10 -5
- package/build/modern/{chunk-JFSCSAHD.js → chunk-25S67KZH.js} +4 -4
- package/build/modern/{chunk-H2HP63H4.js → chunk-CJVKAGCJ.js} +4 -4
- package/build/modern/{chunk-Q3LUIS3M.js → chunk-IE2HWT3I.js} +16 -37
- package/build/modern/chunk-IE2HWT3I.js.map +1 -0
- package/build/modern/{chunk-TGY3RICC.js → chunk-KABRV6TB.js} +4 -4
- package/build/modern/{chunk-SDV6XUM6.js → chunk-RF4VKGOQ.js} +2 -2
- package/build/modern/{chunk-NYRNXRTZ.js → chunk-TS7PAQPV.js} +4 -4
- package/build/modern/{chunk-STCGFGTK.js → chunk-TV346AYO.js} +4 -4
- package/build/modern/{chunk-6DU5QBPR.js → chunk-UCVB2VOI.js} +4 -4
- package/build/modern/components/CircularProgress.js +1 -2
- package/build/modern/components/FileStatus.js +4 -4
- package/build/modern/components/Tag.js +2 -2
- package/build/modern/components/combobox/combobox.js +2 -2
- package/build/modern/components/combobox/index.js +2 -2
- package/build/modern/components/cta-dialog/index.js +3 -3
- package/build/modern/components/cta-dialog/provider.js +3 -3
- package/build/modern/components/date-picker/calendar.js +2 -2
- package/build/modern/components/date-picker/day-view.js +2 -2
- package/build/modern/components/date-picker/index.js +8 -8
- package/build/modern/components/date-picker/month-view.js +2 -2
- package/build/modern/components/date-picker/view-control-group.js +2 -2
- package/build/modern/components/date-picker/year-view.js +2 -2
- package/build/modern/components/deprecated/Label.js +1 -1
- package/build/modern/components/deprecated/NavMenuTrigger.js +2 -2
- package/build/modern/components/dialog/index.js +3 -3
- package/build/modern/components/field/index.js +3 -3
- package/build/modern/components/notifications/center.js +3 -3
- package/build/modern/components/notifications/index.js +4 -4
- package/build/modern/components/notifications/match-icon.js +2 -2
- package/build/modern/components/select/index.js +2 -2
- package/build/modern/components/select/select.js +2 -2
- package/build/modern/context/confirm-modal.js +3 -3
- package/build/modern/context/prompt-modal.js +4 -4
- package/build/modern/index.js +60 -60
- package/package.json +5 -6
- package/src/components/CircularProgress.tsx +26 -38
- package/build/modern/chunk-Q3LUIS3M.js.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- /package/build/modern/{chunk-JFSCSAHD.js.map → chunk-25S67KZH.js.map} +0 -0
- /package/build/modern/{chunk-H2HP63H4.js.map → chunk-CJVKAGCJ.js.map} +0 -0
- /package/build/modern/{chunk-TGY3RICC.js.map → chunk-KABRV6TB.js.map} +0 -0
- /package/build/modern/{chunk-SDV6XUM6.js.map → chunk-RF4VKGOQ.js.map} +0 -0
- /package/build/modern/{chunk-NYRNXRTZ.js.map → chunk-TS7PAQPV.js.map} +0 -0
- /package/build/modern/{chunk-STCGFGTK.js.map → chunk-TV346AYO.js.map} +0 -0
- /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])` */
|
|
@@ -1537,6 +1540,8 @@ declare interface Conditions {
|
|
|
1537
1540
|
"_focusWithin": string
|
|
1538
1541
|
/** `&:is(:focus-visible, [data-focus-visible])` */
|
|
1539
1542
|
"_focusVisible": string
|
|
1543
|
+
/** `&:is(:disabled, [disabled], [data-disabled])` */
|
|
1544
|
+
"_disabled": string
|
|
1540
1545
|
/** `&:is(:active, [data-active])` */
|
|
1541
1546
|
"_active": string
|
|
1542
1547
|
/** `&:visited` */
|
|
@@ -1872,15 +1877,15 @@ declare interface CssProperties extends PropertiesFallback<String_2 | Number_2>,
|
|
|
1872
1877
|
|
|
1873
1878
|
declare type CssVarKeys = `--${CssVarName}`
|
|
1874
1879
|
|
|
1875
|
-
declare type CssVarName =
|
|
1880
|
+
declare type CssVarName = "font-display" | "font-sans" | "font-mono" | AnyString
|
|
1876
1881
|
|
|
1877
1882
|
declare type CssVarProperties = {
|
|
1878
1883
|
[key in CssVarKeys]?: CssVarValue
|
|
1879
1884
|
}
|
|
1880
1885
|
|
|
1881
|
-
declare type CssVars =
|
|
1886
|
+
declare type CssVars = "var(--font-display)" | "var(--font-sans)" | "var(--font-mono)"
|
|
1882
1887
|
|
|
1883
|
-
declare type CssVarValue = ConditionalValue<Token | AnyString | (number & {})>
|
|
1888
|
+
declare type CssVarValue = ConditionalValue<Token | CssVars | AnyString | (number & {})>
|
|
1884
1889
|
|
|
1885
1890
|
/**
|
|
1886
1891
|
* 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
|
|
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");
|
|
@@ -43,11 +41,17 @@ function Show(props) {
|
|
|
43
41
|
// src/components/CircularProgress.tsx
|
|
44
42
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
45
43
|
function CircularProgress(props) {
|
|
44
|
+
const { size = "1.1em" } = props;
|
|
45
|
+
const sizeProps = props.size ? {
|
|
46
|
+
height: size,
|
|
47
|
+
width: size
|
|
48
|
+
} : {};
|
|
46
49
|
const strokeW = 14;
|
|
47
50
|
const radius = `calc(50% * (1 - ${strokeW}/100))`;
|
|
48
51
|
const status = props.syntax ?? "Done";
|
|
49
52
|
const now = props.now >= 100 ? 100 : props.now;
|
|
50
53
|
const bgStyle = props.bgStyle ?? "filled";
|
|
54
|
+
const styles = (0, import_recipes.circularProgress)();
|
|
51
55
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
52
56
|
"div",
|
|
53
57
|
{
|
|
@@ -56,27 +60,19 @@ function CircularProgress(props) {
|
|
|
56
60
|
"aria-valuemin": 0,
|
|
57
61
|
"aria-valuemax": 100,
|
|
58
62
|
"aria-valuenow": now,
|
|
59
|
-
className:
|
|
60
|
-
alignSelf: "stretch",
|
|
61
|
-
flex: 1,
|
|
62
|
-
m: "4px",
|
|
63
|
-
position: "relative"
|
|
64
|
-
}),
|
|
63
|
+
className: styles.root,
|
|
65
64
|
role: "progressbar",
|
|
66
65
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
67
66
|
"svg",
|
|
68
67
|
{
|
|
69
68
|
"data-complete": now === 100,
|
|
70
|
-
className:
|
|
71
|
-
display: "block",
|
|
72
|
-
rounded: "full",
|
|
73
|
-
transition: "all 0.5s ease"
|
|
74
|
-
}),
|
|
69
|
+
className: styles.group,
|
|
75
70
|
fill: "none",
|
|
76
71
|
strokeLinecap: "round",
|
|
77
72
|
strokeWidth: strokeW,
|
|
78
73
|
viewBox: "0 0 100 100",
|
|
79
74
|
xmlns: "http://www.w3.org/2000/svg",
|
|
75
|
+
...sizeProps,
|
|
80
76
|
children: [
|
|
81
77
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("title", { children: props.title }),
|
|
82
78
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("desc", { children: `${now}% ${status}` }),
|
|
@@ -99,9 +95,7 @@ function CircularProgress(props) {
|
|
|
99
95
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Show, { when: bgStyle === "filled", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
100
96
|
"circle",
|
|
101
97
|
{
|
|
102
|
-
className:
|
|
103
|
-
fill: "page.surface.initial"
|
|
104
|
-
}),
|
|
98
|
+
className: styles.base,
|
|
105
99
|
cx: "50%",
|
|
106
100
|
cy: "50%",
|
|
107
101
|
r: `calc(50% * (1 - ${strokeW}/100))`,
|
|
@@ -111,9 +105,7 @@ function CircularProgress(props) {
|
|
|
111
105
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
112
106
|
"circle",
|
|
113
107
|
{
|
|
114
|
-
className:
|
|
115
|
-
stroke: "page.bg.100"
|
|
116
|
-
}),
|
|
108
|
+
className: styles.track,
|
|
117
109
|
cx: "50%",
|
|
118
110
|
cy: "50%",
|
|
119
111
|
r: radius,
|
|
@@ -124,13 +116,7 @@ function CircularProgress(props) {
|
|
|
124
116
|
"circle",
|
|
125
117
|
{
|
|
126
118
|
"data-complete": now === 100,
|
|
127
|
-
className:
|
|
128
|
-
stroke: "url(#gradient)",
|
|
129
|
-
transition: "stroke-dashoffset, stroke 0.5s ease",
|
|
130
|
-
_isComplete: {
|
|
131
|
-
stroke: "success.bg.initial"
|
|
132
|
-
}
|
|
133
|
-
}),
|
|
119
|
+
className: styles.path,
|
|
134
120
|
cx: "50%",
|
|
135
121
|
cy: "50%",
|
|
136
122
|
fill: "none",
|
|
@@ -145,11 +131,7 @@ function CircularProgress(props) {
|
|
|
145
131
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
146
132
|
"text",
|
|
147
133
|
{
|
|
148
|
-
className:
|
|
149
|
-
fill: "page.text.initial",
|
|
150
|
-
fontFamily: "mono",
|
|
151
|
-
textStyle: "1.25rem"
|
|
152
|
-
}),
|
|
134
|
+
className: styles.title,
|
|
153
135
|
x: "50%",
|
|
154
136
|
y: "47%",
|
|
155
137
|
dominantBaseline: "middle",
|
|
@@ -163,11 +145,7 @@ function CircularProgress(props) {
|
|
|
163
145
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
164
146
|
"text",
|
|
165
147
|
{
|
|
166
|
-
className:
|
|
167
|
-
fill: "page.text.100",
|
|
168
|
-
fontSize: "0.5rem",
|
|
169
|
-
fontWeight: 600
|
|
170
|
-
}),
|
|
148
|
+
className: styles.description,
|
|
171
149
|
x: "50%",
|
|
172
150
|
y: "59%",
|
|
173
151
|
dominantBaseline: "middle",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CircularProgress.tsx","../../../src/components/Show.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/CircularProgress.tsx","../../../src/components/Show.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","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;AAAA,qBAAiC;;;ACgCtB;AAJJ,SAAS,KAAQ,OAAwC;AAC9D,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AAErC,MAAI,MAAM;AACR,WAAO,2EAAG,UAAS;AAAA,EACrB;A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