@bigtablet/design-system 1.22.2 → 1.24.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/index.css +345 -285
- package/dist/index.d.ts +374 -88
- package/dist/index.js +416 -308
- package/dist/next.css +28 -28
- 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 +12 -12
- package/package.json +12 -11
package/dist/index.js
CHANGED
|
@@ -1,102 +1,186 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import './index.css';
|
|
3
|
-
import * as
|
|
3
|
+
import * as React6 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
9
|
// src/styles/ts/colors.ts
|
|
10
|
+
var baseColors = {
|
|
11
|
+
brandPrimary: "#121212",
|
|
12
|
+
blue600: "#1A73E8",
|
|
13
|
+
neutral0: "#FFFFFF",
|
|
14
|
+
neutral50: "#F4F4F4",
|
|
15
|
+
neutral200: "#E5E5E5",
|
|
16
|
+
neutral300: "#999999",
|
|
17
|
+
neutral400: "#B3B3B3",
|
|
18
|
+
neutral500: "#888888",
|
|
19
|
+
neutral700: "#666666",
|
|
20
|
+
neutral900: "#121212",
|
|
21
|
+
statusError: "#EF4444",
|
|
22
|
+
statusSuccess: "#10B981",
|
|
23
|
+
statusWarning: "#F59E0B",
|
|
24
|
+
statusInfo: "#3B82F6",
|
|
25
|
+
alphaBlack5: "rgba(0, 0, 0, 0.05)",
|
|
26
|
+
alphaBlack8: "rgba(0, 0, 0, 0.08)",
|
|
27
|
+
alphaBlack12: "rgba(26, 26, 26, 0.12)",
|
|
28
|
+
alphaBlack38: "rgba(26, 26, 26, 0.38)",
|
|
29
|
+
alphaBlack50: "rgba(0, 0, 0, 0.50)",
|
|
30
|
+
alphaWhite5: "rgba(255, 255, 255, 0.05)",
|
|
31
|
+
alphaWhite8: "rgba(255, 255, 255, 0.08)",
|
|
32
|
+
alphaWhite12: "rgba(255, 255, 255, 0.12)"
|
|
33
|
+
};
|
|
10
34
|
var colors = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
brand: {
|
|
36
|
+
primary: baseColors.brandPrimary,
|
|
37
|
+
onPrimary: baseColors.neutral0
|
|
38
|
+
},
|
|
39
|
+
text: {
|
|
40
|
+
heading: baseColors.neutral900,
|
|
41
|
+
body: baseColors.neutral700,
|
|
42
|
+
caption: baseColors.neutral500,
|
|
43
|
+
brand: baseColors.brandPrimary,
|
|
44
|
+
inverse: baseColors.neutral0,
|
|
45
|
+
disabled: baseColors.alphaBlack38
|
|
46
|
+
},
|
|
47
|
+
bg: {
|
|
48
|
+
solid: baseColors.neutral0,
|
|
49
|
+
solidDim: baseColors.neutral50,
|
|
50
|
+
additive: baseColors.alphaBlack5,
|
|
51
|
+
disabled: baseColors.alphaBlack12,
|
|
52
|
+
overlay: baseColors.alphaBlack50
|
|
53
|
+
},
|
|
54
|
+
state: {
|
|
55
|
+
hoverOnLight: baseColors.alphaBlack5,
|
|
56
|
+
pressedOnLight: baseColors.alphaBlack12,
|
|
57
|
+
hoverOnDark: baseColors.alphaWhite5,
|
|
58
|
+
pressedOnDark: baseColors.alphaWhite12
|
|
59
|
+
},
|
|
60
|
+
border: {
|
|
61
|
+
default: baseColors.neutral200,
|
|
62
|
+
hover: baseColors.neutral400,
|
|
63
|
+
subtle: baseColors.alphaBlack8,
|
|
64
|
+
focus: baseColors.neutral900,
|
|
65
|
+
disabled: "#F2F2F2"
|
|
66
|
+
},
|
|
67
|
+
status: {
|
|
68
|
+
error: baseColors.statusError,
|
|
69
|
+
success: baseColors.statusSuccess,
|
|
70
|
+
warning: baseColors.statusWarning,
|
|
71
|
+
info: baseColors.statusInfo
|
|
72
|
+
}
|
|
34
73
|
};
|
|
35
74
|
|
|
36
75
|
// src/styles/ts/spacing.ts
|
|
37
76
|
var spacing = {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"4xl": "2.5rem",
|
|
53
|
-
// 40px
|
|
54
|
-
"5xl": "3rem"
|
|
55
|
-
// 48px
|
|
77
|
+
"0": "0px",
|
|
78
|
+
"1": "1px",
|
|
79
|
+
"2": "2px",
|
|
80
|
+
"3": "3px",
|
|
81
|
+
"4": "4px",
|
|
82
|
+
"6": "6px",
|
|
83
|
+
"8": "8px",
|
|
84
|
+
"12": "12px",
|
|
85
|
+
"16": "16px",
|
|
86
|
+
"20": "20px",
|
|
87
|
+
"24": "24px",
|
|
88
|
+
"32": "32px",
|
|
89
|
+
"40": "40px",
|
|
90
|
+
"48": "48px"
|
|
56
91
|
};
|
|
57
92
|
|
|
58
93
|
// src/styles/ts/typography.ts
|
|
59
|
-
var
|
|
94
|
+
var baseTypography = {
|
|
60
95
|
fontFamily: {
|
|
61
|
-
primary: "
|
|
96
|
+
primary: "Pretendard"
|
|
62
97
|
},
|
|
63
98
|
fontSize: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
99
|
+
"12": "12px",
|
|
100
|
+
"13": "13px",
|
|
101
|
+
"14": "14px",
|
|
102
|
+
"15": "15px",
|
|
103
|
+
"16": "16px",
|
|
104
|
+
"18": "18px",
|
|
105
|
+
"20": "20px",
|
|
106
|
+
"24": "24px",
|
|
107
|
+
"28": "28px",
|
|
108
|
+
"32": "32px",
|
|
109
|
+
"40": "40px",
|
|
110
|
+
"48": "48px"
|
|
73
111
|
},
|
|
74
112
|
fontWeight: {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
light: 300,
|
|
78
|
-
regular: 400,
|
|
79
|
-
medium: 500,
|
|
80
|
-
semibold: 600,
|
|
81
|
-
bold: 700,
|
|
82
|
-
extrabold: 800,
|
|
83
|
-
black: 900
|
|
113
|
+
regular: "Regular",
|
|
114
|
+
medium: "Medium"
|
|
84
115
|
},
|
|
85
116
|
lineHeight: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
117
|
+
"16": "16px",
|
|
118
|
+
"18": "18px",
|
|
119
|
+
"20": "20px",
|
|
120
|
+
"22-5": "22.5px",
|
|
121
|
+
"24": "24px",
|
|
122
|
+
"28": "28px",
|
|
123
|
+
"32": "32px",
|
|
124
|
+
"36": "36px",
|
|
125
|
+
"40": "40px",
|
|
126
|
+
"50": "50px",
|
|
127
|
+
"60": "60px"
|
|
90
128
|
},
|
|
91
129
|
letterSpacing: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
130
|
+
normal: "0px"
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var { fontSize: fs, fontWeight: fw, lineHeight: lh, letterSpacing: ls } = baseTypography;
|
|
134
|
+
var typography = {
|
|
135
|
+
fontFamily: {
|
|
136
|
+
primary: `'${baseTypography.fontFamily.primary}', sans-serif`
|
|
137
|
+
},
|
|
138
|
+
display: {
|
|
139
|
+
large: { fontSize: fs["48"], fontWeight: fw.regular, lineHeight: lh["60"], letterSpacing: ls.normal },
|
|
140
|
+
largeMedium: { fontSize: fs["48"], fontWeight: fw.medium, lineHeight: lh["60"], letterSpacing: ls.normal },
|
|
141
|
+
medium: { fontSize: fs["40"], fontWeight: fw.regular, lineHeight: lh["50"], letterSpacing: ls.normal },
|
|
142
|
+
mediumMedium: { fontSize: fs["40"], fontWeight: fw.medium, lineHeight: lh["50"], letterSpacing: ls.normal },
|
|
143
|
+
small: { fontSize: fs["32"], fontWeight: fw.regular, lineHeight: lh["40"], letterSpacing: ls.normal },
|
|
144
|
+
smallMedium: { fontSize: fs["32"], fontWeight: fw.medium, lineHeight: lh["40"], letterSpacing: ls.normal }
|
|
145
|
+
},
|
|
146
|
+
heading: {
|
|
147
|
+
large: { fontSize: fs["28"], fontWeight: fw.regular, lineHeight: lh["36"], letterSpacing: ls.normal },
|
|
148
|
+
largeMedium: { fontSize: fs["28"], fontWeight: fw.medium, lineHeight: lh["36"], letterSpacing: ls.normal },
|
|
149
|
+
medium: { fontSize: fs["24"], fontWeight: fw.regular, lineHeight: lh["32"], letterSpacing: ls.normal },
|
|
150
|
+
mediumMedium: { fontSize: fs["24"], fontWeight: fw.medium, lineHeight: lh["32"], letterSpacing: ls.normal },
|
|
151
|
+
small: { fontSize: fs["20"], fontWeight: fw.regular, lineHeight: lh["28"], letterSpacing: ls.normal },
|
|
152
|
+
smallMedium: { fontSize: fs["20"], fontWeight: fw.medium, lineHeight: lh["28"], letterSpacing: ls.normal }
|
|
153
|
+
},
|
|
154
|
+
title: {
|
|
155
|
+
large: { fontSize: fs["18"], fontWeight: fw.regular, lineHeight: lh["24"], letterSpacing: ls.normal },
|
|
156
|
+
largeMedium: { fontSize: fs["18"], fontWeight: fw.medium, lineHeight: lh["24"], letterSpacing: ls.normal },
|
|
157
|
+
medium: { fontSize: fs["16"], fontWeight: fw.regular, lineHeight: lh["24"], letterSpacing: ls.normal },
|
|
158
|
+
mediumMedium: { fontSize: fs["16"], fontWeight: fw.medium, lineHeight: lh["24"], letterSpacing: ls.normal },
|
|
159
|
+
small: { fontSize: fs["14"], fontWeight: fw.regular, lineHeight: lh["20"], letterSpacing: ls.normal },
|
|
160
|
+
smallMedium: { fontSize: fs["14"], fontWeight: fw.medium, lineHeight: lh["20"], letterSpacing: ls.normal }
|
|
161
|
+
},
|
|
162
|
+
body: {
|
|
163
|
+
large: { fontSize: fs["16"], fontWeight: fw.regular, lineHeight: lh["24"], letterSpacing: ls.normal },
|
|
164
|
+
largeMedium: { fontSize: fs["16"], fontWeight: fw.medium, lineHeight: lh["24"], letterSpacing: ls.normal },
|
|
165
|
+
medium: { fontSize: fs["15"], fontWeight: fw.regular, lineHeight: lh["22-5"], letterSpacing: ls.normal },
|
|
166
|
+
mediumMedium: { fontSize: fs["15"], fontWeight: fw.medium, lineHeight: lh["22-5"], letterSpacing: ls.normal },
|
|
167
|
+
small: { fontSize: fs["14"], fontWeight: fw.regular, lineHeight: lh["20"], letterSpacing: ls.normal },
|
|
168
|
+
smallMedium: { fontSize: fs["14"], fontWeight: fw.medium, lineHeight: lh["20"], letterSpacing: ls.normal }
|
|
169
|
+
},
|
|
170
|
+
label: {
|
|
171
|
+
large: { fontSize: fs["14"], fontWeight: fw.regular, lineHeight: lh["20"], letterSpacing: ls.normal },
|
|
172
|
+
largeMedium: { fontSize: fs["14"], fontWeight: fw.medium, lineHeight: lh["20"], letterSpacing: ls.normal },
|
|
173
|
+
medium: { fontSize: fs["13"], fontWeight: fw.regular, lineHeight: lh["18"], letterSpacing: ls.normal },
|
|
174
|
+
mediumMedium: { fontSize: fs["13"], fontWeight: fw.medium, lineHeight: lh["18"], letterSpacing: ls.normal },
|
|
175
|
+
small: { fontSize: fs["12"], fontWeight: fw.regular, lineHeight: lh["16"], letterSpacing: ls.normal },
|
|
176
|
+
smallMedium: { fontSize: fs["12"], fontWeight: fw.medium, lineHeight: lh["16"], letterSpacing: ls.normal }
|
|
95
177
|
}
|
|
96
178
|
};
|
|
97
179
|
|
|
98
180
|
// src/styles/ts/radius.ts
|
|
99
181
|
var radius = {
|
|
182
|
+
none: "0px",
|
|
183
|
+
xs: "4px",
|
|
100
184
|
sm: "6px",
|
|
101
185
|
md: "8px",
|
|
102
186
|
lg: "12px",
|
|
@@ -106,10 +190,37 @@ var radius = {
|
|
|
106
190
|
|
|
107
191
|
// src/styles/ts/shadows.ts
|
|
108
192
|
var shadows = {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
193
|
+
level1: "0 1px 1px -1px rgba(0, 0, 0, 0.20), 0 3px 3px 0px rgba(0, 0, 0, 0.12)",
|
|
194
|
+
level2: "0 2px 2px -2px rgba(0, 0, 0, 0.20), 0 6px 6px 0px rgba(0, 0, 0, 0.12)",
|
|
195
|
+
level3: "0 3px 3px -3px rgba(0, 0, 0, 0.20), 0 9px 9px 0px rgba(0, 0, 0, 0.12)",
|
|
196
|
+
level4: "0 5px 5px -5px rgba(0, 0, 0, 0.20), 0 15px 15px 0px rgba(0, 0, 0, 0.12)",
|
|
197
|
+
level5: "0 8px 10px -5px rgba(0, 0, 0, 0.20), 0 20px 20px 0px rgba(0, 0, 0, 0.12)"
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// src/styles/ts/border-width.ts
|
|
201
|
+
var baseBorderWidth = {
|
|
202
|
+
"0": "0px",
|
|
203
|
+
"1": "1px",
|
|
204
|
+
"2": "2px"
|
|
205
|
+
};
|
|
206
|
+
var borderWidth = {
|
|
207
|
+
none: baseBorderWidth["0"],
|
|
208
|
+
standard: baseBorderWidth["1"],
|
|
209
|
+
indicator: baseBorderWidth["2"]
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
// src/styles/ts/opacity.ts
|
|
213
|
+
var opacity = {
|
|
214
|
+
"0": 0,
|
|
215
|
+
"5": 0.05,
|
|
216
|
+
"8": 0.08,
|
|
217
|
+
"12": 0.12,
|
|
218
|
+
"16": 0.16,
|
|
219
|
+
"38": 0.38,
|
|
220
|
+
"50": 0.5,
|
|
221
|
+
"80": 0.8,
|
|
222
|
+
"90": 0.9,
|
|
223
|
+
"100": 1
|
|
113
224
|
};
|
|
114
225
|
|
|
115
226
|
// src/styles/ts/motion.ts
|
|
@@ -130,22 +241,22 @@ var motion = {
|
|
|
130
241
|
// src/styles/ts/skeleton.ts
|
|
131
242
|
var skeleton = {
|
|
132
243
|
color: {
|
|
133
|
-
base:
|
|
134
|
-
wave:
|
|
135
|
-
highlight:
|
|
244
|
+
base: baseColors.neutral50,
|
|
245
|
+
wave: baseColors.neutral200,
|
|
246
|
+
highlight: baseColors.neutral0
|
|
136
247
|
},
|
|
137
|
-
gradient: `linear-gradient(90deg, ${
|
|
248
|
+
gradient: `linear-gradient(90deg, ${baseColors.neutral50} 25%, ${baseColors.neutral0} 37%, ${baseColors.neutral200} 63%)`,
|
|
138
249
|
radius: {
|
|
139
250
|
sm: radius.sm,
|
|
140
251
|
md: radius.md,
|
|
141
252
|
lg: radius.lg
|
|
142
253
|
},
|
|
143
254
|
height: {
|
|
144
|
-
xs: spacing
|
|
145
|
-
sm: spacing
|
|
146
|
-
md: spacing
|
|
147
|
-
lg: spacing
|
|
148
|
-
xl: spacing
|
|
255
|
+
xs: spacing["4"],
|
|
256
|
+
sm: spacing["8"],
|
|
257
|
+
md: spacing["12"],
|
|
258
|
+
lg: spacing["16"],
|
|
259
|
+
xl: spacing["20"]
|
|
149
260
|
},
|
|
150
261
|
animation: {
|
|
151
262
|
duration: "1.4s",
|
|
@@ -155,21 +266,24 @@ var skeleton = {
|
|
|
155
266
|
|
|
156
267
|
// src/styles/ts/breakpoints.ts
|
|
157
268
|
var breakpoints = {
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
//
|
|
162
|
-
|
|
163
|
-
//
|
|
164
|
-
|
|
165
|
-
//
|
|
269
|
+
compact: 0,
|
|
270
|
+
// mobile
|
|
271
|
+
medium: 600,
|
|
272
|
+
// tablet
|
|
273
|
+
expanded: 840,
|
|
274
|
+
// small desktop
|
|
275
|
+
large: 1200
|
|
276
|
+
// desktop
|
|
166
277
|
};
|
|
167
278
|
|
|
168
279
|
// src/styles/ts/z-index.ts
|
|
169
280
|
var zIndex = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
281
|
+
level0: 0,
|
|
282
|
+
level1: 10,
|
|
283
|
+
level2: 100,
|
|
284
|
+
level3: 200,
|
|
285
|
+
level4: 500,
|
|
286
|
+
level5: 1e3
|
|
173
287
|
};
|
|
174
288
|
|
|
175
289
|
// src/styles/ts/a11y.ts
|
|
@@ -211,8 +325,8 @@ var FOCUSABLE_SELECTORS = [
|
|
|
211
325
|
'[tabindex]:not([tabindex="-1"])'
|
|
212
326
|
].join(", ");
|
|
213
327
|
function useFocusTrap(containerRef, isActive) {
|
|
214
|
-
const previousActiveElement =
|
|
215
|
-
|
|
328
|
+
const previousActiveElement = React6.useRef(null);
|
|
329
|
+
React6.useEffect(() => {
|
|
216
330
|
if (!isActive) return;
|
|
217
331
|
const container = containerRef.current;
|
|
218
332
|
if (!container) return;
|
|
@@ -343,7 +457,7 @@ var AlertModal = ({
|
|
|
343
457
|
onCancel,
|
|
344
458
|
onClose
|
|
345
459
|
}) => {
|
|
346
|
-
const panelRef =
|
|
460
|
+
const panelRef = React6.useRef(null);
|
|
347
461
|
useFocusTrap(panelRef, true);
|
|
348
462
|
const modalClassName = [
|
|
349
463
|
"alert_modal",
|
|
@@ -444,7 +558,7 @@ var TopLoading = ({
|
|
|
444
558
|
}
|
|
445
559
|
);
|
|
446
560
|
};
|
|
447
|
-
var ToastContext =
|
|
561
|
+
var ToastContext = React6.createContext(null);
|
|
448
562
|
var VARIANT_ICONS = {
|
|
449
563
|
success: /* @__PURE__ */ jsx(CheckCircle2, { size: 18 }),
|
|
450
564
|
error: /* @__PURE__ */ jsx(XCircle, { size: 18 }),
|
|
@@ -453,9 +567,9 @@ var VARIANT_ICONS = {
|
|
|
453
567
|
default: /* @__PURE__ */ jsx(Bell, { size: 18 })
|
|
454
568
|
};
|
|
455
569
|
var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
456
|
-
const [exiting, setExiting] =
|
|
457
|
-
const closingRef =
|
|
458
|
-
const close =
|
|
570
|
+
const [exiting, setExiting] = React6.useState(false);
|
|
571
|
+
const closingRef = React6.useRef(false);
|
|
572
|
+
const close = React6.useCallback(() => {
|
|
459
573
|
if (closingRef.current) return;
|
|
460
574
|
closingRef.current = true;
|
|
461
575
|
setExiting(true);
|
|
@@ -497,19 +611,19 @@ var ToastItemComponent = ({ item, onRemove, closeAriaLabel }) => {
|
|
|
497
611
|
);
|
|
498
612
|
};
|
|
499
613
|
var ToastProvider = ({ children, maxCount = 5, closeAriaLabel = "Close" }) => {
|
|
500
|
-
const [toasts, setToasts] =
|
|
501
|
-
const [isMounted, setIsMounted] =
|
|
502
|
-
|
|
614
|
+
const [toasts, setToasts] = React6.useState([]);
|
|
615
|
+
const [isMounted, setIsMounted] = React6.useState(false);
|
|
616
|
+
React6.useEffect(() => {
|
|
503
617
|
setIsMounted(true);
|
|
504
618
|
}, []);
|
|
505
|
-
const addToast =
|
|
619
|
+
const addToast = React6.useCallback(
|
|
506
620
|
(message, variant, duration = 3e3) => {
|
|
507
621
|
const id = crypto.randomUUID();
|
|
508
622
|
setToasts((prev) => [{ id, message, variant, duration }, ...prev].slice(0, maxCount));
|
|
509
623
|
},
|
|
510
624
|
[maxCount]
|
|
511
625
|
);
|
|
512
|
-
const removeToast =
|
|
626
|
+
const removeToast = React6.useCallback((id) => {
|
|
513
627
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
514
628
|
}, []);
|
|
515
629
|
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { addToast }, children: [
|
|
@@ -574,34 +688,32 @@ var Button = ({
|
|
|
574
688
|
const buttonStyle = width ? { ...style, width } : style;
|
|
575
689
|
return /* @__PURE__ */ jsx("button", { className: buttonClassName, style: buttonStyle, ...props });
|
|
576
690
|
};
|
|
577
|
-
var Checkbox =
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
604
|
-
);
|
|
691
|
+
var Checkbox = ({ label, size = "md", indeterminate, className, ref, ...props }) => {
|
|
692
|
+
const inputRef = React6.useRef(null);
|
|
693
|
+
React6.useImperativeHandle(ref, () => inputRef.current);
|
|
694
|
+
React6.useEffect(() => {
|
|
695
|
+
if (!inputRef.current) return;
|
|
696
|
+
inputRef.current.indeterminate = Boolean(indeterminate);
|
|
697
|
+
}, [indeterminate]);
|
|
698
|
+
const rootClassName = cn(
|
|
699
|
+
"checkbox",
|
|
700
|
+
`checkbox_size_${size}`,
|
|
701
|
+
className
|
|
702
|
+
);
|
|
703
|
+
return /* @__PURE__ */ jsxs("label", { className: rootClassName, children: [
|
|
704
|
+
/* @__PURE__ */ jsx(
|
|
705
|
+
"input",
|
|
706
|
+
{
|
|
707
|
+
ref: inputRef,
|
|
708
|
+
type: "checkbox",
|
|
709
|
+
className: "checkbox_input",
|
|
710
|
+
...props
|
|
711
|
+
}
|
|
712
|
+
),
|
|
713
|
+
/* @__PURE__ */ jsx("span", { className: "checkbox_box", "aria-hidden": "true" }),
|
|
714
|
+
label ? /* @__PURE__ */ jsx("span", { className: "checkbox_label", children: label }) : null
|
|
715
|
+
] });
|
|
716
|
+
};
|
|
605
717
|
Checkbox.displayName = "Checkbox";
|
|
606
718
|
var FileInput = ({
|
|
607
719
|
label = "Choose file",
|
|
@@ -611,8 +723,8 @@ var FileInput = ({
|
|
|
611
723
|
disabled,
|
|
612
724
|
...props
|
|
613
725
|
}) => {
|
|
614
|
-
const inputId =
|
|
615
|
-
const helperId =
|
|
726
|
+
const inputId = React6.useId();
|
|
727
|
+
const helperId = React6.useId();
|
|
616
728
|
const rootClassName = [
|
|
617
729
|
"file_input",
|
|
618
730
|
disabled && "file_input_disabled",
|
|
@@ -635,20 +747,18 @@ var FileInput = ({
|
|
|
635
747
|
helperText && /* @__PURE__ */ jsx("span", { id: helperId, className: "file_input_helper", children: helperText })
|
|
636
748
|
] });
|
|
637
749
|
};
|
|
638
|
-
var Radio =
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
}
|
|
651
|
-
);
|
|
750
|
+
var Radio = ({ label, size = "md", className, ref, ...props }) => {
|
|
751
|
+
const rootClassName = cn(
|
|
752
|
+
"radio",
|
|
753
|
+
`radio_size_${size}`,
|
|
754
|
+
className
|
|
755
|
+
);
|
|
756
|
+
return /* @__PURE__ */ jsxs("label", { className: rootClassName, children: [
|
|
757
|
+
/* @__PURE__ */ jsx("input", { ref, type: "radio", className: "radio_input", ...props }),
|
|
758
|
+
/* @__PURE__ */ jsx("span", { className: "radio_dot", "aria-hidden": "true" }),
|
|
759
|
+
label ? /* @__PURE__ */ jsx("span", { className: "radio_label", children: label }) : null
|
|
760
|
+
] });
|
|
761
|
+
};
|
|
652
762
|
Radio.displayName = "Radio";
|
|
653
763
|
var Select = ({
|
|
654
764
|
id,
|
|
@@ -665,21 +775,21 @@ var Select = ({
|
|
|
665
775
|
className,
|
|
666
776
|
textAlign = "left"
|
|
667
777
|
}) => {
|
|
668
|
-
const internalId =
|
|
778
|
+
const internalId = React6.useId();
|
|
669
779
|
const selectId = id ?? internalId;
|
|
670
780
|
const isControlled = value !== void 0;
|
|
671
|
-
const [internalValue, setInternalValue] =
|
|
781
|
+
const [internalValue, setInternalValue] = React6.useState(defaultValue);
|
|
672
782
|
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 =
|
|
783
|
+
const [isOpen, setIsOpen] = React6.useState(false);
|
|
784
|
+
const [activeIndex, setActiveIndex] = React6.useState(-1);
|
|
785
|
+
const [dropUp, setDropUp] = React6.useState(false);
|
|
786
|
+
const wrapperRef = React6.useRef(null);
|
|
787
|
+
const controlRef = React6.useRef(null);
|
|
788
|
+
const currentOption = React6.useMemo(
|
|
679
789
|
() => options.find((o) => o.value === currentValue) ?? null,
|
|
680
790
|
[options, currentValue]
|
|
681
791
|
);
|
|
682
|
-
const setValue =
|
|
792
|
+
const setValue = React6.useCallback(
|
|
683
793
|
(next) => {
|
|
684
794
|
const option = options.find((o) => o.value === next) ?? null;
|
|
685
795
|
if (!isControlled) setInternalValue(next);
|
|
@@ -687,12 +797,12 @@ var Select = ({
|
|
|
687
797
|
},
|
|
688
798
|
[isControlled, onChange, options]
|
|
689
799
|
);
|
|
690
|
-
const handleOutsideClick =
|
|
800
|
+
const handleOutsideClick = React6.useEffectEvent((e) => {
|
|
691
801
|
if (!wrapperRef.current?.contains(e.target)) {
|
|
692
802
|
setIsOpen(false);
|
|
693
803
|
}
|
|
694
804
|
});
|
|
695
|
-
|
|
805
|
+
React6.useEffect(() => {
|
|
696
806
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
697
807
|
return () => document.removeEventListener("mousedown", handleOutsideClick);
|
|
698
808
|
}, []);
|
|
@@ -757,12 +867,12 @@ var Select = ({
|
|
|
757
867
|
break;
|
|
758
868
|
}
|
|
759
869
|
};
|
|
760
|
-
|
|
870
|
+
React6.useEffect(() => {
|
|
761
871
|
if (!isOpen) return;
|
|
762
872
|
const idx = options.findIndex((o) => o.value === currentValue && !o.disabled);
|
|
763
873
|
setActiveIndex(idx >= 0 ? idx : Math.max(0, options.findIndex((o) => !o.disabled)));
|
|
764
874
|
}, [isOpen, options, currentValue]);
|
|
765
|
-
|
|
875
|
+
React6.useLayoutEffect(() => {
|
|
766
876
|
if (!isOpen || !controlRef.current) return;
|
|
767
877
|
const rect = controlRef.current.getBoundingClientRect();
|
|
768
878
|
const listHeight = Math.min(options.length * 40, 288);
|
|
@@ -844,146 +954,144 @@ var Select = ({
|
|
|
844
954
|
)
|
|
845
955
|
] });
|
|
846
956
|
};
|
|
847
|
-
var Switch =
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
);
|
|
957
|
+
var Switch = ({
|
|
958
|
+
checked,
|
|
959
|
+
defaultChecked,
|
|
960
|
+
onChange,
|
|
961
|
+
size = "md",
|
|
962
|
+
disabled,
|
|
963
|
+
className,
|
|
964
|
+
ariaLabel,
|
|
965
|
+
ref,
|
|
966
|
+
...props
|
|
967
|
+
}) => {
|
|
968
|
+
const isControlled = checked !== void 0;
|
|
969
|
+
const [innerChecked, setInnerChecked] = React6.useState(!!defaultChecked);
|
|
970
|
+
const isOn = isControlled ? !!checked : innerChecked;
|
|
971
|
+
const handleToggle = () => {
|
|
972
|
+
if (disabled) return;
|
|
973
|
+
const next = !isOn;
|
|
974
|
+
if (!isControlled) setInnerChecked(next);
|
|
975
|
+
onChange?.(next);
|
|
976
|
+
};
|
|
977
|
+
const rootClassName = cn(
|
|
978
|
+
"switch",
|
|
979
|
+
`switch_size_${size}`,
|
|
980
|
+
{ switch_on: isOn, switch_disabled: disabled },
|
|
981
|
+
className
|
|
982
|
+
);
|
|
983
|
+
return /* @__PURE__ */ jsx(
|
|
984
|
+
"button",
|
|
985
|
+
{
|
|
986
|
+
ref,
|
|
987
|
+
type: "button",
|
|
988
|
+
role: "switch",
|
|
989
|
+
"aria-checked": isOn,
|
|
990
|
+
"aria-label": ariaLabel,
|
|
991
|
+
disabled,
|
|
992
|
+
onClick: handleToggle,
|
|
993
|
+
className: rootClassName,
|
|
994
|
+
...props,
|
|
995
|
+
children: /* @__PURE__ */ jsx("span", { className: "switch_thumb" })
|
|
996
|
+
}
|
|
997
|
+
);
|
|
998
|
+
};
|
|
890
999
|
Switch.displayName = "Switch";
|
|
891
|
-
var TextField =
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}
|
|
975
|
-
const nextValue = applyTransform(rawValue);
|
|
976
|
-
setInnerValue(nextValue);
|
|
977
|
-
onChangeAction?.(nextValue);
|
|
1000
|
+
var TextField = ({
|
|
1001
|
+
id,
|
|
1002
|
+
label,
|
|
1003
|
+
helperText,
|
|
1004
|
+
error,
|
|
1005
|
+
success,
|
|
1006
|
+
variant = "outline",
|
|
1007
|
+
size = "md",
|
|
1008
|
+
leftIcon,
|
|
1009
|
+
rightIcon,
|
|
1010
|
+
fullWidth,
|
|
1011
|
+
className,
|
|
1012
|
+
onChangeAction,
|
|
1013
|
+
value,
|
|
1014
|
+
defaultValue,
|
|
1015
|
+
transformValue,
|
|
1016
|
+
ref,
|
|
1017
|
+
...props
|
|
1018
|
+
}) => {
|
|
1019
|
+
const inputId = id ?? React6.useId();
|
|
1020
|
+
const helperId = helperText ? `${inputId}-help` : void 0;
|
|
1021
|
+
const isControlled = value !== void 0;
|
|
1022
|
+
const applyTransform = (nextValue) => transformValue ? transformValue(nextValue) : nextValue;
|
|
1023
|
+
const [innerValue, setInnerValue] = React6.useState(
|
|
1024
|
+
() => applyTransform(value ?? defaultValue ?? "")
|
|
1025
|
+
);
|
|
1026
|
+
const isComposingRef = React6.useRef(false);
|
|
1027
|
+
React6.useEffect(() => {
|
|
1028
|
+
if (!isControlled) return;
|
|
1029
|
+
setInnerValue(applyTransform(value ?? ""));
|
|
1030
|
+
}, [isControlled, value, transformValue]);
|
|
1031
|
+
const rootClassName = cn(
|
|
1032
|
+
"text_field",
|
|
1033
|
+
{ text_field_full_width: fullWidth },
|
|
1034
|
+
className
|
|
1035
|
+
);
|
|
1036
|
+
const inputClassName = cn(
|
|
1037
|
+
"text_field_input",
|
|
1038
|
+
`text_field_variant_${variant}`,
|
|
1039
|
+
`text_field_size_${size}`,
|
|
1040
|
+
{
|
|
1041
|
+
text_field_with_left: !!leftIcon,
|
|
1042
|
+
text_field_with_right: !!rightIcon,
|
|
1043
|
+
text_field_error: !!error,
|
|
1044
|
+
text_field_success: !!success
|
|
1045
|
+
}
|
|
1046
|
+
);
|
|
1047
|
+
const helperClassName = cn(
|
|
1048
|
+
"text_field_helper",
|
|
1049
|
+
{
|
|
1050
|
+
text_field_helper_error: error,
|
|
1051
|
+
text_field_helper_success: success
|
|
1052
|
+
}
|
|
1053
|
+
);
|
|
1054
|
+
return /* @__PURE__ */ jsxs("div", { className: rootClassName, children: [
|
|
1055
|
+
label ? /* @__PURE__ */ jsx("label", { className: "text_field_label", htmlFor: inputId, children: label }) : null,
|
|
1056
|
+
/* @__PURE__ */ jsxs("div", { className: "text_field_wrap", children: [
|
|
1057
|
+
leftIcon ? /* @__PURE__ */ jsx("span", { className: "text_field_icon text_field_icon_left", "aria-hidden": "true", children: leftIcon }) : null,
|
|
1058
|
+
/* @__PURE__ */ jsx(
|
|
1059
|
+
"input",
|
|
1060
|
+
{
|
|
1061
|
+
id: inputId,
|
|
1062
|
+
ref,
|
|
1063
|
+
className: inputClassName,
|
|
1064
|
+
"aria-invalid": !!error,
|
|
1065
|
+
"aria-describedby": helperId,
|
|
1066
|
+
...props,
|
|
1067
|
+
value: innerValue,
|
|
1068
|
+
onCompositionStart: () => {
|
|
1069
|
+
isComposingRef.current = true;
|
|
1070
|
+
},
|
|
1071
|
+
onCompositionEnd: (event) => {
|
|
1072
|
+
isComposingRef.current = false;
|
|
1073
|
+
const rawValue = event.currentTarget.value;
|
|
1074
|
+
const nextValue = applyTransform(rawValue);
|
|
1075
|
+
setInnerValue(nextValue);
|
|
1076
|
+
onChangeAction?.(nextValue);
|
|
1077
|
+
},
|
|
1078
|
+
onChange: (event) => {
|
|
1079
|
+
const rawValue = event.target.value;
|
|
1080
|
+
if (isComposingRef.current) {
|
|
1081
|
+
setInnerValue(rawValue);
|
|
1082
|
+
return;
|
|
978
1083
|
}
|
|
1084
|
+
const nextValue = applyTransform(rawValue);
|
|
1085
|
+
setInnerValue(nextValue);
|
|
1086
|
+
onChangeAction?.(nextValue);
|
|
979
1087
|
}
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
|
|
1088
|
+
}
|
|
1089
|
+
),
|
|
1090
|
+
rightIcon ? /* @__PURE__ */ jsx("span", { className: "text_field_icon text_field_icon_right", "aria-hidden": "true", children: rightIcon }) : null
|
|
1091
|
+
] }),
|
|
1092
|
+
helperText ? /* @__PURE__ */ jsx("div", { id: helperId, className: helperClassName, children: helperText }) : null
|
|
1093
|
+
] });
|
|
1094
|
+
};
|
|
987
1095
|
TextField.displayName = "TextField";
|
|
988
1096
|
var pad = (n) => String(n).padStart(2, "0");
|
|
989
1097
|
var getDaysInMonth = (year, month) => new Date(year, month, 0).getDate();
|
|
@@ -1006,8 +1114,8 @@ var DatePicker = ({
|
|
|
1006
1114
|
minDateSrFormat = "Minimum date: {date}",
|
|
1007
1115
|
selectableRangeUntilTodaySrText = "Selectable up to today"
|
|
1008
1116
|
}) => {
|
|
1009
|
-
const groupId =
|
|
1010
|
-
const constraintId =
|
|
1117
|
+
const groupId = React6.useId();
|
|
1118
|
+
const constraintId = React6.useId();
|
|
1011
1119
|
const today = /* @__PURE__ */ new Date();
|
|
1012
1120
|
const todayYear = today.getFullYear();
|
|
1013
1121
|
const todayMonth = today.getMonth() + 1;
|
|
@@ -1133,7 +1241,7 @@ var getPaginationItems = (page, totalPages) => {
|
|
|
1133
1241
|
var Pagination = ({ page, totalPages, onChange, prevLabel = "Previous page", nextLabel = "Next page" }) => {
|
|
1134
1242
|
const prevDisabled = page <= 1;
|
|
1135
1243
|
const nextDisabled = page >= totalPages;
|
|
1136
|
-
const items =
|
|
1244
|
+
const items = React6.useMemo(
|
|
1137
1245
|
() => getPaginationItems(page, totalPages),
|
|
1138
1246
|
[page, totalPages]
|
|
1139
1247
|
);
|
|
@@ -1193,18 +1301,18 @@ var Modal = ({
|
|
|
1193
1301
|
ariaLabel,
|
|
1194
1302
|
...props
|
|
1195
1303
|
}) => {
|
|
1196
|
-
const panelRef =
|
|
1197
|
-
const titleId =
|
|
1304
|
+
const panelRef = React6.useRef(null);
|
|
1305
|
+
const titleId = React6.useId();
|
|
1198
1306
|
useFocusTrap(panelRef, open);
|
|
1199
|
-
const handleEscape =
|
|
1307
|
+
const handleEscape = React6.useEffectEvent((e) => {
|
|
1200
1308
|
if (e.key === "Escape") onClose?.();
|
|
1201
1309
|
});
|
|
1202
|
-
|
|
1310
|
+
React6.useEffect(() => {
|
|
1203
1311
|
if (!open) return;
|
|
1204
1312
|
document.addEventListener("keydown", handleEscape);
|
|
1205
1313
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
1206
1314
|
}, [open]);
|
|
1207
|
-
|
|
1315
|
+
React6.useEffect(() => {
|
|
1208
1316
|
if (!open) return;
|
|
1209
1317
|
const body = document.body;
|
|
1210
1318
|
const openModals = parseInt(body.dataset.openModals || "0", 10);
|
|
@@ -1255,4 +1363,4 @@ var Modal = ({
|
|
|
1255
1363
|
);
|
|
1256
1364
|
};
|
|
1257
1365
|
|
|
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 };
|
|
1366
|
+
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 };
|