shared-design-system 1.77.0 → 1.79.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/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.d.ts +5 -5
- package/dist/src/components/Typography.js +45 -44
- package/dist/src/components/Typography.js.map +1 -1
- package/dist/src/tokens.d.ts +2 -2
- package/dist/src/tokens.js +68 -68
- package/dist/src/tokens.js.map +1 -1
- package/dist/tailwind.preset.d.ts +1 -1
- package/dist/tailwind.preset.js +82 -77
- package/dist/tailwind.preset.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,CAA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
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,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;CACX,CAAC;AAEF,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;IAC3B,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI;IACvB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAkC,CAAC,EAC5D,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AC,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: `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress.js","sourceRoot":"","sources":["../../../src/components/Progress.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAcnC,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;IAC3B,IAAI,EAAE,MAAM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CAAC,KAAK,CAAC,OAAO;yBAChD,aAEA,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,SACjB,CACR,IACG,CACP,EAED,cAAK,KAAK,EAAE,UAAU,YACpB,cAAK,KAAK,EAAE,QAAQ,YAClB,0BAAQ;;;;;WAKP,GAAS,GACN,GACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { tokens } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { tokens } from "../tokens";
|
|
3
3
|
export interface RadioProps {
|
|
4
4
|
label?: React.ReactNode;
|
|
5
5
|
description?: string;
|
|
@@ -8,8 +8,8 @@ export interface RadioProps {
|
|
|
8
8
|
value?: string | number;
|
|
9
9
|
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
10
10
|
disabled?: boolean;
|
|
11
|
-
size?:
|
|
12
|
-
color?:
|
|
11
|
+
size?: "sm" | "md" | "lg";
|
|
12
|
+
color?: "primary" | "success" | "warning" | "danger";
|
|
13
13
|
className?: string;
|
|
14
14
|
style?: React.CSSProperties;
|
|
15
15
|
}
|
|
@@ -25,7 +25,7 @@ export interface RadioGroupProps {
|
|
|
25
25
|
disabled?: boolean;
|
|
26
26
|
}>;
|
|
27
27
|
value?: string | number;
|
|
28
|
-
direction?:
|
|
28
|
+
direction?: "row" | "column";
|
|
29
29
|
spacing?: keyof typeof tokens.spacing;
|
|
30
30
|
label?: string;
|
|
31
31
|
onChange?: (value: string | number) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
const COLOR_MAP = {
|
|
5
5
|
primary: tokens.color.primary,
|
|
6
6
|
success: tokens.color.success,
|
|
@@ -8,77 +8,84 @@ const COLOR_MAP = {
|
|
|
8
8
|
danger: tokens.color.danger,
|
|
9
9
|
};
|
|
10
10
|
const SIZE_CONFIG = {
|
|
11
|
-
sm: { outer:
|
|
12
|
-
md: { outer:
|
|
13
|
-
lg: { outer:
|
|
11
|
+
sm: { outer: "16px", inner: "8px" },
|
|
12
|
+
md: { outer: "20px", inner: "10px" },
|
|
13
|
+
lg: { outer: "24px", inner: "12px" },
|
|
14
14
|
};
|
|
15
|
-
export const Radio = React.forwardRef(({ label, description, checked, name, value, onChange, disabled = false, size =
|
|
15
|
+
export const Radio = React.forwardRef(({ label, description, checked, name, value, onChange, disabled = false, size = "md", color = "primary", className = "", style = {}, }, ref) => {
|
|
16
16
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
17
17
|
const activeColor = COLOR_MAP[color] || tokens.color.primary;
|
|
18
18
|
const sc = SIZE_CONFIG[size] || SIZE_CONFIG.md;
|
|
19
19
|
const containerStyle = {
|
|
20
|
-
display:
|
|
21
|
-
alignItems: description ?
|
|
22
|
-
gap: tokens.spacing[
|
|
23
|
-
cursor: disabled ?
|
|
20
|
+
display: "inline-flex",
|
|
21
|
+
alignItems: description ? "flex-start" : "center",
|
|
22
|
+
gap: tokens.spacing["3"],
|
|
23
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
24
24
|
opacity: disabled ? 0.55 : 1,
|
|
25
|
-
userSelect:
|
|
25
|
+
userSelect: "none",
|
|
26
26
|
...style,
|
|
27
27
|
};
|
|
28
28
|
const radioBoxStyle = {
|
|
29
|
-
position:
|
|
29
|
+
position: "relative",
|
|
30
30
|
width: sc.outer,
|
|
31
31
|
height: sc.outer,
|
|
32
|
-
borderRadius:
|
|
32
|
+
borderRadius: "50%",
|
|
33
33
|
border: `2px solid ${checked ? activeColor : tokens.color.slate300}`,
|
|
34
34
|
backgroundColor: tokens.color.surface,
|
|
35
|
-
display:
|
|
36
|
-
alignItems:
|
|
37
|
-
justifyContent:
|
|
38
|
-
transition:
|
|
35
|
+
display: "flex",
|
|
36
|
+
alignItems: "center",
|
|
37
|
+
justifyContent: "center",
|
|
38
|
+
transition: "all 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
39
39
|
flexShrink: 0,
|
|
40
|
-
boxShadow:
|
|
41
|
-
marginTop: description ?
|
|
40
|
+
boxShadow: "none",
|
|
41
|
+
marginTop: description ? "2px" : "0",
|
|
42
42
|
};
|
|
43
43
|
const innerCircleStyle = {
|
|
44
44
|
width: sc.inner,
|
|
45
45
|
height: sc.inner,
|
|
46
|
-
borderRadius:
|
|
46
|
+
borderRadius: "50%",
|
|
47
47
|
backgroundColor: activeColor,
|
|
48
|
-
transform: checked ?
|
|
48
|
+
transform: checked ? "scale(1)" : "scale(0)",
|
|
49
49
|
opacity: checked ? 1 : 0,
|
|
50
|
-
transition:
|
|
50
|
+
transition: "transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease",
|
|
51
51
|
};
|
|
52
|
-
return (_jsxs("label", { style: containerStyle, className: `ds-radio ${className}`, onMouseEnter: () => !disabled && setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsxs("div", { style: {
|
|
52
|
+
return (_jsxs("label", { style: containerStyle, className: `ds-radio ${className}`, onMouseEnter: () => !disabled && setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsxs("div", { style: {
|
|
53
|
+
position: "relative",
|
|
54
|
+
display: "flex",
|
|
55
|
+
alignItems: "center",
|
|
56
|
+
flexShrink: 0,
|
|
57
|
+
}, children: [_jsx("input", { ref: ref, type: "radio", name: name, value: value, checked: checked, onChange: onChange, disabled: disabled, style: { position: "absolute", opacity: 0, width: 0, height: 0 } }), _jsx("div", { style: radioBoxStyle, children: _jsx("div", { style: innerCircleStyle }) })] }), (label || description) && (_jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "2px" }, children: [label && (_jsx("span", { style: {
|
|
53
58
|
fontSize: tokens.font.sm,
|
|
54
59
|
fontWeight: tokens.font.weightSemibold,
|
|
55
|
-
color: disabled
|
|
60
|
+
color: disabled
|
|
61
|
+
? tokens.color.textDisabled
|
|
62
|
+
: tokens.color.text,
|
|
56
63
|
lineHeight: 1.4,
|
|
57
64
|
}, children: label })), description && (_jsx("span", { style: {
|
|
58
|
-
fontSize:
|
|
65
|
+
fontSize: "11px",
|
|
59
66
|
fontWeight: tokens.font.weightMedium,
|
|
60
67
|
color: tokens.color.textMuted,
|
|
61
68
|
lineHeight: 1.4,
|
|
62
69
|
}, children: description }))] }))] }));
|
|
63
70
|
});
|
|
64
|
-
Radio.displayName =
|
|
65
|
-
export const RadioGroup = React.forwardRef(({ children, options, value, direction =
|
|
71
|
+
Radio.displayName = "Radio";
|
|
72
|
+
export const RadioGroup = React.forwardRef(({ children, options, value, direction = "column", spacing = "3", label, onChange, className = "", style = {}, }, ref) => {
|
|
66
73
|
var _a;
|
|
67
74
|
return (_jsxs("div", { ref: ref, role: "radiogroup", "aria-label": label, style: { ...style }, className: `ds-radio-group ${className}`, children: [label && (_jsx("div", { style: {
|
|
68
|
-
fontSize: tokens.font.
|
|
75
|
+
fontSize: tokens.font.base,
|
|
69
76
|
fontWeight: tokens.font.weightBold,
|
|
70
77
|
color: tokens.color.slate500,
|
|
71
|
-
textTransform:
|
|
72
|
-
letterSpacing:
|
|
73
|
-
marginBottom: tokens.spacing[
|
|
78
|
+
textTransform: "uppercase",
|
|
79
|
+
letterSpacing: "0.07em",
|
|
80
|
+
marginBottom: tokens.spacing["2"],
|
|
74
81
|
}, children: label })), _jsx("div", { style: {
|
|
75
|
-
display:
|
|
82
|
+
display: "flex",
|
|
76
83
|
flexDirection: direction,
|
|
77
|
-
gap: (_a = tokens.spacing[spacing]) !== null && _a !== void 0 ? _a : tokens.spacing[
|
|
84
|
+
gap: (_a = tokens.spacing[spacing]) !== null && _a !== void 0 ? _a : tokens.spacing["3"],
|
|
78
85
|
}, children: options
|
|
79
86
|
? options.map((opt) => (_jsx(Radio, { label: opt.label, value: opt.value, checked: value === opt.value, disabled: opt.disabled, onChange: () => onChange === null || onChange === void 0 ? void 0 : onChange(opt.value) }, opt.value)))
|
|
80
87
|
: children })] }));
|
|
81
88
|
});
|
|
82
|
-
RadioGroup.displayName =
|
|
89
|
+
RadioGroup.displayName = "Radio.Group";
|
|
83
90
|
Radio.Group = RadioGroup;
|
|
84
91
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/components/Radio.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAgBnC,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;CAC5B,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;IACnC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IACpC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;CACrC,CAAC;
|
|
1
|
+
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/components/Radio.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAgBnC,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;IAC7B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,CAAC,QAAQ,GACR,IACF,CACP,CAAA;CAAA,CACF,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,aAAa,CAAC;AAEvC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface ReadOnlyFieldProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
label: string;
|
|
4
4
|
value?: React.ReactNode;
|
|
@@ -6,6 +6,6 @@ export interface ReadOnlyFieldProps extends React.HTMLAttributes<HTMLDivElement>
|
|
|
6
6
|
copyable?: boolean;
|
|
7
7
|
placeholder?: string;
|
|
8
8
|
hint?: string;
|
|
9
|
-
layout?:
|
|
9
|
+
layout?: "floating" | "stacked";
|
|
10
10
|
}
|
|
11
11
|
export declare const ReadOnlyField: React.FC<ReadOnlyFieldProps>;
|