@foi/design-system 0.0.18 → 0.0.20

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