shared-design-system 1.19.0 → 1.23.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 +1 -1
- package/dist/src/components/Alert.js +34 -20
- package/dist/src/components/Alert.js.map +1 -1
- package/dist/src/components/Avatar.d.ts +7 -2
- package/dist/src/components/Avatar.js +15 -12
- package/dist/src/components/Avatar.js.map +1 -1
- package/dist/src/components/Badge.d.ts +1 -1
- package/dist/src/components/Badge.js +113 -89
- package/dist/src/components/Badge.js.map +1 -1
- package/dist/src/components/Breadcrumbs.d.ts +1 -1
- package/dist/src/components/Breadcrumbs.js +7 -9
- package/dist/src/components/Breadcrumbs.js.map +1 -1
- package/dist/src/components/Button.d.ts +1 -1
- package/dist/src/components/Button.js +6 -4
- package/dist/src/components/Button.js.map +1 -1
- package/dist/src/components/ConfigProvider.d.ts +17 -0
- package/dist/src/components/ConfigProvider.js +54 -0
- package/dist/src/components/ConfigProvider.js.map +1 -0
- package/dist/src/components/ConfirmModal.d.ts +1 -1
- package/dist/src/components/ConfirmModal.js +82 -72
- package/dist/src/components/ConfirmModal.js.map +1 -1
- package/dist/src/components/DatePicker.d.ts +1 -1
- package/dist/src/components/DatePicker.js +33 -10
- package/dist/src/components/DatePicker.js.map +1 -1
- package/dist/src/components/Descriptions.d.ts +15 -0
- package/dist/src/components/Descriptions.js +44 -0
- package/dist/src/components/Descriptions.js.map +1 -0
- package/dist/src/components/Divider.d.ts +1 -1
- package/dist/src/components/Divider.js +21 -16
- package/dist/src/components/Divider.js.map +1 -1
- package/dist/src/components/Drawer.d.ts +1 -1
- package/dist/src/components/Drawer.js +81 -68
- package/dist/src/components/Drawer.js.map +1 -1
- package/dist/src/components/Dropdown.d.ts +17 -0
- package/dist/src/components/Dropdown.js +129 -0
- package/dist/src/components/Dropdown.js.map +1 -0
- package/dist/src/components/Empty.d.ts +9 -0
- package/dist/src/components/Empty.js +15 -0
- package/dist/src/components/Empty.js.map +1 -0
- package/dist/src/components/Form.d.ts +35 -0
- package/dist/src/components/Form.js +54 -0
- package/dist/src/components/Form.js.map +1 -0
- package/dist/src/components/InputComponents.d.ts +4 -4
- package/dist/src/components/InputComponents.js +57 -26
- package/dist/src/components/InputComponents.js.map +1 -1
- package/dist/src/components/ListComponents.d.ts +4 -2
- package/dist/src/components/ListComponents.js +36 -15
- package/dist/src/components/ListComponents.js.map +1 -1
- package/dist/src/components/Message.d.ts +20 -0
- package/dist/src/components/Message.js +69 -0
- package/dist/src/components/Message.js.map +1 -0
- package/dist/src/components/Modal.d.ts +1 -1
- package/dist/src/components/Modal.js +90 -77
- package/dist/src/components/Modal.js.map +1 -1
- package/dist/src/components/MultiSelect.d.ts +1 -1
- package/dist/src/components/MultiSelect.js +65 -20
- package/dist/src/components/MultiSelect.js.map +1 -1
- package/dist/src/components/Popconfirm.d.ts +12 -0
- package/dist/src/components/Popconfirm.js +24 -0
- package/dist/src/components/Popconfirm.js.map +1 -0
- package/dist/src/components/Popover.d.ts +10 -0
- package/dist/src/components/Popover.js +108 -0
- package/dist/src/components/Popover.js.map +1 -0
- package/dist/src/components/Portal.d.ts +11 -0
- package/dist/src/components/Portal.js +30 -0
- package/dist/src/components/Portal.js.map +1 -0
- package/dist/src/components/Radio.d.ts +5 -2
- package/dist/src/components/Radio.js +10 -6
- package/dist/src/components/Radio.js.map +1 -1
- package/dist/src/components/Result.d.ts +9 -0
- package/dist/src/components/Result.js +52 -0
- package/dist/src/components/Result.js.map +1 -0
- package/dist/src/components/Select.d.ts +1 -1
- package/dist/src/components/Select.js +70 -19
- package/dist/src/components/Select.js.map +1 -1
- package/dist/src/components/Skeleton.d.ts +1 -1
- package/dist/src/components/Skeleton.js +10 -7
- package/dist/src/components/Skeleton.js.map +1 -1
- package/dist/src/components/Steps.d.ts +1 -1
- package/dist/src/components/Steps.js +17 -14
- package/dist/src/components/Steps.js.map +1 -1
- package/dist/src/components/Switch.d.ts +1 -1
- package/dist/src/components/Switch.js +6 -6
- package/dist/src/components/Switch.js.map +1 -1
- package/dist/src/components/Table.d.ts +20 -7
- package/dist/src/components/Table.js +140 -113
- package/dist/src/components/Table.js.map +1 -1
- package/dist/src/components/Tabs.d.ts +4 -2
- package/dist/src/components/Tabs.js +15 -10
- package/dist/src/components/Tabs.js.map +1 -1
- package/dist/src/components/Tag.d.ts +1 -1
- package/dist/src/components/Tag.js +17 -8
- package/dist/src/components/Tag.js.map +1 -1
- package/dist/src/components/Timeline.d.ts +13 -0
- package/dist/src/components/Timeline.js +35 -0
- package/dist/src/components/Timeline.js.map +1 -0
- package/dist/src/components/Tooltip.d.ts +1 -1
- package/dist/src/components/Tooltip.js +17 -10
- package/dist/src/components/Tooltip.js.map +1 -1
- package/dist/src/components/Typography.d.ts +5 -5
- package/dist/src/components/Typography.js +38 -23
- package/dist/src/components/Typography.js.map +1 -1
- package/dist/src/index.d.ts +25 -4
- package/dist/src/index.js +15 -5
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface PortalProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
containerId?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Portal component to render children outside the current DOM hierarchy (usually at the end of <body>).
|
|
8
|
+
* This ensures overlays (Modals, Drawers, Tooltips) escape parent overflow: hidden or z-index constraints.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Portal: React.FC<PortalProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
/**
|
|
4
|
+
* Portal component to render children outside the current DOM hierarchy (usually at the end of <body>).
|
|
5
|
+
* This ensures overlays (Modals, Drawers, Tooltips) escape parent overflow: hidden or z-index constraints.
|
|
6
|
+
*/
|
|
7
|
+
export const Portal = ({ children, containerId = 'ds-portal-root' }) => {
|
|
8
|
+
const [mountNode, setMountNode] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
let element = document.getElementById(containerId);
|
|
11
|
+
let created = false;
|
|
12
|
+
if (!element) {
|
|
13
|
+
element = document.createElement('div');
|
|
14
|
+
element.id = containerId;
|
|
15
|
+
document.body.appendChild(element);
|
|
16
|
+
created = true;
|
|
17
|
+
}
|
|
18
|
+
setMountNode(element);
|
|
19
|
+
return () => {
|
|
20
|
+
if (created && element && element.parentNode) {
|
|
21
|
+
element.parentNode.removeChild(element);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}, [containerId]);
|
|
25
|
+
if (!mountNode)
|
|
26
|
+
return null;
|
|
27
|
+
return createPortal(children, mountNode);
|
|
28
|
+
};
|
|
29
|
+
Portal.displayName = 'Portal';
|
|
30
|
+
//# sourceMappingURL=Portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Portal.js","sourceRoot":"","sources":["../../../src/components/Portal.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAOzC;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,WAAW,GAAG,gBAAgB,EAAE,EAAE,EAAE;IAC5F,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAqB,IAAI,CAAC,CAAC;IAErE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,KAAK,CAAC;QAEpB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACxC,OAAO,CAAC,EAAE,GAAG,WAAW,CAAC;YACzB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YACnC,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;QAED,YAAY,CAAC,OAAO,CAAC,CAAC;QAEtB,OAAO,GAAG,EAAE;YACV,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;gBAC7C,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,OAAO,YAAY,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -13,7 +13,10 @@ export interface RadioProps {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
style?: React.CSSProperties;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
16
|
+
export interface RadioComponent extends React.ForwardRefExoticComponent<RadioProps & React.RefAttributes<HTMLInputElement>> {
|
|
17
|
+
Group: typeof RadioGroup;
|
|
18
|
+
}
|
|
19
|
+
export declare const Radio: RadioComponent;
|
|
17
20
|
export interface RadioGroupProps {
|
|
18
21
|
children: React.ReactNode;
|
|
19
22
|
direction?: 'row' | 'column';
|
|
@@ -22,4 +25,4 @@ export interface RadioGroupProps {
|
|
|
22
25
|
className?: string;
|
|
23
26
|
style?: React.CSSProperties;
|
|
24
27
|
}
|
|
25
|
-
export declare const RadioGroup: React.
|
|
28
|
+
export declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { tokens } from '../tokens';
|
|
3
4
|
const COLOR_MAP = {
|
|
4
5
|
primary: tokens.color.primary,
|
|
@@ -11,7 +12,7 @@ const SIZE_CONFIG = {
|
|
|
11
12
|
md: { outer: '20px', inner: '10px' },
|
|
12
13
|
lg: { outer: '24px', inner: '12px' },
|
|
13
14
|
};
|
|
14
|
-
export const Radio = ({ label, description, checked, name, value, onChange, disabled = false, size = 'md', color = 'primary', className = '', style = {}, }) => {
|
|
15
|
+
export const Radio = React.forwardRef(({ label, description, checked, name, value, onChange, disabled = false, size = 'md', color = 'primary', className = '', style = {}, }, ref) => {
|
|
15
16
|
const activeColor = COLOR_MAP[color] || tokens.color.primary;
|
|
16
17
|
const sc = SIZE_CONFIG[size] || SIZE_CONFIG.md;
|
|
17
18
|
const containerStyle = {
|
|
@@ -47,7 +48,7 @@ export const Radio = ({ label, description, checked, name, value, onChange, disa
|
|
|
47
48
|
opacity: checked ? 1 : 0,
|
|
48
49
|
transition: 'transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease',
|
|
49
50
|
};
|
|
50
|
-
return (_jsxs("label", { style: containerStyle, className: `ds-radio ${className}`, children: [_jsxs("div", { style: { position: 'relative', display: 'flex', alignItems: 'center', flexShrink: 0 }, children: [_jsx("input", { 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: {
|
|
51
|
+
return (_jsxs("label", { style: containerStyle, className: `ds-radio ${className}`, children: [_jsxs("div", { style: { position: 'relative', display: 'flex', alignItems: 'center', flexShrink: 0 }, 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: {
|
|
51
52
|
fontSize: tokens.font.sm,
|
|
52
53
|
fontWeight: tokens.font.weightSemibold,
|
|
53
54
|
color: disabled ? tokens.color.textDisabled : tokens.color.text,
|
|
@@ -58,10 +59,11 @@ export const Radio = ({ label, description, checked, name, value, onChange, disa
|
|
|
58
59
|
color: tokens.color.textMuted,
|
|
59
60
|
lineHeight: 1.4,
|
|
60
61
|
}, children: description }))] }))] }));
|
|
61
|
-
};
|
|
62
|
-
|
|
62
|
+
});
|
|
63
|
+
Radio.displayName = 'Radio';
|
|
64
|
+
export const RadioGroup = React.forwardRef(({ children, direction = 'column', spacing = '3', label, className = '', style = {} }, ref) => {
|
|
63
65
|
var _a;
|
|
64
|
-
return (_jsxs("div", { role: "radiogroup", style: { ...style }, className: `ds-radio-group ${className}`, children: [label && (_jsx("div", { style: {
|
|
66
|
+
return (_jsxs("div", { ref: ref, role: "radiogroup", "aria-label": label, style: { ...style }, className: `ds-radio-group ${className}`, children: [label && (_jsx("div", { style: {
|
|
65
67
|
fontSize: tokens.font.xs,
|
|
66
68
|
fontWeight: tokens.font.weightBold,
|
|
67
69
|
color: tokens.color.slate500,
|
|
@@ -73,5 +75,7 @@ export const RadioGroup = ({ children, direction = 'column', spacing = '3', labe
|
|
|
73
75
|
flexDirection: direction,
|
|
74
76
|
gap: (_a = tokens.spacing[spacing]) !== null && _a !== void 0 ? _a : tokens.spacing['3'],
|
|
75
77
|
}, children: children })] }));
|
|
76
|
-
};
|
|
78
|
+
});
|
|
79
|
+
RadioGroup.displayName = 'Radio.Group';
|
|
80
|
+
Radio.Group = RadioGroup;
|
|
77
81
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sourceRoot":"","sources":["../../../src/components/Radio.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Radio.js","sour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;AAEpB,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAW5B,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACxC,CAAC,EAAE,QAAQ,EAAE,SAAS,GAAG,QAAQ,EAAE,OAAO,GAAG,GAAG,EAAE,KAAK,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;;IAAC,OAAA,CAC7F,eACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,YAAY,gBACL,KAAK,EACjB,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,EACnB,SAAS,EAAE,kBAAkB,SAAS,EAAE,aAEvC,KAAK,IAAI,CACR,cACE,KAAK,EAAE;oBACL,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;oBACxB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU;oBAClC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;oBAC5B,aAAa,EAAE,WAAoB;oBACnC,aAAa,EAAE,QAAQ;oBACvB,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;iBAClC,YAEA,KAAK,GACF,CACP,EACD,cACE,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,aAAa,EAAE,SAAS;oBACxB,GAAG,EAAE,MAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,mCAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;iBACpD,YAEA,QAAQ,GACL,IACF,CACP,CAAA;CAAA,CACF,CAAC;AACF,UAAU,CAAC,WAAW,GAAG,aAAa,CAAC;AAEvC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ResultProps {
|
|
3
|
+
status: 'success' | 'error' | 'info' | 'warning' | '404' | '403';
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
subTitle?: React.ReactNode;
|
|
6
|
+
extra?: React.ReactNode;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const Result: React.FC<ResultProps>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { tokens } from '../tokens';
|
|
3
|
+
const STATUS_ICONS = {
|
|
4
|
+
success: {
|
|
5
|
+
color: tokens.color.success,
|
|
6
|
+
icon: (_jsxs("svg", { width: "72", height: "72", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("polyline", { points: "16 9 11 14 8 11" })] })),
|
|
7
|
+
},
|
|
8
|
+
error: {
|
|
9
|
+
color: tokens.color.danger,
|
|
10
|
+
icon: (_jsxs("svg", { width: "72", height: "72", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", 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" })] })),
|
|
11
|
+
},
|
|
12
|
+
warning: {
|
|
13
|
+
color: tokens.color.warning,
|
|
14
|
+
icon: (_jsxs("svg", { width: "72", height: "72", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }), _jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }), _jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })] })),
|
|
15
|
+
},
|
|
16
|
+
info: {
|
|
17
|
+
color: tokens.color.info,
|
|
18
|
+
icon: (_jsxs("svg", { width: "72", height: "72", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", 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" })] })),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const Result = ({ status, title, subTitle, extra, children }) => {
|
|
22
|
+
const is404 = status === '404';
|
|
23
|
+
const is403 = status === '403';
|
|
24
|
+
const iconInfo = STATUS_ICONS[status];
|
|
25
|
+
return (_jsxs("div", { style: {
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
padding: `${tokens.spacing[12]} ${tokens.spacing[6]}`,
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
}, children: [_jsx("div", { style: { marginBottom: tokens.spacing[6], color: (iconInfo === null || iconInfo === void 0 ? void 0 : iconInfo.color) || tokens.color.slate300 }, children: is404 ? (_jsx("div", { style: { fontSize: '72px', fontWeight: tokens.font.weightBold, color: tokens.color.slate200 }, children: "404" })) : is403 ? (_jsx("div", { style: { fontSize: '72px', fontWeight: tokens.font.weightBold, color: tokens.color.slate200 }, children: "403" })) : (iconInfo === null || iconInfo === void 0 ? void 0 : iconInfo.icon) }), _jsx("h2", { style: {
|
|
32
|
+
fontSize: tokens.font['2xl'],
|
|
33
|
+
fontWeight: tokens.font.weightBold,
|
|
34
|
+
color: tokens.color.slate800,
|
|
35
|
+
margin: `0 0 ${tokens.spacing[2]} 0`,
|
|
36
|
+
}, children: title }), subTitle && (_jsx("div", { style: {
|
|
37
|
+
fontSize: tokens.font.md,
|
|
38
|
+
color: tokens.color.slate500,
|
|
39
|
+
maxWidth: '600px',
|
|
40
|
+
lineHeight: 1.6,
|
|
41
|
+
}, children: subTitle })), extra && _jsx("div", { style: { marginTop: tokens.spacing[8] }, children: extra }), children && (_jsx("div", { style: {
|
|
42
|
+
marginTop: tokens.spacing[8],
|
|
43
|
+
padding: tokens.spacing[8],
|
|
44
|
+
backgroundColor: tokens.color.slate50,
|
|
45
|
+
borderRadius: tokens.radius.xl,
|
|
46
|
+
width: '100%',
|
|
47
|
+
maxWidth: '800px',
|
|
48
|
+
textAlign: 'left',
|
|
49
|
+
}, children: children }))] }));
|
|
50
|
+
};
|
|
51
|
+
Result.displayName = 'Result';
|
|
52
|
+
//# sourceMappingURL=Result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Result.js","sourceRoot":"","sources":["../../../src/components/Result.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUnC,MAAM,YAAY,GAA6D;IAC7E,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;QAC3B,IAAI,EAAE,CACJ,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,aAC/F,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,GAAG,EACjC,mBAAU,MAAM,EAAC,iBAAiB,GAAG,IACjC,CACP;KACF;IACD,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;QAC1B,IAAI,EAAE,CACJ,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,aAC/F,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,IAAI,GAAG,EACjC,eAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,IAAI,GAAG,EACtC,eAAM,EAAE,EAAC,GAAG,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AM,CAAC,IAAI,CAAC,UAAU;oBAClC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;oBAC5B,MAAM,EAAE,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;iBACrC,YAEA,KAAK,GACH,EAEJ,QAAQ,IAAI,CACX,cACE,KAAK,EAAE;oBACL,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE;oBACxB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;oBAC5B,QAAQ,EAAE,OAAO;oBACjB,UAAU,EAAE,GAAG;iBAChB,YAEA,QAAQ,GACL,CACP,EAEA,KAAK,IAAI,cAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,YAAG,KAAK,GAAO,EAEpE,QAAQ,IAAI,CACX,cACE,KAAK,EAAE;oBACL,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC5B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC1B,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;oBACrC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;oBAC9B,KAAK,EAAE,MAAM;oBACb,QAAQ,EAAE,OAAO;oBACjB,SAAS,EAAE,MAAM;iBAClB,YAEA,QAAQ,GACL,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import { tokens } from '../tokens';
|
|
4
4
|
const floatingLabelStyle = {
|
|
5
5
|
position: 'absolute',
|
|
@@ -15,12 +15,12 @@ const floatingLabelStyle = {
|
|
|
15
15
|
zIndex: 10,
|
|
16
16
|
transition: tokens.transition.fast,
|
|
17
17
|
};
|
|
18
|
-
export const Select = ({ label, required, options, value, onChange, placeholder = 'Chọn...', className = '', style = {}, error, leadingIcon, searchable = true }) => {
|
|
18
|
+
export const Select = React.forwardRef(({ label, required, options, value, onChange, placeholder = 'Chọn...', className = '', style = {}, error, leadingIcon, searchable = true, }, ref) => {
|
|
19
19
|
const [isOpen, setIsOpen] = useState(false);
|
|
20
20
|
const [searchValue, setSearchValue] = useState('');
|
|
21
21
|
const containerRef = useRef(null);
|
|
22
22
|
// Normalize options to objects
|
|
23
|
-
const normalizedOptions = options === null || options === void 0 ? void 0 : options.map(opt => typeof opt === 'string' ? { label: opt, value: opt } : opt);
|
|
23
|
+
const normalizedOptions = options === null || options === void 0 ? void 0 : options.map((opt) => typeof opt === 'string' ? { label: opt, value: opt } : opt);
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
const handleClickOutside = (event) => {
|
|
26
26
|
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
@@ -28,9 +28,19 @@ export const Select = ({ label, required, options, value, onChange, placeholder
|
|
|
28
28
|
setSearchValue('');
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
+
const handleKeydown = (e) => {
|
|
32
|
+
if (e.key === 'Escape' && isOpen) {
|
|
33
|
+
setIsOpen(false);
|
|
34
|
+
setSearchValue('');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
31
37
|
document.addEventListener('mousedown', handleClickOutside);
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
document.addEventListener('keydown', handleKeydown);
|
|
39
|
+
return () => {
|
|
40
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
41
|
+
document.removeEventListener('keydown', handleKeydown);
|
|
42
|
+
};
|
|
43
|
+
}, [isOpen]);
|
|
34
44
|
const handleSelectValue = (val) => {
|
|
35
45
|
if (onChange) {
|
|
36
46
|
onChange(val);
|
|
@@ -38,17 +48,27 @@ export const Select = ({ label, required, options, value, onChange, placeholder
|
|
|
38
48
|
setIsOpen(false);
|
|
39
49
|
setSearchValue('');
|
|
40
50
|
};
|
|
41
|
-
const selectedOption = normalizedOptions.find(opt => opt.value === value);
|
|
42
|
-
const filteredOptions = normalizedOptions.filter(opt => opt.label.toLowerCase().includes(searchValue.toLowerCase()));
|
|
43
|
-
return (_jsxs("div", { ref:
|
|
51
|
+
const selectedOption = normalizedOptions.find((opt) => opt.value === value);
|
|
52
|
+
const filteredOptions = normalizedOptions.filter((opt) => opt.label.toLowerCase().includes(searchValue.toLowerCase()));
|
|
53
|
+
return (_jsxs("div", { ref: (el) => {
|
|
54
|
+
containerRef.current = el;
|
|
55
|
+
if (typeof ref === 'function')
|
|
56
|
+
ref(el);
|
|
57
|
+
else if (ref)
|
|
58
|
+
ref.current = el;
|
|
59
|
+
}, className: className, style: { position: 'relative', width: '100%', ...style }, children: [label && (_jsxs("label", { style: {
|
|
44
60
|
...floatingLabelStyle,
|
|
45
|
-
color: isOpen
|
|
46
|
-
|
|
61
|
+
color: isOpen
|
|
62
|
+
? tokens.color.borderFocus
|
|
63
|
+
: error
|
|
64
|
+
? tokens.color.danger
|
|
65
|
+
: tokens.color.slate400,
|
|
66
|
+
left: leadingIcon ? '40px' : '14px',
|
|
47
67
|
}, children: [label, " ", required && _jsx("span", { style: { color: tokens.color.danger }, children: "*" })] })), _jsxs("div", { onClick: () => setIsOpen(!isOpen), style: {
|
|
48
68
|
minHeight: '46px',
|
|
49
69
|
padding: '10px 14px',
|
|
50
70
|
backgroundColor: tokens.color.white,
|
|
51
|
-
border: `1px solid ${error ? tokens.color.danger :
|
|
71
|
+
border: `1px solid ${error ? tokens.color.danger : isOpen ? tokens.color.borderFocus : tokens.color.slate200}`,
|
|
52
72
|
borderRadius: tokens.radius.lg,
|
|
53
73
|
display: 'flex',
|
|
54
74
|
alignItems: 'center',
|
|
@@ -61,8 +81,21 @@ export const Select = ({ label, required, options, value, onChange, placeholder
|
|
|
61
81
|
color: isOpen ? tokens.color.primary : tokens.color.slate300,
|
|
62
82
|
display: 'flex',
|
|
63
83
|
alignItems: 'center',
|
|
64
|
-
marginTop: '2px'
|
|
65
|
-
}, children: leadingIcon })), _jsx("div", { style: { flex: 1 }, children: selectedOption ? (_jsx("span", { style: {
|
|
84
|
+
marginTop: '2px',
|
|
85
|
+
}, children: leadingIcon })), _jsx("div", { style: { flex: 1 }, children: selectedOption ? (_jsx("span", { style: {
|
|
86
|
+
fontSize: tokens.font.sm,
|
|
87
|
+
fontWeight: tokens.font.weightBold,
|
|
88
|
+
color: tokens.color.slate800,
|
|
89
|
+
}, children: selectedOption.label })) : (_jsx("span", { style: {
|
|
90
|
+
color: tokens.color.slate400,
|
|
91
|
+
fontSize: tokens.font.sm,
|
|
92
|
+
fontWeight: tokens.font.weightMedium,
|
|
93
|
+
}, children: placeholder })) }), _jsx("div", { style: { color: tokens.color.slate300 }, children: _jsx("svg", { style: {
|
|
94
|
+
width: '18px',
|
|
95
|
+
height: '18px',
|
|
96
|
+
transition: tokens.transition.fast,
|
|
97
|
+
transform: isOpen ? 'rotate(180deg)' : 'none',
|
|
98
|
+
}, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "6 9 12 15 18 9" }) }) })] }), isOpen && (_jsxs("div", { style: {
|
|
66
99
|
position: 'absolute',
|
|
67
100
|
top: '100%',
|
|
68
101
|
left: 0,
|
|
@@ -74,8 +107,14 @@ export const Select = ({ label, required, options, value, onChange, placeholder
|
|
|
74
107
|
border: `1px solid ${tokens.color.slate100}`,
|
|
75
108
|
zIndex: 2000,
|
|
76
109
|
overflow: 'hidden',
|
|
77
|
-
animation: 'reveal 0.2s ease-out'
|
|
78
|
-
}, children: [searchable && (_jsx("div", { style: { padding: '10px 12px', borderBottom: `1px solid ${tokens.color.slate100}` }, children: _jsxs("div", { style: { position: 'relative' }, children: [_jsx("div", { style: {
|
|
110
|
+
animation: 'reveal 0.2s ease-out',
|
|
111
|
+
}, children: [searchable && (_jsx("div", { style: { padding: '10px 12px', borderBottom: `1px solid ${tokens.color.slate100}` }, children: _jsxs("div", { style: { position: 'relative' }, children: [_jsx("div", { style: {
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
left: '10px',
|
|
114
|
+
top: '50%',
|
|
115
|
+
transform: 'translateY(-50%)',
|
|
116
|
+
color: tokens.color.slate300,
|
|
117
|
+
}, children: _jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("circle", { cx: "11", cy: "11", r: "8" }), _jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })] }) }), _jsx("input", { type: "text", autoFocus: true, value: searchValue, onChange: (e) => setSearchValue(e.target.value), placeholder: "T\u00ECm ki\u1EBFm...", style: {
|
|
79
118
|
width: '100%',
|
|
80
119
|
padding: '8px 12px 8px 32px',
|
|
81
120
|
fontSize: '12px',
|
|
@@ -83,7 +122,7 @@ export const Select = ({ label, required, options, value, onChange, placeholder
|
|
|
83
122
|
border: 'none',
|
|
84
123
|
borderRadius: '10px',
|
|
85
124
|
outline: 'none',
|
|
86
|
-
}, onKeyDown: (e) => e.stopPropagation() })] }) })), _jsx("div", { style: { maxHeight: '240px', overflowY: 'auto', padding: '4px' }, children: filteredOptions.length > 0 ? (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map(opt => {
|
|
125
|
+
}, onKeyDown: (e) => e.stopPropagation() })] }) })), _jsx("div", { style: { maxHeight: '240px', overflowY: 'auto', padding: '4px' }, children: filteredOptions.length > 0 ? (filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.map((opt) => {
|
|
87
126
|
const isSelected = value === opt.value;
|
|
88
127
|
return (_jsxs("div", { onClick: (e) => {
|
|
89
128
|
e.stopPropagation();
|
|
@@ -100,12 +139,24 @@ export const Select = ({ label, required, options, value, onChange, placeholder
|
|
|
100
139
|
transition: tokens.transition.fast,
|
|
101
140
|
fontWeight: isSelected ? tokens.font.weightBold : tokens.font.weightMedium,
|
|
102
141
|
color: isSelected ? tokens.color.primary : tokens.color.slate600,
|
|
103
|
-
}, onMouseEnter: (e) => e.currentTarget.style.backgroundColor = tokens.color.slate50, onMouseLeave: (e) => e.currentTarget.style.backgroundColor = 'transparent', children: [opt.label, isSelected && (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: tokens.color.primary, strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "20 6 9 17 4 12" }) }))] }, opt.value));
|
|
104
|
-
})) : (_jsx("div", { style: {
|
|
142
|
+
}, onMouseEnter: (e) => (e.currentTarget.style.backgroundColor = tokens.color.slate50), onMouseLeave: (e) => (e.currentTarget.style.backgroundColor = 'transparent'), children: [opt.label, isSelected && (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: tokens.color.primary, strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "20 6 9 17 4 12" }) }))] }, opt.value));
|
|
143
|
+
})) : (_jsx("div", { style: {
|
|
144
|
+
padding: '20px',
|
|
145
|
+
textAlign: 'center',
|
|
146
|
+
color: tokens.color.slate400,
|
|
147
|
+
fontSize: '11px',
|
|
148
|
+
fontStyle: 'italic',
|
|
149
|
+
}, children: "Kh\u00F4ng t\u00ECm th\u1EA5y k\u1EBFt qu\u1EA3 ph\u00F9 h\u1EE3p" })) })] })), error && (_jsx("p", { style: {
|
|
150
|
+
fontSize: '11px',
|
|
151
|
+
color: tokens.color.danger,
|
|
152
|
+
marginTop: '6px',
|
|
153
|
+
fontWeight: tokens.font.weightMedium,
|
|
154
|
+
}, children: error })), _jsx("style", { children: `
|
|
105
155
|
@keyframes reveal {
|
|
106
156
|
from { opacity: 0; transform: translateY(-8px); }
|
|
107
157
|
to { opacity: 1; transform: translateY(0); }
|
|
108
158
|
}
|
|
109
159
|
` })] }));
|
|
110
|
-
};
|
|
160
|
+
});
|
|
161
|
+
Select.displayName = 'Select';
|
|
111
162
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/Select.tsx"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"Select.js","sourceRoot":"","sources":["../../../src/components/Select.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,kBAAkB,GAAwB;IAC9C,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,MAAM;IACZ,eAAe,EAAE,OAAO;IACxB,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU;IAClC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;IAC5B,aAAa,EAAE,WAAW;IAC1B,aAAa,EAAE,OAAO;IACtB,MAAM,EAAE,EAAE;IACV,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI;CACnC,CAAC;AAqBF,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CACpC,CACE,EACE,KAAK,EACL,QAAQ,EACR,OAAO,EACP,KAAK,EACL,QAAQ,EACR,WAAW,GAAG,SAAS,EACvB,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,EACV,KAAK,EACL,WAAW,EACX,UAAU,GAAG,IAAI,GAClB,EACD,GAAG,EACH,EAAE;IACF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAA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AK,CAAC,OAAO,CAAC,EACnF,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,GAAG,aAAa,CAAC,aAE3E,GAAG,CAAC,KAAK,EACT,UAAU,IAAI,CACb,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAC5B,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,YAEtB,mBAAU,MAAM,EAAC,gBAAgB,GAAY,GACzC,CACP,KAnCI,GAAG,CAAC,KAAK,CAoCV,CACP,CAAC;wBACJ,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,cACE,KAAK,EAAE;gCACL,OAAO,EAAE,MAAM;gCACf,SAAS,EAAE,QAAQ;gCACnB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;gCAC5B,QAAQ,EAAE,MAAM;gCAChB,SAAS,EAAE,QAAQ;6BACpB,kFAGG,CACP,GACG,IACF,CACP,EAEA,KAAK,IAAI,CACR,YACE,KAAK,EAAE;oBACL,QAAQ,EAAE,MAAM;oBAChB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM;oBAC1B,SAAS,EAAE,KAAK;oBAChB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY;iBACrC,YAEA,KAAK,GACJ,CACL,EAED,0BAAQ;;;;;OAKT,GAAS,IACJ,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AACF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAC"}
|
|
@@ -6,4 +6,4 @@ export interface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
6
6
|
lines?: number;
|
|
7
7
|
animation?: 'wave' | 'pulse' | 'none';
|
|
8
8
|
}
|
|
9
|
-
export declare const Skeleton: React.
|
|
9
|
+
export declare const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { tokens } from '../tokens';
|
|
3
4
|
const KEYFRAMES = `
|
|
4
5
|
@keyframes ds-skeleton-wave {
|
|
@@ -10,7 +11,7 @@ const KEYFRAMES = `
|
|
|
10
11
|
50% { opacity: 0.4; }
|
|
11
12
|
}
|
|
12
13
|
`;
|
|
13
|
-
const SingleSkeleton = ({ variant = 'text', width, height, animation = 'wave', className = '', style = {}, ...props }) => {
|
|
14
|
+
const SingleSkeleton = React.forwardRef(({ variant = 'text', width, height, animation = 'wave', className = '', style = {}, ...props }, ref) => {
|
|
14
15
|
const getDims = () => {
|
|
15
16
|
if (variant === 'circle') {
|
|
16
17
|
const d = width || '40px';
|
|
@@ -42,17 +43,19 @@ const SingleSkeleton = ({ variant = 'text', width, height, animation = 'wave', c
|
|
|
42
43
|
animation: 'ds-skeleton-pulse 1.5s ease-in-out infinite',
|
|
43
44
|
}
|
|
44
45
|
: { backgroundColor: tokens.color.slate100 };
|
|
45
|
-
return (_jsxs(_Fragment, { children: [_jsx("style", { children: KEYFRAMES }), _jsx("div", { style: {
|
|
46
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: KEYFRAMES }), _jsx("div", { ref: ref, role: "progressbar", "aria-busy": "true", style: {
|
|
46
47
|
...getDims(),
|
|
47
48
|
...animStyle,
|
|
48
49
|
overflow: 'hidden',
|
|
49
50
|
...style,
|
|
50
51
|
}, className: `ds-skeleton ${className}`, ...props })] }));
|
|
51
|
-
};
|
|
52
|
-
|
|
52
|
+
});
|
|
53
|
+
SingleSkeleton.displayName = 'Skeleton.Inner';
|
|
54
|
+
export const Skeleton = React.forwardRef(({ lines, variant = 'text', animation = 'wave', width, height, className = '', style = {}, ...props }, ref) => {
|
|
53
55
|
if (lines && lines > 1 && variant === 'text') {
|
|
54
|
-
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '8px', ...style }, className: className, children: Array.from({ length: lines }).map((_, i) => (_jsx(SingleSkeleton, { variant: "text", animation: animation, width: i === lines - 1 ? '70%' : '100%', height: height, ...props }, i))) }));
|
|
56
|
+
return (_jsx("div", { ref: ref, style: { display: 'flex', flexDirection: 'column', gap: '8px', ...style }, className: className, children: Array.from({ length: lines }).map((_, i) => (_jsx(SingleSkeleton, { variant: "text", animation: animation, width: i === lines - 1 ? '70%' : '100%', height: height, ...props }, i))) }));
|
|
55
57
|
}
|
|
56
|
-
return (_jsx(SingleSkeleton, { variant: variant, animation: animation, width: width, height: height, className: className, style: style, ...props }));
|
|
57
|
-
};
|
|
58
|
+
return (_jsx(SingleSkeleton, { ref: ref, variant: variant, animation: animation, width: width, height: height, className: className, style: style, ...props }));
|
|
59
|
+
});
|
|
60
|
+
Skeleton.displayName = 'Skeleton';
|
|
58
61
|
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../../../src/components/Skeleton.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../../../src/components/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUnC,MAAM,SAAS,GAAG;;;;;;;;;CASjB,CAAC;AAEF,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CACrC,CACE,EACE,OAAO,GAAG,MAAM,EAChB,KAAK,EACL,MAAM,EACN,SAAS,GAAG,MAAM,EAClB,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,EACV,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,OAAO,G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AC,CAMN,CACH,CAAC,GACE,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,cAAc,IACb,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,KACR,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { tokens } from '../tokens';
|
|
3
4
|
const getColors = (status) => {
|
|
4
5
|
switch (status) {
|
|
@@ -15,9 +16,9 @@ const getColors = (status) => {
|
|
|
15
16
|
};
|
|
16
17
|
const ICON_SIZE = { sm: '28px', md: '36px', lg: '44px' };
|
|
17
18
|
const FONT_SIZE = { sm: tokens.font.xs, md: tokens.font.sm, lg: tokens.font.base };
|
|
18
|
-
export const Steps = ({ currentStep = 0, items = [], direction = 'horizontal', size = 'md', className = '', style = {},
|
|
19
|
+
export const Steps = React.forwardRef(({ currentStep = 0, items = [], direction = 'horizontal', size = 'md', className = '', style = {} }, ref) => {
|
|
19
20
|
const isVertical = direction === 'vertical';
|
|
20
|
-
return (_jsx("div", { style: {
|
|
21
|
+
return (_jsx("div", { ref: ref, role: "list", style: {
|
|
21
22
|
display: 'flex',
|
|
22
23
|
flexDirection: isVertical ? 'column' : 'row',
|
|
23
24
|
gap: 0,
|
|
@@ -25,10 +26,11 @@ export const Steps = ({ currentStep = 0, items = [], direction = 'horizontal', s
|
|
|
25
26
|
...style,
|
|
26
27
|
}, className: `ds-steps ds-steps--${direction} ${className}`, children: items.map((item, index) => {
|
|
27
28
|
const status = index < currentStep ? 'finish' : index === currentStep ? 'process' : 'wait';
|
|
28
|
-
return (_jsx(StepItemComponent, { index: index, status: status, title: item.title, description: item.description, icon: item.icon, direction: direction, isLast: index === items.length - 1, size: size }, index));
|
|
29
|
+
return (_jsx(StepItemComponent, { index: index, status: status, title: item.title, description: item.description, icon: item.icon, direction: direction, isLast: index === items.length - 1, size: size, isCurrent: index === currentStep }, index));
|
|
29
30
|
}) }));
|
|
30
|
-
};
|
|
31
|
-
|
|
31
|
+
});
|
|
32
|
+
Steps.displayName = 'Steps';
|
|
33
|
+
const StepItemComponent = ({ index, status, title, description, icon, direction, isLast, size, isCurrent, }) => {
|
|
32
34
|
const isHorizontal = direction === 'horizontal';
|
|
33
35
|
const c = getColors(status);
|
|
34
36
|
const iconSize = ICON_SIZE[size] || ICON_SIZE.md;
|
|
@@ -36,7 +38,7 @@ const StepItemComponent = ({ index, status, title, description, icon, direction,
|
|
|
36
38
|
const fontSize = FONT_SIZE[size] || tokens.font.sm;
|
|
37
39
|
const CheckIcon = () => (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "20 6 9 17 4 12" }) }));
|
|
38
40
|
const ErrorIcon = () => (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", children: _jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }));
|
|
39
|
-
return (_jsxs("div", { style: {
|
|
41
|
+
return (_jsxs("div", { role: "listitem", "aria-current": isCurrent ? 'step' : undefined, style: {
|
|
40
42
|
display: 'flex',
|
|
41
43
|
flexDirection: isHorizontal ? 'column' : 'row',
|
|
42
44
|
flex: isHorizontal ? (isLast ? 'none' : 1) : 'none',
|
|
@@ -80,22 +82,23 @@ const StepItemComponent = ({ index, status, title, description, icon, direction,
|
|
|
80
82
|
zIndex: 2,
|
|
81
83
|
flexShrink: 0,
|
|
82
84
|
transition: tokens.transition.normal,
|
|
83
|
-
boxShadow: status === 'process'
|
|
84
|
-
? `0 0 0 4px ${tokens.color.primaryLight}`
|
|
85
|
-
: 'none',
|
|
85
|
+
boxShadow: status === 'process' ? `0 0 0 4px ${tokens.color.primaryLight}` : 'none',
|
|
86
86
|
marginBottom: isHorizontal ? tokens.spacing['2'] : 0,
|
|
87
87
|
marginRight: !isHorizontal ? tokens.spacing['3'] : 0,
|
|
88
|
-
}, children: icon ? icon : status === 'finish' ? _jsx(CheckIcon, {}) : status === 'error' ? _jsx(ErrorIcon, {}) : index + 1 }), _jsxs("div", { style: {
|
|
88
|
+
}, children: icon ? (icon) : status === 'finish' ? (_jsx(CheckIcon, {})) : status === 'error' ? (_jsx(ErrorIcon, {})) : (index + 1) }), _jsxs("div", { style: {
|
|
89
89
|
textAlign: isHorizontal ? 'center' : 'left',
|
|
90
90
|
paddingTop: !isHorizontal ? '6px' : 0,
|
|
91
91
|
paddingBottom: !isHorizontal && !isLast ? tokens.spacing['8'] : 0,
|
|
92
92
|
}, children: [_jsx("div", { style: {
|
|
93
93
|
fontSize,
|
|
94
94
|
fontWeight: status === 'process' ? tokens.font.weightBold : tokens.font.weightSemibold,
|
|
95
|
-
color: status === 'wait'
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
color: status === 'wait'
|
|
96
|
+
? tokens.color.textDisabled
|
|
97
|
+
: status === 'error'
|
|
98
|
+
? tokens.color.danger
|
|
99
|
+
: status === 'process'
|
|
100
|
+
? tokens.color.primary
|
|
101
|
+
: tokens.color.text,
|
|
99
102
|
lineHeight: 1.35,
|
|
100
103
|
transition: tokens.transition.fast,
|
|
101
104
|
}, children: title }), description && (_jsx("div", { style: {
|