@yr3/ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +55 -0
  3. package/dist/components/Avatar/avatar.css +133 -0
  4. package/dist/components/Avatar/avatar.css.map +1 -0
  5. package/dist/components/Backdrop/backdrop.css +27 -0
  6. package/dist/components/Backdrop/backdrop.css.map +1 -0
  7. package/dist/components/Box/box.css +46 -0
  8. package/dist/components/Box/box.css.map +1 -0
  9. package/dist/components/Button/buttons.css +114 -0
  10. package/dist/components/Button/buttons.css.map +1 -0
  11. package/dist/components/Calendar/calendar.css +3 -0
  12. package/dist/components/Calendar/calendar.css.map +1 -0
  13. package/dist/components/Checkbox/checkbox.css +122 -0
  14. package/dist/components/Checkbox/checkbox.css.map +1 -0
  15. package/dist/components/Chip/chip.css +136 -0
  16. package/dist/components/Chip/chip.css.map +1 -0
  17. package/dist/components/Collapse/collapse.css +14 -0
  18. package/dist/components/Collapse/collapse.css.map +1 -0
  19. package/dist/components/Container/container.css +39 -0
  20. package/dist/components/Container/container.css.map +1 -0
  21. package/dist/components/Control/control.css +92 -0
  22. package/dist/components/Control/control.css.map +1 -0
  23. package/dist/components/Divider/divider.css +83 -0
  24. package/dist/components/Divider/divider.css.map +1 -0
  25. package/dist/components/Drawer/drawer.css +70 -0
  26. package/dist/components/Drawer/drawer.css.map +1 -0
  27. package/dist/components/Fade/fade.css +10 -0
  28. package/dist/components/Fade/fade.css.map +1 -0
  29. package/dist/components/Flex/flex.css +51 -0
  30. package/dist/components/Flex/flex.css.map +1 -0
  31. package/dist/components/Grid/Grid.css +67 -0
  32. package/dist/components/Grid/Grid.css.map +1 -0
  33. package/dist/components/Group/group.css +132 -0
  34. package/dist/components/Group/group.css.map +1 -0
  35. package/dist/components/Image/image.css +8 -0
  36. package/dist/components/Image/image.css.map +1 -0
  37. package/dist/components/ImageDropzone/image-dropzone.css +55 -0
  38. package/dist/components/ImageDropzone/image-dropzone.css.map +1 -0
  39. package/dist/components/Input/input.css +128 -0
  40. package/dist/components/Input/input.css.map +1 -0
  41. package/dist/components/InputArea/inputArea.css +88 -0
  42. package/dist/components/InputArea/inputArea.css.map +1 -0
  43. package/dist/components/Label/label.css +61 -0
  44. package/dist/components/Label/label.css.map +1 -0
  45. package/dist/components/Modal/modal.css +42 -0
  46. package/dist/components/Modal/modal.css.map +1 -0
  47. package/dist/components/Notistack/notistack.css +225 -0
  48. package/dist/components/Notistack/notistack.css.map +1 -0
  49. package/dist/components/Pending/pending.css +79 -0
  50. package/dist/components/Pending/pending.css.map +1 -0
  51. package/dist/components/Radio/radio.css +96 -0
  52. package/dist/components/Radio/radio.css.map +1 -0
  53. package/dist/components/Select/select.css +80 -0
  54. package/dist/components/Select/select.css.map +1 -0
  55. package/dist/components/Slide/slide.css +46 -0
  56. package/dist/components/Slide/slide.css.map +1 -0
  57. package/dist/components/Switch/switch.css +130 -0
  58. package/dist/components/Switch/switch.css.map +1 -0
  59. package/dist/components/Text/text.css +145 -0
  60. package/dist/components/Text/text.css.map +1 -0
  61. package/dist/index.d.mts +1592 -0
  62. package/dist/index.d.ts +1592 -0
  63. package/dist/index.js +2248 -0
  64. package/dist/index.mjs +2148 -0
  65. package/dist/styles/aminations.css +80 -0
  66. package/dist/styles/aminations.css.map +1 -0
  67. package/dist/styles/global.css +132 -0
  68. package/dist/styles/global.css.map +1 -0
  69. package/dist/styles/index.css +2332 -0
  70. package/dist/styles/index.css.map +1 -0
  71. package/package.json +62 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,2148 @@
