@foi/design-system 0.0.4 → 0.0.5
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/DatePicker.utils-ytCEcs6T.js +2680 -0
- package/dist/DatePicker.utils-ytCEcs6T.js.map +1 -0
- package/dist/RadioGroup-D2s7AY6E.js +325 -0
- package/dist/RadioGroup-D2s7AY6E.js.map +1 -0
- package/dist/RadioGroup.context-zJGC5Sjc.js +395 -0
- package/dist/RadioGroup.context-zJGC5Sjc.js.map +1 -0
- package/dist/Switch-BKf-QVlX.js +3824 -0
- package/dist/Switch-BKf-QVlX.js.map +1 -0
- package/dist/ThemeProvider-CYWZJzSU.js +37 -0
- package/dist/ThemeProvider-CYWZJzSU.js.map +1 -0
- package/dist/atoms.d.ts +18 -0
- package/dist/atoms.mjs +3 -0
- package/dist/emotion-react-jsx-runtime.browser.esm-BFNmScj4.js +992 -0
- package/dist/emotion-react-jsx-runtime.browser.esm-BFNmScj4.js.map +1 -0
- package/dist/hocs.d.ts +2 -0
- package/dist/hocs.mjs +2 -0
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.mjs +2 -0
- package/dist/index.mjs +6 -8654
- package/dist/molecules.d.ts +6 -0
- package/dist/molecules.mjs +2 -0
- package/dist/theme-DEqiATmv.js +436 -0
- package/dist/theme-DEqiATmv.js.map +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/theme.mjs +2 -0
- package/dist/useStateCallback-D9fqdxiO.js +26 -0
- package/dist/useStateCallback-D9fqdxiO.js.map +1 -0
- package/dist/utilities/cleaner/input.d.ts +1 -0
- package/dist/utilities/formatter/date.d.ts +3 -0
- package/dist/utilities/formatter/input.d.ts +1 -0
- package/dist/utilities/formatter/number.d.ts +2 -0
- package/dist/utilities/formatter/strings.d.ts +2 -0
- package/dist/utilities/regex/input.d.ts +4 -0
- package/dist/utilities/validator/input.d.ts +1 -0
- package/dist/utilities.d.ts +7 -0
- package/dist/utilities.mjs +23 -0
- package/dist/utilities.mjs.map +1 -0
- package/package.json +25 -1
- package/dist/index.mjs.map +0 -1
|
@@ -0,0 +1,3824 @@
|
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "./emotion-react-jsx-runtime.browser.esm-BFNmScj4.js";
|
|
2
|
+
import { r as i } from "./theme-DEqiATmv.js";
|
|
3
|
+
import { a, t as o } from "./RadioGroup.context-zJGC5Sjc.js";
|
|
4
|
+
import { _ as s, a as c, c as l, f as u, g as d, h as ee, i as f, l as p, m as te, n as ne, o as m, p as h, r as g, s as re, t as _, u as v, v as y, y as ie } from "./DatePicker.utils-ytCEcs6T.js";
|
|
5
|
+
import { n as b, t as ae } from "./useStateCallback-D9fqdxiO.js";
|
|
6
|
+
import x, { forwardRef as oe, useContext as se, useEffect as ce, useLayoutEffect as le, useMemo as S, useRef as C, useState as w } from "react";
|
|
7
|
+
import { css as T } from "@emotion/react";
|
|
8
|
+
import { useController as ue } from "react-hook-form";
|
|
9
|
+
import de from "@mui/icons-material/EventOutlined";
|
|
10
|
+
import fe from "@mui/icons-material/ArrowDropUpOutlined";
|
|
11
|
+
import pe from "@mui/icons-material/KeyboardArrowLeftOutlined";
|
|
12
|
+
import me from "@mui/icons-material/KeyboardArrowRightOutlined";
|
|
13
|
+
import E from "@mui/icons-material/FiberManualRecord";
|
|
14
|
+
//#region src/components/atoms/Button/Button.emotion.ts
|
|
15
|
+
var D = (e, t) => `
|
|
16
|
+
// UTILS
|
|
17
|
+
${i(e, "color", `--BUTTON-EVENTS-${t}-COLOR-PRIMARY`)}
|
|
18
|
+
|
|
19
|
+
// BACKGROUNDS
|
|
20
|
+
${i(e, "background-color", `--BUTTON-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
21
|
+
|
|
22
|
+
// BORDERS
|
|
23
|
+
${i(e, "border-color", `--BUTTON-EVENTS-${t}-BORDER-COLOR`)}
|
|
24
|
+
${i(e, "border-width", `--BUTTON-EVENTS-${t}-BORDER-WIDTH`)}
|
|
25
|
+
${i(e, "border-style", `--BUTTON-EVENTS-${t}-BORDER-STYLE`)}
|
|
26
|
+
|
|
27
|
+
// OUTLINE
|
|
28
|
+
${i(e, "outline-color", `--BUTTON-EVENTS-${t}-OUTLINE-COLOR`)}
|
|
29
|
+
${i(e, "outline-width", `--BUTTON-EVENTS-${t}-OUTLINE-WIDTH`)}
|
|
30
|
+
${i(e, "outline-style", `--BUTTON-EVENTS-${t}-OUTLINE-STYLE`)}
|
|
31
|
+
${i(e, "outline-offset", `--BUTTON-EVENTS-${t}-OUTLINE-OFFSET`)}
|
|
32
|
+
`, O = (e) => T`
|
|
33
|
+
&.--BUTTON {
|
|
34
|
+
width: 100%;
|
|
35
|
+
height: 48px;
|
|
36
|
+
${i(e, "border-radius", "--BUTTON-ROOT-BORDER-RADIUS")};
|
|
37
|
+
display: flex;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 8px;
|
|
41
|
+
text-transform: none;
|
|
42
|
+
position: relative;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
padding: 13.5px 16px;
|
|
46
|
+
user-select: none;
|
|
47
|
+
-webkit-tap-highlight-color: transparent;
|
|
48
|
+
|
|
49
|
+
// ENABLED
|
|
50
|
+
${D(e, "ENABLED")};
|
|
51
|
+
|
|
52
|
+
// HOVER
|
|
53
|
+
&:hover {
|
|
54
|
+
${D(e, "HOVER")};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ACTIVE
|
|
58
|
+
&.--BUTTON-active,
|
|
59
|
+
&:active {
|
|
60
|
+
${D(e, "ACTIVE")};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// FOCUS
|
|
64
|
+
&:focus-visible {
|
|
65
|
+
outline: none;
|
|
66
|
+
${D(e, "FOCUS")};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// DISABLED
|
|
70
|
+
&:disabled {
|
|
71
|
+
pointer-events: none;
|
|
72
|
+
${D(e, "DISABLED")};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// LOADING
|
|
76
|
+
&.--BUTTON-loading {
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
${D(e, "LOADING")};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.--BUTTON-iconStart,
|
|
82
|
+
.--BUTTON-iconEnd {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
> svg {
|
|
86
|
+
width: 20px;
|
|
87
|
+
height: 20px;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.--BUTTON-span {
|
|
92
|
+
// FONT
|
|
93
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
94
|
+
font-size: 0.875rem; // 14px
|
|
95
|
+
font-weight: 500;
|
|
96
|
+
line-height: 1.5;
|
|
97
|
+
letter-spacing: 0.01em;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
`, k = "--BUTTON", A = ({ className: e, style: r, children: i = "Click me!", type: a = "button", loading: o = !1, iconStart: s, iconEnd: c, ...l }) => {
|
|
101
|
+
let [u, d] = w(!1);
|
|
102
|
+
return /* @__PURE__ */ n("button", {
|
|
103
|
+
className: [
|
|
104
|
+
k,
|
|
105
|
+
u ? `${k}-active` : "",
|
|
106
|
+
o ? `${k}-loading` : "",
|
|
107
|
+
e || ""
|
|
108
|
+
].join(" "),
|
|
109
|
+
css: O(r),
|
|
110
|
+
type: a,
|
|
111
|
+
onKeyDown: (e) => {
|
|
112
|
+
(e.key === "Enter" || e.key === "Space") && d(!0), l.onKeyDown?.(e);
|
|
113
|
+
},
|
|
114
|
+
onKeyUp: (e) => {
|
|
115
|
+
(e.key === "Enter" || e.key === "Space") && d(!1), l.onKeyUp?.(e);
|
|
116
|
+
},
|
|
117
|
+
onBlur: (e) => {
|
|
118
|
+
d(!1), l.onBlur?.(e);
|
|
119
|
+
},
|
|
120
|
+
"data-testid": k,
|
|
121
|
+
...l,
|
|
122
|
+
children: [
|
|
123
|
+
s && /* @__PURE__ */ t("span", {
|
|
124
|
+
className: `${k}-iconStart`,
|
|
125
|
+
children: s
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ t("span", {
|
|
128
|
+
className: `${k}-span`,
|
|
129
|
+
children: i
|
|
130
|
+
}),
|
|
131
|
+
c && /* @__PURE__ */ t("span", {
|
|
132
|
+
className: `${k}-iconEnd`,
|
|
133
|
+
children: c
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
}, he = ({ theme: n, ...r }) => {
|
|
138
|
+
let { componentStyles: i } = e([a.BUTTON], n);
|
|
139
|
+
return /* @__PURE__ */ t(A, {
|
|
140
|
+
...r,
|
|
141
|
+
style: i
|
|
142
|
+
});
|
|
143
|
+
}, j = (e, t) => `
|
|
144
|
+
${i(e, "border-color", `--DATEPICKER-EVENTS-${t}-BORDER-COLOR`)};
|
|
145
|
+
${i(e, "border-width", `--DATEPICKER-EVENTS-${t}-BORDER-WIDTH`)};
|
|
146
|
+
${i(e, "border-style", `--DATEPICKER-EVENTS-${t}-BORDER-STYLE`)};
|
|
147
|
+
`, M = (e, t, n = !1) => `
|
|
148
|
+
${i(e, "color", `--DATEPICKER-EVENTS-${t}-COLOR-SECONDARY`)};
|
|
149
|
+
${n ? "transform: translate(14px, -24px); font-size: 0.75rem;" : ""};
|
|
150
|
+
`, N = (e) => `
|
|
151
|
+
.--DATEPICKER-legend {
|
|
152
|
+
max-width: ${e ? "100%" : "0px"};
|
|
153
|
+
}
|
|
154
|
+
`, P = (e, t) => `
|
|
155
|
+
${i(e, "background-color", `--DATEPICKER-EVENTS-${t}-BACKGROUND-COLOR`)};
|
|
156
|
+
~ .--DATEPICKER-helperText {
|
|
157
|
+
${i(e, "color", `--DATEPICKER-EVENTS-${t}-COLOR-TERTIARY`)};
|
|
158
|
+
}
|
|
159
|
+
`, ge = (e) => T`
|
|
160
|
+
&.--DATEPICKER {
|
|
161
|
+
position: relative;
|
|
162
|
+
padding: 0;
|
|
163
|
+
border: 0;
|
|
164
|
+
width: 100%;
|
|
165
|
+
|
|
166
|
+
&.--DATEPICKER-paddingBottom {
|
|
167
|
+
padding-bottom: 24px;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.--DATEPICKER-container {
|
|
171
|
+
box-sizing: border-box;
|
|
172
|
+
position: relative;
|
|
173
|
+
display: inline-flex;
|
|
174
|
+
align-items: center;
|
|
175
|
+
min-height: 48px;
|
|
176
|
+
|
|
177
|
+
width: -webkit-fill-available;
|
|
178
|
+
width: -moz-available;
|
|
179
|
+
width: stretch;
|
|
180
|
+
|
|
181
|
+
${i(e, "border-radius", "--DATEPICKER-ROOT-BORDER-RADIUS")};
|
|
182
|
+
|
|
183
|
+
// ENABLED
|
|
184
|
+
${P(e, "ENABLED")};
|
|
185
|
+
|
|
186
|
+
// VALUE (field has content or calendar is open)
|
|
187
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-open) {
|
|
188
|
+
${P(e, "VALUE")};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// HOVER
|
|
192
|
+
&:has(.--DATEPICKER-fieldRow:hover) {
|
|
193
|
+
${P(e, "HOVER")};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ACTIVE
|
|
197
|
+
&:has(.--DATEPICKER-fieldRow:active) {
|
|
198
|
+
${P(e, "ACTIVE")};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// FOCUS (user is typing inside the 3 sub-inputs)
|
|
202
|
+
&:has(.--DATEPICKER-fieldRow:focus-within) {
|
|
203
|
+
outline: none;
|
|
204
|
+
${P(e, "FOCUS")};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ERROR
|
|
208
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-error) {
|
|
209
|
+
${P(e, "ERROR")};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ERROR + VALUE
|
|
213
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-error.--DATEPICKER-open) {
|
|
214
|
+
${P(e, "ERROR_VALUE")};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// ERROR + HOVER
|
|
218
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-error:hover) {
|
|
219
|
+
${P(e, "ERROR_HOVER")};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// ERROR + ACTIVE
|
|
223
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-error:active) {
|
|
224
|
+
${P(e, "ERROR_ACTIVE")};
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// ERROR + FOCUS
|
|
228
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-error:focus-within) {
|
|
229
|
+
${P(e, "ERROR_FOCUS")};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// DISABLED
|
|
233
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-disabled) {
|
|
234
|
+
pointer-events: none;
|
|
235
|
+
${P(e, "DISABLED")};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// DISABLED + VALUE
|
|
239
|
+
&:has(.--DATEPICKER-fieldRow.--DATEPICKER-disabled.--DATEPICKER-open) {
|
|
240
|
+
pointer-events: none;
|
|
241
|
+
${P(e, "DISABLED_VALUE")};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.--DATEPICKER-fieldRow {
|
|
245
|
+
display: flex;
|
|
246
|
+
align-items: center;
|
|
247
|
+
gap: 0px;
|
|
248
|
+
|
|
249
|
+
height: -webkit-fill-available;
|
|
250
|
+
height: -moz-available;
|
|
251
|
+
height: stretch;
|
|
252
|
+
width: -webkit-fill-available;
|
|
253
|
+
width: -moz-available;
|
|
254
|
+
width: stretch;
|
|
255
|
+
|
|
256
|
+
min-width: 0;
|
|
257
|
+
border: 0;
|
|
258
|
+
margin: 0;
|
|
259
|
+
padding: 15px 14px;
|
|
260
|
+
background-color: transparent;
|
|
261
|
+
cursor: text;
|
|
262
|
+
box-sizing: border-box;
|
|
263
|
+
|
|
264
|
+
// ── Label / fieldset states triggered as sibling ────────────────
|
|
265
|
+
|
|
266
|
+
// ENABLED
|
|
267
|
+
~ .--DATEPICKER-label {
|
|
268
|
+
${M(e, "ENABLED", !0)};
|
|
269
|
+
}
|
|
270
|
+
~ .--DATEPICKER-fieldset {
|
|
271
|
+
${j(e, "ENABLED")};
|
|
272
|
+
${N(!0)};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// VALUE
|
|
276
|
+
&.--DATEPICKER-open {
|
|
277
|
+
~ .--DATEPICKER-label {
|
|
278
|
+
${M(e, "VALUE", !0)};
|
|
279
|
+
}
|
|
280
|
+
~ .--DATEPICKER-fieldset {
|
|
281
|
+
${j(e, "VALUE")};
|
|
282
|
+
${N(!0)};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// HOVER
|
|
287
|
+
&:hover {
|
|
288
|
+
~ .--DATEPICKER-label {
|
|
289
|
+
${M(e, "HOVER")};
|
|
290
|
+
}
|
|
291
|
+
~ .--DATEPICKER-fieldset {
|
|
292
|
+
${j(e, "HOVER")};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// FOCUS (typing in sub-inputs)
|
|
297
|
+
&:focus-within {
|
|
298
|
+
~ .--DATEPICKER-label {
|
|
299
|
+
${M(e, "FOCUS", !0)};
|
|
300
|
+
}
|
|
301
|
+
~ .--DATEPICKER-fieldset {
|
|
302
|
+
${j(e, "FOCUS")};
|
|
303
|
+
${N(!0)};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// ERROR
|
|
308
|
+
&.--DATEPICKER-error {
|
|
309
|
+
~ .--DATEPICKER-label {
|
|
310
|
+
${M(e, "ERROR")};
|
|
311
|
+
}
|
|
312
|
+
~ .--DATEPICKER-fieldset {
|
|
313
|
+
${j(e, "ERROR")};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// ERROR + VALUE
|
|
318
|
+
&.--DATEPICKER-error.--DATEPICKER-open {
|
|
319
|
+
~ .--DATEPICKER-label {
|
|
320
|
+
${M(e, "ERROR_VALUE")};
|
|
321
|
+
}
|
|
322
|
+
~ .--DATEPICKER-fieldset {
|
|
323
|
+
${j(e, "ERROR_VALUE")};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// ERROR + HOVER
|
|
328
|
+
&.--DATEPICKER-error:hover {
|
|
329
|
+
~ .--DATEPICKER-label {
|
|
330
|
+
${M(e, "ERROR_HOVER")};
|
|
331
|
+
}
|
|
332
|
+
~ .--DATEPICKER-fieldset {
|
|
333
|
+
${j(e, "ERROR_HOVER")};
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// ERROR + FOCUS
|
|
338
|
+
&.--DATEPICKER-error:focus-within {
|
|
339
|
+
~ .--DATEPICKER-label {
|
|
340
|
+
${M(e, "ERROR_FOCUS")};
|
|
341
|
+
}
|
|
342
|
+
~ .--DATEPICKER-fieldset {
|
|
343
|
+
${j(e, "ERROR_FOCUS")};
|
|
344
|
+
${N(!0)};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// DISABLED
|
|
349
|
+
&.--DATEPICKER-disabled {
|
|
350
|
+
user-select: none;
|
|
351
|
+
pointer-events: none;
|
|
352
|
+
cursor: default;
|
|
353
|
+
|
|
354
|
+
.--DATEPICKER-partInput {
|
|
355
|
+
${i(e, "color", "--DATEPICKER-EVENTS-DISABLED-COLOR-PRIMARY")};
|
|
356
|
+
}
|
|
357
|
+
.--DATEPICKER-separator {
|
|
358
|
+
${i(e, "color", "--DATEPICKER-EVENTS-DISABLED-COLOR-PRIMARY")};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
~ .--DATEPICKER-label {
|
|
362
|
+
${M(e, "DISABLED")};
|
|
363
|
+
}
|
|
364
|
+
~ .--DATEPICKER-fieldset {
|
|
365
|
+
${j(e, "DISABLED")};
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// ── Sub-input elements ───────────────────────────────────────────
|
|
370
|
+
|
|
371
|
+
.--DATEPICKER-separator {
|
|
372
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
373
|
+
font-size: 0.875rem;
|
|
374
|
+
font-weight: 400;
|
|
375
|
+
letter-spacing: 0.01em;
|
|
376
|
+
line-height: 1;
|
|
377
|
+
${i(e, "color", "--DATEPICKER-EVENTS-ENABLED-COLOR-PRIMARY")};
|
|
378
|
+
user-select: none;
|
|
379
|
+
padding: 0 2px;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.--DATEPICKER-partInput {
|
|
383
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
384
|
+
font-size: 0.875rem;
|
|
385
|
+
font-weight: 500;
|
|
386
|
+
letter-spacing: 0.01em;
|
|
387
|
+
line-height: 1;
|
|
388
|
+
padding: 0;
|
|
389
|
+
margin: 0;
|
|
390
|
+
|
|
391
|
+
display: inline-flex;
|
|
392
|
+
align-items: center;
|
|
393
|
+
justify-content: center;
|
|
394
|
+
flex: 0 0 auto;
|
|
395
|
+
white-space: nowrap;
|
|
396
|
+
user-select: none;
|
|
397
|
+
cursor: text;
|
|
398
|
+
outline: none;
|
|
399
|
+
|
|
400
|
+
&.--DATEPICKER-placeholder {
|
|
401
|
+
${i(e, "color", "--DATEPICKER-EVENTS-ENABLED-COLOR-SECONDARY")};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
&:focus {
|
|
405
|
+
${i(e, "background-color", "--DATEPICKER-EVENTS-VALUE-BORDER-COLOR")};
|
|
406
|
+
border-radius: 2px;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
&:focus-visible {
|
|
410
|
+
outline: none;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
${i(e, "color", "--DATEPICKER-EVENTS-ENABLED-COLOR-PRIMARY")};
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// ── Calendar icon button ─────────────────────────────────────────
|
|
418
|
+
|
|
419
|
+
.--DATEPICKER-calendarIcon {
|
|
420
|
+
flex-shrink: 0;
|
|
421
|
+
${i(e, "color", "--DATEPICKER-EVENTS-ENABLED-ICON-COLOR")};
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// ── Floating label ───────────────────────────────────────────────
|
|
425
|
+
|
|
426
|
+
.--DATEPICKER-label {
|
|
427
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
428
|
+
font-size: 0.875rem;
|
|
429
|
+
font-weight: 500;
|
|
430
|
+
letter-spacing: 0.01em;
|
|
431
|
+
line-height: normal;
|
|
432
|
+
|
|
433
|
+
padding: 0;
|
|
434
|
+
display: block;
|
|
435
|
+
white-space: nowrap;
|
|
436
|
+
overflow: hidden;
|
|
437
|
+
text-overflow: ellipsis;
|
|
438
|
+
position: absolute;
|
|
439
|
+
pointer-events: none;
|
|
440
|
+
z-index: 4;
|
|
441
|
+
|
|
442
|
+
transform: translate(14px, 0px);
|
|
443
|
+
transition: 150ms ease-in-out;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// ── Fieldset border ──────────────────────────────────────────────
|
|
447
|
+
|
|
448
|
+
.--DATEPICKER-fieldset {
|
|
449
|
+
height: 100%;
|
|
450
|
+
width: -webkit-fill-available;
|
|
451
|
+
width: -moz-available;
|
|
452
|
+
width: stretch;
|
|
453
|
+
|
|
454
|
+
text-align: left;
|
|
455
|
+
position: absolute;
|
|
456
|
+
margin: 0;
|
|
457
|
+
padding: 0 6px;
|
|
458
|
+
pointer-events: none;
|
|
459
|
+
overflow: hidden;
|
|
460
|
+
z-index: 5;
|
|
461
|
+
box-sizing: border-box;
|
|
462
|
+
${i(e, "border-radius", "--DATEPICKER-ROOT-BORDER-RADIUS")};
|
|
463
|
+
-webkit-tap-highlight-color: transparent;
|
|
464
|
+
|
|
465
|
+
.--DATEPICKER-legend {
|
|
466
|
+
width: auto;
|
|
467
|
+
overflow: hidden;
|
|
468
|
+
display: block;
|
|
469
|
+
padding: 0;
|
|
470
|
+
height: 0px;
|
|
471
|
+
visibility: hidden;
|
|
472
|
+
|
|
473
|
+
max-width: 0px;
|
|
474
|
+
transition: max-width 150ms ease-in-out;
|
|
475
|
+
|
|
476
|
+
.--DATEPICKER-text {
|
|
477
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
478
|
+
font-size: 0.75rem;
|
|
479
|
+
letter-spacing: 0.01em;
|
|
480
|
+
font-weight: 500;
|
|
481
|
+
padding: 0px 7px;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.--DATEPICKER-adornment {
|
|
487
|
+
display: flex;
|
|
488
|
+
align-items: center;
|
|
489
|
+
justify-content: center;
|
|
490
|
+
height: 100%;
|
|
491
|
+
width: 48px;
|
|
492
|
+
min-width: 48px;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.--DATEPICKER-helperText {
|
|
497
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
498
|
+
font-size: 0.75rem;
|
|
499
|
+
line-height: 1;
|
|
500
|
+
|
|
501
|
+
display: block;
|
|
502
|
+
margin-top: 8px;
|
|
503
|
+
margin-left: 14px;
|
|
504
|
+
height: 16px;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
`, _e = (e, t) => `
|
|
508
|
+
// BACKGROUNDS
|
|
509
|
+
.--ICONBUTTON-span {
|
|
510
|
+
${i(e, "background-color", `--ICONBUTTON-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
511
|
+
}
|
|
512
|
+
`, ve = (e, t) => `
|
|
513
|
+
// SHADOWS
|
|
514
|
+
${i(e, "background-color", `--ICONBUTTON-EVENTS-${t}-SHADOW-COLOR`)}
|
|
515
|
+
`, ye = (e, t) => `
|
|
516
|
+
// UTILS
|
|
517
|
+
.--ICONBUTTON-span > svg > path {
|
|
518
|
+
${i(e, "fill", `--ICONBUTTON-EVENTS-${t}-ICON-COLOR`)}
|
|
519
|
+
}
|
|
520
|
+
`, be = (e, t) => `
|
|
521
|
+
// BORDER
|
|
522
|
+
.--ICONBUTTON-span {
|
|
523
|
+
${i(e, "border-color", `--ICONBUTTON-EVENTS-${t}-BORDER-COLOR`)}
|
|
524
|
+
${i(e, "border-width", `--ICONBUTTON-EVENTS-${t}-BORDER-WIDTH`)}
|
|
525
|
+
${i(e, "border-style", `--ICONBUTTON-EVENTS-${t}-BORDER-STYLE`)}
|
|
526
|
+
}
|
|
527
|
+
`, F = (e, t) => `
|
|
528
|
+
// OUTLINE
|
|
529
|
+
.--ICONBUTTON-span {
|
|
530
|
+
${i(e, "outline-color", `--ICONBUTTON-EVENTS-${t}-OUTLINE-COLOR`)}
|
|
531
|
+
${i(e, "outline-width", `--ICONBUTTON-EVENTS-${t}-OUTLINE-WIDTH`)}
|
|
532
|
+
${i(e, "outline-style", `--ICONBUTTON-EVENTS-${t}-OUTLINE-STYLE`)}
|
|
533
|
+
${i(e, "outline-offset", `--ICONBUTTON-EVENTS-${t}-OUTLINE-OFFSET`)}
|
|
534
|
+
}
|
|
535
|
+
`, xe = (e) => T`
|
|
536
|
+
&.--ICONBUTTON {
|
|
537
|
+
width: 24px;
|
|
538
|
+
height: 24px;
|
|
539
|
+
${i(e, "border-radius", "--ICONBUTTON-ROOT-BORDER-RADIUS")};
|
|
540
|
+
display: inline-flex;
|
|
541
|
+
align-items: center;
|
|
542
|
+
justify-content: center;
|
|
543
|
+
cursor: pointer;
|
|
544
|
+
vertical-align: middle;
|
|
545
|
+
box-sizing: content-box;
|
|
546
|
+
position: relative;
|
|
547
|
+
user-select: none;
|
|
548
|
+
padding: 0px;
|
|
549
|
+
box-sizing: border-box;
|
|
550
|
+
-webkit-tap-highlight-color: transparent;
|
|
551
|
+
isolation: isolate;
|
|
552
|
+
border: none;
|
|
553
|
+
background-color: transparent;
|
|
554
|
+
|
|
555
|
+
// ENABLED
|
|
556
|
+
${_e(e, "ENABLED")};
|
|
557
|
+
${be(e, "ENABLED")};
|
|
558
|
+
${ye(e, "ENABLED")};
|
|
559
|
+
|
|
560
|
+
// HOVER
|
|
561
|
+
&:hover {
|
|
562
|
+
&:before {
|
|
563
|
+
opacity: 1;
|
|
564
|
+
${ve(e, "HOVER")};
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// ACTIVE
|
|
569
|
+
&.--ICONBUTTON-active,
|
|
570
|
+
&:active {
|
|
571
|
+
&:before {
|
|
572
|
+
opacity: 1;
|
|
573
|
+
${ve(e, "ACTIVE")};
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// FOCUS
|
|
578
|
+
&:focus-visible {
|
|
579
|
+
outline: none;
|
|
580
|
+
${F(e, "FOCUS")};
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
// DISABLED
|
|
584
|
+
&:disabled {
|
|
585
|
+
pointer-events: none;
|
|
586
|
+
${_e(e, "ENABLED")};
|
|
587
|
+
${be(e, "ENABLED")};
|
|
588
|
+
${ye(e, "ENABLED")};
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
&.--ICONBUTTON-flipped {
|
|
592
|
+
.--ICONBUTTON-span {
|
|
593
|
+
> svg {
|
|
594
|
+
rotate: 180deg !important;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
.--ICONBUTTON-span {
|
|
600
|
+
width: 24px;
|
|
601
|
+
height: 24px;
|
|
602
|
+
display: flex;
|
|
603
|
+
justify-content: center;
|
|
604
|
+
align-items: center;
|
|
605
|
+
box-sizing: border-box;
|
|
606
|
+
${i(e, "border-radius", "--ICONBUTTON-ROOT-BORDER-RADIUS")};
|
|
607
|
+
|
|
608
|
+
> svg {
|
|
609
|
+
rotate: 0deg;
|
|
610
|
+
transition: rotate 150ms ease-in-out;
|
|
611
|
+
position: absolute;
|
|
612
|
+
width: 100%;
|
|
613
|
+
height: auto;
|
|
614
|
+
z-index: 1;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
&:before {
|
|
619
|
+
content: '';
|
|
620
|
+
position: absolute;
|
|
621
|
+
width: 36px;
|
|
622
|
+
height: 36px;
|
|
623
|
+
border-radius: 50%;
|
|
624
|
+
opacity: 0;
|
|
625
|
+
transition: opacity 150ms ease-in-out;
|
|
626
|
+
z-index: -1;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
`, I = "--ICONBUTTON", Se = ({ className: e, style: n, icon: r, onClick: i, isFlipped: a, ...o }) => {
|
|
630
|
+
let [s, c] = w(!1);
|
|
631
|
+
return /* @__PURE__ */ t("button", {
|
|
632
|
+
className: [
|
|
633
|
+
I,
|
|
634
|
+
s ? `${I}-active` : "",
|
|
635
|
+
a ? `${I}-flipped` : "",
|
|
636
|
+
e
|
|
637
|
+
].join(" "),
|
|
638
|
+
css: xe(n),
|
|
639
|
+
type: "button",
|
|
640
|
+
onClick: i,
|
|
641
|
+
onKeyDown: (e) => {
|
|
642
|
+
e.stopPropagation(), (e.key === "Enter" || e.key === "Space") && c(!0), o.onKeyDown?.(e);
|
|
643
|
+
},
|
|
644
|
+
onKeyUp: (e) => {
|
|
645
|
+
(e.key === "Enter" || e.key === "Space") && c(!1), o.onKeyUp?.(e);
|
|
646
|
+
},
|
|
647
|
+
onBlur: (e) => {
|
|
648
|
+
c(!1), o.onBlur?.(e);
|
|
649
|
+
},
|
|
650
|
+
"data-testid": I,
|
|
651
|
+
...o,
|
|
652
|
+
children: /* @__PURE__ */ t("span", {
|
|
653
|
+
className: `${I}-span`,
|
|
654
|
+
children: r
|
|
655
|
+
})
|
|
656
|
+
});
|
|
657
|
+
}, Ce = ({ theme: n, ...r }) => {
|
|
658
|
+
let { componentStyles: i } = e([a.ICONBUTTON], n);
|
|
659
|
+
return /* @__PURE__ */ t(Se, {
|
|
660
|
+
...r,
|
|
661
|
+
style: i
|
|
662
|
+
});
|
|
663
|
+
}, we = (e, t) => `
|
|
664
|
+
// OUTLINE
|
|
665
|
+
${i(e, "outline-color", `--DATEPICKERMENU-EVENTS-${t}-OUTLINE-COLOR`)}
|
|
666
|
+
${i(e, "outline-width", `--DATEPICKERMENU-EVENTS-${t}-OUTLINE-WIDTH`)}
|
|
667
|
+
${i(e, "outline-style", `--DATEPICKERMENU-EVENTS-${t}-OUTLINE-STYLE`)}
|
|
668
|
+
${i(e, "outline-offset", `--DATEPICKERMENU-EVENTS-${t}-OUTLINE-OFFSET`)}
|
|
669
|
+
`, Te = (e) => T`
|
|
670
|
+
&.--DATEPICKERMENU {
|
|
671
|
+
z-index: 100;
|
|
672
|
+
position: absolute;
|
|
673
|
+
top: 52px;
|
|
674
|
+
left: 0px;
|
|
675
|
+
box-shadow:
|
|
676
|
+
rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
|
|
677
|
+
rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
|
|
678
|
+
rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
|
|
679
|
+
${i(e, "border-radius", "--DATEPICKERMENU-ROOT-BORDER-RADIUS")};
|
|
680
|
+
${i(e, "background-color", "--DATEPICKERMENU-ROOT-BACKGROUND-COLOR")};
|
|
681
|
+
box-sizing: border-box;
|
|
682
|
+
padding: 16px;
|
|
683
|
+
width: 272px;
|
|
684
|
+
height: autopx;
|
|
685
|
+
|
|
686
|
+
// Animation
|
|
687
|
+
display: none;
|
|
688
|
+
opacity: 0;
|
|
689
|
+
translate: 0px -10px;
|
|
690
|
+
transition-property: display opacity translate;
|
|
691
|
+
transition-duration: 150ms;
|
|
692
|
+
transition-behavior: allow-discrete;
|
|
693
|
+
|
|
694
|
+
&.--DATEPICKERMENU-open {
|
|
695
|
+
display: block;
|
|
696
|
+
opacity: 1;
|
|
697
|
+
translate: 0px 0px;
|
|
698
|
+
|
|
699
|
+
@starting-style {
|
|
700
|
+
opacity: 0;
|
|
701
|
+
translate: 0px -10px;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
&.--DATEPICKERMENU-static {
|
|
706
|
+
position: static;
|
|
707
|
+
margin-top: 8px;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
// ── Header (month/year + navigation) ──────────────────────────────────────
|
|
711
|
+
|
|
712
|
+
.--DATEPICKERMENU-header {
|
|
713
|
+
display: flex;
|
|
714
|
+
justify-content: space-between;
|
|
715
|
+
align-items: center;
|
|
716
|
+
margin: 0 0px 12px 4px;
|
|
717
|
+
|
|
718
|
+
.--DATEPICKERMENU-yearToggle {
|
|
719
|
+
display: flex;
|
|
720
|
+
gap: 12px;
|
|
721
|
+
align-items: center;
|
|
722
|
+
|
|
723
|
+
.--DATEPICKERMENU-labelWrap {
|
|
724
|
+
overflow-x: hidden;
|
|
725
|
+
|
|
726
|
+
.--DATEPICKERMENU-headerLabel {
|
|
727
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
728
|
+
font-size: 1rem;
|
|
729
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-ENABLED-COLOR-PRIMARY")};
|
|
730
|
+
|
|
731
|
+
.--DATEPICKERMENU-yearLabel {
|
|
732
|
+
font-family: ${e["--FONTFAMILY-SECONDARY"] || e["--FONTFAMILY-PRIMARY"]};
|
|
733
|
+
font-size: 0.938rem;
|
|
734
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-ENABLED-COLOR-PRIMARY")};
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// Slide animations when month changes
|
|
739
|
+
&.--DATEPICKERMENU-slideLeft .--DATEPICKERMENU-headerLabel {
|
|
740
|
+
animation: dpSlideFromLeft 150ms ease-in-out;
|
|
741
|
+
}
|
|
742
|
+
&.--DATEPICKERMENU-slideRight .--DATEPICKERMENU-headerLabel {
|
|
743
|
+
animation: dpSlideFromRight 150ms ease-in-out;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
.--DATEPICKERMENU-yearArrow {
|
|
748
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-ENABLED-ICON-COLOR")};
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
.--DATEPICKERMENU-monthNav {
|
|
753
|
+
display: flex;
|
|
754
|
+
gap: 12px;
|
|
755
|
+
|
|
756
|
+
.--DATEPICKERMENU-navArrow {
|
|
757
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-ENABLED-ICON-COLOR")};
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// ── Calendar grid ─────────────────────────────────────────────────────────
|
|
763
|
+
|
|
764
|
+
.--DATEPICKERMENU-body {
|
|
765
|
+
display: flex;
|
|
766
|
+
flex-direction: column;
|
|
767
|
+
gap: 12px;
|
|
768
|
+
overflow-y: clip;
|
|
769
|
+
height: 245px;
|
|
770
|
+
|
|
771
|
+
&.--DATEPICKERMENU-yearBody {
|
|
772
|
+
overflow: clip;
|
|
773
|
+
overflow-clip-margin: 18px;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
.--DATEPICKERMENU-yearScrollWrapper {
|
|
778
|
+
display: flex;
|
|
779
|
+
flex-direction: column;
|
|
780
|
+
gap: 12px;
|
|
781
|
+
overflow-y: scroll;
|
|
782
|
+
height: 100%;
|
|
783
|
+
width: calc(100% + 24px);
|
|
784
|
+
margin-left: -8px;
|
|
785
|
+
padding: 8px;
|
|
786
|
+
box-sizing: border-box;
|
|
787
|
+
scroll-padding: 8px;
|
|
788
|
+
|
|
789
|
+
&::-webkit-scrollbar {
|
|
790
|
+
width: 12px;
|
|
791
|
+
height: 4px;
|
|
792
|
+
cursor: pointer;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
&::-webkit-scrollbar-thumb {
|
|
796
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
797
|
+
border-radius: 9999px;
|
|
798
|
+
border: 3px solid transparent;
|
|
799
|
+
background-clip: padding-box;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.--DATEPICKERMENU-weekRow {
|
|
804
|
+
display: flex;
|
|
805
|
+
width: 100%;
|
|
806
|
+
justify-content: space-between;
|
|
807
|
+
gap: 12px;
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Viewport that clips the slide animation while letting outlines overflow
|
|
811
|
+
.--DATEPICKERMENU-gridViewport {
|
|
812
|
+
overflow: clip;
|
|
813
|
+
overflow-clip-margin: 6px;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// Month grid (with slide animation)
|
|
817
|
+
.--DATEPICKERMENU-calendarGrid {
|
|
818
|
+
display: flex;
|
|
819
|
+
flex-direction: column;
|
|
820
|
+
gap: 12px;
|
|
821
|
+
|
|
822
|
+
&.--DATEPICKERMENU-slideLeft {
|
|
823
|
+
animation: dpSlideFromLeft 150ms ease-in-out;
|
|
824
|
+
}
|
|
825
|
+
&.--DATEPICKERMENU-slideRight {
|
|
826
|
+
animation: dpSlideFromRight 150ms ease-in-out;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// ── Day cells ─────────────────────────────────────────────────────────────
|
|
831
|
+
|
|
832
|
+
.--DATEPICKERMENU-dayCell {
|
|
833
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
834
|
+
font-size: 14px;
|
|
835
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-ENABLED-COLOR-SECONDARY")};
|
|
836
|
+
width: 24px;
|
|
837
|
+
height: 24px;
|
|
838
|
+
display: flex;
|
|
839
|
+
justify-content: center;
|
|
840
|
+
align-items: center;
|
|
841
|
+
background-color: transparent;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.--DATEPICKERMENU-dayBtn {
|
|
845
|
+
width: 24px;
|
|
846
|
+
height: 24px;
|
|
847
|
+
cursor: pointer;
|
|
848
|
+
border: none;
|
|
849
|
+
border-radius: 4px;
|
|
850
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
851
|
+
font-size: 14px;
|
|
852
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-ENABLED-COLOR-PRIMARY")};
|
|
853
|
+
display: flex;
|
|
854
|
+
justify-content: center;
|
|
855
|
+
align-items: center;
|
|
856
|
+
background-color: transparent;
|
|
857
|
+
isolation: isolate;
|
|
858
|
+
padding: 0px;
|
|
859
|
+
|
|
860
|
+
&::before {
|
|
861
|
+
content: '';
|
|
862
|
+
position: absolute;
|
|
863
|
+
width: 36px;
|
|
864
|
+
height: 36px;
|
|
865
|
+
border-radius: 50%;
|
|
866
|
+
opacity: 0;
|
|
867
|
+
transition: opacity 150ms ease-in-out;
|
|
868
|
+
z-index: -1;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
// Hover
|
|
872
|
+
&:hover {
|
|
873
|
+
::before {
|
|
874
|
+
opacity: 1;
|
|
875
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-HOVER-BACKGROUND-COLOR")};
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
// Active
|
|
880
|
+
&:active {
|
|
881
|
+
&::before {
|
|
882
|
+
opacity: 1;
|
|
883
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-ACTIVE-BACKGROUND-COLOR")};
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// Focus
|
|
888
|
+
&.--DATEPICKERMENU-focused,
|
|
889
|
+
&:focus-visible {
|
|
890
|
+
outline: none;
|
|
891
|
+
${we(e, "FOCUS")};
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
&.--DATEPICKERMENU-today {
|
|
895
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-ENABLED-BACKGROUND-COLOR")};
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
&.--DATEPICKERMENU-selected {
|
|
899
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-VALUE-BACKGROUND-COLOR")};
|
|
900
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-VALUE-COLOR-PRIMARY")};
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
&:disabled {
|
|
904
|
+
pointer-events: none;
|
|
905
|
+
cursor: default;
|
|
906
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-DISABLED-COLOR-PRIMARY")};
|
|
907
|
+
background-color: transparent;
|
|
908
|
+
|
|
909
|
+
&.--DATEPICKERMENU-selected {
|
|
910
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-DISABLED-COLOR-PRIMARY")};
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
&.--DATEPICKERMENU-today::after {
|
|
914
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-DISABLED-COLOR-PRIMARY")};
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// ── Year cells ────────────────────────────────────────────────────────────
|
|
920
|
+
|
|
921
|
+
.--DATEPICKERMENU-yearBtn {
|
|
922
|
+
cursor: pointer;
|
|
923
|
+
border: none;
|
|
924
|
+
border-radius: 4px;
|
|
925
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
926
|
+
font-size: 14px;
|
|
927
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-ENABLED-COLOR-PRIMARY")};
|
|
928
|
+
width: 40.5px;
|
|
929
|
+
height: 24px;
|
|
930
|
+
display: flex;
|
|
931
|
+
justify-content: center;
|
|
932
|
+
align-items: center;
|
|
933
|
+
background-color: transparent;
|
|
934
|
+
position: relative;
|
|
935
|
+
isolation: isolate;
|
|
936
|
+
padding: 0px;
|
|
937
|
+
|
|
938
|
+
&::before {
|
|
939
|
+
content: '';
|
|
940
|
+
position: absolute;
|
|
941
|
+
width: 54px;
|
|
942
|
+
height: 36px;
|
|
943
|
+
border-radius: 18px;
|
|
944
|
+
opacity: 0;
|
|
945
|
+
transition: opacity 150ms ease-in-out;
|
|
946
|
+
z-index: -1;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
// Hover
|
|
950
|
+
&:hover {
|
|
951
|
+
::before {
|
|
952
|
+
opacity: 1;
|
|
953
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-HOVER-BACKGROUND-COLOR")};
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
// Active
|
|
958
|
+
&:active {
|
|
959
|
+
&::before {
|
|
960
|
+
opacity: 1;
|
|
961
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-ACTIVE-BACKGROUND-COLOR")};
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
// Focus
|
|
966
|
+
&.--DATEPICKERMENU-focused,
|
|
967
|
+
&:focus-visible {
|
|
968
|
+
outline: none;
|
|
969
|
+
${we(e, "FOCUS")};
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
&.--DATEPICKERMENU-selected {
|
|
973
|
+
${i(e, "background-color", "--DATEPICKERMENU-EVENTS-VALUE-BACKGROUND-COLOR")};
|
|
974
|
+
${i(e, "color", "--DATEPICKERMENU-EVENTS-VALUE-COLOR-PRIMARY")};
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
@keyframes dpSlideFromLeft {
|
|
980
|
+
from {
|
|
981
|
+
translate: -100% 0;
|
|
982
|
+
}
|
|
983
|
+
to {
|
|
984
|
+
translate: 0 0;
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
@keyframes dpSlideFromRight {
|
|
989
|
+
from {
|
|
990
|
+
translate: 100% 0;
|
|
991
|
+
}
|
|
992
|
+
to {
|
|
993
|
+
translate: 0 0;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
`, L = "--DATEPICKERMENU", Ee = oe(({ isOpen: e, hasStaticOptions: i = !1, testId: a = `${L}-root`, monthLabel: o = "", yearLabel: s = "", onPrevMonth: c, onNextMonth: l, disablePrev: u = !1, disableNext: ee = !1, weeks: f = [], years: p = [], daysOfWeek: ne = [], selectedValue: m, format: h = "MM/dd/yyyy", today: g, focusedElement: re = -1, onSelectDay: _ = () => {}, onSelectYear: v = () => {}, onMoveFocus: y = () => {}, onClose: ie = () => {}, style: b }, ae) => {
|
|
997
|
+
let [x, oe] = w(!1), [se, S] = w(null), [T, ue] = w(0), [de, E] = w(!1), [D, O] = w(-1), k = C({}), A = C({}), he = C(null), j = C(o + s);
|
|
998
|
+
ce(() => {
|
|
999
|
+
if (!e) return;
|
|
1000
|
+
let t = o + s;
|
|
1001
|
+
t !== j.current && (j.current = t);
|
|
1002
|
+
}, [
|
|
1003
|
+
o,
|
|
1004
|
+
s,
|
|
1005
|
+
e
|
|
1006
|
+
]);
|
|
1007
|
+
let M = () => {
|
|
1008
|
+
S("left"), ue((e) => e + 1), c();
|
|
1009
|
+
}, N = () => {
|
|
1010
|
+
S("right"), ue((e) => e + 1), l();
|
|
1011
|
+
};
|
|
1012
|
+
ce(() => {
|
|
1013
|
+
if (!e || re < 0) return;
|
|
1014
|
+
let t = k.current[re];
|
|
1015
|
+
if (!t) return;
|
|
1016
|
+
let n = document.activeElement;
|
|
1017
|
+
n && (n.tagName === "INPUT" || n.role === "combobox") || t.focus(), t.scrollIntoView?.({
|
|
1018
|
+
block: "nearest",
|
|
1019
|
+
inline: "nearest"
|
|
1020
|
+
});
|
|
1021
|
+
}, [re, e]), ce(() => {
|
|
1022
|
+
if (!e) {
|
|
1023
|
+
let e = setTimeout(() => oe(!1), 150);
|
|
1024
|
+
return () => clearTimeout(e);
|
|
1025
|
+
}
|
|
1026
|
+
}, [e]), le(() => {
|
|
1027
|
+
if (!x) {
|
|
1028
|
+
O(-1);
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
let e = m && d(m) ? m.getFullYear() : g?.getFullYear() ?? (/* @__PURE__ */ new Date()).getFullYear(), t = p.flat().findIndex((t) => t.label === String(e));
|
|
1032
|
+
O(t >= 0 ? t : 0);
|
|
1033
|
+
}, [x]), le(() => {
|
|
1034
|
+
if (!x || D < 0) return;
|
|
1035
|
+
let e = A.current[D];
|
|
1036
|
+
e && (e.focus({ preventScroll: !0 }), e.scrollIntoView?.({
|
|
1037
|
+
block: "nearest",
|
|
1038
|
+
inline: "nearest"
|
|
1039
|
+
}));
|
|
1040
|
+
}, [D, x]);
|
|
1041
|
+
let P = (e, t) => {
|
|
1042
|
+
if ([
|
|
1043
|
+
"ArrowLeft",
|
|
1044
|
+
"ArrowRight",
|
|
1045
|
+
"ArrowUp",
|
|
1046
|
+
"ArrowDown"
|
|
1047
|
+
].includes(e.key)) {
|
|
1048
|
+
e.preventDefault(), e.stopPropagation(), y(e.key);
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
e.key === "Enter" && (e.preventDefault(), e.stopPropagation(), _(t, !0));
|
|
1052
|
+
}, ge = (e, t) => {
|
|
1053
|
+
let n = e.querySelector(t);
|
|
1054
|
+
return n ? n.tagName === "BUTTON" ? n : n.querySelector("button") : null;
|
|
1055
|
+
}, _e = (e) => {
|
|
1056
|
+
let t = p[0]?.length ?? 4, n = {
|
|
1057
|
+
ArrowRight: 1,
|
|
1058
|
+
ArrowLeft: -1,
|
|
1059
|
+
ArrowDown: t,
|
|
1060
|
+
ArrowUp: -t
|
|
1061
|
+
}[e];
|
|
1062
|
+
if (!n) return;
|
|
1063
|
+
let r = D + n;
|
|
1064
|
+
r < 0 || r >= p.flat().length || O(r);
|
|
1065
|
+
}, ve = (e) => {
|
|
1066
|
+
let t = he.current;
|
|
1067
|
+
if (!t) return;
|
|
1068
|
+
let n = ge(t, `.${L}-yearArrow`), r = Array.from(t.querySelectorAll(`.${L}-navArrow`)), i = x ? null : r[0]?.tagName === "BUTTON" ? r[0] : r[0]?.querySelector("button") ?? null, a = x ? null : r[1]?.tagName === "BUTTON" ? r[1] : r[1]?.querySelector("button") ?? null, o = !x && re >= 0 ? k.current[re] ?? null : null, s = x && D >= 0 ? A.current[D] ?? null : null, c = x ? [n, s].filter((e) => e !== null) : [
|
|
1069
|
+
n,
|
|
1070
|
+
i,
|
|
1071
|
+
a,
|
|
1072
|
+
o
|
|
1073
|
+
].filter((e) => e !== null);
|
|
1074
|
+
c.length !== 0 && c[(c.indexOf(document.activeElement) + (e ? -1 : 1) + c.length) % c.length]?.focus();
|
|
1075
|
+
}, ye = (e) => {
|
|
1076
|
+
if (e.key === "Escape") {
|
|
1077
|
+
e.preventDefault(), e.stopPropagation(), ie();
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
if (e.key === "Tab") {
|
|
1081
|
+
e.preventDefault(), e.stopPropagation(), ve(e.shiftKey);
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
[
|
|
1085
|
+
"ArrowLeft",
|
|
1086
|
+
"ArrowRight",
|
|
1087
|
+
"ArrowUp",
|
|
1088
|
+
"ArrowDown"
|
|
1089
|
+
].includes(e.key) && (x ? (e.preventDefault(), e.stopPropagation(), _e(e.key)) : Object.values(k.current).some((e) => e === document.activeElement) || (e.preventDefault(), e.stopPropagation(), y(e.key)));
|
|
1090
|
+
}, be = m && d(m) ? te(m, h) : null, F = g && d(g) ? te(g, h) : null;
|
|
1091
|
+
return /* @__PURE__ */ t("div", {
|
|
1092
|
+
ref: ae,
|
|
1093
|
+
children: /* @__PURE__ */ n("div", {
|
|
1094
|
+
ref: he,
|
|
1095
|
+
className: [
|
|
1096
|
+
L,
|
|
1097
|
+
e ? `${L}-open` : "",
|
|
1098
|
+
i ? `${L}-static` : ""
|
|
1099
|
+
].filter(Boolean).join(" "),
|
|
1100
|
+
css: Te(b),
|
|
1101
|
+
role: "dialog",
|
|
1102
|
+
"aria-label": "Date picker calendar",
|
|
1103
|
+
"data-testid": a,
|
|
1104
|
+
onKeyDownCapture: ye,
|
|
1105
|
+
children: [/* @__PURE__ */ n("div", {
|
|
1106
|
+
className: `${L}-header`,
|
|
1107
|
+
children: [/* @__PURE__ */ n("div", {
|
|
1108
|
+
className: `${L}-yearToggle`,
|
|
1109
|
+
children: [/* @__PURE__ */ t("div", {
|
|
1110
|
+
className: `${L}-labelWrap`,
|
|
1111
|
+
children: /* @__PURE__ */ n("span", {
|
|
1112
|
+
className: `${L}-headerLabel`,
|
|
1113
|
+
children: [
|
|
1114
|
+
o,
|
|
1115
|
+
" ",
|
|
1116
|
+
/* @__PURE__ */ t("span", {
|
|
1117
|
+
className: `${L}-yearLabel`,
|
|
1118
|
+
children: s
|
|
1119
|
+
})
|
|
1120
|
+
]
|
|
1121
|
+
})
|
|
1122
|
+
}), /* @__PURE__ */ t(Ce, {
|
|
1123
|
+
icon: /* @__PURE__ */ t(fe, {}),
|
|
1124
|
+
onClick: () => oe((e) => !e),
|
|
1125
|
+
className: `${L}-yearArrow`,
|
|
1126
|
+
isFlipped: !x,
|
|
1127
|
+
"aria-label": x ? "Close year selector" : "Open year selector",
|
|
1128
|
+
tabIndex: -1,
|
|
1129
|
+
onFocus: () => E(!0)
|
|
1130
|
+
})]
|
|
1131
|
+
}), !x && /* @__PURE__ */ n("div", {
|
|
1132
|
+
className: `${L}-monthNav`,
|
|
1133
|
+
children: [/* @__PURE__ */ t(Ce, {
|
|
1134
|
+
icon: /* @__PURE__ */ t(pe, {}),
|
|
1135
|
+
onClick: M,
|
|
1136
|
+
className: `${L}-navArrow`,
|
|
1137
|
+
disabled: u,
|
|
1138
|
+
"aria-label": "Previous month",
|
|
1139
|
+
tabIndex: -1,
|
|
1140
|
+
onFocus: () => E(!0)
|
|
1141
|
+
}), /* @__PURE__ */ t(Ce, {
|
|
1142
|
+
icon: /* @__PURE__ */ t(me, {}),
|
|
1143
|
+
onClick: N,
|
|
1144
|
+
className: `${L}-navArrow`,
|
|
1145
|
+
disabled: ee,
|
|
1146
|
+
"aria-label": "Next month",
|
|
1147
|
+
tabIndex: -1,
|
|
1148
|
+
onFocus: () => E(!0)
|
|
1149
|
+
})]
|
|
1150
|
+
})]
|
|
1151
|
+
}), /* @__PURE__ */ n("div", {
|
|
1152
|
+
className: [`${L}-body`, x ? `${L}-yearBody` : ""].filter(Boolean).join(" "),
|
|
1153
|
+
children: [!x && /* @__PURE__ */ n(r, { children: [/* @__PURE__ */ t("div", {
|
|
1154
|
+
className: `${L}-weekRow`,
|
|
1155
|
+
children: ne.map((e, n) => /* @__PURE__ */ t("span", {
|
|
1156
|
+
className: `${L}-dayCell`,
|
|
1157
|
+
children: e
|
|
1158
|
+
}, `header-${n}`))
|
|
1159
|
+
}), /* @__PURE__ */ t("div", {
|
|
1160
|
+
className: `${L}-gridViewport`,
|
|
1161
|
+
children: /* @__PURE__ */ t("div", {
|
|
1162
|
+
className: [
|
|
1163
|
+
`${L}-calendarGrid`,
|
|
1164
|
+
se === "left" ? `${L}-slideLeft` : "",
|
|
1165
|
+
se === "right" ? `${L}-slideRight` : ""
|
|
1166
|
+
].filter(Boolean).join(" "),
|
|
1167
|
+
onAnimationEnd: () => S(null),
|
|
1168
|
+
children: (() => {
|
|
1169
|
+
let n = 0;
|
|
1170
|
+
return f.map((r, i) => /* @__PURE__ */ t("div", {
|
|
1171
|
+
className: `${L}-weekRow`,
|
|
1172
|
+
children: r.map((r, a) => {
|
|
1173
|
+
if (!r.isDate) return /* @__PURE__ */ t("span", { className: `${L}-dayCell` }, `blank-${i}-${a}`);
|
|
1174
|
+
let o = n++, s = !!(be && r.value === be && e), c = r.value === F, l = re === o && e && !de;
|
|
1175
|
+
return /* @__PURE__ */ t("button", {
|
|
1176
|
+
id: `${L}-day-${o}`,
|
|
1177
|
+
ref: (e) => {
|
|
1178
|
+
k.current[o] = e;
|
|
1179
|
+
},
|
|
1180
|
+
className: [
|
|
1181
|
+
`${L}-dayBtn`,
|
|
1182
|
+
s ? `${L}-selected` : "",
|
|
1183
|
+
c ? `${L}-today` : "",
|
|
1184
|
+
l ? `${L}-focused` : ""
|
|
1185
|
+
].filter(Boolean).join(" "),
|
|
1186
|
+
type: "button",
|
|
1187
|
+
onClick: () => _(r.value),
|
|
1188
|
+
onFocus: () => E(!1),
|
|
1189
|
+
onKeyDown: (e) => P(e, r.value),
|
|
1190
|
+
disabled: r.isDisabled,
|
|
1191
|
+
role: "option",
|
|
1192
|
+
"aria-selected": s,
|
|
1193
|
+
tabIndex: -1,
|
|
1194
|
+
children: r.label
|
|
1195
|
+
}, r.value);
|
|
1196
|
+
})
|
|
1197
|
+
}, `week-${i}`));
|
|
1198
|
+
})()
|
|
1199
|
+
}, T)
|
|
1200
|
+
})] }), x && /* @__PURE__ */ t("div", {
|
|
1201
|
+
className: `${L}-yearScrollWrapper`,
|
|
1202
|
+
children: (() => {
|
|
1203
|
+
let e = 0;
|
|
1204
|
+
return p.map((n, r) => /* @__PURE__ */ t("div", {
|
|
1205
|
+
className: `${L}-weekRow`,
|
|
1206
|
+
children: n.map((n) => {
|
|
1207
|
+
let r = e++, i = m && d(m) ? n.label === te(m, "yyyy") : !1, a = D === r && !de;
|
|
1208
|
+
return /* @__PURE__ */ t("button", {
|
|
1209
|
+
ref: (e) => {
|
|
1210
|
+
A.current[r] = e;
|
|
1211
|
+
},
|
|
1212
|
+
className: [
|
|
1213
|
+
`${L}-yearBtn`,
|
|
1214
|
+
i ? `${L}-selected` : "",
|
|
1215
|
+
a ? `${L}-focused` : ""
|
|
1216
|
+
].filter(Boolean).join(" "),
|
|
1217
|
+
type: "button",
|
|
1218
|
+
tabIndex: -1,
|
|
1219
|
+
onClick: () => {
|
|
1220
|
+
v(n.value), oe(!1);
|
|
1221
|
+
},
|
|
1222
|
+
onFocus: () => E(!1),
|
|
1223
|
+
"aria-selected": i,
|
|
1224
|
+
children: n.label
|
|
1225
|
+
}, n.value);
|
|
1226
|
+
})
|
|
1227
|
+
}, `year-row-${r}`));
|
|
1228
|
+
})()
|
|
1229
|
+
})]
|
|
1230
|
+
})]
|
|
1231
|
+
})
|
|
1232
|
+
});
|
|
1233
|
+
});
|
|
1234
|
+
Ee.displayName = "DatePickerMenu";
|
|
1235
|
+
//#endregion
|
|
1236
|
+
//#region src/components/atoms/DatePicker/DatePickerMenu/index.tsx
|
|
1237
|
+
var De = x.forwardRef(({ theme: n, ...r }, i) => {
|
|
1238
|
+
let { componentStyles: o } = e([a.DATEPICKERMENU, a.DATEPICKER], n);
|
|
1239
|
+
return /* @__PURE__ */ t(Ee, {
|
|
1240
|
+
...r,
|
|
1241
|
+
style: o,
|
|
1242
|
+
ref: i
|
|
1243
|
+
});
|
|
1244
|
+
});
|
|
1245
|
+
De.displayName = "DatePickerMenu";
|
|
1246
|
+
//#endregion
|
|
1247
|
+
//#region src/components/atoms/DatePicker/DatePicker.tsx
|
|
1248
|
+
var R = "--DATEPICKER", Oe = ({ name: e, label: r, control: i, language: a = f(), minDate: o, maxDate: ae, disabled: x, disableFuture: oe, disablePast: se, hasStaticOptions: le = !1, showErrorText: T = !0, hasPadding: fe = !1, helperText: pe, style: me, className: E }) => {
|
|
1249
|
+
let D = _[a].format, O = S(() => s(/* @__PURE__ */ new Date()), []), k = a === "en", { field: A, fieldState: he } = ue({
|
|
1250
|
+
control: i,
|
|
1251
|
+
name: e
|
|
1252
|
+
}), j = he.error, M = S(() => d(A.value) ? u(A.value) : {
|
|
1253
|
+
day: "",
|
|
1254
|
+
month: "",
|
|
1255
|
+
year: ""
|
|
1256
|
+
}, []), [N, P] = w(M.day), [_e, ve] = w(M.month), [ye, be] = w(M.year), [F, xe] = w(!1), [I, Se] = w(-1), [we, Te] = w(() => d(A.value) ? A.value : O), L = C(null), Ee = C(null), Oe = C(null), ke = C(null), z = C(null), B = C(null), V = C(""), Ae = C(""), H = C(""), je = F || !!(N || _e || ye), U = S(() => c(we, D, a, {
|
|
1257
|
+
minDate: o,
|
|
1258
|
+
maxDate: ae,
|
|
1259
|
+
disableFuture: oe,
|
|
1260
|
+
disablePast: se,
|
|
1261
|
+
today: O
|
|
1262
|
+
}), [
|
|
1263
|
+
we,
|
|
1264
|
+
a,
|
|
1265
|
+
o,
|
|
1266
|
+
ae,
|
|
1267
|
+
oe,
|
|
1268
|
+
se,
|
|
1269
|
+
O,
|
|
1270
|
+
D
|
|
1271
|
+
]), Me = S(() => U.flat().filter((e) => e.isDate), [U]), Ne = S(() => m(D, 1900, 200, 4), [D]), Pe = _[a].daysOfWeek.map((e) => ne[a][e]), Fe = g(we, a), Ie = te(we, "yyyy");
|
|
1272
|
+
ce(() => {
|
|
1273
|
+
if (!N && !_e && !ye) return;
|
|
1274
|
+
let e = N || "01", t = _e || "01", n = ye || "2000", r = h(k ? `${t}/${e}/${n}` : `${e}/${t}/${n}`, D, /* @__PURE__ */ new Date());
|
|
1275
|
+
A.onChange(r), l(r) && Te(r), j && A.onBlur();
|
|
1276
|
+
}, [
|
|
1277
|
+
N,
|
|
1278
|
+
_e,
|
|
1279
|
+
ye
|
|
1280
|
+
]), b({
|
|
1281
|
+
ref: Ee,
|
|
1282
|
+
onAction: () => {
|
|
1283
|
+
xe(!1), A.onBlur();
|
|
1284
|
+
},
|
|
1285
|
+
isActive: F,
|
|
1286
|
+
exceptRef: L
|
|
1287
|
+
});
|
|
1288
|
+
let Le = (e) => {
|
|
1289
|
+
let t = e.relatedTarget, n = L.current?.contains(t), r = Ee.current?.contains(t);
|
|
1290
|
+
n || r || (xe(!1), A.onBlur());
|
|
1291
|
+
}, Re = (e) => requestAnimationFrame(() => e.current?.focus()), ze = (e) => {
|
|
1292
|
+
if ([
|
|
1293
|
+
"ArrowLeft",
|
|
1294
|
+
"ArrowRight",
|
|
1295
|
+
"ArrowUp",
|
|
1296
|
+
"ArrowDown"
|
|
1297
|
+
].includes(e.key) && F) {
|
|
1298
|
+
e.preventDefault(), e.stopPropagation(), We(e.key);
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1301
|
+
if (e.key === "Backspace" || e.key === "Delete") {
|
|
1302
|
+
e.preventDefault(), P(""), V.current = "";
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
if (!/^\d$/.test(e.key)) return;
|
|
1306
|
+
e.preventDefault(), V.current = (V.current + e.key).slice(-2);
|
|
1307
|
+
let t = parseInt(V.current, 10);
|
|
1308
|
+
if (t === 0) {
|
|
1309
|
+
P("01"), V.current = "";
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
P(String(Math.min(t, 31)).padStart(2, "0")), (t > 3 || V.current.length >= 2) && (V.current = "", Re(k ? B : z));
|
|
1313
|
+
}, W = (e) => {
|
|
1314
|
+
if ([
|
|
1315
|
+
"ArrowLeft",
|
|
1316
|
+
"ArrowRight",
|
|
1317
|
+
"ArrowUp",
|
|
1318
|
+
"ArrowDown"
|
|
1319
|
+
].includes(e.key) && F) {
|
|
1320
|
+
e.preventDefault(), e.stopPropagation(), We(e.key);
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
if (e.key === "Backspace" || e.key === "Delete") {
|
|
1324
|
+
e.preventDefault(), ve(""), Ae.current = "";
|
|
1325
|
+
return;
|
|
1326
|
+
}
|
|
1327
|
+
if (!/^\d$/.test(e.key)) return;
|
|
1328
|
+
e.preventDefault(), Ae.current = (Ae.current + e.key).slice(-2);
|
|
1329
|
+
let t = parseInt(Ae.current, 10);
|
|
1330
|
+
if (t === 0) {
|
|
1331
|
+
ve("01"), Ae.current = "";
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
ve(String(Math.min(t, 12)).padStart(2, "0")), (t > 1 || Ae.current.length >= 2) && (Ae.current = "", Re(k ? ke : B));
|
|
1335
|
+
}, Be = (e) => {
|
|
1336
|
+
if ([
|
|
1337
|
+
"ArrowLeft",
|
|
1338
|
+
"ArrowRight",
|
|
1339
|
+
"ArrowUp",
|
|
1340
|
+
"ArrowDown"
|
|
1341
|
+
].includes(e.key) && F) {
|
|
1342
|
+
e.preventDefault(), e.stopPropagation(), We(e.key);
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
if (e.key === "Backspace" || e.key === "Delete") {
|
|
1346
|
+
e.preventDefault(), be(""), H.current = "";
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
/^\d$/.test(e.key) && (e.preventDefault(), H.current = (H.current + e.key).slice(-4), be(String(parseInt(H.current, 10)).padStart(4, "0")));
|
|
1350
|
+
}, G = () => {
|
|
1351
|
+
if (x) return;
|
|
1352
|
+
let e = l(A.value) ? A.value : O;
|
|
1353
|
+
Te(e), Se(e.getDate() - 1), xe(!0);
|
|
1354
|
+
}, Ve = () => xe(!1), He = () => F ? Ve() : G(), Ue = () => {
|
|
1355
|
+
Te((e) => y(e, -1)), Se(-1);
|
|
1356
|
+
}, K = () => {
|
|
1357
|
+
Te((e) => y(e, 1)), Se(-1);
|
|
1358
|
+
}, q = v(we, {
|
|
1359
|
+
minDate: o,
|
|
1360
|
+
disablePast: se,
|
|
1361
|
+
today: O,
|
|
1362
|
+
format: D
|
|
1363
|
+
}), J = p(we, {
|
|
1364
|
+
maxDate: ae,
|
|
1365
|
+
disableFuture: oe,
|
|
1366
|
+
today: O,
|
|
1367
|
+
format: D
|
|
1368
|
+
}), We = (e) => {
|
|
1369
|
+
if (!F) return;
|
|
1370
|
+
let t = {
|
|
1371
|
+
ArrowRight: 1,
|
|
1372
|
+
ArrowLeft: -1,
|
|
1373
|
+
ArrowDown: 7,
|
|
1374
|
+
ArrowUp: -7
|
|
1375
|
+
}[e];
|
|
1376
|
+
if (!t) return;
|
|
1377
|
+
if (I < 0) {
|
|
1378
|
+
Me.length > 0 && Se(0);
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
|
+
let n = Me[I];
|
|
1382
|
+
if (!n) return;
|
|
1383
|
+
let r = h(n.value, D, /* @__PURE__ */ new Date()), i = ie(r, t);
|
|
1384
|
+
if (re(i, {
|
|
1385
|
+
minDate: o,
|
|
1386
|
+
maxDate: ae,
|
|
1387
|
+
disableFuture: oe,
|
|
1388
|
+
disablePast: se,
|
|
1389
|
+
today: O
|
|
1390
|
+
})) return;
|
|
1391
|
+
if (i.getMonth() !== r.getMonth() || i.getFullYear() !== r.getFullYear()) {
|
|
1392
|
+
if (t > 0 && J || t < 0 && q) return;
|
|
1393
|
+
Te(ee(i)), Se(i.getDate() - 1);
|
|
1394
|
+
return;
|
|
1395
|
+
}
|
|
1396
|
+
let a = Me.findIndex((e) => e.value === te(i, D));
|
|
1397
|
+
a >= 0 && Se(a);
|
|
1398
|
+
}, Y = (e, t) => {
|
|
1399
|
+
let n = h(e, D, /* @__PURE__ */ new Date());
|
|
1400
|
+
A.onChange(n);
|
|
1401
|
+
let r = u(n);
|
|
1402
|
+
P(r.day), ve(r.month), be(r.year), xe(!1), t && requestAnimationFrame(() => Oe.current?.querySelector("button")?.focus());
|
|
1403
|
+
}, Ge = (e) => {
|
|
1404
|
+
let t = h(e, D, /* @__PURE__ */ new Date()), n = l(A.value) ? A.value : O, r = new Date(n);
|
|
1405
|
+
r.setFullYear(t.getFullYear());
|
|
1406
|
+
let i = h(te(r, D), D, /* @__PURE__ */ new Date());
|
|
1407
|
+
A.onChange(i);
|
|
1408
|
+
let a = u(i);
|
|
1409
|
+
P(a.day), ve(a.month), be(a.year), Te(i);
|
|
1410
|
+
}, Ke = (e) => {
|
|
1411
|
+
if (e.key === "Tab") {
|
|
1412
|
+
Ve();
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
if (e.key === "Escape") {
|
|
1416
|
+
Ve();
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
e.key === "Enter" && F && (e.preventDefault(), I >= 0 && Me[I] && !Me[I].isDisabled && Y(Me[I].value)), [
|
|
1420
|
+
"ArrowLeft",
|
|
1421
|
+
"ArrowRight",
|
|
1422
|
+
"ArrowUp",
|
|
1423
|
+
"ArrowDown"
|
|
1424
|
+
].includes(e.key) && F && (e.preventDefault(), We(e.key));
|
|
1425
|
+
}, qe = k ? z : ke, Je = k ? "MM" : "DD", Ye = k ? _e : N, X = k ? W : ze, Xe = k ? () => {
|
|
1426
|
+
Ae.current = "";
|
|
1427
|
+
} : () => {
|
|
1428
|
+
V.current = "";
|
|
1429
|
+
}, Ze = k ? ke : z, Z = k ? "DD" : "MM", Qe = k ? N : _e, $e = k ? ze : W, et = k ? () => {
|
|
1430
|
+
V.current = "";
|
|
1431
|
+
} : () => {
|
|
1432
|
+
Ae.current = "";
|
|
1433
|
+
};
|
|
1434
|
+
return /* @__PURE__ */ n("div", {
|
|
1435
|
+
className: [
|
|
1436
|
+
R,
|
|
1437
|
+
fe ? `${R}-paddingBottom` : "",
|
|
1438
|
+
E || ""
|
|
1439
|
+
].join(" "),
|
|
1440
|
+
css: ge(me),
|
|
1441
|
+
"data-testid": R,
|
|
1442
|
+
children: [
|
|
1443
|
+
/* @__PURE__ */ n("div", {
|
|
1444
|
+
ref: L,
|
|
1445
|
+
className: `${R}-container`,
|
|
1446
|
+
onBlur: Le,
|
|
1447
|
+
onKeyDown: Ke,
|
|
1448
|
+
children: [
|
|
1449
|
+
/* @__PURE__ */ n("div", {
|
|
1450
|
+
className: [
|
|
1451
|
+
`${R}-fieldRow`,
|
|
1452
|
+
je ? `${R}-open` : "",
|
|
1453
|
+
j ? `${R}-error` : "",
|
|
1454
|
+
x ? `${R}-disabled` : ""
|
|
1455
|
+
].join(" "),
|
|
1456
|
+
onClick: (e) => {
|
|
1457
|
+
e.target === e.currentTarget && qe.current?.focus();
|
|
1458
|
+
},
|
|
1459
|
+
"data-testid": `${R}-fieldRow`,
|
|
1460
|
+
children: [
|
|
1461
|
+
/* @__PURE__ */ t("span", {
|
|
1462
|
+
ref: qe,
|
|
1463
|
+
role: "spinbutton",
|
|
1464
|
+
"aria-label": k ? "Month" : "Day",
|
|
1465
|
+
"aria-valuenow": parseInt(Ye) || void 0,
|
|
1466
|
+
"aria-valuemin": 1,
|
|
1467
|
+
"aria-valuemax": k ? 12 : 31,
|
|
1468
|
+
"aria-valuetext": Ye || Je,
|
|
1469
|
+
className: [`${R}-partInput`, Ye ? "" : `${R}-placeholder`].filter(Boolean).join(" "),
|
|
1470
|
+
tabIndex: x ? -1 : 0,
|
|
1471
|
+
onKeyDown: X,
|
|
1472
|
+
onFocus: Xe,
|
|
1473
|
+
"data-testid": `${R}-first`,
|
|
1474
|
+
children: Ye || Je
|
|
1475
|
+
}),
|
|
1476
|
+
/* @__PURE__ */ t("span", {
|
|
1477
|
+
className: `${R}-separator`,
|
|
1478
|
+
children: "/"
|
|
1479
|
+
}),
|
|
1480
|
+
/* @__PURE__ */ t("span", {
|
|
1481
|
+
ref: Ze,
|
|
1482
|
+
role: "spinbutton",
|
|
1483
|
+
"aria-label": k ? "Day" : "Month",
|
|
1484
|
+
"aria-valuenow": parseInt(Qe) || void 0,
|
|
1485
|
+
"aria-valuemin": 1,
|
|
1486
|
+
"aria-valuemax": k ? 31 : 12,
|
|
1487
|
+
"aria-valuetext": Qe || Z,
|
|
1488
|
+
className: [`${R}-partInput`, Qe ? "" : `${R}-placeholder`].filter(Boolean).join(" "),
|
|
1489
|
+
tabIndex: x ? -1 : 0,
|
|
1490
|
+
onKeyDown: $e,
|
|
1491
|
+
onFocus: et,
|
|
1492
|
+
"data-testid": `${R}-second`,
|
|
1493
|
+
children: Qe || Z
|
|
1494
|
+
}),
|
|
1495
|
+
/* @__PURE__ */ t("span", {
|
|
1496
|
+
className: `${R}-separator`,
|
|
1497
|
+
children: "/"
|
|
1498
|
+
}),
|
|
1499
|
+
/* @__PURE__ */ t("span", {
|
|
1500
|
+
ref: B,
|
|
1501
|
+
role: "spinbutton",
|
|
1502
|
+
"aria-label": "Year",
|
|
1503
|
+
"aria-valuenow": parseInt(ye) || void 0,
|
|
1504
|
+
"aria-valuemin": 1900,
|
|
1505
|
+
"aria-valuemax": 2100,
|
|
1506
|
+
"aria-valuetext": ye || "YYYY",
|
|
1507
|
+
className: [`${R}-partInput`, ye ? "" : `${R}-placeholder`].filter(Boolean).join(" "),
|
|
1508
|
+
tabIndex: x ? -1 : 0,
|
|
1509
|
+
onKeyDown: Be,
|
|
1510
|
+
onFocus: () => {
|
|
1511
|
+
H.current = "";
|
|
1512
|
+
},
|
|
1513
|
+
"data-testid": `${R}-year`,
|
|
1514
|
+
children: ye || "YYYY"
|
|
1515
|
+
})
|
|
1516
|
+
]
|
|
1517
|
+
}),
|
|
1518
|
+
/* @__PURE__ */ t("div", {
|
|
1519
|
+
ref: Oe,
|
|
1520
|
+
className: `${R}-adornment`,
|
|
1521
|
+
children: /* @__PURE__ */ t(Ce, {
|
|
1522
|
+
className: `${R}-calendarIcon`,
|
|
1523
|
+
onClick: He,
|
|
1524
|
+
icon: /* @__PURE__ */ t(de, {}),
|
|
1525
|
+
disabled: x,
|
|
1526
|
+
tabIndex: 0,
|
|
1527
|
+
"data-testid": `${R}-calendarIcon`
|
|
1528
|
+
})
|
|
1529
|
+
}),
|
|
1530
|
+
/* @__PURE__ */ t("fieldset", {
|
|
1531
|
+
"aria-hidden": "true",
|
|
1532
|
+
className: `${R}-fieldset`,
|
|
1533
|
+
children: /* @__PURE__ */ t("legend", {
|
|
1534
|
+
className: `${R}-legend`,
|
|
1535
|
+
children: /* @__PURE__ */ t("span", {
|
|
1536
|
+
className: `${R}-text`,
|
|
1537
|
+
children: r
|
|
1538
|
+
})
|
|
1539
|
+
})
|
|
1540
|
+
}),
|
|
1541
|
+
/* @__PURE__ */ t("span", {
|
|
1542
|
+
className: `${R}-label`,
|
|
1543
|
+
children: r
|
|
1544
|
+
})
|
|
1545
|
+
]
|
|
1546
|
+
}),
|
|
1547
|
+
/* @__PURE__ */ n("span", {
|
|
1548
|
+
className: `${R}-helperText`,
|
|
1549
|
+
"data-testid": `${R}-helperText`,
|
|
1550
|
+
children: [pe && !j && pe, T && j && j.message]
|
|
1551
|
+
}),
|
|
1552
|
+
/* @__PURE__ */ t(De, {
|
|
1553
|
+
ref: Ee,
|
|
1554
|
+
isOpen: F,
|
|
1555
|
+
hasStaticOptions: le,
|
|
1556
|
+
language: a,
|
|
1557
|
+
monthLabel: Fe,
|
|
1558
|
+
yearLabel: Ie,
|
|
1559
|
+
onPrevMonth: Ue,
|
|
1560
|
+
onNextMonth: K,
|
|
1561
|
+
disablePrev: q,
|
|
1562
|
+
disableNext: J,
|
|
1563
|
+
weeks: U,
|
|
1564
|
+
years: Ne,
|
|
1565
|
+
daysOfWeek: Pe,
|
|
1566
|
+
selectedValue: l(A.value) ? A.value : void 0,
|
|
1567
|
+
format: D,
|
|
1568
|
+
today: O,
|
|
1569
|
+
focusedElement: I,
|
|
1570
|
+
onSelectDay: Y,
|
|
1571
|
+
onSelectYear: Ge,
|
|
1572
|
+
onMoveFocus: We,
|
|
1573
|
+
onClose: Ve
|
|
1574
|
+
})
|
|
1575
|
+
]
|
|
1576
|
+
});
|
|
1577
|
+
}, ke = ({ theme: n, ...r }) => {
|
|
1578
|
+
let { componentStyles: i } = e([a.DATEPICKER], n);
|
|
1579
|
+
return /* @__PURE__ */ t(Oe, {
|
|
1580
|
+
...r,
|
|
1581
|
+
style: i
|
|
1582
|
+
});
|
|
1583
|
+
}, z = (e, t) => `
|
|
1584
|
+
// BORDERS
|
|
1585
|
+
${i(e, "border-color", `--INPUT-EVENTS-${t}-BORDER-COLOR`)};
|
|
1586
|
+
${i(e, "border-width", `--INPUT-EVENTS-${t}-BORDER-WIDTH`)};
|
|
1587
|
+
${i(e, "border-style", `--INPUT-EVENTS-${t}-BORDER-STYLE`)};
|
|
1588
|
+
`, B = (e, t) => `
|
|
1589
|
+
// TYPOGRAPHY
|
|
1590
|
+
${i(e, "color", `--INPUT-EVENTS-${t}-COLOR-PRIMARY`)};
|
|
1591
|
+
${i(e, "caret-color", `--INPUT-EVENTS-${t}-COLOR-PRIMARY`)};
|
|
1592
|
+
`, V = (e, t, n = !1) => `
|
|
1593
|
+
${i(e, "color", `--INPUT-EVENTS-${t}-COLOR-SECONDARY`)};
|
|
1594
|
+
${n ? "transform: translate(14px, -24px); font-size: 0.75rem;" : ""};
|
|
1595
|
+
`, Ae = (e) => `
|
|
1596
|
+
.--INPUT-legend {
|
|
1597
|
+
max-width: ${e ? "100%" : "0px"};
|
|
1598
|
+
}
|
|
1599
|
+
`, H = (e, t) => `
|
|
1600
|
+
${i(e, "background-color", `--INPUT-EVENTS-${t}-BACKGROUND-COLOR`)};
|
|
1601
|
+
~ .--INPUT-helperText {
|
|
1602
|
+
${i(e, "color", `--INPUT-EVENTS-${t}-COLOR-TERTIARY`)};
|
|
1603
|
+
}
|
|
1604
|
+
`, je = (e) => T`
|
|
1605
|
+
&.--INPUT {
|
|
1606
|
+
position: relative;
|
|
1607
|
+
padding: 0;
|
|
1608
|
+
border: 0;
|
|
1609
|
+
width: 100%;
|
|
1610
|
+
|
|
1611
|
+
&.--INPUT-paddingBottom {
|
|
1612
|
+
padding-bottom: 24px;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.--INPUT-container {
|
|
1616
|
+
box-sizing: border-box;
|
|
1617
|
+
position: relative;
|
|
1618
|
+
display: inline-flex;
|
|
1619
|
+
align-items: center;
|
|
1620
|
+
|
|
1621
|
+
// Safari Firefox Chrome/Edge
|
|
1622
|
+
width: -webkit-fill-available;
|
|
1623
|
+
width: -moz-available;
|
|
1624
|
+
width: stretch;
|
|
1625
|
+
|
|
1626
|
+
${i(e, "border-radius", "--INPUT-ROOT-BORDER-RADIUS")};
|
|
1627
|
+
|
|
1628
|
+
// ENABLED
|
|
1629
|
+
${H(e, "ENABLED")};
|
|
1630
|
+
|
|
1631
|
+
// VALUE
|
|
1632
|
+
&:has(.--INPUT-inputField:not(:placeholder-shown)) {
|
|
1633
|
+
${H(e, "VALUE")};
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
// HOVER
|
|
1637
|
+
&:has(.--INPUT-inputField:hover) {
|
|
1638
|
+
${H(e, "HOVER")};
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// ACTIVE
|
|
1642
|
+
&:has(.--INPUT-inputField:active, .--INPUT-inputField.--INPUT-active) {
|
|
1643
|
+
${H(e, "ACTIVE")};
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// FOCUS
|
|
1647
|
+
&:has(.--INPUT-inputField:focus-visible) {
|
|
1648
|
+
outline: none;
|
|
1649
|
+
${H(e, "FOCUS")};
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
// ERROR
|
|
1653
|
+
&:has(.--INPUT-inputField.--INPUT-error) {
|
|
1654
|
+
${H(e, "ERROR")};
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
// ERROR + VALUE
|
|
1658
|
+
&:has(.--INPUT-inputField.--INPUT-error:not(:placeholder-shown)) {
|
|
1659
|
+
${H(e, "ERROR_VALUE")};
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
// ERROR + HOVER
|
|
1663
|
+
&:has(.--INPUT-inputField.--INPUT-error:hover) {
|
|
1664
|
+
${H(e, "ERROR_HOVER")};
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
// ERROR + ACTIVE
|
|
1668
|
+
&:has(.--INPUT-inputField.--INPUT-error:active, .--INPUT-inputField.--INPUT-error.--INPUT-active) {
|
|
1669
|
+
${H(e, "ERROR_ACTIVE")};
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
// ERROR + FOCUS
|
|
1673
|
+
&:has(.--INPUT-inputField.--INPUT-error:focus-visible) {
|
|
1674
|
+
${H(e, "ERROR_FOCUS")};
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// DISABLED
|
|
1678
|
+
&:has(.--INPUT-inputField:disabled) {
|
|
1679
|
+
pointer-events: none;
|
|
1680
|
+
${H(e, "DISABLED")};
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
// DISABLED + VALUE
|
|
1684
|
+
&:has(.--INPUT-inputField:disabled:not(:placeholder-shown)) {
|
|
1685
|
+
pointer-events: none;
|
|
1686
|
+
${H(e, "DISABLED_VALUE")};
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
.--INPUT-inputField {
|
|
1690
|
+
// FONT
|
|
1691
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
1692
|
+
font-size: 0.875rem; // 14px
|
|
1693
|
+
font-weight: 500;
|
|
1694
|
+
letter-spacing: 0.01em;
|
|
1695
|
+
line-height: 1;
|
|
1696
|
+
|
|
1697
|
+
// Safari Firefox Chrome/Edge
|
|
1698
|
+
height: -webkit-fill-available;
|
|
1699
|
+
height: -moz-available;
|
|
1700
|
+
height: stretch;
|
|
1701
|
+
width: -webkit-fill-available;
|
|
1702
|
+
width: -moz-available;
|
|
1703
|
+
width: stretch;
|
|
1704
|
+
|
|
1705
|
+
min-width: 0;
|
|
1706
|
+
border: 0;
|
|
1707
|
+
margin: 0;
|
|
1708
|
+
padding: 15px 14px;
|
|
1709
|
+
background-color: transparent;
|
|
1710
|
+
cursor: text;
|
|
1711
|
+
display: block;
|
|
1712
|
+
box-sizing: border-box;
|
|
1713
|
+
|
|
1714
|
+
&.--INPUT-right {
|
|
1715
|
+
padding-right: 0px;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
&.--INPUT-left {
|
|
1719
|
+
padding-left: 0px;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
// ENABLED
|
|
1723
|
+
${B(e, "ENABLED")};
|
|
1724
|
+
~ .--INPUT-label {
|
|
1725
|
+
${V(e, "ENABLED")};
|
|
1726
|
+
}
|
|
1727
|
+
~ .--INPUT-fieldset {
|
|
1728
|
+
${z(e, "ENABLED")};
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
// VALUE
|
|
1732
|
+
&:not(:placeholder-shown) {
|
|
1733
|
+
${B(e, "VALUE")};
|
|
1734
|
+
~ .--INPUT-label {
|
|
1735
|
+
${V(e, "VALUE", !0)};
|
|
1736
|
+
}
|
|
1737
|
+
~ .--INPUT-fieldset {
|
|
1738
|
+
${z(e, "VALUE")};
|
|
1739
|
+
${Ae(!0)};
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
// Autocomplete
|
|
1744
|
+
&:-webkit-autofill {
|
|
1745
|
+
-webkit-background-clip: text;
|
|
1746
|
+
${i(e, "-webkit-text-fill-color", "--INPUT-EVENTS-ENABLED-COLOR-PRIMARY")};
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
// HOVER
|
|
1750
|
+
&:hover {
|
|
1751
|
+
${B(e, "HOVER")};
|
|
1752
|
+
~ .--INPUT-label {
|
|
1753
|
+
${V(e, "HOVER")};
|
|
1754
|
+
}
|
|
1755
|
+
~ .--INPUT-fieldset {
|
|
1756
|
+
${z(e, "HOVER")};
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
// ACTIVE
|
|
1761
|
+
&:active,
|
|
1762
|
+
&.--INPUT-active {
|
|
1763
|
+
${B(e, "ACTIVE")};
|
|
1764
|
+
~ .--INPUT-label {
|
|
1765
|
+
${V(e, "ACTIVE")};
|
|
1766
|
+
}
|
|
1767
|
+
~ .--INPUT-fieldset {
|
|
1768
|
+
${z(e, "ACTIVE")};
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
// FOCUS
|
|
1773
|
+
&:focus-visible {
|
|
1774
|
+
outline: none;
|
|
1775
|
+
${B(e, "FOCUS")};
|
|
1776
|
+
~ .--INPUT-label {
|
|
1777
|
+
${V(e, "FOCUS", !0)};
|
|
1778
|
+
}
|
|
1779
|
+
~ .--INPUT-fieldset {
|
|
1780
|
+
${z(e, "FOCUS")};
|
|
1781
|
+
${Ae(!0)};
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1785
|
+
// ERROR
|
|
1786
|
+
&.--INPUT-error {
|
|
1787
|
+
${B(e, "ERROR")};
|
|
1788
|
+
~ .--INPUT-label {
|
|
1789
|
+
${V(e, "ERROR")};
|
|
1790
|
+
}
|
|
1791
|
+
~ .--INPUT-fieldset {
|
|
1792
|
+
${z(e, "ERROR")};
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
// ERROR + VALUE
|
|
1797
|
+
&.--INPUT-error:not(:placeholder-shown) {
|
|
1798
|
+
${B(e, "ERROR_VALUE")};
|
|
1799
|
+
~ .--INPUT-label {
|
|
1800
|
+
${V(e, "ERROR_VALUE")};
|
|
1801
|
+
}
|
|
1802
|
+
~ .--INPUT-fieldset {
|
|
1803
|
+
${z(e, "ERROR_VALUE")};
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
// ERROR + HOVER
|
|
1808
|
+
&.--INPUT-error:hover {
|
|
1809
|
+
${B(e, "ERROR_HOVER")};
|
|
1810
|
+
~ .--INPUT-label {
|
|
1811
|
+
${V(e, "ERROR_HOVER")};
|
|
1812
|
+
}
|
|
1813
|
+
~ .--INPUT-fieldset {
|
|
1814
|
+
${z(e, "ERROR_HOVER")};
|
|
1815
|
+
}
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
// ERROR + ACTIVE
|
|
1819
|
+
&.--INPUT-error:active,
|
|
1820
|
+
&.--INPUT-error.--INPUT-active {
|
|
1821
|
+
${B(e, "ERROR_ACTIVE")};
|
|
1822
|
+
~ .--INPUT-label {
|
|
1823
|
+
${V(e, "ERROR_ACTIVE")};
|
|
1824
|
+
}
|
|
1825
|
+
~ .--INPUT-fieldset {
|
|
1826
|
+
${z(e, "ERROR_ACTIVE")};
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
// ERROR + FOCUS
|
|
1831
|
+
&.--INPUT-error:focus-visible {
|
|
1832
|
+
${B(e, "ERROR_FOCUS")};
|
|
1833
|
+
~ .--INPUT-label {
|
|
1834
|
+
${V(e, "ERROR_FOCUS")};
|
|
1835
|
+
}
|
|
1836
|
+
~ .--INPUT-fieldset {
|
|
1837
|
+
${z(e, "ERROR_FOCUS")};
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
// DISABLED
|
|
1842
|
+
&:disabled {
|
|
1843
|
+
user-select: none;
|
|
1844
|
+
pointer-events: none;
|
|
1845
|
+
${B(e, "DISABLED")};
|
|
1846
|
+
~ .--INPUT-label {
|
|
1847
|
+
${V(e, "DISABLED")};
|
|
1848
|
+
}
|
|
1849
|
+
~ .--INPUT-fieldset {
|
|
1850
|
+
${z(e, "DISABLED")};
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
// DISABLED + VALUE
|
|
1855
|
+
&:disabled:not(:placeholder-shown) {
|
|
1856
|
+
user-select: none;
|
|
1857
|
+
pointer-events: none;
|
|
1858
|
+
${B(e, "DISABLED_VALUE")};
|
|
1859
|
+
~ .--INPUT-label {
|
|
1860
|
+
${V(e, "DISABLED_VALUE")};
|
|
1861
|
+
}
|
|
1862
|
+
~ .--INPUT-fieldset {
|
|
1863
|
+
${z(e, "DISABLED_VALUE")};
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
.--INPUT-label {
|
|
1869
|
+
// FONT
|
|
1870
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
1871
|
+
font-size: 0.875rem; // 14px
|
|
1872
|
+
font-weight: 500;
|
|
1873
|
+
letter-spacing: 0.01em;
|
|
1874
|
+
line-height: normal;
|
|
1875
|
+
|
|
1876
|
+
padding: 0;
|
|
1877
|
+
display: block;
|
|
1878
|
+
white-space: nowrap;
|
|
1879
|
+
overflow: hidden;
|
|
1880
|
+
text-overflow: ellipsis;
|
|
1881
|
+
position: absolute;
|
|
1882
|
+
pointer-events: none;
|
|
1883
|
+
z-index: 4;
|
|
1884
|
+
|
|
1885
|
+
// ANIMATION
|
|
1886
|
+
transform: translate(14px, 0px);
|
|
1887
|
+
transition: 150ms ease-in-out;
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
.--INPUT-fieldset {
|
|
1891
|
+
// Safari Firefox Chrome/Edge
|
|
1892
|
+
height: 100%;
|
|
1893
|
+
width: -webkit-fill-available;
|
|
1894
|
+
width: -moz-available;
|
|
1895
|
+
width: stretch;
|
|
1896
|
+
|
|
1897
|
+
text-align: left;
|
|
1898
|
+
position: absolute;
|
|
1899
|
+
margin: 0;
|
|
1900
|
+
padding: 0 6px;
|
|
1901
|
+
pointer-events: none;
|
|
1902
|
+
overflow: hidden;
|
|
1903
|
+
z-index: 5;
|
|
1904
|
+
box-sizing: border-box;
|
|
1905
|
+
${i(e, "border-radius", "--INPUT-ROOT-BORDER-RADIUS")};
|
|
1906
|
+
-webkit-tap-highlight-color: transparent;
|
|
1907
|
+
|
|
1908
|
+
.--INPUT-legend {
|
|
1909
|
+
width: auto;
|
|
1910
|
+
overflow: hidden;
|
|
1911
|
+
display: block;
|
|
1912
|
+
padding: 0;
|
|
1913
|
+
height: 0px;
|
|
1914
|
+
visibility: hidden;
|
|
1915
|
+
|
|
1916
|
+
// Animation
|
|
1917
|
+
max-width: 0px;
|
|
1918
|
+
transition: max-width 150ms ease-in-out;
|
|
1919
|
+
|
|
1920
|
+
.--INPUT-text {
|
|
1921
|
+
// FONT
|
|
1922
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
1923
|
+
font-size: 0.75rem; // 12px
|
|
1924
|
+
letter-spacing: 0.01em;
|
|
1925
|
+
font-weight: 500;
|
|
1926
|
+
padding: 0px 7px;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
.--INPUT-adornment {
|
|
1932
|
+
display: flex;
|
|
1933
|
+
align-items: center;
|
|
1934
|
+
justify-content: center;
|
|
1935
|
+
height: 100%;
|
|
1936
|
+
width: 48px;
|
|
1937
|
+
min-width: 48px;
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
|
|
1941
|
+
.--INPUT-helperText {
|
|
1942
|
+
// FONT
|
|
1943
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
1944
|
+
font-size: 0.75rem; // 12px
|
|
1945
|
+
line-height: 1;
|
|
1946
|
+
|
|
1947
|
+
display: block;
|
|
1948
|
+
margin-top: 8px;
|
|
1949
|
+
margin-left: 14px;
|
|
1950
|
+
height: 16px;
|
|
1951
|
+
}
|
|
1952
|
+
}
|
|
1953
|
+
`, U = "--INPUT", Me = ({ children: e }) => /* @__PURE__ */ t("div", {
|
|
1954
|
+
className: `${U}-adornment`,
|
|
1955
|
+
children: e
|
|
1956
|
+
}), Ne = ({ name: e, label: r, control: i, width: a, disabled: o, type: s = "text", regex: c, hasPadding: l = !1, format: u, startAdornment: d, endAdornment: ee, helperText: f, showErrorText: p = !0, style: te, className: ne, ...m }) => {
|
|
1957
|
+
let { field: h, fieldState: g } = ue({
|
|
1958
|
+
control: i,
|
|
1959
|
+
name: e
|
|
1960
|
+
}), [re, _] = w(h.value || ""), v = g.error, y = (e) => {
|
|
1961
|
+
e.preventDefault();
|
|
1962
|
+
let { value: t } = e.target;
|
|
1963
|
+
if (c && c.test(t) || !c) {
|
|
1964
|
+
let e = u && t ? u(t) : t;
|
|
1965
|
+
h.onChange(e), _(e), v && ie();
|
|
1966
|
+
}
|
|
1967
|
+
}, ie = () => h.onBlur();
|
|
1968
|
+
return /* @__PURE__ */ n("div", {
|
|
1969
|
+
className: [
|
|
1970
|
+
U,
|
|
1971
|
+
l ? `${U}-paddingBottom` : "",
|
|
1972
|
+
ne || ""
|
|
1973
|
+
].join(" "),
|
|
1974
|
+
css: je(te),
|
|
1975
|
+
"data-testid": U,
|
|
1976
|
+
children: [/* @__PURE__ */ n("div", {
|
|
1977
|
+
className: `${U}-container`,
|
|
1978
|
+
children: [
|
|
1979
|
+
d && /* @__PURE__ */ t(Me, { children: d }),
|
|
1980
|
+
/* @__PURE__ */ t("input", {
|
|
1981
|
+
className: [
|
|
1982
|
+
`${U}-inputField`,
|
|
1983
|
+
v && `${U}-error`,
|
|
1984
|
+
d && `${U}-open`,
|
|
1985
|
+
d && `${U}-left`,
|
|
1986
|
+
ee && `${U}-right`
|
|
1987
|
+
].join(" "),
|
|
1988
|
+
placeholder: " ",
|
|
1989
|
+
value: re,
|
|
1990
|
+
disabled: o,
|
|
1991
|
+
"data-testid": `${U}-inputField`,
|
|
1992
|
+
onChange: (e) => y(e),
|
|
1993
|
+
onBlur: h.onBlur,
|
|
1994
|
+
name: e,
|
|
1995
|
+
type: s,
|
|
1996
|
+
...m
|
|
1997
|
+
}),
|
|
1998
|
+
ee && /* @__PURE__ */ t(Me, { children: ee }),
|
|
1999
|
+
/* @__PURE__ */ t("fieldset", {
|
|
2000
|
+
"aria-hidden": "true",
|
|
2001
|
+
className: `${U}-fieldset`,
|
|
2002
|
+
children: /* @__PURE__ */ t("legend", {
|
|
2003
|
+
className: `${U}-legend`,
|
|
2004
|
+
children: /* @__PURE__ */ t("span", {
|
|
2005
|
+
className: `${U}-text`,
|
|
2006
|
+
children: r
|
|
2007
|
+
})
|
|
2008
|
+
})
|
|
2009
|
+
}),
|
|
2010
|
+
/* @__PURE__ */ t("span", {
|
|
2011
|
+
className: `${U}-label`,
|
|
2012
|
+
children: r
|
|
2013
|
+
})
|
|
2014
|
+
]
|
|
2015
|
+
}), /* @__PURE__ */ n("span", {
|
|
2016
|
+
className: `${U}-helperText`,
|
|
2017
|
+
"data-testid": `${U}-helperText`,
|
|
2018
|
+
children: [f && (!v || !p) && f, p && v && v.message]
|
|
2019
|
+
})]
|
|
2020
|
+
});
|
|
2021
|
+
}, Pe = ({ theme: n, ...r }) => {
|
|
2022
|
+
let { componentStyles: i } = e([a.INPUT], n);
|
|
2023
|
+
return /* @__PURE__ */ t(Ne, {
|
|
2024
|
+
...r,
|
|
2025
|
+
style: i
|
|
2026
|
+
});
|
|
2027
|
+
}, Fe = (e, t) => `
|
|
2028
|
+
// BACKGROUNDS
|
|
2029
|
+
${i(e, "background-color", `--RADIO-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
2030
|
+
`, Ie = (e, t) => `
|
|
2031
|
+
// BORDERS
|
|
2032
|
+
${i(e, "border-color", `--RADIO-EVENTS-${t}-BORDER-COLOR`)}
|
|
2033
|
+
${i(e, "border-width", `--RADIO-EVENTS-${t}-BORDER-WIDTH`)}
|
|
2034
|
+
${i(e, "border-style", `--RADIO-EVENTS-${t}-BORDER-STYLE`)}
|
|
2035
|
+
`, Le = (e, t) => `
|
|
2036
|
+
// OUTLINE
|
|
2037
|
+
${i(e, "outline-color", `--RADIO-EVENTS-${t}-OUTLINE-COLOR`)}
|
|
2038
|
+
${i(e, "outline-width", `--RADIO-EVENTS-${t}-OUTLINE-WIDTH`)}
|
|
2039
|
+
${i(e, "outline-style", `--RADIO-EVENTS-${t}-OUTLINE-STYLE`)}
|
|
2040
|
+
${i(e, "outline-offset", `--RADIO-EVENTS-${t}-OUTLINE-OFFSET`)}
|
|
2041
|
+
`, Re = (e, t) => `
|
|
2042
|
+
// SHADOW
|
|
2043
|
+
${i(e, "background-color", `--RADIO-EVENTS-${t}-SHADOW-COLOR`)}
|
|
2044
|
+
`, ze = (e, t) => `
|
|
2045
|
+
// UTILS
|
|
2046
|
+
> svg > circle {
|
|
2047
|
+
${i(e, "fill", `--RADIO-EVENTS-${t}-ICON-COLOR`)};
|
|
2048
|
+
}
|
|
2049
|
+
`, W = (e, t) => `
|
|
2050
|
+
// TYPOGRAPHY
|
|
2051
|
+
.--RADIO-label {
|
|
2052
|
+
${i(e, "color", `--RADIO-EVENTS-${t}-COLOR-PRIMARY`)}
|
|
2053
|
+
}
|
|
2054
|
+
`, Be = (e) => T`
|
|
2055
|
+
&.--RADIO {
|
|
2056
|
+
display: flex;
|
|
2057
|
+
flex-direction: column;
|
|
2058
|
+
width: fit-content;
|
|
2059
|
+
|
|
2060
|
+
.--RADIO-container {
|
|
2061
|
+
display: flex;
|
|
2062
|
+
flex-direction: row;
|
|
2063
|
+
gap: 12px;
|
|
2064
|
+
align-items: center;
|
|
2065
|
+
cursor: pointer;
|
|
2066
|
+
|
|
2067
|
+
// ENABLED
|
|
2068
|
+
${W(e, "ENABLED")};
|
|
2069
|
+
|
|
2070
|
+
// VALUE
|
|
2071
|
+
&:has(.--RADIO-inputField:checked) {
|
|
2072
|
+
${W(e, "VALUE")};
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
// HOVER
|
|
2076
|
+
&:hover {
|
|
2077
|
+
${W(e, "HOVER")};
|
|
2078
|
+
|
|
2079
|
+
.--RADIO-radio .--RADIO-span {
|
|
2080
|
+
&:before {
|
|
2081
|
+
opacity: 1;
|
|
2082
|
+
${Re(e, "HOVER")};
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
// ACTIVE
|
|
2088
|
+
&:has(.--RADIO-inputField.--RADIO-active, .--RADIO-inputField:active) {
|
|
2089
|
+
${W(e, "ACTIVE")};
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
// FOCUS-VISIBLE
|
|
2093
|
+
&:has(.--RADIO-inputField:focus-visible) {
|
|
2094
|
+
${W(e, "FOCUS")};
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
// ERROR
|
|
2098
|
+
&:has(.--RADIO-inputField.--RADIO-error) {
|
|
2099
|
+
${W(e, "ERROR")};
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
// ERROR + VALUE
|
|
2103
|
+
&:has(.--RADIO-inputField.--RADIO-error:checked) {
|
|
2104
|
+
${W(e, "ERROR_VALUE")};
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
// ERROR + HOVER
|
|
2108
|
+
&:hover:has(.--RADIO-inputField.--RADIO-error) {
|
|
2109
|
+
${W(e, "ERROR_HOVER")};
|
|
2110
|
+
|
|
2111
|
+
.--RADIO-radio .--RADIO-span {
|
|
2112
|
+
&:before {
|
|
2113
|
+
opacity: 1;
|
|
2114
|
+
${Re(e, "ERROR_HOVER")};
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
// ERROR + ACTIVE
|
|
2120
|
+
&:has(.--RADIO-inputField.--RADIO-error:active),
|
|
2121
|
+
&:has(.--RADIO-inputField.--RADIO-error.--RADIO-active) {
|
|
2122
|
+
${W(e, "ERROR_ACTIVE")};
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
// ERROR + FOCUS
|
|
2126
|
+
&:has(.--RADIO-inputField.--RADIO-error:focus-visible) {
|
|
2127
|
+
${W(e, "ERROR_FOCUS")};
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// DISABLED
|
|
2131
|
+
&:has(.--RADIO-inputField:disabled) {
|
|
2132
|
+
pointer-events: none;
|
|
2133
|
+
${W(e, "DISABLED")};
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// DISABLED + VALUE
|
|
2137
|
+
&:has(.--RADIO-inputField:disabled:checked) {
|
|
2138
|
+
${W(e, "DISABLED_VALUE")};
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
.--RADIO-radio {
|
|
2142
|
+
position: relative;
|
|
2143
|
+
display: inline-flex;
|
|
2144
|
+
width: 24px;
|
|
2145
|
+
height: 24px;
|
|
2146
|
+
isolation: isolate;
|
|
2147
|
+
|
|
2148
|
+
.--RADIO-inputField {
|
|
2149
|
+
cursor: pointer;
|
|
2150
|
+
position: absolute;
|
|
2151
|
+
opacity: 0;
|
|
2152
|
+
width: 100%;
|
|
2153
|
+
height: 100%;
|
|
2154
|
+
z-index: 2;
|
|
2155
|
+
margin: 0;
|
|
2156
|
+
-webkit-tap-highlight-color: transparent;
|
|
2157
|
+
|
|
2158
|
+
~ .--RADIO-span > svg {
|
|
2159
|
+
visibility: hidden;
|
|
2160
|
+
}
|
|
2161
|
+
&:checked ~ .--RADIO-span > svg {
|
|
2162
|
+
visibility: visible;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
// ENABLED
|
|
2166
|
+
~ .--RADIO-span {
|
|
2167
|
+
${Fe(e, "ENABLED")};
|
|
2168
|
+
${Ie(e, "ENABLED")};
|
|
2169
|
+
${ze(e, "ENABLED")};
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
// VALUE
|
|
2173
|
+
&:checked ~ .--RADIO-span {
|
|
2174
|
+
${Fe(e, "VALUE")};
|
|
2175
|
+
${Ie(e, "VALUE")};
|
|
2176
|
+
${ze(e, "VALUE")};
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2179
|
+
// HOVER
|
|
2180
|
+
// Is at the container level
|
|
2181
|
+
|
|
2182
|
+
// ACTIVE
|
|
2183
|
+
&.--RADIO-active ~ .--RADIO-span,
|
|
2184
|
+
&:active ~ .--RADIO-span {
|
|
2185
|
+
&:before {
|
|
2186
|
+
opacity: 1;
|
|
2187
|
+
${Re(e, "ACTIVE")};
|
|
2188
|
+
}
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
// FOCUS
|
|
2192
|
+
&:focus-visible ~ .--RADIO-span {
|
|
2193
|
+
outline: none;
|
|
2194
|
+
${Le(e, "FOCUS")};
|
|
2195
|
+
${ze(e, "FOCUS")};
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
// ERROR
|
|
2199
|
+
&.--RADIO-error ~ .--RADIO-span {
|
|
2200
|
+
${Fe(e, "ERROR")};
|
|
2201
|
+
${Ie(e, "ERROR")};
|
|
2202
|
+
${ze(e, "ERROR")};
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
// ERROR + VALUE
|
|
2206
|
+
&.--RADIO-error:checked ~ .--RADIO-span {
|
|
2207
|
+
${Fe(e, "ERROR_VALUE")};
|
|
2208
|
+
${Ie(e, "ERROR_VALUE")};
|
|
2209
|
+
${ze(e, "ERROR_VALUE")};
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
// ERROR + VALUE
|
|
2213
|
+
// Is at the container level
|
|
2214
|
+
|
|
2215
|
+
// ERROR + ACTIVE
|
|
2216
|
+
&.--RADIO-error:active ~ .--RADIO-span,
|
|
2217
|
+
&.--RADIO-error.--RADIO-active ~ .--RADIO-span {
|
|
2218
|
+
&:before {
|
|
2219
|
+
opacity: 1;
|
|
2220
|
+
${Re(e, "ERROR_ACTIVE")};
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
|
|
2224
|
+
// ERROR + FOCUS
|
|
2225
|
+
&.--RADIO-error:focus-visible ~ .--RADIO-span {
|
|
2226
|
+
${Le(e, "ERROR_FOCUS")};
|
|
2227
|
+
${ze(e, "ERROR_FOCUS")};
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
// DISABLED
|
|
2231
|
+
&:disabled ~ .--RADIO-span {
|
|
2232
|
+
${Fe(e, "DISABLED")};
|
|
2233
|
+
${Ie(e, "DISABLED")};
|
|
2234
|
+
${ze(e, "DISABLED")};
|
|
2235
|
+
}
|
|
2236
|
+
|
|
2237
|
+
// DISABLED + VALUE
|
|
2238
|
+
&:disabled:checked ~ .--RADIO-span {
|
|
2239
|
+
${Fe(e, "DISABLED_VALUE")};
|
|
2240
|
+
${Ie(e, "DISABLED_VALUE")};
|
|
2241
|
+
${ze(e, "DISABLED_VALUE")};
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
.--RADIO-span {
|
|
2246
|
+
width: 24px;
|
|
2247
|
+
height: 24px;
|
|
2248
|
+
border-radius: 50%;
|
|
2249
|
+
position: absolute;
|
|
2250
|
+
box-sizing: border-box;
|
|
2251
|
+
display: flex;
|
|
2252
|
+
align-items: center;
|
|
2253
|
+
justify-content: center;
|
|
2254
|
+
transition: background-color 150ms ease-in-out;
|
|
2255
|
+
|
|
2256
|
+
> svg {
|
|
2257
|
+
width: 20px;
|
|
2258
|
+
height: 20px;
|
|
2259
|
+
z-index: 1;
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
&:before {
|
|
2263
|
+
content: '';
|
|
2264
|
+
position: absolute;
|
|
2265
|
+
width: 36px;
|
|
2266
|
+
height: 36px;
|
|
2267
|
+
border-radius: 50%;
|
|
2268
|
+
opacity: 0;
|
|
2269
|
+
transition: opacity 150ms ease-in-out;
|
|
2270
|
+
z-index: -1;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
.--RADIO-label {
|
|
2276
|
+
// FONT
|
|
2277
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
2278
|
+
font-size: 0.875rem;
|
|
2279
|
+
font-weight: 500;
|
|
2280
|
+
line-height: 1;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
`, G = "--RADIO", Ve = x.forwardRef(({ label: e, icon: r = /* @__PURE__ */ t(E, {}), className: i, style: a = {}, disabled: o, checked: s, onSelect: c, error: l, onKeyDown: u, onKeyUp: d, onBlur: ee, value: f, name: p, ...te }, ne) => {
|
|
2285
|
+
let [m, h] = w(!1);
|
|
2286
|
+
return /* @__PURE__ */ t("div", {
|
|
2287
|
+
className: [
|
|
2288
|
+
G,
|
|
2289
|
+
m ? `${G}-active` : "",
|
|
2290
|
+
i || ""
|
|
2291
|
+
].join(" "),
|
|
2292
|
+
css: Be(a),
|
|
2293
|
+
"data-testid": G,
|
|
2294
|
+
children: /* @__PURE__ */ n("label", {
|
|
2295
|
+
className: `${G}-container`,
|
|
2296
|
+
children: [/* @__PURE__ */ n("div", {
|
|
2297
|
+
className: `${G}-radio`,
|
|
2298
|
+
children: [/* @__PURE__ */ t("input", {
|
|
2299
|
+
className: [
|
|
2300
|
+
`${G}-inputField`,
|
|
2301
|
+
m ? `${G}-active` : "",
|
|
2302
|
+
l ? `${G}-error` : ""
|
|
2303
|
+
].join(" "),
|
|
2304
|
+
type: "radio",
|
|
2305
|
+
value: f,
|
|
2306
|
+
name: p,
|
|
2307
|
+
checked: s,
|
|
2308
|
+
disabled: o,
|
|
2309
|
+
onChange: () => c(),
|
|
2310
|
+
onKeyDown: (e) => {
|
|
2311
|
+
(e.key === "Enter" || e.key === "Space") && h(!0), u?.(e);
|
|
2312
|
+
},
|
|
2313
|
+
onKeyUp: (e) => {
|
|
2314
|
+
(e.key === "Enter" || e.key === "Space") && (h(!1), c()), d?.(e);
|
|
2315
|
+
},
|
|
2316
|
+
onBlur: () => {
|
|
2317
|
+
h(!1), ee?.({});
|
|
2318
|
+
},
|
|
2319
|
+
ref: ne,
|
|
2320
|
+
"data-testid": `${G}-inputField`,
|
|
2321
|
+
...te
|
|
2322
|
+
}), /* @__PURE__ */ t("span", {
|
|
2323
|
+
className: `${G}-span`,
|
|
2324
|
+
"data-testid": `${G}-icon`,
|
|
2325
|
+
children: r
|
|
2326
|
+
})]
|
|
2327
|
+
}), /* @__PURE__ */ t("span", {
|
|
2328
|
+
className: `${G}-label`,
|
|
2329
|
+
"data-testid": `${G}-label`,
|
|
2330
|
+
children: e
|
|
2331
|
+
})]
|
|
2332
|
+
})
|
|
2333
|
+
});
|
|
2334
|
+
});
|
|
2335
|
+
Ve.displayName = "RadioBase";
|
|
2336
|
+
var He = (e) => {
|
|
2337
|
+
let n = se(o);
|
|
2338
|
+
if (!n) throw Error("Radio must be used inside a RadioGroup.");
|
|
2339
|
+
let { value: r, ...i } = e, a = n.selectedValue === r;
|
|
2340
|
+
return /* @__PURE__ */ t(Ve, {
|
|
2341
|
+
...i,
|
|
2342
|
+
name: n.name,
|
|
2343
|
+
value: r,
|
|
2344
|
+
checked: a,
|
|
2345
|
+
onSelect: () => n.onChange(r),
|
|
2346
|
+
disabled: i.disabled ?? n.disabled
|
|
2347
|
+
});
|
|
2348
|
+
}, Ue = ({ theme: n, ...r }) => {
|
|
2349
|
+
let { componentStyles: i } = e([a.RADIO], n);
|
|
2350
|
+
return /* @__PURE__ */ t(He, {
|
|
2351
|
+
...r,
|
|
2352
|
+
style: i
|
|
2353
|
+
});
|
|
2354
|
+
}, K = (e, t) => `
|
|
2355
|
+
// BORDERS
|
|
2356
|
+
${i(e, "border-color", `--SELECT-EVENTS-${t}-BORDER-COLOR`)}
|
|
2357
|
+
${i(e, "border-width", `--SELECT-EVENTS-${t}-BORDER-WIDTH`)}
|
|
2358
|
+
${i(e, "border-style", `--SELECT-EVENTS-${t}-BORDER-STYLE`)}
|
|
2359
|
+
`, q = (e, t) => `
|
|
2360
|
+
// TYPOGRAPHY
|
|
2361
|
+
${i(e, "color", `--SELECT-EVENTS-${t}-COLOR-PRIMARY`)}
|
|
2362
|
+
${i(e, "caret-color", `--SELECT-EVENTS-${t}-FONT-PRIMARY`)}
|
|
2363
|
+
`, J = (e, t, n = !1) => `
|
|
2364
|
+
${i(e, "color", `--SELECT-EVENTS-${t}-COLOR-SECONDARY`)}
|
|
2365
|
+
${n ? "transform: translate(14px, -24px); font-size: 0.75rem;" : ""}
|
|
2366
|
+
`, We = (e) => `
|
|
2367
|
+
.--SELECT-legend {
|
|
2368
|
+
max-width: ${e ? "100%" : "0px"};
|
|
2369
|
+
}
|
|
2370
|
+
`, Y = (e, t) => `
|
|
2371
|
+
${i(e, "background-color", `--SELECT-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
2372
|
+
~ .--SELECT-helperText {
|
|
2373
|
+
${i(e, "color", `--SELECT-EVENTS-${t}-COLOR-TERTIARY`)}
|
|
2374
|
+
}
|
|
2375
|
+
`, Ge = (e) => T`
|
|
2376
|
+
&.--SELECT {
|
|
2377
|
+
position: relative;
|
|
2378
|
+
padding: 0;
|
|
2379
|
+
border: 0;
|
|
2380
|
+
width: 100%;
|
|
2381
|
+
|
|
2382
|
+
&.--SELECT-paddingBottom {
|
|
2383
|
+
padding-bottom: 24px;
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
.--SELECT-container {
|
|
2387
|
+
box-sizing: border-box;
|
|
2388
|
+
position: relative;
|
|
2389
|
+
display: inline-flex;
|
|
2390
|
+
align-items: center;
|
|
2391
|
+
|
|
2392
|
+
// Safari Firefox Chrome/Edge
|
|
2393
|
+
width: -webkit-fill-available;
|
|
2394
|
+
width: -moz-available;
|
|
2395
|
+
width: stretch;
|
|
2396
|
+
|
|
2397
|
+
${i(e, "border-radius", "--SELECT-ROOT-BORDER-RADIUS")};
|
|
2398
|
+
|
|
2399
|
+
// ENABLED
|
|
2400
|
+
${Y(e, "ENABLED")};
|
|
2401
|
+
|
|
2402
|
+
// VALUE
|
|
2403
|
+
&:has(.--SELECT-selectField:not(:placeholder-shown)) {
|
|
2404
|
+
${Y(e, "VALUE")};
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
// HOVER
|
|
2408
|
+
&:has(.--SELECT-selectField:hover) {
|
|
2409
|
+
${Y(e, "HOVER")};
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
// ACTIVE
|
|
2413
|
+
&:has(.--SELECT-selectField:active, .--SELECT-selectField.--SELECT-active) {
|
|
2414
|
+
${Y(e, "ACTIVE")};
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
// FOCUS
|
|
2418
|
+
&:has(.--SELECT-selectField:focus-visible) {
|
|
2419
|
+
outline: none;
|
|
2420
|
+
${Y(e, "FOCUS")};
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
// ERROR
|
|
2424
|
+
&:has(.--SELECT-selectField.--SELECT-error) {
|
|
2425
|
+
${Y(e, "ERROR")};
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
// ERROR + VALUE
|
|
2429
|
+
&:has(.--SELECT-selectField.--SELECT-error:not(:placeholder-shown)) {
|
|
2430
|
+
${Y(e, "ERROR_VALUE")};
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
// ERROR + HOVER
|
|
2434
|
+
&:has(.--SELECT-selectField.--SELECT-error:hover) {
|
|
2435
|
+
${Y(e, "ERROR_HOVER")};
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
// ERROR + ACTIVE
|
|
2439
|
+
&:has(.--SELECT-selectField.--SELECT-error:active, .--SELECT-selectField.--SELECT-error.--SELECT-active) {
|
|
2440
|
+
${Y(e, "ERROR_ACTIVE")};
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
// ERROR + FOCUS
|
|
2444
|
+
&:has(.--SELECT-selectField.--SELECT-error:focus-visible) {
|
|
2445
|
+
${Y(e, "ERROR_FOCUS")};
|
|
2446
|
+
}
|
|
2447
|
+
|
|
2448
|
+
// DISABLED
|
|
2449
|
+
&:has(.--SELECT-selectField:disabled) {
|
|
2450
|
+
pointer-events: none;
|
|
2451
|
+
${Y(e, "DISABLED")};
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
// DISABLED + VALUE
|
|
2455
|
+
&:has(.--SELECT-selectField:disabled:not(:placeholder-shown)) {
|
|
2456
|
+
pointer-events: none;
|
|
2457
|
+
${Y(e, "DISABLED-VALUE")};
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
.--SELECT-selectField {
|
|
2461
|
+
// FONT
|
|
2462
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
2463
|
+
font-size: 0.875rem; // 14px
|
|
2464
|
+
font-weight: 500;
|
|
2465
|
+
letter-spacing: 0.01em;
|
|
2466
|
+
line-height: 1;
|
|
2467
|
+
|
|
2468
|
+
// Safari Firefox Chrome/Edge
|
|
2469
|
+
height: -webkit-fill-available;
|
|
2470
|
+
height: -moz-available;
|
|
2471
|
+
height: stretch;
|
|
2472
|
+
width: -webkit-fill-available;
|
|
2473
|
+
width: -moz-available;
|
|
2474
|
+
width: stretch;
|
|
2475
|
+
|
|
2476
|
+
min-width: 0;
|
|
2477
|
+
border: 0;
|
|
2478
|
+
margin: 0;
|
|
2479
|
+
padding: 15px 14px;
|
|
2480
|
+
background-color: transparent;
|
|
2481
|
+
cursor: text;
|
|
2482
|
+
display: block;
|
|
2483
|
+
box-sizing: border-box;
|
|
2484
|
+
|
|
2485
|
+
&:read-only {
|
|
2486
|
+
cursor: pointer;
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
// ENABLED
|
|
2490
|
+
${q(e, "ENABLED")};
|
|
2491
|
+
~ .--SELECT-label {
|
|
2492
|
+
${J(e, "ENABLED")}
|
|
2493
|
+
}
|
|
2494
|
+
~ .--SELECT-fieldset {
|
|
2495
|
+
${K(e, "ENABLED")}
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
// VALUE
|
|
2499
|
+
&:not(:placeholder-shown),
|
|
2500
|
+
&:not([placeholder=' ']),
|
|
2501
|
+
&.--SELECT-open {
|
|
2502
|
+
${q(e, "VALUE")};
|
|
2503
|
+
~ .--SELECT-label {
|
|
2504
|
+
${J(e, "VALUE", !0)}
|
|
2505
|
+
}
|
|
2506
|
+
~ .--SELECT-fieldset {
|
|
2507
|
+
${K(e, "VALUE")};
|
|
2508
|
+
${We(!0)};
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
// HOVER
|
|
2513
|
+
&:hover {
|
|
2514
|
+
${q(e, "HOVER")};
|
|
2515
|
+
~ .--SELECT-label {
|
|
2516
|
+
${J(e, "HOVER")}
|
|
2517
|
+
}
|
|
2518
|
+
~ .--SELECT-fieldset {
|
|
2519
|
+
${K(e, "HOVER")}
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
// ACTIVE
|
|
2524
|
+
&:active,
|
|
2525
|
+
&.--SELECT-active {
|
|
2526
|
+
${q(e, "ACTIVE")};
|
|
2527
|
+
~ .--SELECT-label {
|
|
2528
|
+
${J(e, "ACTIVE")};
|
|
2529
|
+
}
|
|
2530
|
+
~ .--SELECT-fieldset {
|
|
2531
|
+
${K(e, "ACTIVE")};
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
// FOCUS
|
|
2536
|
+
&:focus-visible {
|
|
2537
|
+
outline: none;
|
|
2538
|
+
${q(e, "FOCUS")};
|
|
2539
|
+
~ .--SELECT-label {
|
|
2540
|
+
${J(e, "FOCUS", !0)}
|
|
2541
|
+
}
|
|
2542
|
+
~ .--SELECT-fieldset {
|
|
2543
|
+
${K(e, "FOCUS")};
|
|
2544
|
+
${We(!0)};
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
// ERROR
|
|
2549
|
+
&.--SELECT-error {
|
|
2550
|
+
${q(e, "ERROR")};
|
|
2551
|
+
~ .--SELECT-label {
|
|
2552
|
+
${J(e, "ERROR")}
|
|
2553
|
+
}
|
|
2554
|
+
~ .--SELECT-fieldset {
|
|
2555
|
+
${K(e, "ERROR")}
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2559
|
+
// ERROR + VALUE
|
|
2560
|
+
&.--SELECT-error:not(:placeholder-shown),
|
|
2561
|
+
&.--SELECT-error.--SELECT-open {
|
|
2562
|
+
${q(e, "ERROR_VALUE")};
|
|
2563
|
+
~ .--SELECT-label {
|
|
2564
|
+
${J(e, "ERROR_VALUE")};
|
|
2565
|
+
}
|
|
2566
|
+
~ .--SELECT-fieldset {
|
|
2567
|
+
${K(e, "ERROR_VALUE")};
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
// ERROR + HOVER
|
|
2572
|
+
&.--SELECT-error:hover {
|
|
2573
|
+
${q(e, "ERROR_HOVER")};
|
|
2574
|
+
~ .--SELECT-label {
|
|
2575
|
+
${J(e, "ERROR_HOVER")}
|
|
2576
|
+
}
|
|
2577
|
+
~ .--SELECT-fieldset {
|
|
2578
|
+
${K(e, "ERROR_HOVER")}
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
// ERROR + ACTIVE
|
|
2583
|
+
&.--SELECT-error:active,
|
|
2584
|
+
&.--SELECT-error.--SELECT-active {
|
|
2585
|
+
${q(e, "ERROR_ACTIVE")};
|
|
2586
|
+
~ .--SELECT-label {
|
|
2587
|
+
${J(e, "ERROR_ACTIVE")}
|
|
2588
|
+
}
|
|
2589
|
+
~ .--SELECT-fieldset {
|
|
2590
|
+
${K(e, "ERROR_ACTIVE")}
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
// ERROR + FOCUS
|
|
2595
|
+
&.--SELECT-error:focus-visible {
|
|
2596
|
+
${q(e, "ERROR_FOCUS")};
|
|
2597
|
+
~ .--SELECT-label {
|
|
2598
|
+
${J(e, "ERROR_FOCUS")}
|
|
2599
|
+
}
|
|
2600
|
+
~ .--SELECT-fieldset {
|
|
2601
|
+
${K(e, "ERROR_FOCUS")}
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
// DISABLED
|
|
2606
|
+
&:disabled {
|
|
2607
|
+
user-select: none;
|
|
2608
|
+
pointer-events: none;
|
|
2609
|
+
${q(e, "DISABLED")};
|
|
2610
|
+
~ .--SELECT-label {
|
|
2611
|
+
${J(e, "DISABLED")}
|
|
2612
|
+
}
|
|
2613
|
+
~ .--SELECT-fieldset {
|
|
2614
|
+
${K(e, "DISABLED")}
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
// DISABLED + VALUE
|
|
2619
|
+
&:disabled:not(:placeholder-shown),
|
|
2620
|
+
&:disabled.--SELECT-open {
|
|
2621
|
+
user-select: none;
|
|
2622
|
+
pointer-events: none;
|
|
2623
|
+
${q(e, "DISABLED_VALUE")};
|
|
2624
|
+
~ .--SELECT-label {
|
|
2625
|
+
${J(e, "DISABLED_VALUE")}
|
|
2626
|
+
}
|
|
2627
|
+
~ .--SELECT-fieldset {
|
|
2628
|
+
${K(e, "DISABLED_VALUE")}
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
.--SELECT-label {
|
|
2634
|
+
// FONT
|
|
2635
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
2636
|
+
font-size: 0.875rem; // 14px
|
|
2637
|
+
font-weight: 500;
|
|
2638
|
+
letter-spacing: 0.01em;
|
|
2639
|
+
line-height: normal;
|
|
2640
|
+
|
|
2641
|
+
padding: 0;
|
|
2642
|
+
display: block;
|
|
2643
|
+
white-space: nowrap;
|
|
2644
|
+
overflow: hidden;
|
|
2645
|
+
text-overflow: ellipsis;
|
|
2646
|
+
position: absolute;
|
|
2647
|
+
pointer-events: none;
|
|
2648
|
+
z-index: 4;
|
|
2649
|
+
|
|
2650
|
+
// ANIMATION
|
|
2651
|
+
transform: translate(14px, 0px);
|
|
2652
|
+
transition: 150ms ease-in-out;
|
|
2653
|
+
}
|
|
2654
|
+
|
|
2655
|
+
.--SELECT-fieldset {
|
|
2656
|
+
// Safari Firefox Chrome/Edge
|
|
2657
|
+
height: 100%;
|
|
2658
|
+
width: -webkit-fill-available;
|
|
2659
|
+
width: -moz-available;
|
|
2660
|
+
width: stretch;
|
|
2661
|
+
|
|
2662
|
+
text-align: left;
|
|
2663
|
+
position: absolute;
|
|
2664
|
+
margin: 0;
|
|
2665
|
+
padding: 0 6px;
|
|
2666
|
+
pointer-events: none;
|
|
2667
|
+
overflow: hidden;
|
|
2668
|
+
z-index: 5;
|
|
2669
|
+
box-sizing: border-box;
|
|
2670
|
+
${i(e, "border-radius", "--SELECT-ROOT-BORDER-RADIUS")};
|
|
2671
|
+
-webkit-tap-highlight-color: transparent;
|
|
2672
|
+
|
|
2673
|
+
.--SELECT-legend {
|
|
2674
|
+
width: auto;
|
|
2675
|
+
overflow: hidden;
|
|
2676
|
+
display: block;
|
|
2677
|
+
padding: 0;
|
|
2678
|
+
height: 0px;
|
|
2679
|
+
visibility: hidden;
|
|
2680
|
+
|
|
2681
|
+
// Animation
|
|
2682
|
+
max-width: 0px;
|
|
2683
|
+
transition: max-width 150ms ease-in-out;
|
|
2684
|
+
|
|
2685
|
+
.--SELECT-text {
|
|
2686
|
+
// FONT
|
|
2687
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
2688
|
+
font-size: 0.75rem; // 12px
|
|
2689
|
+
letter-spacing: 0.01em;
|
|
2690
|
+
font-weight: 500;
|
|
2691
|
+
padding: 0px 7px;
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
.--SELECT-adornment {
|
|
2697
|
+
display: flex;
|
|
2698
|
+
align-items: center;
|
|
2699
|
+
justify-content: center;
|
|
2700
|
+
height: 100%;
|
|
2701
|
+
width: 48px;
|
|
2702
|
+
min-width: 48px;
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
.--SELECT-helperText {
|
|
2707
|
+
// FONT
|
|
2708
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
2709
|
+
font-size: 0.75rem; // 12px
|
|
2710
|
+
line-height: 1;
|
|
2711
|
+
|
|
2712
|
+
display: block;
|
|
2713
|
+
margin-top: 8px;
|
|
2714
|
+
margin-left: 14px;
|
|
2715
|
+
height: 16px;
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
`, Ke = (e, t) => `
|
|
2719
|
+
// BACKGROUNDS
|
|
2720
|
+
${i(e, "background-color", `--SELECTMENU-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
2721
|
+
|
|
2722
|
+
// BORDERS
|
|
2723
|
+
${i(e, "border-color", `--SELECTMENU-EVENTS-${t}-BORDER-COLOR`)}
|
|
2724
|
+
${i(e, "border-width", `--SELECTMENU-EVENTS-${t}-BORDER-WIDTH`)}
|
|
2725
|
+
${i(e, "border-style", `--SELECTMENU-EVENTS-${t}-BORDER-STYLE`)}
|
|
2726
|
+
${i(e, "border-radius", `--SELECTMENU-EVENTS-${t}-BORDER-RADIUS`)}
|
|
2727
|
+
`, qe = (e, t) => `
|
|
2728
|
+
// TYPOGRAPHY
|
|
2729
|
+
${i(e, "color", `--SELECTMENU-EVENTS-${t}-COLOR-PRIMARY`)};
|
|
2730
|
+
${i(e, "caret-color", `--SELECTMENU-EVENTS-${t}-COLOR-PRIMARY`)};
|
|
2731
|
+
`, Je = (e, t) => `
|
|
2732
|
+
// BACKGROUNDS
|
|
2733
|
+
${i(e, "background-color", `--SELECTMENU-${t}-BACKGROUND-COLOR`)}
|
|
2734
|
+
|
|
2735
|
+
// BORDERS
|
|
2736
|
+
${i(e, "border-color", `--SELECTMENU-${t}-BORDER-COLOR`)}
|
|
2737
|
+
${i(e, "border-width", `--SELECTMENU-${t}-BORDER-WIDTH`)}
|
|
2738
|
+
${i(e, "border-style", `--SELECTMENU-${t}-BORDER-STYLE`)}
|
|
2739
|
+
${i(e, "border-radius", `--SELECTMENU-${t}-BORDER-RADIUS`)}
|
|
2740
|
+
`, Ye = (e) => T`
|
|
2741
|
+
&.--SELECTMENU {
|
|
2742
|
+
z-index: 100;
|
|
2743
|
+
position: absolute;
|
|
2744
|
+
top: calc(48px + ${e["--SELECTMENU-ROOT-TOP"] || ""});
|
|
2745
|
+
left: 0px;
|
|
2746
|
+
width: 100%;
|
|
2747
|
+
box-shadow:
|
|
2748
|
+
rgba(0, 0, 0, 0.2) 0px 5px 5px -3px,
|
|
2749
|
+
rgba(0, 0, 0, 0.14) 0px 8px 10px 1px,
|
|
2750
|
+
rgba(0, 0, 0, 0.12) 0px 3px 14px 2px;
|
|
2751
|
+
box-sizing: border-box;
|
|
2752
|
+
max-height: 126px; // 3 rows * 42px
|
|
2753
|
+
overflow-y: auto;
|
|
2754
|
+
cursor: pointer;
|
|
2755
|
+
${Je(e, "ROOT")}
|
|
2756
|
+
|
|
2757
|
+
// Animation
|
|
2758
|
+
display: none;
|
|
2759
|
+
opacity: 0;
|
|
2760
|
+
translate: 0px -10px;
|
|
2761
|
+
transition-property: display opacity;
|
|
2762
|
+
transition-duration: 150ms;
|
|
2763
|
+
transition-behavior: allow-discrete;
|
|
2764
|
+
|
|
2765
|
+
&.--SELECTMENU-open {
|
|
2766
|
+
display: block;
|
|
2767
|
+
opacity: 1;
|
|
2768
|
+
translate: 0px 0px;
|
|
2769
|
+
|
|
2770
|
+
@starting-style {
|
|
2771
|
+
opacity: 0;
|
|
2772
|
+
translate: 0px -10px;
|
|
2773
|
+
}
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
// ROW STYLES
|
|
2777
|
+
.--SELECTMENU-row:last-child,
|
|
2778
|
+
.--SELECTMENU-row:has(+ .--SELECTMENU-row:hover),
|
|
2779
|
+
.--SELECTMENU-row:has(+ .--SELECTMENU-selected) {
|
|
2780
|
+
// border-bottom: none;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
.--SELECTMENU-row {
|
|
2784
|
+
padding: 0px 24px;
|
|
2785
|
+
display: flex;
|
|
2786
|
+
flex-direction: column;
|
|
2787
|
+
gap: 2px;
|
|
2788
|
+
justify-content: center;
|
|
2789
|
+
border-top: none;
|
|
2790
|
+
border-left: none;
|
|
2791
|
+
border-right: none;
|
|
2792
|
+
height: 42px;
|
|
2793
|
+
box-sizing: border-box;
|
|
2794
|
+
|
|
2795
|
+
.--SELECTMENU-rowTitle {
|
|
2796
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
2797
|
+
${i(e, "color", "--SELECTMENU-ENABLED-FONT-PRIMARY")}
|
|
2798
|
+
font-size: 0.875rem; // 14px
|
|
2799
|
+
line-height: 1.5;
|
|
2800
|
+
text-overflow: ellipsis;
|
|
2801
|
+
overflow: hidden;
|
|
2802
|
+
white-space: nowrap;
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
.--SELECTMENU-rowDescription {
|
|
2806
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
2807
|
+
${i(e, "color", "--SELECTMENU-ENABLED-FONT-SECONDARY")}
|
|
2808
|
+
font-size: 0.75rem; // 12px
|
|
2809
|
+
line-height: 1;
|
|
2810
|
+
text-overflow: ellipsis;
|
|
2811
|
+
overflow: hidden;
|
|
2812
|
+
white-space: nowrap;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
// ENABLED
|
|
2816
|
+
${Ke(e, "ENABLED")}
|
|
2817
|
+
${qe(e, "ENABLED")}
|
|
2818
|
+
|
|
2819
|
+
// VALUE
|
|
2820
|
+
&.--SELECTMENU-selected {
|
|
2821
|
+
${Ke(e, "VALUE")}
|
|
2822
|
+
${qe(e, "VALUE")}
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
// HOVER
|
|
2826
|
+
&:hover {
|
|
2827
|
+
${Ke(e, "HOVER")}
|
|
2828
|
+
${qe(e, "HOVER")}
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
// - ACTIVE
|
|
2832
|
+
&:active,
|
|
2833
|
+
&.--SELECTMENU-active {
|
|
2834
|
+
${Ke(e, "ACTIVE")}
|
|
2835
|
+
${qe(e, "ACTIVE")}
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
// FOCUS
|
|
2839
|
+
&:focus-visible {
|
|
2840
|
+
outline-offset: 0px;
|
|
2841
|
+
outline: 0;
|
|
2842
|
+
${Ke(e, "FOCUS")}
|
|
2843
|
+
${qe(e, "FOCUS")}
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
&.--SELECTMENU-descriptionMenu {
|
|
2847
|
+
height: 52px;
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
&::-webkit-scrollbar {
|
|
2852
|
+
width: 12px;
|
|
2853
|
+
height: 4px;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
::-webkit-scrollbar-thumb {
|
|
2857
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
2858
|
+
border-radius: 9999px;
|
|
2859
|
+
border: 3px solid transparent;
|
|
2860
|
+
background-clip: padding-box;
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
&.--SELECTMENU-staticMenu {
|
|
2864
|
+
position: static;
|
|
2865
|
+
margin-top: 8px;
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
&.--SELECTMENU-descriptionMenu {
|
|
2869
|
+
max-height: 156px; // 3 rows * 52px
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
`, X = "--SELECTMENU", Xe = x.forwardRef(({ displayOptions: e, value: r, isOpen: i, hasStaticOptions: a, hasDescription: o, onChange: s, focusedElement: c, onScroll: l, style: u, className: d }, ee) => (ce(() => {
|
|
2873
|
+
document.getElementById(`${X}-option-${c}`)?.scrollIntoView({ block: "nearest" });
|
|
2874
|
+
}, [c]), /* @__PURE__ */ t("div", {
|
|
2875
|
+
id: `${X}-root`,
|
|
2876
|
+
className: [
|
|
2877
|
+
X,
|
|
2878
|
+
a ? `${X}-staticMenu` : "",
|
|
2879
|
+
o ? `${X}-descriptionMenu` : "",
|
|
2880
|
+
i && `${X}-open`,
|
|
2881
|
+
d || ""
|
|
2882
|
+
].join(" "),
|
|
2883
|
+
css: Ye(u),
|
|
2884
|
+
onScroll: l,
|
|
2885
|
+
role: "listbox",
|
|
2886
|
+
ref: ee,
|
|
2887
|
+
"data-testid": X,
|
|
2888
|
+
children: e.map((e, a) => {
|
|
2889
|
+
let l = e.value === r && i ? `${X}-selected` : "", u = c === a;
|
|
2890
|
+
return /* @__PURE__ */ n("div", {
|
|
2891
|
+
id: `${X}-option-${a}`,
|
|
2892
|
+
className: [
|
|
2893
|
+
`${X}-row`,
|
|
2894
|
+
l,
|
|
2895
|
+
`${X}-row`,
|
|
2896
|
+
o ? `${X}-descriptionMenu` : "",
|
|
2897
|
+
u ? `${X}-active` : ""
|
|
2898
|
+
].join(" "),
|
|
2899
|
+
onClick: () => s(e),
|
|
2900
|
+
role: "option",
|
|
2901
|
+
tabIndex: -1,
|
|
2902
|
+
"data-testid": `${X}-row-${e.label}`,
|
|
2903
|
+
children: [/* @__PURE__ */ t("span", {
|
|
2904
|
+
className: `${X}-rowTitle`,
|
|
2905
|
+
children: e.label
|
|
2906
|
+
}), o && /* @__PURE__ */ t("span", {
|
|
2907
|
+
className: `${X}-rowDescription`,
|
|
2908
|
+
children: e.description
|
|
2909
|
+
})]
|
|
2910
|
+
}, e.value);
|
|
2911
|
+
})
|
|
2912
|
+
}))), Ze = x.forwardRef(({ theme: n, ...r }, i) => {
|
|
2913
|
+
let { componentStyles: o } = e([a.SELECTMENU, a.SELECT], n);
|
|
2914
|
+
return /* @__PURE__ */ t(Xe, {
|
|
2915
|
+
...r,
|
|
2916
|
+
style: o,
|
|
2917
|
+
ref: i
|
|
2918
|
+
});
|
|
2919
|
+
});
|
|
2920
|
+
Ze.displayName = "SelectMenu";
|
|
2921
|
+
//#endregion
|
|
2922
|
+
//#region src/components/atoms/Select/Select.tsx
|
|
2923
|
+
var Z = "--SELECT", Qe = [], $e = ({ name: e, label: r, control: i, options: a, disabled: o, range: s = 100, hasStaticOptions: c = !1, hasSearch: l = !1, hasDescription: u = !1, hasPadding: d = !1, showErrorText: ee = !0, helperText: f, style: p, className: te, ...ne }) => {
|
|
2924
|
+
let { field: m, fieldState: h } = ue({
|
|
2925
|
+
control: i,
|
|
2926
|
+
name: e
|
|
2927
|
+
}), [g, re] = ae(m.value || ""), [_, v] = ae(!1), [y, ie] = ae(!1), x = C(null), oe = C(null), se = C(null), le = C(null), S = a.find((e) => e.value === g), T = h.error, de = u ? 156 : 126, [pe, me] = ae(S?.label || ""), [E, D] = w(1), [O, k] = w(!1), [A, he] = w(-1), [j, M] = ae("none"), N = _ || !!(l && pe && !g);
|
|
2928
|
+
b({
|
|
2929
|
+
ref: x,
|
|
2930
|
+
onAction: () => {
|
|
2931
|
+
l && pe && !g && me(""), v(!1);
|
|
2932
|
+
},
|
|
2933
|
+
isActive: N,
|
|
2934
|
+
exceptRef: oe
|
|
2935
|
+
});
|
|
2936
|
+
let P = (e) => {
|
|
2937
|
+
m.onChange(e.value), re(e.value), v(!1), ge();
|
|
2938
|
+
}, ge = () => m.onBlur(), _e = (e) => {
|
|
2939
|
+
e.target.select();
|
|
2940
|
+
}, ve = (e) => {
|
|
2941
|
+
e === "ArrowDown" && N ? he(A + 1 >= Qe.length ? 0 : A + 1) : e === "ArrowUp" && N && he(A - 1 < 0 ? Qe.length - 1 : A - 1);
|
|
2942
|
+
}, ye = (e) => {
|
|
2943
|
+
if (e.stopPropagation(), e.key === "Enter") if (e.preventDefault(), N && A >= 0) {
|
|
2944
|
+
M("keyboard");
|
|
2945
|
+
let e = Se()[A];
|
|
2946
|
+
e && P(e);
|
|
2947
|
+
} else v(!N);
|
|
2948
|
+
else e.key === "Tab" || e.key === "Escape" ? v(!1) : ["ArrowDown", "ArrowUp"].includes(e.key) && N && (e.preventDefault(), ve(e.key));
|
|
2949
|
+
}, be = (e) => {
|
|
2950
|
+
if (e.stopPropagation(), e.key === "Enter") if (e.preventDefault(), N && A >= 0) {
|
|
2951
|
+
M("button");
|
|
2952
|
+
let e = Se()[A];
|
|
2953
|
+
e && P(e);
|
|
2954
|
+
} else v(!N);
|
|
2955
|
+
else e.key === "Tab" || e.key === "Escape" ? v(!1) : ["ArrowDown", "ArrowUp"].includes(e.key) && (e.preventDefault(), se.current?.focus(), ve(e.key));
|
|
2956
|
+
}, F = (e) => {
|
|
2957
|
+
e.stopPropagation(), o || v(!N);
|
|
2958
|
+
}, xe = (e) => {
|
|
2959
|
+
e.preventDefault();
|
|
2960
|
+
let { scrollHeight: t, scrollTop: n } = e.target;
|
|
2961
|
+
n + de >= t && Se().length >= E * s && D(E + 1);
|
|
2962
|
+
}, I = (e) => {
|
|
2963
|
+
e.preventDefault();
|
|
2964
|
+
let { value: t } = e.target;
|
|
2965
|
+
t.length > 2 && D(1), me(t, () => k(!0)), v(!0);
|
|
2966
|
+
}, Se = () => {
|
|
2967
|
+
if (l && pe && pe.length > 2) {
|
|
2968
|
+
let e = a.slice(0, s * E);
|
|
2969
|
+
if (pe === S?.label && !O) return Qe = e, e;
|
|
2970
|
+
let t = a.filter((e) => e.label.toLocaleUpperCase().includes(pe.toLocaleUpperCase())).slice(0, s * E);
|
|
2971
|
+
return Qe = O ? t || [] : e, t || [];
|
|
2972
|
+
}
|
|
2973
|
+
return Qe = a.slice(0, s * E), a.slice(0, s * E);
|
|
2974
|
+
};
|
|
2975
|
+
return ce(() => {
|
|
2976
|
+
_ || (me(S?.label || ""), k(!1), he(-1), M("none"), y && ge()), _ && (j === "button" ? le.current?.focus() : j === "keyboard" && se.current?.focus(), ie(!0));
|
|
2977
|
+
}, [_]), /* @__PURE__ */ n("div", {
|
|
2978
|
+
className: [
|
|
2979
|
+
Z,
|
|
2980
|
+
d ? `${Z}-paddingBottom` : "",
|
|
2981
|
+
te || ""
|
|
2982
|
+
].join(" "),
|
|
2983
|
+
css: Ge(p),
|
|
2984
|
+
"data-testid": Z,
|
|
2985
|
+
children: [
|
|
2986
|
+
/* @__PURE__ */ n("div", {
|
|
2987
|
+
className: `${Z}-container`,
|
|
2988
|
+
onClick: F,
|
|
2989
|
+
onKeyDown: (e) => !o && ye(e),
|
|
2990
|
+
role: "button",
|
|
2991
|
+
ref: oe,
|
|
2992
|
+
"data-testid": `${Z}-container`,
|
|
2993
|
+
children: [
|
|
2994
|
+
/* @__PURE__ */ t("input", {
|
|
2995
|
+
name: e,
|
|
2996
|
+
className: [
|
|
2997
|
+
`${Z}-selectField`,
|
|
2998
|
+
N && `${Z}-open`,
|
|
2999
|
+
T && `${Z}-error`
|
|
3000
|
+
].join(" "),
|
|
3001
|
+
onClick: (e) => l && _e(e),
|
|
3002
|
+
onChange: I,
|
|
3003
|
+
value: pe,
|
|
3004
|
+
placeholder: " ",
|
|
3005
|
+
disabled: o,
|
|
3006
|
+
readOnly: !l,
|
|
3007
|
+
ref: se,
|
|
3008
|
+
role: "combobox",
|
|
3009
|
+
autoComplete: "off",
|
|
3010
|
+
"data-testid": `${Z}-selectField`,
|
|
3011
|
+
...l && { placeholder: "Search..." },
|
|
3012
|
+
...ne
|
|
3013
|
+
}),
|
|
3014
|
+
/* @__PURE__ */ t("div", {
|
|
3015
|
+
className: `${Z}-adornment`,
|
|
3016
|
+
children: /* @__PURE__ */ t(Ce, {
|
|
3017
|
+
icon: /* @__PURE__ */ t(fe, {}),
|
|
3018
|
+
onClick: F,
|
|
3019
|
+
onKeyDown: (e) => !o && be(e),
|
|
3020
|
+
disabled: o,
|
|
3021
|
+
isFlipped: !N,
|
|
3022
|
+
tabIndex: -1
|
|
3023
|
+
})
|
|
3024
|
+
}),
|
|
3025
|
+
/* @__PURE__ */ t("fieldset", {
|
|
3026
|
+
"aria-hidden": "true",
|
|
3027
|
+
className: `${Z}-fieldset`,
|
|
3028
|
+
children: /* @__PURE__ */ t("legend", {
|
|
3029
|
+
className: `${Z}-legend`,
|
|
3030
|
+
children: /* @__PURE__ */ t("span", {
|
|
3031
|
+
className: `${Z}-text`,
|
|
3032
|
+
children: r
|
|
3033
|
+
})
|
|
3034
|
+
})
|
|
3035
|
+
}),
|
|
3036
|
+
/* @__PURE__ */ t("span", {
|
|
3037
|
+
className: `${Z}-label`,
|
|
3038
|
+
children: r
|
|
3039
|
+
})
|
|
3040
|
+
]
|
|
3041
|
+
}),
|
|
3042
|
+
/* @__PURE__ */ n("span", {
|
|
3043
|
+
className: `${Z}-helperText`,
|
|
3044
|
+
"data-testid": `${Z}-helperText`,
|
|
3045
|
+
children: [f && (!T || !ee) && f, ee && T && T.message]
|
|
3046
|
+
}),
|
|
3047
|
+
/* @__PURE__ */ t(Ze, {
|
|
3048
|
+
displayOptions: N ? Se() : Qe,
|
|
3049
|
+
value: g,
|
|
3050
|
+
isOpen: N,
|
|
3051
|
+
hasStaticOptions: c,
|
|
3052
|
+
hasDescription: u,
|
|
3053
|
+
onChange: P,
|
|
3054
|
+
focusedElement: A,
|
|
3055
|
+
onScroll: xe,
|
|
3056
|
+
ref: x
|
|
3057
|
+
})
|
|
3058
|
+
]
|
|
3059
|
+
});
|
|
3060
|
+
}, et = ({ theme: n, ...r }) => {
|
|
3061
|
+
let { componentStyles: i } = e([a.SELECT], n);
|
|
3062
|
+
return /* @__PURE__ */ t($e, {
|
|
3063
|
+
...r,
|
|
3064
|
+
style: i
|
|
3065
|
+
});
|
|
3066
|
+
}, tt = (e, t) => `
|
|
3067
|
+
~ .--SLIDER-rail {
|
|
3068
|
+
${i(e, "background-color", `--SLIDER-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
3069
|
+
}
|
|
3070
|
+
`, nt = (e, t) => `
|
|
3071
|
+
~ .--SLIDER-tracker {
|
|
3072
|
+
// BACKGROUNDS
|
|
3073
|
+
${i(e, "background-color", `--SLIDER-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
3074
|
+
}
|
|
3075
|
+
`, rt = (e, t) => `
|
|
3076
|
+
~ .--SLIDER-thumbIcon {
|
|
3077
|
+
// UTILS
|
|
3078
|
+
${i(e, "background-color", `--SLIDER-EVENTS-${t}-ICON-BACKGROUND-COLOR`)}
|
|
3079
|
+
|
|
3080
|
+
// BORDERS
|
|
3081
|
+
${i(e, "border-color", `--SLIDER-EVENTS-${t}-BORDER-COLOR`)}
|
|
3082
|
+
${i(e, "border-width", `--SLIDER-EVENTS-${t}-BORDER-WIDTH`)}
|
|
3083
|
+
${i(e, "border-style", `--SLIDER-EVENTS-${t}-BORDER-STYLE`)}
|
|
3084
|
+
${i(e, "border-radius", `--SLIDER-EVENTS-${t}-BORDER-RADIUS`)}
|
|
3085
|
+
|
|
3086
|
+
|
|
3087
|
+
> svg {
|
|
3088
|
+
${i(e, "fill", `--SLIDER-EVENTS-${t}-ICON-COLOR`)};
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
`, it = (e) => T`
|
|
3092
|
+
&.--SLIDER {
|
|
3093
|
+
justify-content: center;
|
|
3094
|
+
display: flex;
|
|
3095
|
+
border-radius: 12px;
|
|
3096
|
+
box-sizing: content-box;
|
|
3097
|
+
position: relative;
|
|
3098
|
+
touch-action: none;
|
|
3099
|
+
-webkit-tap-highlight-color: transparent;
|
|
3100
|
+
height: 4px;
|
|
3101
|
+
width: 100%;
|
|
3102
|
+
padding: 8px 0px;
|
|
3103
|
+
|
|
3104
|
+
.--SLIDER-inputField {
|
|
3105
|
+
appearance: none;
|
|
3106
|
+
width: 100%;
|
|
3107
|
+
height: 0px;
|
|
3108
|
+
outline: none;
|
|
3109
|
+
position: absolute;
|
|
3110
|
+
pointer-events: none;
|
|
3111
|
+
cursor: default;
|
|
3112
|
+
z-index: 3;
|
|
3113
|
+
margin: 0px;
|
|
3114
|
+
|
|
3115
|
+
// ENABLED
|
|
3116
|
+
${tt(e, "ENABLED")};
|
|
3117
|
+
${rt(e, "ENABLED")};
|
|
3118
|
+
|
|
3119
|
+
// VALUE
|
|
3120
|
+
${nt(e, "VALUE")};
|
|
3121
|
+
|
|
3122
|
+
// HOVER
|
|
3123
|
+
@media (hover: hover) {
|
|
3124
|
+
:hover + .--SLIDER-ripple {
|
|
3125
|
+
opacity: 1;
|
|
3126
|
+
${i(e, "background-color", "--SLIDER-EVENTS-HOVER-BACKGROUND-COLOR")};
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
|
|
3130
|
+
// ACTIVE
|
|
3131
|
+
:active + .--SLIDER-ripple {
|
|
3132
|
+
opacity: 1;
|
|
3133
|
+
${i(e, "background-color", "--SLIDER-EVENTS-ACTIVE-BACKGROUND-COLOR")};
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
// FOCUS
|
|
3137
|
+
&:focus-visible + .--SLIDER-ripple + .--SLIDER-thumbIcon {
|
|
3138
|
+
${i(e, "outline-color", "--SLIDER-EVENTS-FOCUS-OUTLINE-COLOR")}
|
|
3139
|
+
${i(e, "outline-width", "--SLIDER-EVENTS-FOCUS-OUTLINE-WIDTH")}
|
|
3140
|
+
${i(e, "outline-style", "--SLIDER-EVENTS-FOCUS-OUTLINE-STYLE")}
|
|
3141
|
+
${i(e, "outline-offset", "--SLIDER-EVENTS-FOCUS-OUTLINE-OFFSET")}
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3144
|
+
// DISABLED
|
|
3145
|
+
&:disabled {
|
|
3146
|
+
&::-webkit-slider-thumb {
|
|
3147
|
+
pointer-events: none;
|
|
3148
|
+
}
|
|
3149
|
+
|
|
3150
|
+
${tt(e, "DISABLED")};
|
|
3151
|
+
${nt(e, "DISABLED_VALUE")};
|
|
3152
|
+
${rt(e, "DISABLED")};
|
|
3153
|
+
|
|
3154
|
+
~ .--SLIDER-mark {
|
|
3155
|
+
${i(e, "background-color", "--SLIDER-EVENTS-DISABLED_VALUE-BACKGROUND-COLOR")}
|
|
3156
|
+
}
|
|
3157
|
+
|
|
3158
|
+
~ .--SLIDER-mark.--SLIDER-mark--active {
|
|
3159
|
+
${i(e, "background-color", "--SLIDER-EVENTS-DISABLED-BACKGROUND-COLOR")}
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
|
|
3163
|
+
&::-webkit-slider-thumb {
|
|
3164
|
+
-webkit-appearance: none;
|
|
3165
|
+
appearance: none;
|
|
3166
|
+
cursor: pointer;
|
|
3167
|
+
border-radius: 50%;
|
|
3168
|
+
width: 24px;
|
|
3169
|
+
height: 24px;
|
|
3170
|
+
pointer-events: auto;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
|
|
3174
|
+
.--SLIDER-rail {
|
|
3175
|
+
display: block;
|
|
3176
|
+
position: absolute;
|
|
3177
|
+
border-radius: inherit;
|
|
3178
|
+
width: 100%;
|
|
3179
|
+
height: inherit;
|
|
3180
|
+
top: 50%;
|
|
3181
|
+
-webkit-transform: translateY(-50%);
|
|
3182
|
+
-moz-transform: translateY(-50%);
|
|
3183
|
+
-ms-transform: translateY(-50%);
|
|
3184
|
+
transform: translateY(-50%);
|
|
3185
|
+
cursor: pointer;
|
|
3186
|
+
}
|
|
3187
|
+
|
|
3188
|
+
.--SLIDER-tracker {
|
|
3189
|
+
border: none;
|
|
3190
|
+
display: block;
|
|
3191
|
+
position: absolute;
|
|
3192
|
+
border-radius: inherit;
|
|
3193
|
+
height: inherit;
|
|
3194
|
+
top: 50%;
|
|
3195
|
+
transform: translateY(-50%);
|
|
3196
|
+
z-index: 1;
|
|
3197
|
+
cursor: pointer;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
&.--SLIDER--clicking {
|
|
3201
|
+
.--SLIDER-thumbIcon,
|
|
3202
|
+
.--SLIDER-ripple {
|
|
3203
|
+
transition:
|
|
3204
|
+
left 150ms ease-in-out,
|
|
3205
|
+
top 150ms ease-in-out,
|
|
3206
|
+
background-color 150ms ease-in-out,
|
|
3207
|
+
opacity 150ms ease-in-out;
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
.--SLIDER-tracker {
|
|
3211
|
+
transition:
|
|
3212
|
+
left 150ms ease-in-out,
|
|
3213
|
+
right 150ms ease-in-out,
|
|
3214
|
+
width 150ms ease-in-out,
|
|
3215
|
+
top 150ms ease-in-out,
|
|
3216
|
+
bottom 150ms ease-in-out,
|
|
3217
|
+
height 150ms ease-in-out;
|
|
3218
|
+
}
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
&.--SLIDER--vertical {
|
|
3222
|
+
width: 4px;
|
|
3223
|
+
height: 100%;
|
|
3224
|
+
padding: 0px 8px;
|
|
3225
|
+
flex-direction: column;
|
|
3226
|
+
|
|
3227
|
+
.--SLIDER-inputField {
|
|
3228
|
+
width: 0px;
|
|
3229
|
+
height: 100%;
|
|
3230
|
+
writing-mode: vertical-lr;
|
|
3231
|
+
direction: rtl;
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
.--SLIDER-rail {
|
|
3235
|
+
width: inherit;
|
|
3236
|
+
height: 100%;
|
|
3237
|
+
left: 50%;
|
|
3238
|
+
top: 0;
|
|
3239
|
+
transform: translateX(-50%);
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
.--SLIDER-tracker {
|
|
3243
|
+
width: inherit;
|
|
3244
|
+
left: 50%;
|
|
3245
|
+
height: auto;
|
|
3246
|
+
top: auto;
|
|
3247
|
+
transform: translateX(-50%);
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
.--SLIDER-ripple {
|
|
3251
|
+
top: auto;
|
|
3252
|
+
left: 50%;
|
|
3253
|
+
transform: translateX(-50%);
|
|
3254
|
+
margin-left: 0;
|
|
3255
|
+
margin-top: -6px;
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
.--SLIDER-thumbIcon {
|
|
3259
|
+
top: auto;
|
|
3260
|
+
left: 50%;
|
|
3261
|
+
transform: translateX(-50%);
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
.--SLIDER-mark {
|
|
3265
|
+
top: auto;
|
|
3266
|
+
left: 50%;
|
|
3267
|
+
transform: translateX(-50%);
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
|
|
3271
|
+
.--SLIDER-mark {
|
|
3272
|
+
position: absolute;
|
|
3273
|
+
top: 50%;
|
|
3274
|
+
transform: translateY(-50%);
|
|
3275
|
+
width: 2px;
|
|
3276
|
+
height: 2px;
|
|
3277
|
+
border-radius: 50%;
|
|
3278
|
+
pointer-events: none;
|
|
3279
|
+
z-index: 1;
|
|
3280
|
+
${i(e, "background-color", "--SLIDER-EVENTS-VALUE-BACKGROUND-COLOR")}
|
|
3281
|
+
|
|
3282
|
+
&.--SLIDER-mark--active {
|
|
3283
|
+
${i(e, "background-color", "--SLIDER-EVENTS-ENABLED-BACKGROUND-COLOR")}
|
|
3284
|
+
}
|
|
3285
|
+
}
|
|
3286
|
+
|
|
3287
|
+
.--SLIDER-ripple {
|
|
3288
|
+
position: absolute;
|
|
3289
|
+
top: 50%;
|
|
3290
|
+
transform: translateY(-50%);
|
|
3291
|
+
margin-left: -6px;
|
|
3292
|
+
width: 36px;
|
|
3293
|
+
height: 36px;
|
|
3294
|
+
border-radius: 50%;
|
|
3295
|
+
pointer-events: none;
|
|
3296
|
+
z-index: 2;
|
|
3297
|
+
opacity: 0;
|
|
3298
|
+
transition:
|
|
3299
|
+
background-color 150ms ease-in-out,
|
|
3300
|
+
opacity 150ms ease-in-out;
|
|
3301
|
+
}
|
|
3302
|
+
|
|
3303
|
+
.--SLIDER-thumbIcon {
|
|
3304
|
+
position: absolute;
|
|
3305
|
+
top: 50%;
|
|
3306
|
+
transform: translateY(-50%);
|
|
3307
|
+
width: 24px;
|
|
3308
|
+
height: 24px;
|
|
3309
|
+
display: flex;
|
|
3310
|
+
align-items: center;
|
|
3311
|
+
justify-content: center;
|
|
3312
|
+
pointer-events: none;
|
|
3313
|
+
z-index: 4;
|
|
3314
|
+
border-radius: 50%;
|
|
3315
|
+
box-sizing: border-box;
|
|
3316
|
+
|
|
3317
|
+
> svg {
|
|
3318
|
+
width: 20px;
|
|
3319
|
+
height: 20px;
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
`, Q = "--SLIDER", at = ({ min: e = 0, max: i = Infinity, name: a, step: o = 25, distance: s = 0, disabled: c = !1, iconMin: l, iconMax: u, showMarks: d = !1, direction: ee = "horizontal", track: f = "normal", control: p, style: te }) => {
|
|
3324
|
+
let { field: ne } = ue({
|
|
3325
|
+
control: p,
|
|
3326
|
+
name: a
|
|
3327
|
+
}), m = ne.value ?? [e], h = m.length >= 2, g = C(null), re = C(void 0), _ = ee === "vertical", v = i !== Infinity && e !== i && o > 0 ? Array.from({ length: Math.round((i - e) / o) + 1 }, (t, n) => Math.min(e + n * o, i)) : [], y = v.length > 0, ie = (t) => y ? v.reduce((e, n) => Math.abs(n - t) <= Math.abs(e - t) ? n : e) : Math.max(e, Math.min(i, Math.round((t - e) / o) * o + e)), [b, ae] = w(() => y ? m.map(ie) : m), x = (e) => {
|
|
3328
|
+
ne.onChange(e), ae(e);
|
|
3329
|
+
}, oe = (e) => {
|
|
3330
|
+
let t = ie(parseFloat(e.target.value)), n = h ? Math.min(t, b[1] - s) : t;
|
|
3331
|
+
x(h ? [n, b[1]] : [n]);
|
|
3332
|
+
}, se = (e) => {
|
|
3333
|
+
let t = ie(parseFloat(e.target.value)), n = Math.max(t, b[0] + s);
|
|
3334
|
+
x([b[0], n]);
|
|
3335
|
+
}, ce = (t) => {
|
|
3336
|
+
if (!y) return;
|
|
3337
|
+
let n = b[0], r;
|
|
3338
|
+
if (t.key === "ArrowRight" || t.key === "ArrowUp" ? r = v.find((e) => e > n) ?? n : t.key === "ArrowLeft" || t.key === "ArrowDown" ? r = [...v].reverse().find((e) => e < n) ?? n : t.key === "Home" ? r = e : t.key === "End" && (r = h ? Math.min(i, b[1] - s) : i), r !== void 0 && r !== n) {
|
|
3339
|
+
t.preventDefault();
|
|
3340
|
+
let e = h ? Math.min(r, b[1] - s) : r;
|
|
3341
|
+
x(h ? [e, b[1]] : [e]);
|
|
3342
|
+
}
|
|
3343
|
+
}, le = (t) => {
|
|
3344
|
+
if (!y) return;
|
|
3345
|
+
let n = b[1], r;
|
|
3346
|
+
if (t.key === "ArrowRight" || t.key === "ArrowUp" ? r = v.find((e) => e > n) ?? n : t.key === "ArrowLeft" || t.key === "ArrowDown" ? r = [...v].reverse().find((e) => e < n) ?? n : t.key === "Home" ? r = Math.max(e, b[0] + s) : t.key === "End" && (r = i), r !== void 0 && r !== n) {
|
|
3347
|
+
t.preventDefault();
|
|
3348
|
+
let e = Math.max(r, b[0] + s);
|
|
3349
|
+
x([b[0], e]);
|
|
3350
|
+
}
|
|
3351
|
+
}, S = (t) => {
|
|
3352
|
+
if (c || i === Infinity || i === e) return;
|
|
3353
|
+
let n = g.current, r = n?.getBoundingClientRect();
|
|
3354
|
+
if (!r || !n) return;
|
|
3355
|
+
let a = ie(e + (_ ? Math.max(0, Math.min(1, (r.bottom - t.clientY) / r.height)) : Math.max(0, Math.min(1, (t.clientX - r.left) / r.width))) * (i - e));
|
|
3356
|
+
h ? Math.abs(a - b[0]) <= Math.abs(a - b[1]) ? x([Math.max(e, Math.min(a, b[1] - s)), b[1]]) : x([b[0], Math.min(i, Math.max(a, b[0] + s))]) : x([Math.max(e, Math.min(i, a))]), n.classList.add(`${Q}--clicking`), clearTimeout(re.current), re.current = setTimeout(() => n.classList.remove(`${Q}--clicking`), 150);
|
|
3357
|
+
}, T = (t) => i === e ? 0 : (t - e) / (i - e) * 100, de = (e) => {
|
|
3358
|
+
let t = T(e);
|
|
3359
|
+
return _ ? { top: `calc(${100 - t}% - ${(100 - t) / 100 * 24}px)` } : { left: `calc(${t}% - ${t / 100 * 24}px)` };
|
|
3360
|
+
}, fe = (e) => {
|
|
3361
|
+
let t = T(e);
|
|
3362
|
+
return _ ? { top: `calc(${100 - t}% - ${(100 - t) / 100 * 24}px + 11px)` } : { left: `calc(${t}% - ${t / 100 * 24}px + 11px)` };
|
|
3363
|
+
}, pe = () => {
|
|
3364
|
+
let e = b[0], t = b[1] ?? e, n = T(e), r = T(t), i = (e) => 12 - e / 100 * 24;
|
|
3365
|
+
return _ ? h ? f === "inverted" ? [{
|
|
3366
|
+
top: "0%",
|
|
3367
|
+
bottom: `calc(${r}% + ${i(r)}px)`
|
|
3368
|
+
}, {
|
|
3369
|
+
top: `calc(${100 - n}% - ${i(n)}px)`,
|
|
3370
|
+
bottom: "0%"
|
|
3371
|
+
}] : [{
|
|
3372
|
+
top: `calc(${100 - r}% - ${i(r)}px)`,
|
|
3373
|
+
bottom: `calc(${n}% + ${i(n)}px)`
|
|
3374
|
+
}] : f === "inverted" ? [{
|
|
3375
|
+
top: "0%",
|
|
3376
|
+
bottom: `calc(${n}% + ${i(n)}px)`
|
|
3377
|
+
}] : [{
|
|
3378
|
+
top: `calc(${100 - n}% - ${i(n)}px)`,
|
|
3379
|
+
bottom: "0%"
|
|
3380
|
+
}] : h ? f === "inverted" ? [{
|
|
3381
|
+
left: "0%",
|
|
3382
|
+
right: `calc(${100 - n}% - ${i(n)}px)`
|
|
3383
|
+
}, {
|
|
3384
|
+
left: `calc(${r}% + ${i(r)}px)`,
|
|
3385
|
+
right: "0%"
|
|
3386
|
+
}] : [{
|
|
3387
|
+
left: `calc(${n}% + ${i(n)}px)`,
|
|
3388
|
+
right: `calc(${100 - r}% - ${i(r)}px)`
|
|
3389
|
+
}] : f === "inverted" ? [{
|
|
3390
|
+
left: `calc(${n}% + ${i(n)}px)`,
|
|
3391
|
+
right: "0%"
|
|
3392
|
+
}] : [{
|
|
3393
|
+
left: "0%",
|
|
3394
|
+
right: `calc(${100 - n}% - ${i(n)}px)`
|
|
3395
|
+
}];
|
|
3396
|
+
}, me = (e) => h ? f === "inverted" ? e <= b[0] || e >= b[1] : e >= b[0] && e <= b[1] : f === "inverted" ? e >= b[0] : e <= b[0], E = y ? "any" : o;
|
|
3397
|
+
return /* @__PURE__ */ n("span", {
|
|
3398
|
+
ref: g,
|
|
3399
|
+
className: [Q, _ ? `${Q}--vertical` : ""].join(" "),
|
|
3400
|
+
css: it(te),
|
|
3401
|
+
"data-testid": Q,
|
|
3402
|
+
children: [
|
|
3403
|
+
/* @__PURE__ */ t("input", {
|
|
3404
|
+
className: `${Q}-inputField`,
|
|
3405
|
+
type: "range",
|
|
3406
|
+
min: e,
|
|
3407
|
+
max: i,
|
|
3408
|
+
step: E,
|
|
3409
|
+
value: b[0],
|
|
3410
|
+
onChange: oe,
|
|
3411
|
+
onKeyDown: ce,
|
|
3412
|
+
disabled: c,
|
|
3413
|
+
"data-testid": h ? `${Q}-minField` : `${Q}-field`
|
|
3414
|
+
}),
|
|
3415
|
+
/* @__PURE__ */ t("span", {
|
|
3416
|
+
className: `${Q}-ripple`,
|
|
3417
|
+
style: de(b[0]),
|
|
3418
|
+
"aria-hidden": "true"
|
|
3419
|
+
}),
|
|
3420
|
+
/* @__PURE__ */ t("span", {
|
|
3421
|
+
className: `${Q}-thumbIcon`,
|
|
3422
|
+
style: de(b[0]),
|
|
3423
|
+
"aria-hidden": "true",
|
|
3424
|
+
children: l
|
|
3425
|
+
}),
|
|
3426
|
+
h && /* @__PURE__ */ n(r, { children: [
|
|
3427
|
+
/* @__PURE__ */ t("input", {
|
|
3428
|
+
className: `${Q}-inputField`,
|
|
3429
|
+
type: "range",
|
|
3430
|
+
min: e,
|
|
3431
|
+
max: i,
|
|
3432
|
+
step: E,
|
|
3433
|
+
value: b[1],
|
|
3434
|
+
onChange: se,
|
|
3435
|
+
onKeyDown: le,
|
|
3436
|
+
disabled: c,
|
|
3437
|
+
"data-testid": `${Q}-maxField`
|
|
3438
|
+
}),
|
|
3439
|
+
/* @__PURE__ */ t("span", {
|
|
3440
|
+
className: `${Q}-ripple`,
|
|
3441
|
+
style: de(b[1]),
|
|
3442
|
+
"aria-hidden": "true"
|
|
3443
|
+
}),
|
|
3444
|
+
/* @__PURE__ */ t("span", {
|
|
3445
|
+
className: `${Q}-thumbIcon`,
|
|
3446
|
+
style: de(b[1]),
|
|
3447
|
+
"aria-hidden": "true",
|
|
3448
|
+
children: u
|
|
3449
|
+
})
|
|
3450
|
+
] }),
|
|
3451
|
+
/* @__PURE__ */ t("span", {
|
|
3452
|
+
className: `${Q}-rail`,
|
|
3453
|
+
onClick: S
|
|
3454
|
+
}),
|
|
3455
|
+
pe().map((e, n) => /* @__PURE__ */ t("span", {
|
|
3456
|
+
className: `${Q}-tracker`,
|
|
3457
|
+
onClick: S,
|
|
3458
|
+
style: e
|
|
3459
|
+
}, n)),
|
|
3460
|
+
d && v.map((e) => /* @__PURE__ */ t("span", {
|
|
3461
|
+
className: [`${Q}-mark`, me(e) && `${Q}-mark--active`].filter(Boolean).join(" "),
|
|
3462
|
+
style: fe(e),
|
|
3463
|
+
"aria-hidden": "true",
|
|
3464
|
+
onClick: S
|
|
3465
|
+
}, e))
|
|
3466
|
+
]
|
|
3467
|
+
});
|
|
3468
|
+
}, ot = ({ theme: n, ...r }) => {
|
|
3469
|
+
let { componentStyles: i } = e([a.SLIDER], n);
|
|
3470
|
+
return /* @__PURE__ */ t(at, {
|
|
3471
|
+
...r,
|
|
3472
|
+
style: i
|
|
3473
|
+
});
|
|
3474
|
+
}, st = (e, t) => `
|
|
3475
|
+
~ .--SWITCH-span {
|
|
3476
|
+
// BACKGROUNDS
|
|
3477
|
+
${i(e, "background-color", `--SWITCH-EVENTS-${t}-BACKGROUND-COLOR`)}
|
|
3478
|
+
}
|
|
3479
|
+
`, ct = (e, t) => `
|
|
3480
|
+
~ .--SWITCH-span {
|
|
3481
|
+
// BORDERS
|
|
3482
|
+
${i(e, "border-color", `--SWITCH-EVENTS-${t}-BORDER-COLOR`)}
|
|
3483
|
+
${i(e, "border-width", `--SWITCH-EVENTS-${t}-BORDER-WIDTH`)}
|
|
3484
|
+
${i(e, "border-style", `--SWITCH-EVENTS-${t}-BORDER-STYLE`)}
|
|
3485
|
+
${i(e, "border-radius", `--SWITCH-EVENTS-${t}-BORDER-RADIUS`)}
|
|
3486
|
+
}
|
|
3487
|
+
`, lt = (e, t) => `
|
|
3488
|
+
~ .--SWITCH-span {
|
|
3489
|
+
// OUTLINE
|
|
3490
|
+
${i(e, "outline-color", `--SWITCH-EVENTS-${t}-OUTLINE-COLOR`)}
|
|
3491
|
+
${i(e, "outline-width", `--SWITCH-EVENTS-${t}-OUTLINE-WIDTH`)}
|
|
3492
|
+
${i(e, "outline-style", `--SWITCH-EVENTS-${t}-OUTLINE-STYLE`)}
|
|
3493
|
+
${i(e, "outline-offset", `--SWITCH-EVENTS-${t}-OUTLINE-OFFSET`)}
|
|
3494
|
+
}
|
|
3495
|
+
`, ut = (e, t) => `
|
|
3496
|
+
// UTILS
|
|
3497
|
+
~ .--SWITCH-span > span {
|
|
3498
|
+
> svg > path {
|
|
3499
|
+
${i(e, "fill", `--SWITCH-EVENTS-${t}-ICON-COLOR`)};
|
|
3500
|
+
}
|
|
3501
|
+
|
|
3502
|
+
> .--SWITCH-shadow {
|
|
3503
|
+
${i(e, "background-color", `--SWITCH-EVENTS-${t}-ICON-BACKGROUND-COLOR`)};
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
`, dt = (e, t) => `
|
|
3507
|
+
// TYPOGRAPHY
|
|
3508
|
+
.--SWITCH-label {
|
|
3509
|
+
${i(e, "color", `--SWITCH-EVENTS-${t}-COLOR-PRIMARY`)}
|
|
3510
|
+
}
|
|
3511
|
+
|
|
3512
|
+
~ .--SWITCH-helperText {
|
|
3513
|
+
${i(e, "color", `--SWITCH-EVENTS-${t}-COLOR-SECONDARY`)}
|
|
3514
|
+
}
|
|
3515
|
+
`, ft = (e) => T`
|
|
3516
|
+
&.--SWITCH {
|
|
3517
|
+
display: flex;
|
|
3518
|
+
flex-direction: column;
|
|
3519
|
+
gap: 8px;
|
|
3520
|
+
width: fit-content;
|
|
3521
|
+
|
|
3522
|
+
.--SWITCH-container {
|
|
3523
|
+
display: flex;
|
|
3524
|
+
flex-direction: row;
|
|
3525
|
+
gap: 12px;
|
|
3526
|
+
align-items: center;
|
|
3527
|
+
cursor: pointer;
|
|
3528
|
+
|
|
3529
|
+
// ENABLED
|
|
3530
|
+
${dt(e, "ENABLED")};
|
|
3531
|
+
|
|
3532
|
+
// VALUE
|
|
3533
|
+
&:has(.--SWITCH-inputField:checked) {
|
|
3534
|
+
${dt(e, "VALUE")};
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
// HOVER
|
|
3538
|
+
&:has(.--SWITCH-inputField:hover) {
|
|
3539
|
+
${dt(e, "HOVER")};
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
// ACTIVE
|
|
3543
|
+
&:has(.--SWITCH-inputField.--SWITCH-active, .--SWITCH-inputField:active) {
|
|
3544
|
+
${dt(e, "ACTIVE")};
|
|
3545
|
+
}
|
|
3546
|
+
|
|
3547
|
+
// FOCUS-VISIBLE
|
|
3548
|
+
&:has(.--SWITCH-inputField:focus-visible) {
|
|
3549
|
+
${dt(e, "FOCUS")};
|
|
3550
|
+
}
|
|
3551
|
+
|
|
3552
|
+
// DISABLED
|
|
3553
|
+
&:has(.--SWITCH-inputField:disabled) {
|
|
3554
|
+
pointer-events: none;
|
|
3555
|
+
${dt(e, "DISABLED")};
|
|
3556
|
+
}
|
|
3557
|
+
|
|
3558
|
+
// DISABLED + VALUE
|
|
3559
|
+
&:has(.--SWITCH-inputField:disabled:checked) {
|
|
3560
|
+
${dt(e, "DISABLED_VALUE")};
|
|
3561
|
+
}
|
|
3562
|
+
|
|
3563
|
+
.--SWITCH-checkbox {
|
|
3564
|
+
position: relative;
|
|
3565
|
+
display: inline-flex;
|
|
3566
|
+
width: 48px;
|
|
3567
|
+
height: 24px;
|
|
3568
|
+
|
|
3569
|
+
.--SWITCH-inputField {
|
|
3570
|
+
cursor: pointer;
|
|
3571
|
+
position: absolute;
|
|
3572
|
+
opacity: 0;
|
|
3573
|
+
width: 100%;
|
|
3574
|
+
height: 100%;
|
|
3575
|
+
z-index: 2;
|
|
3576
|
+
margin: 0;
|
|
3577
|
+
-webkit-tap-highlight-color: transparent;
|
|
3578
|
+
|
|
3579
|
+
// ENABLED
|
|
3580
|
+
${st(e, "ENABLED")};
|
|
3581
|
+
${ct(e, "ENABLED")};
|
|
3582
|
+
${ut(e, "ENABLED")};
|
|
3583
|
+
|
|
3584
|
+
// VALUE
|
|
3585
|
+
&:checked {
|
|
3586
|
+
${st(e, "VALUE")};
|
|
3587
|
+
${ct(e, "VALUE")};
|
|
3588
|
+
${ut(e, "VALUE")};
|
|
3589
|
+
|
|
3590
|
+
~ .--SWITCH-span {
|
|
3591
|
+
.--SWITCH-iconOff {
|
|
3592
|
+
transform: translateX(27px);
|
|
3593
|
+
opacity: 0;
|
|
3594
|
+
}
|
|
3595
|
+
.--SWITCH-iconOn {
|
|
3596
|
+
transform: translateX(-3px);
|
|
3597
|
+
opacity: 1;
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
|
|
3602
|
+
// HOVER
|
|
3603
|
+
&:hover {
|
|
3604
|
+
~ .--SWITCH-span {
|
|
3605
|
+
.--SWITCH-iconOn,
|
|
3606
|
+
.--SWITCH-iconOff {
|
|
3607
|
+
&::before {
|
|
3608
|
+
opacity: 1;
|
|
3609
|
+
${i(e, "background-color", "--SWITCH-EVENTS-HOVER-SHADOW-COLOR")}
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
// ACTIVE
|
|
3616
|
+
&.--SWITCH-active,
|
|
3617
|
+
&:active {
|
|
3618
|
+
~ .--SWITCH-span {
|
|
3619
|
+
.--SWITCH-iconOn,
|
|
3620
|
+
.--SWITCH-iconOff {
|
|
3621
|
+
&::before {
|
|
3622
|
+
opacity: 1;
|
|
3623
|
+
${i(e, "background-color", "--SWITCH-EVENTS-ACTIVE-SHADOW-COLOR")}
|
|
3624
|
+
}
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
|
|
3629
|
+
// FOCUS
|
|
3630
|
+
&:focus-visible {
|
|
3631
|
+
outline: none;
|
|
3632
|
+
${lt(e, "FOCUS")};
|
|
3633
|
+
${ut(e, "FOCUS")};
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
// DISABLED
|
|
3637
|
+
&:disabled {
|
|
3638
|
+
${st(e, "DISABLED")};
|
|
3639
|
+
${ct(e, "DISABLED")};
|
|
3640
|
+
${ut(e, "DISABLED")};
|
|
3641
|
+
}
|
|
3642
|
+
|
|
3643
|
+
// DISABLED + VALUE
|
|
3644
|
+
&:disabled:checked {
|
|
3645
|
+
${st(e, "DISABLED_VALUE")};
|
|
3646
|
+
${ct(e, "DISABLED_VALUE")};
|
|
3647
|
+
${ut(e, "DISABLED_VALUE")};
|
|
3648
|
+
|
|
3649
|
+
~ .--SWITCH-span {
|
|
3650
|
+
.--SWITCH-iconOff {
|
|
3651
|
+
transform: translateX(27px);
|
|
3652
|
+
opacity: 0;
|
|
3653
|
+
}
|
|
3654
|
+
.--SWITCH-iconOn {
|
|
3655
|
+
transform: translateX(-3px);
|
|
3656
|
+
opacity: 1;
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
|
|
3662
|
+
.--SWITCH-span {
|
|
3663
|
+
width: 48px;
|
|
3664
|
+
height: 24px;
|
|
3665
|
+
${i(e, "border-radius", "--SWITCH-ROOT-BORDER-RADIUS")};
|
|
3666
|
+
position: relative;
|
|
3667
|
+
box-sizing: border-box;
|
|
3668
|
+
display: flex;
|
|
3669
|
+
align-items: center;
|
|
3670
|
+
transition: background-color 150ms ease-in-out;
|
|
3671
|
+
|
|
3672
|
+
.--SWITCH-iconOff,
|
|
3673
|
+
.--SWITCH-iconOn {
|
|
3674
|
+
position: absolute;
|
|
3675
|
+
display: flex;
|
|
3676
|
+
align-items: center;
|
|
3677
|
+
justify-content: center;
|
|
3678
|
+
border-radius: 50%;
|
|
3679
|
+
|
|
3680
|
+
height: min(16px, calc(100% - 6px));
|
|
3681
|
+
aspect-ratio: 1;
|
|
3682
|
+
|
|
3683
|
+
transition:
|
|
3684
|
+
transform 150ms ease-in-out,
|
|
3685
|
+
opacity 150ms ease-in-out;
|
|
3686
|
+
|
|
3687
|
+
&::before {
|
|
3688
|
+
content: '';
|
|
3689
|
+
position: absolute;
|
|
3690
|
+
width: 36px;
|
|
3691
|
+
height: 36px;
|
|
3692
|
+
border-radius: 50%;
|
|
3693
|
+
top: calc(50% - 18px);
|
|
3694
|
+
left: calc(50% - 18px);
|
|
3695
|
+
opacity: 0;
|
|
3696
|
+
z-index: -1;
|
|
3697
|
+
transition: opacity 150ms ease-in-out;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
> svg {
|
|
3701
|
+
width: 12px;
|
|
3702
|
+
height: 12px;
|
|
3703
|
+
max-width: 100%;
|
|
3704
|
+
max-height: 100%;
|
|
3705
|
+
position: absolute;
|
|
3706
|
+
z-index: 1;
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3709
|
+
.--SWITCH-shadow {
|
|
3710
|
+
position: absolute;
|
|
3711
|
+
width: 100%;
|
|
3712
|
+
height: 100%;
|
|
3713
|
+
border-radius: 50%;
|
|
3714
|
+
pointer-events: none;
|
|
3715
|
+
z-index: -1;
|
|
3716
|
+
transition: background-color 150ms ease-in-out;
|
|
3717
|
+
}
|
|
3718
|
+
}
|
|
3719
|
+
|
|
3720
|
+
.--SWITCH-iconOff {
|
|
3721
|
+
left: 0;
|
|
3722
|
+
transform: translateX(3px);
|
|
3723
|
+
opacity: 1;
|
|
3724
|
+
}
|
|
3725
|
+
.--SWITCH-iconOn {
|
|
3726
|
+
right: 0;
|
|
3727
|
+
transform: translateX(calc(-1 * 27px));
|
|
3728
|
+
opacity: 0;
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
.--SWITCH-label {
|
|
3735
|
+
// FONT
|
|
3736
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
3737
|
+
font-size: 0.875rem;
|
|
3738
|
+
font-weight: 500;
|
|
3739
|
+
line-height: 1;
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
.--SWITCH-helperText {
|
|
3743
|
+
// FONT
|
|
3744
|
+
font-family: ${e["--FONTFAMILY-PRIMARY"]};
|
|
3745
|
+
font-size: 13px;
|
|
3746
|
+
line-height: 16px;
|
|
3747
|
+
margin-left: 14px;
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3750
|
+
`, $ = "--SWITCH", pt = ({ name: e, control: r, iconOn: i, iconOff: a, disabled: o, label: s, helperText: c, className: l, style: u, ...d }) => {
|
|
3751
|
+
let [ee, f] = w(!1), { field: p, fieldState: te } = ue({
|
|
3752
|
+
control: r,
|
|
3753
|
+
name: e
|
|
3754
|
+
}), [ne, m] = w(p.value || !1), h = te.error, g = (e) => {
|
|
3755
|
+
p.onChange(e), m(e), h && y();
|
|
3756
|
+
}, re = (e) => {
|
|
3757
|
+
let { checked: t } = e.target;
|
|
3758
|
+
g(t);
|
|
3759
|
+
}, _ = (e) => {
|
|
3760
|
+
(e.key === "Enter" || e.key === "Space") && f(!0), d.onKeyDown?.(e);
|
|
3761
|
+
}, v = (e) => {
|
|
3762
|
+
(e.key === "Enter" || e.key === "Space") && (f(!1), g(!ne)), d.onKeyUp?.(e);
|
|
3763
|
+
}, y = () => p.onBlur();
|
|
3764
|
+
return /* @__PURE__ */ n("div", {
|
|
3765
|
+
className: [
|
|
3766
|
+
$,
|
|
3767
|
+
ee ? `${$}-active` : "",
|
|
3768
|
+
l || ""
|
|
3769
|
+
].join(" "),
|
|
3770
|
+
css: ft(u),
|
|
3771
|
+
"data-testid": $,
|
|
3772
|
+
children: [/* @__PURE__ */ n("label", {
|
|
3773
|
+
className: `${$}-container`,
|
|
3774
|
+
children: [/* @__PURE__ */ n("div", {
|
|
3775
|
+
className: `${$}-checkbox`,
|
|
3776
|
+
children: [/* @__PURE__ */ t("input", {
|
|
3777
|
+
className: [
|
|
3778
|
+
`${$}-inputField`,
|
|
3779
|
+
ee ? `${$}-active` : "",
|
|
3780
|
+
h && `${$}-error`
|
|
3781
|
+
].join(" "),
|
|
3782
|
+
type: "checkbox",
|
|
3783
|
+
value: e,
|
|
3784
|
+
checked: ne,
|
|
3785
|
+
disabled: o,
|
|
3786
|
+
onChange: re,
|
|
3787
|
+
onKeyDown: _,
|
|
3788
|
+
onKeyUp: v,
|
|
3789
|
+
onBlur: y,
|
|
3790
|
+
"data-testid": `${$}-inputField`,
|
|
3791
|
+
...d
|
|
3792
|
+
}), /* @__PURE__ */ n("span", {
|
|
3793
|
+
className: `${$}-span`,
|
|
3794
|
+
"data-testid": `${$}-icon`,
|
|
3795
|
+
children: [/* @__PURE__ */ n("span", {
|
|
3796
|
+
className: `${$}-iconOff`,
|
|
3797
|
+
children: [/* @__PURE__ */ t("span", { className: `${$}-shadow` }), a]
|
|
3798
|
+
}), /* @__PURE__ */ n("span", {
|
|
3799
|
+
className: `${$}-iconOn`,
|
|
3800
|
+
children: [/* @__PURE__ */ t("span", { className: `${$}-shadow` }), i]
|
|
3801
|
+
})]
|
|
3802
|
+
})]
|
|
3803
|
+
}), /* @__PURE__ */ t("span", {
|
|
3804
|
+
className: `${$}-label`,
|
|
3805
|
+
"data-testid": `${$}-label`,
|
|
3806
|
+
children: s
|
|
3807
|
+
})]
|
|
3808
|
+
}), (c || h) && /* @__PURE__ */ t("span", {
|
|
3809
|
+
className: `${$}-helperText`,
|
|
3810
|
+
"data-testid": `${$}-helperText`,
|
|
3811
|
+
children: h ? h.message : c
|
|
3812
|
+
})]
|
|
3813
|
+
});
|
|
3814
|
+
}, mt = ({ theme: n, ...r }) => {
|
|
3815
|
+
let { componentStyles: i } = e([a.SWITCH], n);
|
|
3816
|
+
return /* @__PURE__ */ t(pt, {
|
|
3817
|
+
...r,
|
|
3818
|
+
style: i
|
|
3819
|
+
});
|
|
3820
|
+
};
|
|
3821
|
+
//#endregion
|
|
3822
|
+
export { Pe as a, he as c, Ue as i, ot as n, ke as o, et as r, Ce as s, mt as t };
|
|
3823
|
+
|
|
3824
|
+
//# sourceMappingURL=Switch-BKf-QVlX.js.map
|