@yr3/ui 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Avatar/avatar.css +14 -2
- package/dist/components/Avatar/avatar.css.map +1 -1
- package/dist/components/Backdrop/backdrop.css +1 -1
- package/dist/components/Button/buttons.css +7 -4
- package/dist/components/Button/buttons.css.map +1 -1
- package/dist/components/Checkbox/checkbox.css +55 -31
- package/dist/components/Checkbox/checkbox.css.map +1 -1
- package/dist/components/Chip/chip.css +9 -0
- package/dist/components/Chip/chip.css.map +1 -1
- package/dist/components/Control/control.css +12 -0
- package/dist/components/Control/control.css.map +1 -1
- package/dist/components/Divider/divider.css +4 -0
- package/dist/components/Divider/divider.css.map +1 -1
- package/dist/components/Group/group.css +26 -18
- package/dist/components/Group/group.css.map +1 -1
- package/dist/components/Input/input.css +5 -1
- package/dist/components/Input/input.css.map +1 -1
- package/dist/components/InputArea/inputArea.css +5 -0
- package/dist/components/InputArea/inputArea.css.map +1 -1
- package/dist/components/Label/label.css +4 -0
- package/dist/components/Label/label.css.map +1 -1
- package/dist/components/Loader/loader.css +112 -0
- package/dist/components/Loader/loader.css.map +1 -0
- package/dist/components/Notistack/notistack.css +5 -0
- package/dist/components/Notistack/notistack.css.map +1 -1
- package/dist/components/Pending/pending.css +4 -0
- package/dist/components/Pending/pending.css.map +1 -1
- package/dist/components/Radio/radio.css +5 -0
- package/dist/components/Radio/radio.css.map +1 -1
- package/dist/components/Select/select.css +44 -0
- package/dist/components/Select/select.css.map +1 -1
- package/dist/components/Switch/switch.css +28 -0
- package/dist/components/Switch/switch.css.map +1 -1
- package/dist/components/Text/text.css +9 -1
- package/dist/components/Text/text.css.map +1 -1
- package/dist/index.cjs +530 -246
- package/dist/index.d.cts +74 -12
- package/dist/index.d.ts +74 -12
- package/dist/index.js +523 -246
- package/dist/styles/global.css +5 -0
- package/dist/styles/global.css.map +1 -1
- package/dist/styles/index.css +352 -58
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,7 @@ __export(index_exports, {
|
|
|
57
57
|
Input: () => Input,
|
|
58
58
|
InputArea: () => InputArea,
|
|
59
59
|
Label: () => Label,
|
|
60
|
+
Loader: () => Loader,
|
|
60
61
|
Modal: () => Modal,
|
|
61
62
|
ModalContainer: () => ModalContainer,
|
|
62
63
|
Notistack: () => Notistack,
|
|
@@ -73,6 +74,7 @@ __export(index_exports, {
|
|
|
73
74
|
ThemeContext: () => ThemeContext,
|
|
74
75
|
ThemeProvider: () => ThemeProvider,
|
|
75
76
|
adjustColor: () => adjustColor,
|
|
77
|
+
alpha: () => alpha,
|
|
76
78
|
applyTheme: () => applyTheme,
|
|
77
79
|
baseTokens: () => baseTokens,
|
|
78
80
|
bem: () => bem,
|
|
@@ -85,14 +87,19 @@ __export(index_exports, {
|
|
|
85
87
|
createTheme: () => createTheme,
|
|
86
88
|
createVariants: () => createVariants,
|
|
87
89
|
cx: () => cx,
|
|
90
|
+
darken: () => darken,
|
|
88
91
|
getContrast: () => getContrast,
|
|
89
92
|
getCountryCodePhone: () => getCountryCodePhone,
|
|
90
93
|
getDialPhone: () => getDialPhone,
|
|
91
94
|
getMonthCalendar: () => getMonthCalendar,
|
|
92
95
|
getNumberPhone: () => getNumberPhone,
|
|
96
|
+
hexToRgb: () => hexToRgb,
|
|
93
97
|
initTheme: () => initTheme,
|
|
94
98
|
isEmpty: () => isEmpty,
|
|
99
|
+
lighten: () => lighten,
|
|
100
|
+
mergeDeep: () => mergeDeep,
|
|
95
101
|
normalizePhone: () => normalizePhone,
|
|
102
|
+
rgbToHex: () => rgbToHex,
|
|
96
103
|
text: () => text,
|
|
97
104
|
times: () => times,
|
|
98
105
|
uiStyle: () => uiStyle,
|
|
@@ -214,6 +221,20 @@ function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
|
214
221
|
}
|
|
215
222
|
|
|
216
223
|
// src/utils/color.ts
|
|
224
|
+
var rgbToHex = (r, g, b) => {
|
|
225
|
+
return "#" + [r, g, b].map(
|
|
226
|
+
(v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")
|
|
227
|
+
).join("");
|
|
228
|
+
};
|
|
229
|
+
var hexToRgb = (hex) => {
|
|
230
|
+
const clean = hex.replace("#", "");
|
|
231
|
+
const num = parseInt(clean, 16);
|
|
232
|
+
return {
|
|
233
|
+
r: num >> 16 & 255,
|
|
234
|
+
g: num >> 8 & 255,
|
|
235
|
+
b: num & 255
|
|
236
|
+
};
|
|
237
|
+
};
|
|
217
238
|
var adjustColor = (hex, amount) => {
|
|
218
239
|
const num = parseInt(hex.replace("#", ""), 16);
|
|
219
240
|
let r = (num >> 16) + amount;
|
|
@@ -241,6 +262,26 @@ var createPaletteColor = (main) => {
|
|
|
241
262
|
contrastText: getContrast(main)
|
|
242
263
|
};
|
|
243
264
|
};
|
|
265
|
+
var lighten = (hex, amount) => {
|
|
266
|
+
const { r, g, b } = hexToRgb(hex);
|
|
267
|
+
return rgbToHex(
|
|
268
|
+
r + (255 - r) * amount,
|
|
269
|
+
g + (255 - g) * amount,
|
|
270
|
+
b + (255 - b) * amount
|
|
271
|
+
);
|
|
272
|
+
};
|
|
273
|
+
var darken = (hex, amount) => {
|
|
274
|
+
const { r, g, b } = hexToRgb(hex);
|
|
275
|
+
return rgbToHex(
|
|
276
|
+
r * (1 - amount),
|
|
277
|
+
g * (1 - amount),
|
|
278
|
+
b * (1 - amount)
|
|
279
|
+
);
|
|
280
|
+
};
|
|
281
|
+
var alpha = (hex, opacity) => {
|
|
282
|
+
const { r, g, b } = hexToRgb(hex);
|
|
283
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
284
|
+
};
|
|
244
285
|
|
|
245
286
|
// src/utils/common.ts
|
|
246
287
|
function isEmpty(value) {
|
|
@@ -402,6 +443,24 @@ var getNumberPhone = (phone, dial) => {
|
|
|
402
443
|
return phone;
|
|
403
444
|
};
|
|
404
445
|
|
|
446
|
+
// src/utils/merge.ts
|
|
447
|
+
function mergeDeep(target, source) {
|
|
448
|
+
if (!source) return target;
|
|
449
|
+
const output = { ...target };
|
|
450
|
+
Object.keys(source).forEach((key) => {
|
|
451
|
+
const k = key;
|
|
452
|
+
if (typeof source[k] === "object" && source[k] !== null && !Array.isArray(source[k])) {
|
|
453
|
+
output[k] = mergeDeep(
|
|
454
|
+
target[k] || {},
|
|
455
|
+
source[k]
|
|
456
|
+
);
|
|
457
|
+
} else {
|
|
458
|
+
output[k] = source[k];
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
return output;
|
|
462
|
+
}
|
|
463
|
+
|
|
405
464
|
// src/theme/breakpoint.ts
|
|
406
465
|
var breakpoints = {
|
|
407
466
|
xs: 0,
|
|
@@ -479,6 +538,7 @@ var createTheme = (props) => {
|
|
|
479
538
|
warning: createPaletteColor("#ffc107"),
|
|
480
539
|
info: createPaletteColor("#17a2b8"),
|
|
481
540
|
disabled: "#aeaeae84",
|
|
541
|
+
backdrop: "rgba(0, 0, 0, 0.5)",
|
|
482
542
|
background: {
|
|
483
543
|
default: "#0f0f1a",
|
|
484
544
|
surface: "#1a1a2e"
|
|
@@ -486,6 +546,10 @@ var createTheme = (props) => {
|
|
|
486
546
|
text: {
|
|
487
547
|
primary: "#ffffff",
|
|
488
548
|
secondary: "#2e2f2f"
|
|
549
|
+
},
|
|
550
|
+
common: {
|
|
551
|
+
white: "#ffffff",
|
|
552
|
+
black: "#000000"
|
|
489
553
|
}
|
|
490
554
|
},
|
|
491
555
|
breakpoints,
|
|
@@ -520,6 +584,9 @@ var applyTheme = (theme, target) => {
|
|
|
520
584
|
root.style.setProperty(`--color-${key}-contrast`, value.contrastText);
|
|
521
585
|
}
|
|
522
586
|
});
|
|
587
|
+
if (theme.colors.backdrop) {
|
|
588
|
+
root.style.setProperty("--color-backdrop", theme.colors.backdrop);
|
|
589
|
+
}
|
|
523
590
|
if (theme.colors.background?.default) {
|
|
524
591
|
root.style.setProperty("--color-bg", theme.colors.background.default);
|
|
525
592
|
}
|
|
@@ -529,12 +596,21 @@ var applyTheme = (theme, target) => {
|
|
|
529
596
|
if (theme.colors.disabled) {
|
|
530
597
|
root.style.setProperty("--color-disabled", theme.colors.disabled);
|
|
531
598
|
}
|
|
599
|
+
if (theme.colors.text?.primary) {
|
|
600
|
+
root.style.setProperty("--color-text", theme.colors.text?.primary);
|
|
601
|
+
}
|
|
532
602
|
if (theme.colors.text?.primary) {
|
|
533
603
|
root.style.setProperty("--color-text-primary", theme.colors.text?.primary);
|
|
534
604
|
}
|
|
535
605
|
if (theme.colors.text?.secondary) {
|
|
536
606
|
root.style.setProperty("--color-text-secondary", theme.colors.text?.secondary);
|
|
537
607
|
}
|
|
608
|
+
if (theme.colors.common?.white) {
|
|
609
|
+
root.style.setProperty("--color-white", theme.colors.common.white);
|
|
610
|
+
}
|
|
611
|
+
if (theme.colors.common?.black) {
|
|
612
|
+
root.style.setProperty("--color-black", theme.colors.common.black);
|
|
613
|
+
}
|
|
538
614
|
if (theme.breakpoints) {
|
|
539
615
|
Object.entries(theme.breakpoints).forEach(([key, value]) => {
|
|
540
616
|
document.documentElement.style.setProperty(
|
|
@@ -580,7 +656,8 @@ var avatarVariants = createVariants({
|
|
|
580
656
|
text: "yr3Avatar--color-text",
|
|
581
657
|
warning: "yr3Avatar--color-warning",
|
|
582
658
|
info: "yr3Avatar--color-info",
|
|
583
|
-
error: "yr3Avatar--color-error"
|
|
659
|
+
error: "yr3Avatar--color-error",
|
|
660
|
+
common: "yr3Avatar--color-common"
|
|
584
661
|
},
|
|
585
662
|
size: {
|
|
586
663
|
sm: "yr3Avatar--sm",
|
|
@@ -590,10 +667,11 @@ var avatarVariants = createVariants({
|
|
|
590
667
|
variant: {
|
|
591
668
|
circle: "yr3Avatar--circle",
|
|
592
669
|
square: "yr3Avatar--square",
|
|
593
|
-
rounded: "yr3Avatar--rounded"
|
|
670
|
+
rounded: "yr3Avatar--rounded",
|
|
671
|
+
bordered: "yr3Avatar--bordered"
|
|
594
672
|
},
|
|
595
673
|
bordered: {
|
|
596
|
-
true: "yr3Avatar--
|
|
674
|
+
true: "yr3Avatar--border-active"
|
|
597
675
|
},
|
|
598
676
|
shadow: {
|
|
599
677
|
0: "",
|
|
@@ -618,7 +696,7 @@ var Avatar = ({
|
|
|
618
696
|
variant = "circle",
|
|
619
697
|
color = "primary",
|
|
620
698
|
label,
|
|
621
|
-
bordered =
|
|
699
|
+
bordered = false,
|
|
622
700
|
ui,
|
|
623
701
|
shadow = 0,
|
|
624
702
|
onClick,
|
|
@@ -646,9 +724,18 @@ var React2 = __toESM(require("react"), 1);
|
|
|
646
724
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
647
725
|
var BackdropContext = React2.createContext(null);
|
|
648
726
|
var BackdropProvider = ({ children }) => {
|
|
649
|
-
const [
|
|
650
|
-
const show = () =>
|
|
651
|
-
|
|
727
|
+
const [stack, setStack] = React2.useState([]);
|
|
728
|
+
const show = (id) => {
|
|
729
|
+
setStack((prev) => [...prev, id]);
|
|
730
|
+
};
|
|
731
|
+
const hide = (id) => {
|
|
732
|
+
if (id) {
|
|
733
|
+
setStack((prev) => prev.filter((item) => item !== id));
|
|
734
|
+
} else {
|
|
735
|
+
setStack([]);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
const open = stack.length > 0;
|
|
652
739
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(BackdropContext.Provider, { value: { open, show, hide }, children: [
|
|
653
740
|
children,
|
|
654
741
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Backdrop, {})
|
|
@@ -746,7 +833,8 @@ var textVariants = createVariants({
|
|
|
746
833
|
warning: "yr3Text--color-warning",
|
|
747
834
|
error: "yr3Text--color-error",
|
|
748
835
|
info: "yr3Text--color-info",
|
|
749
|
-
background: "yr3Text--color-background"
|
|
836
|
+
background: "yr3Text--color-background",
|
|
837
|
+
common: "yr3Text--color-common"
|
|
750
838
|
},
|
|
751
839
|
weight: {
|
|
752
840
|
light: "yr3Text--weight-light",
|
|
@@ -806,7 +894,8 @@ var buttonVariant = createVariants({
|
|
|
806
894
|
info: "yr3Button--color-info",
|
|
807
895
|
error: "yr3Button--color-error",
|
|
808
896
|
background: "yr3Button--color-background",
|
|
809
|
-
warning: "yr3Button--color-warning"
|
|
897
|
+
warning: "yr3Button--color-warning",
|
|
898
|
+
common: "yr3Button--color-common"
|
|
810
899
|
},
|
|
811
900
|
size: {
|
|
812
901
|
auto: "yr3Button--size-auto",
|
|
@@ -1002,6 +1091,19 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1002
1091
|
// src/components/Checkbox/Checkbox.tsx
|
|
1003
1092
|
var React4 = __toESM(require("react"), 1);
|
|
1004
1093
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1094
|
+
var initialPropsComponent = {
|
|
1095
|
+
checkbox: {
|
|
1096
|
+
ui: {
|
|
1097
|
+
color: "primary"
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
content: {
|
|
1101
|
+
variant: "caption",
|
|
1102
|
+
color: "primary",
|
|
1103
|
+
ui: {},
|
|
1104
|
+
style: {}
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1005
1107
|
var Checkbox = ({
|
|
1006
1108
|
checked,
|
|
1007
1109
|
defaultChecked,
|
|
@@ -1010,6 +1112,7 @@ var Checkbox = ({
|
|
|
1010
1112
|
color = "primary",
|
|
1011
1113
|
disabled,
|
|
1012
1114
|
propsComponent,
|
|
1115
|
+
type = "default",
|
|
1013
1116
|
variant = "text"
|
|
1014
1117
|
}) => {
|
|
1015
1118
|
const [internal, setInternal] = React4.useState(defaultChecked || false);
|
|
@@ -1019,11 +1122,12 @@ var Checkbox = ({
|
|
|
1019
1122
|
if (!isControlled) setInternal(e.target.checked);
|
|
1020
1123
|
onChange?.(e, e.target.checked);
|
|
1021
1124
|
};
|
|
1125
|
+
const properties = mergeDeep(initialPropsComponent, propsComponent || {});
|
|
1022
1126
|
const bemClasse = bem("yr3Checkbox");
|
|
1023
|
-
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}` });
|
|
1127
|
+
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
1024
1128
|
const boxClasses = bem("yr3Checkbox-box");
|
|
1025
1129
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
1026
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: classes, style: uiStyle(
|
|
1130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: classes, style: uiStyle(properties?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
|
|
1027
1131
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1028
1132
|
"input",
|
|
1029
1133
|
{
|
|
@@ -1035,7 +1139,7 @@ var Checkbox = ({
|
|
|
1035
1139
|
}
|
|
1036
1140
|
),
|
|
1037
1141
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: classesBox, "data-testid": "yr3Checkbox-box" }),
|
|
1038
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { variant: "caption", color: !value ?
|
|
1142
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { variant: "caption", color: !value ? properties?.content?.color : color, ...properties?.content, children: label })
|
|
1039
1143
|
] });
|
|
1040
1144
|
};
|
|
1041
1145
|
|
|
@@ -1058,7 +1162,10 @@ var chipVariants = createVariants({
|
|
|
1058
1162
|
success: "yr3Chip--success",
|
|
1059
1163
|
error: "yr3Chip--error",
|
|
1060
1164
|
warning: "yr3Chip--warning",
|
|
1061
|
-
info: "yr3Chip--info"
|
|
1165
|
+
info: "yr3Chip--info",
|
|
1166
|
+
common: "yr3Chip--common",
|
|
1167
|
+
background: "yr3Chip--background",
|
|
1168
|
+
disabled: "yr3Chip--disabled"
|
|
1062
1169
|
},
|
|
1063
1170
|
rounded: {
|
|
1064
1171
|
true: "yr3Chip--rounded",
|
|
@@ -1085,7 +1192,22 @@ var IconClose = (props) => {
|
|
|
1085
1192
|
|
|
1086
1193
|
// src/components/Chip/Chip.tsx
|
|
1087
1194
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1088
|
-
var
|
|
1195
|
+
var initialChipProps = {
|
|
1196
|
+
label: {
|
|
1197
|
+
ui: {},
|
|
1198
|
+
style: {}
|
|
1199
|
+
},
|
|
1200
|
+
delete: {
|
|
1201
|
+
ui: {},
|
|
1202
|
+
style: {}
|
|
1203
|
+
},
|
|
1204
|
+
icon: {
|
|
1205
|
+
width: 20,
|
|
1206
|
+
height: 20
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1210
|
+
const properties = mergeDeep(initialChipProps, propsComponent);
|
|
1089
1211
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
1090
1212
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1091
1213
|
"div",
|
|
@@ -1093,14 +1215,21 @@ var Chip = ({ label, variant, color, icon, onDelete, rounded, size = "medium", u
|
|
|
1093
1215
|
className,
|
|
1094
1216
|
"data-testid": "yr3Chip",
|
|
1095
1217
|
...props,
|
|
1096
|
-
style:
|
|
1097
|
-
...style,
|
|
1098
|
-
...uiStyle(ui)
|
|
1099
|
-
},
|
|
1218
|
+
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
1100
1219
|
children: [
|
|
1101
1220
|
icon,
|
|
1102
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "yr3Chip__label", children: label }),
|
|
1103
|
-
|
|
1221
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "yr3Chip__label", style: composeStyles(properties?.label?.ui, properties?.label?.style), children: label }),
|
|
1222
|
+
deleted && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1223
|
+
"span",
|
|
1224
|
+
{
|
|
1225
|
+
className: "yr3Chip__delete",
|
|
1226
|
+
onClick: onDelete,
|
|
1227
|
+
role: "button",
|
|
1228
|
+
"aria-label": "delete",
|
|
1229
|
+
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1230
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconClose, { ...properties?.icon, stroke: color })
|
|
1231
|
+
}
|
|
1232
|
+
)
|
|
1104
1233
|
]
|
|
1105
1234
|
}
|
|
1106
1235
|
);
|
|
@@ -1172,7 +1301,8 @@ var controlVariants = createVariants({
|
|
|
1172
1301
|
disabled: "yr3Control--color-disabled",
|
|
1173
1302
|
info: "yr3Control--color-info",
|
|
1174
1303
|
warning: "yr3Control--color-warning",
|
|
1175
|
-
error: "yr3Control--color-error"
|
|
1304
|
+
error: "yr3Control--color-error",
|
|
1305
|
+
common: "yr3Control--color-common"
|
|
1176
1306
|
},
|
|
1177
1307
|
size: {
|
|
1178
1308
|
auto: "yr3Control--size-auto",
|
|
@@ -1249,7 +1379,8 @@ var dividerVariants = createVariants({
|
|
|
1249
1379
|
text: "yr3Divider--color-text",
|
|
1250
1380
|
warning: "yr3Divider--color-warning",
|
|
1251
1381
|
info: "yr3Divider--color-info",
|
|
1252
|
-
error: "yr3Divider--color-error"
|
|
1382
|
+
error: "yr3Divider--color-error",
|
|
1383
|
+
common: "yr3Divider--color-common"
|
|
1253
1384
|
}
|
|
1254
1385
|
}
|
|
1255
1386
|
});
|
|
@@ -1278,7 +1409,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1278
1409
|
const { hide } = useBackdrop();
|
|
1279
1410
|
const handleClose = () => {
|
|
1280
1411
|
if (props === "container") {
|
|
1281
|
-
hide();
|
|
1412
|
+
hide("drawer");
|
|
1282
1413
|
onClose && onClose();
|
|
1283
1414
|
}
|
|
1284
1415
|
return;
|
|
@@ -1304,33 +1435,44 @@ var useClickAway = (ref, callback) => {
|
|
|
1304
1435
|
|
|
1305
1436
|
// src/components/Drawer/Drawer.tsx
|
|
1306
1437
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1438
|
+
var initialPropsComponent2 = {
|
|
1439
|
+
drawer: {},
|
|
1440
|
+
closing: null,
|
|
1441
|
+
container: {},
|
|
1442
|
+
onClose: false
|
|
1443
|
+
};
|
|
1307
1444
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1308
1445
|
const { show, hide } = useBackdrop();
|
|
1309
1446
|
const ref = React8.useRef(null);
|
|
1447
|
+
const properties = mergeDeep(initialPropsComponent2, propsComponent);
|
|
1310
1448
|
React8.useEffect(() => {
|
|
1311
1449
|
if (open) {
|
|
1312
|
-
show();
|
|
1450
|
+
show("drawer");
|
|
1451
|
+
} else {
|
|
1452
|
+
hide("drawer");
|
|
1313
1453
|
}
|
|
1314
1454
|
}, [open]);
|
|
1315
1455
|
useClickAway(ref, () => {
|
|
1316
|
-
if (!open ||
|
|
1317
|
-
if (
|
|
1318
|
-
hide();
|
|
1456
|
+
if (!open || properties?.closing === null) return;
|
|
1457
|
+
if (properties?.closing === "drawer") {
|
|
1458
|
+
hide("drawer");
|
|
1319
1459
|
onClose();
|
|
1320
1460
|
}
|
|
1321
1461
|
;
|
|
1322
1462
|
});
|
|
1323
1463
|
React8.useEffect(() => {
|
|
1324
|
-
if (
|
|
1325
|
-
hide();
|
|
1464
|
+
if (properties?.onClose) {
|
|
1465
|
+
hide("drawer");
|
|
1326
1466
|
onClose();
|
|
1327
1467
|
}
|
|
1328
|
-
}, [
|
|
1468
|
+
}, [properties?.onClose]);
|
|
1469
|
+
const classesBem = bem("yr3Drawer");
|
|
1470
|
+
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1329
1471
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1330
1472
|
"div",
|
|
1331
1473
|
{
|
|
1332
|
-
className:
|
|
1333
|
-
style:
|
|
1474
|
+
className: drawerClasses,
|
|
1475
|
+
style: properties?.drawer,
|
|
1334
1476
|
onClick: (e) => e.stopPropagation(),
|
|
1335
1477
|
ref,
|
|
1336
1478
|
"data-testid": "yr3Drawer",
|
|
@@ -1338,9 +1480,9 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1338
1480
|
DrawerContainer_default,
|
|
1339
1481
|
{
|
|
1340
1482
|
children,
|
|
1341
|
-
...
|
|
1342
|
-
props:
|
|
1343
|
-
onClose: () =>
|
|
1483
|
+
...properties?.container,
|
|
1484
|
+
props: properties?.closing,
|
|
1485
|
+
onClose: () => properties?.closing === "container" ? onClose() : {}
|
|
1344
1486
|
}
|
|
1345
1487
|
)
|
|
1346
1488
|
},
|
|
@@ -1498,7 +1640,12 @@ var groupVariants = createVariants({
|
|
|
1498
1640
|
info: "yr3Group--color-info",
|
|
1499
1641
|
disabled: "yr3Group--color-disabled",
|
|
1500
1642
|
text: "yr3Group--color-text",
|
|
1501
|
-
background: "yr3Group--color-background"
|
|
1643
|
+
background: "yr3Group--color-background",
|
|
1644
|
+
common: "yr3Group--color-common"
|
|
1645
|
+
},
|
|
1646
|
+
type: {
|
|
1647
|
+
rounded: "yr3Group--type-rounded",
|
|
1648
|
+
square: "yr3Group--type-square"
|
|
1502
1649
|
}
|
|
1503
1650
|
}
|
|
1504
1651
|
});
|
|
@@ -1520,6 +1667,7 @@ var Group = ({
|
|
|
1520
1667
|
value,
|
|
1521
1668
|
onChange,
|
|
1522
1669
|
variant,
|
|
1670
|
+
type = "rounded",
|
|
1523
1671
|
color = "primary",
|
|
1524
1672
|
propsComponent = initialComponents
|
|
1525
1673
|
}) => {
|
|
@@ -1534,7 +1682,7 @@ var Group = ({
|
|
|
1534
1682
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1535
1683
|
"div",
|
|
1536
1684
|
{
|
|
1537
|
-
className: groupVariants({ variant, color }),
|
|
1685
|
+
className: groupVariants({ variant, color, type }),
|
|
1538
1686
|
"data-testid": "yr3Group",
|
|
1539
1687
|
style: composeStyles(propsComponent.group?.ui, propsComponent.group?.style),
|
|
1540
1688
|
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -1575,7 +1723,15 @@ var Image = ({
|
|
|
1575
1723
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
1576
1724
|
var React11 = __toESM(require("react"), 1);
|
|
1577
1725
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1578
|
-
var
|
|
1726
|
+
var initialPropsComponent3 = {
|
|
1727
|
+
box: {},
|
|
1728
|
+
text: {},
|
|
1729
|
+
container: {},
|
|
1730
|
+
preview: {},
|
|
1731
|
+
content: {}
|
|
1732
|
+
};
|
|
1733
|
+
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
1734
|
+
const properties = mergeDeep(initialPropsComponent3, propsComponent || {});
|
|
1579
1735
|
const [dragging, setDragging] = React11.useState(false);
|
|
1580
1736
|
const [files, setFiles] = React11.useState([]);
|
|
1581
1737
|
const inputRef = React11.useRef(null);
|
|
@@ -1590,7 +1746,7 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1590
1746
|
};
|
|
1591
1747
|
const classes = bem("yr3Dropzone");
|
|
1592
1748
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
1593
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { as: "div", position: "relative", content: "center", ...
|
|
1749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1594
1750
|
"div",
|
|
1595
1751
|
{
|
|
1596
1752
|
className: classComponent,
|
|
@@ -1605,7 +1761,7 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1605
1761
|
handleFiles(e.dataTransfer.files);
|
|
1606
1762
|
},
|
|
1607
1763
|
onClick: () => inputRef.current?.click(),
|
|
1608
|
-
style: composeStyles(ui, style),
|
|
1764
|
+
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1609
1765
|
children: [
|
|
1610
1766
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1611
1767
|
"input",
|
|
@@ -1618,10 +1774,10 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1618
1774
|
onChange: (e) => handleFiles(e.target.files)
|
|
1619
1775
|
}
|
|
1620
1776
|
),
|
|
1621
|
-
isEmpty(files) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--content", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
1622
|
-
multiple && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--previews", children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1623
|
-
!multiple && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--preview", children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1624
|
-
!!defaultImage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--preview", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: defaultImage }) }),
|
|
1777
|
+
isEmpty(files) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--content", style: composeStyles(properties?.content?.ui, properties?.content?.style), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
1778
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--previews", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1779
|
+
!multiple && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1780
|
+
!!defaultImage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: defaultImage }) }),
|
|
1625
1781
|
component
|
|
1626
1782
|
]
|
|
1627
1783
|
}
|
|
@@ -1667,7 +1823,8 @@ var inputVariants = createVariants({
|
|
|
1667
1823
|
background: "yr3Input--color-background",
|
|
1668
1824
|
error: "yr3Input--color-error",
|
|
1669
1825
|
warning: "yr3Input--color-warning",
|
|
1670
|
-
info: "yr3Input--color-info"
|
|
1826
|
+
info: "yr3Input--color-info",
|
|
1827
|
+
common: "yr3Input--color-common"
|
|
1671
1828
|
},
|
|
1672
1829
|
size: {
|
|
1673
1830
|
auto: "yr3Input--size-auto",
|
|
@@ -1788,7 +1945,12 @@ var inputAreaVariants = createVariants({
|
|
|
1788
1945
|
secondary: "yr3InputArea--color-secondary",
|
|
1789
1946
|
success: "yr3InputArea--color-success",
|
|
1790
1947
|
text: "yr3InputArea--color-text",
|
|
1791
|
-
disabled: "yr3InputArea--color-disabled"
|
|
1948
|
+
disabled: "yr3InputArea--color-disabled",
|
|
1949
|
+
background: "yr3InputArea--color-background",
|
|
1950
|
+
error: "yr3InputArea--color-error",
|
|
1951
|
+
warning: "yr3InputArea--color-warning",
|
|
1952
|
+
info: "yr3InputArea--color-info",
|
|
1953
|
+
common: "yr3InputArea--color-common"
|
|
1792
1954
|
},
|
|
1793
1955
|
size: {
|
|
1794
1956
|
auto: "yr3InputArea--size-auto",
|
|
@@ -1875,33 +2037,99 @@ var InputArea = ({
|
|
|
1875
2037
|
] });
|
|
1876
2038
|
};
|
|
1877
2039
|
|
|
1878
|
-
// src/components/
|
|
2040
|
+
// src/components/Loader/loader.variants.ts
|
|
2041
|
+
var loaderSpinnerVariants = createVariants({
|
|
2042
|
+
base: "yr3Loader--spinner",
|
|
2043
|
+
variants: {
|
|
2044
|
+
color: {
|
|
2045
|
+
primary: "yr3Loader--spinner-color-primary",
|
|
2046
|
+
secondary: "yr3Loader--spinner-color-secondary",
|
|
2047
|
+
success: "yr3Loader--spinner-color-success",
|
|
2048
|
+
error: "yr3Loader--spinner-color-error",
|
|
2049
|
+
warning: "yr3Loader--spinner-color-warning",
|
|
2050
|
+
info: "yr3Loader--spinner-color-info",
|
|
2051
|
+
disabled: "yr3Loader--spinner-color-disabled",
|
|
2052
|
+
text: "yr3Loader--spinner-color-text",
|
|
2053
|
+
background: "yr3Loader--spinner-color-background",
|
|
2054
|
+
common: "yr3Loader--spinner-color-common"
|
|
2055
|
+
},
|
|
2056
|
+
size: {
|
|
2057
|
+
sm: "yr3Loader--spinner-size-sm",
|
|
2058
|
+
md: "yr3Loader--spinner-size-md",
|
|
2059
|
+
lg: "yr3Loader--spinner-size-lg"
|
|
2060
|
+
},
|
|
2061
|
+
type: {
|
|
2062
|
+
default: "yr3Loader--spinner-default",
|
|
2063
|
+
dots: "yr3Loader--spinner-dots",
|
|
2064
|
+
fancy: "yr3Loader--spinner-fancy"
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
});
|
|
2068
|
+
|
|
2069
|
+
// src/components/Loader/Loader.tsx
|
|
1879
2070
|
var React14 = __toESM(require("react"), 1);
|
|
2071
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2072
|
+
var initialComponents2 = {
|
|
2073
|
+
loader: {
|
|
2074
|
+
ui: {},
|
|
2075
|
+
style: {}
|
|
2076
|
+
},
|
|
2077
|
+
spinner: {
|
|
2078
|
+
size: "sm",
|
|
2079
|
+
color: "primary",
|
|
2080
|
+
type: "default"
|
|
2081
|
+
},
|
|
2082
|
+
container: {
|
|
2083
|
+
center: true,
|
|
2084
|
+
container: true,
|
|
2085
|
+
ui: {
|
|
2086
|
+
width: "100%",
|
|
2087
|
+
height: "100%"
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
};
|
|
2091
|
+
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2092
|
+
const properties = mergeDeep(initialComponents2, propsComponent || {});
|
|
2093
|
+
const classSpinner = loaderSpinnerVariants({
|
|
2094
|
+
color: properties?.spinner?.color,
|
|
2095
|
+
type: properties?.spinner?.type,
|
|
2096
|
+
size: properties?.spinner?.size
|
|
2097
|
+
});
|
|
2098
|
+
if (!loading) return null;
|
|
2099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "yr3Loader", style: composeStyles(properties?.loader?.ui, properties?.loader?.style), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Flex, { ...properties?.container, children: component || /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: classSpinner, children: properties?.spinner?.type === "dots" && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(React14.Fragment, { children: [
|
|
2100
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {}),
|
|
2101
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {}),
|
|
2102
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {})
|
|
2103
|
+
] }) }) }) });
|
|
2104
|
+
};
|
|
2105
|
+
|
|
2106
|
+
// src/components/Modal/Modal.tsx
|
|
2107
|
+
var React15 = __toESM(require("react"), 1);
|
|
1880
2108
|
|
|
1881
2109
|
// src/components/Modal/ModalContainer.tsx
|
|
1882
|
-
var
|
|
2110
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1883
2111
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
1884
2112
|
const classes = bem("yr3Modal-container");
|
|
1885
2113
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
1886
|
-
return /* @__PURE__ */ (0,
|
|
2114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
1887
2115
|
};
|
|
1888
2116
|
|
|
1889
2117
|
// src/components/Modal/Modal.tsx
|
|
1890
|
-
var
|
|
2118
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1891
2119
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
1892
2120
|
const { show, hide } = useBackdrop();
|
|
1893
|
-
|
|
2121
|
+
React15.useEffect(() => {
|
|
1894
2122
|
if (open) {
|
|
1895
|
-
show();
|
|
2123
|
+
show("modal");
|
|
1896
2124
|
} else {
|
|
1897
|
-
hide();
|
|
2125
|
+
hide("modal");
|
|
1898
2126
|
}
|
|
1899
|
-
}, [open
|
|
2127
|
+
}, [open]);
|
|
1900
2128
|
const classes = bem("yr3Modal");
|
|
1901
2129
|
const classComponent = classes(void 0, { "open": !!open });
|
|
1902
|
-
return /* @__PURE__ */ (0,
|
|
2130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
|
|
1903
2131
|
children,
|
|
1904
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0,
|
|
2132
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
1905
2133
|
] }) }) });
|
|
1906
2134
|
};
|
|
1907
2135
|
|
|
@@ -1941,15 +2169,15 @@ var notistackVariants = createVariants({
|
|
|
1941
2169
|
});
|
|
1942
2170
|
|
|
1943
2171
|
// src/components/Notistack/Notistack.tsx
|
|
1944
|
-
var
|
|
2172
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1945
2173
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
1946
2174
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
1947
2175
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
1948
2176
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
1949
2177
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
1950
|
-
return /* @__PURE__ */ (0,
|
|
1951
|
-
/* @__PURE__ */ (0,
|
|
1952
|
-
/* @__PURE__ */ (0,
|
|
2178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
2179
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: containerStyle, children: message }),
|
|
2180
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1953
2181
|
"div",
|
|
1954
2182
|
{
|
|
1955
2183
|
className: "yr3Notistack--progress",
|
|
@@ -1977,13 +2205,14 @@ var pendingVariants = createVariants({
|
|
|
1977
2205
|
text: "yr3Pending--color-text",
|
|
1978
2206
|
info: "yr3Pending--color-info",
|
|
1979
2207
|
background: "yr3Pending--color-background",
|
|
1980
|
-
warning: "yr3Pending--color-warning"
|
|
2208
|
+
warning: "yr3Pending--color-warning",
|
|
2209
|
+
common: "yr3Pending--color-common"
|
|
1981
2210
|
}
|
|
1982
2211
|
}
|
|
1983
2212
|
});
|
|
1984
2213
|
|
|
1985
2214
|
// src/components/Pending/Pending.tsx
|
|
1986
|
-
var
|
|
2215
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1987
2216
|
var Pending = ({
|
|
1988
2217
|
variant,
|
|
1989
2218
|
width,
|
|
@@ -1996,7 +2225,7 @@ var Pending = ({
|
|
|
1996
2225
|
const widthStyle = variant === "circle" ? size : width;
|
|
1997
2226
|
const heightStyle = variant === "circle" ? size : height;
|
|
1998
2227
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
1999
|
-
return /* @__PURE__ */ (0,
|
|
2228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2000
2229
|
"div",
|
|
2001
2230
|
{
|
|
2002
2231
|
className: pendingVariants({ variant, color }),
|
|
@@ -2007,19 +2236,19 @@ var Pending = ({
|
|
|
2007
2236
|
};
|
|
2008
2237
|
|
|
2009
2238
|
// src/components/Phone/Phone.tsx
|
|
2010
|
-
var
|
|
2239
|
+
var React17 = __toESM(require("react"), 1);
|
|
2011
2240
|
|
|
2012
2241
|
// src/components/Selector/Selector.tsx
|
|
2013
|
-
var
|
|
2242
|
+
var React16 = __toESM(require("react"), 1);
|
|
2014
2243
|
|
|
2015
2244
|
// src/Icons/IconDown.tsx
|
|
2016
|
-
var
|
|
2245
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2017
2246
|
var IconDown = (props) => {
|
|
2018
|
-
return /* @__PURE__ */ (0,
|
|
2247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.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_runtime31.jsx)("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2019
2248
|
};
|
|
2020
2249
|
|
|
2021
2250
|
// src/components/Selector/Selector.tsx
|
|
2022
|
-
var
|
|
2251
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2023
2252
|
var initalPropsComponent2 = {
|
|
2024
2253
|
text: {
|
|
2025
2254
|
variant: "caption",
|
|
@@ -2032,16 +2261,16 @@ var initalPropsComponent2 = {
|
|
|
2032
2261
|
}
|
|
2033
2262
|
};
|
|
2034
2263
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
2035
|
-
const [open, setOpen] =
|
|
2036
|
-
const [valueState, setValueState] =
|
|
2037
|
-
const ref =
|
|
2264
|
+
const [open, setOpen] = React16.useState(false);
|
|
2265
|
+
const [valueState, setValueState] = React16.useState(value || defaultValue || null);
|
|
2266
|
+
const ref = React16.useRef(null);
|
|
2038
2267
|
useClickAway(ref, () => setOpen(false));
|
|
2039
|
-
return /* @__PURE__ */ (0,
|
|
2040
|
-
/* @__PURE__ */ (0,
|
|
2041
|
-
/* @__PURE__ */ (0,
|
|
2268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "yr3Selector--control", children: [
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
2042
2271
|
valueState
|
|
2043
2272
|
] }) }),
|
|
2044
|
-
open && /* @__PURE__ */ (0,
|
|
2273
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "yr3Selector--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2045
2274
|
"div",
|
|
2046
2275
|
{
|
|
2047
2276
|
className: "yr3Selector--option",
|
|
@@ -2062,7 +2291,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
2062
2291
|
};
|
|
2063
2292
|
onChange?.(event, opt.value);
|
|
2064
2293
|
},
|
|
2065
|
-
children: /* @__PURE__ */ (0,
|
|
2294
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { ...propsComponent?.text, children: propsComponent?.text?.children || opt.label })
|
|
2066
2295
|
},
|
|
2067
2296
|
opt.value
|
|
2068
2297
|
)) })
|
|
@@ -2071,7 +2300,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
2071
2300
|
var Selector_default = Selector;
|
|
2072
2301
|
|
|
2073
2302
|
// src/components/Phone/Phone.tsx
|
|
2074
|
-
var
|
|
2303
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2075
2304
|
var Phone = ({
|
|
2076
2305
|
name,
|
|
2077
2306
|
value,
|
|
@@ -2083,13 +2312,13 @@ var Phone = ({
|
|
|
2083
2312
|
}) => {
|
|
2084
2313
|
const isControlled = value !== void 0;
|
|
2085
2314
|
const initial = value || defaultValue || "";
|
|
2086
|
-
const [prefix, setPrefix] =
|
|
2315
|
+
const [prefix, setPrefix] = React17.useState(
|
|
2087
2316
|
getDialPhone(initial, countries) || countries[0].dial
|
|
2088
2317
|
);
|
|
2089
|
-
const [number, setNumber] =
|
|
2318
|
+
const [number, setNumber] = React17.useState(
|
|
2090
2319
|
getNumberPhone(initial, prefix) || ""
|
|
2091
2320
|
);
|
|
2092
|
-
|
|
2321
|
+
React17.useEffect(() => {
|
|
2093
2322
|
if (isControlled && value) {
|
|
2094
2323
|
const dial = getDialPhone(value, countries);
|
|
2095
2324
|
const num = getNumberPhone(value, dial);
|
|
@@ -2108,10 +2337,10 @@ var Phone = ({
|
|
|
2108
2337
|
setPrefix(val);
|
|
2109
2338
|
onChange?.(null, `${val}${number}`);
|
|
2110
2339
|
};
|
|
2111
|
-
return /* @__PURE__ */ (0,
|
|
2112
|
-
/* @__PURE__ */ (0,
|
|
2113
|
-
/* @__PURE__ */ (0,
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
2340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
2342
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { variant: "row", container: true, center: true, children: [
|
|
2343
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2115
2344
|
Selector_default,
|
|
2116
2345
|
{
|
|
2117
2346
|
options: countries.map((c) => ({
|
|
@@ -2123,7 +2352,7 @@ var Phone = ({
|
|
|
2123
2352
|
...propsComponent?.selector
|
|
2124
2353
|
}
|
|
2125
2354
|
),
|
|
2126
|
-
/* @__PURE__ */ (0,
|
|
2355
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2127
2356
|
Divider,
|
|
2128
2357
|
{
|
|
2129
2358
|
orientation: "vertical",
|
|
@@ -2132,7 +2361,7 @@ var Phone = ({
|
|
|
2132
2361
|
...propsComponent?.divider
|
|
2133
2362
|
}
|
|
2134
2363
|
),
|
|
2135
|
-
/* @__PURE__ */ (0,
|
|
2364
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2136
2365
|
Input,
|
|
2137
2366
|
{
|
|
2138
2367
|
type: "number",
|
|
@@ -2148,9 +2377,9 @@ var Phone = ({
|
|
|
2148
2377
|
};
|
|
2149
2378
|
|
|
2150
2379
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
2151
|
-
var
|
|
2380
|
+
var React18 = __toESM(require("react"), 1);
|
|
2152
2381
|
var import_autocomplete_places = require("@yr3/autocomplete-places");
|
|
2153
|
-
var
|
|
2382
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2154
2383
|
var initPropsComponent = {
|
|
2155
2384
|
label: {
|
|
2156
2385
|
display: true,
|
|
@@ -2190,9 +2419,9 @@ var PlacesAutocomplete = ({
|
|
|
2190
2419
|
keyApi,
|
|
2191
2420
|
propsComponent = initPropsComponent
|
|
2192
2421
|
}) => {
|
|
2193
|
-
const [value, setValue] =
|
|
2194
|
-
const inputRef =
|
|
2195
|
-
const [anchorEl, setAnchorEl] =
|
|
2422
|
+
const [value, setValue] = React18.useState(null);
|
|
2423
|
+
const inputRef = React18.useRef(null);
|
|
2424
|
+
const [anchorEl, setAnchorEl] = React18.useState(null);
|
|
2196
2425
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
2197
2426
|
const handleSelect = async (id) => {
|
|
2198
2427
|
const place = await selectPlace(id);
|
|
@@ -2212,12 +2441,12 @@ var PlacesAutocomplete = ({
|
|
|
2212
2441
|
setValue(place.address);
|
|
2213
2442
|
setAnchorEl(null);
|
|
2214
2443
|
};
|
|
2215
|
-
|
|
2444
|
+
React18.useEffect(() => {
|
|
2216
2445
|
if (defaultLocation) {
|
|
2217
2446
|
setValue(defaultLocation);
|
|
2218
2447
|
}
|
|
2219
2448
|
}, [defaultLocation]);
|
|
2220
|
-
|
|
2449
|
+
React18.useEffect(() => {
|
|
2221
2450
|
if (value === "") {
|
|
2222
2451
|
onSelect(null);
|
|
2223
2452
|
}
|
|
@@ -2227,13 +2456,13 @@ var PlacesAutocomplete = ({
|
|
|
2227
2456
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2228
2457
|
};
|
|
2229
2458
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2230
|
-
|
|
2459
|
+
React18.useEffect(() => {
|
|
2231
2460
|
if (onChangeForm) {
|
|
2232
2461
|
onChangeForm({ target: { value } });
|
|
2233
2462
|
}
|
|
2234
2463
|
}, [onChangeForm]);
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2465
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2237
2466
|
Input,
|
|
2238
2467
|
{
|
|
2239
2468
|
ref: inputRef,
|
|
@@ -2247,7 +2476,7 @@ var PlacesAutocomplete = ({
|
|
|
2247
2476
|
},
|
|
2248
2477
|
"input-places"
|
|
2249
2478
|
),
|
|
2250
|
-
open && /* @__PURE__ */ (0,
|
|
2479
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "yr3Places--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent?.menu?.style), children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Flex, { container: true, ui: { p: 1 }, children: suggestions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Flex, { onClick: () => handleSelect(s.id), ui: { padding: 8, cursor: "pointer", "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" } }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { ...propsComponent?.menu?.text, children: s.description }) }, s.id)) }) })
|
|
2251
2480
|
] });
|
|
2252
2481
|
};
|
|
2253
2482
|
|
|
@@ -2264,13 +2493,18 @@ var radioVariant = createVariants({
|
|
|
2264
2493
|
secondary: "yr3Radio--color-secondary",
|
|
2265
2494
|
success: "yr3Radio--color-success",
|
|
2266
2495
|
text: "yr3Radio--color-text",
|
|
2267
|
-
disabled: "yr3Radio--color-disabled"
|
|
2496
|
+
disabled: "yr3Radio--color-disabled",
|
|
2497
|
+
background: "yr3Radio--color-background",
|
|
2498
|
+
error: "yr3Radio--color-error",
|
|
2499
|
+
warning: "yr3Radio--color-warning",
|
|
2500
|
+
info: "yr3Radio--color-info",
|
|
2501
|
+
common: "yr3Radio--color-common"
|
|
2268
2502
|
}
|
|
2269
2503
|
}
|
|
2270
2504
|
});
|
|
2271
2505
|
|
|
2272
2506
|
// src/components/Radio/Radio.tsx
|
|
2273
|
-
var
|
|
2507
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2274
2508
|
var Radio = ({
|
|
2275
2509
|
checked,
|
|
2276
2510
|
value,
|
|
@@ -2286,8 +2520,8 @@ var Radio = ({
|
|
|
2286
2520
|
const bemClass = bem("yr3Radio");
|
|
2287
2521
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2288
2522
|
const variantClass = radioVariant({ variant });
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2291
2525
|
"input",
|
|
2292
2526
|
{
|
|
2293
2527
|
type: "radio",
|
|
@@ -2299,8 +2533,8 @@ var Radio = ({
|
|
|
2299
2533
|
}
|
|
2300
2534
|
),
|
|
2301
2535
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2302
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0,
|
|
2303
|
-
typeof label === "string" && /* @__PURE__ */ (0,
|
|
2536
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2537
|
+
typeof label === "string" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2304
2538
|
"span",
|
|
2305
2539
|
{
|
|
2306
2540
|
className: "yr3Radio--label",
|
|
@@ -2313,7 +2547,104 @@ var Radio = ({
|
|
|
2313
2547
|
};
|
|
2314
2548
|
|
|
2315
2549
|
// src/components/Select/Select.tsx
|
|
2316
|
-
var
|
|
2550
|
+
var React22 = __toESM(require("react"), 1);
|
|
2551
|
+
|
|
2552
|
+
// src/theme/ThemeProvider.tsx
|
|
2553
|
+
var React20 = __toESM(require("react"), 1);
|
|
2554
|
+
|
|
2555
|
+
// src/theme/notistackContext.tsx
|
|
2556
|
+
var React19 = __toESM(require("react"), 1);
|
|
2557
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2558
|
+
var NotistackContext = React19.createContext(null);
|
|
2559
|
+
var NotistackProvider = ({ children }) => {
|
|
2560
|
+
const [snacks, setSnacks] = React19.useState([]);
|
|
2561
|
+
const notistack = (snack) => {
|
|
2562
|
+
const id = Date.now();
|
|
2563
|
+
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2564
|
+
const duration = snack.duration || 3e3;
|
|
2565
|
+
const exitDuration = 300;
|
|
2566
|
+
setTimeout(() => {
|
|
2567
|
+
setSnacks(
|
|
2568
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2569
|
+
);
|
|
2570
|
+
}, duration);
|
|
2571
|
+
setTimeout(() => {
|
|
2572
|
+
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2573
|
+
}, duration + exitDuration);
|
|
2574
|
+
};
|
|
2575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2576
|
+
children,
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Notistack, { ...snack }, snack.id)) })
|
|
2578
|
+
] });
|
|
2579
|
+
};
|
|
2580
|
+
var useNotistack = () => {
|
|
2581
|
+
const ctx = React19.useContext(NotistackContext);
|
|
2582
|
+
if (!ctx) {
|
|
2583
|
+
throw new Error("NotistackProvider missing");
|
|
2584
|
+
}
|
|
2585
|
+
return ctx;
|
|
2586
|
+
};
|
|
2587
|
+
|
|
2588
|
+
// src/theme/ThemeProvider.tsx
|
|
2589
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2590
|
+
var ThemeContext = React20.createContext(null);
|
|
2591
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2592
|
+
React20.useEffect(() => {
|
|
2593
|
+
applyTheme(theme);
|
|
2594
|
+
}, [theme]);
|
|
2595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(BackdropProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(NotistackProvider, { children }) }) });
|
|
2596
|
+
};
|
|
2597
|
+
var useTheme = () => React20.useContext(ThemeContext);
|
|
2598
|
+
|
|
2599
|
+
// src/theme/tokens.ts
|
|
2600
|
+
var baseTokens = {
|
|
2601
|
+
colors: {
|
|
2602
|
+
primary: "#6C5CE7",
|
|
2603
|
+
secondary: "#00CEC9",
|
|
2604
|
+
background: "#0f0f1a",
|
|
2605
|
+
surface: "#1a1a2e",
|
|
2606
|
+
textPrimary: "#ffffff",
|
|
2607
|
+
textSecondary: "#b2bec3"
|
|
2608
|
+
},
|
|
2609
|
+
spacing: (factor) => `${factor * 8}px`,
|
|
2610
|
+
radius: {
|
|
2611
|
+
sm: "6px",
|
|
2612
|
+
md: "12px",
|
|
2613
|
+
lg: "20px"
|
|
2614
|
+
}
|
|
2615
|
+
};
|
|
2616
|
+
|
|
2617
|
+
// src/theme/useMediaQuery.tsx
|
|
2618
|
+
var React21 = __toESM(require("react"), 1);
|
|
2619
|
+
function useMediaQuery(query) {
|
|
2620
|
+
const theme = useTheme();
|
|
2621
|
+
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2622
|
+
const [matches, setMatches] = React21.useState(() => {
|
|
2623
|
+
if (typeof window === "undefined") return false;
|
|
2624
|
+
return window.matchMedia(computedQuery).matches;
|
|
2625
|
+
});
|
|
2626
|
+
React21.useEffect(() => {
|
|
2627
|
+
if (typeof window === "undefined") return;
|
|
2628
|
+
const media = window.matchMedia(computedQuery);
|
|
2629
|
+
const listener = () => setMatches(media.matches);
|
|
2630
|
+
media.addEventListener("change", listener);
|
|
2631
|
+
return () => media.removeEventListener("change", listener);
|
|
2632
|
+
}, [computedQuery]);
|
|
2633
|
+
return matches;
|
|
2634
|
+
}
|
|
2635
|
+
function useBreakpointValue(values) {
|
|
2636
|
+
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
2637
|
+
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
2638
|
+
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
2639
|
+
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
2640
|
+
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
2641
|
+
if (xl && values.xl !== void 0) return values.xl;
|
|
2642
|
+
if (lg && values.lg !== void 0) return values.lg;
|
|
2643
|
+
if (md && values.md !== void 0) return values.md;
|
|
2644
|
+
if (sm && values.sm !== void 0) return values.sm;
|
|
2645
|
+
if (xs && values.xs !== void 0) return values.xs;
|
|
2646
|
+
return void 0;
|
|
2647
|
+
}
|
|
2317
2648
|
|
|
2318
2649
|
// src/components/Select/select.variants.ts
|
|
2319
2650
|
var selectVariants = createVariants({
|
|
@@ -2337,17 +2668,43 @@ var selectVariants = createVariants({
|
|
|
2337
2668
|
background: "yr3Select--color-background",
|
|
2338
2669
|
error: "yr3Select--color-error",
|
|
2339
2670
|
warning: "yr3Select--color-warning",
|
|
2340
|
-
info: "yr3Select--color-info"
|
|
2671
|
+
info: "yr3Select--color-info",
|
|
2672
|
+
common: "yr3Select--color-common"
|
|
2341
2673
|
},
|
|
2342
2674
|
animated: {
|
|
2343
2675
|
true: "yr3Select--animated"
|
|
2676
|
+
},
|
|
2677
|
+
icon: {
|
|
2678
|
+
true: "yr3Select--icon"
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
var selectIconVariants = createVariants({
|
|
2683
|
+
base: "yr3Select--icon",
|
|
2684
|
+
variants: {
|
|
2685
|
+
color: {
|
|
2686
|
+
primary: "yr3Select--icon-color-primary",
|
|
2687
|
+
secondary: "yr3Select--icon-color-secondary",
|
|
2688
|
+
success: "yr3Select--icon-color-success",
|
|
2689
|
+
text: "yr3Select--icon-color-text",
|
|
2690
|
+
disabled: "yr3Select--icon-color-disabled",
|
|
2691
|
+
background: "yr3Select--icon-color-background",
|
|
2692
|
+
error: "yr3Select--icon-color-error",
|
|
2693
|
+
warning: "yr3Select--icon-color-warning",
|
|
2694
|
+
info: "yr3Select--icon-color-info",
|
|
2695
|
+
common: "yr3Select--icon-color-common"
|
|
2696
|
+
},
|
|
2697
|
+
animated: {
|
|
2698
|
+
true: "yr3Select--icon-animated"
|
|
2699
|
+
},
|
|
2700
|
+
open: {
|
|
2701
|
+
true: "yr3Select--icon-open"
|
|
2344
2702
|
}
|
|
2345
2703
|
}
|
|
2346
2704
|
});
|
|
2347
|
-
var select_variants_default = selectVariants;
|
|
2348
2705
|
|
|
2349
2706
|
// src/components/Select/Select.tsx
|
|
2350
|
-
var
|
|
2707
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2351
2708
|
var initiaPropsComponent3 = {
|
|
2352
2709
|
control: {
|
|
2353
2710
|
variant: "outlined",
|
|
@@ -2357,6 +2714,7 @@ var initiaPropsComponent3 = {
|
|
|
2357
2714
|
},
|
|
2358
2715
|
label: {
|
|
2359
2716
|
display: true,
|
|
2717
|
+
color: "primary",
|
|
2360
2718
|
ui: {},
|
|
2361
2719
|
style: {}
|
|
2362
2720
|
},
|
|
@@ -2379,20 +2737,23 @@ var initiaPropsComponent3 = {
|
|
|
2379
2737
|
icon: {
|
|
2380
2738
|
style: {
|
|
2381
2739
|
width: 24,
|
|
2382
|
-
height: 24
|
|
2383
|
-
stroke: "currentColor"
|
|
2740
|
+
height: 24
|
|
2384
2741
|
},
|
|
2742
|
+
color: "primary",
|
|
2385
2743
|
component: void 0
|
|
2386
2744
|
}
|
|
2387
2745
|
};
|
|
2388
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent
|
|
2389
|
-
const [open, setOpen] =
|
|
2390
|
-
const [valueState, setValueState] =
|
|
2391
|
-
const ref =
|
|
2746
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2747
|
+
const [open, setOpen] = React22.useState(false);
|
|
2748
|
+
const [valueState, setValueState] = React22.useState(value || defaultValue || null);
|
|
2749
|
+
const ref = React22.useRef(null);
|
|
2392
2750
|
useClickAway(ref, () => setOpen(false));
|
|
2393
|
-
const
|
|
2394
|
-
|
|
2395
|
-
|
|
2751
|
+
const theme = useTheme();
|
|
2752
|
+
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2753
|
+
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2754
|
+
const classes = selectVariants({ wrapper: true });
|
|
2755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: classes, ref, children: [
|
|
2756
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2396
2757
|
Input,
|
|
2397
2758
|
{
|
|
2398
2759
|
label,
|
|
@@ -2400,27 +2761,36 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2400
2761
|
disabled: true,
|
|
2401
2762
|
value: valueState,
|
|
2402
2763
|
propsComponent: {
|
|
2403
|
-
control:
|
|
2404
|
-
label:
|
|
2764
|
+
control: properties?.control,
|
|
2765
|
+
label: properties?.label
|
|
2405
2766
|
}
|
|
2406
2767
|
}
|
|
2407
2768
|
),
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2409
|
-
|
|
2769
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2770
|
+
"div",
|
|
2410
2771
|
{
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2772
|
+
className: classesIcon,
|
|
2773
|
+
style: properties?.icon?.style,
|
|
2774
|
+
onClick: () => setOpen((prev) => !prev),
|
|
2775
|
+
"data-testid": "yr3Select-icon",
|
|
2776
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2777
|
+
IconDown,
|
|
2778
|
+
{
|
|
2779
|
+
width: properties?.icon?.style?.width,
|
|
2780
|
+
height: properties?.icon?.style?.height,
|
|
2781
|
+
stroke: "currentColor",
|
|
2782
|
+
style: properties?.icon?.style
|
|
2783
|
+
}
|
|
2784
|
+
)
|
|
2415
2785
|
}
|
|
2416
|
-
)
|
|
2417
|
-
open && /* @__PURE__ */ (0,
|
|
2786
|
+
),
|
|
2787
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2418
2788
|
"div",
|
|
2419
2789
|
{
|
|
2420
2790
|
className: "yr3Select--menu",
|
|
2421
|
-
style: composeStyles(
|
|
2791
|
+
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2422
2792
|
"data-testid": "yr3Select-menu",
|
|
2423
|
-
children: options.map((opt) => /* @__PURE__ */ (0,
|
|
2793
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2424
2794
|
"div",
|
|
2425
2795
|
{
|
|
2426
2796
|
className: "yr3Select--option",
|
|
@@ -2441,8 +2811,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2441
2811
|
};
|
|
2442
2812
|
onChange?.(event, opt.value);
|
|
2443
2813
|
},
|
|
2444
|
-
style: composeStyles(
|
|
2445
|
-
children: /* @__PURE__ */ (0,
|
|
2814
|
+
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { as: "span", variant: "caption", color: properties?.menu?.options?.text?.color || "primary", ...properties?.menu?.options?.text, children: opt.label })
|
|
2446
2816
|
},
|
|
2447
2817
|
opt.value
|
|
2448
2818
|
))
|
|
@@ -2452,8 +2822,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2452
2822
|
};
|
|
2453
2823
|
|
|
2454
2824
|
// src/components/Slide/Slide.tsx
|
|
2455
|
-
var
|
|
2456
|
-
var
|
|
2825
|
+
var React23 = __toESM(require("react"), 1);
|
|
2826
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2457
2827
|
var Slide = ({
|
|
2458
2828
|
in: inProp,
|
|
2459
2829
|
children,
|
|
@@ -2467,7 +2837,7 @@ var Slide = ({
|
|
|
2467
2837
|
[direction]: true,
|
|
2468
2838
|
"in": !!inProp
|
|
2469
2839
|
});
|
|
2470
|
-
|
|
2840
|
+
React23.useEffect(() => {
|
|
2471
2841
|
let timeoutId;
|
|
2472
2842
|
if (inProp) {
|
|
2473
2843
|
timeoutId = setTimeout(() => {
|
|
@@ -2477,19 +2847,19 @@ var Slide = ({
|
|
|
2477
2847
|
return () => clearTimeout(timeoutId);
|
|
2478
2848
|
}, [inProp, duration, onTransitionEnd]);
|
|
2479
2849
|
const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2480
|
-
return /* @__PURE__ */ (0,
|
|
2850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2481
2851
|
"div",
|
|
2482
2852
|
{
|
|
2483
2853
|
className: "yr3Slide",
|
|
2484
2854
|
style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
|
|
2485
2855
|
"data-testid": "yr3Slide",
|
|
2486
|
-
children: /* @__PURE__ */ (0,
|
|
2856
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2487
2857
|
"div",
|
|
2488
2858
|
{
|
|
2489
2859
|
className: classNameContent,
|
|
2490
2860
|
style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
|
|
2491
2861
|
"data-testid": "yr3Slide-content",
|
|
2492
|
-
children: /* @__PURE__ */ (0,
|
|
2862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
|
|
2493
2863
|
}
|
|
2494
2864
|
)
|
|
2495
2865
|
}
|
|
@@ -2497,7 +2867,7 @@ var Slide = ({
|
|
|
2497
2867
|
};
|
|
2498
2868
|
|
|
2499
2869
|
// src/components/Switch/Switch.tsx
|
|
2500
|
-
var
|
|
2870
|
+
var React24 = __toESM(require("react"), 1);
|
|
2501
2871
|
|
|
2502
2872
|
// src/components/Switch/switch.variants.ts
|
|
2503
2873
|
var switchVariants = createVariants({
|
|
@@ -2509,7 +2879,11 @@ var switchVariants = createVariants({
|
|
|
2509
2879
|
success: "yr3Switch--color-success",
|
|
2510
2880
|
text: "yr3Switch--color-text",
|
|
2511
2881
|
disabled: "yr3Switch--color-disabled",
|
|
2512
|
-
warning: "yr3Switch--color-warning"
|
|
2882
|
+
warning: "yr3Switch--color-warning",
|
|
2883
|
+
info: "yr3Switch--color-info",
|
|
2884
|
+
error: "yr3Switch--color-error",
|
|
2885
|
+
background: "yr3Switch--color-background",
|
|
2886
|
+
common: "yr3Switch--color-common"
|
|
2513
2887
|
},
|
|
2514
2888
|
size: {
|
|
2515
2889
|
sm: "yr3Switch--sm",
|
|
@@ -2530,7 +2904,7 @@ var switchVariants = createVariants({
|
|
|
2530
2904
|
});
|
|
2531
2905
|
|
|
2532
2906
|
// src/components/Switch/Switch.tsx
|
|
2533
|
-
var
|
|
2907
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2534
2908
|
var Switch = ({
|
|
2535
2909
|
checked,
|
|
2536
2910
|
defaultChecked,
|
|
@@ -2542,7 +2916,7 @@ var Switch = ({
|
|
|
2542
2916
|
placement = "end",
|
|
2543
2917
|
propsComponent
|
|
2544
2918
|
}) => {
|
|
2545
|
-
const [internal, setInternal] =
|
|
2919
|
+
const [internal, setInternal] = React24.useState(defaultChecked || false);
|
|
2546
2920
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2547
2921
|
const isControlled = checked !== void 0;
|
|
2548
2922
|
const value = isControlled ? checked : internal;
|
|
@@ -2550,13 +2924,13 @@ var Switch = ({
|
|
|
2550
2924
|
if (!isControlled) setInternal(e.target.checked);
|
|
2551
2925
|
onChange?.(e, e.target.checked);
|
|
2552
2926
|
};
|
|
2553
|
-
return /* @__PURE__ */ (0,
|
|
2927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2554
2928
|
"label",
|
|
2555
2929
|
{
|
|
2556
2930
|
className: classname,
|
|
2557
2931
|
"data-testid": "yr3Switch",
|
|
2558
2932
|
children: [
|
|
2559
|
-
/* @__PURE__ */ (0,
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2560
2934
|
"input",
|
|
2561
2935
|
{
|
|
2562
2936
|
type: "checkbox",
|
|
@@ -2565,8 +2939,8 @@ var Switch = ({
|
|
|
2565
2939
|
disabled
|
|
2566
2940
|
}
|
|
2567
2941
|
),
|
|
2568
|
-
/* @__PURE__ */ (0,
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2942
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
2943
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2570
2944
|
"span",
|
|
2571
2945
|
{
|
|
2572
2946
|
className: "yr3Switch--label",
|
|
@@ -2581,9 +2955,9 @@ var Switch = ({
|
|
|
2581
2955
|
};
|
|
2582
2956
|
|
|
2583
2957
|
// src/Icons/IconSearch.tsx
|
|
2584
|
-
var
|
|
2958
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2585
2959
|
var IconSearch = (props) => {
|
|
2586
|
-
return /* @__PURE__ */ (0,
|
|
2960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.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_runtime41.jsx)(
|
|
2587
2961
|
"path",
|
|
2588
2962
|
{
|
|
2589
2963
|
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",
|
|
@@ -2595,103 +2969,6 @@ var IconSearch = (props) => {
|
|
|
2595
2969
|
) });
|
|
2596
2970
|
};
|
|
2597
2971
|
|
|
2598
|
-
// src/theme/ThemeProvider.tsx
|
|
2599
|
-
var React22 = __toESM(require("react"), 1);
|
|
2600
|
-
|
|
2601
|
-
// src/theme/notistackContext.tsx
|
|
2602
|
-
var React21 = __toESM(require("react"), 1);
|
|
2603
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2604
|
-
var NotistackContext = React21.createContext(null);
|
|
2605
|
-
var NotistackProvider = ({ children }) => {
|
|
2606
|
-
const [snacks, setSnacks] = React21.useState([]);
|
|
2607
|
-
const notistack = (snack) => {
|
|
2608
|
-
const id = Date.now();
|
|
2609
|
-
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2610
|
-
const duration = snack.duration || 3e3;
|
|
2611
|
-
const exitDuration = 300;
|
|
2612
|
-
setTimeout(() => {
|
|
2613
|
-
setSnacks(
|
|
2614
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2615
|
-
);
|
|
2616
|
-
}, duration);
|
|
2617
|
-
setTimeout(() => {
|
|
2618
|
-
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2619
|
-
}, duration + exitDuration);
|
|
2620
|
-
};
|
|
2621
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2622
|
-
children,
|
|
2623
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Notistack, { ...snack }, snack.id)) })
|
|
2624
|
-
] });
|
|
2625
|
-
};
|
|
2626
|
-
var useNotistack = () => {
|
|
2627
|
-
const ctx = React21.useContext(NotistackContext);
|
|
2628
|
-
if (!ctx) {
|
|
2629
|
-
throw new Error("NotistackProvider missing");
|
|
2630
|
-
}
|
|
2631
|
-
return ctx;
|
|
2632
|
-
};
|
|
2633
|
-
|
|
2634
|
-
// src/theme/ThemeProvider.tsx
|
|
2635
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2636
|
-
var ThemeContext = React22.createContext(null);
|
|
2637
|
-
var ThemeProvider = ({ theme, children }) => {
|
|
2638
|
-
React22.useEffect(() => {
|
|
2639
|
-
applyTheme(theme);
|
|
2640
|
-
}, [theme]);
|
|
2641
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BackdropProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(NotistackProvider, { children }) }) });
|
|
2642
|
-
};
|
|
2643
|
-
var useTheme = () => React22.useContext(ThemeContext);
|
|
2644
|
-
|
|
2645
|
-
// src/theme/tokens.ts
|
|
2646
|
-
var baseTokens = {
|
|
2647
|
-
colors: {
|
|
2648
|
-
primary: "#6C5CE7",
|
|
2649
|
-
secondary: "#00CEC9",
|
|
2650
|
-
background: "#0f0f1a",
|
|
2651
|
-
surface: "#1a1a2e",
|
|
2652
|
-
textPrimary: "#ffffff",
|
|
2653
|
-
textSecondary: "#b2bec3"
|
|
2654
|
-
},
|
|
2655
|
-
spacing: (factor) => `${factor * 8}px`,
|
|
2656
|
-
radius: {
|
|
2657
|
-
sm: "6px",
|
|
2658
|
-
md: "12px",
|
|
2659
|
-
lg: "20px"
|
|
2660
|
-
}
|
|
2661
|
-
};
|
|
2662
|
-
|
|
2663
|
-
// src/theme/useMediaQuery.tsx
|
|
2664
|
-
var React23 = __toESM(require("react"), 1);
|
|
2665
|
-
function useMediaQuery(query) {
|
|
2666
|
-
const theme = useTheme();
|
|
2667
|
-
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2668
|
-
const [matches, setMatches] = React23.useState(() => {
|
|
2669
|
-
if (typeof window === "undefined") return false;
|
|
2670
|
-
return window.matchMedia(computedQuery).matches;
|
|
2671
|
-
});
|
|
2672
|
-
React23.useEffect(() => {
|
|
2673
|
-
if (typeof window === "undefined") return;
|
|
2674
|
-
const media = window.matchMedia(computedQuery);
|
|
2675
|
-
const listener = () => setMatches(media.matches);
|
|
2676
|
-
media.addEventListener("change", listener);
|
|
2677
|
-
return () => media.removeEventListener("change", listener);
|
|
2678
|
-
}, [computedQuery]);
|
|
2679
|
-
return matches;
|
|
2680
|
-
}
|
|
2681
|
-
function useBreakpointValue(values) {
|
|
2682
|
-
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
2683
|
-
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
2684
|
-
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
2685
|
-
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
2686
|
-
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
2687
|
-
if (xl && values.xl !== void 0) return values.xl;
|
|
2688
|
-
if (lg && values.lg !== void 0) return values.lg;
|
|
2689
|
-
if (md && values.md !== void 0) return values.md;
|
|
2690
|
-
if (sm && values.sm !== void 0) return values.sm;
|
|
2691
|
-
if (xs && values.xs !== void 0) return values.xs;
|
|
2692
|
-
return void 0;
|
|
2693
|
-
}
|
|
2694
|
-
|
|
2695
2972
|
// src/hooks/usePlaces.ts
|
|
2696
2973
|
var import_autocomplete_places2 = require("@yr3/autocomplete-places");
|
|
2697
2974
|
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
@@ -2703,7 +2980,7 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
|
2703
2980
|
};
|
|
2704
2981
|
|
|
2705
2982
|
// src/hooks/useBreakpoint.ts
|
|
2706
|
-
var
|
|
2983
|
+
var React25 = __toESM(require("react"), 1);
|
|
2707
2984
|
var breakUp = (bp) => `(min-width: ${bp}px)`;
|
|
2708
2985
|
var breakDown = (bp) => `(max-width: ${bp}px)`;
|
|
2709
2986
|
function useBreakpoint(queryInput) {
|
|
@@ -2713,8 +2990,8 @@ function useBreakpoint(queryInput) {
|
|
|
2713
2990
|
if (typeof window === "undefined") return false;
|
|
2714
2991
|
return window.matchMedia(query).matches;
|
|
2715
2992
|
};
|
|
2716
|
-
const [matches, setMatches] =
|
|
2717
|
-
|
|
2993
|
+
const [matches, setMatches] = React25.useState(getMatch);
|
|
2994
|
+
React25.useEffect(() => {
|
|
2718
2995
|
if (typeof window === "undefined") return;
|
|
2719
2996
|
const media = window.matchMedia(query);
|
|
2720
2997
|
const listener = (e) => {
|
|
@@ -2768,6 +3045,7 @@ initTheme();
|
|
|
2768
3045
|
Input,
|
|
2769
3046
|
InputArea,
|
|
2770
3047
|
Label,
|
|
3048
|
+
Loader,
|
|
2771
3049
|
Modal,
|
|
2772
3050
|
ModalContainer,
|
|
2773
3051
|
Notistack,
|
|
@@ -2784,6 +3062,7 @@ initTheme();
|
|
|
2784
3062
|
ThemeContext,
|
|
2785
3063
|
ThemeProvider,
|
|
2786
3064
|
adjustColor,
|
|
3065
|
+
alpha,
|
|
2787
3066
|
applyTheme,
|
|
2788
3067
|
baseTokens,
|
|
2789
3068
|
bem,
|
|
@@ -2796,14 +3075,19 @@ initTheme();
|
|
|
2796
3075
|
createTheme,
|
|
2797
3076
|
createVariants,
|
|
2798
3077
|
cx,
|
|
3078
|
+
darken,
|
|
2799
3079
|
getContrast,
|
|
2800
3080
|
getCountryCodePhone,
|
|
2801
3081
|
getDialPhone,
|
|
2802
3082
|
getMonthCalendar,
|
|
2803
3083
|
getNumberPhone,
|
|
3084
|
+
hexToRgb,
|
|
2804
3085
|
initTheme,
|
|
2805
3086
|
isEmpty,
|
|
3087
|
+
lighten,
|
|
3088
|
+
mergeDeep,
|
|
2806
3089
|
normalizePhone,
|
|
3090
|
+
rgbToHex,
|
|
2807
3091
|
text,
|
|
2808
3092
|
times,
|
|
2809
3093
|
uiStyle,
|