@bigtablet/design-system 1.23.0 → 1.24.1
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/index.css +637 -577
- package/dist/index.d.ts +526 -240
- package/dist/index.js +875 -660
- package/dist/next.css +28 -28
- package/dist/next.d.ts +1 -1
- package/dist/next.js +99 -147
- package/dist/styles/scss/_a11y.scss +4 -4
- package/dist/styles/scss/_breakpoints.scss +19 -13
- package/dist/styles/scss/_colors.scss +67 -55
- package/dist/styles/scss/_radius.scss +6 -5
- package/dist/styles/scss/_shadows.scss +5 -20
- package/dist/styles/scss/_spacing.scss +14 -12
- package/dist/styles/scss/_typography.scss +61 -64
- package/dist/styles/scss/_z-index.scss +6 -3
- package/dist/vanilla/bigtablet.min.css +1 -1
- package/dist/vanilla/bigtablet.min.js +2 -2
- package/package.json +148 -146
package/dist/index.js
CHANGED
|
@@ -1,117 +1,109 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './index.css';
|
|
3
|
-
import * as
|
|
3
|
+
import * as React9 from 'react';
|
|
4
4
|
import { createContext, useContext, useState, useCallback } from 'react';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
6
|
import { createPortal } from 'react-dom';
|
|
7
7
|
import { ChevronDown, Check, X, Bell, Info, AlertTriangle, XCircle, CheckCircle2 } from 'lucide-react';
|
|
8
8
|
|
|
9
|
-
// src/styles/ts/
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
backgroundNeutral: "#f3f3f3",
|
|
16
|
-
backgroundMuted: "#f0f0f0",
|
|
17
|
-
textPrimary: "#1a1a1a",
|
|
18
|
-
textSecondary: "#666666",
|
|
19
|
-
textTertiary: "#999999",
|
|
20
|
-
border: "#e5e5e5",
|
|
21
|
-
borderLight: "rgba(0, 0, 0, 0.08)",
|
|
22
|
-
success: "#10b981",
|
|
23
|
-
error: "#ef4444",
|
|
24
|
-
warning: "#f59e0b",
|
|
25
|
-
info: "#3b82f6",
|
|
26
|
-
overlay: "rgba(0, 0, 0, 0.5)",
|
|
27
|
-
hoverSubtle: "rgba(0, 0, 0, 0.03)",
|
|
28
|
-
hoverLight: "rgba(0, 0, 0, 0.05)",
|
|
29
|
-
textStrong: "#1F2937",
|
|
30
|
-
textNormal: "#3B3B3B",
|
|
31
|
-
textSubtle: "#6B7280",
|
|
32
|
-
textDisabled: "#9CA3AF",
|
|
33
|
-
textInverse: "#FFFFFF"
|
|
9
|
+
// src/styles/ts/a11y.ts
|
|
10
|
+
var a11y = {
|
|
11
|
+
focusRing: "0 0 0 3px rgba(0, 0, 0, 0.15)",
|
|
12
|
+
focusRingError: "0 0 0 3px rgba(239, 68, 68, 0.15)",
|
|
13
|
+
focusRingSuccess: "0 0 0 3px rgba(16, 185, 129, 0.15)",
|
|
14
|
+
tapMinSize: "44px"
|
|
34
15
|
};
|
|
35
16
|
|
|
36
|
-
// src/styles/ts/
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
xl: "1.25rem",
|
|
47
|
-
// 20px
|
|
48
|
-
"2xl": "1.5rem",
|
|
49
|
-
// 24px
|
|
50
|
-
"3xl": "2rem",
|
|
51
|
-
// 32px
|
|
52
|
-
"4xl": "2.5rem",
|
|
53
|
-
// 40px
|
|
54
|
-
"5xl": "3rem"
|
|
55
|
-
// 48px
|
|
17
|
+
// src/styles/ts/border-width.ts
|
|
18
|
+
var baseBorderWidth = {
|
|
19
|
+
"0": "0px",
|
|
20
|
+
"1": "1px",
|
|
21
|
+
"2": "2px"
|
|
22
|
+
};
|
|
23
|
+
var borderWidth = {
|
|
24
|
+
none: baseBorderWidth["0"],
|
|
25
|
+
standard: baseBorderWidth["1"],
|
|
26
|
+
indicator: baseBorderWidth["2"]
|
|
56
27
|
};
|
|
57
28
|
|
|
58
|
-
// src/styles/ts/
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
29
|
+
// src/styles/ts/breakpoints.ts
|
|
30
|
+
var breakpoints = {
|
|
31
|
+
compact: 0,
|
|
32
|
+
// mobile
|
|
33
|
+
medium: 600,
|
|
34
|
+
// tablet
|
|
35
|
+
expanded: 840,
|
|
36
|
+
// small desktop
|
|
37
|
+
large: 1200
|
|
38
|
+
// desktop
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/styles/ts/colors.ts
|
|
42
|
+
var baseColors = {
|
|
43
|
+
brandPrimary: "#121212",
|
|
44
|
+
blue600: "#1A73E8",
|
|
45
|
+
neutral0: "#FFFFFF",
|
|
46
|
+
neutral50: "#F4F4F4",
|
|
47
|
+
neutral200: "#E5E5E5",
|
|
48
|
+
neutral300: "#999999",
|
|
49
|
+
neutral400: "#B3B3B3",
|
|
50
|
+
neutral500: "#888888",
|
|
51
|
+
neutral700: "#666666",
|
|
52
|
+
neutral900: "#121212",
|
|
53
|
+
statusError: "#EF4444",
|
|
54
|
+
statusSuccess: "#10B981",
|
|
55
|
+
statusWarning: "#F59E0B",
|
|
56
|
+
statusInfo: "#3B82F6",
|
|
57
|
+
alphaBlack5: "rgba(0, 0, 0, 0.05)",
|
|
58
|
+
alphaBlack8: "rgba(0, 0, 0, 0.08)",
|
|
59
|
+
alphaBlack12: "rgba(26, 26, 26, 0.12)",
|
|
60
|
+
alphaBlack38: "rgba(26, 26, 26, 0.38)",
|
|
61
|
+
alphaBlack50: "rgba(0, 0, 0, 0.50)",
|
|
62
|
+
alphaWhite5: "rgba(255, 255, 255, 0.05)",
|
|
63
|
+
alphaWhite8: "rgba(255, 255, 255, 0.08)",
|
|
64
|
+
alphaWhite12: "rgba(255, 255, 255, 0.12)"
|
|
65
|
+
};
|
|
66
|
+
var colors = {
|
|
67
|
+
brand: {
|
|
68
|
+
primary: baseColors.brandPrimary,
|
|
69
|
+
onPrimary: baseColors.neutral0
|
|
62
70
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"2xl": "1.5rem",
|
|
71
|
-
"3xl": "2rem",
|
|
72
|
-
"4xl": "2.5rem"
|
|
71
|
+
text: {
|
|
72
|
+
heading: baseColors.neutral900,
|
|
73
|
+
body: baseColors.neutral700,
|
|
74
|
+
caption: baseColors.neutral500,
|
|
75
|
+
brand: baseColors.brandPrimary,
|
|
76
|
+
inverse: baseColors.neutral0,
|
|
77
|
+
disabled: baseColors.alphaBlack38
|
|
73
78
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
semibold: 600,
|
|
81
|
-
bold: 700,
|
|
82
|
-
extrabold: 800,
|
|
83
|
-
black: 900
|
|
79
|
+
bg: {
|
|
80
|
+
solid: baseColors.neutral0,
|
|
81
|
+
solidDim: baseColors.neutral50,
|
|
82
|
+
additive: baseColors.alphaBlack5,
|
|
83
|
+
disabled: baseColors.alphaBlack12,
|
|
84
|
+
overlay: baseColors.alphaBlack50
|
|
84
85
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
state: {
|
|
87
|
+
hoverOnLight: baseColors.alphaBlack5,
|
|
88
|
+
pressedOnLight: baseColors.alphaBlack12,
|
|
89
|
+
hoverOnDark: baseColors.alphaWhite5,
|
|
90
|
+
pressedOnDark: baseColors.alphaWhite12
|
|
90
91
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
border: {
|
|
93
|
+
default: baseColors.neutral200,
|
|
94
|
+
hover: baseColors.neutral400,
|
|
95
|
+
subtle: baseColors.alphaBlack8,
|
|
96
|
+
focus: baseColors.neutral900,
|
|
97
|
+
disabled: "#F2F2F2"
|
|
98
|
+
},
|
|
99
|
+
status: {
|
|
100
|
+
error: baseColors.statusError,
|
|
101
|
+
success: baseColors.statusSuccess,
|
|
102
|
+
warning: baseColors.statusWarning,
|
|
103
|
+
info: baseColors.statusInfo
|
|
95
104
|
}
|
|
96
105
|
};
|
|
97
106
|
|
|
98
|
-
// src/styles/ts/radius.ts
|
|
99
|
-
var radius = {
|
|
100
|
-
sm: "6px",
|
|
101
|
-
md: "8px",
|
|
102
|
-
lg: "12px",
|
|
103
|
-
xl: "16px",
|
|
104
|
-
full: "9999px"
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// src/styles/ts/shadows.ts
|
|
108
|
-
var shadows = {
|
|
109
|
-
sm: "0 2px 4px rgba(0, 0, 0, 0.04)",
|
|
110
|
-
md: "0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04)",
|
|
111
|
-
lg: "0 8px 20px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06)",
|
|
112
|
-
xl: "0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04)"
|
|
113
|
-
};
|
|
114
|
-
|
|
115
107
|
// src/styles/ts/motion.ts
|
|
116
108
|
var motion = {
|
|
117
109
|
transition: {
|
|
@@ -127,25 +119,77 @@ var motion = {
|
|
|
127
119
|
}
|
|
128
120
|
};
|
|
129
121
|
|
|
122
|
+
// src/styles/ts/opacity.ts
|
|
123
|
+
var opacity = {
|
|
124
|
+
"0": 0,
|
|
125
|
+
"5": 0.05,
|
|
126
|
+
"8": 0.08,
|
|
127
|
+
"12": 0.12,
|
|
128
|
+
"16": 0.16,
|
|
129
|
+
"38": 0.38,
|
|
130
|
+
"50": 0.5,
|
|
131
|
+
"80": 0.8,
|
|
132
|
+
"90": 0.9,
|
|
133
|
+
"100": 1
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// src/styles/ts/radius.ts
|
|
137
|
+
var radius = {
|
|
138
|
+
none: "0px",
|
|
139
|
+
xs: "4px",
|
|
140
|
+
sm: "6px",
|
|
141
|
+
md: "8px",
|
|
142
|
+
lg: "12px",
|
|
143
|
+
xl: "16px",
|
|
144
|
+
full: "9999px"
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
// src/styles/ts/shadows.ts
|
|
148
|
+
var shadows = {
|
|
149
|
+
level1: "0 1px 1px -1px rgba(0, 0, 0, 0.20), 0 3px 3px 0px rgba(0, 0, 0, 0.12)",
|
|
150
|
+
level2: "0 2px 2px -2px rgba(0, 0, 0, 0.20), 0 6px 6px 0px rgba(0, 0, 0, 0.12)",
|
|
151
|
+
level3: "0 3px 3px -3px rgba(0, 0, 0, 0.20), 0 9px 9px 0px rgba(0, 0, 0, 0.12)",
|
|
152
|
+
level4: "0 5px 5px -5px rgba(0, 0, 0, 0.20), 0 15px 15px 0px rgba(0, 0, 0, 0.12)",
|
|
153
|
+
level5: "0 8px 10px -5px rgba(0, 0, 0, 0.20), 0 20px 20px 0px rgba(0, 0, 0, 0.12)"
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// src/styles/ts/spacing.ts
|
|
157
|
+
var spacing = {
|
|
158
|
+
"0": "0px",
|
|
159
|
+
"1": "1px",
|
|
160
|
+
"2": "2px",
|
|
161
|
+
"3": "3px",
|
|
162
|
+
"4": "4px",
|
|
163
|
+
"6": "6px",
|
|
164
|
+
"8": "8px",
|
|
165
|
+
"12": "12px",
|
|
166
|
+
"16": "16px",
|
|
167
|
+
"20": "20px",
|
|
168
|
+
"24": "24px",
|
|
169
|
+
"32": "32px",
|
|
170
|
+
"40": "40px",
|
|
171
|
+
"48": "48px"
|
|
172
|
+
};
|
|
173
|
+
|
|
130
174
|
// src/styles/ts/skeleton.ts
|
|
131
175
|
var skeleton = {
|
|
132
176
|
color: {
|
|
133
|
-
base:
|
|
134
|
-
wave:
|
|
135
|
-
highlight:
|
|
177
|
+
base: baseColors.neutral50,
|
|
178
|
+
wave: baseColors.neutral200,
|
|
179
|
+
highlight: baseColors.neutral0
|
|
136
180
|
},
|
|
137
|
-
gradient: `linear-gradient(90deg, ${
|
|
181
|
+
gradient: `linear-gradient(90deg, ${baseColors.neutral50} 25%, ${baseColors.neutral0} 37%, ${baseColors.neutral200} 63%)`,
|
|
138
182
|
radius: {
|
|
139
183
|
sm: radius.sm,
|
|
140
184
|
md: radius.md,
|
|
141
185
|
lg: radius.lg
|
|
142
186
|
},
|
|
143
187
|
height: {
|
|
144
|
-
xs: spacing
|
|
145
|
-
sm: spacing
|
|
146
|
-
md: spacing
|
|
147
|
-
lg: spacing
|
|
148
|
-
xl: spacing
|
|
188
|
+
xs: spacing["4"],
|
|
189
|
+
sm: spacing["8"],
|
|
190
|
+
md: spacing["12"],
|
|
191
|
+
lg: spacing["16"],
|
|
192
|
+
xl: spacing["20"]
|
|
149
193
|
},
|
|
150
194
|
animation: {
|
|
151
195
|
duration: "1.4s",
|
|
@@ -153,31 +197,251 @@ var skeleton = {
|
|
|
153
197
|
}
|
|
154
198
|
};
|
|
155
199
|
|
|
156
|
-
// src/styles/ts/
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
200
|
+
// src/styles/ts/typography.ts
|
|
201
|
+
var baseTypography = {
|
|
202
|
+
fontFamily: {
|
|
203
|
+
primary: "Pretendard"
|
|
204
|
+
},
|
|
205
|
+
fontSize: {
|
|
206
|
+
"12": "12px",
|
|
207
|
+
"13": "13px",
|
|
208
|
+
"14": "14px",
|
|
209
|
+
"15": "15px",
|
|
210
|
+
"16": "16px",
|
|
211
|
+
"18": "18px",
|
|
212
|
+
"20": "20px",
|
|
213
|
+
"24": "24px",
|
|
214
|
+
"28": "28px",
|
|
215
|
+
"32": "32px",
|
|
216
|
+
"40": "40px",
|
|
217
|
+
"48": "48px"
|
|
218
|
+
},
|
|
219
|
+
fontWeight: {
|
|
220
|
+
regular: "Regular",
|
|
221
|
+
medium: "Medium"
|
|
222
|
+
},
|
|
223
|
+
lineHeight: {
|
|
224
|
+
"16": "16px",
|
|
225
|
+
"18": "18px",
|
|
226
|
+
"20": "20px",
|
|
227
|
+
"22-5": "22.5px",
|
|
228
|
+
"24": "24px",
|
|
229
|
+
"28": "28px",
|
|
230
|
+
"32": "32px",
|
|
231
|
+
"36": "36px",
|
|
232
|
+
"40": "40px",
|
|
233
|
+
"50": "50px",
|
|
234
|
+
"60": "60px"
|
|
235
|
+
},
|
|
236
|
+
letterSpacing: {
|
|
237
|
+
normal: "0px"
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
var { fontSize: fs, fontWeight: fw, lineHeight: lh, letterSpacing: ls } = baseTypography;
|
|
241
|
+
var typography = {
|
|
242
|
+
fontFamily: {
|
|
243
|
+
primary: `'${baseTypography.fontFamily.primary}', sans-serif`
|
|
244
|
+
},
|
|
245
|
+
display: {
|
|
246
|
+
large: {
|
|
247
|
+
fontSize: fs["48"],
|
|
248
|
+
fontWeight: fw.regular,
|
|
249
|
+
lineHeight: lh["60"],
|
|
250
|
+
letterSpacing: ls.normal
|
|
251
|
+
},
|
|
252
|
+
largeMedium: {
|
|
253
|
+
fontSize: fs["48"],
|
|
254
|
+
fontWeight: fw.medium,
|
|
255
|
+
lineHeight: lh["60"],
|
|
256
|
+
letterSpacing: ls.normal
|
|
257
|
+
},
|
|
258
|
+
medium: {
|
|
259
|
+
fontSize: fs["40"],
|
|
260
|
+
fontWeight: fw.regular,
|
|
261
|
+
lineHeight: lh["50"],
|
|
262
|
+
letterSpacing: ls.normal
|
|
263
|
+
},
|
|
264
|
+
mediumMedium: {
|
|
265
|
+
fontSize: fs["40"],
|
|
266
|
+
fontWeight: fw.medium,
|
|
267
|
+
lineHeight: lh["50"],
|
|
268
|
+
letterSpacing: ls.normal
|
|
269
|
+
},
|
|
270
|
+
small: {
|
|
271
|
+
fontSize: fs["32"],
|
|
272
|
+
fontWeight: fw.regular,
|
|
273
|
+
lineHeight: lh["40"],
|
|
274
|
+
letterSpacing: ls.normal
|
|
275
|
+
},
|
|
276
|
+
smallMedium: {
|
|
277
|
+
fontSize: fs["32"],
|
|
278
|
+
fontWeight: fw.medium,
|
|
279
|
+
lineHeight: lh["40"],
|
|
280
|
+
letterSpacing: ls.normal
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
heading: {
|
|
284
|
+
large: {
|
|
285
|
+
fontSize: fs["28"],
|
|
286
|
+
fontWeight: fw.regular,
|
|
287
|
+
lineHeight: lh["36"],
|
|
288
|
+
letterSpacing: ls.normal
|
|
289
|
+
},
|
|
290
|
+
largeMedium: {
|
|
291
|
+
fontSize: fs["28"],
|
|
292
|
+
fontWeight: fw.medium,
|
|
293
|
+
lineHeight: lh["36"],
|
|
294
|
+
letterSpacing: ls.normal
|
|
295
|
+
},
|
|
296
|
+
medium: {
|
|
297
|
+
fontSize: fs["24"],
|
|
298
|
+
fontWeight: fw.regular,
|
|
299
|
+
lineHeight: lh["32"],
|
|
300
|
+
letterSpacing: ls.normal
|
|
301
|
+
},
|
|
302
|
+
mediumMedium: {
|
|
303
|
+
fontSize: fs["24"],
|
|
304
|
+
fontWeight: fw.medium,
|
|
305
|
+
lineHeight: lh["32"],
|
|
306
|
+
letterSpacing: ls.normal
|
|
307
|
+
},
|
|
308
|
+
small: {
|
|
309
|
+
fontSize: fs["20"],
|
|
310
|
+
fontWeight: fw.regular,
|
|
311
|
+
lineHeight: lh["28"],
|
|
312
|
+
letterSpacing: ls.normal
|
|
313
|
+
},
|
|
314
|
+
smallMedium: {
|
|
315
|
+
fontSize: fs["20"],
|
|
316
|
+
fontWeight: fw.medium,
|
|
317
|
+
lineHeight: lh["28"],
|
|
318
|
+
letterSpacing: ls.normal
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
title: {
|
|
322
|
+
large: {
|
|
323
|
+
fontSize: fs["18"],
|
|
324
|
+
fontWeight: fw.regular,
|
|
325
|
+
lineHeight: lh["24"],
|
|
326
|
+
letterSpacing: ls.normal
|
|
327
|
+
},
|
|
328
|
+
largeMedium: {
|
|
329
|
+
fontSize: fs["18"],
|
|
330
|
+
fontWeight: fw.medium,
|
|
331
|
+
lineHeight: lh["24"],
|
|
332
|
+
letterSpacing: ls.normal
|
|
333
|
+
},
|
|
334
|
+
medium: {
|
|
335
|
+
fontSize: fs["16"],
|
|
336
|
+
fontWeight: fw.regular,
|
|
337
|
+
lineHeight: lh["24"],
|
|
338
|
+
letterSpacing: ls.normal
|
|
339
|
+
},
|
|
340
|
+
mediumMedium: {
|
|
341
|
+
fontSize: fs["16"],
|
|
342
|
+
fontWeight: fw.medium,
|
|
343
|
+
lineHeight: lh["24"],
|
|
344
|
+
letterSpacing: ls.normal
|
|
345
|
+
},
|
|
346
|
+
small: {
|
|
347
|
+
fontSize: fs["14"],
|
|
348
|
+
fontWeight: fw.regular,
|
|
349
|
+
lineHeight: lh["20"],
|
|
350
|
+
letterSpacing: ls.normal
|
|
351
|
+
},
|
|
352
|
+
smallMedium: {
|
|
353
|
+
fontSize: fs["14"],
|
|
354
|
+
fontWeight: fw.medium,
|
|
355
|
+
lineHeight: lh["20"],
|
|
356
|
+
letterSpacing: ls.normal
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
body: {
|
|
360
|
+
large: {
|
|
361
|
+
fontSize: fs["16"],
|
|
362
|
+
fontWeight: fw.regular,
|
|
363
|
+
lineHeight: lh["24"],
|
|
364
|
+
letterSpacing: ls.normal
|
|
365
|
+
},
|
|
366
|
+
largeMedium: {
|
|
367
|
+
fontSize: fs["16"],
|
|
368
|
+
fontWeight: fw.medium,
|
|
369
|
+
lineHeight: lh["24"],
|
|
370
|
+
letterSpacing: ls.normal
|
|
371
|
+
},
|
|
372
|
+
medium: {
|
|
373
|
+
fontSize: fs["15"],
|
|
374
|
+
fontWeight: fw.regular,
|
|
375
|
+
lineHeight: lh["22-5"],
|
|
376
|
+
letterSpacing: ls.normal
|
|
377
|
+
},
|
|
378
|
+
mediumMedium: {
|
|
379
|
+
fontSize: fs["15"],
|
|
380
|
+
fontWeight: fw.medium,
|
|
381
|
+
lineHeight: lh["22-5"],
|
|
382
|
+
letterSpacing: ls.normal
|
|
383
|
+
},
|
|
384
|
+
small: {
|
|
385
|
+
fontSize: fs["14"],
|
|
386
|
+
fontWeight: fw.regular,
|
|
387
|
+
lineHeight: lh["20"],
|
|
388
|
+
letterSpacing: ls.normal
|
|
389
|
+
},
|
|
390
|
+
smallMedium: {
|
|
391
|
+
fontSize: fs["14"],
|
|
392
|
+
fontWeight: fw.medium,
|
|
393
|
+
lineHeight: lh["20"],
|
|
394
|
+
letterSpacing: ls.normal
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
label: {
|
|
398
|
+
large: {
|
|
399
|
+
fontSize: fs["14"],
|
|
400
|
+
fontWeight: fw.regular,
|
|
401
|
+
lineHeight: lh["20"],
|
|
402
|
+
letterSpacing: ls.normal
|
|
403
|
+
},
|
|
404
|
+
largeMedium: {
|
|
405
|
+
fontSize: fs["14"],
|
|
406
|
+
fontWeight: fw.medium,
|
|
407
|
+
lineHeight: lh["20"],
|
|
408
|
+
letterSpacing: ls.normal
|
|
409
|
+
},
|
|
410
|
+
medium: {
|
|
411
|
+
fontSize: fs["13"],
|
|
412
|
+
fontWeight: fw.regular,
|
|
413
|
+
lineHeight: lh["18"],
|
|
414
|
+
letterSpacing: ls.normal
|
|
415
|
+
},
|
|
416
|
+
mediumMedium: {
|
|
417
|
+
fontSize: fs["13"],
|
|
418
|
+
fontWeight: fw.medium,
|
|
419
|
+
lineHeight: lh["18"],
|
|
420
|
+
letterSpacing: ls.normal
|
|
421
|
+
},
|
|
422
|
+
small: {
|
|
423
|
+
fontSize: fs["12"],
|
|
424
|
+
fontWeight: fw.regular,
|
|
425
|
+
lineHeight: lh["16"],
|
|
426
|
+
letterSpacing: ls.normal
|
|
427
|
+
},
|
|
428
|
+
smallMedium: {
|
|
429
|
+
fontSize: fs["12"],
|
|
430
|
+
fontWeight: fw.medium,
|
|
431
|
+
lineHeight: lh["16"],
|
|
432
|
+
letterSpacing: ls.normal
|
|
433
|
+
}
|
|
434
|
+
}
|
|
166
435
|
};
|
|
167
436
|
|
|
168
437
|
// src/styles/ts/z-index.ts
|
|
169
438
|
var zIndex = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
var a11y = {
|
|
177
|
-
focusRing: "0 0 0 3px rgba(0, 0, 0, 0.15)",
|
|
178
|
-
focusRingError: "0 0 0 3px rgba(239, 68, 68, 0.15)",
|
|
179
|
-
focusRingSuccess: "0 0 0 3px rgba(16, 185, 129, 0.15)",
|
|
180
|
-
tapMinSize: "44px"
|
|
439
|
+
level0: 0,
|
|
440
|
+
level1: 10,
|
|
441
|
+
level2: 100,
|
|
442
|
+
level3: 200,
|
|
443
|
+
level4: 500,
|
|
444
|
+
level5: 1e3
|
|
181
445
|
};
|
|
182
446
|
|
|
183
447
|
// src/utils/cn.ts
|
|
@@ -194,7 +458,7 @@ var cn = (...classes) => {
|
|
|
194
458
|
}
|
|
195
459
|
} else if (typeof item === "object") {
|
|
196
460
|
for (const key in item) {
|
|
197
|
-
if (Object.
|
|
461
|
+
if (Object.hasOwn(item, key) && item[key]) {
|
|
198
462
|
classNames.push(key);
|
|
199
463
|
}
|
|
200
464
|
}
|
|
@@ -211,8 +475,8 @@ var FOCUSABLE_SELECTORS = [
|
|
|
211
475
|
'[tabindex]:not([tabindex="-1"])'
|
|
212
476
|
].join(", ");
|
|
213
477
|
function useFocusTrap(containerRef, isActive) {
|
|
214
|
-
const previousActiveElement =
|
|
215
|
-
|
|
478
|
+
const previousActiveElement = React9.useRef(null);
|
|
479
|
+
React9.useEffect(() => {
|
|
216
480
|
if (!isActive) return;
|
|
217
481
|
const container = containerRef.current;
|
|
218
482
|
if (!container) return;
|
|
@@ -256,9 +520,7 @@ function useFocusTrap(containerRef, isActive) {
|
|
|
256
520
|
if (wasTabIndexAdded) {
|
|
257
521
|
container.removeAttribute("tabindex");
|
|
258
522
|
}
|
|
259
|
-
|
|
260
|
-
previousActiveElement.current.focus();
|
|
261
|
-
}
|
|
523
|
+
previousActiveElement.current?.focus();
|
|
262
524
|
};
|
|
263
525
|
}, [isActive, containerRef]);
|
|
264
526
|
}
|
|
@@ -292,9 +554,7 @@ var useAlert = () => {
|
|
|
292
554
|
}
|
|
293
555
|
return context;
|
|
294
556
|
};
|
|
295
|
-
var AlertProvider = ({
|
|
296
|
-
children
|
|
297
|
-
}) => {
|
|
557
|
+
var AlertProvider = ({ children }) => {
|
|
298
558
|
const [alertState, setAlertState] = useState({
|
|
299
559
|
isOpen: false
|
|
300
560
|
});
|
|
@@ -343,20 +603,15 @@ var AlertModal = ({
|
|
|
343
603
|
onCancel,
|
|
344
604
|
onClose
|
|
345
605
|
}) => {
|
|
346
|
-
const panelRef =
|
|
606
|
+
const panelRef = React9.useRef(null);
|
|
347
607
|
useFocusTrap(panelRef, true);
|
|
348
|
-
const modalClassName = [
|
|
349
|
-
|
|
350
|
-
`alert_variant_${variant}`
|
|
351
|
-
].filter(Boolean).join(" ");
|
|
352
|
-
const actionsClassName = [
|
|
353
|
-
"alert_actions",
|
|
354
|
-
`alert_actions_${actionsAlign}`
|
|
355
|
-
].filter(Boolean).join(" ");
|
|
608
|
+
const modalClassName = ["alert_modal", `alert_variant_${variant}`].filter(Boolean).join(" ");
|
|
609
|
+
const actionsClassName = ["alert_actions", `alert_actions_${actionsAlign}`].filter(Boolean).join(" ");
|
|
356
610
|
return /* @__PURE__ */ jsx(
|
|
357
611
|
"div",
|
|
358
612
|
{
|
|
359
613
|
className: "alert_overlay",
|
|
614
|
+
role: "presentation",
|
|
360
615
|
onClick: onClose,
|
|
361
616
|
onKeyDown: (e) => e.key === "Escape" && onClose(),
|
|
362
617
|
children: /* @__PURE__ */ jsxs(
|
|
@@ -365,6 +620,9 @@ var AlertModal = ({
|
|
|
365
620
|
ref: panelRef,
|
|
366
621
|
className: modalClassName,
|
|
367
622
|
onClick: (e) => e.stopPropagation(),
|
|
623
|
+
onKeyDown: (e) => {
|
|
624
|
+
if (e.key !== "Escape") e.stopPropagation();
|
|
625
|
+
},
|
|
368
626
|
role: "alertdialog",
|
|
369
627
|
"aria-modal": "true",
|
|
370
628
|
"aria-labelledby": "alert_title",
|
|
@@ -373,24 +631,8 @@ var AlertModal = ({
|
|
|
373
631
|
title && /* @__PURE__ */ jsx("div", { className: "alert_title", id: "alert_title", children: title }),
|
|
374
632
|
message && /* @__PURE__ */ jsx("div", { className: "alert_message", id: "alert_message", children: message }),
|
|
375
633
|
/* @__PURE__ */ jsxs("div", { className: actionsClassName, children: [
|
|
376
|
-
showCancel && /* @__PURE__ */ jsx(
|
|
377
|
-
|
|
378
|
-
{
|
|
379
|
-
type: "button",
|
|
380
|
-
className: "alert_button alert_button_cancel",
|
|
381
|
-
onClick: onCancel,
|
|
382
|
-
children: cancelText
|
|
383
|
-
}
|
|
384
|
-
),
|
|
385
|
-
/* @__PURE__ */ jsx(
|
|
386
|
-
"button",
|
|
387
|
-
{
|
|
388
|
-
type: "button",
|
|
389
|
-
className: "alert_button alert_button_confirm",
|
|
390
|
-
onClick: onConfirm,
|
|
391
|
-
children: confirmText
|
|
392
|
-
}
|
|
393
|
-
)
|
|
634
|
+
showCancel && /* @__PURE__ */ jsx("button", { type: "button", className: "alert_button alert_button_cancel", onClick: onCancel, children: cancelText }),
|
|
635
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "alert_button alert_button_confirm", onClick: onConfirm, children: confirmText })
|
|
394
636
|
] })
|
|
395
637
|
]
|
|
396
638
|
}
|
|
@@ -409,42 +651,7 @@ var Spinner = ({ size = 24, ariaLabel = "Loading" }) => {
|
|
|
409
651
|
}
|
|
410
652
|
);
|
|
411
653
|
};
|
|
412
|
-
var
|
|
413
|
-
progress,
|
|
414
|
-
color,
|
|
415
|
-
height = 3,
|
|
416
|
-
isLoading = true,
|
|
417
|
-
ariaLabel = "Page loading"
|
|
418
|
-
}) => {
|
|
419
|
-
if (!isLoading) return null;
|
|
420
|
-
const isIndeterminate = progress === void 0;
|
|
421
|
-
return /* @__PURE__ */ jsx(
|
|
422
|
-
"div",
|
|
423
|
-
{
|
|
424
|
-
className: "top_loading",
|
|
425
|
-
style: { height },
|
|
426
|
-
role: "progressbar",
|
|
427
|
-
"aria-valuemin": 0,
|
|
428
|
-
"aria-valuemax": 100,
|
|
429
|
-
"aria-valuenow": isIndeterminate ? void 0 : progress,
|
|
430
|
-
"aria-label": ariaLabel,
|
|
431
|
-
children: /* @__PURE__ */ jsx(
|
|
432
|
-
"div",
|
|
433
|
-
{
|
|
434
|
-
className: [
|
|
435
|
-
"top_loading_bar",
|
|
436
|
-
isIndeterminate && "top_loading_indeterminate"
|
|
437
|
-
].filter(Boolean).join(" "),
|
|
438
|
-
style: {
|
|
439
|
-
width: isIndeterminate ? void 0 : `${progress}%`,
|
|
440
|
-
backgroundColor: color
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
)
|
|
444
|
-
}
|
|
445
|
-
);
|
|
446
|
-
};
|
|
447
|
-
var ToastContext = React7.createContext(null);
|
|
654
|
+
var ToastContext = React9.createContext(null);
|
|
448
655
|
var VARIANT_ICONS = {
|
|
449
656
|
success: /* @__PURE__ */ jsx(CheckCircle2, { size: 18 }),
|
|
450
657
|
error: /* @__PURE__ */ jsx(XCircle, { size: 18 }),
|
|
@@ -453,63 +660,48 @@ var VARIANT_ICONS = {
|
|
|
453
660
|
default: /* @__PURE__ */ jsx(Bell, { size: 18 })
|
|
454
661
|
};
|
|
455
662
|
var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
456
|
-
const [exiting, setExiting] =
|
|
457
|
-
const closingRef =
|
|
458
|
-
const close =
|
|
663
|
+
const [exiting, setExiting] = React9.useState(false);
|
|
664
|
+
const closingRef = React9.useRef(false);
|
|
665
|
+
const close = React9.useCallback(() => {
|
|
459
666
|
if (closingRef.current) return;
|
|
460
667
|
closingRef.current = true;
|
|
461
668
|
setExiting(true);
|
|
462
669
|
setTimeout(() => onRemove(item.id), 260);
|
|
463
670
|
}, [item.id, onRemove]);
|
|
464
|
-
const itemClassName = [
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
type: "button",
|
|
480
|
-
className: "toast_close",
|
|
481
|
-
onClick: close,
|
|
482
|
-
"aria-label": closeAriaLabel,
|
|
483
|
-
children: /* @__PURE__ */ jsx(X, { size: 14 })
|
|
484
|
-
}
|
|
485
|
-
),
|
|
486
|
-
/* @__PURE__ */ jsx(
|
|
487
|
-
"div",
|
|
488
|
-
{
|
|
489
|
-
className: `toast_progress toast_progress_${item.variant}`,
|
|
490
|
-
style: { "--toast-duration": `${item.duration}ms` },
|
|
491
|
-
onAnimationEnd: close,
|
|
492
|
-
"aria-hidden": "true"
|
|
493
|
-
}
|
|
494
|
-
)
|
|
495
|
-
]
|
|
496
|
-
}
|
|
497
|
-
);
|
|
671
|
+
const itemClassName = ["toast_item", exiting && "toast_item_exiting"].filter(Boolean).join(" ");
|
|
672
|
+
return /* @__PURE__ */ jsxs("div", { className: itemClassName, role: item.variant === "error" ? "alert" : "status", children: [
|
|
673
|
+
/* @__PURE__ */ jsx("span", { className: `toast_icon toast_icon_${item.variant}`, "aria-hidden": "true", children: VARIANT_ICONS[item.variant] }),
|
|
674
|
+
/* @__PURE__ */ jsx("span", { className: "toast_message", children: item.message }),
|
|
675
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "toast_close", onClick: close, "aria-label": closeAriaLabel, children: /* @__PURE__ */ jsx(X, { size: 14 }) }),
|
|
676
|
+
/* @__PURE__ */ jsx(
|
|
677
|
+
"div",
|
|
678
|
+
{
|
|
679
|
+
className: `toast_progress toast_progress_${item.variant}`,
|
|
680
|
+
style: { "--toast-duration": `${item.duration}ms` },
|
|
681
|
+
onAnimationEnd: close,
|
|
682
|
+
"aria-hidden": "true"
|
|
683
|
+
}
|
|
684
|
+
)
|
|
685
|
+
] });
|
|
498
686
|
};
|
|
499
|
-
var ToastProvider = ({
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
687
|
+
var ToastProvider = ({
|
|
688
|
+
children,
|
|
689
|
+
maxCount = 5,
|
|
690
|
+
closeAriaLabel = "Close"
|
|
691
|
+
}) => {
|
|
692
|
+
const [toasts, setToasts] = React9.useState([]);
|
|
693
|
+
const [isMounted, setIsMounted] = React9.useState(false);
|
|
694
|
+
React9.useEffect(() => {
|
|
503
695
|
setIsMounted(true);
|
|
504
696
|
}, []);
|
|
505
|
-
const addToast =
|
|
697
|
+
const addToast = React9.useCallback(
|
|
506
698
|
(message, variant, duration = 3e3) => {
|
|
507
699
|
const id = crypto.randomUUID();
|
|
508
700
|
setToasts((prev) => [{ id, message, variant, duration }, ...prev].slice(0, maxCount));
|
|
509
701
|
},
|
|
510
702
|
[maxCount]
|
|
511
703
|
);
|
|
512
|
-
const removeToast =
|
|
704
|
+
const removeToast = React9.useCallback((id) => {
|
|
513
705
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
514
706
|
}, []);
|
|
515
707
|
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { addToast }, children: [
|
|
@@ -519,6 +711,7 @@ var ToastProvider = ({ children, maxCount = 5, closeAriaLabel = "Close" }) => {
|
|
|
519
711
|
"div",
|
|
520
712
|
{
|
|
521
713
|
className: "toast_container",
|
|
714
|
+
role: "region",
|
|
522
715
|
"aria-live": "polite",
|
|
523
716
|
"aria-atomic": "false",
|
|
524
717
|
"aria-label": "Notifications",
|
|
@@ -555,101 +748,358 @@ var useToast = () => {
|
|
|
555
748
|
message: (message, duration) => ctx.addToast(message, "default", duration)
|
|
556
749
|
};
|
|
557
750
|
};
|
|
558
|
-
var
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
style,
|
|
565
|
-
...props
|
|
751
|
+
var TopLoading = ({
|
|
752
|
+
progress,
|
|
753
|
+
color,
|
|
754
|
+
height = 3,
|
|
755
|
+
isLoading = true,
|
|
756
|
+
ariaLabel = "Page loading"
|
|
566
757
|
}) => {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
React7.useEffect(() => {
|
|
582
|
-
if (!inputRef.current) return;
|
|
583
|
-
inputRef.current.indeterminate = Boolean(indeterminate);
|
|
584
|
-
}, [indeterminate]);
|
|
585
|
-
const rootClassName = cn(
|
|
586
|
-
"checkbox",
|
|
587
|
-
`checkbox_size_${size}`,
|
|
588
|
-
className
|
|
589
|
-
);
|
|
590
|
-
return /* @__PURE__ */ jsxs("label", { className: rootClassName, children: [
|
|
591
|
-
/* @__PURE__ */ jsx(
|
|
592
|
-
"input",
|
|
758
|
+
if (!isLoading) return null;
|
|
759
|
+
const isIndeterminate = progress === void 0;
|
|
760
|
+
return /* @__PURE__ */ jsx(
|
|
761
|
+
"div",
|
|
762
|
+
{
|
|
763
|
+
className: "top_loading",
|
|
764
|
+
style: { height },
|
|
765
|
+
role: "progressbar",
|
|
766
|
+
"aria-valuemin": 0,
|
|
767
|
+
"aria-valuemax": 100,
|
|
768
|
+
"aria-valuenow": isIndeterminate ? void 0 : progress,
|
|
769
|
+
"aria-label": ariaLabel,
|
|
770
|
+
children: /* @__PURE__ */ jsx(
|
|
771
|
+
"div",
|
|
593
772
|
{
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
773
|
+
className: ["top_loading_bar", isIndeterminate && "top_loading_indeterminate"].filter(Boolean).join(" "),
|
|
774
|
+
style: {
|
|
775
|
+
width: isIndeterminate ? void 0 : `${progress}%`,
|
|
776
|
+
backgroundColor: color
|
|
777
|
+
}
|
|
598
778
|
}
|
|
599
|
-
)
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
label = "Choose file",
|
|
608
|
-
onFiles,
|
|
609
|
-
helperText,
|
|
779
|
+
)
|
|
780
|
+
}
|
|
781
|
+
);
|
|
782
|
+
};
|
|
783
|
+
var Checkbox = ({
|
|
784
|
+
label,
|
|
785
|
+
size = "md",
|
|
786
|
+
indeterminate,
|
|
610
787
|
className,
|
|
611
|
-
|
|
788
|
+
ref,
|
|
612
789
|
...props
|
|
613
790
|
}) => {
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
return /* @__PURE__ */ jsxs("
|
|
622
|
-
/* @__PURE__ */ jsx(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
id: inputId,
|
|
626
|
-
type: "file",
|
|
627
|
-
className: "file_input_control",
|
|
628
|
-
disabled,
|
|
629
|
-
"aria-describedby": helperText ? helperId : void 0,
|
|
630
|
-
onChange: (e) => onFiles?.(e.currentTarget.files),
|
|
631
|
-
...props
|
|
632
|
-
}
|
|
633
|
-
),
|
|
634
|
-
/* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "file_input_label", children: label }),
|
|
635
|
-
helperText && /* @__PURE__ */ jsx("span", { id: helperId, className: "file_input_helper", children: helperText })
|
|
791
|
+
const inputRef = React9.useRef(null);
|
|
792
|
+
React9.useImperativeHandle(ref, () => inputRef.current);
|
|
793
|
+
React9.useEffect(() => {
|
|
794
|
+
if (!inputRef.current) return;
|
|
795
|
+
inputRef.current.indeterminate = Boolean(indeterminate);
|
|
796
|
+
}, [indeterminate]);
|
|
797
|
+
const rootClassName = cn("checkbox", `checkbox_size_${size}`, className);
|
|
798
|
+
return /* @__PURE__ */ jsxs("label", { className: rootClassName, children: [
|
|
799
|
+
/* @__PURE__ */ jsx("input", { ref: inputRef, type: "checkbox", className: "checkbox_input", ...props }),
|
|
800
|
+
/* @__PURE__ */ jsx("span", { className: "checkbox_box", "aria-hidden": "true" }),
|
|
801
|
+
label ? /* @__PURE__ */ jsx("span", { className: "checkbox_label", children: label }) : null
|
|
636
802
|
] });
|
|
637
803
|
};
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
804
|
+
Checkbox.displayName = "Checkbox";
|
|
805
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
806
|
+
var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
|
|
807
|
+
var normalizeWidth = (v) => typeof v === "number" ? `${v}px` : v;
|
|
808
|
+
var DatePicker = ({
|
|
809
|
+
label,
|
|
810
|
+
value,
|
|
811
|
+
onChange,
|
|
812
|
+
mode = "year-month-day",
|
|
813
|
+
startYear = 1950,
|
|
814
|
+
endYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
|
|
815
|
+
minDate,
|
|
816
|
+
selectableRange = "all",
|
|
817
|
+
disabled,
|
|
818
|
+
fullWidth = true,
|
|
819
|
+
width,
|
|
820
|
+
yearLabel = "Year",
|
|
821
|
+
monthLabel = "Month",
|
|
822
|
+
dayLabel = "Day",
|
|
823
|
+
minDateSrFormat = "Minimum date: {date}",
|
|
824
|
+
selectableRangeUntilTodaySrText = "Selectable up to today"
|
|
825
|
+
}) => {
|
|
826
|
+
const groupId = React9.useId();
|
|
827
|
+
const constraintId = React9.useId();
|
|
828
|
+
const today = /* @__PURE__ */ new Date();
|
|
829
|
+
const todayYear = today.getFullYear();
|
|
830
|
+
const todayMonth = today.getMonth() + 1;
|
|
831
|
+
const todayDay = today.getDate();
|
|
832
|
+
const [y, m, d] = value?.split("-").map(Number) ?? [];
|
|
833
|
+
const [minY, minM, minD] = minDate?.split("-").map(Number) ?? [];
|
|
834
|
+
const year = y ?? "";
|
|
835
|
+
const month = m ?? "";
|
|
836
|
+
const day = d ?? "";
|
|
837
|
+
const maxYear = selectableRange === "until-today" ? todayYear : endYear;
|
|
838
|
+
const minMonth = minY && year === minY ? minM : 1;
|
|
839
|
+
const maxMonth = selectableRange === "until-today" && year === todayYear ? todayMonth : 12;
|
|
840
|
+
const minDay = minY && minM && year === minY && month === minM ? minD : 1;
|
|
841
|
+
const maxDay = selectableRange === "until-today" && year === todayYear && month === todayMonth ? todayDay : getDaysInMonth(year || todayYear, month || 1);
|
|
842
|
+
const days = year && month ? Math.min(getDaysInMonth(year, month), maxDay) : 31;
|
|
843
|
+
const clampDay = (year2, month2, day2) => Math.min(day2, getDaysInMonth(year2, month2));
|
|
844
|
+
const emit = (yy, mm, dd) => {
|
|
845
|
+
if (mode === "year-month") {
|
|
846
|
+
onChange(`${yy}-${pad(mm)}`);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
const safeDay = clampDay(yy, mm, dd ?? 1);
|
|
850
|
+
onChange(`${yy}-${pad(mm)}-${pad(safeDay)}`);
|
|
851
|
+
};
|
|
852
|
+
const containerStyle = width ? { width: normalizeWidth(width) } : void 0;
|
|
853
|
+
const rootClassName = cn("date_picker", { date_picker_full_width: fullWidth && !width });
|
|
854
|
+
const constraintParts = [];
|
|
855
|
+
if (minDate) constraintParts.push(minDateSrFormat.replace("{date}", minDate));
|
|
856
|
+
if (selectableRange === "until-today") constraintParts.push(selectableRangeUntilTodaySrText);
|
|
857
|
+
const constraintDesc = constraintParts.join(". ");
|
|
858
|
+
return /* @__PURE__ */ jsxs("div", { className: rootClassName, style: containerStyle, children: [
|
|
859
|
+
label && /* @__PURE__ */ jsx("span", { className: "date_picker_label", id: groupId, children: label }),
|
|
860
|
+
constraintDesc && /* @__PURE__ */ jsx("span", { id: constraintId, className: "date_picker_sr_only", children: constraintDesc }),
|
|
861
|
+
/* @__PURE__ */ jsxs(
|
|
862
|
+
"div",
|
|
863
|
+
{
|
|
864
|
+
className: "date_picker_fields",
|
|
865
|
+
role: "group",
|
|
866
|
+
"aria-labelledby": label ? groupId : void 0,
|
|
867
|
+
"aria-describedby": constraintDesc ? constraintId : void 0,
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ jsxs(
|
|
870
|
+
"select",
|
|
871
|
+
{
|
|
872
|
+
"aria-label": yearLabel,
|
|
873
|
+
value: year,
|
|
874
|
+
disabled,
|
|
875
|
+
onChange: (e) => emit(Number(e.target.value), month || minMonth, day || minDay),
|
|
876
|
+
children: [
|
|
877
|
+
/* @__PURE__ */ jsx("option", { value: "", children: yearLabel }),
|
|
878
|
+
Array.from({ length: maxYear - startYear + 1 }, (_, i) => startYear + i).map((y2) => /* @__PURE__ */ jsx("option", { value: y2, children: y2 }, y2))
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
),
|
|
882
|
+
/* @__PURE__ */ jsxs(
|
|
883
|
+
"select",
|
|
884
|
+
{
|
|
885
|
+
"aria-label": monthLabel,
|
|
886
|
+
value: month,
|
|
887
|
+
disabled: disabled || !year,
|
|
888
|
+
onChange: (e) => emit(year, Number(e.target.value), day || minDay),
|
|
889
|
+
children: [
|
|
890
|
+
/* @__PURE__ */ jsx("option", { value: "", children: monthLabel }),
|
|
891
|
+
Array.from({ length: maxMonth - minMonth + 1 }, (_, i) => minMonth + i).map((m2) => /* @__PURE__ */ jsx("option", { value: m2, children: pad(m2) }, m2))
|
|
892
|
+
]
|
|
893
|
+
}
|
|
894
|
+
),
|
|
895
|
+
mode === "year-month-day" && /* @__PURE__ */ jsxs(
|
|
896
|
+
"select",
|
|
897
|
+
{
|
|
898
|
+
"aria-label": dayLabel,
|
|
899
|
+
value: day,
|
|
900
|
+
disabled: disabled || !month,
|
|
901
|
+
onChange: (e) => emit(year, month, Number(e.target.value)),
|
|
902
|
+
children: [
|
|
903
|
+
/* @__PURE__ */ jsx("option", { value: "", children: dayLabel }),
|
|
904
|
+
Array.from({ length: days - minDay + 1 }, (_, i) => minDay + i).map((d2) => /* @__PURE__ */ jsx("option", { value: d2, children: pad(d2) }, d2))
|
|
905
|
+
]
|
|
906
|
+
}
|
|
907
|
+
)
|
|
908
|
+
]
|
|
909
|
+
}
|
|
910
|
+
)
|
|
911
|
+
] });
|
|
912
|
+
};
|
|
913
|
+
var FileInput = ({
|
|
914
|
+
label = "Choose file",
|
|
915
|
+
onFiles,
|
|
916
|
+
helperText,
|
|
917
|
+
className,
|
|
918
|
+
disabled,
|
|
919
|
+
...props
|
|
920
|
+
}) => {
|
|
921
|
+
const inputId = React9.useId();
|
|
922
|
+
const helperId = React9.useId();
|
|
923
|
+
const rootClassName = ["file_input", disabled && "file_input_disabled", className ?? ""].filter(Boolean).join(" ");
|
|
924
|
+
return /* @__PURE__ */ jsxs("div", { className: rootClassName, children: [
|
|
925
|
+
/* @__PURE__ */ jsx(
|
|
926
|
+
"input",
|
|
927
|
+
{
|
|
928
|
+
id: inputId,
|
|
929
|
+
type: "file",
|
|
930
|
+
className: "file_input_control",
|
|
931
|
+
disabled,
|
|
932
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
933
|
+
onChange: (e) => onFiles?.(e.currentTarget.files),
|
|
934
|
+
...props
|
|
935
|
+
}
|
|
936
|
+
),
|
|
937
|
+
/* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "file_input_label", children: label }),
|
|
938
|
+
helperText && /* @__PURE__ */ jsx("span", { id: helperId, className: "file_input_helper", children: helperText })
|
|
939
|
+
] });
|
|
940
|
+
};
|
|
941
|
+
var Radio = ({ label, size = "md", className, ref, ...props }) => {
|
|
942
|
+
const rootClassName = cn("radio", `radio_size_${size}`, className);
|
|
943
|
+
return /* @__PURE__ */ jsxs("label", { className: rootClassName, children: [
|
|
944
|
+
/* @__PURE__ */ jsx("input", { ref, type: "radio", className: "radio_input", ...props }),
|
|
945
|
+
/* @__PURE__ */ jsx("span", { className: "radio_dot", "aria-hidden": "true" }),
|
|
946
|
+
label ? /* @__PURE__ */ jsx("span", { className: "radio_label", children: label }) : null
|
|
947
|
+
] });
|
|
948
|
+
};
|
|
949
|
+
Radio.displayName = "Radio";
|
|
950
|
+
var Switch = ({
|
|
951
|
+
checked,
|
|
952
|
+
defaultChecked,
|
|
953
|
+
onChange,
|
|
954
|
+
size = "md",
|
|
955
|
+
disabled,
|
|
956
|
+
className,
|
|
957
|
+
ariaLabel,
|
|
958
|
+
ref,
|
|
959
|
+
...props
|
|
960
|
+
}) => {
|
|
961
|
+
const isControlled = checked !== void 0;
|
|
962
|
+
const [innerChecked, setInnerChecked] = React9.useState(!!defaultChecked);
|
|
963
|
+
const isOn = isControlled ? !!checked : innerChecked;
|
|
964
|
+
const handleToggle = () => {
|
|
965
|
+
if (disabled) return;
|
|
966
|
+
const next = !isOn;
|
|
967
|
+
if (!isControlled) setInnerChecked(next);
|
|
968
|
+
onChange?.(next);
|
|
969
|
+
};
|
|
970
|
+
const rootClassName = cn(
|
|
971
|
+
"switch",
|
|
972
|
+
`switch_size_${size}`,
|
|
973
|
+
{ switch_on: isOn, switch_disabled: disabled },
|
|
974
|
+
className
|
|
975
|
+
);
|
|
976
|
+
return /* @__PURE__ */ jsx(
|
|
977
|
+
"button",
|
|
978
|
+
{
|
|
979
|
+
ref,
|
|
980
|
+
type: "button",
|
|
981
|
+
role: "switch",
|
|
982
|
+
"aria-checked": isOn,
|
|
983
|
+
"aria-label": ariaLabel,
|
|
984
|
+
disabled,
|
|
985
|
+
onClick: handleToggle,
|
|
986
|
+
className: rootClassName,
|
|
987
|
+
...props,
|
|
988
|
+
children: /* @__PURE__ */ jsx("span", { className: "switch_thumb" })
|
|
989
|
+
}
|
|
990
|
+
);
|
|
991
|
+
};
|
|
992
|
+
Switch.displayName = "Switch";
|
|
993
|
+
var TextField = ({
|
|
994
|
+
id,
|
|
995
|
+
label,
|
|
996
|
+
helperText,
|
|
997
|
+
error,
|
|
998
|
+
success,
|
|
999
|
+
variant = "outline",
|
|
1000
|
+
size = "md",
|
|
1001
|
+
leftIcon,
|
|
1002
|
+
rightIcon,
|
|
1003
|
+
fullWidth,
|
|
1004
|
+
className,
|
|
1005
|
+
onChangeAction,
|
|
1006
|
+
value,
|
|
1007
|
+
defaultValue,
|
|
1008
|
+
transformValue,
|
|
1009
|
+
ref,
|
|
1010
|
+
...props
|
|
1011
|
+
}) => {
|
|
1012
|
+
const generatedId = React9.useId();
|
|
1013
|
+
const inputId = id ?? generatedId;
|
|
1014
|
+
const helperId = helperText ? `${inputId}-help` : void 0;
|
|
1015
|
+
const isControlled = value !== void 0;
|
|
1016
|
+
const applyTransform = (nextValue) => transformValue ? transformValue(nextValue) : nextValue;
|
|
1017
|
+
const [innerValue, setInnerValue] = React9.useState(
|
|
1018
|
+
() => applyTransform(value ?? defaultValue ?? "")
|
|
1019
|
+
);
|
|
1020
|
+
const isComposingRef = React9.useRef(false);
|
|
1021
|
+
React9.useEffect(() => {
|
|
1022
|
+
if (!isControlled) return;
|
|
1023
|
+
const nextValue = value ?? "";
|
|
1024
|
+
setInnerValue(transformValue ? transformValue(nextValue) : nextValue);
|
|
1025
|
+
}, [isControlled, value, transformValue]);
|
|
1026
|
+
const rootClassName = cn("text_field", { text_field_full_width: fullWidth }, className);
|
|
1027
|
+
const inputClassName = cn(
|
|
1028
|
+
"text_field_input",
|
|
1029
|
+
`text_field_variant_${variant}`,
|
|
1030
|
+
`text_field_size_${size}`,
|
|
1031
|
+
{
|
|
1032
|
+
text_field_with_left: !!leftIcon,
|
|
1033
|
+
text_field_with_right: !!rightIcon,
|
|
1034
|
+
text_field_error: !!error,
|
|
1035
|
+
text_field_success: !!success
|
|
1036
|
+
}
|
|
1037
|
+
);
|
|
1038
|
+
const helperClassName = cn("text_field_helper", {
|
|
1039
|
+
text_field_helper_error: error,
|
|
1040
|
+
text_field_helper_success: success
|
|
1041
|
+
});
|
|
1042
|
+
return /* @__PURE__ */ jsxs("div", { className: rootClassName, children: [
|
|
1043
|
+
label ? /* @__PURE__ */ jsx("label", { className: "text_field_label", htmlFor: inputId, children: label }) : null,
|
|
1044
|
+
/* @__PURE__ */ jsxs("div", { className: "text_field_wrap", children: [
|
|
1045
|
+
leftIcon ? /* @__PURE__ */ jsx("span", { className: "text_field_icon text_field_icon_left", "aria-hidden": "true", children: leftIcon }) : null,
|
|
1046
|
+
/* @__PURE__ */ jsx(
|
|
1047
|
+
"input",
|
|
1048
|
+
{
|
|
1049
|
+
id: inputId,
|
|
1050
|
+
ref,
|
|
1051
|
+
className: inputClassName,
|
|
1052
|
+
"aria-invalid": !!error,
|
|
1053
|
+
"aria-describedby": helperId,
|
|
1054
|
+
...props,
|
|
1055
|
+
value: innerValue,
|
|
1056
|
+
onCompositionStart: () => {
|
|
1057
|
+
isComposingRef.current = true;
|
|
1058
|
+
},
|
|
1059
|
+
onCompositionEnd: (event) => {
|
|
1060
|
+
isComposingRef.current = false;
|
|
1061
|
+
const rawValue = event.currentTarget.value;
|
|
1062
|
+
const nextValue = applyTransform(rawValue);
|
|
1063
|
+
setInnerValue(nextValue);
|
|
1064
|
+
onChangeAction?.(nextValue);
|
|
1065
|
+
},
|
|
1066
|
+
onChange: (event) => {
|
|
1067
|
+
const rawValue = event.target.value;
|
|
1068
|
+
if (isComposingRef.current) {
|
|
1069
|
+
setInnerValue(rawValue);
|
|
1070
|
+
return;
|
|
1071
|
+
}
|
|
1072
|
+
const nextValue = applyTransform(rawValue);
|
|
1073
|
+
setInnerValue(nextValue);
|
|
1074
|
+
onChangeAction?.(nextValue);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
),
|
|
1078
|
+
rightIcon ? /* @__PURE__ */ jsx("span", { className: "text_field_icon text_field_icon_right", "aria-hidden": "true", children: rightIcon }) : null
|
|
1079
|
+
] }),
|
|
1080
|
+
helperText ? /* @__PURE__ */ jsx("div", { id: helperId, className: helperClassName, children: helperText }) : null
|
|
1081
|
+
] });
|
|
1082
|
+
};
|
|
1083
|
+
TextField.displayName = "TextField";
|
|
1084
|
+
var Button = ({
|
|
1085
|
+
variant = "primary",
|
|
1086
|
+
size = "md",
|
|
1087
|
+
fullWidth = true,
|
|
1088
|
+
width,
|
|
1089
|
+
className,
|
|
1090
|
+
style,
|
|
1091
|
+
...props
|
|
1092
|
+
}) => {
|
|
1093
|
+
const buttonClassName = cn(
|
|
1094
|
+
"button",
|
|
1095
|
+
`button_variant_${variant}`,
|
|
1096
|
+
`button_size_${size}`,
|
|
1097
|
+
fullWidth && !width && "button_full_width",
|
|
1098
|
+
className
|
|
1099
|
+
);
|
|
1100
|
+
const buttonStyle = width ? { ...style, width } : style;
|
|
1101
|
+
return /* @__PURE__ */ jsx("button", { className: buttonClassName, style: buttonStyle, ...props });
|
|
1102
|
+
};
|
|
653
1103
|
var Select = ({
|
|
654
1104
|
id,
|
|
655
1105
|
label,
|
|
@@ -665,21 +1115,21 @@ var Select = ({
|
|
|
665
1115
|
className,
|
|
666
1116
|
textAlign = "left"
|
|
667
1117
|
}) => {
|
|
668
|
-
const internalId =
|
|
1118
|
+
const internalId = React9.useId();
|
|
669
1119
|
const selectId = id ?? internalId;
|
|
670
1120
|
const isControlled = value !== void 0;
|
|
671
|
-
const [internalValue, setInternalValue] =
|
|
1121
|
+
const [internalValue, setInternalValue] = React9.useState(defaultValue);
|
|
672
1122
|
const currentValue = isControlled ? value ?? null : internalValue;
|
|
673
|
-
const [isOpen, setIsOpen] =
|
|
674
|
-
const [activeIndex, setActiveIndex] =
|
|
675
|
-
const [dropUp, setDropUp] =
|
|
676
|
-
const wrapperRef =
|
|
677
|
-
const controlRef =
|
|
678
|
-
const currentOption =
|
|
1123
|
+
const [isOpen, setIsOpen] = React9.useState(false);
|
|
1124
|
+
const [activeIndex, setActiveIndex] = React9.useState(-1);
|
|
1125
|
+
const [dropUp, setDropUp] = React9.useState(false);
|
|
1126
|
+
const wrapperRef = React9.useRef(null);
|
|
1127
|
+
const controlRef = React9.useRef(null);
|
|
1128
|
+
const currentOption = React9.useMemo(
|
|
679
1129
|
() => options.find((o) => o.value === currentValue) ?? null,
|
|
680
1130
|
[options, currentValue]
|
|
681
1131
|
);
|
|
682
|
-
const setValue =
|
|
1132
|
+
const setValue = React9.useCallback(
|
|
683
1133
|
(next) => {
|
|
684
1134
|
const option = options.find((o) => o.value === next) ?? null;
|
|
685
1135
|
if (!isControlled) setInternalValue(next);
|
|
@@ -687,12 +1137,12 @@ var Select = ({
|
|
|
687
1137
|
},
|
|
688
1138
|
[isControlled, onChange, options]
|
|
689
1139
|
);
|
|
690
|
-
const handleOutsideClick =
|
|
1140
|
+
const handleOutsideClick = React9.useEffectEvent((e) => {
|
|
691
1141
|
if (!wrapperRef.current?.contains(e.target)) {
|
|
692
1142
|
setIsOpen(false);
|
|
693
1143
|
}
|
|
694
1144
|
});
|
|
695
|
-
|
|
1145
|
+
React9.useEffect(() => {
|
|
696
1146
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
697
1147
|
return () => document.removeEventListener("mousedown", handleOutsideClick);
|
|
698
1148
|
}, []);
|
|
@@ -757,12 +1207,17 @@ var Select = ({
|
|
|
757
1207
|
break;
|
|
758
1208
|
}
|
|
759
1209
|
};
|
|
760
|
-
|
|
1210
|
+
React9.useEffect(() => {
|
|
761
1211
|
if (!isOpen) return;
|
|
762
1212
|
const idx = options.findIndex((o) => o.value === currentValue && !o.disabled);
|
|
763
|
-
setActiveIndex(
|
|
1213
|
+
setActiveIndex(
|
|
1214
|
+
idx >= 0 ? idx : Math.max(
|
|
1215
|
+
0,
|
|
1216
|
+
options.findIndex((o) => !o.disabled)
|
|
1217
|
+
)
|
|
1218
|
+
);
|
|
764
1219
|
}, [isOpen, options, currentValue]);
|
|
765
|
-
|
|
1220
|
+
React9.useLayoutEffect(() => {
|
|
766
1221
|
if (!isOpen || !controlRef.current) return;
|
|
767
1222
|
const rect = controlRef.current.getBoundingClientRect();
|
|
768
1223
|
const listHeight = Math.min(options.length * 40, 288);
|
|
@@ -778,51 +1233,53 @@ var Select = ({
|
|
|
778
1233
|
{ is_open: isOpen, is_disabled: disabled }
|
|
779
1234
|
);
|
|
780
1235
|
const listClassName = cn("select_list", { select_list_up: dropUp });
|
|
781
|
-
return /* @__PURE__ */ jsxs(
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
"
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
children: options.map((opt, i) => {
|
|
1236
|
+
return /* @__PURE__ */ jsxs(
|
|
1237
|
+
"div",
|
|
1238
|
+
{
|
|
1239
|
+
ref: wrapperRef,
|
|
1240
|
+
className: rootClassName,
|
|
1241
|
+
style: fullWidth ? { width: "100%" } : void 0,
|
|
1242
|
+
children: [
|
|
1243
|
+
label && /* @__PURE__ */ jsx("label", { htmlFor: selectId, className: "select_label", children: label }),
|
|
1244
|
+
/* @__PURE__ */ jsxs(
|
|
1245
|
+
"button",
|
|
1246
|
+
{
|
|
1247
|
+
ref: controlRef,
|
|
1248
|
+
id: selectId,
|
|
1249
|
+
type: "button",
|
|
1250
|
+
className: controlClassName,
|
|
1251
|
+
"aria-haspopup": "listbox",
|
|
1252
|
+
"aria-expanded": isOpen,
|
|
1253
|
+
"aria-controls": `${selectId}_listbox`,
|
|
1254
|
+
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
1255
|
+
onKeyDown,
|
|
1256
|
+
disabled,
|
|
1257
|
+
children: [
|
|
1258
|
+
/* @__PURE__ */ jsx(
|
|
1259
|
+
"span",
|
|
1260
|
+
{
|
|
1261
|
+
className: currentOption ? "select_value" : "select_placeholder",
|
|
1262
|
+
style: textAlign === "left" ? { textAlign: "start" } : void 0,
|
|
1263
|
+
children: currentOption ? currentOption.label : placeholder
|
|
1264
|
+
}
|
|
1265
|
+
),
|
|
1266
|
+
/* @__PURE__ */ jsx("span", { className: "select_icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChevronDown, { size: 16 }) })
|
|
1267
|
+
]
|
|
1268
|
+
}
|
|
1269
|
+
),
|
|
1270
|
+
isOpen && /* @__PURE__ */ jsx("div", { id: `${selectId}_listbox`, role: "listbox", className: listClassName, children: options.map((opt, i) => {
|
|
816
1271
|
const selected = currentValue === opt.value;
|
|
817
1272
|
const active = i === activeIndex;
|
|
818
|
-
const optionClassName = cn(
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
1273
|
+
const optionClassName = cn("select_option", {
|
|
1274
|
+
is_selected: selected,
|
|
1275
|
+
is_active: active,
|
|
1276
|
+
is_disabled: opt.disabled
|
|
1277
|
+
});
|
|
822
1278
|
return /* @__PURE__ */ jsxs(
|
|
823
|
-
"
|
|
1279
|
+
"div",
|
|
824
1280
|
{
|
|
825
1281
|
role: "option",
|
|
1282
|
+
tabIndex: -1,
|
|
826
1283
|
"aria-selected": selected,
|
|
827
1284
|
"aria-disabled": opt.disabled ? true : void 0,
|
|
828
1285
|
className: optionClassName,
|
|
@@ -832,6 +1289,14 @@ var Select = ({
|
|
|
832
1289
|
setValue(opt.value);
|
|
833
1290
|
setIsOpen(false);
|
|
834
1291
|
},
|
|
1292
|
+
onKeyDown: (e) => {
|
|
1293
|
+
if (opt.disabled) return;
|
|
1294
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1295
|
+
e.preventDefault();
|
|
1296
|
+
setValue(opt.value);
|
|
1297
|
+
setIsOpen(false);
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
835
1300
|
children: [
|
|
836
1301
|
/* @__PURE__ */ jsx("span", { children: opt.label }),
|
|
837
1302
|
selected && /* @__PURE__ */ jsx(Check, { size: 16, "aria-hidden": "true" })
|
|
@@ -839,267 +1304,10 @@ var Select = ({
|
|
|
839
1304
|
},
|
|
840
1305
|
opt.value
|
|
841
1306
|
);
|
|
842
|
-
})
|
|
843
|
-
|
|
844
|
-
)
|
|
845
|
-
] });
|
|
846
|
-
};
|
|
847
|
-
var Switch = React7.forwardRef(
|
|
848
|
-
({
|
|
849
|
-
checked,
|
|
850
|
-
defaultChecked,
|
|
851
|
-
onChange,
|
|
852
|
-
size = "md",
|
|
853
|
-
disabled,
|
|
854
|
-
className,
|
|
855
|
-
ariaLabel,
|
|
856
|
-
...props
|
|
857
|
-
}, ref) => {
|
|
858
|
-
const isControlled = checked !== void 0;
|
|
859
|
-
const [innerChecked, setInnerChecked] = React7.useState(!!defaultChecked);
|
|
860
|
-
const isOn = isControlled ? !!checked : innerChecked;
|
|
861
|
-
const handleToggle = () => {
|
|
862
|
-
if (disabled) return;
|
|
863
|
-
const next = !isOn;
|
|
864
|
-
if (!isControlled) setInnerChecked(next);
|
|
865
|
-
onChange?.(next);
|
|
866
|
-
};
|
|
867
|
-
const rootClassName = cn(
|
|
868
|
-
"switch",
|
|
869
|
-
`switch_size_${size}`,
|
|
870
|
-
{ switch_on: isOn, switch_disabled: disabled },
|
|
871
|
-
className
|
|
872
|
-
);
|
|
873
|
-
return /* @__PURE__ */ jsx(
|
|
874
|
-
"button",
|
|
875
|
-
{
|
|
876
|
-
ref,
|
|
877
|
-
type: "button",
|
|
878
|
-
role: "switch",
|
|
879
|
-
"aria-checked": isOn,
|
|
880
|
-
"aria-label": ariaLabel,
|
|
881
|
-
disabled,
|
|
882
|
-
onClick: handleToggle,
|
|
883
|
-
className: rootClassName,
|
|
884
|
-
...props,
|
|
885
|
-
children: /* @__PURE__ */ jsx("span", { className: "switch_thumb" })
|
|
886
|
-
}
|
|
887
|
-
);
|
|
888
|
-
}
|
|
889
|
-
);
|
|
890
|
-
Switch.displayName = "Switch";
|
|
891
|
-
var TextField = React7.forwardRef(
|
|
892
|
-
({
|
|
893
|
-
id,
|
|
894
|
-
label,
|
|
895
|
-
helperText,
|
|
896
|
-
error,
|
|
897
|
-
success,
|
|
898
|
-
variant = "outline",
|
|
899
|
-
size = "md",
|
|
900
|
-
leftIcon,
|
|
901
|
-
rightIcon,
|
|
902
|
-
fullWidth,
|
|
903
|
-
className,
|
|
904
|
-
onChangeAction,
|
|
905
|
-
value,
|
|
906
|
-
defaultValue,
|
|
907
|
-
transformValue,
|
|
908
|
-
...props
|
|
909
|
-
}, ref) => {
|
|
910
|
-
const inputId = id ?? React7.useId();
|
|
911
|
-
const helperId = helperText ? `${inputId}-help` : void 0;
|
|
912
|
-
const isControlled = value !== void 0;
|
|
913
|
-
const applyTransform = (nextValue) => transformValue ? transformValue(nextValue) : nextValue;
|
|
914
|
-
const [innerValue, setInnerValue] = React7.useState(
|
|
915
|
-
() => applyTransform(value ?? defaultValue ?? "")
|
|
916
|
-
);
|
|
917
|
-
const isComposingRef = React7.useRef(false);
|
|
918
|
-
React7.useEffect(() => {
|
|
919
|
-
if (!isControlled) return;
|
|
920
|
-
setInnerValue(applyTransform(value ?? ""));
|
|
921
|
-
}, [isControlled, value, transformValue]);
|
|
922
|
-
const rootClassName = cn(
|
|
923
|
-
"text_field",
|
|
924
|
-
{ text_field_full_width: fullWidth },
|
|
925
|
-
className
|
|
926
|
-
);
|
|
927
|
-
const inputClassName = cn(
|
|
928
|
-
"text_field_input",
|
|
929
|
-
`text_field_variant_${variant}`,
|
|
930
|
-
`text_field_size_${size}`,
|
|
931
|
-
{
|
|
932
|
-
text_field_with_left: !!leftIcon,
|
|
933
|
-
text_field_with_right: !!rightIcon,
|
|
934
|
-
text_field_error: !!error,
|
|
935
|
-
text_field_success: !!success
|
|
936
|
-
}
|
|
937
|
-
);
|
|
938
|
-
const helperClassName = cn(
|
|
939
|
-
"text_field_helper",
|
|
940
|
-
{
|
|
941
|
-
text_field_helper_error: error,
|
|
942
|
-
text_field_helper_success: success
|
|
943
|
-
}
|
|
944
|
-
);
|
|
945
|
-
return /* @__PURE__ */ jsxs("div", { className: rootClassName, children: [
|
|
946
|
-
label ? /* @__PURE__ */ jsx("label", { className: "text_field_label", htmlFor: inputId, children: label }) : null,
|
|
947
|
-
/* @__PURE__ */ jsxs("div", { className: "text_field_wrap", children: [
|
|
948
|
-
leftIcon ? /* @__PURE__ */ jsx("span", { className: "text_field_icon text_field_icon_left", "aria-hidden": "true", children: leftIcon }) : null,
|
|
949
|
-
/* @__PURE__ */ jsx(
|
|
950
|
-
"input",
|
|
951
|
-
{
|
|
952
|
-
id: inputId,
|
|
953
|
-
ref,
|
|
954
|
-
className: inputClassName,
|
|
955
|
-
"aria-invalid": !!error,
|
|
956
|
-
"aria-describedby": helperId,
|
|
957
|
-
...props,
|
|
958
|
-
value: innerValue,
|
|
959
|
-
onCompositionStart: () => {
|
|
960
|
-
isComposingRef.current = true;
|
|
961
|
-
},
|
|
962
|
-
onCompositionEnd: (event) => {
|
|
963
|
-
isComposingRef.current = false;
|
|
964
|
-
const rawValue = event.currentTarget.value;
|
|
965
|
-
const nextValue = applyTransform(rawValue);
|
|
966
|
-
setInnerValue(nextValue);
|
|
967
|
-
onChangeAction?.(nextValue);
|
|
968
|
-
},
|
|
969
|
-
onChange: (event) => {
|
|
970
|
-
const rawValue = event.target.value;
|
|
971
|
-
if (isComposingRef.current) {
|
|
972
|
-
setInnerValue(rawValue);
|
|
973
|
-
return;
|
|
974
|
-
}
|
|
975
|
-
const nextValue = applyTransform(rawValue);
|
|
976
|
-
setInnerValue(nextValue);
|
|
977
|
-
onChangeAction?.(nextValue);
|
|
978
|
-
}
|
|
979
|
-
}
|
|
980
|
-
),
|
|
981
|
-
rightIcon ? /* @__PURE__ */ jsx("span", { className: "text_field_icon text_field_icon_right", "aria-hidden": "true", children: rightIcon }) : null
|
|
982
|
-
] }),
|
|
983
|
-
helperText ? /* @__PURE__ */ jsx("div", { id: helperId, className: helperClassName, children: helperText }) : null
|
|
984
|
-
] });
|
|
985
|
-
}
|
|
986
|
-
);
|
|
987
|
-
TextField.displayName = "TextField";
|
|
988
|
-
var pad = (n) => String(n).padStart(2, "0");
|
|
989
|
-
var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
|
|
990
|
-
var normalizeWidth = (v) => typeof v === "number" ? `${v}px` : v;
|
|
991
|
-
var DatePicker = ({
|
|
992
|
-
label,
|
|
993
|
-
value,
|
|
994
|
-
onChange,
|
|
995
|
-
mode = "year-month-day",
|
|
996
|
-
startYear = 1950,
|
|
997
|
-
endYear = (/* @__PURE__ */ new Date()).getFullYear() + 10,
|
|
998
|
-
minDate,
|
|
999
|
-
selectableRange = "all",
|
|
1000
|
-
disabled,
|
|
1001
|
-
fullWidth = true,
|
|
1002
|
-
width,
|
|
1003
|
-
yearLabel = "Year",
|
|
1004
|
-
monthLabel = "Month",
|
|
1005
|
-
dayLabel = "Day",
|
|
1006
|
-
minDateSrFormat = "Minimum date: {date}",
|
|
1007
|
-
selectableRangeUntilTodaySrText = "Selectable up to today"
|
|
1008
|
-
}) => {
|
|
1009
|
-
const groupId = React7.useId();
|
|
1010
|
-
const constraintId = React7.useId();
|
|
1011
|
-
const today = /* @__PURE__ */ new Date();
|
|
1012
|
-
const todayYear = today.getFullYear();
|
|
1013
|
-
const todayMonth = today.getMonth() + 1;
|
|
1014
|
-
const todayDay = today.getDate();
|
|
1015
|
-
const [y, m, d] = value?.split("-").map(Number) ?? [];
|
|
1016
|
-
const [minY, minM, minD] = minDate?.split("-").map(Number) ?? [];
|
|
1017
|
-
const year = y ?? "";
|
|
1018
|
-
const month = m ?? "";
|
|
1019
|
-
const day = d ?? "";
|
|
1020
|
-
const maxYear = selectableRange === "until-today" ? todayYear : endYear;
|
|
1021
|
-
const minMonth = minY && year === minY ? minM : 1;
|
|
1022
|
-
const maxMonth = selectableRange === "until-today" && year === todayYear ? todayMonth : 12;
|
|
1023
|
-
const minDay = minY && minM && year === minY && month === minM ? minD : 1;
|
|
1024
|
-
const maxDay = selectableRange === "until-today" && year === todayYear && month === todayMonth ? todayDay : getDaysInMonth(year || todayYear, month || 1);
|
|
1025
|
-
const days = year && month ? Math.min(getDaysInMonth(year, month), maxDay) : 31;
|
|
1026
|
-
const clampDay = (year2, month2, day2) => Math.min(day2, getDaysInMonth(year2, month2));
|
|
1027
|
-
const emit = (yy, mm, dd) => {
|
|
1028
|
-
if (mode === "year-month") {
|
|
1029
|
-
onChange(`${yy}-${pad(mm)}`);
|
|
1030
|
-
return;
|
|
1307
|
+
}) })
|
|
1308
|
+
]
|
|
1031
1309
|
}
|
|
1032
|
-
|
|
1033
|
-
onChange(`${yy}-${pad(mm)}-${pad(safeDay)}`);
|
|
1034
|
-
};
|
|
1035
|
-
const containerStyle = width ? { width: normalizeWidth(width) } : void 0;
|
|
1036
|
-
const rootClassName = cn("date_picker", { date_picker_full_width: fullWidth && !width });
|
|
1037
|
-
const constraintParts = [];
|
|
1038
|
-
if (minDate) constraintParts.push(minDateSrFormat.replace("{date}", minDate));
|
|
1039
|
-
if (selectableRange === "until-today") constraintParts.push(selectableRangeUntilTodaySrText);
|
|
1040
|
-
const constraintDesc = constraintParts.join(". ");
|
|
1041
|
-
return /* @__PURE__ */ jsxs("div", { className: rootClassName, style: containerStyle, children: [
|
|
1042
|
-
label && /* @__PURE__ */ jsx("label", { className: "date_picker_label", id: groupId, children: label }),
|
|
1043
|
-
constraintDesc && /* @__PURE__ */ jsx("span", { id: constraintId, className: "date_picker_sr_only", children: constraintDesc }),
|
|
1044
|
-
/* @__PURE__ */ jsxs(
|
|
1045
|
-
"div",
|
|
1046
|
-
{
|
|
1047
|
-
className: "date_picker_fields",
|
|
1048
|
-
role: "group",
|
|
1049
|
-
"aria-labelledby": label ? groupId : void 0,
|
|
1050
|
-
"aria-describedby": constraintDesc ? constraintId : void 0,
|
|
1051
|
-
children: [
|
|
1052
|
-
/* @__PURE__ */ jsxs(
|
|
1053
|
-
"select",
|
|
1054
|
-
{
|
|
1055
|
-
"aria-label": yearLabel,
|
|
1056
|
-
value: year,
|
|
1057
|
-
disabled,
|
|
1058
|
-
onChange: (e) => emit(Number(e.target.value), month || minMonth, day || minDay),
|
|
1059
|
-
children: [
|
|
1060
|
-
/* @__PURE__ */ jsx("option", { value: "", children: yearLabel }),
|
|
1061
|
-
Array.from(
|
|
1062
|
-
{ length: maxYear - startYear + 1 },
|
|
1063
|
-
(_, i) => startYear + i
|
|
1064
|
-
).map((y2) => /* @__PURE__ */ jsx("option", { value: y2, children: y2 }, y2))
|
|
1065
|
-
]
|
|
1066
|
-
}
|
|
1067
|
-
),
|
|
1068
|
-
/* @__PURE__ */ jsxs(
|
|
1069
|
-
"select",
|
|
1070
|
-
{
|
|
1071
|
-
"aria-label": monthLabel,
|
|
1072
|
-
value: month,
|
|
1073
|
-
disabled: disabled || !year,
|
|
1074
|
-
onChange: (e) => emit(year, Number(e.target.value), day || minDay),
|
|
1075
|
-
children: [
|
|
1076
|
-
/* @__PURE__ */ jsx("option", { value: "", children: monthLabel }),
|
|
1077
|
-
Array.from({ length: maxMonth - minMonth + 1 }, (_, i) => minMonth + i).map(
|
|
1078
|
-
(m2) => /* @__PURE__ */ jsx("option", { value: m2, children: pad(m2) }, m2)
|
|
1079
|
-
)
|
|
1080
|
-
]
|
|
1081
|
-
}
|
|
1082
|
-
),
|
|
1083
|
-
mode === "year-month-day" && /* @__PURE__ */ jsxs(
|
|
1084
|
-
"select",
|
|
1085
|
-
{
|
|
1086
|
-
"aria-label": dayLabel,
|
|
1087
|
-
value: day,
|
|
1088
|
-
disabled: disabled || !month,
|
|
1089
|
-
onChange: (e) => emit(year, month, Number(e.target.value)),
|
|
1090
|
-
children: [
|
|
1091
|
-
/* @__PURE__ */ jsx("option", { value: "", children: dayLabel }),
|
|
1092
|
-
Array.from(
|
|
1093
|
-
{ length: days - minDay + 1 },
|
|
1094
|
-
(_, i) => minDay + i
|
|
1095
|
-
).map((d2) => /* @__PURE__ */ jsx("option", { value: d2, children: pad(d2) }, d2))
|
|
1096
|
-
]
|
|
1097
|
-
}
|
|
1098
|
-
)
|
|
1099
|
-
]
|
|
1100
|
-
}
|
|
1101
|
-
)
|
|
1102
|
-
] });
|
|
1310
|
+
);
|
|
1103
1311
|
};
|
|
1104
1312
|
var range = (start, end) => {
|
|
1105
1313
|
const out = [];
|
|
@@ -1130,13 +1338,16 @@ var getPaginationItems = (page, totalPages) => {
|
|
|
1130
1338
|
items.push(last);
|
|
1131
1339
|
return items;
|
|
1132
1340
|
};
|
|
1133
|
-
var Pagination = ({
|
|
1341
|
+
var Pagination = ({
|
|
1342
|
+
page,
|
|
1343
|
+
totalPages,
|
|
1344
|
+
onChange,
|
|
1345
|
+
prevLabel = "Previous page",
|
|
1346
|
+
nextLabel = "Next page"
|
|
1347
|
+
}) => {
|
|
1134
1348
|
const prevDisabled = page <= 1;
|
|
1135
1349
|
const nextDisabled = page >= totalPages;
|
|
1136
|
-
const items =
|
|
1137
|
-
() => getPaginationItems(page, totalPages),
|
|
1138
|
-
[page, totalPages]
|
|
1139
|
-
);
|
|
1350
|
+
const items = React9.useMemo(() => getPaginationItems(page, totalPages), [page, totalPages]);
|
|
1140
1351
|
return /* @__PURE__ */ jsxs("nav", { className: "pagination", "aria-label": "Pagination", children: [
|
|
1141
1352
|
/* @__PURE__ */ jsx(
|
|
1142
1353
|
"button",
|
|
@@ -1149,16 +1360,13 @@ var Pagination = ({ page, totalPages, onChange, prevLabel = "Previous page", nex
|
|
|
1149
1360
|
children: "\u2039"
|
|
1150
1361
|
}
|
|
1151
1362
|
),
|
|
1152
|
-
/* @__PURE__ */ jsx("
|
|
1363
|
+
/* @__PURE__ */ jsx("ul", { className: "pagination_pages", children: items.map((it, idx) => {
|
|
1153
1364
|
if (it === "ellipsis") {
|
|
1154
|
-
return /* @__PURE__ */ jsx("
|
|
1365
|
+
return /* @__PURE__ */ jsx("li", { className: "pagination_ellipsis", "aria-hidden": "true", children: "\u2026" }, `e-${idx}`);
|
|
1155
1366
|
}
|
|
1156
1367
|
const isActive = it === page;
|
|
1157
|
-
const buttonClassName = cn(
|
|
1158
|
-
|
|
1159
|
-
{ pagination_active: isActive }
|
|
1160
|
-
);
|
|
1161
|
-
return /* @__PURE__ */ jsx("span", { role: "listitem", children: /* @__PURE__ */ jsx(
|
|
1368
|
+
const buttonClassName = cn("pagination_page_button", { pagination_active: isActive });
|
|
1369
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
1162
1370
|
"button",
|
|
1163
1371
|
{
|
|
1164
1372
|
type: "button",
|
|
@@ -1193,18 +1401,18 @@ var Modal = ({
|
|
|
1193
1401
|
ariaLabel,
|
|
1194
1402
|
...props
|
|
1195
1403
|
}) => {
|
|
1196
|
-
const panelRef =
|
|
1197
|
-
const titleId =
|
|
1404
|
+
const panelRef = React9.useRef(null);
|
|
1405
|
+
const titleId = React9.useId();
|
|
1198
1406
|
useFocusTrap(panelRef, open);
|
|
1199
|
-
const handleEscape =
|
|
1407
|
+
const handleEscape = React9.useEffectEvent((e) => {
|
|
1200
1408
|
if (e.key === "Escape") onClose?.();
|
|
1201
1409
|
});
|
|
1202
|
-
|
|
1410
|
+
React9.useEffect(() => {
|
|
1203
1411
|
if (!open) return;
|
|
1204
1412
|
document.addEventListener("keydown", handleEscape);
|
|
1205
1413
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
1206
1414
|
}, [open]);
|
|
1207
|
-
|
|
1415
|
+
React9.useEffect(() => {
|
|
1208
1416
|
if (!open) return;
|
|
1209
1417
|
const body = document.body;
|
|
1210
1418
|
const openModals = parseInt(body.dataset.openModals || "0", 10);
|
|
@@ -1237,13 +1445,20 @@ var Modal = ({
|
|
|
1237
1445
|
"aria-labelledby": hasTitle && !ariaLabel ? titleId : void 0,
|
|
1238
1446
|
"aria-label": !hasTitle ? ariaLabel ?? "Dialog" : ariaLabel,
|
|
1239
1447
|
onClick: () => closeOnOverlay && onClose?.(),
|
|
1448
|
+
onKeyDown: (e) => {
|
|
1449
|
+
if (e.key === "Escape") onClose?.();
|
|
1450
|
+
},
|
|
1240
1451
|
children: /* @__PURE__ */ jsxs(
|
|
1241
1452
|
"div",
|
|
1242
1453
|
{
|
|
1243
1454
|
ref: panelRef,
|
|
1244
1455
|
className: panelClassName,
|
|
1245
1456
|
style: { width },
|
|
1457
|
+
role: "document",
|
|
1246
1458
|
onClick: (e) => e.stopPropagation(),
|
|
1459
|
+
onKeyDown: (e) => {
|
|
1460
|
+
if (e.key !== "Escape") e.stopPropagation();
|
|
1461
|
+
},
|
|
1247
1462
|
...props,
|
|
1248
1463
|
children: [
|
|
1249
1464
|
title && /* @__PURE__ */ jsx("div", { id: titleId, className: "modal_header", children: title }),
|
|
@@ -1255,4 +1470,4 @@ var Modal = ({
|
|
|
1255
1470
|
);
|
|
1256
1471
|
};
|
|
1257
1472
|
|
|
1258
|
-
export { AlertProvider, Button, Card, Checkbox, DatePicker, FileInput, Modal, Pagination, Radio, Select, Spinner, Switch, TextField, ToastProvider, TopLoading, a11y, breakpoints, colors, motion, radius, shadows, skeleton, spacing, typography, useAlert, useToast, zIndex };
|
|
1473
|
+
export { AlertProvider, Button, Card, Checkbox, DatePicker, FileInput, Modal, Pagination, Radio, Select, Spinner, Switch, TextField, ToastProvider, TopLoading, a11y, baseBorderWidth, baseColors, baseTypography, borderWidth, breakpoints, colors, motion, opacity, radius, shadows, skeleton, spacing, typography, useAlert, useToast, zIndex };
|