@yr3/ui 1.0.13 → 1.0.14
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 +509 -236
- package/dist/index.d.cts +72 -10
- package/dist/index.d.ts +72 -10
- package/dist/index.js +502 -236
- 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,
|
|
@@ -746,7 +824,8 @@ var textVariants = createVariants({
|
|
|
746
824
|
warning: "yr3Text--color-warning",
|
|
747
825
|
error: "yr3Text--color-error",
|
|
748
826
|
info: "yr3Text--color-info",
|
|
749
|
-
background: "yr3Text--color-background"
|
|
827
|
+
background: "yr3Text--color-background",
|
|
828
|
+
common: "yr3Text--color-common"
|
|
750
829
|
},
|
|
751
830
|
weight: {
|
|
752
831
|
light: "yr3Text--weight-light",
|
|
@@ -806,7 +885,8 @@ var buttonVariant = createVariants({
|
|
|
806
885
|
info: "yr3Button--color-info",
|
|
807
886
|
error: "yr3Button--color-error",
|
|
808
887
|
background: "yr3Button--color-background",
|
|
809
|
-
warning: "yr3Button--color-warning"
|
|
888
|
+
warning: "yr3Button--color-warning",
|
|
889
|
+
common: "yr3Button--color-common"
|
|
810
890
|
},
|
|
811
891
|
size: {
|
|
812
892
|
auto: "yr3Button--size-auto",
|
|
@@ -1002,6 +1082,19 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
1002
1082
|
// src/components/Checkbox/Checkbox.tsx
|
|
1003
1083
|
var React4 = __toESM(require("react"), 1);
|
|
1004
1084
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1085
|
+
var initialPropsComponent = {
|
|
1086
|
+
checkbox: {
|
|
1087
|
+
ui: {
|
|
1088
|
+
color: "primary"
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
content: {
|
|
1092
|
+
variant: "caption",
|
|
1093
|
+
color: "primary",
|
|
1094
|
+
ui: {},
|
|
1095
|
+
style: {}
|
|
1096
|
+
}
|
|
1097
|
+
};
|
|
1005
1098
|
var Checkbox = ({
|
|
1006
1099
|
checked,
|
|
1007
1100
|
defaultChecked,
|
|
@@ -1010,6 +1103,7 @@ var Checkbox = ({
|
|
|
1010
1103
|
color = "primary",
|
|
1011
1104
|
disabled,
|
|
1012
1105
|
propsComponent,
|
|
1106
|
+
type = "default",
|
|
1013
1107
|
variant = "text"
|
|
1014
1108
|
}) => {
|
|
1015
1109
|
const [internal, setInternal] = React4.useState(defaultChecked || false);
|
|
@@ -1019,11 +1113,12 @@ var Checkbox = ({
|
|
|
1019
1113
|
if (!isControlled) setInternal(e.target.checked);
|
|
1020
1114
|
onChange?.(e, e.target.checked);
|
|
1021
1115
|
};
|
|
1116
|
+
const properties = mergeDeep(initialPropsComponent, propsComponent || {});
|
|
1022
1117
|
const bemClasse = bem("yr3Checkbox");
|
|
1023
|
-
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}` });
|
|
1118
|
+
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
1024
1119
|
const boxClasses = bem("yr3Checkbox-box");
|
|
1025
1120
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
1026
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: classes, style: uiStyle(
|
|
1121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { className: classes, style: uiStyle(properties?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
|
|
1027
1122
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1028
1123
|
"input",
|
|
1029
1124
|
{
|
|
@@ -1035,7 +1130,7 @@ var Checkbox = ({
|
|
|
1035
1130
|
}
|
|
1036
1131
|
),
|
|
1037
1132
|
/* @__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 ?
|
|
1133
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { variant: "caption", color: !value ? properties?.content?.color : color, ...properties?.content, children: label })
|
|
1039
1134
|
] });
|
|
1040
1135
|
};
|
|
1041
1136
|
|
|
@@ -1058,7 +1153,10 @@ var chipVariants = createVariants({
|
|
|
1058
1153
|
success: "yr3Chip--success",
|
|
1059
1154
|
error: "yr3Chip--error",
|
|
1060
1155
|
warning: "yr3Chip--warning",
|
|
1061
|
-
info: "yr3Chip--info"
|
|
1156
|
+
info: "yr3Chip--info",
|
|
1157
|
+
common: "yr3Chip--common",
|
|
1158
|
+
background: "yr3Chip--background",
|
|
1159
|
+
disabled: "yr3Chip--disabled"
|
|
1062
1160
|
},
|
|
1063
1161
|
rounded: {
|
|
1064
1162
|
true: "yr3Chip--rounded",
|
|
@@ -1085,7 +1183,22 @@ var IconClose = (props) => {
|
|
|
1085
1183
|
|
|
1086
1184
|
// src/components/Chip/Chip.tsx
|
|
1087
1185
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1088
|
-
var
|
|
1186
|
+
var initialChipProps = {
|
|
1187
|
+
label: {
|
|
1188
|
+
ui: {},
|
|
1189
|
+
style: {}
|
|
1190
|
+
},
|
|
1191
|
+
delete: {
|
|
1192
|
+
ui: {},
|
|
1193
|
+
style: {}
|
|
1194
|
+
},
|
|
1195
|
+
icon: {
|
|
1196
|
+
width: 20,
|
|
1197
|
+
height: 20
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1201
|
+
const properties = mergeDeep(initialChipProps, propsComponent);
|
|
1089
1202
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
1090
1203
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1091
1204
|
"div",
|
|
@@ -1093,14 +1206,21 @@ var Chip = ({ label, variant, color, icon, onDelete, rounded, size = "medium", u
|
|
|
1093
1206
|
className,
|
|
1094
1207
|
"data-testid": "yr3Chip",
|
|
1095
1208
|
...props,
|
|
1096
|
-
style:
|
|
1097
|
-
...style,
|
|
1098
|
-
...uiStyle(ui)
|
|
1099
|
-
},
|
|
1209
|
+
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
1100
1210
|
children: [
|
|
1101
1211
|
icon,
|
|
1102
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "yr3Chip__label", children: label }),
|
|
1103
|
-
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "yr3Chip__label", style: composeStyles(properties?.label?.ui, properties?.label?.style), children: label }),
|
|
1213
|
+
deleted && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1214
|
+
"span",
|
|
1215
|
+
{
|
|
1216
|
+
className: "yr3Chip__delete",
|
|
1217
|
+
onClick: onDelete,
|
|
1218
|
+
role: "button",
|
|
1219
|
+
"aria-label": "delete",
|
|
1220
|
+
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1221
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(IconClose, { ...properties?.icon, stroke: color })
|
|
1222
|
+
}
|
|
1223
|
+
)
|
|
1104
1224
|
]
|
|
1105
1225
|
}
|
|
1106
1226
|
);
|
|
@@ -1172,7 +1292,8 @@ var controlVariants = createVariants({
|
|
|
1172
1292
|
disabled: "yr3Control--color-disabled",
|
|
1173
1293
|
info: "yr3Control--color-info",
|
|
1174
1294
|
warning: "yr3Control--color-warning",
|
|
1175
|
-
error: "yr3Control--color-error"
|
|
1295
|
+
error: "yr3Control--color-error",
|
|
1296
|
+
common: "yr3Control--color-common"
|
|
1176
1297
|
},
|
|
1177
1298
|
size: {
|
|
1178
1299
|
auto: "yr3Control--size-auto",
|
|
@@ -1249,7 +1370,8 @@ var dividerVariants = createVariants({
|
|
|
1249
1370
|
text: "yr3Divider--color-text",
|
|
1250
1371
|
warning: "yr3Divider--color-warning",
|
|
1251
1372
|
info: "yr3Divider--color-info",
|
|
1252
|
-
error: "yr3Divider--color-error"
|
|
1373
|
+
error: "yr3Divider--color-error",
|
|
1374
|
+
common: "yr3Divider--color-common"
|
|
1253
1375
|
}
|
|
1254
1376
|
}
|
|
1255
1377
|
});
|
|
@@ -1304,33 +1426,42 @@ var useClickAway = (ref, callback) => {
|
|
|
1304
1426
|
|
|
1305
1427
|
// src/components/Drawer/Drawer.tsx
|
|
1306
1428
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1429
|
+
var initialPropsComponent2 = {
|
|
1430
|
+
drawer: {},
|
|
1431
|
+
closing: null,
|
|
1432
|
+
container: {},
|
|
1433
|
+
onClose: false
|
|
1434
|
+
};
|
|
1307
1435
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1308
1436
|
const { show, hide } = useBackdrop();
|
|
1309
1437
|
const ref = React8.useRef(null);
|
|
1438
|
+
const properties = mergeDeep(initialPropsComponent2, propsComponent);
|
|
1310
1439
|
React8.useEffect(() => {
|
|
1311
|
-
if (open) {
|
|
1440
|
+
if (!!open) {
|
|
1312
1441
|
show();
|
|
1442
|
+
} else {
|
|
1443
|
+
hide();
|
|
1313
1444
|
}
|
|
1314
1445
|
}, [open]);
|
|
1315
1446
|
useClickAway(ref, () => {
|
|
1316
|
-
if (!open ||
|
|
1317
|
-
if (
|
|
1447
|
+
if (!open || properties?.closing === null) return;
|
|
1448
|
+
if (properties?.closing === "drawer") {
|
|
1318
1449
|
hide();
|
|
1319
1450
|
onClose();
|
|
1320
1451
|
}
|
|
1321
1452
|
;
|
|
1322
1453
|
});
|
|
1323
1454
|
React8.useEffect(() => {
|
|
1324
|
-
if (
|
|
1455
|
+
if (properties?.onClose) {
|
|
1325
1456
|
hide();
|
|
1326
1457
|
onClose();
|
|
1327
1458
|
}
|
|
1328
|
-
}, [
|
|
1459
|
+
}, [properties?.onClose]);
|
|
1329
1460
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1330
1461
|
"div",
|
|
1331
1462
|
{
|
|
1332
1463
|
className: `yr3Drawer ${anchor && `yr3Drawer--${anchor}`} ${open && "yr3Drawer--open"}`,
|
|
1333
|
-
style:
|
|
1464
|
+
style: properties?.drawer,
|
|
1334
1465
|
onClick: (e) => e.stopPropagation(),
|
|
1335
1466
|
ref,
|
|
1336
1467
|
"data-testid": "yr3Drawer",
|
|
@@ -1338,9 +1469,9 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1338
1469
|
DrawerContainer_default,
|
|
1339
1470
|
{
|
|
1340
1471
|
children,
|
|
1341
|
-
...
|
|
1342
|
-
props:
|
|
1343
|
-
onClose: () =>
|
|
1472
|
+
...properties?.container,
|
|
1473
|
+
props: properties?.closing,
|
|
1474
|
+
onClose: () => properties?.closing === "container" ? onClose() : {}
|
|
1344
1475
|
}
|
|
1345
1476
|
)
|
|
1346
1477
|
},
|
|
@@ -1498,7 +1629,12 @@ var groupVariants = createVariants({
|
|
|
1498
1629
|
info: "yr3Group--color-info",
|
|
1499
1630
|
disabled: "yr3Group--color-disabled",
|
|
1500
1631
|
text: "yr3Group--color-text",
|
|
1501
|
-
background: "yr3Group--color-background"
|
|
1632
|
+
background: "yr3Group--color-background",
|
|
1633
|
+
common: "yr3Group--color-common"
|
|
1634
|
+
},
|
|
1635
|
+
type: {
|
|
1636
|
+
rounded: "yr3Group--type-rounded",
|
|
1637
|
+
square: "yr3Group--type-square"
|
|
1502
1638
|
}
|
|
1503
1639
|
}
|
|
1504
1640
|
});
|
|
@@ -1520,6 +1656,7 @@ var Group = ({
|
|
|
1520
1656
|
value,
|
|
1521
1657
|
onChange,
|
|
1522
1658
|
variant,
|
|
1659
|
+
type = "rounded",
|
|
1523
1660
|
color = "primary",
|
|
1524
1661
|
propsComponent = initialComponents
|
|
1525
1662
|
}) => {
|
|
@@ -1534,7 +1671,7 @@ var Group = ({
|
|
|
1534
1671
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1535
1672
|
"div",
|
|
1536
1673
|
{
|
|
1537
|
-
className: groupVariants({ variant, color }),
|
|
1674
|
+
className: groupVariants({ variant, color, type }),
|
|
1538
1675
|
"data-testid": "yr3Group",
|
|
1539
1676
|
style: composeStyles(propsComponent.group?.ui, propsComponent.group?.style),
|
|
1540
1677
|
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -1575,7 +1712,15 @@ var Image = ({
|
|
|
1575
1712
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
1576
1713
|
var React11 = __toESM(require("react"), 1);
|
|
1577
1714
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1578
|
-
var
|
|
1715
|
+
var initialPropsComponent3 = {
|
|
1716
|
+
box: {},
|
|
1717
|
+
text: {},
|
|
1718
|
+
container: {},
|
|
1719
|
+
preview: {},
|
|
1720
|
+
content: {}
|
|
1721
|
+
};
|
|
1722
|
+
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
1723
|
+
const properties = mergeDeep(initialPropsComponent3, propsComponent || {});
|
|
1579
1724
|
const [dragging, setDragging] = React11.useState(false);
|
|
1580
1725
|
const [files, setFiles] = React11.useState([]);
|
|
1581
1726
|
const inputRef = React11.useRef(null);
|
|
@@ -1590,7 +1735,7 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1590
1735
|
};
|
|
1591
1736
|
const classes = bem("yr3Dropzone");
|
|
1592
1737
|
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", ...
|
|
1738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1594
1739
|
"div",
|
|
1595
1740
|
{
|
|
1596
1741
|
className: classComponent,
|
|
@@ -1605,7 +1750,7 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1605
1750
|
handleFiles(e.dataTransfer.files);
|
|
1606
1751
|
},
|
|
1607
1752
|
onClick: () => inputRef.current?.click(),
|
|
1608
|
-
style: composeStyles(ui, style),
|
|
1753
|
+
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1609
1754
|
children: [
|
|
1610
1755
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1611
1756
|
"input",
|
|
@@ -1618,10 +1763,10 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1618
1763
|
onChange: (e) => handleFiles(e.target.files)
|
|
1619
1764
|
}
|
|
1620
1765
|
),
|
|
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 }) }),
|
|
1766
|
+
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" }) }),
|
|
1767
|
+
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)) }),
|
|
1768
|
+
!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)) }),
|
|
1769
|
+
!!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
1770
|
component
|
|
1626
1771
|
]
|
|
1627
1772
|
}
|
|
@@ -1667,7 +1812,8 @@ var inputVariants = createVariants({
|
|
|
1667
1812
|
background: "yr3Input--color-background",
|
|
1668
1813
|
error: "yr3Input--color-error",
|
|
1669
1814
|
warning: "yr3Input--color-warning",
|
|
1670
|
-
info: "yr3Input--color-info"
|
|
1815
|
+
info: "yr3Input--color-info",
|
|
1816
|
+
common: "yr3Input--color-common"
|
|
1671
1817
|
},
|
|
1672
1818
|
size: {
|
|
1673
1819
|
auto: "yr3Input--size-auto",
|
|
@@ -1788,7 +1934,12 @@ var inputAreaVariants = createVariants({
|
|
|
1788
1934
|
secondary: "yr3InputArea--color-secondary",
|
|
1789
1935
|
success: "yr3InputArea--color-success",
|
|
1790
1936
|
text: "yr3InputArea--color-text",
|
|
1791
|
-
disabled: "yr3InputArea--color-disabled"
|
|
1937
|
+
disabled: "yr3InputArea--color-disabled",
|
|
1938
|
+
background: "yr3InputArea--color-background",
|
|
1939
|
+
error: "yr3InputArea--color-error",
|
|
1940
|
+
warning: "yr3InputArea--color-warning",
|
|
1941
|
+
info: "yr3InputArea--color-info",
|
|
1942
|
+
common: "yr3InputArea--color-common"
|
|
1792
1943
|
},
|
|
1793
1944
|
size: {
|
|
1794
1945
|
auto: "yr3InputArea--size-auto",
|
|
@@ -1875,22 +2026,88 @@ var InputArea = ({
|
|
|
1875
2026
|
] });
|
|
1876
2027
|
};
|
|
1877
2028
|
|
|
1878
|
-
// src/components/
|
|
2029
|
+
// src/components/Loader/loader.variants.ts
|
|
2030
|
+
var loaderSpinnerVariants = createVariants({
|
|
2031
|
+
base: "yr3Loader--spinner",
|
|
2032
|
+
variants: {
|
|
2033
|
+
color: {
|
|
2034
|
+
primary: "yr3Loader--spinner-color-primary",
|
|
2035
|
+
secondary: "yr3Loader--spinner-color-secondary",
|
|
2036
|
+
success: "yr3Loader--spinner-color-success",
|
|
2037
|
+
error: "yr3Loader--spinner-color-error",
|
|
2038
|
+
warning: "yr3Loader--spinner-color-warning",
|
|
2039
|
+
info: "yr3Loader--spinner-color-info",
|
|
2040
|
+
disabled: "yr3Loader--spinner-color-disabled",
|
|
2041
|
+
text: "yr3Loader--spinner-color-text",
|
|
2042
|
+
background: "yr3Loader--spinner-color-background",
|
|
2043
|
+
common: "yr3Loader--spinner-color-common"
|
|
2044
|
+
},
|
|
2045
|
+
size: {
|
|
2046
|
+
sm: "yr3Loader--spinner-size-sm",
|
|
2047
|
+
md: "yr3Loader--spinner-size-md",
|
|
2048
|
+
lg: "yr3Loader--spinner-size-lg"
|
|
2049
|
+
},
|
|
2050
|
+
type: {
|
|
2051
|
+
default: "yr3Loader--spinner-default",
|
|
2052
|
+
dots: "yr3Loader--spinner-dots",
|
|
2053
|
+
fancy: "yr3Loader--spinner-fancy"
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
});
|
|
2057
|
+
|
|
2058
|
+
// src/components/Loader/Loader.tsx
|
|
1879
2059
|
var React14 = __toESM(require("react"), 1);
|
|
2060
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2061
|
+
var initialComponents2 = {
|
|
2062
|
+
loader: {
|
|
2063
|
+
ui: {},
|
|
2064
|
+
style: {}
|
|
2065
|
+
},
|
|
2066
|
+
spinner: {
|
|
2067
|
+
size: "sm",
|
|
2068
|
+
color: "primary",
|
|
2069
|
+
type: "default"
|
|
2070
|
+
},
|
|
2071
|
+
container: {
|
|
2072
|
+
center: true,
|
|
2073
|
+
container: true,
|
|
2074
|
+
ui: {
|
|
2075
|
+
width: "100%",
|
|
2076
|
+
height: "100%"
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
2081
|
+
const properties = mergeDeep(initialComponents2, propsComponent || {});
|
|
2082
|
+
const classSpinner = loaderSpinnerVariants({
|
|
2083
|
+
color: properties?.spinner?.color,
|
|
2084
|
+
type: properties?.spinner?.type,
|
|
2085
|
+
size: properties?.spinner?.size
|
|
2086
|
+
});
|
|
2087
|
+
if (!loading) return null;
|
|
2088
|
+
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: [
|
|
2089
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {}),
|
|
2090
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {}),
|
|
2091
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", {})
|
|
2092
|
+
] }) }) }) });
|
|
2093
|
+
};
|
|
2094
|
+
|
|
2095
|
+
// src/components/Modal/Modal.tsx
|
|
2096
|
+
var React15 = __toESM(require("react"), 1);
|
|
1880
2097
|
|
|
1881
2098
|
// src/components/Modal/ModalContainer.tsx
|
|
1882
|
-
var
|
|
2099
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1883
2100
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
1884
2101
|
const classes = bem("yr3Modal-container");
|
|
1885
2102
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
1886
|
-
return /* @__PURE__ */ (0,
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
1887
2104
|
};
|
|
1888
2105
|
|
|
1889
2106
|
// src/components/Modal/Modal.tsx
|
|
1890
|
-
var
|
|
2107
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1891
2108
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
1892
2109
|
const { show, hide } = useBackdrop();
|
|
1893
|
-
|
|
2110
|
+
React15.useEffect(() => {
|
|
1894
2111
|
if (open) {
|
|
1895
2112
|
show();
|
|
1896
2113
|
} else {
|
|
@@ -1899,9 +2116,9 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
1899
2116
|
}, [open, show]);
|
|
1900
2117
|
const classes = bem("yr3Modal");
|
|
1901
2118
|
const classComponent = classes(void 0, { "open": !!open });
|
|
1902
|
-
return /* @__PURE__ */ (0,
|
|
2119
|
+
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
2120
|
children,
|
|
1904
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0,
|
|
2121
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
1905
2122
|
] }) }) });
|
|
1906
2123
|
};
|
|
1907
2124
|
|
|
@@ -1941,15 +2158,15 @@ var notistackVariants = createVariants({
|
|
|
1941
2158
|
});
|
|
1942
2159
|
|
|
1943
2160
|
// src/components/Notistack/Notistack.tsx
|
|
1944
|
-
var
|
|
2161
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1945
2162
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
1946
2163
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
1947
2164
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
1948
2165
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
1949
2166
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
1950
|
-
return /* @__PURE__ */ (0,
|
|
1951
|
-
/* @__PURE__ */ (0,
|
|
1952
|
-
/* @__PURE__ */ (0,
|
|
2167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
2168
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: containerStyle, children: message }),
|
|
2169
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1953
2170
|
"div",
|
|
1954
2171
|
{
|
|
1955
2172
|
className: "yr3Notistack--progress",
|
|
@@ -1977,13 +2194,14 @@ var pendingVariants = createVariants({
|
|
|
1977
2194
|
text: "yr3Pending--color-text",
|
|
1978
2195
|
info: "yr3Pending--color-info",
|
|
1979
2196
|
background: "yr3Pending--color-background",
|
|
1980
|
-
warning: "yr3Pending--color-warning"
|
|
2197
|
+
warning: "yr3Pending--color-warning",
|
|
2198
|
+
common: "yr3Pending--color-common"
|
|
1981
2199
|
}
|
|
1982
2200
|
}
|
|
1983
2201
|
});
|
|
1984
2202
|
|
|
1985
2203
|
// src/components/Pending/Pending.tsx
|
|
1986
|
-
var
|
|
2204
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1987
2205
|
var Pending = ({
|
|
1988
2206
|
variant,
|
|
1989
2207
|
width,
|
|
@@ -1996,7 +2214,7 @@ var Pending = ({
|
|
|
1996
2214
|
const widthStyle = variant === "circle" ? size : width;
|
|
1997
2215
|
const heightStyle = variant === "circle" ? size : height;
|
|
1998
2216
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
1999
|
-
return /* @__PURE__ */ (0,
|
|
2217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2000
2218
|
"div",
|
|
2001
2219
|
{
|
|
2002
2220
|
className: pendingVariants({ variant, color }),
|
|
@@ -2007,19 +2225,19 @@ var Pending = ({
|
|
|
2007
2225
|
};
|
|
2008
2226
|
|
|
2009
2227
|
// src/components/Phone/Phone.tsx
|
|
2010
|
-
var
|
|
2228
|
+
var React17 = __toESM(require("react"), 1);
|
|
2011
2229
|
|
|
2012
2230
|
// src/components/Selector/Selector.tsx
|
|
2013
|
-
var
|
|
2231
|
+
var React16 = __toESM(require("react"), 1);
|
|
2014
2232
|
|
|
2015
2233
|
// src/Icons/IconDown.tsx
|
|
2016
|
-
var
|
|
2234
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2017
2235
|
var IconDown = (props) => {
|
|
2018
|
-
return /* @__PURE__ */ (0,
|
|
2236
|
+
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
2237
|
};
|
|
2020
2238
|
|
|
2021
2239
|
// src/components/Selector/Selector.tsx
|
|
2022
|
-
var
|
|
2240
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2023
2241
|
var initalPropsComponent2 = {
|
|
2024
2242
|
text: {
|
|
2025
2243
|
variant: "caption",
|
|
@@ -2032,16 +2250,16 @@ var initalPropsComponent2 = {
|
|
|
2032
2250
|
}
|
|
2033
2251
|
};
|
|
2034
2252
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
2035
|
-
const [open, setOpen] =
|
|
2036
|
-
const [valueState, setValueState] =
|
|
2037
|
-
const ref =
|
|
2253
|
+
const [open, setOpen] = React16.useState(false);
|
|
2254
|
+
const [valueState, setValueState] = React16.useState(value || defaultValue || null);
|
|
2255
|
+
const ref = React16.useRef(null);
|
|
2038
2256
|
useClickAway(ref, () => setOpen(false));
|
|
2039
|
-
return /* @__PURE__ */ (0,
|
|
2040
|
-
/* @__PURE__ */ (0,
|
|
2041
|
-
/* @__PURE__ */ (0,
|
|
2257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
2258
|
+
/* @__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: [
|
|
2259
|
+
/* @__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
2260
|
valueState
|
|
2043
2261
|
] }) }),
|
|
2044
|
-
open && /* @__PURE__ */ (0,
|
|
2262
|
+
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
2263
|
"div",
|
|
2046
2264
|
{
|
|
2047
2265
|
className: "yr3Selector--option",
|
|
@@ -2062,7 +2280,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
2062
2280
|
};
|
|
2063
2281
|
onChange?.(event, opt.value);
|
|
2064
2282
|
},
|
|
2065
|
-
children: /* @__PURE__ */ (0,
|
|
2283
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { ...propsComponent?.text, children: propsComponent?.text?.children || opt.label })
|
|
2066
2284
|
},
|
|
2067
2285
|
opt.value
|
|
2068
2286
|
)) })
|
|
@@ -2071,7 +2289,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
2071
2289
|
var Selector_default = Selector;
|
|
2072
2290
|
|
|
2073
2291
|
// src/components/Phone/Phone.tsx
|
|
2074
|
-
var
|
|
2292
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2075
2293
|
var Phone = ({
|
|
2076
2294
|
name,
|
|
2077
2295
|
value,
|
|
@@ -2083,13 +2301,13 @@ var Phone = ({
|
|
|
2083
2301
|
}) => {
|
|
2084
2302
|
const isControlled = value !== void 0;
|
|
2085
2303
|
const initial = value || defaultValue || "";
|
|
2086
|
-
const [prefix, setPrefix] =
|
|
2304
|
+
const [prefix, setPrefix] = React17.useState(
|
|
2087
2305
|
getDialPhone(initial, countries) || countries[0].dial
|
|
2088
2306
|
);
|
|
2089
|
-
const [number, setNumber] =
|
|
2307
|
+
const [number, setNumber] = React17.useState(
|
|
2090
2308
|
getNumberPhone(initial, prefix) || ""
|
|
2091
2309
|
);
|
|
2092
|
-
|
|
2310
|
+
React17.useEffect(() => {
|
|
2093
2311
|
if (isControlled && value) {
|
|
2094
2312
|
const dial = getDialPhone(value, countries);
|
|
2095
2313
|
const num = getNumberPhone(value, dial);
|
|
@@ -2108,10 +2326,10 @@ var Phone = ({
|
|
|
2108
2326
|
setPrefix(val);
|
|
2109
2327
|
onChange?.(null, `${val}${number}`);
|
|
2110
2328
|
};
|
|
2111
|
-
return /* @__PURE__ */ (0,
|
|
2112
|
-
/* @__PURE__ */ (0,
|
|
2113
|
-
/* @__PURE__ */ (0,
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
2329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
2331
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { variant: "row", container: true, center: true, children: [
|
|
2332
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2115
2333
|
Selector_default,
|
|
2116
2334
|
{
|
|
2117
2335
|
options: countries.map((c) => ({
|
|
@@ -2123,7 +2341,7 @@ var Phone = ({
|
|
|
2123
2341
|
...propsComponent?.selector
|
|
2124
2342
|
}
|
|
2125
2343
|
),
|
|
2126
|
-
/* @__PURE__ */ (0,
|
|
2344
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2127
2345
|
Divider,
|
|
2128
2346
|
{
|
|
2129
2347
|
orientation: "vertical",
|
|
@@ -2132,7 +2350,7 @@ var Phone = ({
|
|
|
2132
2350
|
...propsComponent?.divider
|
|
2133
2351
|
}
|
|
2134
2352
|
),
|
|
2135
|
-
/* @__PURE__ */ (0,
|
|
2353
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2136
2354
|
Input,
|
|
2137
2355
|
{
|
|
2138
2356
|
type: "number",
|
|
@@ -2148,9 +2366,9 @@ var Phone = ({
|
|
|
2148
2366
|
};
|
|
2149
2367
|
|
|
2150
2368
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
2151
|
-
var
|
|
2369
|
+
var React18 = __toESM(require("react"), 1);
|
|
2152
2370
|
var import_autocomplete_places = require("@yr3/autocomplete-places");
|
|
2153
|
-
var
|
|
2371
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2154
2372
|
var initPropsComponent = {
|
|
2155
2373
|
label: {
|
|
2156
2374
|
display: true,
|
|
@@ -2190,9 +2408,9 @@ var PlacesAutocomplete = ({
|
|
|
2190
2408
|
keyApi,
|
|
2191
2409
|
propsComponent = initPropsComponent
|
|
2192
2410
|
}) => {
|
|
2193
|
-
const [value, setValue] =
|
|
2194
|
-
const inputRef =
|
|
2195
|
-
const [anchorEl, setAnchorEl] =
|
|
2411
|
+
const [value, setValue] = React18.useState(null);
|
|
2412
|
+
const inputRef = React18.useRef(null);
|
|
2413
|
+
const [anchorEl, setAnchorEl] = React18.useState(null);
|
|
2196
2414
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
2197
2415
|
const handleSelect = async (id) => {
|
|
2198
2416
|
const place = await selectPlace(id);
|
|
@@ -2212,12 +2430,12 @@ var PlacesAutocomplete = ({
|
|
|
2212
2430
|
setValue(place.address);
|
|
2213
2431
|
setAnchorEl(null);
|
|
2214
2432
|
};
|
|
2215
|
-
|
|
2433
|
+
React18.useEffect(() => {
|
|
2216
2434
|
if (defaultLocation) {
|
|
2217
2435
|
setValue(defaultLocation);
|
|
2218
2436
|
}
|
|
2219
2437
|
}, [defaultLocation]);
|
|
2220
|
-
|
|
2438
|
+
React18.useEffect(() => {
|
|
2221
2439
|
if (value === "") {
|
|
2222
2440
|
onSelect(null);
|
|
2223
2441
|
}
|
|
@@ -2227,13 +2445,13 @@ var PlacesAutocomplete = ({
|
|
|
2227
2445
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2228
2446
|
};
|
|
2229
2447
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2230
|
-
|
|
2448
|
+
React18.useEffect(() => {
|
|
2231
2449
|
if (onChangeForm) {
|
|
2232
2450
|
onChangeForm({ target: { value } });
|
|
2233
2451
|
}
|
|
2234
2452
|
}, [onChangeForm]);
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
2236
|
-
/* @__PURE__ */ (0,
|
|
2453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2237
2455
|
Input,
|
|
2238
2456
|
{
|
|
2239
2457
|
ref: inputRef,
|
|
@@ -2247,7 +2465,7 @@ var PlacesAutocomplete = ({
|
|
|
2247
2465
|
},
|
|
2248
2466
|
"input-places"
|
|
2249
2467
|
),
|
|
2250
|
-
open && /* @__PURE__ */ (0,
|
|
2468
|
+
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
2469
|
] });
|
|
2252
2470
|
};
|
|
2253
2471
|
|
|
@@ -2264,13 +2482,18 @@ var radioVariant = createVariants({
|
|
|
2264
2482
|
secondary: "yr3Radio--color-secondary",
|
|
2265
2483
|
success: "yr3Radio--color-success",
|
|
2266
2484
|
text: "yr3Radio--color-text",
|
|
2267
|
-
disabled: "yr3Radio--color-disabled"
|
|
2485
|
+
disabled: "yr3Radio--color-disabled",
|
|
2486
|
+
background: "yr3Radio--color-background",
|
|
2487
|
+
error: "yr3Radio--color-error",
|
|
2488
|
+
warning: "yr3Radio--color-warning",
|
|
2489
|
+
info: "yr3Radio--color-info",
|
|
2490
|
+
common: "yr3Radio--color-common"
|
|
2268
2491
|
}
|
|
2269
2492
|
}
|
|
2270
2493
|
});
|
|
2271
2494
|
|
|
2272
2495
|
// src/components/Radio/Radio.tsx
|
|
2273
|
-
var
|
|
2496
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2274
2497
|
var Radio = ({
|
|
2275
2498
|
checked,
|
|
2276
2499
|
value,
|
|
@@ -2286,8 +2509,8 @@ var Radio = ({
|
|
|
2286
2509
|
const bemClass = bem("yr3Radio");
|
|
2287
2510
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2288
2511
|
const variantClass = radioVariant({ variant });
|
|
2289
|
-
return /* @__PURE__ */ (0,
|
|
2290
|
-
/* @__PURE__ */ (0,
|
|
2512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2291
2514
|
"input",
|
|
2292
2515
|
{
|
|
2293
2516
|
type: "radio",
|
|
@@ -2299,8 +2522,8 @@ var Radio = ({
|
|
|
2299
2522
|
}
|
|
2300
2523
|
),
|
|
2301
2524
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2302
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0,
|
|
2303
|
-
typeof label === "string" && /* @__PURE__ */ (0,
|
|
2525
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2526
|
+
typeof label === "string" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2304
2527
|
"span",
|
|
2305
2528
|
{
|
|
2306
2529
|
className: "yr3Radio--label",
|
|
@@ -2313,7 +2536,104 @@ var Radio = ({
|
|
|
2313
2536
|
};
|
|
2314
2537
|
|
|
2315
2538
|
// src/components/Select/Select.tsx
|
|
2316
|
-
var
|
|
2539
|
+
var React22 = __toESM(require("react"), 1);
|
|
2540
|
+
|
|
2541
|
+
// src/theme/ThemeProvider.tsx
|
|
2542
|
+
var React20 = __toESM(require("react"), 1);
|
|
2543
|
+
|
|
2544
|
+
// src/theme/notistackContext.tsx
|
|
2545
|
+
var React19 = __toESM(require("react"), 1);
|
|
2546
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2547
|
+
var NotistackContext = React19.createContext(null);
|
|
2548
|
+
var NotistackProvider = ({ children }) => {
|
|
2549
|
+
const [snacks, setSnacks] = React19.useState([]);
|
|
2550
|
+
const notistack = (snack) => {
|
|
2551
|
+
const id = Date.now();
|
|
2552
|
+
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2553
|
+
const duration = snack.duration || 3e3;
|
|
2554
|
+
const exitDuration = 300;
|
|
2555
|
+
setTimeout(() => {
|
|
2556
|
+
setSnacks(
|
|
2557
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2558
|
+
);
|
|
2559
|
+
}, duration);
|
|
2560
|
+
setTimeout(() => {
|
|
2561
|
+
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2562
|
+
}, duration + exitDuration);
|
|
2563
|
+
};
|
|
2564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2565
|
+
children,
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Notistack, { ...snack }, snack.id)) })
|
|
2567
|
+
] });
|
|
2568
|
+
};
|
|
2569
|
+
var useNotistack = () => {
|
|
2570
|
+
const ctx = React19.useContext(NotistackContext);
|
|
2571
|
+
if (!ctx) {
|
|
2572
|
+
throw new Error("NotistackProvider missing");
|
|
2573
|
+
}
|
|
2574
|
+
return ctx;
|
|
2575
|
+
};
|
|
2576
|
+
|
|
2577
|
+
// src/theme/ThemeProvider.tsx
|
|
2578
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2579
|
+
var ThemeContext = React20.createContext(null);
|
|
2580
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2581
|
+
React20.useEffect(() => {
|
|
2582
|
+
applyTheme(theme);
|
|
2583
|
+
}, [theme]);
|
|
2584
|
+
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 }) }) });
|
|
2585
|
+
};
|
|
2586
|
+
var useTheme = () => React20.useContext(ThemeContext);
|
|
2587
|
+
|
|
2588
|
+
// src/theme/tokens.ts
|
|
2589
|
+
var baseTokens = {
|
|
2590
|
+
colors: {
|
|
2591
|
+
primary: "#6C5CE7",
|
|
2592
|
+
secondary: "#00CEC9",
|
|
2593
|
+
background: "#0f0f1a",
|
|
2594
|
+
surface: "#1a1a2e",
|
|
2595
|
+
textPrimary: "#ffffff",
|
|
2596
|
+
textSecondary: "#b2bec3"
|
|
2597
|
+
},
|
|
2598
|
+
spacing: (factor) => `${factor * 8}px`,
|
|
2599
|
+
radius: {
|
|
2600
|
+
sm: "6px",
|
|
2601
|
+
md: "12px",
|
|
2602
|
+
lg: "20px"
|
|
2603
|
+
}
|
|
2604
|
+
};
|
|
2605
|
+
|
|
2606
|
+
// src/theme/useMediaQuery.tsx
|
|
2607
|
+
var React21 = __toESM(require("react"), 1);
|
|
2608
|
+
function useMediaQuery(query) {
|
|
2609
|
+
const theme = useTheme();
|
|
2610
|
+
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2611
|
+
const [matches, setMatches] = React21.useState(() => {
|
|
2612
|
+
if (typeof window === "undefined") return false;
|
|
2613
|
+
return window.matchMedia(computedQuery).matches;
|
|
2614
|
+
});
|
|
2615
|
+
React21.useEffect(() => {
|
|
2616
|
+
if (typeof window === "undefined") return;
|
|
2617
|
+
const media = window.matchMedia(computedQuery);
|
|
2618
|
+
const listener = () => setMatches(media.matches);
|
|
2619
|
+
media.addEventListener("change", listener);
|
|
2620
|
+
return () => media.removeEventListener("change", listener);
|
|
2621
|
+
}, [computedQuery]);
|
|
2622
|
+
return matches;
|
|
2623
|
+
}
|
|
2624
|
+
function useBreakpointValue(values) {
|
|
2625
|
+
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
2626
|
+
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
2627
|
+
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
2628
|
+
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
2629
|
+
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
2630
|
+
if (xl && values.xl !== void 0) return values.xl;
|
|
2631
|
+
if (lg && values.lg !== void 0) return values.lg;
|
|
2632
|
+
if (md && values.md !== void 0) return values.md;
|
|
2633
|
+
if (sm && values.sm !== void 0) return values.sm;
|
|
2634
|
+
if (xs && values.xs !== void 0) return values.xs;
|
|
2635
|
+
return void 0;
|
|
2636
|
+
}
|
|
2317
2637
|
|
|
2318
2638
|
// src/components/Select/select.variants.ts
|
|
2319
2639
|
var selectVariants = createVariants({
|
|
@@ -2337,17 +2657,43 @@ var selectVariants = createVariants({
|
|
|
2337
2657
|
background: "yr3Select--color-background",
|
|
2338
2658
|
error: "yr3Select--color-error",
|
|
2339
2659
|
warning: "yr3Select--color-warning",
|
|
2340
|
-
info: "yr3Select--color-info"
|
|
2660
|
+
info: "yr3Select--color-info",
|
|
2661
|
+
common: "yr3Select--color-common"
|
|
2341
2662
|
},
|
|
2342
2663
|
animated: {
|
|
2343
2664
|
true: "yr3Select--animated"
|
|
2665
|
+
},
|
|
2666
|
+
icon: {
|
|
2667
|
+
true: "yr3Select--icon"
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
});
|
|
2671
|
+
var selectIconVariants = createVariants({
|
|
2672
|
+
base: "yr3Select--icon",
|
|
2673
|
+
variants: {
|
|
2674
|
+
color: {
|
|
2675
|
+
primary: "yr3Select--icon-color-primary",
|
|
2676
|
+
secondary: "yr3Select--icon-color-secondary",
|
|
2677
|
+
success: "yr3Select--icon-color-success",
|
|
2678
|
+
text: "yr3Select--icon-color-text",
|
|
2679
|
+
disabled: "yr3Select--icon-color-disabled",
|
|
2680
|
+
background: "yr3Select--icon-color-background",
|
|
2681
|
+
error: "yr3Select--icon-color-error",
|
|
2682
|
+
warning: "yr3Select--icon-color-warning",
|
|
2683
|
+
info: "yr3Select--icon-color-info",
|
|
2684
|
+
common: "yr3Select--icon-color-common"
|
|
2685
|
+
},
|
|
2686
|
+
animated: {
|
|
2687
|
+
true: "yr3Select--icon-animated"
|
|
2688
|
+
},
|
|
2689
|
+
open: {
|
|
2690
|
+
true: "yr3Select--icon-open"
|
|
2344
2691
|
}
|
|
2345
2692
|
}
|
|
2346
2693
|
});
|
|
2347
|
-
var select_variants_default = selectVariants;
|
|
2348
2694
|
|
|
2349
2695
|
// src/components/Select/Select.tsx
|
|
2350
|
-
var
|
|
2696
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2351
2697
|
var initiaPropsComponent3 = {
|
|
2352
2698
|
control: {
|
|
2353
2699
|
variant: "outlined",
|
|
@@ -2357,6 +2703,7 @@ var initiaPropsComponent3 = {
|
|
|
2357
2703
|
},
|
|
2358
2704
|
label: {
|
|
2359
2705
|
display: true,
|
|
2706
|
+
color: "primary",
|
|
2360
2707
|
ui: {},
|
|
2361
2708
|
style: {}
|
|
2362
2709
|
},
|
|
@@ -2379,20 +2726,23 @@ var initiaPropsComponent3 = {
|
|
|
2379
2726
|
icon: {
|
|
2380
2727
|
style: {
|
|
2381
2728
|
width: 24,
|
|
2382
|
-
height: 24
|
|
2383
|
-
stroke: "currentColor"
|
|
2729
|
+
height: 24
|
|
2384
2730
|
},
|
|
2731
|
+
color: "primary",
|
|
2385
2732
|
component: void 0
|
|
2386
2733
|
}
|
|
2387
2734
|
};
|
|
2388
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent
|
|
2389
|
-
const [open, setOpen] =
|
|
2390
|
-
const [valueState, setValueState] =
|
|
2391
|
-
const ref =
|
|
2735
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2736
|
+
const [open, setOpen] = React22.useState(false);
|
|
2737
|
+
const [valueState, setValueState] = React22.useState(value || defaultValue || null);
|
|
2738
|
+
const ref = React22.useRef(null);
|
|
2392
2739
|
useClickAway(ref, () => setOpen(false));
|
|
2393
|
-
const
|
|
2394
|
-
|
|
2395
|
-
|
|
2740
|
+
const theme = useTheme();
|
|
2741
|
+
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2742
|
+
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2743
|
+
const classes = selectVariants({ wrapper: true });
|
|
2744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: classes, ref, children: [
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2396
2746
|
Input,
|
|
2397
2747
|
{
|
|
2398
2748
|
label,
|
|
@@ -2400,27 +2750,36 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2400
2750
|
disabled: true,
|
|
2401
2751
|
value: valueState,
|
|
2402
2752
|
propsComponent: {
|
|
2403
|
-
control:
|
|
2404
|
-
label:
|
|
2753
|
+
control: properties?.control,
|
|
2754
|
+
label: properties?.label
|
|
2405
2755
|
}
|
|
2406
2756
|
}
|
|
2407
2757
|
),
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2409
|
-
|
|
2758
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2759
|
+
"div",
|
|
2410
2760
|
{
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2761
|
+
className: classesIcon,
|
|
2762
|
+
style: properties?.icon?.style,
|
|
2763
|
+
onClick: () => setOpen((prev) => !prev),
|
|
2764
|
+
"data-testid": "yr3Select-icon",
|
|
2765
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2766
|
+
IconDown,
|
|
2767
|
+
{
|
|
2768
|
+
width: properties?.icon?.style?.width,
|
|
2769
|
+
height: properties?.icon?.style?.height,
|
|
2770
|
+
stroke: "currentColor",
|
|
2771
|
+
style: properties?.icon?.style
|
|
2772
|
+
}
|
|
2773
|
+
)
|
|
2415
2774
|
}
|
|
2416
|
-
)
|
|
2417
|
-
open && /* @__PURE__ */ (0,
|
|
2775
|
+
),
|
|
2776
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2418
2777
|
"div",
|
|
2419
2778
|
{
|
|
2420
2779
|
className: "yr3Select--menu",
|
|
2421
|
-
style: composeStyles(
|
|
2780
|
+
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2422
2781
|
"data-testid": "yr3Select-menu",
|
|
2423
|
-
children: options.map((opt) => /* @__PURE__ */ (0,
|
|
2782
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2424
2783
|
"div",
|
|
2425
2784
|
{
|
|
2426
2785
|
className: "yr3Select--option",
|
|
@@ -2441,8 +2800,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2441
2800
|
};
|
|
2442
2801
|
onChange?.(event, opt.value);
|
|
2443
2802
|
},
|
|
2444
|
-
style: composeStyles(
|
|
2445
|
-
children: /* @__PURE__ */ (0,
|
|
2803
|
+
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2804
|
+
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
2805
|
},
|
|
2447
2806
|
opt.value
|
|
2448
2807
|
))
|
|
@@ -2452,8 +2811,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2452
2811
|
};
|
|
2453
2812
|
|
|
2454
2813
|
// src/components/Slide/Slide.tsx
|
|
2455
|
-
var
|
|
2456
|
-
var
|
|
2814
|
+
var React23 = __toESM(require("react"), 1);
|
|
2815
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2457
2816
|
var Slide = ({
|
|
2458
2817
|
in: inProp,
|
|
2459
2818
|
children,
|
|
@@ -2467,7 +2826,7 @@ var Slide = ({
|
|
|
2467
2826
|
[direction]: true,
|
|
2468
2827
|
"in": !!inProp
|
|
2469
2828
|
});
|
|
2470
|
-
|
|
2829
|
+
React23.useEffect(() => {
|
|
2471
2830
|
let timeoutId;
|
|
2472
2831
|
if (inProp) {
|
|
2473
2832
|
timeoutId = setTimeout(() => {
|
|
@@ -2477,19 +2836,19 @@ var Slide = ({
|
|
|
2477
2836
|
return () => clearTimeout(timeoutId);
|
|
2478
2837
|
}, [inProp, duration, onTransitionEnd]);
|
|
2479
2838
|
const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2480
|
-
return /* @__PURE__ */ (0,
|
|
2839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2481
2840
|
"div",
|
|
2482
2841
|
{
|
|
2483
2842
|
className: "yr3Slide",
|
|
2484
2843
|
style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
|
|
2485
2844
|
"data-testid": "yr3Slide",
|
|
2486
|
-
children: /* @__PURE__ */ (0,
|
|
2845
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2487
2846
|
"div",
|
|
2488
2847
|
{
|
|
2489
2848
|
className: classNameContent,
|
|
2490
2849
|
style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
|
|
2491
2850
|
"data-testid": "yr3Slide-content",
|
|
2492
|
-
children: /* @__PURE__ */ (0,
|
|
2851
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
|
|
2493
2852
|
}
|
|
2494
2853
|
)
|
|
2495
2854
|
}
|
|
@@ -2497,7 +2856,7 @@ var Slide = ({
|
|
|
2497
2856
|
};
|
|
2498
2857
|
|
|
2499
2858
|
// src/components/Switch/Switch.tsx
|
|
2500
|
-
var
|
|
2859
|
+
var React24 = __toESM(require("react"), 1);
|
|
2501
2860
|
|
|
2502
2861
|
// src/components/Switch/switch.variants.ts
|
|
2503
2862
|
var switchVariants = createVariants({
|
|
@@ -2509,7 +2868,11 @@ var switchVariants = createVariants({
|
|
|
2509
2868
|
success: "yr3Switch--color-success",
|
|
2510
2869
|
text: "yr3Switch--color-text",
|
|
2511
2870
|
disabled: "yr3Switch--color-disabled",
|
|
2512
|
-
warning: "yr3Switch--color-warning"
|
|
2871
|
+
warning: "yr3Switch--color-warning",
|
|
2872
|
+
info: "yr3Switch--color-info",
|
|
2873
|
+
error: "yr3Switch--color-error",
|
|
2874
|
+
background: "yr3Switch--color-background",
|
|
2875
|
+
common: "yr3Switch--color-common"
|
|
2513
2876
|
},
|
|
2514
2877
|
size: {
|
|
2515
2878
|
sm: "yr3Switch--sm",
|
|
@@ -2530,7 +2893,7 @@ var switchVariants = createVariants({
|
|
|
2530
2893
|
});
|
|
2531
2894
|
|
|
2532
2895
|
// src/components/Switch/Switch.tsx
|
|
2533
|
-
var
|
|
2896
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2534
2897
|
var Switch = ({
|
|
2535
2898
|
checked,
|
|
2536
2899
|
defaultChecked,
|
|
@@ -2542,7 +2905,7 @@ var Switch = ({
|
|
|
2542
2905
|
placement = "end",
|
|
2543
2906
|
propsComponent
|
|
2544
2907
|
}) => {
|
|
2545
|
-
const [internal, setInternal] =
|
|
2908
|
+
const [internal, setInternal] = React24.useState(defaultChecked || false);
|
|
2546
2909
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2547
2910
|
const isControlled = checked !== void 0;
|
|
2548
2911
|
const value = isControlled ? checked : internal;
|
|
@@ -2550,13 +2913,13 @@ var Switch = ({
|
|
|
2550
2913
|
if (!isControlled) setInternal(e.target.checked);
|
|
2551
2914
|
onChange?.(e, e.target.checked);
|
|
2552
2915
|
};
|
|
2553
|
-
return /* @__PURE__ */ (0,
|
|
2916
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
2554
2917
|
"label",
|
|
2555
2918
|
{
|
|
2556
2919
|
className: classname,
|
|
2557
2920
|
"data-testid": "yr3Switch",
|
|
2558
2921
|
children: [
|
|
2559
|
-
/* @__PURE__ */ (0,
|
|
2922
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2560
2923
|
"input",
|
|
2561
2924
|
{
|
|
2562
2925
|
type: "checkbox",
|
|
@@ -2565,8 +2928,8 @@ var Switch = ({
|
|
|
2565
2928
|
disabled
|
|
2566
2929
|
}
|
|
2567
2930
|
),
|
|
2568
|
-
/* @__PURE__ */ (0,
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2931
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
2932
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2570
2933
|
"span",
|
|
2571
2934
|
{
|
|
2572
2935
|
className: "yr3Switch--label",
|
|
@@ -2581,9 +2944,9 @@ var Switch = ({
|
|
|
2581
2944
|
};
|
|
2582
2945
|
|
|
2583
2946
|
// src/Icons/IconSearch.tsx
|
|
2584
|
-
var
|
|
2947
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2585
2948
|
var IconSearch = (props) => {
|
|
2586
|
-
return /* @__PURE__ */ (0,
|
|
2949
|
+
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
2950
|
"path",
|
|
2588
2951
|
{
|
|
2589
2952
|
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 +2958,6 @@ var IconSearch = (props) => {
|
|
|
2595
2958
|
) });
|
|
2596
2959
|
};
|
|
2597
2960
|
|
|
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
2961
|
// src/hooks/usePlaces.ts
|
|
2696
2962
|
var import_autocomplete_places2 = require("@yr3/autocomplete-places");
|
|
2697
2963
|
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
@@ -2703,7 +2969,7 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
|
2703
2969
|
};
|
|
2704
2970
|
|
|
2705
2971
|
// src/hooks/useBreakpoint.ts
|
|
2706
|
-
var
|
|
2972
|
+
var React25 = __toESM(require("react"), 1);
|
|
2707
2973
|
var breakUp = (bp) => `(min-width: ${bp}px)`;
|
|
2708
2974
|
var breakDown = (bp) => `(max-width: ${bp}px)`;
|
|
2709
2975
|
function useBreakpoint(queryInput) {
|
|
@@ -2713,8 +2979,8 @@ function useBreakpoint(queryInput) {
|
|
|
2713
2979
|
if (typeof window === "undefined") return false;
|
|
2714
2980
|
return window.matchMedia(query).matches;
|
|
2715
2981
|
};
|
|
2716
|
-
const [matches, setMatches] =
|
|
2717
|
-
|
|
2982
|
+
const [matches, setMatches] = React25.useState(getMatch);
|
|
2983
|
+
React25.useEffect(() => {
|
|
2718
2984
|
if (typeof window === "undefined") return;
|
|
2719
2985
|
const media = window.matchMedia(query);
|
|
2720
2986
|
const listener = (e) => {
|
|
@@ -2768,6 +3034,7 @@ initTheme();
|
|
|
2768
3034
|
Input,
|
|
2769
3035
|
InputArea,
|
|
2770
3036
|
Label,
|
|
3037
|
+
Loader,
|
|
2771
3038
|
Modal,
|
|
2772
3039
|
ModalContainer,
|
|
2773
3040
|
Notistack,
|
|
@@ -2784,6 +3051,7 @@ initTheme();
|
|
|
2784
3051
|
ThemeContext,
|
|
2785
3052
|
ThemeProvider,
|
|
2786
3053
|
adjustColor,
|
|
3054
|
+
alpha,
|
|
2787
3055
|
applyTheme,
|
|
2788
3056
|
baseTokens,
|
|
2789
3057
|
bem,
|
|
@@ -2796,14 +3064,19 @@ initTheme();
|
|
|
2796
3064
|
createTheme,
|
|
2797
3065
|
createVariants,
|
|
2798
3066
|
cx,
|
|
3067
|
+
darken,
|
|
2799
3068
|
getContrast,
|
|
2800
3069
|
getCountryCodePhone,
|
|
2801
3070
|
getDialPhone,
|
|
2802
3071
|
getMonthCalendar,
|
|
2803
3072
|
getNumberPhone,
|
|
3073
|
+
hexToRgb,
|
|
2804
3074
|
initTheme,
|
|
2805
3075
|
isEmpty,
|
|
3076
|
+
lighten,
|
|
3077
|
+
mergeDeep,
|
|
2806
3078
|
normalizePhone,
|
|
3079
|
+
rgbToHex,
|
|
2807
3080
|
text,
|
|
2808
3081
|
times,
|
|
2809
3082
|
uiStyle,
|