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