@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.js
CHANGED
|
@@ -104,6 +104,20 @@ function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// src/utils/color.ts
|
|
107
|
+
var rgbToHex = (r, g, b) => {
|
|
108
|
+
return "#" + [r, g, b].map(
|
|
109
|
+
(v) => Math.round(Math.max(0, Math.min(255, v))).toString(16).padStart(2, "0")
|
|
110
|
+
).join("");
|
|
111
|
+
};
|
|
112
|
+
var hexToRgb = (hex) => {
|
|
113
|
+
const clean = hex.replace("#", "");
|
|
114
|
+
const num = parseInt(clean, 16);
|
|
115
|
+
return {
|
|
116
|
+
r: num >> 16 & 255,
|
|
117
|
+
g: num >> 8 & 255,
|
|
118
|
+
b: num & 255
|
|
119
|
+
};
|
|
120
|
+
};
|
|
107
121
|
var adjustColor = (hex, amount) => {
|
|
108
122
|
const num = parseInt(hex.replace("#", ""), 16);
|
|
109
123
|
let r = (num >> 16) + amount;
|
|
@@ -131,6 +145,26 @@ var createPaletteColor = (main) => {
|
|
|
131
145
|
contrastText: getContrast(main)
|
|
132
146
|
};
|
|
133
147
|
};
|
|
148
|
+
var lighten = (hex, amount) => {
|
|
149
|
+
const { r, g, b } = hexToRgb(hex);
|
|
150
|
+
return rgbToHex(
|
|
151
|
+
r + (255 - r) * amount,
|
|
152
|
+
g + (255 - g) * amount,
|
|
153
|
+
b + (255 - b) * amount
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
var darken = (hex, amount) => {
|
|
157
|
+
const { r, g, b } = hexToRgb(hex);
|
|
158
|
+
return rgbToHex(
|
|
159
|
+
r * (1 - amount),
|
|
160
|
+
g * (1 - amount),
|
|
161
|
+
b * (1 - amount)
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
var alpha = (hex, opacity) => {
|
|
165
|
+
const { r, g, b } = hexToRgb(hex);
|
|
166
|
+
return `rgba(${r}, ${g}, ${b}, ${opacity})`;
|
|
167
|
+
};
|
|
134
168
|
|
|
135
169
|
// src/utils/common.ts
|
|
136
170
|
function isEmpty(value) {
|
|
@@ -292,6 +326,24 @@ var getNumberPhone = (phone, dial) => {
|
|
|
292
326
|
return phone;
|
|
293
327
|
};
|
|
294
328
|
|
|
329
|
+
// src/utils/merge.ts
|
|
330
|
+
function mergeDeep(target, source) {
|
|
331
|
+
if (!source) return target;
|
|
332
|
+
const output = { ...target };
|
|
333
|
+
Object.keys(source).forEach((key) => {
|
|
334
|
+
const k = key;
|
|
335
|
+
if (typeof source[k] === "object" && source[k] !== null && !Array.isArray(source[k])) {
|
|
336
|
+
output[k] = mergeDeep(
|
|
337
|
+
target[k] || {},
|
|
338
|
+
source[k]
|
|
339
|
+
);
|
|
340
|
+
} else {
|
|
341
|
+
output[k] = source[k];
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
return output;
|
|
345
|
+
}
|
|
346
|
+
|
|
295
347
|
// src/theme/breakpoint.ts
|
|
296
348
|
var breakpoints = {
|
|
297
349
|
xs: 0,
|
|
@@ -369,6 +421,7 @@ var createTheme = (props) => {
|
|
|
369
421
|
warning: createPaletteColor("#ffc107"),
|
|
370
422
|
info: createPaletteColor("#17a2b8"),
|
|
371
423
|
disabled: "#aeaeae84",
|
|
424
|
+
backdrop: "rgba(0, 0, 0, 0.5)",
|
|
372
425
|
background: {
|
|
373
426
|
default: "#0f0f1a",
|
|
374
427
|
surface: "#1a1a2e"
|
|
@@ -376,6 +429,10 @@ var createTheme = (props) => {
|
|
|
376
429
|
text: {
|
|
377
430
|
primary: "#ffffff",
|
|
378
431
|
secondary: "#2e2f2f"
|
|
432
|
+
},
|
|
433
|
+
common: {
|
|
434
|
+
white: "#ffffff",
|
|
435
|
+
black: "#000000"
|
|
379
436
|
}
|
|
380
437
|
},
|
|
381
438
|
breakpoints,
|
|
@@ -410,6 +467,9 @@ var applyTheme = (theme, target) => {
|
|
|
410
467
|
root.style.setProperty(`--color-${key}-contrast`, value.contrastText);
|
|
411
468
|
}
|
|
412
469
|
});
|
|
470
|
+
if (theme.colors.backdrop) {
|
|
471
|
+
root.style.setProperty("--color-backdrop", theme.colors.backdrop);
|
|
472
|
+
}
|
|
413
473
|
if (theme.colors.background?.default) {
|
|
414
474
|
root.style.setProperty("--color-bg", theme.colors.background.default);
|
|
415
475
|
}
|
|
@@ -419,12 +479,21 @@ var applyTheme = (theme, target) => {
|
|
|
419
479
|
if (theme.colors.disabled) {
|
|
420
480
|
root.style.setProperty("--color-disabled", theme.colors.disabled);
|
|
421
481
|
}
|
|
482
|
+
if (theme.colors.text?.primary) {
|
|
483
|
+
root.style.setProperty("--color-text", theme.colors.text?.primary);
|
|
484
|
+
}
|
|
422
485
|
if (theme.colors.text?.primary) {
|
|
423
486
|
root.style.setProperty("--color-text-primary", theme.colors.text?.primary);
|
|
424
487
|
}
|
|
425
488
|
if (theme.colors.text?.secondary) {
|
|
426
489
|
root.style.setProperty("--color-text-secondary", theme.colors.text?.secondary);
|
|
427
490
|
}
|
|
491
|
+
if (theme.colors.common?.white) {
|
|
492
|
+
root.style.setProperty("--color-white", theme.colors.common.white);
|
|
493
|
+
}
|
|
494
|
+
if (theme.colors.common?.black) {
|
|
495
|
+
root.style.setProperty("--color-black", theme.colors.common.black);
|
|
496
|
+
}
|
|
428
497
|
if (theme.breakpoints) {
|
|
429
498
|
Object.entries(theme.breakpoints).forEach(([key, value]) => {
|
|
430
499
|
document.documentElement.style.setProperty(
|
|
@@ -470,7 +539,8 @@ var avatarVariants = createVariants({
|
|
|
470
539
|
text: "yr3Avatar--color-text",
|
|
471
540
|
warning: "yr3Avatar--color-warning",
|
|
472
541
|
info: "yr3Avatar--color-info",
|
|
473
|
-
error: "yr3Avatar--color-error"
|
|
542
|
+
error: "yr3Avatar--color-error",
|
|
543
|
+
common: "yr3Avatar--color-common"
|
|
474
544
|
},
|
|
475
545
|
size: {
|
|
476
546
|
sm: "yr3Avatar--sm",
|
|
@@ -480,10 +550,11 @@ var avatarVariants = createVariants({
|
|
|
480
550
|
variant: {
|
|
481
551
|
circle: "yr3Avatar--circle",
|
|
482
552
|
square: "yr3Avatar--square",
|
|
483
|
-
rounded: "yr3Avatar--rounded"
|
|
553
|
+
rounded: "yr3Avatar--rounded",
|
|
554
|
+
bordered: "yr3Avatar--bordered"
|
|
484
555
|
},
|
|
485
556
|
bordered: {
|
|
486
|
-
true: "yr3Avatar--
|
|
557
|
+
true: "yr3Avatar--border-active"
|
|
487
558
|
},
|
|
488
559
|
shadow: {
|
|
489
560
|
0: "",
|
|
@@ -508,7 +579,7 @@ var Avatar = ({
|
|
|
508
579
|
variant = "circle",
|
|
509
580
|
color = "primary",
|
|
510
581
|
label,
|
|
511
|
-
bordered =
|
|
582
|
+
bordered = false,
|
|
512
583
|
ui,
|
|
513
584
|
shadow = 0,
|
|
514
585
|
onClick,
|
|
@@ -536,9 +607,18 @@ import * as React2 from "react";
|
|
|
536
607
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
537
608
|
var BackdropContext = React2.createContext(null);
|
|
538
609
|
var BackdropProvider = ({ children }) => {
|
|
539
|
-
const [
|
|
540
|
-
const show = () =>
|
|
541
|
-
|
|
610
|
+
const [stack, setStack] = React2.useState([]);
|
|
611
|
+
const show = (id) => {
|
|
612
|
+
setStack((prev) => [...prev, id]);
|
|
613
|
+
};
|
|
614
|
+
const hide = (id) => {
|
|
615
|
+
if (id) {
|
|
616
|
+
setStack((prev) => prev.filter((item) => item !== id));
|
|
617
|
+
} else {
|
|
618
|
+
setStack([]);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
const open = stack.length > 0;
|
|
542
622
|
return /* @__PURE__ */ jsxs(BackdropContext.Provider, { value: { open, show, hide }, children: [
|
|
543
623
|
children,
|
|
544
624
|
/* @__PURE__ */ jsx2(Backdrop, {})
|
|
@@ -636,7 +716,8 @@ var textVariants = createVariants({
|
|
|
636
716
|
warning: "yr3Text--color-warning",
|
|
637
717
|
error: "yr3Text--color-error",
|
|
638
718
|
info: "yr3Text--color-info",
|
|
639
|
-
background: "yr3Text--color-background"
|
|
719
|
+
background: "yr3Text--color-background",
|
|
720
|
+
common: "yr3Text--color-common"
|
|
640
721
|
},
|
|
641
722
|
weight: {
|
|
642
723
|
light: "yr3Text--weight-light",
|
|
@@ -696,7 +777,8 @@ var buttonVariant = createVariants({
|
|
|
696
777
|
info: "yr3Button--color-info",
|
|
697
778
|
error: "yr3Button--color-error",
|
|
698
779
|
background: "yr3Button--color-background",
|
|
699
|
-
warning: "yr3Button--color-warning"
|
|
780
|
+
warning: "yr3Button--color-warning",
|
|
781
|
+
common: "yr3Button--color-common"
|
|
700
782
|
},
|
|
701
783
|
size: {
|
|
702
784
|
auto: "yr3Button--size-auto",
|
|
@@ -892,6 +974,19 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
892
974
|
// src/components/Checkbox/Checkbox.tsx
|
|
893
975
|
import * as React4 from "react";
|
|
894
976
|
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
977
|
+
var initialPropsComponent = {
|
|
978
|
+
checkbox: {
|
|
979
|
+
ui: {
|
|
980
|
+
color: "primary"
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
content: {
|
|
984
|
+
variant: "caption",
|
|
985
|
+
color: "primary",
|
|
986
|
+
ui: {},
|
|
987
|
+
style: {}
|
|
988
|
+
}
|
|
989
|
+
};
|
|
895
990
|
var Checkbox = ({
|
|
896
991
|
checked,
|
|
897
992
|
defaultChecked,
|
|
@@ -900,6 +995,7 @@ var Checkbox = ({
|
|
|
900
995
|
color = "primary",
|
|
901
996
|
disabled,
|
|
902
997
|
propsComponent,
|
|
998
|
+
type = "default",
|
|
903
999
|
variant = "text"
|
|
904
1000
|
}) => {
|
|
905
1001
|
const [internal, setInternal] = React4.useState(defaultChecked || false);
|
|
@@ -909,11 +1005,12 @@ var Checkbox = ({
|
|
|
909
1005
|
if (!isControlled) setInternal(e.target.checked);
|
|
910
1006
|
onChange?.(e, e.target.checked);
|
|
911
1007
|
};
|
|
1008
|
+
const properties = mergeDeep(initialPropsComponent, propsComponent || {});
|
|
912
1009
|
const bemClasse = bem("yr3Checkbox");
|
|
913
|
-
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}` });
|
|
1010
|
+
const classes = bemClasse(void 0, { color: `color-${color}`, disabled, variant: `variant-${variant}`, type: `type-${type}` });
|
|
914
1011
|
const boxClasses = bem("yr3Checkbox-box");
|
|
915
1012
|
const classesBox = boxClasses(void 0, { checked: !!value });
|
|
916
|
-
return /* @__PURE__ */ jsxs3("label", { className: classes, style: uiStyle(
|
|
1013
|
+
return /* @__PURE__ */ jsxs3("label", { className: classes, style: uiStyle(properties?.checkbox?.ui), "data-testid": "yr3Checkbox", children: [
|
|
917
1014
|
/* @__PURE__ */ jsx8(
|
|
918
1015
|
"input",
|
|
919
1016
|
{
|
|
@@ -925,7 +1022,7 @@ var Checkbox = ({
|
|
|
925
1022
|
}
|
|
926
1023
|
),
|
|
927
1024
|
/* @__PURE__ */ jsx8("span", { className: classesBox, "data-testid": "yr3Checkbox-box" }),
|
|
928
|
-
label && /* @__PURE__ */ jsx8(Text, { variant: "caption", color: !value ?
|
|
1025
|
+
label && /* @__PURE__ */ jsx8(Text, { variant: "caption", color: !value ? properties?.content?.color : color, ...properties?.content, children: label })
|
|
929
1026
|
] });
|
|
930
1027
|
};
|
|
931
1028
|
|
|
@@ -948,7 +1045,10 @@ var chipVariants = createVariants({
|
|
|
948
1045
|
success: "yr3Chip--success",
|
|
949
1046
|
error: "yr3Chip--error",
|
|
950
1047
|
warning: "yr3Chip--warning",
|
|
951
|
-
info: "yr3Chip--info"
|
|
1048
|
+
info: "yr3Chip--info",
|
|
1049
|
+
common: "yr3Chip--common",
|
|
1050
|
+
background: "yr3Chip--background",
|
|
1051
|
+
disabled: "yr3Chip--disabled"
|
|
952
1052
|
},
|
|
953
1053
|
rounded: {
|
|
954
1054
|
true: "yr3Chip--rounded",
|
|
@@ -975,7 +1075,22 @@ var IconClose = (props) => {
|
|
|
975
1075
|
|
|
976
1076
|
// src/components/Chip/Chip.tsx
|
|
977
1077
|
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
978
|
-
var
|
|
1078
|
+
var initialChipProps = {
|
|
1079
|
+
label: {
|
|
1080
|
+
ui: {},
|
|
1081
|
+
style: {}
|
|
1082
|
+
},
|
|
1083
|
+
delete: {
|
|
1084
|
+
ui: {},
|
|
1085
|
+
style: {}
|
|
1086
|
+
},
|
|
1087
|
+
icon: {
|
|
1088
|
+
width: 20,
|
|
1089
|
+
height: 20
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
var Chip = ({ label, variant, color, icon, deleted, onDelete, rounded, size = "medium", propsComponent, ...props }) => {
|
|
1093
|
+
const properties = mergeDeep(initialChipProps, propsComponent);
|
|
979
1094
|
const className = chip_variants_default({ variant, colors: color, rounded, size });
|
|
980
1095
|
return /* @__PURE__ */ jsxs4(
|
|
981
1096
|
"div",
|
|
@@ -983,14 +1098,21 @@ var Chip = ({ label, variant, color, icon, onDelete, rounded, size = "medium", u
|
|
|
983
1098
|
className,
|
|
984
1099
|
"data-testid": "yr3Chip",
|
|
985
1100
|
...props,
|
|
986
|
-
style:
|
|
987
|
-
...style,
|
|
988
|
-
...uiStyle(ui)
|
|
989
|
-
},
|
|
1101
|
+
style: composeStyles(properties.chip?.ui, properties.chip?.style),
|
|
990
1102
|
children: [
|
|
991
1103
|
icon,
|
|
992
|
-
/* @__PURE__ */ jsx10("span", { className: "yr3Chip__label", children: label }),
|
|
993
|
-
|
|
1104
|
+
/* @__PURE__ */ jsx10("span", { className: "yr3Chip__label", style: composeStyles(properties?.label?.ui, properties?.label?.style), children: label }),
|
|
1105
|
+
deleted && /* @__PURE__ */ jsx10(
|
|
1106
|
+
"span",
|
|
1107
|
+
{
|
|
1108
|
+
className: "yr3Chip__delete",
|
|
1109
|
+
onClick: onDelete,
|
|
1110
|
+
role: "button",
|
|
1111
|
+
"aria-label": "delete",
|
|
1112
|
+
style: composeStyles(properties?.delete?.ui, properties?.delete?.style),
|
|
1113
|
+
children: /* @__PURE__ */ jsx10(IconClose, { ...properties?.icon, stroke: color })
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
994
1116
|
]
|
|
995
1117
|
}
|
|
996
1118
|
);
|
|
@@ -1062,7 +1184,8 @@ var controlVariants = createVariants({
|
|
|
1062
1184
|
disabled: "yr3Control--color-disabled",
|
|
1063
1185
|
info: "yr3Control--color-info",
|
|
1064
1186
|
warning: "yr3Control--color-warning",
|
|
1065
|
-
error: "yr3Control--color-error"
|
|
1187
|
+
error: "yr3Control--color-error",
|
|
1188
|
+
common: "yr3Control--color-common"
|
|
1066
1189
|
},
|
|
1067
1190
|
size: {
|
|
1068
1191
|
auto: "yr3Control--size-auto",
|
|
@@ -1139,7 +1262,8 @@ var dividerVariants = createVariants({
|
|
|
1139
1262
|
text: "yr3Divider--color-text",
|
|
1140
1263
|
warning: "yr3Divider--color-warning",
|
|
1141
1264
|
info: "yr3Divider--color-info",
|
|
1142
|
-
error: "yr3Divider--color-error"
|
|
1265
|
+
error: "yr3Divider--color-error",
|
|
1266
|
+
common: "yr3Divider--color-common"
|
|
1143
1267
|
}
|
|
1144
1268
|
}
|
|
1145
1269
|
});
|
|
@@ -1168,7 +1292,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1168
1292
|
const { hide } = useBackdrop();
|
|
1169
1293
|
const handleClose = () => {
|
|
1170
1294
|
if (props === "container") {
|
|
1171
|
-
hide();
|
|
1295
|
+
hide("drawer");
|
|
1172
1296
|
onClose && onClose();
|
|
1173
1297
|
}
|
|
1174
1298
|
return;
|
|
@@ -1194,33 +1318,44 @@ var useClickAway = (ref, callback) => {
|
|
|
1194
1318
|
|
|
1195
1319
|
// src/components/Drawer/Drawer.tsx
|
|
1196
1320
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1321
|
+
var initialPropsComponent2 = {
|
|
1322
|
+
drawer: {},
|
|
1323
|
+
closing: null,
|
|
1324
|
+
container: {},
|
|
1325
|
+
onClose: false
|
|
1326
|
+
};
|
|
1197
1327
|
var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
1198
1328
|
const { show, hide } = useBackdrop();
|
|
1199
1329
|
const ref = React8.useRef(null);
|
|
1330
|
+
const properties = mergeDeep(initialPropsComponent2, propsComponent);
|
|
1200
1331
|
React8.useEffect(() => {
|
|
1201
1332
|
if (open) {
|
|
1202
|
-
show();
|
|
1333
|
+
show("drawer");
|
|
1334
|
+
} else {
|
|
1335
|
+
hide("drawer");
|
|
1203
1336
|
}
|
|
1204
1337
|
}, [open]);
|
|
1205
1338
|
useClickAway(ref, () => {
|
|
1206
|
-
if (!open ||
|
|
1207
|
-
if (
|
|
1208
|
-
hide();
|
|
1339
|
+
if (!open || properties?.closing === null) return;
|
|
1340
|
+
if (properties?.closing === "drawer") {
|
|
1341
|
+
hide("drawer");
|
|
1209
1342
|
onClose();
|
|
1210
1343
|
}
|
|
1211
1344
|
;
|
|
1212
1345
|
});
|
|
1213
1346
|
React8.useEffect(() => {
|
|
1214
|
-
if (
|
|
1215
|
-
hide();
|
|
1347
|
+
if (properties?.onClose) {
|
|
1348
|
+
hide("drawer");
|
|
1216
1349
|
onClose();
|
|
1217
1350
|
}
|
|
1218
|
-
}, [
|
|
1351
|
+
}, [properties?.onClose]);
|
|
1352
|
+
const classesBem = bem("yr3Drawer");
|
|
1353
|
+
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1219
1354
|
return /* @__PURE__ */ jsx16(
|
|
1220
1355
|
"div",
|
|
1221
1356
|
{
|
|
1222
|
-
className:
|
|
1223
|
-
style:
|
|
1357
|
+
className: drawerClasses,
|
|
1358
|
+
style: properties?.drawer,
|
|
1224
1359
|
onClick: (e) => e.stopPropagation(),
|
|
1225
1360
|
ref,
|
|
1226
1361
|
"data-testid": "yr3Drawer",
|
|
@@ -1228,9 +1363,9 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1228
1363
|
DrawerContainer_default,
|
|
1229
1364
|
{
|
|
1230
1365
|
children,
|
|
1231
|
-
...
|
|
1232
|
-
props:
|
|
1233
|
-
onClose: () =>
|
|
1366
|
+
...properties?.container,
|
|
1367
|
+
props: properties?.closing,
|
|
1368
|
+
onClose: () => properties?.closing === "container" ? onClose() : {}
|
|
1234
1369
|
}
|
|
1235
1370
|
)
|
|
1236
1371
|
},
|
|
@@ -1388,7 +1523,12 @@ var groupVariants = createVariants({
|
|
|
1388
1523
|
info: "yr3Group--color-info",
|
|
1389
1524
|
disabled: "yr3Group--color-disabled",
|
|
1390
1525
|
text: "yr3Group--color-text",
|
|
1391
|
-
background: "yr3Group--color-background"
|
|
1526
|
+
background: "yr3Group--color-background",
|
|
1527
|
+
common: "yr3Group--color-common"
|
|
1528
|
+
},
|
|
1529
|
+
type: {
|
|
1530
|
+
rounded: "yr3Group--type-rounded",
|
|
1531
|
+
square: "yr3Group--type-square"
|
|
1392
1532
|
}
|
|
1393
1533
|
}
|
|
1394
1534
|
});
|
|
@@ -1410,6 +1550,7 @@ var Group = ({
|
|
|
1410
1550
|
value,
|
|
1411
1551
|
onChange,
|
|
1412
1552
|
variant,
|
|
1553
|
+
type = "rounded",
|
|
1413
1554
|
color = "primary",
|
|
1414
1555
|
propsComponent = initialComponents
|
|
1415
1556
|
}) => {
|
|
@@ -1424,7 +1565,7 @@ var Group = ({
|
|
|
1424
1565
|
return /* @__PURE__ */ jsx20(
|
|
1425
1566
|
"div",
|
|
1426
1567
|
{
|
|
1427
|
-
className: groupVariants({ variant, color }),
|
|
1568
|
+
className: groupVariants({ variant, color, type }),
|
|
1428
1569
|
"data-testid": "yr3Group",
|
|
1429
1570
|
style: composeStyles(propsComponent.group?.ui, propsComponent.group?.style),
|
|
1430
1571
|
children: options.map((opt) => /* @__PURE__ */ jsx20(
|
|
@@ -1465,7 +1606,15 @@ var Image = ({
|
|
|
1465
1606
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
1466
1607
|
import * as React11 from "react";
|
|
1467
1608
|
import { jsx as jsx22, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1468
|
-
var
|
|
1609
|
+
var initialPropsComponent3 = {
|
|
1610
|
+
box: {},
|
|
1611
|
+
text: {},
|
|
1612
|
+
container: {},
|
|
1613
|
+
preview: {},
|
|
1614
|
+
content: {}
|
|
1615
|
+
};
|
|
1616
|
+
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
1617
|
+
const properties = mergeDeep(initialPropsComponent3, propsComponent || {});
|
|
1469
1618
|
const [dragging, setDragging] = React11.useState(false);
|
|
1470
1619
|
const [files, setFiles] = React11.useState([]);
|
|
1471
1620
|
const inputRef = React11.useRef(null);
|
|
@@ -1480,7 +1629,7 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1480
1629
|
};
|
|
1481
1630
|
const classes = bem("yr3Dropzone");
|
|
1482
1631
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
1483
|
-
return /* @__PURE__ */ jsx22(Box, { as: "div", position: "relative", content: "center", ...
|
|
1632
|
+
return /* @__PURE__ */ jsx22(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ jsxs5(
|
|
1484
1633
|
"div",
|
|
1485
1634
|
{
|
|
1486
1635
|
className: classComponent,
|
|
@@ -1495,7 +1644,7 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1495
1644
|
handleFiles(e.dataTransfer.files);
|
|
1496
1645
|
},
|
|
1497
1646
|
onClick: () => inputRef.current?.click(),
|
|
1498
|
-
style: composeStyles(ui, style),
|
|
1647
|
+
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1499
1648
|
children: [
|
|
1500
1649
|
/* @__PURE__ */ jsx22(
|
|
1501
1650
|
"input",
|
|
@@ -1508,10 +1657,10 @@ var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered,
|
|
|
1508
1657
|
onChange: (e) => handleFiles(e.target.files)
|
|
1509
1658
|
}
|
|
1510
1659
|
),
|
|
1511
|
-
isEmpty(files) && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--content", children: /* @__PURE__ */ jsx22(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
1512
|
-
multiple && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--previews", children: files.map((file, i) => /* @__PURE__ */ jsx22("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1513
|
-
!multiple && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--preview", children: files.map((file, i) => /* @__PURE__ */ jsx22("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1514
|
-
!!defaultImage && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--preview", children: /* @__PURE__ */ jsx22("img", { src: defaultImage }) }),
|
|
1660
|
+
isEmpty(files) && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--content", style: composeStyles(properties?.content?.ui, properties?.content?.style), children: /* @__PURE__ */ jsx22(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
1661
|
+
multiple && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--previews", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ jsx22("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1662
|
+
!multiple && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ jsx22("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1663
|
+
!!defaultImage && /* @__PURE__ */ jsx22("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: /* @__PURE__ */ jsx22("img", { src: defaultImage }) }),
|
|
1515
1664
|
component
|
|
1516
1665
|
]
|
|
1517
1666
|
}
|
|
@@ -1557,7 +1706,8 @@ var inputVariants = createVariants({
|
|
|
1557
1706
|
background: "yr3Input--color-background",
|
|
1558
1707
|
error: "yr3Input--color-error",
|
|
1559
1708
|
warning: "yr3Input--color-warning",
|
|
1560
|
-
info: "yr3Input--color-info"
|
|
1709
|
+
info: "yr3Input--color-info",
|
|
1710
|
+
common: "yr3Input--color-common"
|
|
1561
1711
|
},
|
|
1562
1712
|
size: {
|
|
1563
1713
|
auto: "yr3Input--size-auto",
|
|
@@ -1678,7 +1828,12 @@ var inputAreaVariants = createVariants({
|
|
|
1678
1828
|
secondary: "yr3InputArea--color-secondary",
|
|
1679
1829
|
success: "yr3InputArea--color-success",
|
|
1680
1830
|
text: "yr3InputArea--color-text",
|
|
1681
|
-
disabled: "yr3InputArea--color-disabled"
|
|
1831
|
+
disabled: "yr3InputArea--color-disabled",
|
|
1832
|
+
background: "yr3InputArea--color-background",
|
|
1833
|
+
error: "yr3InputArea--color-error",
|
|
1834
|
+
warning: "yr3InputArea--color-warning",
|
|
1835
|
+
info: "yr3InputArea--color-info",
|
|
1836
|
+
common: "yr3InputArea--color-common"
|
|
1682
1837
|
},
|
|
1683
1838
|
size: {
|
|
1684
1839
|
auto: "yr3InputArea--size-auto",
|
|
@@ -1765,33 +1920,99 @@ var InputArea = ({
|
|
|
1765
1920
|
] });
|
|
1766
1921
|
};
|
|
1767
1922
|
|
|
1768
|
-
// src/components/
|
|
1923
|
+
// src/components/Loader/loader.variants.ts
|
|
1924
|
+
var loaderSpinnerVariants = createVariants({
|
|
1925
|
+
base: "yr3Loader--spinner",
|
|
1926
|
+
variants: {
|
|
1927
|
+
color: {
|
|
1928
|
+
primary: "yr3Loader--spinner-color-primary",
|
|
1929
|
+
secondary: "yr3Loader--spinner-color-secondary",
|
|
1930
|
+
success: "yr3Loader--spinner-color-success",
|
|
1931
|
+
error: "yr3Loader--spinner-color-error",
|
|
1932
|
+
warning: "yr3Loader--spinner-color-warning",
|
|
1933
|
+
info: "yr3Loader--spinner-color-info",
|
|
1934
|
+
disabled: "yr3Loader--spinner-color-disabled",
|
|
1935
|
+
text: "yr3Loader--spinner-color-text",
|
|
1936
|
+
background: "yr3Loader--spinner-color-background",
|
|
1937
|
+
common: "yr3Loader--spinner-color-common"
|
|
1938
|
+
},
|
|
1939
|
+
size: {
|
|
1940
|
+
sm: "yr3Loader--spinner-size-sm",
|
|
1941
|
+
md: "yr3Loader--spinner-size-md",
|
|
1942
|
+
lg: "yr3Loader--spinner-size-lg"
|
|
1943
|
+
},
|
|
1944
|
+
type: {
|
|
1945
|
+
default: "yr3Loader--spinner-default",
|
|
1946
|
+
dots: "yr3Loader--spinner-dots",
|
|
1947
|
+
fancy: "yr3Loader--spinner-fancy"
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
});
|
|
1951
|
+
|
|
1952
|
+
// src/components/Loader/Loader.tsx
|
|
1769
1953
|
import * as React14 from "react";
|
|
1954
|
+
import { jsx as jsx26, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1955
|
+
var initialComponents2 = {
|
|
1956
|
+
loader: {
|
|
1957
|
+
ui: {},
|
|
1958
|
+
style: {}
|
|
1959
|
+
},
|
|
1960
|
+
spinner: {
|
|
1961
|
+
size: "sm",
|
|
1962
|
+
color: "primary",
|
|
1963
|
+
type: "default"
|
|
1964
|
+
},
|
|
1965
|
+
container: {
|
|
1966
|
+
center: true,
|
|
1967
|
+
container: true,
|
|
1968
|
+
ui: {
|
|
1969
|
+
width: "100%",
|
|
1970
|
+
height: "100%"
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
var Loader = ({ component, loading = false, propsComponent }) => {
|
|
1975
|
+
const properties = mergeDeep(initialComponents2, propsComponent || {});
|
|
1976
|
+
const classSpinner = loaderSpinnerVariants({
|
|
1977
|
+
color: properties?.spinner?.color,
|
|
1978
|
+
type: properties?.spinner?.type,
|
|
1979
|
+
size: properties?.spinner?.size
|
|
1980
|
+
});
|
|
1981
|
+
if (!loading) return null;
|
|
1982
|
+
return /* @__PURE__ */ jsx26("div", { className: "yr3Loader", style: composeStyles(properties?.loader?.ui, properties?.loader?.style), children: /* @__PURE__ */ jsx26(Flex, { ...properties?.container, children: component || /* @__PURE__ */ jsx26("div", { className: classSpinner, children: properties?.spinner?.type === "dots" && /* @__PURE__ */ jsxs8(React14.Fragment, { children: [
|
|
1983
|
+
/* @__PURE__ */ jsx26("span", {}),
|
|
1984
|
+
/* @__PURE__ */ jsx26("span", {}),
|
|
1985
|
+
/* @__PURE__ */ jsx26("span", {})
|
|
1986
|
+
] }) }) }) });
|
|
1987
|
+
};
|
|
1988
|
+
|
|
1989
|
+
// src/components/Modal/Modal.tsx
|
|
1990
|
+
import * as React15 from "react";
|
|
1770
1991
|
|
|
1771
1992
|
// src/components/Modal/ModalContainer.tsx
|
|
1772
|
-
import { jsx as
|
|
1993
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1773
1994
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
1774
1995
|
const classes = bem("yr3Modal-container");
|
|
1775
1996
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
1776
|
-
return /* @__PURE__ */
|
|
1997
|
+
return /* @__PURE__ */ jsx27("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
1777
1998
|
};
|
|
1778
1999
|
|
|
1779
2000
|
// src/components/Modal/Modal.tsx
|
|
1780
|
-
import { jsx as
|
|
2001
|
+
import { jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1781
2002
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
1782
2003
|
const { show, hide } = useBackdrop();
|
|
1783
|
-
|
|
2004
|
+
React15.useEffect(() => {
|
|
1784
2005
|
if (open) {
|
|
1785
|
-
show();
|
|
2006
|
+
show("modal");
|
|
1786
2007
|
} else {
|
|
1787
|
-
hide();
|
|
2008
|
+
hide("modal");
|
|
1788
2009
|
}
|
|
1789
|
-
}, [open
|
|
2010
|
+
}, [open]);
|
|
1790
2011
|
const classes = bem("yr3Modal");
|
|
1791
2012
|
const classComponent = classes(void 0, { "open": !!open });
|
|
1792
|
-
return /* @__PURE__ */
|
|
2013
|
+
return /* @__PURE__ */ jsx28("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ jsx28(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ jsxs9(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
|
|
1793
2014
|
children,
|
|
1794
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */
|
|
2015
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ jsx28(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
1795
2016
|
] }) }) });
|
|
1796
2017
|
};
|
|
1797
2018
|
|
|
@@ -1831,15 +2052,15 @@ var notistackVariants = createVariants({
|
|
|
1831
2052
|
});
|
|
1832
2053
|
|
|
1833
2054
|
// src/components/Notistack/Notistack.tsx
|
|
1834
|
-
import { jsx as
|
|
2055
|
+
import { jsx as jsx29, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1835
2056
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
1836
2057
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
1837
2058
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
1838
2059
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
1839
2060
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
1840
|
-
return /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
1842
|
-
/* @__PURE__ */
|
|
2061
|
+
return /* @__PURE__ */ jsxs10("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
2062
|
+
/* @__PURE__ */ jsx29("span", { style: containerStyle, children: message }),
|
|
2063
|
+
/* @__PURE__ */ jsx29(
|
|
1843
2064
|
"div",
|
|
1844
2065
|
{
|
|
1845
2066
|
className: "yr3Notistack--progress",
|
|
@@ -1867,13 +2088,14 @@ var pendingVariants = createVariants({
|
|
|
1867
2088
|
text: "yr3Pending--color-text",
|
|
1868
2089
|
info: "yr3Pending--color-info",
|
|
1869
2090
|
background: "yr3Pending--color-background",
|
|
1870
|
-
warning: "yr3Pending--color-warning"
|
|
2091
|
+
warning: "yr3Pending--color-warning",
|
|
2092
|
+
common: "yr3Pending--color-common"
|
|
1871
2093
|
}
|
|
1872
2094
|
}
|
|
1873
2095
|
});
|
|
1874
2096
|
|
|
1875
2097
|
// src/components/Pending/Pending.tsx
|
|
1876
|
-
import { jsx as
|
|
2098
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1877
2099
|
var Pending = ({
|
|
1878
2100
|
variant,
|
|
1879
2101
|
width,
|
|
@@ -1886,7 +2108,7 @@ var Pending = ({
|
|
|
1886
2108
|
const widthStyle = variant === "circle" ? size : width;
|
|
1887
2109
|
const heightStyle = variant === "circle" ? size : height;
|
|
1888
2110
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
1889
|
-
return /* @__PURE__ */
|
|
2111
|
+
return /* @__PURE__ */ jsx30(
|
|
1890
2112
|
"div",
|
|
1891
2113
|
{
|
|
1892
2114
|
className: pendingVariants({ variant, color }),
|
|
@@ -1897,19 +2119,19 @@ var Pending = ({
|
|
|
1897
2119
|
};
|
|
1898
2120
|
|
|
1899
2121
|
// src/components/Phone/Phone.tsx
|
|
1900
|
-
import * as
|
|
2122
|
+
import * as React17 from "react";
|
|
1901
2123
|
|
|
1902
2124
|
// src/components/Selector/Selector.tsx
|
|
1903
|
-
import * as
|
|
2125
|
+
import * as React16 from "react";
|
|
1904
2126
|
|
|
1905
2127
|
// src/Icons/IconDown.tsx
|
|
1906
|
-
import { jsx as
|
|
2128
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1907
2129
|
var IconDown = (props) => {
|
|
1908
|
-
return /* @__PURE__ */
|
|
2130
|
+
return /* @__PURE__ */ jsx31("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__ */ jsx31("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1909
2131
|
};
|
|
1910
2132
|
|
|
1911
2133
|
// src/components/Selector/Selector.tsx
|
|
1912
|
-
import { jsx as
|
|
2134
|
+
import { jsx as jsx32, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1913
2135
|
var initalPropsComponent2 = {
|
|
1914
2136
|
text: {
|
|
1915
2137
|
variant: "caption",
|
|
@@ -1922,16 +2144,16 @@ var initalPropsComponent2 = {
|
|
|
1922
2144
|
}
|
|
1923
2145
|
};
|
|
1924
2146
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
1925
|
-
const [open, setOpen] =
|
|
1926
|
-
const [valueState, setValueState] =
|
|
1927
|
-
const ref =
|
|
2147
|
+
const [open, setOpen] = React16.useState(false);
|
|
2148
|
+
const [valueState, setValueState] = React16.useState(value || defaultValue || null);
|
|
2149
|
+
const ref = React16.useRef(null);
|
|
1928
2150
|
useClickAway(ref, () => setOpen(false));
|
|
1929
|
-
return /* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
2151
|
+
return /* @__PURE__ */ jsxs11("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
2152
|
+
/* @__PURE__ */ jsx32("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ jsxs11("div", { className: "yr3Selector--control", children: [
|
|
2153
|
+
/* @__PURE__ */ jsx32("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ jsx32(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
1932
2154
|
valueState
|
|
1933
2155
|
] }) }),
|
|
1934
|
-
open && /* @__PURE__ */
|
|
2156
|
+
open && /* @__PURE__ */ jsx32("div", { className: "yr3Selector--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), children: options.map((opt) => /* @__PURE__ */ jsx32(
|
|
1935
2157
|
"div",
|
|
1936
2158
|
{
|
|
1937
2159
|
className: "yr3Selector--option",
|
|
@@ -1952,7 +2174,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
1952
2174
|
};
|
|
1953
2175
|
onChange?.(event, opt.value);
|
|
1954
2176
|
},
|
|
1955
|
-
children: /* @__PURE__ */
|
|
2177
|
+
children: /* @__PURE__ */ jsx32(Text, { ...propsComponent?.text, children: propsComponent?.text?.children || opt.label })
|
|
1956
2178
|
},
|
|
1957
2179
|
opt.value
|
|
1958
2180
|
)) })
|
|
@@ -1961,7 +2183,7 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
1961
2183
|
var Selector_default = Selector;
|
|
1962
2184
|
|
|
1963
2185
|
// src/components/Phone/Phone.tsx
|
|
1964
|
-
import { jsx as
|
|
2186
|
+
import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1965
2187
|
var Phone = ({
|
|
1966
2188
|
name,
|
|
1967
2189
|
value,
|
|
@@ -1973,13 +2195,13 @@ var Phone = ({
|
|
|
1973
2195
|
}) => {
|
|
1974
2196
|
const isControlled = value !== void 0;
|
|
1975
2197
|
const initial = value || defaultValue || "";
|
|
1976
|
-
const [prefix, setPrefix] =
|
|
2198
|
+
const [prefix, setPrefix] = React17.useState(
|
|
1977
2199
|
getDialPhone(initial, countries) || countries[0].dial
|
|
1978
2200
|
);
|
|
1979
|
-
const [number, setNumber] =
|
|
2201
|
+
const [number, setNumber] = React17.useState(
|
|
1980
2202
|
getNumberPhone(initial, prefix) || ""
|
|
1981
2203
|
);
|
|
1982
|
-
|
|
2204
|
+
React17.useEffect(() => {
|
|
1983
2205
|
if (isControlled && value) {
|
|
1984
2206
|
const dial = getDialPhone(value, countries);
|
|
1985
2207
|
const num = getNumberPhone(value, dial);
|
|
@@ -1998,10 +2220,10 @@ var Phone = ({
|
|
|
1998
2220
|
setPrefix(val);
|
|
1999
2221
|
onChange?.(null, `${val}${number}`);
|
|
2000
2222
|
};
|
|
2001
|
-
return /* @__PURE__ */
|
|
2002
|
-
/* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
2004
|
-
/* @__PURE__ */
|
|
2223
|
+
return /* @__PURE__ */ jsxs12(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2224
|
+
/* @__PURE__ */ jsx33(Label, { text: label, className: "yr3Input--active" }),
|
|
2225
|
+
/* @__PURE__ */ jsxs12(Flex, { variant: "row", container: true, center: true, children: [
|
|
2226
|
+
/* @__PURE__ */ jsx33(
|
|
2005
2227
|
Selector_default,
|
|
2006
2228
|
{
|
|
2007
2229
|
options: countries.map((c) => ({
|
|
@@ -2013,7 +2235,7 @@ var Phone = ({
|
|
|
2013
2235
|
...propsComponent?.selector
|
|
2014
2236
|
}
|
|
2015
2237
|
),
|
|
2016
|
-
/* @__PURE__ */
|
|
2238
|
+
/* @__PURE__ */ jsx33(
|
|
2017
2239
|
Divider,
|
|
2018
2240
|
{
|
|
2019
2241
|
orientation: "vertical",
|
|
@@ -2022,7 +2244,7 @@ var Phone = ({
|
|
|
2022
2244
|
...propsComponent?.divider
|
|
2023
2245
|
}
|
|
2024
2246
|
),
|
|
2025
|
-
/* @__PURE__ */
|
|
2247
|
+
/* @__PURE__ */ jsx33(
|
|
2026
2248
|
Input,
|
|
2027
2249
|
{
|
|
2028
2250
|
type: "number",
|
|
@@ -2038,9 +2260,9 @@ var Phone = ({
|
|
|
2038
2260
|
};
|
|
2039
2261
|
|
|
2040
2262
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
2041
|
-
import * as
|
|
2263
|
+
import * as React18 from "react";
|
|
2042
2264
|
import { useAutocompletePlaces } from "@yr3/autocomplete-places";
|
|
2043
|
-
import { jsx as
|
|
2265
|
+
import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2044
2266
|
var initPropsComponent = {
|
|
2045
2267
|
label: {
|
|
2046
2268
|
display: true,
|
|
@@ -2080,9 +2302,9 @@ var PlacesAutocomplete = ({
|
|
|
2080
2302
|
keyApi,
|
|
2081
2303
|
propsComponent = initPropsComponent
|
|
2082
2304
|
}) => {
|
|
2083
|
-
const [value, setValue] =
|
|
2084
|
-
const inputRef =
|
|
2085
|
-
const [anchorEl, setAnchorEl] =
|
|
2305
|
+
const [value, setValue] = React18.useState(null);
|
|
2306
|
+
const inputRef = React18.useRef(null);
|
|
2307
|
+
const [anchorEl, setAnchorEl] = React18.useState(null);
|
|
2086
2308
|
const { suggestions, selectPlace } = useAutocompletePlaces({ input: value, apiKey: keyApi, language, provider });
|
|
2087
2309
|
const handleSelect = async (id) => {
|
|
2088
2310
|
const place = await selectPlace(id);
|
|
@@ -2102,12 +2324,12 @@ var PlacesAutocomplete = ({
|
|
|
2102
2324
|
setValue(place.address);
|
|
2103
2325
|
setAnchorEl(null);
|
|
2104
2326
|
};
|
|
2105
|
-
|
|
2327
|
+
React18.useEffect(() => {
|
|
2106
2328
|
if (defaultLocation) {
|
|
2107
2329
|
setValue(defaultLocation);
|
|
2108
2330
|
}
|
|
2109
2331
|
}, [defaultLocation]);
|
|
2110
|
-
|
|
2332
|
+
React18.useEffect(() => {
|
|
2111
2333
|
if (value === "") {
|
|
2112
2334
|
onSelect(null);
|
|
2113
2335
|
}
|
|
@@ -2117,13 +2339,13 @@ var PlacesAutocomplete = ({
|
|
|
2117
2339
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2118
2340
|
};
|
|
2119
2341
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2120
|
-
|
|
2342
|
+
React18.useEffect(() => {
|
|
2121
2343
|
if (onChangeForm) {
|
|
2122
2344
|
onChangeForm({ target: { value } });
|
|
2123
2345
|
}
|
|
2124
2346
|
}, [onChangeForm]);
|
|
2125
|
-
return /* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
2347
|
+
return /* @__PURE__ */ jsxs13(Control, { ...propsComponent?.control, children: [
|
|
2348
|
+
/* @__PURE__ */ jsx34(
|
|
2127
2349
|
Input,
|
|
2128
2350
|
{
|
|
2129
2351
|
ref: inputRef,
|
|
@@ -2137,7 +2359,7 @@ var PlacesAutocomplete = ({
|
|
|
2137
2359
|
},
|
|
2138
2360
|
"input-places"
|
|
2139
2361
|
),
|
|
2140
|
-
open && /* @__PURE__ */
|
|
2362
|
+
open && /* @__PURE__ */ jsx34("div", { className: "yr3Places--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent?.menu?.style), children: /* @__PURE__ */ jsx34(Flex, { container: true, ui: { p: 1 }, children: suggestions.map((s) => /* @__PURE__ */ jsx34(Flex, { onClick: () => handleSelect(s.id), ui: { padding: 8, cursor: "pointer", "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" } }, children: /* @__PURE__ */ jsx34(Text, { ...propsComponent?.menu?.text, children: s.description }) }, s.id)) }) })
|
|
2141
2363
|
] });
|
|
2142
2364
|
};
|
|
2143
2365
|
|
|
@@ -2154,13 +2376,18 @@ var radioVariant = createVariants({
|
|
|
2154
2376
|
secondary: "yr3Radio--color-secondary",
|
|
2155
2377
|
success: "yr3Radio--color-success",
|
|
2156
2378
|
text: "yr3Radio--color-text",
|
|
2157
|
-
disabled: "yr3Radio--color-disabled"
|
|
2379
|
+
disabled: "yr3Radio--color-disabled",
|
|
2380
|
+
background: "yr3Radio--color-background",
|
|
2381
|
+
error: "yr3Radio--color-error",
|
|
2382
|
+
warning: "yr3Radio--color-warning",
|
|
2383
|
+
info: "yr3Radio--color-info",
|
|
2384
|
+
common: "yr3Radio--color-common"
|
|
2158
2385
|
}
|
|
2159
2386
|
}
|
|
2160
2387
|
});
|
|
2161
2388
|
|
|
2162
2389
|
// src/components/Radio/Radio.tsx
|
|
2163
|
-
import { jsx as
|
|
2390
|
+
import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2164
2391
|
var Radio = ({
|
|
2165
2392
|
checked,
|
|
2166
2393
|
value,
|
|
@@ -2176,8 +2403,8 @@ var Radio = ({
|
|
|
2176
2403
|
const bemClass = bem("yr3Radio");
|
|
2177
2404
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2178
2405
|
const variantClass = radioVariant({ variant });
|
|
2179
|
-
return /* @__PURE__ */
|
|
2180
|
-
/* @__PURE__ */
|
|
2406
|
+
return /* @__PURE__ */ jsxs14("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2407
|
+
/* @__PURE__ */ jsx35(
|
|
2181
2408
|
"input",
|
|
2182
2409
|
{
|
|
2183
2410
|
type: "radio",
|
|
@@ -2189,8 +2416,8 @@ var Radio = ({
|
|
|
2189
2416
|
}
|
|
2190
2417
|
),
|
|
2191
2418
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2192
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */
|
|
2193
|
-
typeof label === "string" && /* @__PURE__ */
|
|
2419
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ jsx35("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2420
|
+
typeof label === "string" && /* @__PURE__ */ jsx35(
|
|
2194
2421
|
"span",
|
|
2195
2422
|
{
|
|
2196
2423
|
className: "yr3Radio--label",
|
|
@@ -2203,7 +2430,104 @@ var Radio = ({
|
|
|
2203
2430
|
};
|
|
2204
2431
|
|
|
2205
2432
|
// src/components/Select/Select.tsx
|
|
2206
|
-
import * as
|
|
2433
|
+
import * as React22 from "react";
|
|
2434
|
+
|
|
2435
|
+
// src/theme/ThemeProvider.tsx
|
|
2436
|
+
import * as React20 from "react";
|
|
2437
|
+
|
|
2438
|
+
// src/theme/notistackContext.tsx
|
|
2439
|
+
import * as React19 from "react";
|
|
2440
|
+
import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2441
|
+
var NotistackContext = React19.createContext(null);
|
|
2442
|
+
var NotistackProvider = ({ children }) => {
|
|
2443
|
+
const [snacks, setSnacks] = React19.useState([]);
|
|
2444
|
+
const notistack = (snack) => {
|
|
2445
|
+
const id = Date.now();
|
|
2446
|
+
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2447
|
+
const duration = snack.duration || 3e3;
|
|
2448
|
+
const exitDuration = 300;
|
|
2449
|
+
setTimeout(() => {
|
|
2450
|
+
setSnacks(
|
|
2451
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2452
|
+
);
|
|
2453
|
+
}, duration);
|
|
2454
|
+
setTimeout(() => {
|
|
2455
|
+
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2456
|
+
}, duration + exitDuration);
|
|
2457
|
+
};
|
|
2458
|
+
return /* @__PURE__ */ jsxs15(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2459
|
+
children,
|
|
2460
|
+
/* @__PURE__ */ jsx36("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx36(Notistack, { ...snack }, snack.id)) })
|
|
2461
|
+
] });
|
|
2462
|
+
};
|
|
2463
|
+
var useNotistack = () => {
|
|
2464
|
+
const ctx = React19.useContext(NotistackContext);
|
|
2465
|
+
if (!ctx) {
|
|
2466
|
+
throw new Error("NotistackProvider missing");
|
|
2467
|
+
}
|
|
2468
|
+
return ctx;
|
|
2469
|
+
};
|
|
2470
|
+
|
|
2471
|
+
// src/theme/ThemeProvider.tsx
|
|
2472
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2473
|
+
var ThemeContext = React20.createContext(null);
|
|
2474
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2475
|
+
React20.useEffect(() => {
|
|
2476
|
+
applyTheme(theme);
|
|
2477
|
+
}, [theme]);
|
|
2478
|
+
return /* @__PURE__ */ jsx37(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx37(BackdropProvider, { children: /* @__PURE__ */ jsx37(NotistackProvider, { children }) }) });
|
|
2479
|
+
};
|
|
2480
|
+
var useTheme = () => React20.useContext(ThemeContext);
|
|
2481
|
+
|
|
2482
|
+
// src/theme/tokens.ts
|
|
2483
|
+
var baseTokens = {
|
|
2484
|
+
colors: {
|
|
2485
|
+
primary: "#6C5CE7",
|
|
2486
|
+
secondary: "#00CEC9",
|
|
2487
|
+
background: "#0f0f1a",
|
|
2488
|
+
surface: "#1a1a2e",
|
|
2489
|
+
textPrimary: "#ffffff",
|
|
2490
|
+
textSecondary: "#b2bec3"
|
|
2491
|
+
},
|
|
2492
|
+
spacing: (factor) => `${factor * 8}px`,
|
|
2493
|
+
radius: {
|
|
2494
|
+
sm: "6px",
|
|
2495
|
+
md: "12px",
|
|
2496
|
+
lg: "20px"
|
|
2497
|
+
}
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
// src/theme/useMediaQuery.tsx
|
|
2501
|
+
import * as React21 from "react";
|
|
2502
|
+
function useMediaQuery(query) {
|
|
2503
|
+
const theme = useTheme();
|
|
2504
|
+
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2505
|
+
const [matches, setMatches] = React21.useState(() => {
|
|
2506
|
+
if (typeof window === "undefined") return false;
|
|
2507
|
+
return window.matchMedia(computedQuery).matches;
|
|
2508
|
+
});
|
|
2509
|
+
React21.useEffect(() => {
|
|
2510
|
+
if (typeof window === "undefined") return;
|
|
2511
|
+
const media = window.matchMedia(computedQuery);
|
|
2512
|
+
const listener = () => setMatches(media.matches);
|
|
2513
|
+
media.addEventListener("change", listener);
|
|
2514
|
+
return () => media.removeEventListener("change", listener);
|
|
2515
|
+
}, [computedQuery]);
|
|
2516
|
+
return matches;
|
|
2517
|
+
}
|
|
2518
|
+
function useBreakpointValue(values) {
|
|
2519
|
+
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
2520
|
+
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
2521
|
+
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
2522
|
+
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
2523
|
+
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
2524
|
+
if (xl && values.xl !== void 0) return values.xl;
|
|
2525
|
+
if (lg && values.lg !== void 0) return values.lg;
|
|
2526
|
+
if (md && values.md !== void 0) return values.md;
|
|
2527
|
+
if (sm && values.sm !== void 0) return values.sm;
|
|
2528
|
+
if (xs && values.xs !== void 0) return values.xs;
|
|
2529
|
+
return void 0;
|
|
2530
|
+
}
|
|
2207
2531
|
|
|
2208
2532
|
// src/components/Select/select.variants.ts
|
|
2209
2533
|
var selectVariants = createVariants({
|
|
@@ -2227,17 +2551,43 @@ var selectVariants = createVariants({
|
|
|
2227
2551
|
background: "yr3Select--color-background",
|
|
2228
2552
|
error: "yr3Select--color-error",
|
|
2229
2553
|
warning: "yr3Select--color-warning",
|
|
2230
|
-
info: "yr3Select--color-info"
|
|
2554
|
+
info: "yr3Select--color-info",
|
|
2555
|
+
common: "yr3Select--color-common"
|
|
2231
2556
|
},
|
|
2232
2557
|
animated: {
|
|
2233
2558
|
true: "yr3Select--animated"
|
|
2559
|
+
},
|
|
2560
|
+
icon: {
|
|
2561
|
+
true: "yr3Select--icon"
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
});
|
|
2565
|
+
var selectIconVariants = createVariants({
|
|
2566
|
+
base: "yr3Select--icon",
|
|
2567
|
+
variants: {
|
|
2568
|
+
color: {
|
|
2569
|
+
primary: "yr3Select--icon-color-primary",
|
|
2570
|
+
secondary: "yr3Select--icon-color-secondary",
|
|
2571
|
+
success: "yr3Select--icon-color-success",
|
|
2572
|
+
text: "yr3Select--icon-color-text",
|
|
2573
|
+
disabled: "yr3Select--icon-color-disabled",
|
|
2574
|
+
background: "yr3Select--icon-color-background",
|
|
2575
|
+
error: "yr3Select--icon-color-error",
|
|
2576
|
+
warning: "yr3Select--icon-color-warning",
|
|
2577
|
+
info: "yr3Select--icon-color-info",
|
|
2578
|
+
common: "yr3Select--icon-color-common"
|
|
2579
|
+
},
|
|
2580
|
+
animated: {
|
|
2581
|
+
true: "yr3Select--icon-animated"
|
|
2582
|
+
},
|
|
2583
|
+
open: {
|
|
2584
|
+
true: "yr3Select--icon-open"
|
|
2234
2585
|
}
|
|
2235
2586
|
}
|
|
2236
2587
|
});
|
|
2237
|
-
var select_variants_default = selectVariants;
|
|
2238
2588
|
|
|
2239
2589
|
// src/components/Select/Select.tsx
|
|
2240
|
-
import { jsx as
|
|
2590
|
+
import { jsx as jsx38, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2241
2591
|
var initiaPropsComponent3 = {
|
|
2242
2592
|
control: {
|
|
2243
2593
|
variant: "outlined",
|
|
@@ -2247,6 +2597,7 @@ var initiaPropsComponent3 = {
|
|
|
2247
2597
|
},
|
|
2248
2598
|
label: {
|
|
2249
2599
|
display: true,
|
|
2600
|
+
color: "primary",
|
|
2250
2601
|
ui: {},
|
|
2251
2602
|
style: {}
|
|
2252
2603
|
},
|
|
@@ -2269,20 +2620,23 @@ var initiaPropsComponent3 = {
|
|
|
2269
2620
|
icon: {
|
|
2270
2621
|
style: {
|
|
2271
2622
|
width: 24,
|
|
2272
|
-
height: 24
|
|
2273
|
-
stroke: "currentColor"
|
|
2623
|
+
height: 24
|
|
2274
2624
|
},
|
|
2625
|
+
color: "primary",
|
|
2275
2626
|
component: void 0
|
|
2276
2627
|
}
|
|
2277
2628
|
};
|
|
2278
|
-
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent
|
|
2279
|
-
const [open, setOpen] =
|
|
2280
|
-
const [valueState, setValueState] =
|
|
2281
|
-
const ref =
|
|
2629
|
+
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2630
|
+
const [open, setOpen] = React22.useState(false);
|
|
2631
|
+
const [valueState, setValueState] = React22.useState(value || defaultValue || null);
|
|
2632
|
+
const ref = React22.useRef(null);
|
|
2282
2633
|
useClickAway(ref, () => setOpen(false));
|
|
2283
|
-
const
|
|
2284
|
-
|
|
2285
|
-
|
|
2634
|
+
const theme = useTheme();
|
|
2635
|
+
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2636
|
+
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2637
|
+
const classes = selectVariants({ wrapper: true });
|
|
2638
|
+
return /* @__PURE__ */ jsxs16("div", { className: classes, ref, children: [
|
|
2639
|
+
/* @__PURE__ */ jsx38(
|
|
2286
2640
|
Input,
|
|
2287
2641
|
{
|
|
2288
2642
|
label,
|
|
@@ -2290,27 +2644,36 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2290
2644
|
disabled: true,
|
|
2291
2645
|
value: valueState,
|
|
2292
2646
|
propsComponent: {
|
|
2293
|
-
control:
|
|
2294
|
-
label:
|
|
2647
|
+
control: properties?.control,
|
|
2648
|
+
label: properties?.label
|
|
2295
2649
|
}
|
|
2296
2650
|
}
|
|
2297
2651
|
),
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
-
|
|
2652
|
+
/* @__PURE__ */ jsx38(
|
|
2653
|
+
"div",
|
|
2300
2654
|
{
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2655
|
+
className: classesIcon,
|
|
2656
|
+
style: properties?.icon?.style,
|
|
2657
|
+
onClick: () => setOpen((prev) => !prev),
|
|
2658
|
+
"data-testid": "yr3Select-icon",
|
|
2659
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ jsx38(
|
|
2660
|
+
IconDown,
|
|
2661
|
+
{
|
|
2662
|
+
width: properties?.icon?.style?.width,
|
|
2663
|
+
height: properties?.icon?.style?.height,
|
|
2664
|
+
stroke: "currentColor",
|
|
2665
|
+
style: properties?.icon?.style
|
|
2666
|
+
}
|
|
2667
|
+
)
|
|
2305
2668
|
}
|
|
2306
|
-
)
|
|
2307
|
-
open && /* @__PURE__ */
|
|
2669
|
+
),
|
|
2670
|
+
open && /* @__PURE__ */ jsx38(
|
|
2308
2671
|
"div",
|
|
2309
2672
|
{
|
|
2310
2673
|
className: "yr3Select--menu",
|
|
2311
|
-
style: composeStyles(
|
|
2674
|
+
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2312
2675
|
"data-testid": "yr3Select-menu",
|
|
2313
|
-
children: options.map((opt) => /* @__PURE__ */
|
|
2676
|
+
children: options.map((opt) => /* @__PURE__ */ jsx38(
|
|
2314
2677
|
"div",
|
|
2315
2678
|
{
|
|
2316
2679
|
className: "yr3Select--option",
|
|
@@ -2331,8 +2694,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2331
2694
|
};
|
|
2332
2695
|
onChange?.(event, opt.value);
|
|
2333
2696
|
},
|
|
2334
|
-
style: composeStyles(
|
|
2335
|
-
children: /* @__PURE__ */
|
|
2697
|
+
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2698
|
+
children: /* @__PURE__ */ jsx38(Text, { as: "span", variant: "caption", color: properties?.menu?.options?.text?.color || "primary", ...properties?.menu?.options?.text, children: opt.label })
|
|
2336
2699
|
},
|
|
2337
2700
|
opt.value
|
|
2338
2701
|
))
|
|
@@ -2342,8 +2705,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2342
2705
|
};
|
|
2343
2706
|
|
|
2344
2707
|
// src/components/Slide/Slide.tsx
|
|
2345
|
-
import * as
|
|
2346
|
-
import { jsx as
|
|
2708
|
+
import * as React23 from "react";
|
|
2709
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2347
2710
|
var Slide = ({
|
|
2348
2711
|
in: inProp,
|
|
2349
2712
|
children,
|
|
@@ -2357,7 +2720,7 @@ var Slide = ({
|
|
|
2357
2720
|
[direction]: true,
|
|
2358
2721
|
"in": !!inProp
|
|
2359
2722
|
});
|
|
2360
|
-
|
|
2723
|
+
React23.useEffect(() => {
|
|
2361
2724
|
let timeoutId;
|
|
2362
2725
|
if (inProp) {
|
|
2363
2726
|
timeoutId = setTimeout(() => {
|
|
@@ -2367,19 +2730,19 @@ var Slide = ({
|
|
|
2367
2730
|
return () => clearTimeout(timeoutId);
|
|
2368
2731
|
}, [inProp, duration, onTransitionEnd]);
|
|
2369
2732
|
const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2370
|
-
return /* @__PURE__ */
|
|
2733
|
+
return /* @__PURE__ */ jsx39(
|
|
2371
2734
|
"div",
|
|
2372
2735
|
{
|
|
2373
2736
|
className: "yr3Slide",
|
|
2374
2737
|
style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
|
|
2375
2738
|
"data-testid": "yr3Slide",
|
|
2376
|
-
children: /* @__PURE__ */
|
|
2739
|
+
children: /* @__PURE__ */ jsx39(
|
|
2377
2740
|
"div",
|
|
2378
2741
|
{
|
|
2379
2742
|
className: classNameContent,
|
|
2380
2743
|
style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
|
|
2381
2744
|
"data-testid": "yr3Slide-content",
|
|
2382
|
-
children: /* @__PURE__ */
|
|
2745
|
+
children: /* @__PURE__ */ jsx39(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
|
|
2383
2746
|
}
|
|
2384
2747
|
)
|
|
2385
2748
|
}
|
|
@@ -2387,7 +2750,7 @@ var Slide = ({
|
|
|
2387
2750
|
};
|
|
2388
2751
|
|
|
2389
2752
|
// src/components/Switch/Switch.tsx
|
|
2390
|
-
import * as
|
|
2753
|
+
import * as React24 from "react";
|
|
2391
2754
|
|
|
2392
2755
|
// src/components/Switch/switch.variants.ts
|
|
2393
2756
|
var switchVariants = createVariants({
|
|
@@ -2399,7 +2762,11 @@ var switchVariants = createVariants({
|
|
|
2399
2762
|
success: "yr3Switch--color-success",
|
|
2400
2763
|
text: "yr3Switch--color-text",
|
|
2401
2764
|
disabled: "yr3Switch--color-disabled",
|
|
2402
|
-
warning: "yr3Switch--color-warning"
|
|
2765
|
+
warning: "yr3Switch--color-warning",
|
|
2766
|
+
info: "yr3Switch--color-info",
|
|
2767
|
+
error: "yr3Switch--color-error",
|
|
2768
|
+
background: "yr3Switch--color-background",
|
|
2769
|
+
common: "yr3Switch--color-common"
|
|
2403
2770
|
},
|
|
2404
2771
|
size: {
|
|
2405
2772
|
sm: "yr3Switch--sm",
|
|
@@ -2420,7 +2787,7 @@ var switchVariants = createVariants({
|
|
|
2420
2787
|
});
|
|
2421
2788
|
|
|
2422
2789
|
// src/components/Switch/Switch.tsx
|
|
2423
|
-
import { jsx as
|
|
2790
|
+
import { jsx as jsx40, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2424
2791
|
var Switch = ({
|
|
2425
2792
|
checked,
|
|
2426
2793
|
defaultChecked,
|
|
@@ -2432,7 +2799,7 @@ var Switch = ({
|
|
|
2432
2799
|
placement = "end",
|
|
2433
2800
|
propsComponent
|
|
2434
2801
|
}) => {
|
|
2435
|
-
const [internal, setInternal] =
|
|
2802
|
+
const [internal, setInternal] = React24.useState(defaultChecked || false);
|
|
2436
2803
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2437
2804
|
const isControlled = checked !== void 0;
|
|
2438
2805
|
const value = isControlled ? checked : internal;
|
|
@@ -2440,13 +2807,13 @@ var Switch = ({
|
|
|
2440
2807
|
if (!isControlled) setInternal(e.target.checked);
|
|
2441
2808
|
onChange?.(e, e.target.checked);
|
|
2442
2809
|
};
|
|
2443
|
-
return /* @__PURE__ */
|
|
2810
|
+
return /* @__PURE__ */ jsxs17(
|
|
2444
2811
|
"label",
|
|
2445
2812
|
{
|
|
2446
2813
|
className: classname,
|
|
2447
2814
|
"data-testid": "yr3Switch",
|
|
2448
2815
|
children: [
|
|
2449
|
-
/* @__PURE__ */
|
|
2816
|
+
/* @__PURE__ */ jsx40(
|
|
2450
2817
|
"input",
|
|
2451
2818
|
{
|
|
2452
2819
|
type: "checkbox",
|
|
@@ -2455,8 +2822,8 @@ var Switch = ({
|
|
|
2455
2822
|
disabled
|
|
2456
2823
|
}
|
|
2457
2824
|
),
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
/* @__PURE__ */
|
|
2825
|
+
/* @__PURE__ */ jsx40("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx40("span", { className: "yr3Switch--thumb" }) }),
|
|
2826
|
+
/* @__PURE__ */ jsx40(
|
|
2460
2827
|
"span",
|
|
2461
2828
|
{
|
|
2462
2829
|
className: "yr3Switch--label",
|
|
@@ -2471,9 +2838,9 @@ var Switch = ({
|
|
|
2471
2838
|
};
|
|
2472
2839
|
|
|
2473
2840
|
// src/Icons/IconSearch.tsx
|
|
2474
|
-
import { jsx as
|
|
2841
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2475
2842
|
var IconSearch = (props) => {
|
|
2476
|
-
return /* @__PURE__ */
|
|
2843
|
+
return /* @__PURE__ */ jsx41("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__ */ jsx41(
|
|
2477
2844
|
"path",
|
|
2478
2845
|
{
|
|
2479
2846
|
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",
|
|
@@ -2485,103 +2852,6 @@ var IconSearch = (props) => {
|
|
|
2485
2852
|
) });
|
|
2486
2853
|
};
|
|
2487
2854
|
|
|
2488
|
-
// src/theme/ThemeProvider.tsx
|
|
2489
|
-
import * as React22 from "react";
|
|
2490
|
-
|
|
2491
|
-
// src/theme/notistackContext.tsx
|
|
2492
|
-
import * as React21 from "react";
|
|
2493
|
-
import { jsx as jsx39, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2494
|
-
var NotistackContext = React21.createContext(null);
|
|
2495
|
-
var NotistackProvider = ({ children }) => {
|
|
2496
|
-
const [snacks, setSnacks] = React21.useState([]);
|
|
2497
|
-
const notistack = (snack) => {
|
|
2498
|
-
const id = Date.now();
|
|
2499
|
-
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2500
|
-
const duration = snack.duration || 3e3;
|
|
2501
|
-
const exitDuration = 300;
|
|
2502
|
-
setTimeout(() => {
|
|
2503
|
-
setSnacks(
|
|
2504
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2505
|
-
);
|
|
2506
|
-
}, duration);
|
|
2507
|
-
setTimeout(() => {
|
|
2508
|
-
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2509
|
-
}, duration + exitDuration);
|
|
2510
|
-
};
|
|
2511
|
-
return /* @__PURE__ */ jsxs16(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2512
|
-
children,
|
|
2513
|
-
/* @__PURE__ */ jsx39("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx39(Notistack, { ...snack }, snack.id)) })
|
|
2514
|
-
] });
|
|
2515
|
-
};
|
|
2516
|
-
var useNotistack = () => {
|
|
2517
|
-
const ctx = React21.useContext(NotistackContext);
|
|
2518
|
-
if (!ctx) {
|
|
2519
|
-
throw new Error("NotistackProvider missing");
|
|
2520
|
-
}
|
|
2521
|
-
return ctx;
|
|
2522
|
-
};
|
|
2523
|
-
|
|
2524
|
-
// src/theme/ThemeProvider.tsx
|
|
2525
|
-
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2526
|
-
var ThemeContext = React22.createContext(null);
|
|
2527
|
-
var ThemeProvider = ({ theme, children }) => {
|
|
2528
|
-
React22.useEffect(() => {
|
|
2529
|
-
applyTheme(theme);
|
|
2530
|
-
}, [theme]);
|
|
2531
|
-
return /* @__PURE__ */ jsx40(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx40(BackdropProvider, { children: /* @__PURE__ */ jsx40(NotistackProvider, { children }) }) });
|
|
2532
|
-
};
|
|
2533
|
-
var useTheme = () => React22.useContext(ThemeContext);
|
|
2534
|
-
|
|
2535
|
-
// src/theme/tokens.ts
|
|
2536
|
-
var baseTokens = {
|
|
2537
|
-
colors: {
|
|
2538
|
-
primary: "#6C5CE7",
|
|
2539
|
-
secondary: "#00CEC9",
|
|
2540
|
-
background: "#0f0f1a",
|
|
2541
|
-
surface: "#1a1a2e",
|
|
2542
|
-
textPrimary: "#ffffff",
|
|
2543
|
-
textSecondary: "#b2bec3"
|
|
2544
|
-
},
|
|
2545
|
-
spacing: (factor) => `${factor * 8}px`,
|
|
2546
|
-
radius: {
|
|
2547
|
-
sm: "6px",
|
|
2548
|
-
md: "12px",
|
|
2549
|
-
lg: "20px"
|
|
2550
|
-
}
|
|
2551
|
-
};
|
|
2552
|
-
|
|
2553
|
-
// src/theme/useMediaQuery.tsx
|
|
2554
|
-
import * as React23 from "react";
|
|
2555
|
-
function useMediaQuery(query) {
|
|
2556
|
-
const theme = useTheme();
|
|
2557
|
-
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2558
|
-
const [matches, setMatches] = React23.useState(() => {
|
|
2559
|
-
if (typeof window === "undefined") return false;
|
|
2560
|
-
return window.matchMedia(computedQuery).matches;
|
|
2561
|
-
});
|
|
2562
|
-
React23.useEffect(() => {
|
|
2563
|
-
if (typeof window === "undefined") return;
|
|
2564
|
-
const media = window.matchMedia(computedQuery);
|
|
2565
|
-
const listener = () => setMatches(media.matches);
|
|
2566
|
-
media.addEventListener("change", listener);
|
|
2567
|
-
return () => media.removeEventListener("change", listener);
|
|
2568
|
-
}, [computedQuery]);
|
|
2569
|
-
return matches;
|
|
2570
|
-
}
|
|
2571
|
-
function useBreakpointValue(values) {
|
|
2572
|
-
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
2573
|
-
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
2574
|
-
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
2575
|
-
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
2576
|
-
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
2577
|
-
if (xl && values.xl !== void 0) return values.xl;
|
|
2578
|
-
if (lg && values.lg !== void 0) return values.lg;
|
|
2579
|
-
if (md && values.md !== void 0) return values.md;
|
|
2580
|
-
if (sm && values.sm !== void 0) return values.sm;
|
|
2581
|
-
if (xs && values.xs !== void 0) return values.xs;
|
|
2582
|
-
return void 0;
|
|
2583
|
-
}
|
|
2584
|
-
|
|
2585
2855
|
// src/hooks/usePlaces.ts
|
|
2586
2856
|
import { useAutocompletePlaces as useAutocompletePlaces2 } from "@yr3/autocomplete-places";
|
|
2587
2857
|
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
@@ -2593,7 +2863,7 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
|
2593
2863
|
};
|
|
2594
2864
|
|
|
2595
2865
|
// src/hooks/useBreakpoint.ts
|
|
2596
|
-
import * as
|
|
2866
|
+
import * as React25 from "react";
|
|
2597
2867
|
var breakUp = (bp) => `(min-width: ${bp}px)`;
|
|
2598
2868
|
var breakDown = (bp) => `(max-width: ${bp}px)`;
|
|
2599
2869
|
function useBreakpoint(queryInput) {
|
|
@@ -2603,8 +2873,8 @@ function useBreakpoint(queryInput) {
|
|
|
2603
2873
|
if (typeof window === "undefined") return false;
|
|
2604
2874
|
return window.matchMedia(query).matches;
|
|
2605
2875
|
};
|
|
2606
|
-
const [matches, setMatches] =
|
|
2607
|
-
|
|
2876
|
+
const [matches, setMatches] = React25.useState(getMatch);
|
|
2877
|
+
React25.useEffect(() => {
|
|
2608
2878
|
if (typeof window === "undefined") return;
|
|
2609
2879
|
const media = window.matchMedia(query);
|
|
2610
2880
|
const listener = (e) => {
|
|
@@ -2657,6 +2927,7 @@ export {
|
|
|
2657
2927
|
Input,
|
|
2658
2928
|
InputArea,
|
|
2659
2929
|
Label,
|
|
2930
|
+
Loader,
|
|
2660
2931
|
Modal,
|
|
2661
2932
|
ModalContainer,
|
|
2662
2933
|
Notistack,
|
|
@@ -2673,6 +2944,7 @@ export {
|
|
|
2673
2944
|
ThemeContext,
|
|
2674
2945
|
ThemeProvider,
|
|
2675
2946
|
adjustColor,
|
|
2947
|
+
alpha,
|
|
2676
2948
|
applyTheme,
|
|
2677
2949
|
baseTokens,
|
|
2678
2950
|
bem,
|
|
@@ -2685,14 +2957,19 @@ export {
|
|
|
2685
2957
|
createTheme,
|
|
2686
2958
|
createVariants,
|
|
2687
2959
|
cx,
|
|
2960
|
+
darken,
|
|
2688
2961
|
getContrast,
|
|
2689
2962
|
getCountryCodePhone,
|
|
2690
2963
|
getDialPhone,
|
|
2691
2964
|
getMonthCalendar,
|
|
2692
2965
|
getNumberPhone,
|
|
2966
|
+
hexToRgb,
|
|
2693
2967
|
initTheme,
|
|
2694
2968
|
isEmpty,
|
|
2969
|
+
lighten,
|
|
2970
|
+
mergeDeep,
|
|
2695
2971
|
normalizePhone,
|
|
2972
|
+
rgbToHex,
|
|
2696
2973
|
text,
|
|
2697
2974
|
times,
|
|
2698
2975
|
uiStyle,
|