shared-design-system 1.10.0 → 1.12.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/Avatar.d.ts +2 -1
- package/dist/src/components/Avatar.js +39 -21
- package/dist/src/components/Avatar.js.map +1 -1
- package/dist/src/components/Badge.d.ts +3 -2
- package/dist/src/components/Badge.js +51 -25
- package/dist/src/components/Badge.js.map +1 -1
- package/dist/src/components/Button.d.ts +2 -0
- package/dist/src/components/Button.js +28 -12
- package/dist/src/components/Button.js.map +1 -1
- package/dist/src/components/Card.d.ts +4 -1
- package/dist/src/components/Card.js +43 -18
- package/dist/src/components/Card.js.map +1 -1
- package/dist/src/components/DatePicker.d.ts +3 -0
- package/dist/src/components/DatePicker.js +227 -0
- package/dist/src/components/DatePicker.js.map +1 -0
- package/dist/src/components/Divider.d.ts +2 -0
- package/dist/src/components/Divider.js +20 -12
- package/dist/src/components/Divider.js.map +1 -1
- package/dist/src/components/InputComponents.d.ts +4 -4
- package/dist/src/components/InputComponents.js +99 -99
- package/dist/src/components/InputComponents.js.map +1 -1
- package/dist/src/components/MultiSelect.d.ts +14 -0
- package/dist/src/components/MultiSelect.js +142 -0
- package/dist/src/components/MultiSelect.js.map +1 -0
- package/dist/src/components/ReadOnlyField.d.ts +2 -1
- package/dist/src/components/ReadOnlyField.js +20 -13
- package/dist/src/components/ReadOnlyField.js.map +1 -1
- package/dist/src/components/Select.d.ts +19 -0
- package/dist/src/components/Select.js +110 -0
- package/dist/src/components/Select.js.map +1 -0
- package/dist/src/components/Stack.d.ts +2 -0
- package/dist/src/components/Stack.js +18 -5
- package/dist/src/components/Stack.js.map +1 -1
- package/dist/src/components/Table.d.ts +6 -12
- package/dist/src/components/Table.js +13 -7
- package/dist/src/components/Table.js.map +1 -1
- package/dist/src/components/Tag.d.ts +3 -2
- package/dist/src/components/Tag.js +22 -22
- package/dist/src/components/Tag.js.map +1 -1
- package/dist/src/components/Typography.d.ts +2 -2
- package/dist/src/components/Typography.js +16 -8
- package/dist/src/components/Typography.js.map +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { tokens } from '../tokens';
|
|
4
|
+
const Calendar = ({ value, onChange, onClose }) => {
|
|
5
|
+
const now = new Date();
|
|
6
|
+
const [viewDate, setViewDate] = useState(value || now);
|
|
7
|
+
const year = viewDate.getFullYear();
|
|
8
|
+
const month = viewDate.getMonth();
|
|
9
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
10
|
+
const firstDayOfMonth = new Date(year, month, 1).getDay(); // 0 (Sun) to 6 (Sat)
|
|
11
|
+
// Adjusted for Monday start if needed, but 0=Sun is standard for native pickers.
|
|
12
|
+
// Let's stick with 0=Sun.
|
|
13
|
+
const monthNames = [
|
|
14
|
+
'Tháng 1', 'Tháng 2', 'Tháng 3', 'Tháng 4', 'Tháng 5', 'Tháng 6',
|
|
15
|
+
'Tháng 7', 'Tháng 8', 'Tháng 9', 'Tháng 10', 'Tháng 11', 'Tháng 12'
|
|
16
|
+
];
|
|
17
|
+
const daysOfWeek = ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'];
|
|
18
|
+
const handlePrevMonth = (e) => {
|
|
19
|
+
e.stopPropagation();
|
|
20
|
+
setViewDate(new Date(year, month - 1, 1));
|
|
21
|
+
};
|
|
22
|
+
const handleNextMonth = (e) => {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
setViewDate(new Date(year, month + 1, 1));
|
|
25
|
+
};
|
|
26
|
+
const handleDayClick = (day) => {
|
|
27
|
+
const selectedDate = new Date(year, month, day);
|
|
28
|
+
onChange(selectedDate);
|
|
29
|
+
onClose();
|
|
30
|
+
};
|
|
31
|
+
const isSelected = (day) => {
|
|
32
|
+
return value &&
|
|
33
|
+
value.getDate() === day &&
|
|
34
|
+
value.getMonth() === month &&
|
|
35
|
+
value.getFullYear() === year;
|
|
36
|
+
};
|
|
37
|
+
const isToday = (day) => {
|
|
38
|
+
return now.getDate() === day &&
|
|
39
|
+
now.getMonth() === month &&
|
|
40
|
+
now.getFullYear() === year;
|
|
41
|
+
};
|
|
42
|
+
return (_jsxs("div", { style: {
|
|
43
|
+
padding: tokens.spacing[4],
|
|
44
|
+
width: '280px',
|
|
45
|
+
userSelect: 'none'
|
|
46
|
+
}, onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { style: {
|
|
47
|
+
display: 'flex',
|
|
48
|
+
justifyContent: 'space-between',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
marginBottom: tokens.spacing[4]
|
|
51
|
+
}, children: [_jsx("button", { onClick: handlePrevMonth, style: {
|
|
52
|
+
border: 'none',
|
|
53
|
+
background: 'transparent',
|
|
54
|
+
cursor: 'pointer',
|
|
55
|
+
padding: tokens.spacing[1],
|
|
56
|
+
borderRadius: '50%',
|
|
57
|
+
color: tokens.color.slate500,
|
|
58
|
+
transition: tokens.transition.fast,
|
|
59
|
+
}, onMouseEnter: (e) => e.currentTarget.style.backgroundColor = tokens.color.slate100, onMouseLeave: (e) => e.currentTarget.style.backgroundColor = 'transparent', children: _jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "15 18 9 12 15 6" }) }) }), _jsxs("div", { style: { fontWeight: tokens.font.weightBold, color: tokens.color.slate800, fontSize: tokens.font.sm }, children: [monthNames[month], " - ", year] }), _jsx("button", { onClick: handleNextMonth, style: {
|
|
60
|
+
border: 'none',
|
|
61
|
+
background: 'transparent',
|
|
62
|
+
cursor: 'pointer',
|
|
63
|
+
padding: tokens.spacing[1],
|
|
64
|
+
borderRadius: '50%',
|
|
65
|
+
color: tokens.color.slate500,
|
|
66
|
+
transition: tokens.transition.fast,
|
|
67
|
+
}, onMouseEnter: (e) => e.currentTarget.style.backgroundColor = tokens.color.slate100, onMouseLeave: (e) => e.currentTarget.style.backgroundColor = 'transparent', children: _jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "9 18 15 12 9 6" }) }) })] }), _jsx("div", { style: {
|
|
68
|
+
display: 'grid',
|
|
69
|
+
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
70
|
+
marginBottom: tokens.spacing[2],
|
|
71
|
+
textAlign: 'center'
|
|
72
|
+
}, children: daysOfWeek.map(d => (_jsx("div", { style: { fontSize: '11px', fontWeight: tokens.font.weightBold, color: tokens.color.slate400 }, children: d }, d))) }), _jsxs("div", { style: {
|
|
73
|
+
display: 'grid',
|
|
74
|
+
gridTemplateColumns: 'repeat(7, 1fr)',
|
|
75
|
+
gap: '2px'
|
|
76
|
+
}, children: [Array.from({ length: firstDayOfMonth }).map((_, i) => (_jsx("div", {}, `empty-${i}`))), Array.from({ length: daysInMonth }).map((_, i) => {
|
|
77
|
+
const day = i + 1;
|
|
78
|
+
const selected = isSelected(day);
|
|
79
|
+
const today = isToday(day);
|
|
80
|
+
return (_jsx("div", { onClick: () => handleDayClick(day), style: {
|
|
81
|
+
height: '34px',
|
|
82
|
+
display: 'flex',
|
|
83
|
+
alignItems: 'center',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
fontSize: tokens.font.sm,
|
|
86
|
+
borderRadius: '8px',
|
|
87
|
+
cursor: 'pointer',
|
|
88
|
+
transition: tokens.transition.fast,
|
|
89
|
+
fontWeight: selected || today ? tokens.font.weightBold : tokens.font.weightMedium,
|
|
90
|
+
backgroundColor: selected ? tokens.color.primary : (today ? tokens.color.primaryLight : 'transparent'),
|
|
91
|
+
color: selected ? 'white' : (today ? tokens.color.primary : tokens.color.slate700),
|
|
92
|
+
}, onMouseEnter: (e) => {
|
|
93
|
+
if (!selected)
|
|
94
|
+
e.currentTarget.style.backgroundColor = tokens.color.slate100;
|
|
95
|
+
}, onMouseLeave: (e) => {
|
|
96
|
+
if (!selected)
|
|
97
|
+
e.currentTarget.style.backgroundColor = today ? tokens.color.primaryLight : 'transparent';
|
|
98
|
+
}, children: day }, day));
|
|
99
|
+
})] }), _jsx("div", { style: {
|
|
100
|
+
marginTop: tokens.spacing[3],
|
|
101
|
+
paddingTop: tokens.spacing[3],
|
|
102
|
+
borderTop: `1px solid ${tokens.color.slate100}`,
|
|
103
|
+
display: 'flex',
|
|
104
|
+
justifyContent: 'center'
|
|
105
|
+
}, children: _jsx("button", { onClick: (e) => { e.stopPropagation(); handleDayClick(now.getDate()); }, style: {
|
|
106
|
+
border: 'none',
|
|
107
|
+
background: 'transparent',
|
|
108
|
+
color: tokens.color.primary,
|
|
109
|
+
fontSize: '12px',
|
|
110
|
+
fontWeight: tokens.font.weightBold,
|
|
111
|
+
cursor: 'pointer'
|
|
112
|
+
}, children: "H\u00F4m nay" }) })] }));
|
|
113
|
+
};
|
|
114
|
+
const floatingLabelStyle = {
|
|
115
|
+
position: 'absolute',
|
|
116
|
+
top: '-10px',
|
|
117
|
+
left: '14px',
|
|
118
|
+
backgroundColor: 'white',
|
|
119
|
+
padding: '0 6px',
|
|
120
|
+
fontSize: '10px',
|
|
121
|
+
fontWeight: tokens.font.weightBold,
|
|
122
|
+
color: tokens.color.slate400,
|
|
123
|
+
textTransform: 'uppercase',
|
|
124
|
+
letterSpacing: '0.1em',
|
|
125
|
+
zIndex: 10,
|
|
126
|
+
transition: tokens.transition.fast,
|
|
127
|
+
};
|
|
128
|
+
const inputContainerStyle = (isFocused, hasError) => ({
|
|
129
|
+
position: 'relative',
|
|
130
|
+
width: '100%',
|
|
131
|
+
backgroundColor: tokens.color.white,
|
|
132
|
+
border: `1px solid ${hasError ? tokens.color.danger : (isFocused ? tokens.color.borderFocus : tokens.color.slate200)}`,
|
|
133
|
+
borderRadius: tokens.radius.lg,
|
|
134
|
+
padding: '12px 16px',
|
|
135
|
+
transition: tokens.transition.fast,
|
|
136
|
+
boxShadow: isFocused ? '0 0 0 3px rgba(245, 158, 11, 0.1)' : tokens.shadow.sm,
|
|
137
|
+
});
|
|
138
|
+
const inputFieldBaseStyle = {
|
|
139
|
+
width: '100%',
|
|
140
|
+
border: 'none',
|
|
141
|
+
outline: 'none',
|
|
142
|
+
backgroundColor: 'transparent',
|
|
143
|
+
fontSize: tokens.font.sm,
|
|
144
|
+
fontFamily: tokens.font.family,
|
|
145
|
+
fontWeight: tokens.font.weightSemibold,
|
|
146
|
+
color: tokens.color.slate800,
|
|
147
|
+
padding: '4px 0 0 0',
|
|
148
|
+
};
|
|
149
|
+
export const DatePicker = ({ value, onChange, placeholder, label, required, error, ...props }) => {
|
|
150
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
151
|
+
const containerRef = useRef(null);
|
|
152
|
+
// Parse incoming value string if format is YYYY-MM-DD or DD/MM/YYYY
|
|
153
|
+
const parseValue = (val) => {
|
|
154
|
+
if (!val)
|
|
155
|
+
return undefined;
|
|
156
|
+
if (val instanceof Date)
|
|
157
|
+
return val;
|
|
158
|
+
// Try simple parse
|
|
159
|
+
const d = new Date(val);
|
|
160
|
+
if (!isNaN(d.getTime()))
|
|
161
|
+
return d;
|
|
162
|
+
return undefined;
|
|
163
|
+
};
|
|
164
|
+
const [dateValue, setDateValue] = useState(parseValue(value));
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
setDateValue(parseValue(value));
|
|
167
|
+
}, [value]);
|
|
168
|
+
const handleDateChange = (date) => {
|
|
169
|
+
setDateValue(date);
|
|
170
|
+
if (onChange) {
|
|
171
|
+
// Mocking target for native-like onChange
|
|
172
|
+
const event = {
|
|
173
|
+
target: { value: date.toISOString().split('T')[0] },
|
|
174
|
+
};
|
|
175
|
+
onChange(event);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
useEffect(() => {
|
|
179
|
+
const handleClickOutside = (event) => {
|
|
180
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
181
|
+
setIsOpen(false);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
if (isOpen) {
|
|
185
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
186
|
+
}
|
|
187
|
+
return () => {
|
|
188
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
189
|
+
};
|
|
190
|
+
}, [isOpen]);
|
|
191
|
+
const displayValue = dateValue ? dateValue.toLocaleDateString('vi-VN') : '';
|
|
192
|
+
return (_jsxs("div", { ref: containerRef, style: { position: 'relative', width: '100%', ...props.style }, children: [label && (_jsxs("label", { style: {
|
|
193
|
+
...floatingLabelStyle,
|
|
194
|
+
color: isOpen ? tokens.color.borderFocus : (error ? tokens.color.danger : tokens.color.slate400),
|
|
195
|
+
left: '40px'
|
|
196
|
+
}, children: [label, " ", required && _jsx("span", { style: { color: tokens.color.danger }, children: "*" })] })), _jsx("div", { onClick: () => setIsOpen(!isOpen), style: inputContainerStyle(isOpen, !!error), children: _jsxs("div", { style: { position: 'relative', display: 'flex', alignItems: 'center', cursor: 'pointer' }, children: [_jsx("div", { style: {
|
|
197
|
+
position: 'absolute',
|
|
198
|
+
left: '0',
|
|
199
|
+
color: isOpen ? tokens.color.primary : tokens.color.slate300,
|
|
200
|
+
display: 'flex',
|
|
201
|
+
alignItems: 'center',
|
|
202
|
+
zIndex: 1,
|
|
203
|
+
pointerEvents: 'none',
|
|
204
|
+
marginTop: '2px'
|
|
205
|
+
}, children: _jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }), _jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }), _jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }), _jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })] }) }), _jsx("input", { ...props, readOnly: true, placeholder: placeholder || 'Chọn ngày...', value: displayValue, autoComplete: "off", style: {
|
|
206
|
+
...inputFieldBaseStyle,
|
|
207
|
+
paddingLeft: '28px',
|
|
208
|
+
cursor: 'pointer',
|
|
209
|
+
} })] }) }), isOpen && (_jsx("div", { style: {
|
|
210
|
+
position: 'absolute',
|
|
211
|
+
top: '100%',
|
|
212
|
+
left: 0,
|
|
213
|
+
zIndex: 2000,
|
|
214
|
+
marginTop: tokens.spacing[2],
|
|
215
|
+
backgroundColor: tokens.color.white,
|
|
216
|
+
borderRadius: tokens.radius.lg,
|
|
217
|
+
boxShadow: tokens.shadow.xl,
|
|
218
|
+
border: `1px solid ${tokens.color.slate100}`,
|
|
219
|
+
animation: 'fadeIn 0.2s ease-out'
|
|
220
|
+
}, children: _jsx(Calendar, { value: dateValue, onChange: handleDateChange, onClose: () => setIsOpen(false) }) })), _jsx("style", { children: `
|
|
221
|
+
@keyframes fadeIn {
|
|
222
|
+
from { opacity: 0; transform: translateY(-10px); }
|
|
223
|
+
to { opacity: 1; transform: translateY(0); }
|
|
224
|
+
}
|
|
225
|
+
` }), error && _jsx("p", { style: { fontSize: '11px', color: tokens.color.danger, marginTop: '6px', fontWeight: tokens.font.weightMedium }, children: error })] }));
|
|
226
|
+
};
|
|
227
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../src/components/DatePicker.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AASnC,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;IACzE,MAAM,GAAG,GAAG,IAAI,IAAI,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MAAM,EAAE,SAAS;6BAClB,GACD,IACE,GACF,EAEL,MAAM,IAAI,CACT,cAAK,KAAK,EAAE;oBACV,QAAQ,EAAE,UAAU;oBACpB,GAAG,EAAE,MAAM;oBACX,IAAI,EAAE,CAAC;oBACP,MAAM,EAAE,IAAI;oBACZ,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC5B,eAAe,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK;oBACnC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;oBAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE;oBAC3B,MAAM,EAAE,aAAa,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;oBAC5C,SAAS,EAAE,sBAAsB;iBAClC,YACC,KAAC,QAAQ,IACP,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,GAC/B,GACE,CACP,EACD,0BAAQ;;;;;OAKP,GAAS,EAET,KAAK,IAAI,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,YAAG,KAAK,GAAK,IACrI,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface DividerProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
3
|
orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
type?: 'solid' | 'gradient';
|
|
5
|
+
label?: React.ReactNode;
|
|
4
6
|
margin?: 'none' | 'sm' | 'md' | 'lg';
|
|
5
7
|
}
|
|
6
8
|
export declare const Divider: React.FC<DividerProps>;
|
|
@@ -1,34 +1,42 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { tokens } from '../tokens';
|
|
3
|
-
export const Divider = ({ orientation = 'horizontal', margin = 'md', className = '', style = {} }) => {
|
|
3
|
+
export const Divider = ({ orientation = 'horizontal', type = 'solid', label, margin = 'md', className = '', style = {} }) => {
|
|
4
4
|
const getMargin = () => {
|
|
5
5
|
switch (margin) {
|
|
6
6
|
case 'none': return '0';
|
|
7
7
|
case 'sm': return tokens.spacing[2];
|
|
8
8
|
case 'lg': return tokens.spacing[8];
|
|
9
|
-
case 'md':
|
|
10
9
|
default: return tokens.spacing[4];
|
|
11
10
|
}
|
|
12
11
|
};
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const isVertical = orientation === 'vertical';
|
|
13
|
+
const isGradient = type === 'gradient';
|
|
14
|
+
const lineStyle = {
|
|
15
|
+
backgroundColor: isGradient ? 'transparent' : tokens.color.slate100,
|
|
16
|
+
backgroundImage: isGradient
|
|
17
|
+
? (isVertical
|
|
18
|
+
? `linear-gradient(to bottom, transparent, ${tokens.color.slate200}, transparent)`
|
|
19
|
+
: `linear-gradient(to right, transparent, ${tokens.color.slate200}, transparent)`)
|
|
20
|
+
: 'none',
|
|
15
21
|
border: 'none',
|
|
22
|
+
width: isVertical ? '1.5px' : '100%',
|
|
23
|
+
height: isVertical ? '100%' : '1.5px',
|
|
24
|
+
flexShrink: 0,
|
|
16
25
|
...style
|
|
17
26
|
};
|
|
18
|
-
if (
|
|
27
|
+
if (isVertical) {
|
|
19
28
|
return (_jsx("div", { style: {
|
|
20
|
-
...
|
|
21
|
-
width: '1px',
|
|
22
|
-
height: '100%',
|
|
29
|
+
...lineStyle,
|
|
23
30
|
margin: `0 ${getMargin()}`,
|
|
24
31
|
display: 'inline-block',
|
|
25
32
|
verticalAlign: 'middle'
|
|
26
33
|
}, className: className }));
|
|
27
34
|
}
|
|
35
|
+
if (label) {
|
|
36
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%', margin: `${getMargin()} 0`, gap: tokens.spacing[4], ...style }, className: className, children: [_jsx("div", { style: { ...lineStyle, flex: 1, margin: 0 } }), _jsx("span", { style: { fontSize: '11px', fontWeight: tokens.font.weightBold, color: tokens.color.slate500, textTransform: 'uppercase', letterSpacing: '0.05em' }, children: label }), _jsx("div", { style: { ...lineStyle, flex: 1, margin: 0 } })] }));
|
|
37
|
+
}
|
|
28
38
|
return (_jsx("hr", { style: {
|
|
29
|
-
...
|
|
30
|
-
width: '100%',
|
|
31
|
-
height: '1px',
|
|
39
|
+
...lineStyle,
|
|
32
40
|
margin: `${getMargin()} 0`
|
|
33
41
|
}, className: className }));
|
|
34
42
|
};
|
|
@@ -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;AASnC,MAAM,CAAC,MAAM,OAAO,GAA2B,CAAC,EAC9C,WAAW,GAAG,YAAY,EAC1B,IAAI,GAAG,OAAO,EACd,KAAK,EACL,MAAM,GAAG,IAAI,EACb,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,EACX,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,QAAO,MAAM,EAAE,CAAC;YACd,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,OAAO,CAAC,CAAC,OAAO,MAA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,SAAS,aACtJ,cAAK,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAQ,EACxD,eAAM,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,QAAQ,EAAE,YACrJ,KAAK,GACD,EACP,cAAK,KAAK,EAAE,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAQ,IACpD,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,aACE,KAAK,EAAE;YACL,GAAG,SAAS;YACZ,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI;SAC3B,EACD,SAAS,EAAE,SAAS,GACpB,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
|
|
|
3
3
|
label?: string;
|
|
4
4
|
required?: boolean;
|
|
5
5
|
error?: string;
|
|
6
|
-
|
|
6
|
+
leadingIcon?: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
export declare const Input: React.FC<InputProps>;
|
|
9
9
|
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
@@ -12,13 +12,13 @@ export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextArea
|
|
|
12
12
|
error?: string;
|
|
13
13
|
}
|
|
14
14
|
export declare const Textarea: React.FC<TextareaProps>;
|
|
15
|
-
export interface
|
|
15
|
+
export interface NativeSelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
16
16
|
label?: string;
|
|
17
17
|
required?: boolean;
|
|
18
18
|
error?: string;
|
|
19
|
-
|
|
19
|
+
leadingIcon?: React.ReactNode;
|
|
20
20
|
}
|
|
21
|
-
export declare const
|
|
21
|
+
export declare const NativeSelect: React.FC<NativeSelectProps>;
|
|
22
22
|
export interface CheckboxProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
23
23
|
label?: string;
|
|
24
24
|
}
|
|
@@ -1,126 +1,124 @@
|
|
|
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
|
-
const
|
|
5
|
-
display: 'block',
|
|
6
|
-
fontSize: tokens.font.xs,
|
|
7
|
-
fontWeight: tokens.font.weightMedium,
|
|
8
|
-
color: tokens.color.textMuted,
|
|
9
|
-
marginBottom: tokens.spacing[1],
|
|
10
|
-
};
|
|
11
|
-
const filterLabelStyle = {
|
|
4
|
+
const floatingLabelStyle = {
|
|
12
5
|
position: 'absolute',
|
|
13
6
|
top: '-10px',
|
|
14
|
-
left: '
|
|
7
|
+
left: '14px',
|
|
15
8
|
backgroundColor: 'white',
|
|
16
9
|
padding: '0 6px',
|
|
17
|
-
fontSize: '
|
|
18
|
-
fontWeight: tokens.font.
|
|
10
|
+
fontSize: '10px',
|
|
11
|
+
fontWeight: tokens.font.weightBold,
|
|
19
12
|
color: tokens.color.slate400,
|
|
20
13
|
textTransform: 'uppercase',
|
|
21
|
-
letterSpacing: '0.
|
|
14
|
+
letterSpacing: '0.1em',
|
|
22
15
|
zIndex: 1,
|
|
16
|
+
transition: tokens.transition.fast,
|
|
23
17
|
};
|
|
24
|
-
const
|
|
18
|
+
const inputContainerStyle = (isFocused, hasError) => ({
|
|
19
|
+
position: 'relative',
|
|
25
20
|
width: '100%',
|
|
26
|
-
padding: `${tokens.spacing[3]} ${tokens.spacing[5]}`,
|
|
27
|
-
fontSize: tokens.font.sm,
|
|
28
|
-
borderRadius: tokens.radius.lg,
|
|
29
|
-
border: `1px solid ${tokens.color.slate200}`,
|
|
30
21
|
backgroundColor: tokens.color.white,
|
|
31
|
-
color: tokens.color.
|
|
32
|
-
|
|
22
|
+
border: `1px solid ${hasError ? tokens.color.danger : (isFocused ? tokens.color.borderFocus : tokens.color.slate200)}`,
|
|
23
|
+
borderRadius: tokens.radius.lg,
|
|
24
|
+
padding: '12px 16px',
|
|
33
25
|
transition: tokens.transition.fast,
|
|
26
|
+
boxShadow: isFocused ? '0 0 0 3px rgba(245, 158, 11, 0.1)' : tokens.shadow.sm,
|
|
27
|
+
});
|
|
28
|
+
const inputFieldBaseStyle = {
|
|
29
|
+
width: '100%',
|
|
30
|
+
border: 'none',
|
|
31
|
+
outline: 'none',
|
|
32
|
+
backgroundColor: 'transparent',
|
|
33
|
+
fontSize: tokens.font.sm,
|
|
34
34
|
fontFamily: tokens.font.family,
|
|
35
|
-
fontWeight: tokens.font.
|
|
35
|
+
fontWeight: tokens.font.weightSemibold,
|
|
36
|
+
color: tokens.color.slate800,
|
|
37
|
+
padding: '4px 0 0 0',
|
|
36
38
|
};
|
|
37
|
-
export const Input = ({ label, required, error,
|
|
39
|
+
export const Input = ({ label, required, error, className = '', style = {}, onFocus, onBlur, leadingIcon, ...props }) => {
|
|
38
40
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
...(isFocused && !isFilter && {
|
|
59
|
-
borderColor: tokens.color.borderFocus,
|
|
60
|
-
backgroundColor: tokens.color.white,
|
|
61
|
-
}),
|
|
62
|
-
...style
|
|
63
|
-
};
|
|
64
|
-
return (_jsxs("div", { className: className, style: { width: '100%', position: 'relative' }, children: [label && !isFilter && (_jsxs("label", { style: labelStyle, children: [label, " ", required && _jsx("span", { style: { color: tokens.color.danger }, children: "*" })] })), _jsxs("div", { style: containerStyle, children: [label && isFilter && (_jsx("label", { style: { ...filterLabelStyle, color: isFocused ? tokens.color.borderFocus : tokens.color.slate400 }, children: label })), _jsx("input", { style: fieldStyle, onFocus: (e) => {
|
|
41
|
+
return (_jsxs("div", { className: className, style: { width: '100%', position: 'relative', ...style }, children: [label && (_jsxs("label", { style: {
|
|
42
|
+
...floatingLabelStyle,
|
|
43
|
+
color: isFocused ? tokens.color.borderFocus : (error ? tokens.color.danger : tokens.color.slate400),
|
|
44
|
+
left: leadingIcon ? '40px' : '14px'
|
|
45
|
+
}, children: [label, " ", required && _jsx("span", { style: { color: tokens.color.danger }, children: "*" })] })), _jsxs("div", { style: inputContainerStyle(isFocused, !!error), children: [leadingIcon && (_jsx("div", { style: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
left: '16px',
|
|
48
|
+
top: '50%',
|
|
49
|
+
transform: 'translateY(-50%)',
|
|
50
|
+
color: isFocused ? tokens.color.primary : tokens.color.slate300,
|
|
51
|
+
display: 'flex',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
zIndex: 1,
|
|
54
|
+
pointerEvents: 'none',
|
|
55
|
+
marginTop: '2px'
|
|
56
|
+
}, children: leadingIcon })), _jsx("input", { style: {
|
|
57
|
+
...inputFieldBaseStyle,
|
|
58
|
+
...(leadingIcon && { paddingLeft: '28px' }),
|
|
59
|
+
}, onFocus: (e) => {
|
|
65
60
|
setIsFocused(true);
|
|
66
61
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
67
62
|
}, onBlur: (e) => {
|
|
68
63
|
setIsFocused(false);
|
|
69
64
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
70
|
-
}, ...props })] }), error && _jsx("p", { style: { fontSize: '11px', color: tokens.color.danger, marginTop: '
|
|
65
|
+
}, ...props })] }), error && _jsx("p", { style: { fontSize: '11px', color: tokens.color.danger, marginTop: '6px', fontWeight: tokens.font.weightMedium }, children: error })] }));
|
|
71
66
|
};
|
|
72
|
-
export const Textarea = ({ label, required, error, className = '', style = {}, ...props }) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
export const Textarea = ({ label, required, error, className = '', style = {}, onFocus, onBlur, ...props }) => {
|
|
68
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
69
|
+
return (_jsxs("div", { className: className, style: { width: '100%', position: 'relative', ...style }, children: [label && (_jsxs("label", { style: {
|
|
70
|
+
...floatingLabelStyle,
|
|
71
|
+
color: isFocused ? tokens.color.borderFocus : (error ? tokens.color.danger : tokens.color.slate400)
|
|
72
|
+
}, children: [label, " ", required && _jsx("span", { style: { color: tokens.color.danger }, children: "*" })] })), _jsx("div", { style: inputContainerStyle(isFocused, !!error), children: _jsx("textarea", { style: {
|
|
73
|
+
...inputFieldBaseStyle,
|
|
74
|
+
minHeight: '100px',
|
|
75
|
+
resize: 'none',
|
|
76
|
+
}, onFocus: (e) => {
|
|
77
|
+
setIsFocused(true);
|
|
78
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
79
|
+
}, onBlur: (e) => {
|
|
80
|
+
setIsFocused(false);
|
|
81
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
82
|
+
}, ...props }) }), error && _jsx("p", { style: { fontSize: '11px', color: tokens.color.danger, marginTop: '6px', fontWeight: tokens.font.weightMedium }, children: error })] }));
|
|
79
83
|
};
|
|
80
|
-
export const
|
|
84
|
+
export const NativeSelect = ({ label, required, children, error, className = '', style = {}, onFocus, onBlur, leadingIcon, ...props }) => {
|
|
81
85
|
const [isFocused, setIsFocused] = React.useState(false);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
top: '50%',
|
|
119
|
-
transform: 'translateY(-50%)',
|
|
120
|
-
pointerEvents: 'none',
|
|
121
|
-
color: tokens.color.slate300,
|
|
122
|
-
marginTop: isFilter ? '2px' : '0'
|
|
123
|
-
}, children: _jsx("svg", { width: "14", height: "14", 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" }) }) })] })] }), error && _jsx("p", { style: { fontSize: '11px', color: tokens.color.danger, marginTop: '4px' }, children: error })] }));
|
|
86
|
+
return (_jsxs("div", { className: className, style: { width: '100%', position: 'relative', ...style }, children: [label && (_jsxs("label", { style: {
|
|
87
|
+
...floatingLabelStyle,
|
|
88
|
+
color: isFocused ? tokens.color.borderFocus : (error ? tokens.color.danger : tokens.color.slate400),
|
|
89
|
+
left: leadingIcon ? '40px' : '14px'
|
|
90
|
+
}, children: [label, " ", required && _jsx("span", { style: { color: tokens.color.danger }, children: "*" })] })), _jsx("div", { style: inputContainerStyle(isFocused, !!error), children: _jsxs("div", { style: { position: 'relative', display: 'flex', alignItems: 'center' }, children: [leadingIcon && (_jsx("div", { style: {
|
|
91
|
+
position: 'absolute',
|
|
92
|
+
left: '0',
|
|
93
|
+
color: isFocused ? tokens.color.primary : tokens.color.slate300,
|
|
94
|
+
display: 'flex',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
zIndex: 1,
|
|
97
|
+
pointerEvents: 'none',
|
|
98
|
+
marginTop: '2px'
|
|
99
|
+
}, children: leadingIcon })), _jsx("select", { style: {
|
|
100
|
+
...inputFieldBaseStyle,
|
|
101
|
+
appearance: 'none',
|
|
102
|
+
paddingRight: '32px',
|
|
103
|
+
...(leadingIcon && { paddingLeft: '28px' }),
|
|
104
|
+
cursor: 'pointer',
|
|
105
|
+
}, onFocus: (e) => {
|
|
106
|
+
setIsFocused(true);
|
|
107
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
|
|
108
|
+
}, onBlur: (e) => {
|
|
109
|
+
setIsFocused(false);
|
|
110
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
111
|
+
}, ...props, children: children }), _jsx("div", { style: {
|
|
112
|
+
position: 'absolute',
|
|
113
|
+
right: '0',
|
|
114
|
+
top: '50%',
|
|
115
|
+
transform: 'translateY(-50%)',
|
|
116
|
+
pointerEvents: 'none',
|
|
117
|
+
color: isFocused ? tokens.color.borderFocus : tokens.color.slate300,
|
|
118
|
+
display: 'flex',
|
|
119
|
+
alignItems: 'center',
|
|
120
|
+
marginTop: '2px'
|
|
121
|
+
}, children: _jsx("svg", { width: "18", height: "18", 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" }) }) })] }) }), error && _jsx("p", { style: { fontSize: '11px', color: tokens.color.danger, marginTop: '6px', fontWeight: tokens.font.weightMedium }, children: error })] }));
|
|
124
122
|
};
|
|
125
123
|
export const Checkbox = ({ label, checked, className = '', style = {}, ...props }) => {
|
|
126
124
|
return (_jsxs("label", { className: className, style: {
|
|
@@ -131,16 +129,18 @@ export const Checkbox = ({ label, checked, className = '', style = {}, ...props
|
|
|
131
129
|
fontSize: tokens.font.sm,
|
|
132
130
|
fontWeight: tokens.font.weightMedium,
|
|
133
131
|
color: tokens.color.slate800,
|
|
132
|
+
userSelect: 'none',
|
|
134
133
|
...style
|
|
135
134
|
}, children: [_jsxs("div", { style: { position: 'relative', display: 'flex', alignItems: 'center' }, children: [_jsx("input", { type: "checkbox", checked: checked, style: {
|
|
136
135
|
appearance: 'none',
|
|
137
136
|
width: '20px',
|
|
138
137
|
height: '20px',
|
|
139
138
|
borderRadius: '6px',
|
|
140
|
-
border: `
|
|
139
|
+
border: `2px solid ${checked ? tokens.color.primary : tokens.color.slate200}`,
|
|
141
140
|
backgroundColor: checked ? tokens.color.primary : 'transparent',
|
|
142
141
|
cursor: 'pointer',
|
|
143
142
|
transition: tokens.transition.fast,
|
|
143
|
+
boxShadow: checked ? `0 2px 4px ${tokens.color.primary}33` : 'none',
|
|
144
144
|
}, ...props }), checked && (_jsx("svg", { style: {
|
|
145
145
|
position: 'absolute',
|
|
146
146
|
left: '3px',
|