1
+ // src/style-inject.ts
2
+ var ID = "yr3@ui";
3
+ function injectStyles() {
4
+ if (typeof document === "undefined") return;
5
+ if (document.getElementById(ID)) return;
6
+ if (typeof document !== "undefined" && typeof import.meta !== "undefined") {
7
+ const link = document.createElement("link");
8
+ link.rel = "stylesheet";
9
+ link.href = new URL("./styles/index.css", import.meta.url).toString();
10
+ document.head.appendChild(link);
11
+ }
12
+ }
13
+
14
+ // src/utils/bem.ts
15
+ var bem = (block) => {
16
+ return (element, modifiers) => {
17
+ const base = element ? `${block}__${element}` : block;
18
+ const classes = [base];
19
+ if (modifiers) {
20
+ Object.entries(modifiers).forEach(([key, value]) => {
21
+ if (!value) return;
22
+ if (typeof value === "boolean") {
23
+ classes.push(`${base}--${key}`);
24
+ } else {
25
+ classes.push(`${base}--${value}`);
26
+ }
27
+ });
28
+ }
29
+ return classes.join(" ");
30
+ };
31
+ };
32
+ var bemMerge = (...args) => {
33
+ return args.flatMap((arg) => {
34
+ if (!arg) return [];
35
+ if (typeof arg === "string") return [arg];
36
+ if (typeof arg === "object") {
37
+ return Object.entries(arg).filter(([_, v]) => v).map(([k]) => k);
38
+ }
39
+ return [];
40
+ }).join(" ");
41
+ };
42
+
43
+ // src/utils/calendar.ts
44
+ import dayjs from "dayjs";
45
+ function getMonthCalendar(year, month, startIndex, selected, props) {
46
+ const today = dayjs().startOf("day");
47
+ const startOfMonth = dayjs().year(year).month(month).startOf("month");
48
+ const endOfMonth = dayjs().year(year).month(month).endOf("month");
49
+ let dayCurrent = {};
50
+ let startDay = startOfMonth.day();
51
+ startDay = startDay === 0 ? 6 : startDay - 1;
52
+ const daysInMonth = endOfMonth.date();
53
+ const calendar = [];
54
+ let week = [];
55
+ for (let i = 0; i < startDay; i++) {
56
+ week.push(null);
57
+ }
58
+ for (let day = 1; day <= daysInMonth; day++) {
59
+ const date = startOfMonth.date(day);
60
+ const key = date.format("YYYY-MM-DD");
61
+ const isToday = date.isSame(today, "day");
62
+ const isPast = date.isBefore(today, "day");
63
+ const isFuture = date.isAfter(today, "day");
64
+ if (date.isSame(today, "day")) {
65
+ dayCurrent = {
66
+ day,
67
+ date,
68
+ isToday,
69
+ isPast,
70
+ isFuture,
71
+ isCurrentMonth: true,
72
+ selected: true,
73
+ data: props ? props[key] || null : null
74
+ };
75
+ }
76
+ week.push({
77
+ day,
78
+ date,
79
+ isToday,
80
+ isPast,
81
+ isFuture,
82
+ isCurrentMonth: true,
83
+ selected: selected ? date.isSame(selected?.date, "day") : false,
84
+ data: props ? props[key] || null : null
85
+ });
86
+ if (week.length === 7) {
87
+ calendar.push(week);
88
+ week = [];
89
+ }
90
+ }
91
+ if (week.length > 0) {
92
+ while (week.length < 7) {
93
+ week.push(null);
94
+ }
95
+ calendar.push(week);
96
+ }
97
+ function getDaysContainer() {
98
+ const base = [0, 1, 2, 3, 4, 5, 6];
99
+ return [
100
+ ...base.slice(startIndex),
101
+ ...base.slice(0, startIndex)
102
+ ];
103
+ }
104
+ return {
105
+ calendar,
106
+ month,
107
+ date: startOfMonth,
108
+ daysContainer: getDaysContainer(),
109
+ monthLabel: startOfMonth.format("MMMM"),
110
+ yearLabel: startOfMonth.format("YYYY"),
111
+ days: startOfMonth.daysInMonth(),
112
+ weeks: calendar.length,
113
+ isWeekend: startOfMonth.day() === 0 || startOfMonth.day() === 6,
114
+ selected: selected ? Object.assign({}, selected) : null,
115
+ currentDay: dayCurrent
116
+ };
117
+ }
118
+
119
+ // src/utils/color.ts
120
+ var adjustColor = (hex, amount) => {
121
+ const num = parseInt(hex.replace("#", ""), 16);
122
+ let r = (num >> 16) + amount;
123
+ let g = (num >> 8 & 255) + amount;
124
+ let b = (num & 255) + amount;
125
+ r = Math.max(Math.min(255, r), 0);
126
+ g = Math.max(Math.min(255, g), 0);
127
+ b = Math.max(Math.min(255, b), 0);
128
+ return `#${(r << 16 | g << 8 | b).toString(16).padStart(6, "0")}`;
129
+ };
130
+ var getContrast = (hex) => {
131
+ const c = hex.substring(1);
132
+ const rgb = parseInt(c, 16);
133
+ const r = rgb >> 16 & 255;
134
+ const g = rgb >> 8 & 255;
135
+ const b = rgb & 255;
136
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
137
+ return luminance > 0.5 ? "#000000" : "#ffffff";
138
+ };
139
+ var createPaletteColor = (main) => {
140
+ return {
141
+ main,
142
+ light: adjustColor(main, 40),
143
+ dark: adjustColor(main, -40),
144
+ contrastText: getContrast(main)
145
+ };
146
+ };
147
+
148
+ // src/utils/common.ts
149
+ function isEmpty(value) {
150
+ if (value == null) return true;
151
+ if (typeof value === "string") return value.trim().length === 0;
152
+ if (Array.isArray(value)) return value.length === 0;
153
+ if (value instanceof Map || value instanceof Set) {
154
+ return value.size === 0;
155
+ }
156
+ if (typeof value === "object") {
157
+ return Object.keys(value).length === 0;
158
+ }
159
+ return false;
160
+ }
161
+ function times(n, iteratee) {
162
+ const result = [];
163
+ for (let i = 0; i < n; i++) {
164
+ result.push(iteratee(i));
165
+ }
166
+ return result;
167
+ }
168
+
169
+ // src/utils/cx.ts
170
+ var cx = (...args) => {
171
+ return args.flatMap((arg) => {
172
+ if (!arg) return [];
173
+ if (typeof arg === "string") return [arg];
174
+ if (typeof arg === "object") {
175
+ return Object.entries(arg).filter(([_, value]) => value).map(([key]) => key);
176
+ }
177
+ return [];
178
+ }).join(" ");
179
+ };
180
+
181
+ // src/utils/ui.ts
182
+ var spacing = (value) => `${value * 8}px`;
183
+ var uiStyle = (styles = {}) => {
184
+ const result = {};
185
+ Object.entries(styles).forEach(([key, value]) => {
186
+ switch (key) {
187
+ case "mt":
188
+ result.marginTop = spacing(value);
189
+ break;
190
+ case "mb":
191
+ result.marginBottom = spacing(value);
192
+ break;
193
+ case "mx":
194
+ result.marginLeft = spacing(value);
195
+ result.marginRight = spacing(value);
196
+ break;
197
+ case "my":
198
+ result.marginTop = spacing(value);
199
+ result.marginBottom = spacing(value);
200
+ break;
201
+ case "p":
202
+ result.padding = spacing(value);
203
+ break;
204
+ case "px":
205
+ result.paddingLeft = spacing(value);
206
+ result.paddingRight = spacing(value);
207
+ break;
208
+ case "pt":
209
+ result.paddingTop = spacing(value);
210
+ break;
211
+ case "pb":
212
+ result.paddingBottom = spacing(value);
213
+ break;
214
+ case "py":
215
+ result.paddingTop = spacing(value);
216
+ result.paddingBottom = spacing(value);
217
+ break;
218
+ case "bg":
219
+ result.backgroundColor = `var(--color-${value})`;
220
+ break;
221
+ case "color":
222
+ result.color = `var(--color-${value})`;
223
+ break;
224
+ case "radius":
225
+ result.borderRadius = `${value * 4}px`;
226
+ break;
227
+ case "flex":
228
+ if (value) result.display = "flex";
229
+ break;
230
+ case "center":
231
+ if (value) {
232
+ result.display = "flex";
233
+ result.alignItems = "center";
234
+ result.justifyContent = "center";
235
+ }
236
+ break;
237
+ default:
238
+ result[key] = value;
239
+ }
240
+ });
241
+ return result;
242
+ };
243
+ var composeStyles = (ui, style) => {
244
+ return {
245
+ ...style,
246
+ ...uiStyle(ui)
247
+ };
248
+ };
249
+
250
+ // src/utils/variants.ts
251
+ var createVariants = (config) => {
252
+ return (props = {}) => {
253
+ const classes = [config.base];
254
+ if (config.variants) {
255
+ Object.entries(config.variants).forEach(([key, map]) => {
256
+ const value = props[key];
257
+ if (value && map[value]) {
258
+ classes.push(map[value]);
259
+ }
260
+ });
261
+ }
262
+ return classes.join(" ");
263
+ };
264
+ };
265
+
266
+ // src/theme/breakpoint.ts
267
+ var breakpoints = {
268
+ xs: 0,
269
+ sm: 600,
270
+ md: 900,
271
+ lg: 1200,
272
+ xl: 1536
273
+ };
274
+
275
+ // src/theme/text.ts
276
+ var text = {
277
+ h1: {
278
+ fontSize: "40px",
279
+ fontWeight: 700,
280
+ lineHeight: 1.2
281
+ },
282
+ h2: {
283
+ fontSize: "32px",
284
+ fontWeight: 600
285
+ },
286
+ h3: {
287
+ fontSize: "24px",
288
+ fontWeight: 500
289
+ },
290
+ h4: {
291
+ fontSize: "20px",
292
+ fontWeight: 500
293
+ },
294
+ h5: {
295
+ fontSize: "18px",
296
+ fontWeight: 500
297
+ },
298
+ h6: {
299
+ fontSize: "16px",
300
+ fontWeight: 500
301
+ },
302
+ title: {
303
+ fontSize: "20px",
304
+ fontWeight: 500
305
+ },
306
+ subtitle: {
307
+ fontSize: "18px",
308
+ fontWeight: 400
309
+ },
310
+ body1: {
311
+ fontSize: "16px",
312
+ fontWeight: 400
313
+ },
314
+ body2: {
315
+ fontSize: "14px",
316
+ fontWeight: 400
317
+ },
318
+ caption: {
319
+ fontSize: "12px",
320
+ fontWeight: 400
321
+ },
322
+ button: {
323
+ fontSize: "14px",
324
+ fontWeight: 500
325
+ },
326
+ helper: {
327
+ fontSize: "12px",
328
+ fontWeight: 400
329
+ }
330
+ };
331
+
332
+ // src/theme/createTheme.ts
333
+ var createTheme = (props) => {
334
+ const defaultTheme = {
335
+ colors: {
336
+ primary: createPaletteColor("#9262fb"),
337
+ secondary: createPaletteColor("#52f4a6"),
338
+ success: createPaletteColor("#28a745"),
339
+ error: createPaletteColor("#dc3545"),
340
+ warning: createPaletteColor("#ffc107"),
341
+ info: createPaletteColor("#17a2b8"),
342
+ disabled: "#aeaeae84",
343
+ background: {
344
+ default: "#0f0f1a",
345
+ surface: "#1a1a2e"
346
+ },
347
+ text: {
348
+ primary: "#ffffff",
349
+ secondary: "#2e2f2f"
350
+ }
351
+ },
352
+ breakpoints,
353
+ text,
354
+ fontFamily: "Inter, sans-serif"
355
+ };
356
+ return {
357
+ ...defaultTheme,
358
+ ...props,
359
+ colors: {
360
+ ...defaultTheme.colors,
361
+ ...props?.colors
362
+ },
363
+ breakpoints: {
364
+ ...defaultTheme.breakpoints,
365
+ ...props?.breakpoints
366
+ },
367
+ text: {
368
+ ...defaultTheme.text,
369
+ ...props?.text
370
+ },
371
+ fontFamily: props?.fontFamily || defaultTheme.fontFamily
372
+ };
373
+ };
374
+ var applyTheme = (theme, target) => {
375
+ const root = target || document.documentElement;
376
+ Object.entries(theme.colors).forEach(([key, value]) => {
377
+ if (typeof value === "object" && "main" in value) {
378
+ root.style.setProperty(`--color-${key}`, value.main);
379
+ root.style.setProperty(`--color-${key}-light`, value.light);
380
+ root.style.setProperty(`--color-${key}-dark`, value.dark);
381
+ root.style.setProperty(`--color-${key}-contrast`, value.contrastText);
382
+ }
383
+ });
384
+ if (theme.colors.background?.default) {
385
+ root.style.setProperty("--color-bg", theme.colors.background.default);
386
+ }
387
+ if (theme.colors.background?.surface) {
388
+ root.style.setProperty("--color-surface", theme.colors.background?.surface);
389
+ }
390
+ if (theme.colors.disabled) {
391
+ root.style.setProperty("--color-disabled", theme.colors.disabled);
392
+ }
393
+ if (theme.colors.text?.primary) {
394
+ root.style.setProperty("--color-text-primary", theme.colors.text?.primary);
395
+ }
396
+ if (theme.colors.text?.secondary) {
397
+ root.style.setProperty("--color-text-secondary", theme.colors.text?.secondary);
398
+ }
399
+ if (theme.breakpoints) {
400
+ Object.entries(theme.breakpoints).forEach(([key, value]) => {
401
+ document.documentElement.style.setProperty(
402
+ `--breakpoint-${key}`,
403
+ `${value}px`
404
+ );
405
+ });
406
+ }
407
+ Object.entries(theme.text).forEach(([key, value]) => {
408
+ Object.entries(value).forEach(([prop, val]) => {
409
+ document.documentElement.style.setProperty(
410
+ `--typo-${key}-${prop}`,
411
+ String(val)
412
+ );
413
+ });
414
+ });
415
+ if (theme.fontFamily) {
416
+ document.documentElement.style.setProperty(
417
+ "--font-family-base",
418
+ theme.fontFamily
419
+ );
420
+ }
421
+ };
422
+
423
+ // src/theme/initTheme.ts
424
+ function initTheme() {
425
+ if (typeof document === "undefined") return;
426
+ applyTheme(createTheme());
427
+ }
428
+
429
+ // src/components/Avatar/Avatar.tsx
430
+ import * as React from "react";
431
+
432
+ // src/components/Avatar/avatar.variants.ts
433
+ var avatarVariants = createVariants({
434
+ base: "yr3Avatar",
435
+ variants: {
436
+ color: {
437
+ primary: "yr3Avatar--color-primary",
438
+ secondary: "yr3Avatar--color-secondary",
439
+ success: "yr3Avatar--color-success",
440
+ disabled: "yr3Avatar--color-disabled",
441
+ text: "yr3Avatar--color-text",
442
+ warning: "yr3Avatar--color-warning",
443
+ info: "yr3Avatar--color-info",
444
+ error: "yr3Avatar--color-error"
445
+ },
446
+ size: {
447
+ sm: "yr3Avatar--sm",
448
+ md: "yr3Avatar--md",
449
+ lg: "yr3Avatar--lg"
450
+ },
451
+ variant: {
452
+ circle: "yr3Avatar--circle",
453
+ square: "yr3Avatar--square",
454
+ rounded: "yr3Avatar--rounded"
455
+ },
456
+ bordered: {
457
+ true: "yr3Avatar--bordered"
458
+ },
459
+ shadow: {
460
+ 0: "",
461
+ 1: "yr3Avatar--shadow-1",
462
+ 2: "yr3Avatar--shadow-2",
463
+ 3: "yr3Avatar--shadow-3"
464
+ },
465
+ floating: {
466
+ true: "yr3Avatar--floating"
467
+ }
468
+ }
469
+ });
470
+ var avatar_variants_default = avatarVariants;
471
+
472
+ // src/components/Avatar/Avatar.tsx
473
+ import { jsx } from "react/jsx-runtime";
474
+ var Avatar = ({
475
+ src,
476
+ alt,
477
+ children,
478
+ size = "sm",
479
+ variant = "circle",
480
+ color = "primary",
481
+ label,
482
+ bordered = true,
483
+ ui,
484
+ shadow = 0,
485
+ onClick,
486
+ floating = false,
487
+ role
488
+ }) => {
489
+ const [error, setError] = React.useState(false);
490
+ const showFallback = !src || error;
491
+ const className = avatar_variants_default({ size, variant, color, bordered, shadow, floating });
492
+ return /* @__PURE__ */ jsx("div", { className, style: uiStyle(ui), "data-testid": "yr3Avatar", role, onClick, children: !showFallback ? /* @__PURE__ */ jsx(
493
+ "img",
494
+ {
495
+ src,
496
+ alt,
497
+ onError: () => setError(true)
498
+ }
499
+ ) : /* @__PURE__ */ jsx("span", { className: "yr3Avatar--fallback", "data-testid": "yr3Avatar-fallback", children: children || label }) });
500
+ };
501
+
502
+ // src/components/Backdrop/Backdrop.tsx
503
+ import { createPortal } from "react-dom";
504
+
505
+ // src/theme/backdropContext.tsx
506
+ import * as React2 from "react";
507
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
508
+ var BackdropContext = React2.createContext(null);
509
+ var BackdropProvider = ({ children }) => {
510
+ const [open, setOpen] = React2.useState(false);
511
+ const show = () => setOpen(true);
512
+ const hide = () => setOpen(false);
513
+ return /* @__PURE__ */ jsxs(BackdropContext.Provider, { value: { open, show, hide }, children: [
514
+ children,
515
+ /* @__PURE__ */ jsx2(Backdrop, {})
516
+ ] });
517
+ };
518
+ var useBackdrop = () => {
519
+ const ctx = React2.useContext(BackdropContext);
520
+ if (!ctx) throw new Error("BackdropProvider missing");
521
+ return ctx;
522
+ };
523
+
524
+ // src/components/Backdrop/Backdrop.tsx
525
+ import { jsx as jsx3 } from "react/jsx-runtime";
526
+ var Backdrop = () => {
527
+ const { open } = useBackdrop();
528
+ return createPortal(
529
+ /* @__PURE__ */ jsx3("div", { className: `yr3Backdrop ${open ? "yr3Backdrop--open" : ""}`, "data-testid": "yr3Backdrop" }),
530
+ document.body
531
+ );
532
+ };
533
+
534
+ // src/components/Box/box.variants.ts
535
+ var boxVariants = createVariants({
536
+ base: "yr3Box",
537
+ variants: {
538
+ content: {
539
+ start: "yr3Box--content-start",
540
+ center: "yr3Box--content-center",
541
+ end: "yr3Box--content-end"
542
+ },
543
+ drawer: {
544
+ true: "yr3Box--drawer"
545
+ },
546
+ position: {
547
+ relative: "yr3Box--position-relative",
548
+ absolute: "yr3Box--position-absolute",
549
+ fixed: "yr3Box--position-fixed",
550
+ sticky: "yr3Box--position-sticky"
551
+ }
552
+ }
553
+ });
554
+
555
+ // src/components/Box/Box.tsx
556
+ import { jsx as jsx4 } from "react/jsx-runtime";
557
+ var Box = ({
558
+ content = "start",
559
+ children,
560
+ drawer = false,
561
+ ui,
562
+ style,
563
+ as: Component = "div",
564
+ position = "relative",
565
+ ...props
566
+ }) => {
567
+ const classes = boxVariants({ content, drawer, position });
568
+ return /* @__PURE__ */ jsx4(
569
+ Component,
570
+ {
571
+ className: classes,
572
+ style: composeStyles(ui, style),
573
+ ...props,
574
+ "data-testid": "yr3Box",
575
+ children
576
+ }
577
+ );
578
+ };
579
+
580
+ // src/components/Text/Text.tsx
581
+ import { jsx as jsx5 } from "react/jsx-runtime";
582
+ var Text = ({
583
+ children,
584
+ variant = "inherit",
585
+ color = "text",
586
+ as: Component = "p",
587
+ weight = "regular",
588
+ gutters = [0, 0],
589
+ ui = {},
590
+ style,
591
+ onClick
592
+ }) => {
593
+ const styleUI = uiStyle({ ...ui, marginTop: gutters[0] || 0, marginBottom: gutters[1] || 0 });
594
+ return /* @__PURE__ */ jsx5(
595
+ Component,
596
+ {
597
+ className: `
598
+ yr3Text
599
+ yr3Text--${variant}
600
+ yr3Text--${color}
601
+ ${weight ? `yr3Text--${weight}` : ""}
602
+
603
+ `,
604
+ style: composeStyles(styleUI, style),
605
+ onClick,
606
+ "data-testid": "yr3Text",
607
+ children
608
+ }
609
+ );
610
+ };
611
+
612
+ // src/components/Button/Button.variants.ts
613
+ var buttonVariant = createVariants({
614
+ base: "yr3Button",
615
+ variants: {
616
+ variant: {
617
+ filled: "yr3Button--filled",
618
+ outlined: "yr3Button--outlined",
619
+ text: "yr3Button--text"
620
+ },
621
+ color: {
622
+ primary: "yr3Button--color-primary",
623
+ secondary: "yr3Button--color-secondary",
624
+ success: "yr3Button--color-success",
625
+ text: "yr3Button--color-text",
626
+ disabled: "yr3Button--color-disabled"
627
+ },
628
+ size: {
629
+ auto: "yr3Button--size-auto",
630
+ full: "yr3Button--size-full"
631
+ },
632
+ gradientBorder: {
633
+ true: "yr3Button--gradientBorder"
634
+ },
635
+ disabled: {
636
+ true: "yr3Button--disabled"
637
+ },
638
+ animated: {
639
+ true: "yr3Button--animated"
640
+ }
641
+ }
642
+ });
643
+
644
+ // src/components/Button/Button.tsx
645
+ import { jsx as jsx6 } from "react/jsx-runtime";
646
+ var Button = ({ children, color = "text", variant = "text", animated, disabled, gradientBorder = false, size = "auto", ui, style, propsComponent, ...props }) => {
647
+ const buttonClassname = buttonVariant({ variant, color, animated, disabled, gradientBorder, size });
648
+ return /* @__PURE__ */ jsx6(
649
+ "button",
650
+ {
651
+ className: buttonClassname,
652
+ disabled,
653
+ "data-testid": "yr3Button",
654
+ ...props,
655
+ style: composeStyles(ui, style),
656
+ children: /* @__PURE__ */ jsx6(Text, { variant: propsComponent?.text?.variant || "button", children })
657
+ }
658
+ );
659
+ };
660
+
661
+ // src/components/Calendar/Calendar.tsx
662
+ import * as React3 from "react";
663
+ import dayjs2 from "dayjs";
664
+
665
+ // src/components/Flex/flex.variants.ts
666
+ var flexVariants = createVariants({
667
+ base: "yr3Flex",
668
+ variants: {
669
+ variant: {
670
+ row: "yr3Flex--row",
671
+ column: "yr3Flex--column",
672
+ wrap: "yr3Flex--wrap"
673
+ },
674
+ container: {
675
+ true: "yr3Flex--container"
676
+ },
677
+ center: {
678
+ true: "yr3Flex--center"
679
+ },
680
+ between: {
681
+ true: "yr3Flex--between"
682
+ },
683
+ bordered: {
684
+ true: "yr3Flex--bordered"
685
+ }
686
+ }
687
+ });
688
+ var flex_variants_default = flexVariants;
689
+
690
+ // src/components/Flex/Flex.tsx
691
+ import { jsx as jsx7 } from "react/jsx-runtime";
692
+ var Flex = ({
693
+ container = false,
694
+ spacing: spacing2 = 1,
695
+ children,
696
+ ui,
697
+ gap,
698
+ variant = "column",
699
+ center = false,
700
+ between = false,
701
+ style,
702
+ bordered = false,
703
+ ...props
704
+ }) => {
705
+ const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
706
+ return /* @__PURE__ */ jsx7(
707
+ "div",
708
+ {
709
+ className: classes,
710
+ style: composeStyles(ui, style),
711
+ ...props,
712
+ "data-testid": "yr3Flex",
713
+ children
714
+ }
715
+ );
716
+ };
717
+
718
+ // src/components/Grid/Grid.tsx
719
+ import { jsx as jsx8 } from "react/jsx-runtime";
720
+ var Grid = ({
721
+ container = false,
722
+ spacing: spacing2 = 0,
723
+ children,
724
+ columns = 12,
725
+ span = 1,
726
+ ui,
727
+ style,
728
+ item = false,
729
+ size = 0,
730
+ center = false,
731
+ ...props
732
+ }) => {
733
+ if (item) {
734
+ columns = 0;
735
+ }
736
+ if (container) {
737
+ columns = 0;
738
+ ui = {
739
+ ...ui,
740
+ gridTemplateColumns: `repeat(${columns}, 1fr)`
741
+ };
742
+ }
743
+ if (center) {
744
+ ui = {
745
+ ...ui,
746
+ justifyContent: "center",
747
+ alignItems: "center"
748
+ };
749
+ }
750
+ const classes = bem("yr3Grid");
751
+ const className = classes(void 0, { container, [`spacing-${spacing2}`]: center, span: item && `Col-${size}` });
752
+ return /* @__PURE__ */ jsx8(
753
+ "div",
754
+ {
755
+ className,
756
+ style: composeStyles(ui, style),
757
+ "data-testid": "yr3Grid",
758
+ ...props,
759
+ children
760
+ }
761
+ );
762
+ };
763
+
764
+ // src/components/Calendar/Calendar.tsx
765
+ import weekday from "dayjs/plugin/weekday";
766
+ import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
767
+ dayjs2.extend(weekday);
768
+ var initalPropsComponent = {
769
+ action: {
770
+ displayButtons: true,
771
+ displayCalendar: true,
772
+ day: {
773
+ background: "transparent",
774
+ borderColor: "transparent",
775
+ ui: {}
776
+ },
777
+ buttonNext: {
778
+ disabled: false,
779
+ label: "next"
780
+ },
781
+ buttonBack: {
782
+ disabled: false,
783
+ label: "back"
784
+ }
785
+ }
786
+ };
787
+ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar, onMonthChange }) => {
788
+ const month = dayjs2().month();
789
+ const [currentMonth, setCurrentMonth] = React3.useState(month);
790
+ const [selected, setSelected] = React3.useState(null);
791
+ const program = React3.useMemo(() => {
792
+ return getMonthCalendar(dayjs2().year(), currentMonth, 0, selected, mapCalendar);
793
+ }, [selected, currentMonth, mapCalendar]);
794
+ React3.useEffect(() => {
795
+ if (selected) {
796
+ onSelect && onSelect(selected);
797
+ } else {
798
+ onSelect && onSelect(program.currentDay);
799
+ }
800
+ }, [selected, program, onSelect]);
801
+ React3.useEffect(() => {
802
+ if (currentMonth) {
803
+ onMonthChange && onMonthChange(currentMonth);
804
+ }
805
+ }, [currentMonth]);
806
+ return /* @__PURE__ */ jsxs2(Flex, { container: true, center: true, variant: "column", gap: 2, "data-testid": "yr3Calendar", children: [
807
+ propsComponent.action?.displayButtons && /* @__PURE__ */ jsxs2(Flex, { variant: "row", container: true, ui: { justifyContent: "space-between", marginBottom: 16, width: "80dvw" }, children: [
808
+ /* @__PURE__ */ jsx9(Button, { disabled: propsComponent.action?.buttonBack?.disabled || false, color: "primary", onClick: () => setCurrentMonth(currentMonth - 1), children: propsComponent.action?.buttonBack?.label }),
809
+ /* @__PURE__ */ jsx9(Text, { variant: "h6", ui: { textTransform: "uppercase" }, children: program?.monthLabel }),
810
+ /* @__PURE__ */ jsx9(Button, { disabled: propsComponent.action?.buttonNext?.disabled, color: "primary", onClick: () => setCurrentMonth(currentMonth + 1), children: propsComponent.action?.buttonNext?.label })
811
+ ] }),
812
+ propsComponent.action?.displayCalendar && /* @__PURE__ */ jsxs2(Grid, { container: true, columns: 7, ui: { alignItems: "flex-start", justifyContent: "flex-start", width: "80dvw" }, spacing: 0, children: [
813
+ program?.daysContainer.map((i) => /* @__PURE__ */ jsx9(Flex, { variant: "wrap", center: true, ui: { width: 40, marginBottom: 5 }, children: /* @__PURE__ */ jsx9(Text, { variant: "caption", color: "primary", ui: { opacity: 0.7, textTransform: "uppercase" }, children: dayjs2().day(i + 1).format("dd") }) }, i)),
814
+ times(program.calendar.length, (i) => /* @__PURE__ */ jsx9(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */ jsx9(
815
+ Flex,
816
+ {
817
+ center: true,
818
+ ui: {
819
+ width: 40,
820
+ height: 20,
821
+ marginBottom: 5,
822
+ borderRadius: 4,
823
+ opacity: program.calendar[i][j]?.isPast ? 0.6 : 1,
824
+ border: "1px solid transparent",
825
+ background: propsComponent.action?.day?.background || "transparent",
826
+ borderColor: propsComponent.action?.day?.borderColor || "transparent",
827
+ ...propsComponent.action?.day?.ui
828
+ // background: program.calendar[i][j]?.isToday ? theme?.colors?.disabled as never:
829
+ // program.calendar[i][j]?.data ? theme?.colors?.secondary?.dark :
830
+ // 'transparent',
831
+ // borderColor: !program.calendar[i][j] ? 'transparent' :
832
+ // !selected && program.calendar[i][j]?.isToday ? theme?.colors?.primary?.main :
833
+ // program.calendar[i][j]?.selected ? theme?.colors.secondary?.main :
834
+ // !!program.calendar[i][j]?.isFuture ? theme?.colors.primary?.light :
835
+ // theme?.colors.disabled,
836
+ },
837
+ "data-testid": "yr3CalendarDay",
838
+ onClick: () => {
839
+ if (selected === program.calendar[i][j]) {
840
+ setSelected(null);
841
+ } else {
842
+ setSelected(program.calendar[i][j]);
843
+ }
844
+ },
845
+ children: /* @__PURE__ */ jsx9(
846
+ Text,
847
+ {
848
+ variant: "body2",
849
+ color: program.calendar[i][j]?.isFuture ? "text" : "text",
850
+ children: program.calendar[i][j]?.day || ""
851
+ }
852
+ )
853
+ },
854
+ j
855
+ )) }, i))
856
+ ] })
857
+ ] });
858
+ };
859
+
860
+ // src/components/Checkbox/Checkbox.tsx
861
+ import * as React4 from "react";
862
+ import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
863
+ var Checkbox = ({
864
+ checked,
865
+ defaultChecked,
866
+ onChange,
867
+ label,
868
+ color = "primary",
869
+ disabled,
870
+ propsComponent,
871
+ variant = "text"
872
+ }) => {
873
+ const [internal, setInternal] = React4.useState(defaultChecked || false);
874
+ const isControlled = checked !== void 0;
875
+ const value = isControlled ? checked : internal;
876
+ const handleChange = (e) => {
877
+ if (!isControlled) setInternal(e.target.checked);
878
+ onChange?.(e, e.target.checked);
879
+ };
880
+ const bemClasse = bem("yr3Checkbox");
881
+ const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}` });
882
+ const boxClasses = bem("yr3Checkbox-box");
883
+ const classesBox = boxClasses(void 0, { checked: !!value });
884
+ return /* @__PURE__ */ jsxs3("label", { className: classes, style: uiStyle(propsComponent?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
885
+ /* @__PURE__ */ jsx10(
886
+ "input",
887
+ {
888
+ type: "checkbox",
889
+ checked: value,
890
+ onChange: handleChange,
891
+ disabled,
892
+ "data-testid": "yr3Checkbox-input"
893
+ }
894
+ ),
895
+ /* @__PURE__ */ jsx10("span", { className: classesBox, "data-testid": "yr3Checkbox-box" }),
896
+ label && /* @__PURE__ */ jsx10(Text, { variant: "caption", color: !value ? propsComponent?.content?.color : color, ...propsComponent?.content, children: label })
897
+ ] });
898
+ };
899
+
900
+ // src/components/Chip/chip.variants.ts
901
+ var chipVariants = createVariants({
902
+ base: "yr3Chip",
903
+ variants: {
904
+ size: {
905
+ small: "yr3Chip--small",
906
+ medium: "yr3Chip--medium",
907
+ large: "yr3Chip--large"
908
+ },
909
+ variant: {
910
+ outlined: "yr3Chip--outlined",
911
+ filled: "yr3Chip--filled"
912
+ },
913
+ colors: {
914
+ primary: "yr3Chip--primary",
915
+ secondary: "yr3Chip--secondary",
916
+ success: "yr3Chip--success",
917
+ error: "yr3Chip--error",
918
+ warning: "yr3Chip--warning",
919
+ info: "yr3Chip--info"
920
+ },
921
+ rounded: {
922
+ true: "yr3Chip--rounded",
923
+ false: "yr3Chip--square"
924
+ }
925
+ }
926
+ });
927
+ var chip_variants_default = chipVariants;
928
+
929
+ // src/Icons/IconClose.tsx
930
+ import { jsx as jsx11 } from "react/jsx-runtime";
931
+ var IconClose = (props) => {
932
+ return /* @__PURE__ */ jsx11("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx11(
933
+ "path",
934
+ {
935
+ d: "M16 16L12 12M12 12L8 8M12 12L16 8M12 12L8 16",
936
+ stroke: props.stroke || "#fff",
937
+ strokeWidth: props.strokeWidth || "1.5",
938
+ strokeLinecap: "round",
939
+ strokeLinejoin: "round"
940
+ }
941
+ ) });
942
+ };
943
+
944
+ // src/components/Chip/Chip.tsx
945
+ import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
946
+ var Chip = ({ label, variant, color, icon, onDelete, rounded, size = "medium", ui, style, ...props }) => {
947
+ const className = chip_variants_default({ variant, colors: color, rounded, size });
948
+ return /* @__PURE__ */ jsxs4(
949
+ "div",
950
+ {
951
+ className,
952
+ "data-testid": "yr3Chip",
953
+ ...props,
954
+ style: {
955
+ ...style,
956
+ ...uiStyle(ui)
957
+ },
958
+ children: [
959
+ icon,
960
+ /* @__PURE__ */ jsx12("span", { className: "yr3Chip__label", children: label }),
961
+ onDelete && /* @__PURE__ */ jsx12("span", { className: "yr3Chip__delete", onClick: onDelete, role: "button", "aria-label": "delete", children: /* @__PURE__ */ jsx12(IconClose, { width: 20, height: 20, stroke: color }) })
962
+ ]
963
+ }
964
+ );
965
+ };
966
+
967
+ // src/components/Collapse/Collapse.tsx
968
+ import * as React5 from "react";
969
+ import { jsx as jsx13 } from "react/jsx-runtime";
970
+ var Collapse = ({ children, open, anchor }) => {
971
+ const ref = React5.useRef(null);
972
+ const [height, setHeight] = React5.useState(0);
973
+ React5.useEffect(() => {
974
+ if (ref.current) {
975
+ if (open) {
976
+ setHeight(ref.current.scrollHeight);
977
+ } else {
978
+ setHeight(0);
979
+ }
980
+ }
981
+ }, [open, children]);
982
+ return /* @__PURE__ */ jsx13("div", { className: `yr3Collapse yr3Collapse--${anchor}`, style: { height }, "data-testid": "yr3Collapse", children: /* @__PURE__ */ jsx13("div", { ref, className: "yr3Collapse__inner", children }) });
983
+ };
984
+
985
+ // src/components/Container/Container.tsx
986
+ import { jsx as jsx14 } from "react/jsx-runtime";
987
+ var Container = ({
988
+ children,
989
+ maxWidth = "sm",
990
+ ui,
991
+ style,
992
+ fixed = false
993
+ }) => {
994
+ const containerClassName = bem("yr3Container");
995
+ const classes = containerClassName(void 0, { maxWidth, static: fixed });
996
+ return /* @__PURE__ */ jsx14(
997
+ "div",
998
+ {
999
+ className: classes,
1000
+ style: composeStyles(ui, style),
1001
+ "data-testid": "yr3Container",
1002
+ children
1003
+ }
1004
+ );
1005
+ };
1006
+
1007
+ // src/theme/controlContext.tsx
1008
+ import * as React6 from "react";
1009
+ var ControlContext = React6.createContext(null);
1010
+ var useControl = () => React6.useContext(ControlContext);
1011
+
1012
+ // src/components/Control/Control.tsx
1013
+ import * as React7 from "react";
1014
+
1015
+ // src/components/Control/control.variants.ts
1016
+ var controlVariants = createVariants({
1017
+ base: "yr3Control",
1018
+ variants: {
1019
+ variant: {
1020
+ filled: "yr3Control--filled",
1021
+ outlined: "yr3Control--outlined",
1022
+ base: "yr3Control--base",
1023
+ lined: "yr3Control--lined"
1024
+ },
1025
+ color: {
1026
+ primary: "yr3Control--color-primary",
1027
+ secondary: "yr3Control--color-secondary",
1028
+ success: "yr3Control--color-success",
1029
+ text: "yr3Control--color-text",
1030
+ disabled: "yr3Control--color-disabled",
1031
+ info: "yr3Control--color-info",
1032
+ warning: "yr3Control--color-warning",
1033
+ error: "yr3Control--color-error"
1034
+ },
1035
+ size: {
1036
+ auto: "yr3Control--size-auto",
1037
+ full: "yr3Control--size-full"
1038
+ },
1039
+ rounded: {
1040
+ true: "yr3Control--rounded"
1041
+ },
1042
+ disabled: {
1043
+ true: "yr3Control--disabled"
1044
+ },
1045
+ animated: {
1046
+ true: "yr3Control--animated"
1047
+ },
1048
+ label: {
1049
+ true: "yr3Control--label"
1050
+ }
1051
+ }
1052
+ });
1053
+
1054
+ // src/components/Control/Control.tsx
1055
+ import { jsx as jsx15 } from "react/jsx-runtime";
1056
+ var Control = ({
1057
+ children,
1058
+ error = false,
1059
+ disabled = false,
1060
+ variant = "outlined",
1061
+ style,
1062
+ ui,
1063
+ color = "primary",
1064
+ label = true
1065
+ }) => {
1066
+ const [focused, setFocused] = React7.useState(false);
1067
+ const value = {
1068
+ focused,
1069
+ setFocused,
1070
+ error,
1071
+ disabled
1072
+ };
1073
+ const classes = controlVariants({ variant, color, label });
1074
+ return /* @__PURE__ */ jsx15(ControlContext.Provider, { value, children: /* @__PURE__ */ jsx15(
1075
+ "div",
1076
+ {
1077
+ className: classes,
1078
+ style: composeStyles(ui, style),
1079
+ "data-testid": "yr3Control",
1080
+ children
1081
+ }
1082
+ ) });
1083
+ };
1084
+
1085
+ // src/components/Divider/dividerVariants.ts
1086
+ var dividerVariants = createVariants({
1087
+ base: "yr3Divider",
1088
+ variants: {
1089
+ orientation: {
1090
+ horizontal: "yr3Divider--horizontal",
1091
+ vertical: "yr3Divider--vertical"
1092
+ },
1093
+ align: {
1094
+ left: "yr3Divider--left",
1095
+ center: "yr3Divider--center",
1096
+ right: "yr3Divider--right"
1097
+ },
1098
+ withText: {
1099
+ true: "yr3Divider--withText"
1100
+ },
1101
+ color: {
1102
+ primary: "yr3Divider--color-primary",
1103
+ secondary: "yr3Divider--color-secondary",
1104
+ success: "yr3Divider--color-success",
1105
+ disabled: "yr3Divider--color-disabled",
1106
+ text: "yr3Divider--color-text",
1107
+ warning: "yr3Divider--color-warning",
1108
+ info: "yr3Divider--color-info",
1109
+ error: "yr3Divider--color-error"
1110
+ }
1111
+ }
1112
+ });
1113
+ var dividerVariants_default = dividerVariants;
1114
+
1115
+ // src/components/Divider/Divider.tsx
1116
+ import { jsx as jsx16 } from "react/jsx-runtime";
1117
+ var Divider = ({
1118
+ orientation = "horizontal",
1119
+ text: text2,
1120
+ align = "center",
1121
+ ui,
1122
+ style,
1123
+ color = "primary"
1124
+ }) => {
1125
+ const classname = dividerVariants_default({ orientation, align, withText: !!text2, color });
1126
+ return /* @__PURE__ */ jsx16("div", { className: classname, style: composeStyles(ui, style), "data-testid": "yr3Divider", children: text2 && /* @__PURE__ */ jsx16("span", { className: "yr3Divider--text", "data-testid": "yr3Divider-text", children: text2 }) });
1127
+ };
1128
+
1129
+ // src/components/Drawer/Drawer.tsx
1130
+ import * as React8 from "react";
1131
+
1132
+ // src/components/Drawer/DrawerContainer.tsx
1133
+ import { jsx as jsx17 } from "react/jsx-runtime";
1134
+ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
1135
+ const { hide } = useBackdrop();
1136
+ const handleClose = () => {
1137
+ if (props === "container") {
1138
+ hide();
1139
+ onClose && onClose();
1140
+ }
1141
+ return;
1142
+ };
1143
+ return /* @__PURE__ */ jsx17("div", { className: "yr3Drawer--container", style: composeStyles(ui, style), onClick: handleClose, "data-testid": "yr3Drawer-container", children });
1144
+ };
1145
+ var DrawerContainer_default = DrawerContainer;
1146
+
1147
+ // src/hooks/useClickAway.ts
1148
+ import { useEffect as useEffect3 } from "react";
1149
+ var useClickAway = (ref, callback) => {
1150
+ useEffect3(() => {
1151
+ const handleClick = (e) => {
1152
+ if (!ref.current || ref.current.contains(e.target)) return;
1153
+ callback();
1154
+ };
1155
+ document.addEventListener("mousedown", handleClick);
1156
+ return () => {
1157
+ document.removeEventListener("mousedown", handleClick);
1158
+ };
1159
+ }, [ref, callback]);
1160
+ };
1161
+
1162
+ // src/components/Drawer/Drawer.tsx
1163
+ import { jsx as jsx18 } from "react/jsx-runtime";
1164
+ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
1165
+ const { show, hide } = useBackdrop();
1166
+ const ref = React8.useRef(null);
1167
+ React8.useEffect(() => {
1168
+ if (open) {
1169
+ show();
1170
+ }
1171
+ }, [open]);
1172
+ useClickAway(ref, () => {
1173
+ if (!open || propsComponent?.closing === null) return;
1174
+ if (propsComponent?.closing === "drawer") {
1175
+ hide();
1176
+ onClose();
1177
+ }
1178
+ ;
1179
+ });
1180
+ React8.useEffect(() => {
1181
+ if (propsComponent?.onClose) {
1182
+ hide();
1183
+ onClose();
1184
+ }
1185
+ }, [propsComponent?.onClose]);
1186
+ return /* @__PURE__ */ jsx18(
1187
+ "div",
1188
+ {
1189
+ className: `yr3Drawer ${anchor && `yr3Drawer--${anchor}`} ${open && "yr3Drawer--open"}`,
1190
+ style: propsComponent?.drawer,
1191
+ onClick: (e) => e.stopPropagation(),
1192
+ ref,
1193
+ "data-testid": "yr3Drawer",
1194
+ children: /* @__PURE__ */ jsx18(
1195
+ DrawerContainer_default,
1196
+ {
1197
+ children,
1198
+ ...propsComponent?.container,
1199
+ props: propsComponent?.closing,
1200
+ onClose: () => propsComponent?.closing === "container" ? onClose() : console.log("closing null")
1201
+ }
1202
+ )
1203
+ },
1204
+ "drawer_" + anchor
1205
+ );
1206
+ };
1207
+
1208
+ // src/components/Fade/Fade.tsx
1209
+ import * as React9 from "react";
1210
+ import { jsx as jsx19 } from "react/jsx-runtime";
1211
+ var Fade = ({
1212
+ in: inProp,
1213
+ children,
1214
+ duration = 200,
1215
+ onTransitionEnd,
1216
+ style
1217
+ }) => {
1218
+ React9.useEffect(() => {
1219
+ let timeoutId;
1220
+ if (inProp) {
1221
+ timeoutId = setTimeout(() => {
1222
+ onTransitionEnd && onTransitionEnd();
1223
+ }, duration);
1224
+ }
1225
+ return () => clearTimeout(timeoutId);
1226
+ }, [inProp, duration, onTransitionEnd]);
1227
+ return /* @__PURE__ */ jsx19(
1228
+ "div",
1229
+ {
1230
+ className: `yr3Fade ${inProp ? "yr3Fade--in" : ""}`,
1231
+ style: { ...style, transitionDuration: `${duration}ms` },
1232
+ "data-testid": "yr3Fade",
1233
+ children
1234
+ }
1235
+ );
1236
+ };
1237
+
1238
+ // src/components/Group/Group.tsx
1239
+ import * as React10 from "react";
1240
+
1241
+ // src/components/Group/group.variants.ts
1242
+ var groupVariants = createVariants({
1243
+ base: "yr3Group",
1244
+ variants: {
1245
+ variant: {
1246
+ filled: "yr3Group--filled",
1247
+ outlined: "yr3Group--outlined",
1248
+ text: "yr3Group--text"
1249
+ },
1250
+ color: {
1251
+ primary: "yr3Group--color-primary",
1252
+ secondary: "yr3Group--color-secondary",
1253
+ success: "yr3Group--color-success",
1254
+ error: "yr3Group--color-error",
1255
+ warning: "yr3Group--color-warning",
1256
+ info: "yr3Group--color-info",
1257
+ disabled: "yr3Group--color-disabled",
1258
+ text: "yr3Group--color-text",
1259
+ background: "yr3Group--color-background"
1260
+ }
1261
+ }
1262
+ });
1263
+
1264
+ // src/components/Group/Group.tsx
1265
+ import { jsx as jsx20 } from "react/jsx-runtime";
1266
+ var initialComponents = {
1267
+ group: {
1268
+ ui: {},
1269
+ style: {}
1270
+ },
1271
+ item: {
1272
+ ui: {},
1273
+ style: {}
1274
+ }
1275
+ };
1276
+ var Group = ({
1277
+ options,
1278
+ value,
1279
+ onChange,
1280
+ variant,
1281
+ color = "primary",
1282
+ propsComponent = initialComponents
1283
+ }) => {
1284
+ const [internalValue, setInternalValue] = React10.useState(null);
1285
+ const isControlled = value !== void 0;
1286
+ React10.useEffect(() => {
1287
+ if (isControlled) {
1288
+ setInternalValue(value);
1289
+ }
1290
+ }, [value, isControlled]);
1291
+ const classItems = bem("yr3Group--item");
1292
+ return /* @__PURE__ */ jsx20(
1293
+ "div",
1294
+ {
1295
+ className: groupVariants({ variant, color }),
1296
+ "data-testid": "yr3Group",
1297
+ style: composeStyles(propsComponent.group?.ui, propsComponent.group?.style),
1298
+ children: options.map((opt) => /* @__PURE__ */ jsx20(
1299
+ "div",
1300
+ {
1301
+ "data-testid": "yr3Group-item",
1302
+ className: classItems(void 0, { item: !!opt, active: internalValue === opt.value || Array.isArray(value) && value.includes(opt.value) }),
1303
+ onClick: () => onChange?.(opt.value),
1304
+ style: composeStyles(propsComponent.item?.ui, propsComponent.item?.style),
1305
+ children: opt.label
1306
+ },
1307
+ opt.value
1308
+ ))
1309
+ }
1310
+ );
1311
+ };
1312
+
1313
+ // src/components/Image/Image.tsx
1314
+ import { jsx as jsx21 } from "react/jsx-runtime";
1315
+ var Image = ({
1316
+ src,
1317
+ alt = "",
1318
+ ui,
1319
+ style
1320
+ }) => {
1321
+ return /* @__PURE__ */ jsx21(
1322
+ "img",
1323
+ {
1324
+ src,
1325
+ alt,
1326
+ className: "yr3Image",
1327
+ style: composeStyles(ui, style),
1328
+ "data-testid": "yr3Image"
1329
+ }
1330
+ );
1331
+ };
1332
+
1333
+ // src/components/Input/Input.tsx
1334
+ import * as React11 from "react";
1335
+
1336
+ // src/components/Label/Label.tsx
1337
+ import { jsx as jsx22 } from "react/jsx-runtime";
1338
+ var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
1339
+ const classes = bem("yr3Label");
1340
+ const classComponent = classes(void 0, { color: `color-${color}` });
1341
+ const classnames = bemMerge(classComponent, className);
1342
+ return /* @__PURE__ */ jsx22(
1343
+ "span",
1344
+ {
1345
+ className: classnames,
1346
+ "data-testid": "yr3Label",
1347
+ style: composeStyles(ui, style),
1348
+ children: text2 ? text2 : children
1349
+ }
1350
+ );
1351
+ };
1352
+
1353
+ // src/components/Input/input.variants.ts
1354
+ var inputVariants = createVariants({
1355
+ base: "yr3Input",
1356
+ variants: {
1357
+ variant: {
1358
+ filled: "yr3Input--filled",
1359
+ outlined: "yr3Input--outlined",
1360
+ base: "yr3Input--base",
1361
+ lined: "yr3Input--lined"
1362
+ },
1363
+ color: {
1364
+ primary: "yr3Input--color-primary",
1365
+ secondary: "yr3Input--color-secondary",
1366
+ success: "yr3Input--color-success",
1367
+ text: "yr3Input--color-text",
1368
+ disabled: "yr3Input--color-disabled",
1369
+ background: "yr3Input--color-background",
1370
+ error: "yr3Input--color-error",
1371
+ warning: "yr3Input--color-warning",
1372
+ info: "yr3Input--color-info"
1373
+ },
1374
+ size: {
1375
+ auto: "yr3Input--size-auto",
1376
+ full: "yr3Input--size-full"
1377
+ },
1378
+ rounded: {
1379
+ true: "yr3Input--rounded"
1380
+ },
1381
+ disabled: {
1382
+ true: "yr3Input--disabled"
1383
+ },
1384
+ animated: {
1385
+ true: "yr3Input--animated"
1386
+ },
1387
+ label: {
1388
+ true: "yr3Input--label"
1389
+ }
1390
+ }
1391
+ });
1392
+
1393
+ // src/components/Input/Input.tsx
1394
+ import { jsx as jsx23, jsxs as jsxs5 } from "react/jsx-runtime";
1395
+ var initiaPropsComponent = {
1396
+ label: {
1397
+ display: true,
1398
+ ui: {},
1399
+ style: {}
1400
+ }
1401
+ };
1402
+ var Input = React11.forwardRef(
1403
+ ({
1404
+ label,
1405
+ value,
1406
+ defaultValue,
1407
+ onChange,
1408
+ variant = "outlined",
1409
+ error = null,
1410
+ ui,
1411
+ style,
1412
+ propsComponent = initiaPropsComponent,
1413
+ type = "text",
1414
+ color = "primary",
1415
+ ...props
1416
+ }, ref) => {
1417
+ const [focused, setFocused] = React11.useState(false);
1418
+ const [internalValue, setInternalValue] = React11.useState(defaultValue);
1419
+ const [internalError, setInternalError] = React11.useState(null);
1420
+ const isControlled = value !== void 0;
1421
+ const currentValue = isControlled ? value : internalValue;
1422
+ const isActive = focused || !!currentValue;
1423
+ const checkPattern = (type2, value2) => {
1424
+ switch (type2) {
1425
+ case "email":
1426
+ return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
1427
+ case "phone":
1428
+ return /^\d{10}$/.test(value2);
1429
+ case "number":
1430
+ return /^\d+$/.test(value2);
1431
+ default:
1432
+ return true;
1433
+ }
1434
+ };
1435
+ const handleChange = (e) => {
1436
+ const newValue = e.target.value;
1437
+ const isValid = checkPattern(type, newValue);
1438
+ if (!isValid) {
1439
+ setInternalError("Valore non valido");
1440
+ } else {
1441
+ setInternalError(null);
1442
+ }
1443
+ if (!isControlled) {
1444
+ setInternalValue(newValue);
1445
+ }
1446
+ onChange?.(e, newValue);
1447
+ };
1448
+ const classes = inputVariants({ color, label: propsComponent?.label?.display });
1449
+ return /* @__PURE__ */ jsxs5(Control, { variant, color, label: propsComponent?.label?.display, children: [
1450
+ propsComponent?.label?.display && /* @__PURE__ */ jsx23(
1451
+ Label,
1452
+ {
1453
+ text: label || "",
1454
+ className: !!isActive ? "yr3Input--active" : "",
1455
+ color,
1456
+ ...propsComponent.label
1457
+ }
1458
+ ),
1459
+ /* @__PURE__ */ jsx23(
1460
+ "input",
1461
+ {
1462
+ ref,
1463
+ value: currentValue,
1464
+ type,
1465
+ autoComplete: "off",
1466
+ onChange: handleChange,
1467
+ onFocus: () => setFocused(true),
1468
+ onBlur: () => setFocused(false),
1469
+ className: classes,
1470
+ style: composeStyles(ui, style),
1471
+ ...props,
1472
+ "data-testid": "yr3Input"
1473
+ }
1474
+ ),
1475
+ /* @__PURE__ */ jsx23(Text, { variant: "helper", "data-testid": "yr3Input-helper", children: error || internalError || "" })
1476
+ ] });
1477
+ }
1478
+ );
1479
+
1480
+ // src/components/Input/InputPhone.tsx
1481
+ import * as React14 from "react";
1482
+
1483
+ // src/components/Select/Selector.tsx
1484
+ import * as React12 from "react";
1485
+
1486
+ // src/Icons/IconDown.tsx
1487
+ import { jsx as jsx24 } from "react/jsx-runtime";
1488
+ var IconDown = (props) => {
1489
+ return /* @__PURE__ */ jsx24("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "data-testid": "yr3Icons", children: /* @__PURE__ */ jsx24("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1490
+ };
1491
+
1492
+ // src/components/Select/Selector.tsx
1493
+ import { jsx as jsx25, jsxs as jsxs6 } from "react/jsx-runtime";
1494
+ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon }) => {
1495
+ const [open, setOpen] = React12.useState(false);
1496
+ const [valueState, setValueState] = React12.useState(value || defaultValue || null);
1497
+ const ref = React12.useRef(null);
1498
+ useClickAway(ref, () => setOpen(false));
1499
+ return /* @__PURE__ */ jsxs6("div", { className: "yr3Selector-wrapper", ref, children: [
1500
+ /* @__PURE__ */ jsx25("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ jsxs6("div", { className: "yr3Selector--control", children: [
1501
+ /* @__PURE__ */ jsx25("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ jsx25(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
1502
+ valueState
1503
+ ] }) }),
1504
+ open && /* @__PURE__ */ jsx25("div", { className: "yr3Select--menu", children: options.map((opt) => /* @__PURE__ */ jsx25(
1505
+ "div",
1506
+ {
1507
+ className: "yr3Select--option",
1508
+ onClick: (e) => {
1509
+ e.stopPropagation();
1510
+ setValueState(opt.value);
1511
+ setOpen(false);
1512
+ const event = {
1513
+ event: e,
1514
+ target: {
1515
+ name,
1516
+ value: opt.value
1517
+ },
1518
+ currentTarget: {
1519
+ name,
1520
+ value: opt.value
1521
+ }
1522
+ };
1523
+ onChange?.(event, opt.value);
1524
+ },
1525
+ children: opt.label
1526
+ },
1527
+ opt.value
1528
+ )) })
1529
+ ] });
1530
+ };
1531
+ var Selector_default = Selector;
1532
+
1533
+ // src/theme/ThemeProvider.tsx
1534
+ import * as React13 from "react";
1535
+ import { jsx as jsx26 } from "react/jsx-runtime";
1536
+ var ThemeContext = React13.createContext(null);
1537
+ var ThemeProvider = ({ theme, children }) => {
1538
+ React13.useEffect(() => {
1539
+ applyTheme(theme);
1540
+ }, [theme]);
1541
+ return /* @__PURE__ */ jsx26(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx26(BackdropProvider, { children }) });
1542
+ };
1543
+ var useTheme = () => React13.useContext(ThemeContext);
1544
+
1545
+ // src/components/Input/InputPhone.tsx
1546
+ import { jsx as jsx27, jsxs as jsxs7 } from "react/jsx-runtime";
1547
+ var Phone = ({
1548
+ name,
1549
+ value,
1550
+ onChange,
1551
+ prefix = "+39",
1552
+ label = "Phone",
1553
+ countries = [],
1554
+ propsComponent
1555
+ }) => {
1556
+ const [prefixValue, setPrefixValue] = React14.useState(prefix);
1557
+ const [number, setNumber] = React14.useState(Number(value) || null);
1558
+ const theme = useTheme();
1559
+ const handleChange = (newPrefix, newNumber) => {
1560
+ const full = `${newPrefix}${newNumber.toString()}`;
1561
+ const event = {
1562
+ target: {
1563
+ name,
1564
+ value: full
1565
+ }
1566
+ };
1567
+ onChange?.(event, full);
1568
+ };
1569
+ return /* @__PURE__ */ jsxs7(Control, { variant: "outlined", children: [
1570
+ /* @__PURE__ */ jsx27(Label, { text: label, className: "yr3Input--active" }),
1571
+ /* @__PURE__ */ jsx27("div", { className: "yr3PhoneInput", "data-testid": "yr3Phone", children: /* @__PURE__ */ jsxs7(Flex, { variant: "row", container: true, center: true, children: [
1572
+ /* @__PURE__ */ jsx27(
1573
+ Selector_default,
1574
+ {
1575
+ options: countries.map((c) => ({
1576
+ value: c.dial,
1577
+ label: c.code
1578
+ })),
1579
+ value: prefixValue,
1580
+ onChange: (_, val) => {
1581
+ setPrefixValue(val);
1582
+ handleChange(val, number);
1583
+ },
1584
+ ...propsComponent?.selector,
1585
+ ui: {
1586
+ ...propsComponent?.selector?.ui,
1587
+ padding: 4
1588
+ },
1589
+ style: propsComponent?.selector?.style
1590
+ }
1591
+ ),
1592
+ /* @__PURE__ */ jsx27(Divider, { orientation: "vertical", ...propsComponent?.divider }),
1593
+ /* @__PURE__ */ jsx27(
1594
+ Input,
1595
+ {
1596
+ type: "phone",
1597
+ variant: "base",
1598
+ value: number,
1599
+ ...propsComponent?.input,
1600
+ onChange: (e, value2) => {
1601
+ setNumber(value2);
1602
+ handleChange(prefixValue, value2);
1603
+ }
1604
+ }
1605
+ )
1606
+ ] }) })
1607
+ ] });
1608
+ };
1609
+
1610
+ // src/components/Input/InputPlaces.tsx
1611
+ import * as React15 from "react";
1612
+ import { useAutocompletePlaces } from "@yr3/autocomplete-places";
1613
+ import { jsx as jsx28, jsxs as jsxs8 } from "react/jsx-runtime";
1614
+
1615
+ // src/components/Modal/Modal.tsx
1616
+ import * as React16 from "react";
1617
+
1618
+ // src/components/Modal/ModalContainer.tsx
1619
+ import { jsx as jsx29 } from "react/jsx-runtime";
1620
+ var ModalContainer = ({ children, size = "sm", ui, style }) => {
1621
+ const classes = bem("yr3Modal-container");
1622
+ const classComponent = classes(void 0, { [`${size}`]: !!size });
1623
+ return /* @__PURE__ */ jsx29("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
1624
+ };
1625
+
1626
+ // src/components/Modal/Modal.tsx
1627
+ import { jsx as jsx30, jsxs as jsxs9 } from "react/jsx-runtime";
1628
+ var Modal = ({ open, onClose, children, propsComponent }) => {
1629
+ const { show, hide } = useBackdrop();
1630
+ React16.useEffect(() => {
1631
+ if (open) {
1632
+ show();
1633
+ } else {
1634
+ hide();
1635
+ }
1636
+ }, [open, show]);
1637
+ const classes = bem("yr3Modal");
1638
+ const classComponent = classes(void 0, { "open": !!open });
1639
+ return /* @__PURE__ */ jsx30("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ jsx30(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ jsxs9(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
1640
+ children,
1641
+ propsComponent?.close ? propsComponent.close : /* @__PURE__ */ jsx30(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
1642
+ ] }) }) });
1643
+ };
1644
+
1645
+ // src/components/Notistack/notistack.variants.ts
1646
+ var notistackVariants = createVariants({
1647
+ base: "yr3Notistack",
1648
+ variants: {
1649
+ type: {
1650
+ info: "yr3Notistack--info",
1651
+ success: "yr3Notistack--success",
1652
+ warning: "yr3Notistack--warning",
1653
+ error: "yr3Notistack--error"
1654
+ },
1655
+ color: {
1656
+ primary: "yr3Notistack--color-primary",
1657
+ secondary: "yr3Notistack--color-secondary",
1658
+ success: "yr3Notistack--color-success",
1659
+ disabled: "yr3Notistack--color-disabled",
1660
+ text: "yr3Notistack--color-text",
1661
+ warning: "yr3Notistack--color-warning",
1662
+ info: "yr3Notistack--color-info",
1663
+ error: "yr3Notistack--color-error"
1664
+ },
1665
+ direction: {
1666
+ "top-left": "yr3Notistack--top-left",
1667
+ "top-center": "yr3Notistack--top-center",
1668
+ "top-right": "yr3Notistack--top-right",
1669
+ "bottom-left": "yr3Notistack--bottom-left",
1670
+ "bottom-center": "yr3Notistack--bottom-center",
1671
+ "bottom-right": "yr3Notistack--bottom-right"
1672
+ },
1673
+ exiting: {
1674
+ true: "yr3Notistack--exit",
1675
+ false: "yr3Notistack--enter"
1676
+ }
1677
+ }
1678
+ });
1679
+
1680
+ // src/components/Notistack/Notistack.tsx
1681
+ import { jsx as jsx31, jsxs as jsxs10 } from "react/jsx-runtime";
1682
+ var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
1683
+ const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
1684
+ const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
1685
+ const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
1686
+ const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
1687
+ return /* @__PURE__ */ jsxs10("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
1688
+ /* @__PURE__ */ jsx31("span", { style: containerStyle, children: message }),
1689
+ /* @__PURE__ */ jsx31(
1690
+ "div",
1691
+ {
1692
+ className: "yr3Notistack--progress",
1693
+ style: { ...progressStyle, animationDuration: `${duration}ms` }
1694
+ }
1695
+ )
1696
+ ] });
1697
+ };
1698
+
1699
+ // src/components/Pending/pending.variants.ts
1700
+ var pendingVariants = createVariants({
1701
+ base: "yr3Pending",
1702
+ variants: {
1703
+ variant: {
1704
+ rect: "yr3Pending--rect",
1705
+ circle: "yr3Pending--circle",
1706
+ text: "yr3Pending--text"
1707
+ },
1708
+ color: {
1709
+ primary: "yr3Pending--color-primary",
1710
+ secondary: "yr3Pending--color-secondary",
1711
+ error: "yr3Pending--color-error",
1712
+ success: "yr3Pending--color-success",
1713
+ disabled: "yr3Pending--color-disabled",
1714
+ text: "yr3Pending--color-text",
1715
+ info: "yr3Pending--color-info",
1716
+ background: "yr3Pending--color-background",
1717
+ warning: "yr3Pending--color-warning"
1718
+ }
1719
+ }
1720
+ });
1721
+
1722
+ // src/components/Pending/Pending.tsx
1723
+ import { jsx as jsx32 } from "react/jsx-runtime";
1724
+ var Pending = ({
1725
+ variant,
1726
+ width,
1727
+ height,
1728
+ size,
1729
+ ui,
1730
+ color = "disabled",
1731
+ style
1732
+ }) => {
1733
+ const widthStyle = variant === "circle" ? size : width;
1734
+ const heightStyle = variant === "circle" ? size : height;
1735
+ const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
1736
+ return /* @__PURE__ */ jsx32(
1737
+ "div",
1738
+ {
1739
+ className: pendingVariants({ variant, color }),
1740
+ style: composeStyles(uiStylePending, style),
1741
+ "data-testid": "yr3Pending"
1742
+ }
1743
+ );
1744
+ };
1745
+
1746
+ // src/components/Radio/radio.variants.ts
1747
+ var radioVariant = createVariants({
1748
+ base: "yr3Radio",
1749
+ variants: {
1750
+ variant: {
1751
+ circle: "yr3Radio--variant-circle",
1752
+ square: "yr3Radio--variant-square"
1753
+ },
1754
+ color: {
1755
+ primary: "yr3Radio--color-primary",
1756
+ secondary: "yr3Radio--color-secondary",
1757
+ success: "yr3Radio--color-success",
1758
+ text: "yr3Radio--color-text",
1759
+ disabled: "yr3Radio--color-disabled"
1760
+ }
1761
+ }
1762
+ });
1763
+
1764
+ // src/components/Radio/Radio.tsx
1765
+ import { jsx as jsx33, jsxs as jsxs11 } from "react/jsx-runtime";
1766
+ var Radio = ({
1767
+ checked,
1768
+ value,
1769
+ name,
1770
+ onChange,
1771
+ label,
1772
+ color = "primary",
1773
+ variant = "circle",
1774
+ iconChecked,
1775
+ iconUnchecked,
1776
+ propsComponent
1777
+ }) => {
1778
+ const bemClass = bem("yr3Radio");
1779
+ const classes = bemClass(void 0, { [color]: `color-${color}` });
1780
+ const variantClass = radioVariant({ variant });
1781
+ return /* @__PURE__ */ jsxs11("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
1782
+ /* @__PURE__ */ jsx33(
1783
+ "input",
1784
+ {
1785
+ type: "radio",
1786
+ checked,
1787
+ name,
1788
+ value,
1789
+ onChange: (e) => onChange?.(e, value),
1790
+ "data-testid": "yr3Radio-input"
1791
+ }
1792
+ ),
1793
+ iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
1794
+ !iconChecked && !iconUnchecked && /* @__PURE__ */ jsx33("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
1795
+ typeof label === "string" && /* @__PURE__ */ jsx33(
1796
+ "span",
1797
+ {
1798
+ className: "yr3Radio--label",
1799
+ "data-testid": "yr3Radio-label",
1800
+ style: composeStyles(propsComponent?.label?.ui, propsComponent?.label?.style),
1801
+ children: label
1802
+ }
1803
+ ) || label
1804
+ ] });
1805
+ };
1806
+
1807
+ // src/components/Select/Select.tsx
1808
+ import * as React17 from "react";
1809
+ import { jsx as jsx34, jsxs as jsxs12 } from "react/jsx-runtime";
1810
+ var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
1811
+ const [open, setOpen] = React17.useState(false);
1812
+ const [valueState, setValueState] = React17.useState(value || defaultValue || null);
1813
+ const ref = React17.useRef(null);
1814
+ useClickAway(ref, () => setOpen(false));
1815
+ return /* @__PURE__ */ jsxs12(Control, { ...propsComponent?.control, children: [
1816
+ /* @__PURE__ */ jsx34(
1817
+ Label,
1818
+ {
1819
+ ...propsComponent?.label,
1820
+ text: label || "seleziona",
1821
+ className: open || valueState ? "yr3Input--active" : ""
1822
+ }
1823
+ ),
1824
+ /* @__PURE__ */ jsxs12("div", { className: "yr3Select-wrapper", ref, children: [
1825
+ /* @__PURE__ */ jsxs12("div", { className: `yr3Select ${open ? "yr3Select--open" : ""}`, "data-testid": "yr3Select-wrapper", style: composeStyles(propsComponent?.wrapper?.ui, propsComponent?.wrapper?.style), children: [
1826
+ /* @__PURE__ */ jsx34("div", { className: "yr3Select--control", children: valueState }),
1827
+ /* @__PURE__ */ jsx34("div", { className: "yr3Select--icon", onClick: () => setOpen((prev) => !prev), "data-testid": "yr3Select-icon", children: propsComponent?.icon?.component ? propsComponent.icon.component : /* @__PURE__ */ jsx34(
1828
+ IconDown,
1829
+ {
1830
+ width: propsComponent?.icon?.style?.width || 26,
1831
+ height: propsComponent?.icon?.style?.height || 26,
1832
+ stroke: propsComponent?.icon?.style?.stroke || "currentColor",
1833
+ style: propsComponent?.icon?.style
1834
+ }
1835
+ ) })
1836
+ ] }),
1837
+ open && /* @__PURE__ */ jsx34(
1838
+ "div",
1839
+ {
1840
+ className: "yr3Select--menu",
1841
+ style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
1842
+ "data-testid": "yr3Select-menu",
1843
+ children: options.map((opt) => /* @__PURE__ */ jsx34(
1844
+ "div",
1845
+ {
1846
+ className: "yr3Select--option",
1847
+ onClick: (e) => {
1848
+ e.stopPropagation();
1849
+ setValueState(opt.value);
1850
+ setOpen(false);
1851
+ const event = {
1852
+ event: e,
1853
+ target: {
1854
+ name,
1855
+ value: opt.value
1856
+ },
1857
+ currentTarget: {
1858
+ name,
1859
+ value: opt.value
1860
+ }
1861
+ };
1862
+ onChange?.(event, opt.value);
1863
+ },
1864
+ children: opt.label
1865
+ },
1866
+ opt.value
1867
+ ))
1868
+ }
1869
+ )
1870
+ ] })
1871
+ ] });
1872
+ };
1873
+
1874
+ // src/components/Slide/Slide.tsx
1875
+ import * as React18 from "react";
1876
+ import { jsx as jsx35 } from "react/jsx-runtime";
1877
+ var Slide = ({
1878
+ in: inProp,
1879
+ children,
1880
+ direction = "left",
1881
+ duration = 300,
1882
+ onTransitionEnd,
1883
+ propsComponent
1884
+ }) => {
1885
+ const bemContent = bem("yr3Slide--content");
1886
+ const classNameContent = bemContent(void 0, {
1887
+ [direction]: true,
1888
+ "in": !!inProp
1889
+ });
1890
+ React18.useEffect(() => {
1891
+ let timeoutId;
1892
+ if (inProp) {
1893
+ timeoutId = setTimeout(() => {
1894
+ onTransitionEnd && onTransitionEnd();
1895
+ }, duration);
1896
+ }
1897
+ return () => clearTimeout(timeoutId);
1898
+ }, [inProp, duration, onTransitionEnd]);
1899
+ const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
1900
+ return /* @__PURE__ */ jsx35(
1901
+ "div",
1902
+ {
1903
+ className: "yr3Slide",
1904
+ style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
1905
+ "data-testid": "yr3Slide",
1906
+ children: /* @__PURE__ */ jsx35(
1907
+ "div",
1908
+ {
1909
+ className: classNameContent,
1910
+ style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
1911
+ "data-testid": "yr3Slide-content",
1912
+ children: /* @__PURE__ */ jsx35(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
1913
+ }
1914
+ )
1915
+ }
1916
+ );
1917
+ };
1918
+
1919
+ // src/components/Switch/Switch.tsx
1920
+ import * as React19 from "react";
1921
+
1922
+ // src/components/Switch/switch.variants.ts
1923
+ var switchVariants = createVariants({
1924
+ base: "yr3Switch",
1925
+ variants: {
1926
+ colors: {
1927
+ primary: "yr3Switch--color-primary",
1928
+ secondary: "yr3Switch--color-secondary",
1929
+ success: "yr3Switch--color-success",
1930
+ text: "yr3Switch--color-text",
1931
+ disabled: "yr3Switch--color-disabled",
1932
+ warning: "yr3Switch--color-warning"
1933
+ },
1934
+ size: {
1935
+ sm: "yr3Switch--sm",
1936
+ md: "yr3Switch--md",
1937
+ lg: "yr3Switch--lg"
1938
+ },
1939
+ disabled: {
1940
+ true: "yr3Switch--disabled"
1941
+ },
1942
+ checked: {
1943
+ true: "yr3Switch--checked"
1944
+ }
1945
+ }
1946
+ });
1947
+
1948
+ // src/components/Switch/Switch.tsx
1949
+ import { jsx as jsx36, jsxs as jsxs13 } from "react/jsx-runtime";
1950
+ var Switch = ({
1951
+ checked,
1952
+ defaultChecked,
1953
+ onChange,
1954
+ disabled,
1955
+ color = "primary",
1956
+ size = "sm",
1957
+ label
1958
+ }) => {
1959
+ const [internal, setInternal] = React19.useState(defaultChecked || false);
1960
+ const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
1961
+ const isControlled = checked !== void 0;
1962
+ const value = isControlled ? checked : internal;
1963
+ const handleChange = (e) => {
1964
+ if (!isControlled) setInternal(e.target.checked);
1965
+ onChange?.(e, e.target.checked);
1966
+ };
1967
+ return /* @__PURE__ */ jsxs13(
1968
+ "label",
1969
+ {
1970
+ className: classname,
1971
+ "data-testid": "yr3Switch",
1972
+ children: [
1973
+ /* @__PURE__ */ jsx36(
1974
+ "input",
1975
+ {
1976
+ type: "checkbox",
1977
+ checked: value,
1978
+ onChange: handleChange,
1979
+ disabled
1980
+ }
1981
+ ),
1982
+ /* @__PURE__ */ jsx36("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx36("span", { className: "yr3Switch--thumb" }) }),
1983
+ /* @__PURE__ */ jsx36("span", { className: "yr3Switch--label", "data-testid": "yr3Switch-label", children: label })
1984
+ ]
1985
+ }
1986
+ );
1987
+ };
1988
+
1989
+ // src/Icons/IconSearch.tsx
1990
+ import { jsx as jsx37 } from "react/jsx-runtime";
1991
+ var IconSearch = (props) => {
1992
+ return /* @__PURE__ */ jsx37("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx37(
1993
+ "path",
1994
+ {
1995
+ d: "M15.7955 15.8111L21 21M18 10.5C18 14.6421 14.6421 18 10.5 18C6.35786 18 3 14.6421 3 10.5C3 6.35786 6.35786 3 10.5 3C14.6421 3 18 6.35786 18 10.5Z",
1996
+ stroke: props.stroke || "#fff",
1997
+ strokeWidth: props.strokeWidth || "1.5",
1998
+ strokeLinecap: "round",
1999
+ strokeLinejoin: "round"
2000
+ }
2001
+ ) });
2002
+ };
2003
+
2004
+ // src/theme/tokens.ts
2005
+ var baseTokens = {
2006
+ colors: {
2007
+ primary: "#6C5CE7",
2008
+ secondary: "#00CEC9",
2009
+ background: "#0f0f1a",
2010
+ surface: "#1a1a2e",
2011
+ textPrimary: "#ffffff",
2012
+ textSecondary: "#b2bec3"
2013
+ },
2014
+ spacing: (factor) => `${factor * 8}px`,
2015
+ radius: {
2016
+ sm: "6px",
2017
+ md: "12px",
2018
+ lg: "20px"
2019
+ }
2020
+ };
2021
+
2022
+ // src/theme/notistackContext.tsx
2023
+ import * as React20 from "react";
2024
+ import { jsx as jsx38, jsxs as jsxs14 } from "react/jsx-runtime";
2025
+ var NotistackContext = React20.createContext(null);
2026
+ var NotistackProvider = ({ children }) => {
2027
+ const [snacks, setSnacks] = React20.useState([]);
2028
+ const enqueueNotistack = (snack) => {
2029
+ const id = Date.now();
2030
+ setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
2031
+ const duration = snack.duration || 3e3;
2032
+ const exitDuration = 300;
2033
+ setTimeout(() => {
2034
+ setSnacks(
2035
+ (prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
2036
+ );
2037
+ }, duration);
2038
+ setTimeout(() => {
2039
+ setSnacks((prev) => prev.filter((s) => s.id !== id));
2040
+ }, duration + exitDuration);
2041
+ };
2042
+ return /* @__PURE__ */ jsxs14(NotistackContext.Provider, { value: { enqueueNotistack }, children: [
2043
+ children,
2044
+ /* @__PURE__ */ jsx38("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx38(Notistack, { ...snack }, snack.id)) })
2045
+ ] });
2046
+ };
2047
+ var useNotistack = () => React20.useContext(NotistackContext);
2048
+
2049
+ // src/theme/useMediaQuery.tsx
2050
+ import * as React21 from "react";
2051
+ function useMediaQuery(query) {
2052
+ const theme = useTheme();
2053
+ const computedQuery = typeof query === "function" ? query(theme) : query;
2054
+ const [matches, setMatches] = React21.useState(() => {
2055
+ if (typeof window === "undefined") return false;
2056
+ return window.matchMedia(computedQuery).matches;
2057
+ });
2058
+ React21.useEffect(() => {
2059
+ if (typeof window === "undefined") return;
2060
+ const media = window.matchMedia(computedQuery);
2061
+ const listener = () => setMatches(media.matches);
2062
+ media.addEventListener("change", listener);
2063
+ return () => media.removeEventListener("change", listener);
2064
+ }, [computedQuery]);
2065
+ return matches;
2066
+ }
2067
+ function useBreakpointValue(values) {
2068
+ const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
2069
+ const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
2070
+ const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
2071
+ const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
2072
+ const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
2073
+ if (xl && values.xl !== void 0) return values.xl;
2074
+ if (lg && values.lg !== void 0) return values.lg;
2075
+ if (md && values.md !== void 0) return values.md;
2076
+ if (sm && values.sm !== void 0) return values.sm;
2077
+ if (xs && values.xs !== void 0) return values.xs;
2078
+ return void 0;
2079
+ }
2080
+
2081
+ // src/index.ts
2082
+ injectStyles();
2083
+ initTheme();
2084
+ export {
2085
+ Avatar,
2086
+ Backdrop,
2087
+ BackdropContext,
2088
+ BackdropProvider,
2089
+ Box,
2090
+ Button,
2091
+ Calendar,
2092
+ Checkbox,
2093
+ Chip,
2094
+ Collapse,
2095
+ Container,
2096
+ Control,
2097
+ ControlContext,
2098
+ Divider,
2099
+ Drawer,
2100
+ Fade,
2101
+ Flex,
2102
+ Grid,
2103
+ Group,
2104
+ IconClose,
2105
+ IconDown,
2106
+ IconSearch,
2107
+ Image,
2108
+ Input,
2109
+ Label,
2110
+ Modal,
2111
+ ModalContainer,
2112
+ Notistack,
2113
+ NotistackProvider,
2114
+ Pending,
2115
+ Phone,
2116
+ Radio,
2117
+ Select,
2118
+ Slide,
2119
+ Switch,
2120
+ Text,
2121
+ ThemeContext,
2122
+ ThemeProvider,
2123
+ adjustColor,
2124
+ applyTheme,
2125
+ baseTokens,
2126
+ bem,
2127
+ bemMerge,
2128
+ breakpoints,
2129
+ composeStyles,
2130
+ createPaletteColor,
2131
+ createTheme,
2132
+ createVariants,
2133
+ cx,
2134
+ getContrast,
2135
+ getMonthCalendar,
2136
+ initTheme,
2137
+ isEmpty,
2138
+ text,
2139
+ times,
2140
+ uiStyle,
2141
+ useBackdrop,
2142
+ useBreakpointValue,
2143
+ useClickAway,
2144
+ useControl,
2145
+ useMediaQuery,
2146
+ useNotistack,
2147
+ useTheme
2148
+ };