shared-design-system 1.78.0 → 1.80.0
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/dist/src/components/Breadcrumbs.d.ts +2 -2
- package/dist/src/components/Breadcrumbs.js +34 -29
- package/dist/src/components/Breadcrumbs.js.map +1 -1
- package/dist/src/components/Button.d.ts +4 -3
- package/dist/src/components/Button.js +71 -41
- package/dist/src/components/Button.js.map +1 -1
- package/dist/src/components/LoadingSpinner.d.ts +3 -3
- package/dist/src/components/LoadingSpinner.js +26 -24
- package/dist/src/components/LoadingSpinner.js.map +1 -1
- package/dist/src/components/Progress.d.ts +3 -3
- package/dist/src/components/Progress.js +36 -28
- package/dist/src/components/Progress.js.map +1 -1
- package/dist/src/components/Radio.d.ts +5 -5
- package/dist/src/components/Radio.js +41 -34
- package/dist/src/components/Radio.js.map +1 -1
- package/dist/src/components/ReadOnlyField.d.ts +2 -2
- package/dist/src/components/ReadOnlyField.js +52 -37
- package/dist/src/components/ReadOnlyField.js.map +1 -1
- package/dist/src/components/Statistic.d.ts +1 -1
- package/dist/src/components/Statistic.js +30 -11
- package/dist/src/components/Statistic.js.map +1 -1
- package/dist/src/components/Steps.d.ts +4 -4
- package/dist/src/components/Steps.js +81 -50
- package/dist/src/components/Steps.js.map +1 -1
- package/dist/src/components/Typography.js +4 -4
- package/dist/src/components/Typography.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface BreadcrumbItem {
|
|
3
3
|
label: React.ReactNode;
|
|
4
4
|
icon?: React.ReactNode;
|
|
@@ -7,7 +7,7 @@ export interface BreadcrumbItem {
|
|
|
7
7
|
export interface BreadcrumbsProps extends React.HTMLAttributes<HTMLElement> {
|
|
8
8
|
items: BreadcrumbItem[];
|
|
9
9
|
separator?: React.ReactNode;
|
|
10
|
-
size?:
|
|
10
|
+
size?: "sm" | "md";
|
|
11
11
|
maxItems?: number;
|
|
12
12
|
}
|
|
13
13
|
export declare const Breadcrumbs: React.ForwardRefExoticComponent<BreadcrumbsProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,58 +1,63 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React from
|
|
3
|
-
import { tokens } from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { tokens } from "../tokens";
|
|
4
4
|
const ChevronSeparator = () => (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", style: { opacity: 0.35, flexShrink: 0 }, children: _jsx("polyline", { points: "9 18 15 12 9 6" }) }));
|
|
5
|
-
export const Breadcrumbs = React.forwardRef(({ items = [], separator, size =
|
|
6
|
-
const fontSize = size ===
|
|
5
|
+
export const Breadcrumbs = React.forwardRef(({ items = [], separator, size = "sm", maxItems, className = "", style = {}, }, ref) => {
|
|
6
|
+
const fontSize = size === "sm" ? tokens.font.base : tokens.font.sm;
|
|
7
7
|
const resolvedSeparator = separator || _jsx(ChevronSeparator, {});
|
|
8
8
|
let displayItems = items;
|
|
9
9
|
if (maxItems && items.length > maxItems) {
|
|
10
10
|
const front = items.slice(0, 1);
|
|
11
11
|
const back = items.slice(-Math.max(1, maxItems - 2));
|
|
12
|
-
displayItems = [...front, { label:
|
|
12
|
+
displayItems = [...front, { label: "…" }, ...back];
|
|
13
13
|
}
|
|
14
14
|
return (_jsx("nav", { ref: ref, "aria-label": "Breadcrumb", className: `ds-breadcrumbs ${className}`, children: _jsx("ol", { style: {
|
|
15
|
-
display:
|
|
16
|
-
alignItems:
|
|
15
|
+
display: "flex",
|
|
16
|
+
alignItems: "center",
|
|
17
17
|
gap: tokens.spacing[1],
|
|
18
18
|
fontSize,
|
|
19
19
|
fontWeight: tokens.font.weightMedium,
|
|
20
20
|
color: tokens.color.textMuted,
|
|
21
|
-
listStyle:
|
|
21
|
+
listStyle: "none",
|
|
22
22
|
padding: 0,
|
|
23
23
|
margin: 0,
|
|
24
|
-
flexWrap:
|
|
24
|
+
flexWrap: "wrap",
|
|
25
25
|
...style,
|
|
26
26
|
}, children: displayItems.map((item, index) => {
|
|
27
27
|
const isLast = index === displayItems.length - 1;
|
|
28
|
-
return (_jsx("li", { style: {
|
|
28
|
+
return (_jsx("li", { style: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
gap: tokens.spacing[1],
|
|
32
|
+
}, children: isLast ? (_jsxs("span", { "aria-current": "page", style: {
|
|
29
33
|
fontWeight: tokens.font.weightSemibold,
|
|
30
34
|
color: tokens.color.slate700,
|
|
31
|
-
display:
|
|
32
|
-
alignItems:
|
|
33
|
-
gap:
|
|
34
|
-
maxWidth:
|
|
35
|
-
overflow:
|
|
36
|
-
textOverflow:
|
|
37
|
-
whiteSpace:
|
|
38
|
-
}, children: [item.icon && _jsx("span", { style: { display:
|
|
39
|
-
display:
|
|
40
|
-
alignItems:
|
|
41
|
-
gap:
|
|
42
|
-
color:
|
|
43
|
-
cursor: item.onClick ?
|
|
35
|
+
display: "inline-flex",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
gap: "4px",
|
|
38
|
+
maxWidth: "200px",
|
|
39
|
+
overflow: "hidden",
|
|
40
|
+
textOverflow: "ellipsis",
|
|
41
|
+
whiteSpace: "nowrap",
|
|
42
|
+
}, children: [item.icon && (_jsx("span", { style: { display: "inline-flex", flexShrink: 0 }, children: item.icon })), item.label] })) : (_jsxs(_Fragment, { children: [_jsxs("span", { onClick: item.onClick, style: {
|
|
43
|
+
display: "inline-flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: "4px",
|
|
46
|
+
color: "inherit",
|
|
47
|
+
cursor: item.onClick ? "pointer" : "default",
|
|
44
48
|
transition: tokens.transition.fast,
|
|
45
49
|
borderRadius: tokens.radius.sm,
|
|
46
|
-
padding:
|
|
47
|
-
margin:
|
|
50
|
+
padding: "1px 3px",
|
|
51
|
+
margin: "-1px -3px",
|
|
48
52
|
}, onMouseEnter: (e) => {
|
|
49
53
|
if (item.onClick)
|
|
50
|
-
e.currentTarget.style.color =
|
|
54
|
+
e.currentTarget.style.color =
|
|
55
|
+
tokens.color.primary;
|
|
51
56
|
}, onMouseLeave: (e) => {
|
|
52
57
|
if (item.onClick)
|
|
53
|
-
e.currentTarget.style.color =
|
|
54
|
-
}, children: [item.icon && (_jsx("span", { style: { display:
|
|
58
|
+
e.currentTarget.style.color = "";
|
|
59
|
+
}, children: [item.icon && (_jsx("span", { style: { display: "inline-flex", flexShrink: 0 }, children: item.icon })), item.label] }), _jsx("span", { "aria-hidden": "true", style: { display: "inline-flex", alignItems: "center" }, children: resolvedSeparator })] })) }, index));
|
|
55
60
|
}) }) }));
|
|
56
61
|
});
|
|
57
|
-
Breadcrumbs.displayName =
|
|
62
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
58
63
|
//# sourceMappingURL=Breadcrumbs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/components/Breadcrumbs.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAenC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAC7B,
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/components/Breadcrumbs.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAenC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAC7B,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,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;oCACpB,GAAG,EAAE,KAAK;oCACV,KAAK,EAAE,SAAS;oCAChB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;oCAC5C,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;oCAClC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;oCAC9B,OAAO,EAAE,SAAS;oCAClB,MAAM,EAAE,WAAW;iCACpB,EACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;oCAClB,IAAI,IAAI,CAAC,OAAO;wCACb,CAAC,CAAC,aAA6B,CAAC,KAAK,CAAC,KAAK;4CAC1C,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;gCAC3B,CAAC,EACD,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE;oCAClB,IAAI,IAAI,CAAC,OAAO;wCACb,CAAC,CAAC,aAA6B,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;gCACtD,CAAC,aAEA,IAAI,CAAC,IAAI,IAAI,CACZ,eAAM,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC,EAAE,YACnD,IAAI,CAAC,IAAI,GACL,CACR,EACA,IAAI,CAAC,KAAK,IACN,EACP,8BACc,MAAM,EAClB,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,YAEtD,iBAAiB,GACb,IACN,CACJ,IApEI,KAAK,CAqEP,CACN,CAAC;YACJ,CAAC,CAAC,GACC,GACD,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
-
variant?:
|
|
4
|
-
size?:
|
|
3
|
+
variant?: "primary" | "secondary" | "danger" | "ghost" | "amber" | "success" | "outline";
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
5
5
|
isActive?: boolean;
|
|
6
6
|
startIcon?: React.ReactNode;
|
|
7
7
|
endIcon?: React.ReactNode;
|
|
8
8
|
icon?: React.ReactNode;
|
|
9
9
|
loading?: boolean;
|
|
10
10
|
fullWidth?: boolean;
|
|
11
|
+
isIconButton?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from
|
|
3
|
-
import { tokens } from
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { tokens } from "../tokens";
|
|
4
4
|
// Brand red = #BE1128 → rgba(190,17,40,...)
|
|
5
5
|
// Brand yellow = #FFC20E → rgba(255,194,14,...)
|
|
6
6
|
const VARIANT_STYLES = {
|
|
7
7
|
primary: {
|
|
8
8
|
bg: tokens.color.primary,
|
|
9
|
-
color:
|
|
9
|
+
color: "#ffffff",
|
|
10
10
|
border: `1px solid ${tokens.color.primary}`,
|
|
11
11
|
shadow: tokens.shadow.sm,
|
|
12
12
|
hoverBg: tokens.color.primaryDark,
|
|
13
|
-
hoverColor:
|
|
13
|
+
hoverColor: "#ffffff",
|
|
14
14
|
hoverBorder: `1px solid ${tokens.color.primaryDark}`,
|
|
15
15
|
hoverShadow: tokens.shadow.md,
|
|
16
16
|
},
|
|
@@ -18,7 +18,7 @@ const VARIANT_STYLES = {
|
|
|
18
18
|
bg: tokens.color.white,
|
|
19
19
|
color: tokens.color.slate700,
|
|
20
20
|
border: `1px solid ${tokens.color.slate300}`,
|
|
21
|
-
shadow:
|
|
21
|
+
shadow: "none",
|
|
22
22
|
hoverBg: tokens.color.slate50,
|
|
23
23
|
hoverColor: tokens.color.slate900,
|
|
24
24
|
hoverBorder: `1px solid ${tokens.color.slate400}`,
|
|
@@ -26,7 +26,7 @@ const VARIANT_STYLES = {
|
|
|
26
26
|
},
|
|
27
27
|
danger: {
|
|
28
28
|
bg: tokens.color.danger,
|
|
29
|
-
color:
|
|
29
|
+
color: "#ffffff",
|
|
30
30
|
border: `1px solid ${tokens.color.danger}`,
|
|
31
31
|
shadow: tokens.shadow.sm,
|
|
32
32
|
hoverBg: tokens.color.dangerBg,
|
|
@@ -36,7 +36,7 @@ const VARIANT_STYLES = {
|
|
|
36
36
|
},
|
|
37
37
|
success: {
|
|
38
38
|
bg: tokens.color.success,
|
|
39
|
-
color:
|
|
39
|
+
color: "#ffffff",
|
|
40
40
|
border: `1px solid ${tokens.color.success}`,
|
|
41
41
|
shadow: tokens.shadow.sm,
|
|
42
42
|
hoverBg: tokens.color.successBg,
|
|
@@ -46,43 +46,63 @@ const VARIANT_STYLES = {
|
|
|
46
46
|
},
|
|
47
47
|
amber: {
|
|
48
48
|
bg: tokens.color.accent,
|
|
49
|
-
color:
|
|
49
|
+
color: "#212B36",
|
|
50
50
|
border: `1px solid ${tokens.color.accent}`,
|
|
51
51
|
shadow: tokens.shadow.sm,
|
|
52
52
|
hoverBg: tokens.color.accentDark,
|
|
53
|
-
hoverColor:
|
|
53
|
+
hoverColor: "#212B36",
|
|
54
54
|
hoverBorder: `1px solid ${tokens.color.accentDark}`,
|
|
55
55
|
hoverShadow: tokens.shadow.md,
|
|
56
56
|
},
|
|
57
57
|
ghost: {
|
|
58
|
-
bg:
|
|
58
|
+
bg: "transparent",
|
|
59
59
|
color: tokens.color.textMuted,
|
|
60
|
-
border:
|
|
61
|
-
shadow:
|
|
62
|
-
hoverBg:
|
|
60
|
+
border: "1px solid transparent",
|
|
61
|
+
shadow: "none",
|
|
62
|
+
hoverBg: "rgba(0, 0, 0, 0.04)",
|
|
63
63
|
hoverColor: tokens.color.text,
|
|
64
|
-
hoverBorder:
|
|
65
|
-
hoverShadow:
|
|
64
|
+
hoverBorder: "1px solid transparent",
|
|
65
|
+
hoverShadow: "none",
|
|
66
66
|
},
|
|
67
67
|
outline: {
|
|
68
|
-
bg:
|
|
68
|
+
bg: "transparent",
|
|
69
69
|
color: tokens.color.primary,
|
|
70
70
|
border: `1px solid ${tokens.color.primary}`,
|
|
71
|
-
shadow:
|
|
72
|
-
hoverBg:
|
|
71
|
+
shadow: "none",
|
|
72
|
+
hoverBg: "rgba(232, 83, 10, 0.04)",
|
|
73
73
|
hoverColor: tokens.color.primary,
|
|
74
74
|
hoverBorder: `1px solid ${tokens.color.primary}`,
|
|
75
|
-
hoverShadow:
|
|
75
|
+
hoverShadow: "none",
|
|
76
76
|
},
|
|
77
77
|
};
|
|
78
78
|
const SIZE_STYLES = {
|
|
79
|
-
xs: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
xs: {
|
|
80
|
+
padding: "2px 10px",
|
|
81
|
+
fontSize: "11px",
|
|
82
|
+
height: "26px",
|
|
83
|
+
borderRadius: tokens.radius.md,
|
|
84
|
+
},
|
|
85
|
+
sm: {
|
|
86
|
+
padding: `4px ${tokens.spacing[4]}`,
|
|
87
|
+
fontSize: "12px",
|
|
88
|
+
height: "32px",
|
|
89
|
+
borderRadius: tokens.radius.md,
|
|
90
|
+
},
|
|
91
|
+
md: {
|
|
92
|
+
padding: `${tokens.spacing[2]} ${tokens.spacing[6]}`,
|
|
93
|
+
fontSize: tokens.font.sm,
|
|
94
|
+
height: "40px",
|
|
95
|
+
borderRadius: tokens.radius.lg,
|
|
96
|
+
},
|
|
97
|
+
lg: {
|
|
98
|
+
padding: `${tokens.spacing[3]} ${tokens.spacing[8]}`,
|
|
99
|
+
fontSize: tokens.font.md,
|
|
100
|
+
height: "48px",
|
|
101
|
+
borderRadius: tokens.radius.xl,
|
|
102
|
+
},
|
|
83
103
|
};
|
|
84
|
-
const SpinnerInline = ({ color }) => (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 50 50", style: { animation:
|
|
85
|
-
export const Button = React.forwardRef(({ children, variant =
|
|
104
|
+
const SpinnerInline = ({ color }) => (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 50 50", style: { animation: "ds-spin 0.7s linear infinite", flexShrink: 0 }, children: [_jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: color, strokeWidth: "5", strokeDasharray: "80,150", strokeLinecap: "round" }), _jsx("style", { children: `@keyframes ds-spin { to { transform: rotate(360deg); }}` })] }));
|
|
105
|
+
export const Button = React.forwardRef(({ children, variant = "primary", size = "md", disabled = false, loading = false, fullWidth = false, onClick, style = {}, className = "", isActive = false, startIcon, endIcon, icon, isIconButton = false, ...props }, ref) => {
|
|
86
106
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
87
107
|
const vs = VARIANT_STYLES[variant] || VARIANT_STYLES.primary;
|
|
88
108
|
const ss = SIZE_STYLES[size] || SIZE_STYLES.md;
|
|
@@ -92,27 +112,37 @@ export const Button = React.forwardRef(({ children, variant = 'primary', size =
|
|
|
92
112
|
fontFamily: tokens.font.family,
|
|
93
113
|
fontWeight: tokens.font.weightSemibold,
|
|
94
114
|
...ss,
|
|
95
|
-
cursor: isEffectivelyDisabled ?
|
|
96
|
-
transition:
|
|
97
|
-
display: fullWidth ?
|
|
98
|
-
width: fullWidth ?
|
|
99
|
-
alignItems:
|
|
100
|
-
justifyContent:
|
|
101
|
-
gap: tokens.spacing[2],
|
|
102
|
-
outline:
|
|
103
|
-
userSelect:
|
|
115
|
+
cursor: isEffectivelyDisabled ? "not-allowed" : "pointer",
|
|
116
|
+
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
117
|
+
display: fullWidth || isIconButton ? "flex" : "inline-flex",
|
|
118
|
+
width: fullWidth || isIconButton ? "100%" : undefined,
|
|
119
|
+
alignItems: "center",
|
|
120
|
+
justifyContent: "center",
|
|
121
|
+
gap: isIconButton ? 0 : tokens.spacing[2],
|
|
122
|
+
outline: "none",
|
|
123
|
+
userSelect: "none",
|
|
104
124
|
opacity: isEffectivelyDisabled ? 0.5 : 1,
|
|
105
125
|
backgroundColor: showHover ? vs.hoverBg : vs.bg,
|
|
106
126
|
color: showHover ? vs.hoverColor : vs.color,
|
|
107
127
|
border: showHover ? vs.hoverBorder : vs.border,
|
|
108
|
-
boxShadow:
|
|
109
|
-
transform:
|
|
110
|
-
whiteSpace:
|
|
111
|
-
letterSpacing:
|
|
112
|
-
position:
|
|
128
|
+
boxShadow: "none",
|
|
129
|
+
transform: "none",
|
|
130
|
+
whiteSpace: "nowrap",
|
|
131
|
+
letterSpacing: "0.01em",
|
|
132
|
+
position: "relative",
|
|
113
133
|
...style,
|
|
114
134
|
};
|
|
115
|
-
|
|
135
|
+
if (isIconButton) {
|
|
136
|
+
baseStyle.width = ss.height;
|
|
137
|
+
baseStyle.padding = "0";
|
|
138
|
+
baseStyle.flexShrink = 0;
|
|
139
|
+
}
|
|
140
|
+
return (_jsxs("button", { ref: ref, style: baseStyle, className: `ds-button ds-button--${variant} ds-button--${size} ${className} ${isIconButton ? "ds-button--icon" : ""}`, disabled: isEffectivelyDisabled, onClick: isEffectivelyDisabled ? undefined : onClick, onMouseEnter: () => !isEffectivelyDisabled && setIsHovered(true), onMouseLeave: () => !isEffectivelyDisabled && setIsHovered(false), "aria-busy": loading, "aria-disabled": isEffectivelyDisabled, ...props, children: [loading ? (_jsx(SpinnerInline, { color: showHover ? vs.hoverColor : vs.color })) : ((startIcon || icon) && (_jsx("span", { style: { display: "flex", alignItems: "center", flexShrink: 0 }, children: startIcon || icon }))), !isIconButton && (_jsx("span", { style: {
|
|
141
|
+
opacity: loading ? 0 : 1,
|
|
142
|
+
display: "inline-flex",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
gap: tokens.spacing[2],
|
|
145
|
+
}, children: children })), !loading && endIcon && !isIconButton && (_jsx("span", { style: { display: "flex", alignItems: "center", flexShrink: 0 }, children: endIcon }))] }));
|
|
116
146
|
});
|
|
117
|
-
Button.displayName =
|
|
147
|
+
Button.displayName = "Button";
|
|
118
148
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAiCnC,4CAA4C;AAC5C,gDAAgD;AAChD,MAAM,cAAc,GAAiC;IACnD,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;QACxB,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,aAAa,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE;QAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;QACxB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW;QACjC,UAAU,EAAE,SAAS;QACrB,WAAW,EAAE,aAAa,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE;QACpD,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;KAC9B;IACD,SAAS,EAAE;QACT,EAAE,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK;QACtB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;QAC5B,MAAM,EAAE,aAAa,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;QAC5C,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;QAC7B,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;QACjC,WAAW,EAAE,aAAa,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;QACjD,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,EAA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AO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACxB,OAAO,EAAE,aAAa;oBACtB,UAAU,EAAE,QAAQ;oBACpB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;iBACvB,YAEA,QAAQ,GACJ,CACR,EACA,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,YAAY,IAAI,CACvC,eACE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,EAAE,YAE9D,OAAO,GACH,CACR,IACM,CACV,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface LoadingSpinnerProps {
|
|
3
|
-
size?:
|
|
4
|
-
color?:
|
|
3
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
4
|
+
color?: "primary" | "white" | "success" | "warning" | "danger" | "info" | "slate";
|
|
5
5
|
label?: string;
|
|
6
6
|
className?: string;
|
|
7
7
|
style?: React.CSSProperties;
|
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { tokens } from
|
|
2
|
+
import { tokens } from "../tokens";
|
|
3
3
|
const SIZE_MAP = {
|
|
4
|
-
xs:
|
|
5
|
-
sm:
|
|
6
|
-
md:
|
|
7
|
-
lg:
|
|
8
|
-
xl:
|
|
4
|
+
xs: "14px",
|
|
5
|
+
sm: "20px",
|
|
6
|
+
md: "32px",
|
|
7
|
+
lg: "48px",
|
|
8
|
+
xl: "64px",
|
|
9
9
|
};
|
|
10
10
|
const COLOR_MAP = {
|
|
11
11
|
primary: tokens.color.primary,
|
|
12
|
-
white:
|
|
12
|
+
white: "#ffffff",
|
|
13
13
|
success: tokens.color.success,
|
|
14
14
|
warning: tokens.color.warning,
|
|
15
15
|
danger: tokens.color.danger,
|
|
16
16
|
info: tokens.color.info,
|
|
17
17
|
slate: tokens.color.slate400,
|
|
18
18
|
};
|
|
19
|
-
export const LoadingSpinner = ({ size =
|
|
20
|
-
const dims = SIZE_MAP[size] ||
|
|
21
|
-
const strokeWidth = size ===
|
|
19
|
+
export const LoadingSpinner = ({ size = "md", color = "primary", label, className = "", style = {}, }) => {
|
|
20
|
+
const dims = SIZE_MAP[size] || "32px";
|
|
21
|
+
const strokeWidth = size === "xs" || size === "sm" ? "3" : size === "xl" ? "5" : "4";
|
|
22
22
|
const resolvedColor = COLOR_MAP[color] || tokens.color.primary;
|
|
23
23
|
return (_jsxs("div", { style: {
|
|
24
|
-
display:
|
|
25
|
-
flexDirection: label ?
|
|
26
|
-
alignItems:
|
|
27
|
-
justifyContent:
|
|
24
|
+
display: "inline-flex",
|
|
25
|
+
flexDirection: label ? "column" : "row",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "center",
|
|
28
28
|
gap: label ? tokens.spacing[2] : 0,
|
|
29
29
|
...style,
|
|
30
|
-
}, className: `ds-spinner ${className}`, children: [_jsxs("svg", { width: dims, height: dims, viewBox: "0 0 50 50", style: { animation:
|
|
30
|
+
}, className: `ds-spinner ${className}`, children: [_jsxs("svg", { width: dims, height: dims, viewBox: "0 0 50 50", style: { animation: "ds-spin 0.75s linear infinite", flexShrink: 0 }, "aria-hidden": "true", children: [_jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: "currentColor", strokeWidth: strokeWidth, style: { color: `${resolvedColor}20` } }), _jsx("circle", { cx: "25", cy: "25", r: "20", fill: "none", stroke: resolvedColor, strokeWidth: strokeWidth, strokeDasharray: "80, 150", strokeLinecap: "round", style: { transformOrigin: "center" } }), _jsx("style", { children: `
|
|
31
31
|
@keyframes ds-spin {
|
|
32
32
|
0% { transform: rotate(0deg); }
|
|
33
33
|
100% { transform: rotate(360deg); }
|
|
34
34
|
}
|
|
35
35
|
` })] }), label && (_jsx("span", { style: {
|
|
36
|
-
fontSize: size ===
|
|
36
|
+
fontSize: size === "xs" || size === "sm"
|
|
37
|
+
? tokens.font.base
|
|
38
|
+
: tokens.font.sm,
|
|
37
39
|
fontWeight: tokens.font.weightMedium,
|
|
38
40
|
color: resolvedColor,
|
|
39
41
|
lineHeight: 1.4,
|
|
@@ -43,16 +45,16 @@ export const LoadingOverlay = ({ visible = true, label, }) => {
|
|
|
43
45
|
if (!visible)
|
|
44
46
|
return null;
|
|
45
47
|
return (_jsxs("div", { style: {
|
|
46
|
-
position:
|
|
48
|
+
position: "absolute",
|
|
47
49
|
inset: 0,
|
|
48
|
-
display:
|
|
49
|
-
flexDirection:
|
|
50
|
-
alignItems:
|
|
51
|
-
justifyContent:
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexDirection: "column",
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
justifyContent: "center",
|
|
52
54
|
gap: tokens.spacing[3],
|
|
53
|
-
backgroundColor:
|
|
54
|
-
backdropFilter:
|
|
55
|
-
borderRadius:
|
|
55
|
+
backgroundColor: "rgba(255, 255, 255, 0.75)",
|
|
56
|
+
backdropFilter: "blur(3px)",
|
|
57
|
+
borderRadius: "inherit",
|
|
56
58
|
zIndex: 10,
|
|
57
59
|
}, children: [_jsx(LoadingSpinner, { size: "md" }), label && (_jsx("span", { style: {
|
|
58
60
|
fontSize: tokens.font.sm,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingSpinner.js","sourceRoot":"","sources":["../../../src/components/LoadingSpinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"LoadingSpinner.js","sourceRoot":"","sources":["../../../src/components/LoadingSpinner.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAiBnC,MAAM,QAAQ,GAA2B;IACvC,EAAE,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AAO,IAAI,CAAC;IAE1B,OAAO,CACL,eACE,KAAK,EAAE;YACL,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,CAAC;YACR,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;YACtB,eAAe,EAAE,2BAA2B;YAC5C,cAAc,EAAE,WAAW;YAC3B,YAAY,EAAE,SAAS;YACvB,MAAM,EAAE,EAAE;SACX,aAED,KAAC,cAAc,IAAC,IAAI,EAAC,IAAI,GAAG,EAC3B,KAAK,IAAI,CACR,eACE,KAAK,EAAE;oBACL,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;oBACxB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY;oBACpC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS;iBAC9B,YAEA,KAAK,GACD,CACR,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
value?: number;
|
|
4
4
|
max?: number;
|
|
5
|
-
color?:
|
|
6
|
-
size?:
|
|
5
|
+
color?: "primary" | "success" | "warning" | "danger" | "info" | "gradient";
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
7
7
|
height?: string;
|
|
8
8
|
showLabel?: boolean;
|
|
9
9
|
label?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { tokens } from
|
|
2
|
+
import { tokens } from "../tokens";
|
|
3
3
|
const COLOR_MAP = {
|
|
4
4
|
success: tokens.color.success,
|
|
5
5
|
warning: tokens.color.warning,
|
|
@@ -8,62 +8,70 @@ const COLOR_MAP = {
|
|
|
8
8
|
primary: tokens.color.primary,
|
|
9
9
|
};
|
|
10
10
|
const SIZE_HEIGHT = {
|
|
11
|
-
xs:
|
|
12
|
-
sm:
|
|
13
|
-
md:
|
|
14
|
-
lg:
|
|
11
|
+
xs: "4px",
|
|
12
|
+
sm: "6px",
|
|
13
|
+
md: "10px",
|
|
14
|
+
lg: "14px",
|
|
15
15
|
};
|
|
16
|
-
export const Progress = ({ value = 0, max = 100, color =
|
|
17
|
-
const percentage = indeterminate
|
|
18
|
-
|
|
16
|
+
export const Progress = ({ value = 0, max = 100, color = "primary", size = "sm", height, className = "", style = {}, showLabel = false, label, striped = false, indeterminate = false, ...props }) => {
|
|
17
|
+
const percentage = indeterminate
|
|
18
|
+
? 100
|
|
19
|
+
: Math.min(100, Math.max(0, (value / max) * 100));
|
|
20
|
+
const barHeight = height || SIZE_HEIGHT[size] || "6px";
|
|
19
21
|
const getBarColor = () => {
|
|
20
|
-
if (color ===
|
|
22
|
+
if (color === "gradient") {
|
|
21
23
|
// brand gradient: red → yellow
|
|
22
24
|
return `linear-gradient(90deg, ${tokens.color.primary} 0%, ${tokens.color.accent} 100%)`;
|
|
23
25
|
}
|
|
24
26
|
return COLOR_MAP[color] || tokens.color.primary;
|
|
25
27
|
};
|
|
26
|
-
const isGradient = color ===
|
|
28
|
+
const isGradient = color === "gradient";
|
|
27
29
|
const trackStyle = {
|
|
28
|
-
width:
|
|
30
|
+
width: "100%",
|
|
29
31
|
height: barHeight,
|
|
30
32
|
backgroundColor: tokens.color.slate100,
|
|
31
33
|
borderRadius: tokens.radius.full,
|
|
32
|
-
overflow:
|
|
34
|
+
overflow: "hidden",
|
|
33
35
|
};
|
|
34
36
|
const barStyle = {
|
|
35
|
-
width: indeterminate ?
|
|
36
|
-
height:
|
|
37
|
+
width: indeterminate ? "40%" : `${percentage}%`,
|
|
38
|
+
height: "100%",
|
|
37
39
|
...(isGradient
|
|
38
40
|
? { background: getBarColor() }
|
|
39
41
|
: { backgroundColor: getBarColor() }),
|
|
40
42
|
borderRadius: tokens.radius.full,
|
|
41
|
-
transition: indeterminate
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
transition: indeterminate
|
|
44
|
+
? "none"
|
|
45
|
+
: "width 0.4s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
46
|
+
animation: indeterminate
|
|
47
|
+
? "ds-progress-indeterminate 1.4s ease-in-out infinite"
|
|
48
|
+
: undefined,
|
|
49
|
+
position: "relative",
|
|
50
|
+
overflow: "hidden",
|
|
51
|
+
...(striped
|
|
52
|
+
? {
|
|
53
|
+
backgroundImage: `repeating-linear-gradient(
|
|
47
54
|
45deg,
|
|
48
55
|
rgba(255,255,255,0.12) 0,
|
|
49
56
|
rgba(255,255,255,0.12) 6px,
|
|
50
57
|
transparent 6px,
|
|
51
58
|
transparent 12px
|
|
52
59
|
)`,
|
|
53
|
-
|
|
60
|
+
}
|
|
61
|
+
: {}),
|
|
54
62
|
};
|
|
55
|
-
return (_jsxs("div", { style: { width:
|
|
56
|
-
display:
|
|
57
|
-
justifyContent:
|
|
58
|
-
alignItems:
|
|
63
|
+
return (_jsxs("div", { style: { width: "100%", ...style }, className: `ds-progress ${className}`, ...props, children: [(showLabel || label) && (_jsxs("div", { style: {
|
|
64
|
+
display: "flex",
|
|
65
|
+
justifyContent: "space-between",
|
|
66
|
+
alignItems: "center",
|
|
59
67
|
marginBottom: tokens.spacing[1],
|
|
60
68
|
}, children: [label && (_jsx("span", { style: {
|
|
61
|
-
fontSize: tokens.font.
|
|
69
|
+
fontSize: tokens.font.base,
|
|
62
70
|
fontWeight: tokens.font.weightSemibold,
|
|
63
71
|
color: tokens.color.textMuted,
|
|
64
|
-
letterSpacing:
|
|
72
|
+
letterSpacing: "0.02em",
|
|
65
73
|
}, children: label })), showLabel && !indeterminate && (_jsxs("span", { style: {
|
|
66
|
-
fontSize: tokens.font.
|
|
74
|
+
fontSize: tokens.font.base,
|
|
67
75
|
fontWeight: tokens.font.weightBold,
|
|
68
76
|
color: COLOR_MAP[color] || tokens.color.primary,
|
|
69
77
|
}, children: [percentage.toFixed(0), "%"] }))] })), _jsx("div", { style: trackStyle, children: _jsx("div", { style: barStyle, children: _jsx("style", { children: `
|