@yr3/ui 1.0.14 → 1.0.16
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/Group/group.css +12 -6
- package/dist/components/Group/group.css.map +1 -1
- package/dist/components/Slide/slide.css +4 -0
- package/dist/components/Slide/slide.css.map +1 -1
- package/dist/index.cjs +231 -156
- package/dist/index.d.cts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +230 -156
- package/dist/styles/index.css +16 -6
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -95,6 +95,7 @@ __export(index_exports, {
|
|
|
95
95
|
getNumberPhone: () => getNumberPhone,
|
|
96
96
|
hexToRgb: () => hexToRgb,
|
|
97
97
|
initTheme: () => initTheme,
|
|
98
|
+
inputCurrency: () => inputCurrency,
|
|
98
99
|
isEmpty: () => isEmpty,
|
|
99
100
|
lighten: () => lighten,
|
|
100
101
|
mergeDeep: () => mergeDeep,
|
|
@@ -461,6 +462,15 @@ function mergeDeep(target, source) {
|
|
|
461
462
|
return output;
|
|
462
463
|
}
|
|
463
464
|
|
|
465
|
+
// src/utils/input.ts
|
|
466
|
+
var inputCurrency = (e, value, alloweds) => {
|
|
467
|
+
const allowed = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab"].concat(alloweds);
|
|
468
|
+
if (allowed.includes(e.key)) return;
|
|
469
|
+
if (/^\d$/.test(e.key)) return;
|
|
470
|
+
if ((e.key === "," || e.key === ".") && !(value || "").includes(",") && !(value || "").includes(".")) return;
|
|
471
|
+
e.preventDefault();
|
|
472
|
+
};
|
|
473
|
+
|
|
464
474
|
// src/theme/breakpoint.ts
|
|
465
475
|
var breakpoints = {
|
|
466
476
|
xs: 0,
|
|
@@ -724,9 +734,18 @@ var React2 = __toESM(require("react"), 1);
|
|
|
724
734
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
725
735
|
var BackdropContext = React2.createContext(null);
|
|
726
736
|
var BackdropProvider = ({ children }) => {
|
|
727
|
-
const [
|
|
728
|
-
const show = () =>
|
|
729
|
-
|
|
737
|
+
const [stack, setStack] = React2.useState([]);
|
|
738
|
+
const show = (id) => {
|
|
739
|
+
setStack((prev) => [...prev, id]);
|
|
740
|
+
};
|
|
741
|
+
const hide = (id) => {
|
|
742
|
+
if (id) {
|
|
743
|
+
setStack((prev) => prev.filter((item) => item !== id));
|
|
744
|
+
} else {
|
|
745
|
+
setStack([]);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
const open = stack.length > 0;
|
|
730
749
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(BackdropContext.Provider, { value: { open, show, hide }, children: [
|
|
731
750
|
children,
|
|
732
751
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Backdrop, {})
|
|
@@ -1400,7 +1419,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1400
1419
|
const { hide } = useBackdrop();
|
|
1401
1420
|
const handleClose = () => {
|
|
1402
1421
|
if (props === "container") {
|
|
1403
|
-
hide();
|
|
1422
|
+
hide("drawer");
|
|
1404
1423
|
onClose && onClose();
|
|
1405
1424
|
}
|
|
1406
1425
|
return;
|
|
@@ -1437,30 +1456,32 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1437
1456
|
const ref = React8.useRef(null);
|
|
1438
1457
|
const properties = mergeDeep(initialPropsComponent2, propsComponent);
|
|
1439
1458
|
React8.useEffect(() => {
|
|
1440
|
-
if (
|
|
1441
|
-
show();
|
|
1459
|
+
if (open) {
|
|
1460
|
+
show("drawer");
|
|
1442
1461
|
} else {
|
|
1443
|
-
hide();
|
|
1462
|
+
hide("drawer");
|
|
1444
1463
|
}
|
|
1445
1464
|
}, [open]);
|
|
1446
1465
|
useClickAway(ref, () => {
|
|
1447
1466
|
if (!open || properties?.closing === null) return;
|
|
1448
1467
|
if (properties?.closing === "drawer") {
|
|
1449
|
-
hide();
|
|
1468
|
+
hide("drawer");
|
|
1450
1469
|
onClose();
|
|
1451
1470
|
}
|
|
1452
1471
|
;
|
|
1453
1472
|
});
|
|
1454
1473
|
React8.useEffect(() => {
|
|
1455
1474
|
if (properties?.onClose) {
|
|
1456
|
-
hide();
|
|
1475
|
+
hide("drawer");
|
|
1457
1476
|
onClose();
|
|
1458
1477
|
}
|
|
1459
1478
|
}, [properties?.onClose]);
|
|
1479
|
+
const classesBem = bem("yr3Drawer");
|
|
1480
|
+
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1460
1481
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1461
1482
|
"div",
|
|
1462
1483
|
{
|
|
1463
|
-
className:
|
|
1484
|
+
className: drawerClasses,
|
|
1464
1485
|
style: properties?.drawer,
|
|
1465
1486
|
onClick: (e) => e.stopPropagation(),
|
|
1466
1487
|
ref,
|
|
@@ -1648,7 +1669,14 @@ var initialComponents = {
|
|
|
1648
1669
|
},
|
|
1649
1670
|
item: {
|
|
1650
1671
|
ui: {},
|
|
1651
|
-
style: {}
|
|
1672
|
+
style: {},
|
|
1673
|
+
text: {
|
|
1674
|
+
variant: "caption",
|
|
1675
|
+
color: "primary",
|
|
1676
|
+
as: "span",
|
|
1677
|
+
ui: {},
|
|
1678
|
+
style: {}
|
|
1679
|
+
}
|
|
1652
1680
|
}
|
|
1653
1681
|
};
|
|
1654
1682
|
var Group = ({
|
|
@@ -1658,8 +1686,10 @@ var Group = ({
|
|
|
1658
1686
|
variant,
|
|
1659
1687
|
type = "rounded",
|
|
1660
1688
|
color = "primary",
|
|
1661
|
-
|
|
1689
|
+
exclude = false,
|
|
1690
|
+
propsComponent
|
|
1662
1691
|
}) => {
|
|
1692
|
+
const properties = mergeDeep(initialComponents, propsComponent || {});
|
|
1663
1693
|
const [internalValue, setInternalValue] = React10.useState(null);
|
|
1664
1694
|
const isControlled = value !== void 0;
|
|
1665
1695
|
React10.useEffect(() => {
|
|
@@ -1668,20 +1698,51 @@ var Group = ({
|
|
|
1668
1698
|
}
|
|
1669
1699
|
}, [value, isControlled]);
|
|
1670
1700
|
const classItems = bem("yr3Group--item");
|
|
1701
|
+
const clasess = (item) => classItems(void 0, {
|
|
1702
|
+
item: !!item,
|
|
1703
|
+
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
1704
|
+
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
1705
|
+
});
|
|
1706
|
+
const mappingStyle = React10.useMemo(() => {
|
|
1707
|
+
if (!exclude) {
|
|
1708
|
+
const checked = options.filter((opt) => Array.isArray(value) ? value.includes(opt.value) : internalValue === opt.value);
|
|
1709
|
+
return checked.map((opt, index) => ({
|
|
1710
|
+
...opt,
|
|
1711
|
+
index,
|
|
1712
|
+
style: {
|
|
1713
|
+
borderTopLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1714
|
+
borderBottomLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1715
|
+
borderTopRightRadius: index === checked.length - 1 ? "var(--group-border-radius, 0px)" : 0,
|
|
1716
|
+
borderBottomRightRadius: index === checked.length - 1 ? "var(--group-border-radius, 0px)" : 0
|
|
1717
|
+
}
|
|
1718
|
+
}));
|
|
1719
|
+
}
|
|
1720
|
+
const diference = options.filter((opt) => Array.isArray(value) ? !value.includes(opt.value) : internalValue !== opt.value);
|
|
1721
|
+
return diference.map((opt, index) => ({
|
|
1722
|
+
...opt,
|
|
1723
|
+
index,
|
|
1724
|
+
style: {
|
|
1725
|
+
borderTopLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1726
|
+
borderBottomLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1727
|
+
borderTopRightRadius: index === diference.length - 1 ? "var(--group-border-radius, 0px)" : 0,
|
|
1728
|
+
borderBottomRightRadius: index === diference.length - 1 ? "var(--group-border-radius, 0px)" : 0
|
|
1729
|
+
}
|
|
1730
|
+
}));
|
|
1731
|
+
}, [exclude, value, options]);
|
|
1671
1732
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1672
1733
|
"div",
|
|
1673
1734
|
{
|
|
1674
1735
|
className: groupVariants({ variant, color, type }),
|
|
1675
1736
|
"data-testid": "yr3Group",
|
|
1676
|
-
style: composeStyles(
|
|
1677
|
-
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1737
|
+
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
1738
|
+
children: options.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1678
1739
|
"div",
|
|
1679
1740
|
{
|
|
1680
1741
|
"data-testid": "yr3Group-item",
|
|
1681
|
-
className:
|
|
1682
|
-
onClick: () => onChange?.(opt.value),
|
|
1683
|
-
style: composeStyles(
|
|
1684
|
-
children: opt.label
|
|
1742
|
+
className: clasess(opt),
|
|
1743
|
+
onClick: () => (!opt.disabled && !exclude || exclude && mappingStyle?.find((e) => e.value === opt.value)?.index === 0) && onChange?.(opt.value),
|
|
1744
|
+
style: composeStyles(properties.item?.ui, { ...properties.item?.style, ...mappingStyle?.find((o) => o.value === opt.value)?.style }),
|
|
1745
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { ...properties.item?.text, children: opt.label })
|
|
1685
1746
|
},
|
|
1686
1747
|
opt.value
|
|
1687
1748
|
))
|
|
@@ -1851,11 +1912,12 @@ var Input = React12.forwardRef(
|
|
|
1851
1912
|
defaultValue,
|
|
1852
1913
|
onChange,
|
|
1853
1914
|
variant = "outlined",
|
|
1854
|
-
error =
|
|
1915
|
+
error = "ce un errore",
|
|
1916
|
+
separatorCurrency = ",",
|
|
1855
1917
|
ui,
|
|
1856
1918
|
style,
|
|
1857
1919
|
propsComponent = initiaPropsComponent,
|
|
1858
|
-
|
|
1920
|
+
pattern = "text",
|
|
1859
1921
|
color = "primary",
|
|
1860
1922
|
size = "auto",
|
|
1861
1923
|
...props
|
|
@@ -1865,20 +1927,24 @@ var Input = React12.forwardRef(
|
|
|
1865
1927
|
const isControlled = value !== void 0;
|
|
1866
1928
|
const currentValue = isControlled ? value : internalValue;
|
|
1867
1929
|
const isActive = focused || !!currentValue;
|
|
1868
|
-
const checkPattern = (
|
|
1869
|
-
switch (
|
|
1930
|
+
const checkPattern = (type, value2) => {
|
|
1931
|
+
switch (type) {
|
|
1870
1932
|
case "email":
|
|
1871
1933
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
1872
1934
|
case "phone":
|
|
1873
1935
|
return /^\d{10}$/.test(value2);
|
|
1874
1936
|
case "number":
|
|
1875
1937
|
return /^\d+$/.test(value2);
|
|
1938
|
+
case "currency":
|
|
1939
|
+
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1940
|
+
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
1876
1941
|
default:
|
|
1877
1942
|
return true;
|
|
1878
1943
|
}
|
|
1879
1944
|
};
|
|
1880
1945
|
const handleChange = (e) => {
|
|
1881
1946
|
const newValue = e.target.value;
|
|
1947
|
+
if (newValue && !checkPattern(pattern, newValue)) return;
|
|
1882
1948
|
if (!isControlled) {
|
|
1883
1949
|
setInternalValue(newValue);
|
|
1884
1950
|
}
|
|
@@ -1900,10 +1966,10 @@ var Input = React12.forwardRef(
|
|
|
1900
1966
|
{
|
|
1901
1967
|
ref,
|
|
1902
1968
|
value: currentValue,
|
|
1903
|
-
|
|
1969
|
+
inputMode: pattern === "currency" ? "numeric" : pattern === "phone" ? "tel" : void 0,
|
|
1904
1970
|
autoComplete: "off",
|
|
1971
|
+
type: "text",
|
|
1905
1972
|
onChange: handleChange,
|
|
1906
|
-
onKeyDown: (e) => checkPattern(type, e.key),
|
|
1907
1973
|
onFocus: () => setFocused(true),
|
|
1908
1974
|
onBlur: () => setFocused(false),
|
|
1909
1975
|
className: classes,
|
|
@@ -2109,11 +2175,11 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
2109
2175
|
const { show, hide } = useBackdrop();
|
|
2110
2176
|
React15.useEffect(() => {
|
|
2111
2177
|
if (open) {
|
|
2112
|
-
show();
|
|
2178
|
+
show("modal");
|
|
2113
2179
|
} else {
|
|
2114
|
-
hide();
|
|
2180
|
+
hide("modal");
|
|
2115
2181
|
}
|
|
2116
|
-
}, [open
|
|
2182
|
+
}, [open]);
|
|
2117
2183
|
const classes = bem("yr3Modal");
|
|
2118
2184
|
const classComponent = classes(void 0, { "open": !!open });
|
|
2119
2185
|
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: [
|
|
@@ -2536,104 +2602,7 @@ var Radio = ({
|
|
|
2536
2602
|
};
|
|
2537
2603
|
|
|
2538
2604
|
// src/components/Select/Select.tsx
|
|
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
2605
|
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
|
-
}
|
|
2637
2606
|
|
|
2638
2607
|
// src/components/Select/select.variants.ts
|
|
2639
2608
|
var selectVariants = createVariants({
|
|
@@ -2693,7 +2662,7 @@ var selectIconVariants = createVariants({
|
|
|
2693
2662
|
});
|
|
2694
2663
|
|
|
2695
2664
|
// src/components/Select/Select.tsx
|
|
2696
|
-
var
|
|
2665
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2697
2666
|
var initiaPropsComponent3 = {
|
|
2698
2667
|
control: {
|
|
2699
2668
|
variant: "outlined",
|
|
@@ -2733,36 +2702,35 @@ var initiaPropsComponent3 = {
|
|
|
2733
2702
|
}
|
|
2734
2703
|
};
|
|
2735
2704
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2736
|
-
const [open, setOpen] =
|
|
2737
|
-
const [valueState, setValueState] =
|
|
2738
|
-
const ref =
|
|
2705
|
+
const [open, setOpen] = React19.useState(false);
|
|
2706
|
+
const [valueState, setValueState] = React19.useState(value || defaultValue || null);
|
|
2707
|
+
const ref = React19.useRef(null);
|
|
2739
2708
|
useClickAway(ref, () => setOpen(false));
|
|
2740
|
-
const theme = useTheme();
|
|
2741
2709
|
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2742
2710
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2743
2711
|
const classes = selectVariants({ wrapper: true });
|
|
2744
|
-
return /* @__PURE__ */ (0,
|
|
2745
|
-
/* @__PURE__ */ (0,
|
|
2712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: classes, ref, children: [
|
|
2713
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2746
2714
|
Input,
|
|
2747
2715
|
{
|
|
2748
2716
|
label,
|
|
2749
2717
|
variant: "base",
|
|
2750
2718
|
disabled: true,
|
|
2751
|
-
value: valueState,
|
|
2719
|
+
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
2752
2720
|
propsComponent: {
|
|
2753
2721
|
control: properties?.control,
|
|
2754
2722
|
label: properties?.label
|
|
2755
2723
|
}
|
|
2756
2724
|
}
|
|
2757
2725
|
),
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
2726
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2759
2727
|
"div",
|
|
2760
2728
|
{
|
|
2761
2729
|
className: classesIcon,
|
|
2762
2730
|
style: properties?.icon?.style,
|
|
2763
2731
|
onClick: () => setOpen((prev) => !prev),
|
|
2764
2732
|
"data-testid": "yr3Select-icon",
|
|
2765
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0,
|
|
2733
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2766
2734
|
IconDown,
|
|
2767
2735
|
{
|
|
2768
2736
|
width: properties?.icon?.style?.width,
|
|
@@ -2773,13 +2741,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2773
2741
|
)
|
|
2774
2742
|
}
|
|
2775
2743
|
),
|
|
2776
|
-
open && /* @__PURE__ */ (0,
|
|
2744
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2777
2745
|
"div",
|
|
2778
2746
|
{
|
|
2779
2747
|
className: "yr3Select--menu",
|
|
2780
2748
|
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2781
2749
|
"data-testid": "yr3Select-menu",
|
|
2782
|
-
children: options.map((opt) => /* @__PURE__ */ (0,
|
|
2750
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2783
2751
|
"div",
|
|
2784
2752
|
{
|
|
2785
2753
|
className: "yr3Select--option",
|
|
@@ -2801,7 +2769,7 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2801
2769
|
onChange?.(event, opt.value);
|
|
2802
2770
|
},
|
|
2803
2771
|
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2804
|
-
children: /* @__PURE__ */ (0,
|
|
2772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { as: "span", variant: "caption", color: properties?.menu?.options?.text?.color || "primary", ...properties?.menu?.options?.text, children: opt.label })
|
|
2805
2773
|
},
|
|
2806
2774
|
opt.value
|
|
2807
2775
|
))
|
|
@@ -2811,8 +2779,15 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2811
2779
|
};
|
|
2812
2780
|
|
|
2813
2781
|
// src/components/Slide/Slide.tsx
|
|
2814
|
-
var
|
|
2815
|
-
var
|
|
2782
|
+
var React20 = __toESM(require("react"), 1);
|
|
2783
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2784
|
+
var initialPropsComponent4 = {
|
|
2785
|
+
slide: {
|
|
2786
|
+
ui: {},
|
|
2787
|
+
style: {}
|
|
2788
|
+
},
|
|
2789
|
+
box: {}
|
|
2790
|
+
};
|
|
2816
2791
|
var Slide = ({
|
|
2817
2792
|
in: inProp,
|
|
2818
2793
|
children,
|
|
@@ -2821,12 +2796,14 @@ var Slide = ({
|
|
|
2821
2796
|
onTransitionEnd,
|
|
2822
2797
|
propsComponent
|
|
2823
2798
|
}) => {
|
|
2799
|
+
const properties = mergeDeep(initialPropsComponent4, propsComponent || {});
|
|
2824
2800
|
const bemContent = bem("yr3Slide--content");
|
|
2825
2801
|
const classNameContent = bemContent(void 0, {
|
|
2826
2802
|
[direction]: true,
|
|
2827
|
-
"in": !!inProp
|
|
2803
|
+
"in": !!inProp,
|
|
2804
|
+
"out": !inProp
|
|
2828
2805
|
});
|
|
2829
|
-
|
|
2806
|
+
React20.useEffect(() => {
|
|
2830
2807
|
let timeoutId;
|
|
2831
2808
|
if (inProp) {
|
|
2832
2809
|
timeoutId = setTimeout(() => {
|
|
@@ -2835,20 +2812,20 @@ var Slide = ({
|
|
|
2835
2812
|
}
|
|
2836
2813
|
return () => clearTimeout(timeoutId);
|
|
2837
2814
|
}, [inProp, duration, onTransitionEnd]);
|
|
2838
|
-
const uiStyleContent = uiStyle({ ...
|
|
2839
|
-
return /* @__PURE__ */ (0,
|
|
2815
|
+
const uiStyleContent = uiStyle({ ...properties?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2840
2817
|
"div",
|
|
2841
2818
|
{
|
|
2842
2819
|
className: "yr3Slide",
|
|
2843
|
-
style:
|
|
2820
|
+
style: composeStyles(),
|
|
2844
2821
|
"data-testid": "yr3Slide",
|
|
2845
|
-
children: /* @__PURE__ */ (0,
|
|
2822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2846
2823
|
"div",
|
|
2847
2824
|
{
|
|
2848
2825
|
className: classNameContent,
|
|
2849
|
-
style: composeStyles(uiStyleContent,
|
|
2826
|
+
style: composeStyles(uiStyleContent, properties?.slide?.style || {}),
|
|
2850
2827
|
"data-testid": "yr3Slide-content",
|
|
2851
|
-
children: /* @__PURE__ */ (0,
|
|
2828
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { ...properties?.box, "data-testid": "yr3Slide-box", children })
|
|
2852
2829
|
}
|
|
2853
2830
|
)
|
|
2854
2831
|
}
|
|
@@ -2856,7 +2833,7 @@ var Slide = ({
|
|
|
2856
2833
|
};
|
|
2857
2834
|
|
|
2858
2835
|
// src/components/Switch/Switch.tsx
|
|
2859
|
-
var
|
|
2836
|
+
var React21 = __toESM(require("react"), 1);
|
|
2860
2837
|
|
|
2861
2838
|
// src/components/Switch/switch.variants.ts
|
|
2862
2839
|
var switchVariants = createVariants({
|
|
@@ -2893,7 +2870,7 @@ var switchVariants = createVariants({
|
|
|
2893
2870
|
});
|
|
2894
2871
|
|
|
2895
2872
|
// src/components/Switch/Switch.tsx
|
|
2896
|
-
var
|
|
2873
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2897
2874
|
var Switch = ({
|
|
2898
2875
|
checked,
|
|
2899
2876
|
defaultChecked,
|
|
@@ -2905,7 +2882,7 @@ var Switch = ({
|
|
|
2905
2882
|
placement = "end",
|
|
2906
2883
|
propsComponent
|
|
2907
2884
|
}) => {
|
|
2908
|
-
const [internal, setInternal] =
|
|
2885
|
+
const [internal, setInternal] = React21.useState(defaultChecked || false);
|
|
2909
2886
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2910
2887
|
const isControlled = checked !== void 0;
|
|
2911
2888
|
const value = isControlled ? checked : internal;
|
|
@@ -2913,13 +2890,13 @@ var Switch = ({
|
|
|
2913
2890
|
if (!isControlled) setInternal(e.target.checked);
|
|
2914
2891
|
onChange?.(e, e.target.checked);
|
|
2915
2892
|
};
|
|
2916
|
-
return /* @__PURE__ */ (0,
|
|
2893
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2917
2894
|
"label",
|
|
2918
2895
|
{
|
|
2919
2896
|
className: classname,
|
|
2920
2897
|
"data-testid": "yr3Switch",
|
|
2921
2898
|
children: [
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
2899
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2923
2900
|
"input",
|
|
2924
2901
|
{
|
|
2925
2902
|
type: "checkbox",
|
|
@@ -2928,8 +2905,8 @@ var Switch = ({
|
|
|
2928
2905
|
disabled
|
|
2929
2906
|
}
|
|
2930
2907
|
),
|
|
2931
|
-
/* @__PURE__ */ (0,
|
|
2932
|
-
/* @__PURE__ */ (0,
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
2909
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2933
2910
|
"span",
|
|
2934
2911
|
{
|
|
2935
2912
|
className: "yr3Switch--label",
|
|
@@ -2944,9 +2921,9 @@ var Switch = ({
|
|
|
2944
2921
|
};
|
|
2945
2922
|
|
|
2946
2923
|
// src/Icons/IconSearch.tsx
|
|
2947
|
-
var
|
|
2924
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2948
2925
|
var IconSearch = (props) => {
|
|
2949
|
-
return /* @__PURE__ */ (0,
|
|
2926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.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_runtime39.jsx)(
|
|
2950
2927
|
"path",
|
|
2951
2928
|
{
|
|
2952
2929
|
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",
|
|
@@ -2958,6 +2935,103 @@ var IconSearch = (props) => {
|
|
|
2958
2935
|
) });
|
|
2959
2936
|
};
|
|
2960
2937
|
|
|
2938
|
+
// src/theme/ThemeProvider.tsx
|
|
2939
|
+
var React23 = __toESM(require("react"), 1);
|
|
2940
|
+
|
|
2941
|
+
// src/theme/notistackContext.tsx
|
|
2942
|
+
var React22 = __toESM(require("react"), 1);
|
|
2943
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2944
|
+
var NotistackContext = React22.createContext(null);
|
|
2945
|
+
var NotistackProvider = ({ children }) => {
|
|
2946
|
+
const [snacks, setSnacks] = React22.useState([]);
|
|
2947
|
+
const notistack = (snack) => {
|
|
2948
|
+
const id = Date.now();
|
|
2949
|
+
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2950
|
+
const duration = snack.duration || 3e3;
|
|
2951
|
+
const exitDuration = 300;
|
|
2952
|
+
setTimeout(() => {
|
|
2953
|
+
setSnacks(
|
|
2954
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2955
|
+
);
|
|
2956
|
+
}, duration);
|
|
2957
|
+
setTimeout(() => {
|
|
2958
|
+
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2959
|
+
}, duration + exitDuration);
|
|
2960
|
+
};
|
|
2961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2962
|
+
children,
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Notistack, { ...snack }, snack.id)) })
|
|
2964
|
+
] });
|
|
2965
|
+
};
|
|
2966
|
+
var useNotistack = () => {
|
|
2967
|
+
const ctx = React22.useContext(NotistackContext);
|
|
2968
|
+
if (!ctx) {
|
|
2969
|
+
throw new Error("NotistackProvider missing");
|
|
2970
|
+
}
|
|
2971
|
+
return ctx;
|
|
2972
|
+
};
|
|
2973
|
+
|
|
2974
|
+
// src/theme/ThemeProvider.tsx
|
|
2975
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2976
|
+
var ThemeContext = React23.createContext(null);
|
|
2977
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2978
|
+
React23.useEffect(() => {
|
|
2979
|
+
applyTheme(theme);
|
|
2980
|
+
}, [theme]);
|
|
2981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(BackdropProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(NotistackProvider, { children }) }) });
|
|
2982
|
+
};
|
|
2983
|
+
var useTheme = () => React23.useContext(ThemeContext);
|
|
2984
|
+
|
|
2985
|
+
// src/theme/tokens.ts
|
|
2986
|
+
var baseTokens = {
|
|
2987
|
+
colors: {
|
|
2988
|
+
primary: "#6C5CE7",
|
|
2989
|
+
secondary: "#00CEC9",
|
|
2990
|
+
background: "#0f0f1a",
|
|
2991
|
+
surface: "#1a1a2e",
|
|
2992
|
+
textPrimary: "#ffffff",
|
|
2993
|
+
textSecondary: "#b2bec3"
|
|
2994
|
+
},
|
|
2995
|
+
spacing: (factor) => `${factor * 8}px`,
|
|
2996
|
+
radius: {
|
|
2997
|
+
sm: "6px",
|
|
2998
|
+
md: "12px",
|
|
2999
|
+
lg: "20px"
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
|
|
3003
|
+
// src/theme/useMediaQuery.tsx
|
|
3004
|
+
var React24 = __toESM(require("react"), 1);
|
|
3005
|
+
function useMediaQuery(query) {
|
|
3006
|
+
const theme = useTheme();
|
|
3007
|
+
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
3008
|
+
const [matches, setMatches] = React24.useState(() => {
|
|
3009
|
+
if (typeof window === "undefined") return false;
|
|
3010
|
+
return window.matchMedia(computedQuery).matches;
|
|
3011
|
+
});
|
|
3012
|
+
React24.useEffect(() => {
|
|
3013
|
+
if (typeof window === "undefined") return;
|
|
3014
|
+
const media = window.matchMedia(computedQuery);
|
|
3015
|
+
const listener = () => setMatches(media.matches);
|
|
3016
|
+
media.addEventListener("change", listener);
|
|
3017
|
+
return () => media.removeEventListener("change", listener);
|
|
3018
|
+
}, [computedQuery]);
|
|
3019
|
+
return matches;
|
|
3020
|
+
}
|
|
3021
|
+
function useBreakpointValue(values) {
|
|
3022
|
+
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
3023
|
+
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
3024
|
+
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
3025
|
+
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
3026
|
+
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
3027
|
+
if (xl && values.xl !== void 0) return values.xl;
|
|
3028
|
+
if (lg && values.lg !== void 0) return values.lg;
|
|
3029
|
+
if (md && values.md !== void 0) return values.md;
|
|
3030
|
+
if (sm && values.sm !== void 0) return values.sm;
|
|
3031
|
+
if (xs && values.xs !== void 0) return values.xs;
|
|
3032
|
+
return void 0;
|
|
3033
|
+
}
|
|
3034
|
+
|
|
2961
3035
|
// src/hooks/usePlaces.ts
|
|
2962
3036
|
var import_autocomplete_places2 = require("@yr3/autocomplete-places");
|
|
2963
3037
|
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
@@ -3072,6 +3146,7 @@ initTheme();
|
|
|
3072
3146
|
getNumberPhone,
|
|
3073
3147
|
hexToRgb,
|
|
3074
3148
|
initTheme,
|
|
3149
|
+
inputCurrency,
|
|
3075
3150
|
isEmpty,
|
|
3076
3151
|
lighten,
|
|
3077
3152
|
mergeDeep,
|