shared-design-system 1.12.0 → 1.13.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/Alert.d.ts +2 -1
- package/dist/src/components/Alert.js +80 -38
- package/dist/src/components/Alert.js.map +1 -1
- package/dist/src/components/Avatar.d.ts +11 -2
- package/dist/src/components/Avatar.js +87 -40
- package/dist/src/components/Avatar.js.map +1 -1
- package/dist/src/components/Badge.d.ts +4 -2
- package/dist/src/components/Badge.js +67 -29
- package/dist/src/components/Badge.js.map +1 -1
- package/dist/src/components/Breadcrumbs.d.ts +4 -1
- package/dist/src/components/Breadcrumbs.js +56 -27
- package/dist/src/components/Breadcrumbs.js.map +1 -1
- package/dist/src/components/Button.d.ts +4 -2
- package/dist/src/components/Button.js +99 -95
- package/dist/src/components/Button.js.map +1 -1
- package/dist/src/components/Card.d.ts +3 -1
- package/dist/src/components/Card.js +86 -23
- package/dist/src/components/Card.js.map +1 -1
- package/dist/src/components/ConfirmModal.d.ts +5 -2
- package/dist/src/components/ConfirmModal.js +99 -47
- package/dist/src/components/ConfirmModal.js.map +1 -1
- package/dist/src/components/Divider.d.ts +4 -2
- package/dist/src/components/Divider.js +46 -19
- package/dist/src/components/Divider.js.map +1 -1
- package/dist/src/components/ListComponents.d.ts +7 -4
- package/dist/src/components/ListComponents.js +70 -35
- package/dist/src/components/ListComponents.js.map +1 -1
- package/dist/src/components/LoadingSpinner.d.ts +9 -2
- package/dist/src/components/LoadingSpinner.js +59 -17
- package/dist/src/components/LoadingSpinner.js.map +1 -1
- package/dist/src/components/Progress.d.ts +5 -1
- package/dist/src/components/Progress.js +58 -26
- package/dist/src/components/Progress.js.map +1 -1
- package/dist/src/components/Radio.d.ts +4 -0
- package/dist/src/components/Radio.js +50 -24
- package/dist/src/components/Radio.js.map +1 -1
- package/dist/src/components/ReadOnlyField.d.ts +4 -0
- package/dist/src/components/ReadOnlyField.js +78 -25
- package/dist/src/components/ReadOnlyField.js.map +1 -1
- package/dist/src/components/Skeleton.d.ts +3 -1
- package/dist/src/components/Skeleton.js +52 -22
- package/dist/src/components/Skeleton.js.map +1 -1
- package/dist/src/components/Stack.d.ts +2 -0
- package/dist/src/components/Stack.js +21 -20
- package/dist/src/components/Stack.js.map +1 -1
- package/dist/src/components/Steps.d.ts +3 -1
- package/dist/src/components/Steps.js +93 -68
- package/dist/src/components/Steps.js.map +1 -1
- package/dist/src/components/Switch.d.ts +6 -2
- package/dist/src/components/Switch.js +45 -22
- package/dist/src/components/Switch.js.map +1 -1
- package/dist/src/components/Table.d.ts +9 -1
- package/dist/src/components/Table.js +102 -37
- package/dist/src/components/Table.js.map +1 -1
- package/dist/src/components/Tabs.d.ts +9 -5
- package/dist/src/components/Tabs.js +88 -88
- package/dist/src/components/Tabs.js.map +1 -1
- package/dist/src/components/Tag.d.ts +3 -1
- package/dist/src/components/Tag.js +104 -26
- package/dist/src/components/Tag.js.map +1 -1
- package/dist/src/components/Tooltip.d.ts +3 -0
- package/dist/src/components/Tooltip.js +89 -38
- package/dist/src/components/Tooltip.js.map +1 -1
- package/dist/src/components/Typography.d.ts +14 -1
- package/dist/src/components/Typography.js +108 -61
- package/dist/src/components/Typography.js.map +1 -1
- package/dist/src/index.d.ts +6 -6
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,53 +1,105 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { Button } from './Button';
|
|
3
4
|
import { tokens } from '../tokens';
|
|
4
|
-
|
|
5
|
+
const VARIANT_ICONS = {
|
|
6
|
+
danger: (_jsxs("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), _jsx("line", { x1: "9", y1: "9", x2: "15", y2: "15" })] })),
|
|
7
|
+
warning: (_jsxs("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }), _jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }), _jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })] })),
|
|
8
|
+
primary: (_jsxs("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }), _jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })] })),
|
|
9
|
+
};
|
|
10
|
+
const VARIANT_STYLE = {
|
|
11
|
+
danger: { color: tokens.color.danger, bg: tokens.color.dangerBg },
|
|
12
|
+
warning: { color: tokens.color.warning, bg: tokens.color.warningBg },
|
|
13
|
+
primary: { color: tokens.color.primary, bg: tokens.color.primaryLight },
|
|
14
|
+
};
|
|
15
|
+
const SIZE_WIDTH = {
|
|
16
|
+
sm: '360px',
|
|
17
|
+
md: '440px',
|
|
18
|
+
lg: '560px',
|
|
19
|
+
};
|
|
20
|
+
export const ConfirmModal = ({ isOpen, title, message, confirmText = 'Xác nhận', cancelText = 'Hủy bỏ', onConfirm, onCancel, variant = 'primary', icon, size = 'md', loading = false, }) => {
|
|
21
|
+
// Escape key handler
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!isOpen)
|
|
24
|
+
return;
|
|
25
|
+
const handler = (e) => { if (e.key === 'Escape')
|
|
26
|
+
onCancel(); };
|
|
27
|
+
window.addEventListener('keydown', handler);
|
|
28
|
+
return () => window.removeEventListener('keydown', handler);
|
|
29
|
+
}, [isOpen, onCancel]);
|
|
5
30
|
if (!isOpen)
|
|
6
31
|
return null;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
const vs = VARIANT_STYLE[variant] || VARIANT_STYLE.primary;
|
|
33
|
+
const resolvedIcon = icon || VARIANT_ICONS[variant];
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: `
|
|
35
|
+
@keyframes ds-modal-in {
|
|
36
|
+
from { opacity: 0; transform: scale(0.94) translateY(8px); }
|
|
37
|
+
to { opacity: 1; transform: scale(1) translateY(0); }
|
|
38
|
+
}
|
|
39
|
+
@keyframes ds-overlay-in {
|
|
40
|
+
from { opacity: 0; }
|
|
41
|
+
to { opacity: 1; }
|
|
42
|
+
}
|
|
43
|
+
` }), _jsx("div", { style: {
|
|
44
|
+
position: 'fixed',
|
|
45
|
+
top: 0,
|
|
46
|
+
left: 0,
|
|
47
|
+
width: '100%',
|
|
48
|
+
height: '100%',
|
|
49
|
+
backgroundColor: 'rgba(15, 23, 42, 0.45)',
|
|
50
|
+
display: 'flex',
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
justifyContent: 'center',
|
|
53
|
+
zIndex: 1000,
|
|
54
|
+
backdropFilter: 'blur(6px)',
|
|
55
|
+
WebkitBackdropFilter: 'blur(6px)',
|
|
56
|
+
fontFamily: tokens.font.family,
|
|
57
|
+
padding: tokens.spacing[4],
|
|
58
|
+
animation: 'ds-overlay-in 0.2s ease-out',
|
|
59
|
+
}, onClick: onCancel, children: _jsxs("div", { style: {
|
|
60
|
+
backgroundColor: tokens.color.surface,
|
|
61
|
+
borderRadius: tokens.radius['2xl'],
|
|
62
|
+
width: SIZE_WIDTH[size] || SIZE_WIDTH.md,
|
|
63
|
+
maxWidth: '100%',
|
|
64
|
+
boxShadow: `
|
|
65
|
+
${tokens.shadow.xl},
|
|
66
|
+
0 0 0 1px rgba(0,0,0,0.05),
|
|
67
|
+
inset 0 1px 0 rgba(255,255,255,0.9)
|
|
68
|
+
`,
|
|
69
|
+
animation: 'ds-modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)',
|
|
70
|
+
overflow: 'hidden',
|
|
71
|
+
}, onClick: (e) => e.stopPropagation(), children: [_jsx("div", { style: {
|
|
72
|
+
height: '4px',
|
|
73
|
+
background: `linear-gradient(90deg, ${vs.color}, ${vs.color}80)`,
|
|
74
|
+
} }), _jsxs("div", { style: { padding: tokens.spacing[8] }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'flex-start', gap: tokens.spacing[4], marginBottom: tokens.spacing[4] }, children: [_jsx("div", { style: {
|
|
75
|
+
width: '52px',
|
|
76
|
+
height: '52px',
|
|
77
|
+
borderRadius: tokens.radius.xl,
|
|
78
|
+
backgroundColor: vs.bg,
|
|
79
|
+
color: vs.color,
|
|
80
|
+
display: 'flex',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
justifyContent: 'center',
|
|
83
|
+
flexShrink: 0,
|
|
84
|
+
}, children: resolvedIcon }), _jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [_jsx("h3", { style: {
|
|
85
|
+
margin: 0,
|
|
86
|
+
fontSize: tokens.font.lg,
|
|
87
|
+
fontWeight: tokens.font.weightBold,
|
|
88
|
+
color: tokens.color.text,
|
|
89
|
+
lineHeight: 1.25,
|
|
90
|
+
letterSpacing: '-0.02em',
|
|
91
|
+
}, children: title }), _jsx("div", { style: {
|
|
92
|
+
marginTop: tokens.spacing[2],
|
|
93
|
+
fontSize: tokens.font.sm,
|
|
94
|
+
lineHeight: 1.65,
|
|
95
|
+
color: tokens.color.textMuted,
|
|
96
|
+
fontWeight: tokens.font.weightMedium,
|
|
97
|
+
}, children: message })] })] }), _jsxs("div", { style: {
|
|
98
|
+
display: 'flex',
|
|
99
|
+
justifyContent: 'flex-end',
|
|
100
|
+
gap: tokens.spacing[3],
|
|
101
|
+
paddingTop: tokens.spacing[4],
|
|
102
|
+
borderTop: `1px solid ${tokens.color.slate100}`,
|
|
103
|
+
}, children: [_jsx(Button, { variant: "ghost", onClick: onCancel, disabled: loading, autoFocus: true, children: cancelText }), _jsx(Button, { variant: variant === 'warning' ? 'amber' : variant, onClick: onConfirm, disabled: loading, children: loading ? 'Đang xử lý...' : confirmText })] })] })] }) })] }));
|
|
52
104
|
};
|
|
53
105
|
//# sourceMappingURL=ConfirmModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmModal.js","sourceRoot":"","sources":["../../../src/components/ConfirmModal.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ConfirmModal.js","sourceRoot":"","sources":["../../../src/components/ConfirmModal.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAgBnC,MAAM,aAAa,GAAoC;IACrD,MAAM,EAAE,CACN,eAAK,KAAK,EAAC,IAAI,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L,cAAK,KAAK,EAAE;wDACV,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;wDAC5B,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;wDACxB,UAAU,EAAE,IAAI;wDAChB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS;wDAC7B,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY;qDACrC,YACE,OAAO,GACJ,IACF,IACF,EAGN,eAAK,KAAK,EAAE;wCACV,OAAO,EAAE,MAAM;wCACf,cAAc,EAAE,UAAU;wCAC1B,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;wCACtB,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;wCAC7B,SAAS,EAAE,aAAa,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;qCAChD,aACC,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,QAAQ,EACjB,QAAQ,EAAE,OAAO,EACjB,SAAS,kBAER,UAAU,GACJ,EACT,KAAC,MAAM,IACL,OAAO,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAiE,EAC5G,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,OAAO,YAEhB,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,GACjC,IACL,IACF,IACF,GACF,IACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface DividerProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
3
|
orientation?: 'horizontal' | 'vertical';
|
|
4
|
-
type?: 'solid' | 'gradient';
|
|
4
|
+
type?: 'solid' | 'dashed' | 'gradient';
|
|
5
5
|
label?: React.ReactNode;
|
|
6
|
-
margin?: 'none' | 'sm' | 'md' | 'lg';
|
|
6
|
+
margin?: 'none' | 'xs' | 'sm' | 'md' | 'lg';
|
|
7
|
+
color?: string;
|
|
8
|
+
thickness?: number;
|
|
7
9
|
}
|
|
8
10
|
export declare const Divider: React.FC<DividerProps>;
|
|
@@ -1,43 +1,70 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { tokens } from '../tokens';
|
|
3
|
-
export const Divider = ({ orientation = 'horizontal', type = 'solid', label, margin = 'md', className = '', style = {} }) => {
|
|
3
|
+
export const Divider = ({ orientation = 'horizontal', type = 'solid', label, margin = 'md', color, thickness = 1, className = '', style = {}, }) => {
|
|
4
4
|
const getMargin = () => {
|
|
5
5
|
switch (margin) {
|
|
6
6
|
case 'none': return '0';
|
|
7
|
+
case 'xs': return tokens.spacing[1];
|
|
7
8
|
case 'sm': return tokens.spacing[2];
|
|
8
9
|
case 'lg': return tokens.spacing[8];
|
|
9
10
|
default: return tokens.spacing[4];
|
|
10
11
|
}
|
|
11
12
|
};
|
|
12
13
|
const isVertical = orientation === 'vertical';
|
|
14
|
+
const isDashed = type === 'dashed';
|
|
13
15
|
const isGradient = type === 'gradient';
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
? `linear-gradient(to bottom, transparent, ${
|
|
19
|
-
: `linear-gradient(to right, transparent, ${
|
|
20
|
-
: 'none',
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
const defaultColor = color || tokens.color.slate200;
|
|
17
|
+
const lineStyle = isGradient
|
|
18
|
+
? {
|
|
19
|
+
background: isVertical
|
|
20
|
+
? `linear-gradient(to bottom, transparent, ${defaultColor}, transparent)`
|
|
21
|
+
: `linear-gradient(to right, transparent, ${defaultColor}, transparent)`,
|
|
22
|
+
border: 'none',
|
|
23
|
+
}
|
|
24
|
+
: {
|
|
25
|
+
backgroundColor: isDashed ? 'transparent' : defaultColor,
|
|
26
|
+
border: isDashed
|
|
27
|
+
? `${thickness}px dashed ${defaultColor}`
|
|
28
|
+
: 'none',
|
|
29
|
+
};
|
|
30
|
+
const baseLineStyle = {
|
|
31
|
+
...lineStyle,
|
|
24
32
|
flexShrink: 0,
|
|
25
|
-
|
|
33
|
+
width: isVertical ? `${thickness}px` : '100%',
|
|
34
|
+
height: isVertical ? '100%' : `${thickness}px`,
|
|
35
|
+
...(!isDashed && !isGradient ? { backgroundColor: defaultColor } : {}),
|
|
26
36
|
};
|
|
27
37
|
if (isVertical) {
|
|
28
38
|
return (_jsx("div", { style: {
|
|
29
|
-
...
|
|
39
|
+
...baseLineStyle,
|
|
30
40
|
margin: `0 ${getMargin()}`,
|
|
31
41
|
display: 'inline-block',
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
alignSelf: 'stretch',
|
|
43
|
+
...style,
|
|
44
|
+
}, className: `ds-divider ds-divider--vertical ${className}` }));
|
|
34
45
|
}
|
|
35
46
|
if (label) {
|
|
36
|
-
return (_jsxs("div", { style: {
|
|
47
|
+
return (_jsxs("div", { style: {
|
|
48
|
+
display: 'flex',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
width: '100%',
|
|
51
|
+
margin: `${getMargin()} 0`,
|
|
52
|
+
gap: tokens.spacing[3],
|
|
53
|
+
...style,
|
|
54
|
+
}, className: `ds-divider ds-divider--labeled ${className}`, children: [_jsx("div", { style: { ...baseLineStyle, flex: 1 } }), _jsx("span", { style: {
|
|
55
|
+
fontSize: '11px',
|
|
56
|
+
fontWeight: tokens.font.weightSemibold,
|
|
57
|
+
color: tokens.color.slate400,
|
|
58
|
+
textTransform: 'uppercase',
|
|
59
|
+
letterSpacing: '0.08em',
|
|
60
|
+
whiteSpace: 'nowrap',
|
|
61
|
+
padding: `0 ${tokens.spacing[1]}`,
|
|
62
|
+
}, children: label }), _jsx("div", { style: { ...baseLineStyle, flex: 1 } })] }));
|
|
37
63
|
}
|
|
38
64
|
return (_jsx("hr", { style: {
|
|
39
|
-
...
|
|
40
|
-
margin: `${getMargin()} 0
|
|
41
|
-
|
|
65
|
+
...baseLineStyle,
|
|
66
|
+
margin: `${getMargin()} 0`,
|
|
67
|
+
...style,
|
|
68
|
+
}, className: `ds-divider ${className}` }));
|
|
42
69
|
};
|
|
43
70
|
//# sourceMappingURL=Divider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../../src/components/Divider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../../src/components/Divider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAWnC,MAAM,CAAC,MAAM,OAAO,GAA2B,CAAC,EAC9C,WAAW,GAAG,YAAY,EAC1B,IAAI,GAAG,OAAO,EACd,KAAK,EACL,MAAM,GAAG,IAAI,EACb,KAAK,EACL,SAAS,GAAG,CAAC,EACb,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,GACX,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,MAAM,CAAC,CAAC,OAAO,GAAG,CAAC;YACxB,KAAK,IAAI,CAAC,CAAC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACpC,KAAK,IAAI,CAAC,CAAC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACpC,KAAK,IAAI,CAAC,CAAC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACpC,OAAO,CAAC,CAAC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,WAAW,KAAK,UAAU,CAAC;IAC9C,MAAM,QAAQ,GAAG,IAAI,KAAK,QAAQ,CAAC;IACnC,MAAM,UAAU,GAAG,IAA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Q;gBACpB,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI;gBAC1B,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;gBACtB,GAAG,KAAK;aACT,EACD,SAAS,EAAE,kCAAkC,SAAS,EAAE,aAExD,cAAK,KAAK,EAAE,EAAE,GAAG,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,GAAI,EAC7C,eAAM,KAAK,EAAE;wBACX,QAAQ,EAAE,MAAM;wBAChB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc;wBACtC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;wBAC5B,aAAa,EAAE,WAAoB;wBACnC,aAAa,EAAE,QAAQ;wBACvB,UAAU,EAAE,QAAiB;wBAC7B,OAAO,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;qBAClC,YACE,KAAK,GACD,EACP,cAAK,KAAK,EAAE,EAAE,GAAG,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,GAAI,IACzC,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,aACE,KAAK,EAAE;YACL,GAAG,aAAa;YAChB,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI;YAC1B,GAAG,KAAK;SACT,EACD,SAAS,EAAE,cAAc,SAAS,EAAE,GACpC,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,16 +3,19 @@ export interface ListProps<T = any> extends Omit<React.HTMLAttributes<HTMLUListE
|
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
items?: T[];
|
|
5
5
|
renderItem?: (item: T, index: number) => React.ReactNode;
|
|
6
|
-
variant?: 'default' | 'sidebar' | 'ghost';
|
|
7
|
-
spacing?: '
|
|
6
|
+
variant?: 'default' | 'sidebar' | 'ghost' | 'card';
|
|
7
|
+
spacing?: 'none' | 'xs' | 'sm' | 'md';
|
|
8
|
+
divider?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare const List: <T extends any>({ children, items, renderItem, className, style, variant, spacing, ...props }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const List: <T extends any>({ children, items, renderItem, className, style, variant, spacing, divider, ...props }: ListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export interface ListItemProps extends React.HTMLAttributes<HTMLLIElement> {
|
|
11
12
|
children: React.ReactNode;
|
|
12
13
|
icon?: React.ReactNode;
|
|
13
14
|
action?: React.ReactNode;
|
|
15
|
+
badge?: React.ReactNode;
|
|
14
16
|
divider?: boolean;
|
|
15
17
|
active?: boolean;
|
|
16
|
-
variant?: 'default' | 'sidebar' | 'ghost';
|
|
18
|
+
variant?: 'default' | 'sidebar' | 'ghost' | 'card';
|
|
19
|
+
description?: string;
|
|
17
20
|
}
|
|
18
21
|
export declare const ListItem: React.FC<ListItemProps>;
|
|
@@ -1,63 +1,98 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { tokens } from '../tokens';
|
|
4
|
-
export const List = ({ children, items, renderItem, className = '', style = {}, variant = 'default', spacing = '
|
|
4
|
+
export const List = ({ children, items, renderItem, className = '', style = {}, variant = 'default', spacing = 'xs', divider = false, ...props }) => {
|
|
5
|
+
const isCard = variant === 'card';
|
|
6
|
+
const isSidebarOrGhost = variant === 'sidebar' || variant === 'ghost';
|
|
5
7
|
const getSpacing = () => {
|
|
6
8
|
switch (spacing) {
|
|
7
|
-
case '
|
|
8
|
-
case '
|
|
9
|
-
case '
|
|
9
|
+
case 'none': return '0';
|
|
10
|
+
case 'xs': return '2px';
|
|
11
|
+
case 'md': return tokens.spacing[2];
|
|
10
12
|
default: return '4px';
|
|
11
13
|
}
|
|
12
14
|
};
|
|
13
15
|
const containerStyle = {
|
|
14
16
|
listStyle: 'none',
|
|
15
|
-
padding: 0,
|
|
17
|
+
padding: isCard ? tokens.spacing[3] : 0,
|
|
16
18
|
margin: 0,
|
|
17
19
|
display: 'flex',
|
|
18
20
|
flexDirection: 'column',
|
|
19
|
-
gap:
|
|
20
|
-
border: variant === 'default' ? `1px solid ${tokens.color.slate100}` : 'none',
|
|
21
|
-
borderRadius: variant === 'default' ? tokens.radius.
|
|
21
|
+
gap: isSidebarOrGhost || isCard ? getSpacing() : '0',
|
|
22
|
+
border: variant === 'default' ? `1px solid ${tokens.color.slate100}` : isCard ? `1px solid ${tokens.color.slate100}` : 'none',
|
|
23
|
+
borderRadius: variant === 'default' ? tokens.radius.xl : isCard ? tokens.radius['2xl'] : '0',
|
|
22
24
|
overflow: 'hidden',
|
|
23
|
-
backgroundColor: variant === 'default' ? tokens.color.white : 'transparent',
|
|
24
|
-
|
|
25
|
+
backgroundColor: variant === 'default' ? tokens.color.white : isCard ? tokens.color.white : 'transparent',
|
|
26
|
+
boxShadow: isCard ? tokens.shadow.sm : 'none',
|
|
27
|
+
...style,
|
|
25
28
|
};
|
|
26
|
-
return (_jsx("ul", { style: containerStyle, className: className
|
|
29
|
+
return (_jsx("ul", { style: containerStyle, className: `ds-list ds-list--${variant} ${className}`, ...props, children: items && renderItem
|
|
30
|
+
? items.map((item, index) => (_jsxs(React.Fragment, { children: [renderItem(item, index), divider && index < items.length - 1 && (_jsx("li", { "aria-hidden": true, style: { height: '1px', backgroundColor: tokens.color.slate100, margin: '0 -0px' } }))] }, index)))
|
|
31
|
+
: children }));
|
|
27
32
|
};
|
|
28
|
-
export const ListItem = ({ children, icon, action, onClick, className = '', style = {}, divider = false, active = false, variant = 'sidebar', ...props }) => {
|
|
29
|
-
const
|
|
33
|
+
export const ListItem = ({ children, icon, action, badge, onClick, className = '', style = {}, divider = false, active = false, variant = 'sidebar', description, ...props }) => {
|
|
34
|
+
const [hovered, setHovered] = React.useState(false);
|
|
35
|
+
const isSidebar = variant === 'sidebar' || variant === 'card';
|
|
36
|
+
const isClickable = !!onClick;
|
|
37
|
+
const showHover = isClickable && hovered && !active;
|
|
38
|
+
const getActiveStyles = () => {
|
|
39
|
+
if (active)
|
|
40
|
+
return {
|
|
41
|
+
backgroundColor: tokens.color.primaryLight,
|
|
42
|
+
color: tokens.color.primary,
|
|
43
|
+
borderColor: 'rgba(37, 99, 235, 0.2)',
|
|
44
|
+
};
|
|
45
|
+
if (showHover)
|
|
46
|
+
return {
|
|
47
|
+
backgroundColor: tokens.color.slate50,
|
|
48
|
+
color: tokens.color.slate700,
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
backgroundColor: 'transparent',
|
|
52
|
+
color: tokens.color.slate600,
|
|
53
|
+
};
|
|
54
|
+
};
|
|
30
55
|
const itemStyle = {
|
|
31
56
|
display: 'flex',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
padding: isSidebar ?
|
|
57
|
+
alignItems: description ? 'flex-start' : 'center',
|
|
58
|
+
padding: isSidebar ? `${tokens.spacing[3]} ${tokens.spacing[4]}` : `${tokens.spacing[4]} ${tokens.spacing[4]}`,
|
|
34
59
|
gap: tokens.spacing[3],
|
|
35
|
-
cursor:
|
|
36
|
-
borderRadius: isSidebar ? tokens.radius.
|
|
60
|
+
cursor: isClickable ? 'pointer' : 'default',
|
|
61
|
+
borderRadius: isSidebar ? tokens.radius.lg : '0',
|
|
37
62
|
transition: tokens.transition.fast,
|
|
38
|
-
border: isSidebar ? `1px solid ${active ?
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
63
|
+
border: isSidebar ? `1px solid ${active ? 'rgba(37, 99, 235, 0.15)' : 'transparent'}` : 'none',
|
|
64
|
+
borderBottom: !isSidebar && (divider || variant === 'default')
|
|
65
|
+
? `1px solid ${tokens.color.slate100}`
|
|
66
|
+
: 'none',
|
|
42
67
|
fontWeight: active ? tokens.font.weightSemibold : tokens.font.weightMedium,
|
|
43
|
-
|
|
68
|
+
outline: 'none',
|
|
69
|
+
...getActiveStyles(),
|
|
70
|
+
...style,
|
|
44
71
|
};
|
|
45
|
-
const
|
|
72
|
+
const iconWrapStyle = {
|
|
46
73
|
display: 'flex',
|
|
47
74
|
flexShrink: 0,
|
|
48
|
-
color: active ? tokens.color.
|
|
75
|
+
color: active ? tokens.color.primary : showHover ? tokens.color.slate500 : tokens.color.slate400,
|
|
49
76
|
transition: tokens.transition.fast,
|
|
77
|
+
marginTop: description ? '2px' : '0',
|
|
50
78
|
};
|
|
51
|
-
return (_jsxs("li", { style: itemStyle, className: className
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
return (_jsxs("li", { style: itemStyle, className: `ds-list-item ${className}`, onClick: onClick, onMouseEnter: () => isClickable && setHovered(true), onMouseLeave: () => isClickable && setHovered(false), role: isClickable ? 'button' : undefined, tabIndex: isClickable ? 0 : undefined, ...props, children: [icon && _jsx("div", { style: iconWrapStyle, children: icon }), _jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [_jsx("div", { style: {
|
|
80
|
+
fontSize: tokens.font.sm,
|
|
81
|
+
lineHeight: 1.4,
|
|
82
|
+
whiteSpace: 'nowrap',
|
|
83
|
+
overflow: 'hidden',
|
|
84
|
+
textOverflow: 'ellipsis',
|
|
85
|
+
}, children: children }), description && (_jsx("div", { style: {
|
|
86
|
+
fontSize: '11px',
|
|
87
|
+
color: tokens.color.textMuted,
|
|
88
|
+
marginTop: '2px',
|
|
89
|
+
fontWeight: tokens.font.weightMedium,
|
|
90
|
+
lineHeight: 1.4,
|
|
91
|
+
}, children: description }))] }), badge && (_jsx("div", { style: { flexShrink: 0, marginLeft: tokens.spacing[1] }, children: badge })), action && (_jsx("div", { style: { flexShrink: 0 }, children: action })), isSidebar && isClickable && !action && (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round", style: {
|
|
92
|
+
flexShrink: 0,
|
|
93
|
+
opacity: active ? 0.7 : 0.3,
|
|
94
|
+
transition: tokens.transition.fast,
|
|
95
|
+
marginLeft: 'auto',
|
|
96
|
+
}, children: _jsx("polyline", { points: "9 18 15 12 9 6" }) }))] }));
|
|
62
97
|
};
|
|
63
98
|
//# sourceMappingURL=ListComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListComponents.js","sourceRoot":"","sources":["../../../src/components/ListComponents.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"ListComponents.js","sourceRoot":"","sources":["../../../src/components/ListComponents.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAWnC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAgB,EAClC,QAAQ,EACR,KAAK,EACL,UAAU,EACV,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,SAAS,EACnB,OAAO,GAAG,IAAI,EACd,OAAO,GAAG,KAAK,EACf,GAAG,KAAK,EACK,EAAE,EAAE;IACjB,MAAM,MAAM,GAAG,OAAO,KAAK,MAAM,CAAC;IAClC,MAAM,gBAAgB,GAAG,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,OAAO,CAAC;IAEtE,MAAM,UAAU,GAAG,GAAG,EAAE;QACtB,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,MAAM,CAAC,CAAC,OAAO,GAAG,CAAC;YACxB,KAAK,IAAI,CAAC,CAAG,OAAO,KAAK,CAAC;YAC1B,KAAK,IAAI,CAAC,CAAG,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACtC,OAAO,CAAC,CAAK,OAAO,KAAK,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,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AK,KAAK,EAAE;4BACV,QAAQ,EAAE,MAAM;4BAChB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS;4BAC7B,SAAS,EAAE,KAAK;4BAChB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY;4BACpC,UAAU,EAAE,GAAG;yBAChB,YACE,WAAW,GACR,CACP,IACG,EAEL,KAAK,IAAI,CACR,cAAK,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,YAAG,KAAK,GAAO,CAC5E,EACA,MAAM,IAAI,CACT,cAAK,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,YAAG,MAAM,GAAO,CAC9C,EAGA,SAAS,IAAI,WAAW,IAAI,CAAC,MAAM,IAAI,CACtC,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAE,GAAG,EAChB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,KAAK,EAAE;oBACL,UAAU,EAAE,CAAC;oBACb,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;oBAC3B,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;oBAClC,UAAU,EAAE,MAAM;iBACnB,YAED,mBAAU,MAAM,EAAC,gBAAgB,GAAG,GAChC,CACP,IACE,CACN,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface LoadingSpinnerProps {
|
|
3
|
-
size?: 'sm' | 'md' | 'lg';
|
|
4
|
-
color?: 'primary' | 'white';
|
|
3
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
|
+
color?: 'primary' | 'white' | 'success' | 'warning' | 'danger' | 'info' | 'slate';
|
|
5
|
+
label?: string;
|
|
5
6
|
className?: string;
|
|
7
|
+
style?: React.CSSProperties;
|
|
6
8
|
}
|
|
7
9
|
export declare const LoadingSpinner: React.FC<LoadingSpinnerProps>;
|
|
10
|
+
export interface LoadingOverlayProps {
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const LoadingOverlay: React.FC<LoadingOverlayProps>;
|
|
@@ -1,21 +1,63 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { tokens } from '../tokens';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
const SIZE_MAP = {
|
|
4
|
+
xs: '14px',
|
|
5
|
+
sm: '20px',
|
|
6
|
+
md: '32px',
|
|
7
|
+
lg: '48px',
|
|
8
|
+
xl: '64px',
|
|
9
|
+
};
|
|
10
|
+
const COLOR_MAP = {
|
|
11
|
+
primary: tokens.color.primary,
|
|
12
|
+
white: '#ffffff',
|
|
13
|
+
success: tokens.color.success,
|
|
14
|
+
warning: tokens.color.warning,
|
|
15
|
+
danger: tokens.color.danger,
|
|
16
|
+
info: tokens.color.info,
|
|
17
|
+
slate: tokens.color.slate400,
|
|
18
|
+
};
|
|
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
|
+
const resolvedColor = COLOR_MAP[color] || tokens.color.primary;
|
|
23
|
+
return (_jsxs("div", { style: {
|
|
24
|
+
display: 'inline-flex',
|
|
25
|
+
flexDirection: label ? 'column' : 'row',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
gap: label ? tokens.spacing[2] : 0,
|
|
29
|
+
...style,
|
|
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
|
+
@keyframes ds-spin {
|
|
32
|
+
0% { transform: rotate(0deg); }
|
|
33
|
+
100% { transform: rotate(360deg); }
|
|
34
|
+
}
|
|
35
|
+
` })] }), label && (_jsx("span", { style: {
|
|
36
|
+
fontSize: size === 'xs' || size === 'sm' ? tokens.font.xs : tokens.font.sm,
|
|
37
|
+
fontWeight: tokens.font.weightMedium,
|
|
38
|
+
color: resolvedColor,
|
|
39
|
+
lineHeight: 1.4,
|
|
40
|
+
}, children: label }))] }));
|
|
41
|
+
};
|
|
42
|
+
export const LoadingOverlay = ({ visible = true, label, }) => {
|
|
43
|
+
if (!visible)
|
|
44
|
+
return null;
|
|
45
|
+
return (_jsxs("div", { style: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
inset: 0,
|
|
48
|
+
display: 'flex',
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
gap: tokens.spacing[3],
|
|
53
|
+
backgroundColor: 'rgba(255, 255, 255, 0.75)',
|
|
54
|
+
backdropFilter: 'blur(3px)',
|
|
55
|
+
borderRadius: 'inherit',
|
|
56
|
+
zIndex: 10,
|
|
57
|
+
}, children: [_jsx(LoadingSpinner, { size: "md" }), label && (_jsx("span", { style: {
|
|
58
|
+
fontSize: tokens.font.sm,
|
|
59
|
+
fontWeight: tokens.font.weightMedium,
|
|
60
|
+
color: tokens.color.textMuted,
|
|
61
|
+
}, children: label }))] }));
|
|
20
62
|
};
|
|
21
63
|
//# sourceMappingURL=LoadingSpinner.js.map
|