@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.js
CHANGED
|
@@ -344,6 +344,15 @@ function mergeDeep(target, source) {
|
|
|
344
344
|
return output;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
// src/utils/input.ts
|
|
348
|
+
var inputCurrency = (e, value, alloweds) => {
|
|
349
|
+
const allowed = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab"].concat(alloweds);
|
|
350
|
+
if (allowed.includes(e.key)) return;
|
|
351
|
+
if (/^\d$/.test(e.key)) return;
|
|
352
|
+
if ((e.key === "," || e.key === ".") && !(value || "").includes(",") && !(value || "").includes(".")) return;
|
|
353
|
+
e.preventDefault();
|
|
354
|
+
};
|
|
355
|
+
|
|
347
356
|
// src/theme/breakpoint.ts
|
|
348
357
|
var breakpoints = {
|
|
349
358
|
xs: 0,
|
|
@@ -607,9 +616,18 @@ import * as React2 from "react";
|
|
|
607
616
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
608
617
|
var BackdropContext = React2.createContext(null);
|
|
609
618
|
var BackdropProvider = ({ children }) => {
|
|
610
|
-
const [
|
|
611
|
-
const show = () =>
|
|
612
|
-
|
|
619
|
+
const [stack, setStack] = React2.useState([]);
|
|
620
|
+
const show = (id) => {
|
|
621
|
+
setStack((prev) => [...prev, id]);
|
|
622
|
+
};
|
|
623
|
+
const hide = (id) => {
|
|
624
|
+
if (id) {
|
|
625
|
+
setStack((prev) => prev.filter((item) => item !== id));
|
|
626
|
+
} else {
|
|
627
|
+
setStack([]);
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
const open = stack.length > 0;
|
|
613
631
|
return /* @__PURE__ */ jsxs(BackdropContext.Provider, { value: { open, show, hide }, children: [
|
|
614
632
|
children,
|
|
615
633
|
/* @__PURE__ */ jsx2(Backdrop, {})
|
|
@@ -1283,7 +1301,7 @@ var DrawerContainer = ({ children, ui, style, props, onClose }) => {
|
|
|
1283
1301
|
const { hide } = useBackdrop();
|
|
1284
1302
|
const handleClose = () => {
|
|
1285
1303
|
if (props === "container") {
|
|
1286
|
-
hide();
|
|
1304
|
+
hide("drawer");
|
|
1287
1305
|
onClose && onClose();
|
|
1288
1306
|
}
|
|
1289
1307
|
return;
|
|
@@ -1320,30 +1338,32 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1320
1338
|
const ref = React8.useRef(null);
|
|
1321
1339
|
const properties = mergeDeep(initialPropsComponent2, propsComponent);
|
|
1322
1340
|
React8.useEffect(() => {
|
|
1323
|
-
if (
|
|
1324
|
-
show();
|
|
1341
|
+
if (open) {
|
|
1342
|
+
show("drawer");
|
|
1325
1343
|
} else {
|
|
1326
|
-
hide();
|
|
1344
|
+
hide("drawer");
|
|
1327
1345
|
}
|
|
1328
1346
|
}, [open]);
|
|
1329
1347
|
useClickAway(ref, () => {
|
|
1330
1348
|
if (!open || properties?.closing === null) return;
|
|
1331
1349
|
if (properties?.closing === "drawer") {
|
|
1332
|
-
hide();
|
|
1350
|
+
hide("drawer");
|
|
1333
1351
|
onClose();
|
|
1334
1352
|
}
|
|
1335
1353
|
;
|
|
1336
1354
|
});
|
|
1337
1355
|
React8.useEffect(() => {
|
|
1338
1356
|
if (properties?.onClose) {
|
|
1339
|
-
hide();
|
|
1357
|
+
hide("drawer");
|
|
1340
1358
|
onClose();
|
|
1341
1359
|
}
|
|
1342
1360
|
}, [properties?.onClose]);
|
|
1361
|
+
const classesBem = bem("yr3Drawer");
|
|
1362
|
+
const drawerClasses = classesBem(void 0, { [anchor]: anchor, open });
|
|
1343
1363
|
return /* @__PURE__ */ jsx16(
|
|
1344
1364
|
"div",
|
|
1345
1365
|
{
|
|
1346
|
-
className:
|
|
1366
|
+
className: drawerClasses,
|
|
1347
1367
|
style: properties?.drawer,
|
|
1348
1368
|
onClick: (e) => e.stopPropagation(),
|
|
1349
1369
|
ref,
|
|
@@ -1531,7 +1551,14 @@ var initialComponents = {
|
|
|
1531
1551
|
},
|
|
1532
1552
|
item: {
|
|
1533
1553
|
ui: {},
|
|
1534
|
-
style: {}
|
|
1554
|
+
style: {},
|
|
1555
|
+
text: {
|
|
1556
|
+
variant: "caption",
|
|
1557
|
+
color: "primary",
|
|
1558
|
+
as: "span",
|
|
1559
|
+
ui: {},
|
|
1560
|
+
style: {}
|
|
1561
|
+
}
|
|
1535
1562
|
}
|
|
1536
1563
|
};
|
|
1537
1564
|
var Group = ({
|
|
@@ -1541,8 +1568,10 @@ var Group = ({
|
|
|
1541
1568
|
variant,
|
|
1542
1569
|
type = "rounded",
|
|
1543
1570
|
color = "primary",
|
|
1544
|
-
|
|
1571
|
+
exclude = false,
|
|
1572
|
+
propsComponent
|
|
1545
1573
|
}) => {
|
|
1574
|
+
const properties = mergeDeep(initialComponents, propsComponent || {});
|
|
1546
1575
|
const [internalValue, setInternalValue] = React10.useState(null);
|
|
1547
1576
|
const isControlled = value !== void 0;
|
|
1548
1577
|
React10.useEffect(() => {
|
|
@@ -1551,20 +1580,51 @@ var Group = ({
|
|
|
1551
1580
|
}
|
|
1552
1581
|
}, [value, isControlled]);
|
|
1553
1582
|
const classItems = bem("yr3Group--item");
|
|
1583
|
+
const clasess = (item) => classItems(void 0, {
|
|
1584
|
+
item: !!item,
|
|
1585
|
+
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
1586
|
+
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
1587
|
+
});
|
|
1588
|
+
const mappingStyle = React10.useMemo(() => {
|
|
1589
|
+
if (!exclude) {
|
|
1590
|
+
const checked = options.filter((opt) => Array.isArray(value) ? value.includes(opt.value) : internalValue === opt.value);
|
|
1591
|
+
return checked.map((opt, index) => ({
|
|
1592
|
+
...opt,
|
|
1593
|
+
index,
|
|
1594
|
+
style: {
|
|
1595
|
+
borderTopLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1596
|
+
borderBottomLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1597
|
+
borderTopRightRadius: index === checked.length - 1 ? "var(--group-border-radius, 0px)" : 0,
|
|
1598
|
+
borderBottomRightRadius: index === checked.length - 1 ? "var(--group-border-radius, 0px)" : 0
|
|
1599
|
+
}
|
|
1600
|
+
}));
|
|
1601
|
+
}
|
|
1602
|
+
const diference = options.filter((opt) => Array.isArray(value) ? !value.includes(opt.value) : internalValue !== opt.value);
|
|
1603
|
+
return diference.map((opt, index) => ({
|
|
1604
|
+
...opt,
|
|
1605
|
+
index,
|
|
1606
|
+
style: {
|
|
1607
|
+
borderTopLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1608
|
+
borderBottomLeftRadius: index === 0 ? "var(--group-border-radius, 0px)" : 0,
|
|
1609
|
+
borderTopRightRadius: index === diference.length - 1 ? "var(--group-border-radius, 0px)" : 0,
|
|
1610
|
+
borderBottomRightRadius: index === diference.length - 1 ? "var(--group-border-radius, 0px)" : 0
|
|
1611
|
+
}
|
|
1612
|
+
}));
|
|
1613
|
+
}, [exclude, value, options]);
|
|
1554
1614
|
return /* @__PURE__ */ jsx20(
|
|
1555
1615
|
"div",
|
|
1556
1616
|
{
|
|
1557
1617
|
className: groupVariants({ variant, color, type }),
|
|
1558
1618
|
"data-testid": "yr3Group",
|
|
1559
|
-
style: composeStyles(
|
|
1560
|
-
children: options.map((opt) => /* @__PURE__ */ jsx20(
|
|
1619
|
+
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
1620
|
+
children: options.map((opt, index) => /* @__PURE__ */ jsx20(
|
|
1561
1621
|
"div",
|
|
1562
1622
|
{
|
|
1563
1623
|
"data-testid": "yr3Group-item",
|
|
1564
|
-
className:
|
|
1565
|
-
onClick: () => onChange?.(opt.value),
|
|
1566
|
-
style: composeStyles(
|
|
1567
|
-
children: opt.label
|
|
1624
|
+
className: clasess(opt),
|
|
1625
|
+
onClick: () => (!opt.disabled && !exclude || exclude && mappingStyle?.find((e) => e.value === opt.value)?.index === 0) && onChange?.(opt.value),
|
|
1626
|
+
style: composeStyles(properties.item?.ui, { ...properties.item?.style, ...mappingStyle?.find((o) => o.value === opt.value)?.style }),
|
|
1627
|
+
children: /* @__PURE__ */ jsx20(Text, { ...properties.item?.text, children: opt.label })
|
|
1568
1628
|
},
|
|
1569
1629
|
opt.value
|
|
1570
1630
|
))
|
|
@@ -1734,11 +1794,12 @@ var Input = React12.forwardRef(
|
|
|
1734
1794
|
defaultValue,
|
|
1735
1795
|
onChange,
|
|
1736
1796
|
variant = "outlined",
|
|
1737
|
-
error =
|
|
1797
|
+
error = "ce un errore",
|
|
1798
|
+
separatorCurrency = ",",
|
|
1738
1799
|
ui,
|
|
1739
1800
|
style,
|
|
1740
1801
|
propsComponent = initiaPropsComponent,
|
|
1741
|
-
|
|
1802
|
+
pattern = "text",
|
|
1742
1803
|
color = "primary",
|
|
1743
1804
|
size = "auto",
|
|
1744
1805
|
...props
|
|
@@ -1748,20 +1809,24 @@ var Input = React12.forwardRef(
|
|
|
1748
1809
|
const isControlled = value !== void 0;
|
|
1749
1810
|
const currentValue = isControlled ? value : internalValue;
|
|
1750
1811
|
const isActive = focused || !!currentValue;
|
|
1751
|
-
const checkPattern = (
|
|
1752
|
-
switch (
|
|
1812
|
+
const checkPattern = (type, value2) => {
|
|
1813
|
+
switch (type) {
|
|
1753
1814
|
case "email":
|
|
1754
1815
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
1755
1816
|
case "phone":
|
|
1756
1817
|
return /^\d{10}$/.test(value2);
|
|
1757
1818
|
case "number":
|
|
1758
1819
|
return /^\d+$/.test(value2);
|
|
1820
|
+
case "currency":
|
|
1821
|
+
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1822
|
+
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
1759
1823
|
default:
|
|
1760
1824
|
return true;
|
|
1761
1825
|
}
|
|
1762
1826
|
};
|
|
1763
1827
|
const handleChange = (e) => {
|
|
1764
1828
|
const newValue = e.target.value;
|
|
1829
|
+
if (newValue && !checkPattern(pattern, newValue)) return;
|
|
1765
1830
|
if (!isControlled) {
|
|
1766
1831
|
setInternalValue(newValue);
|
|
1767
1832
|
}
|
|
@@ -1783,10 +1848,10 @@ var Input = React12.forwardRef(
|
|
|
1783
1848
|
{
|
|
1784
1849
|
ref,
|
|
1785
1850
|
value: currentValue,
|
|
1786
|
-
|
|
1851
|
+
inputMode: pattern === "currency" ? "numeric" : pattern === "phone" ? "tel" : void 0,
|
|
1787
1852
|
autoComplete: "off",
|
|
1853
|
+
type: "text",
|
|
1788
1854
|
onChange: handleChange,
|
|
1789
|
-
onKeyDown: (e) => checkPattern(type, e.key),
|
|
1790
1855
|
onFocus: () => setFocused(true),
|
|
1791
1856
|
onBlur: () => setFocused(false),
|
|
1792
1857
|
className: classes,
|
|
@@ -1992,11 +2057,11 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
1992
2057
|
const { show, hide } = useBackdrop();
|
|
1993
2058
|
React15.useEffect(() => {
|
|
1994
2059
|
if (open) {
|
|
1995
|
-
show();
|
|
2060
|
+
show("modal");
|
|
1996
2061
|
} else {
|
|
1997
|
-
hide();
|
|
2062
|
+
hide("modal");
|
|
1998
2063
|
}
|
|
1999
|
-
}, [open
|
|
2064
|
+
}, [open]);
|
|
2000
2065
|
const classes = bem("yr3Modal");
|
|
2001
2066
|
const classComponent = classes(void 0, { "open": !!open });
|
|
2002
2067
|
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: [
|
|
@@ -2419,104 +2484,7 @@ var Radio = ({
|
|
|
2419
2484
|
};
|
|
2420
2485
|
|
|
2421
2486
|
// src/components/Select/Select.tsx
|
|
2422
|
-
import * as React22 from "react";
|
|
2423
|
-
|
|
2424
|
-
// src/theme/ThemeProvider.tsx
|
|
2425
|
-
import * as React20 from "react";
|
|
2426
|
-
|
|
2427
|
-
// src/theme/notistackContext.tsx
|
|
2428
2487
|
import * as React19 from "react";
|
|
2429
|
-
import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2430
|
-
var NotistackContext = React19.createContext(null);
|
|
2431
|
-
var NotistackProvider = ({ children }) => {
|
|
2432
|
-
const [snacks, setSnacks] = React19.useState([]);
|
|
2433
|
-
const notistack = (snack) => {
|
|
2434
|
-
const id = Date.now();
|
|
2435
|
-
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2436
|
-
const duration = snack.duration || 3e3;
|
|
2437
|
-
const exitDuration = 300;
|
|
2438
|
-
setTimeout(() => {
|
|
2439
|
-
setSnacks(
|
|
2440
|
-
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2441
|
-
);
|
|
2442
|
-
}, duration);
|
|
2443
|
-
setTimeout(() => {
|
|
2444
|
-
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2445
|
-
}, duration + exitDuration);
|
|
2446
|
-
};
|
|
2447
|
-
return /* @__PURE__ */ jsxs15(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2448
|
-
children,
|
|
2449
|
-
/* @__PURE__ */ jsx36("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx36(Notistack, { ...snack }, snack.id)) })
|
|
2450
|
-
] });
|
|
2451
|
-
};
|
|
2452
|
-
var useNotistack = () => {
|
|
2453
|
-
const ctx = React19.useContext(NotistackContext);
|
|
2454
|
-
if (!ctx) {
|
|
2455
|
-
throw new Error("NotistackProvider missing");
|
|
2456
|
-
}
|
|
2457
|
-
return ctx;
|
|
2458
|
-
};
|
|
2459
|
-
|
|
2460
|
-
// src/theme/ThemeProvider.tsx
|
|
2461
|
-
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2462
|
-
var ThemeContext = React20.createContext(null);
|
|
2463
|
-
var ThemeProvider = ({ theme, children }) => {
|
|
2464
|
-
React20.useEffect(() => {
|
|
2465
|
-
applyTheme(theme);
|
|
2466
|
-
}, [theme]);
|
|
2467
|
-
return /* @__PURE__ */ jsx37(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx37(BackdropProvider, { children: /* @__PURE__ */ jsx37(NotistackProvider, { children }) }) });
|
|
2468
|
-
};
|
|
2469
|
-
var useTheme = () => React20.useContext(ThemeContext);
|
|
2470
|
-
|
|
2471
|
-
// src/theme/tokens.ts
|
|
2472
|
-
var baseTokens = {
|
|
2473
|
-
colors: {
|
|
2474
|
-
primary: "#6C5CE7",
|
|
2475
|
-
secondary: "#00CEC9",
|
|
2476
|
-
background: "#0f0f1a",
|
|
2477
|
-
surface: "#1a1a2e",
|
|
2478
|
-
textPrimary: "#ffffff",
|
|
2479
|
-
textSecondary: "#b2bec3"
|
|
2480
|
-
},
|
|
2481
|
-
spacing: (factor) => `${factor * 8}px`,
|
|
2482
|
-
radius: {
|
|
2483
|
-
sm: "6px",
|
|
2484
|
-
md: "12px",
|
|
2485
|
-
lg: "20px"
|
|
2486
|
-
}
|
|
2487
|
-
};
|
|
2488
|
-
|
|
2489
|
-
// src/theme/useMediaQuery.tsx
|
|
2490
|
-
import * as React21 from "react";
|
|
2491
|
-
function useMediaQuery(query) {
|
|
2492
|
-
const theme = useTheme();
|
|
2493
|
-
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2494
|
-
const [matches, setMatches] = React21.useState(() => {
|
|
2495
|
-
if (typeof window === "undefined") return false;
|
|
2496
|
-
return window.matchMedia(computedQuery).matches;
|
|
2497
|
-
});
|
|
2498
|
-
React21.useEffect(() => {
|
|
2499
|
-
if (typeof window === "undefined") return;
|
|
2500
|
-
const media = window.matchMedia(computedQuery);
|
|
2501
|
-
const listener = () => setMatches(media.matches);
|
|
2502
|
-
media.addEventListener("change", listener);
|
|
2503
|
-
return () => media.removeEventListener("change", listener);
|
|
2504
|
-
}, [computedQuery]);
|
|
2505
|
-
return matches;
|
|
2506
|
-
}
|
|
2507
|
-
function useBreakpointValue(values) {
|
|
2508
|
-
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
2509
|
-
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
2510
|
-
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
2511
|
-
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
2512
|
-
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
2513
|
-
if (xl && values.xl !== void 0) return values.xl;
|
|
2514
|
-
if (lg && values.lg !== void 0) return values.lg;
|
|
2515
|
-
if (md && values.md !== void 0) return values.md;
|
|
2516
|
-
if (sm && values.sm !== void 0) return values.sm;
|
|
2517
|
-
if (xs && values.xs !== void 0) return values.xs;
|
|
2518
|
-
return void 0;
|
|
2519
|
-
}
|
|
2520
2488
|
|
|
2521
2489
|
// src/components/Select/select.variants.ts
|
|
2522
2490
|
var selectVariants = createVariants({
|
|
@@ -2576,7 +2544,7 @@ var selectIconVariants = createVariants({
|
|
|
2576
2544
|
});
|
|
2577
2545
|
|
|
2578
2546
|
// src/components/Select/Select.tsx
|
|
2579
|
-
import { jsx as
|
|
2547
|
+
import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2580
2548
|
var initiaPropsComponent3 = {
|
|
2581
2549
|
control: {
|
|
2582
2550
|
variant: "outlined",
|
|
@@ -2616,36 +2584,35 @@ var initiaPropsComponent3 = {
|
|
|
2616
2584
|
}
|
|
2617
2585
|
};
|
|
2618
2586
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2619
|
-
const [open, setOpen] =
|
|
2620
|
-
const [valueState, setValueState] =
|
|
2621
|
-
const ref =
|
|
2587
|
+
const [open, setOpen] = React19.useState(false);
|
|
2588
|
+
const [valueState, setValueState] = React19.useState(value || defaultValue || null);
|
|
2589
|
+
const ref = React19.useRef(null);
|
|
2622
2590
|
useClickAway(ref, () => setOpen(false));
|
|
2623
|
-
const theme = useTheme();
|
|
2624
2591
|
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2625
2592
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2626
2593
|
const classes = selectVariants({ wrapper: true });
|
|
2627
|
-
return /* @__PURE__ */
|
|
2628
|
-
/* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ jsxs15("div", { className: classes, ref, children: [
|
|
2595
|
+
/* @__PURE__ */ jsx36(
|
|
2629
2596
|
Input,
|
|
2630
2597
|
{
|
|
2631
2598
|
label,
|
|
2632
2599
|
variant: "base",
|
|
2633
2600
|
disabled: true,
|
|
2634
|
-
value: valueState,
|
|
2601
|
+
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
2635
2602
|
propsComponent: {
|
|
2636
2603
|
control: properties?.control,
|
|
2637
2604
|
label: properties?.label
|
|
2638
2605
|
}
|
|
2639
2606
|
}
|
|
2640
2607
|
),
|
|
2641
|
-
/* @__PURE__ */
|
|
2608
|
+
/* @__PURE__ */ jsx36(
|
|
2642
2609
|
"div",
|
|
2643
2610
|
{
|
|
2644
2611
|
className: classesIcon,
|
|
2645
2612
|
style: properties?.icon?.style,
|
|
2646
2613
|
onClick: () => setOpen((prev) => !prev),
|
|
2647
2614
|
"data-testid": "yr3Select-icon",
|
|
2648
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */
|
|
2615
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ jsx36(
|
|
2649
2616
|
IconDown,
|
|
2650
2617
|
{
|
|
2651
2618
|
width: properties?.icon?.style?.width,
|
|
@@ -2656,13 +2623,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2656
2623
|
)
|
|
2657
2624
|
}
|
|
2658
2625
|
),
|
|
2659
|
-
open && /* @__PURE__ */
|
|
2626
|
+
open && /* @__PURE__ */ jsx36(
|
|
2660
2627
|
"div",
|
|
2661
2628
|
{
|
|
2662
2629
|
className: "yr3Select--menu",
|
|
2663
2630
|
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2664
2631
|
"data-testid": "yr3Select-menu",
|
|
2665
|
-
children: options.map((opt) => /* @__PURE__ */
|
|
2632
|
+
children: options.map((opt) => /* @__PURE__ */ jsx36(
|
|
2666
2633
|
"div",
|
|
2667
2634
|
{
|
|
2668
2635
|
className: "yr3Select--option",
|
|
@@ -2684,7 +2651,7 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2684
2651
|
onChange?.(event, opt.value);
|
|
2685
2652
|
},
|
|
2686
2653
|
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2687
|
-
children: /* @__PURE__ */
|
|
2654
|
+
children: /* @__PURE__ */ jsx36(Text, { as: "span", variant: "caption", color: properties?.menu?.options?.text?.color || "primary", ...properties?.menu?.options?.text, children: opt.label })
|
|
2688
2655
|
},
|
|
2689
2656
|
opt.value
|
|
2690
2657
|
))
|
|
@@ -2694,8 +2661,15 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2694
2661
|
};
|
|
2695
2662
|
|
|
2696
2663
|
// src/components/Slide/Slide.tsx
|
|
2697
|
-
import * as
|
|
2698
|
-
import { jsx as
|
|
2664
|
+
import * as React20 from "react";
|
|
2665
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
2666
|
+
var initialPropsComponent4 = {
|
|
2667
|
+
slide: {
|
|
2668
|
+
ui: {},
|
|
2669
|
+
style: {}
|
|
2670
|
+
},
|
|
2671
|
+
box: {}
|
|
2672
|
+
};
|
|
2699
2673
|
var Slide = ({
|
|
2700
2674
|
in: inProp,
|
|
2701
2675
|
children,
|
|
@@ -2704,12 +2678,14 @@ var Slide = ({
|
|
|
2704
2678
|
onTransitionEnd,
|
|
2705
2679
|
propsComponent
|
|
2706
2680
|
}) => {
|
|
2681
|
+
const properties = mergeDeep(initialPropsComponent4, propsComponent || {});
|
|
2707
2682
|
const bemContent = bem("yr3Slide--content");
|
|
2708
2683
|
const classNameContent = bemContent(void 0, {
|
|
2709
2684
|
[direction]: true,
|
|
2710
|
-
"in": !!inProp
|
|
2685
|
+
"in": !!inProp,
|
|
2686
|
+
"out": !inProp
|
|
2711
2687
|
});
|
|
2712
|
-
|
|
2688
|
+
React20.useEffect(() => {
|
|
2713
2689
|
let timeoutId;
|
|
2714
2690
|
if (inProp) {
|
|
2715
2691
|
timeoutId = setTimeout(() => {
|
|
@@ -2718,20 +2694,20 @@ var Slide = ({
|
|
|
2718
2694
|
}
|
|
2719
2695
|
return () => clearTimeout(timeoutId);
|
|
2720
2696
|
}, [inProp, duration, onTransitionEnd]);
|
|
2721
|
-
const uiStyleContent = uiStyle({ ...
|
|
2722
|
-
return /* @__PURE__ */
|
|
2697
|
+
const uiStyleContent = uiStyle({ ...properties?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2698
|
+
return /* @__PURE__ */ jsx37(
|
|
2723
2699
|
"div",
|
|
2724
2700
|
{
|
|
2725
2701
|
className: "yr3Slide",
|
|
2726
|
-
style:
|
|
2702
|
+
style: composeStyles(),
|
|
2727
2703
|
"data-testid": "yr3Slide",
|
|
2728
|
-
children: /* @__PURE__ */
|
|
2704
|
+
children: /* @__PURE__ */ jsx37(
|
|
2729
2705
|
"div",
|
|
2730
2706
|
{
|
|
2731
2707
|
className: classNameContent,
|
|
2732
|
-
style: composeStyles(uiStyleContent,
|
|
2708
|
+
style: composeStyles(uiStyleContent, properties?.slide?.style || {}),
|
|
2733
2709
|
"data-testid": "yr3Slide-content",
|
|
2734
|
-
children: /* @__PURE__ */
|
|
2710
|
+
children: /* @__PURE__ */ jsx37(Box, { ...properties?.box, "data-testid": "yr3Slide-box", children })
|
|
2735
2711
|
}
|
|
2736
2712
|
)
|
|
2737
2713
|
}
|
|
@@ -2739,7 +2715,7 @@ var Slide = ({
|
|
|
2739
2715
|
};
|
|
2740
2716
|
|
|
2741
2717
|
// src/components/Switch/Switch.tsx
|
|
2742
|
-
import * as
|
|
2718
|
+
import * as React21 from "react";
|
|
2743
2719
|
|
|
2744
2720
|
// src/components/Switch/switch.variants.ts
|
|
2745
2721
|
var switchVariants = createVariants({
|
|
@@ -2776,7 +2752,7 @@ var switchVariants = createVariants({
|
|
|
2776
2752
|
});
|
|
2777
2753
|
|
|
2778
2754
|
// src/components/Switch/Switch.tsx
|
|
2779
|
-
import { jsx as
|
|
2755
|
+
import { jsx as jsx38, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2780
2756
|
var Switch = ({
|
|
2781
2757
|
checked,
|
|
2782
2758
|
defaultChecked,
|
|
@@ -2788,7 +2764,7 @@ var Switch = ({
|
|
|
2788
2764
|
placement = "end",
|
|
2789
2765
|
propsComponent
|
|
2790
2766
|
}) => {
|
|
2791
|
-
const [internal, setInternal] =
|
|
2767
|
+
const [internal, setInternal] = React21.useState(defaultChecked || false);
|
|
2792
2768
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2793
2769
|
const isControlled = checked !== void 0;
|
|
2794
2770
|
const value = isControlled ? checked : internal;
|
|
@@ -2796,13 +2772,13 @@ var Switch = ({
|
|
|
2796
2772
|
if (!isControlled) setInternal(e.target.checked);
|
|
2797
2773
|
onChange?.(e, e.target.checked);
|
|
2798
2774
|
};
|
|
2799
|
-
return /* @__PURE__ */
|
|
2775
|
+
return /* @__PURE__ */ jsxs16(
|
|
2800
2776
|
"label",
|
|
2801
2777
|
{
|
|
2802
2778
|
className: classname,
|
|
2803
2779
|
"data-testid": "yr3Switch",
|
|
2804
2780
|
children: [
|
|
2805
|
-
/* @__PURE__ */
|
|
2781
|
+
/* @__PURE__ */ jsx38(
|
|
2806
2782
|
"input",
|
|
2807
2783
|
{
|
|
2808
2784
|
type: "checkbox",
|
|
@@ -2811,8 +2787,8 @@ var Switch = ({
|
|
|
2811
2787
|
disabled
|
|
2812
2788
|
}
|
|
2813
2789
|
),
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
/* @__PURE__ */
|
|
2790
|
+
/* @__PURE__ */ jsx38("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx38("span", { className: "yr3Switch--thumb" }) }),
|
|
2791
|
+
/* @__PURE__ */ jsx38(
|
|
2816
2792
|
"span",
|
|
2817
2793
|
{
|
|
2818
2794
|
className: "yr3Switch--label",
|
|
@@ -2827,9 +2803,9 @@ var Switch = ({
|
|
|
2827
2803
|
};
|
|
2828
2804
|
|
|
2829
2805
|
// src/Icons/IconSearch.tsx
|
|
2830
|
-
import { jsx as
|
|
2806
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2831
2807
|
var IconSearch = (props) => {
|
|
2832
|
-
return /* @__PURE__ */
|
|
2808
|
+
return /* @__PURE__ */ jsx39("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__ */ jsx39(
|
|
2833
2809
|
"path",
|
|
2834
2810
|
{
|
|
2835
2811
|
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",
|
|
@@ -2841,6 +2817,103 @@ var IconSearch = (props) => {
|
|
|
2841
2817
|
) });
|
|
2842
2818
|
};
|
|
2843
2819
|
|
|
2820
|
+
// src/theme/ThemeProvider.tsx
|
|
2821
|
+
import * as React23 from "react";
|
|
2822
|
+
|
|
2823
|
+
// src/theme/notistackContext.tsx
|
|
2824
|
+
import * as React22 from "react";
|
|
2825
|
+
import { jsx as jsx40, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2826
|
+
var NotistackContext = React22.createContext(null);
|
|
2827
|
+
var NotistackProvider = ({ children }) => {
|
|
2828
|
+
const [snacks, setSnacks] = React22.useState([]);
|
|
2829
|
+
const notistack = (snack) => {
|
|
2830
|
+
const id = Date.now();
|
|
2831
|
+
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
2832
|
+
const duration = snack.duration || 3e3;
|
|
2833
|
+
const exitDuration = 300;
|
|
2834
|
+
setTimeout(() => {
|
|
2835
|
+
setSnacks(
|
|
2836
|
+
(prev) => prev.map((s) => s.id === id ? { ...s, exiting: true } : s)
|
|
2837
|
+
);
|
|
2838
|
+
}, duration);
|
|
2839
|
+
setTimeout(() => {
|
|
2840
|
+
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2841
|
+
}, duration + exitDuration);
|
|
2842
|
+
};
|
|
2843
|
+
return /* @__PURE__ */ jsxs17(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2844
|
+
children,
|
|
2845
|
+
/* @__PURE__ */ jsx40("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ jsx40(Notistack, { ...snack }, snack.id)) })
|
|
2846
|
+
] });
|
|
2847
|
+
};
|
|
2848
|
+
var useNotistack = () => {
|
|
2849
|
+
const ctx = React22.useContext(NotistackContext);
|
|
2850
|
+
if (!ctx) {
|
|
2851
|
+
throw new Error("NotistackProvider missing");
|
|
2852
|
+
}
|
|
2853
|
+
return ctx;
|
|
2854
|
+
};
|
|
2855
|
+
|
|
2856
|
+
// src/theme/ThemeProvider.tsx
|
|
2857
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
2858
|
+
var ThemeContext = React23.createContext(null);
|
|
2859
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2860
|
+
React23.useEffect(() => {
|
|
2861
|
+
applyTheme(theme);
|
|
2862
|
+
}, [theme]);
|
|
2863
|
+
return /* @__PURE__ */ jsx41(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx41(BackdropProvider, { children: /* @__PURE__ */ jsx41(NotistackProvider, { children }) }) });
|
|
2864
|
+
};
|
|
2865
|
+
var useTheme = () => React23.useContext(ThemeContext);
|
|
2866
|
+
|
|
2867
|
+
// src/theme/tokens.ts
|
|
2868
|
+
var baseTokens = {
|
|
2869
|
+
colors: {
|
|
2870
|
+
primary: "#6C5CE7",
|
|
2871
|
+
secondary: "#00CEC9",
|
|
2872
|
+
background: "#0f0f1a",
|
|
2873
|
+
surface: "#1a1a2e",
|
|
2874
|
+
textPrimary: "#ffffff",
|
|
2875
|
+
textSecondary: "#b2bec3"
|
|
2876
|
+
},
|
|
2877
|
+
spacing: (factor) => `${factor * 8}px`,
|
|
2878
|
+
radius: {
|
|
2879
|
+
sm: "6px",
|
|
2880
|
+
md: "12px",
|
|
2881
|
+
lg: "20px"
|
|
2882
|
+
}
|
|
2883
|
+
};
|
|
2884
|
+
|
|
2885
|
+
// src/theme/useMediaQuery.tsx
|
|
2886
|
+
import * as React24 from "react";
|
|
2887
|
+
function useMediaQuery(query) {
|
|
2888
|
+
const theme = useTheme();
|
|
2889
|
+
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2890
|
+
const [matches, setMatches] = React24.useState(() => {
|
|
2891
|
+
if (typeof window === "undefined") return false;
|
|
2892
|
+
return window.matchMedia(computedQuery).matches;
|
|
2893
|
+
});
|
|
2894
|
+
React24.useEffect(() => {
|
|
2895
|
+
if (typeof window === "undefined") return;
|
|
2896
|
+
const media = window.matchMedia(computedQuery);
|
|
2897
|
+
const listener = () => setMatches(media.matches);
|
|
2898
|
+
media.addEventListener("change", listener);
|
|
2899
|
+
return () => media.removeEventListener("change", listener);
|
|
2900
|
+
}, [computedQuery]);
|
|
2901
|
+
return matches;
|
|
2902
|
+
}
|
|
2903
|
+
function useBreakpointValue(values) {
|
|
2904
|
+
const xs = useMediaQuery(`(min-width: ${breakpoints.xs}px)`);
|
|
2905
|
+
const sm = useMediaQuery(`(min-width: ${breakpoints.sm}px)`);
|
|
2906
|
+
const md = useMediaQuery(`(min-width: ${breakpoints.md}px)`);
|
|
2907
|
+
const lg = useMediaQuery(`(min-width: ${breakpoints.lg}px)`);
|
|
2908
|
+
const xl = useMediaQuery(`(min-width: ${breakpoints.xl}px)`);
|
|
2909
|
+
if (xl && values.xl !== void 0) return values.xl;
|
|
2910
|
+
if (lg && values.lg !== void 0) return values.lg;
|
|
2911
|
+
if (md && values.md !== void 0) return values.md;
|
|
2912
|
+
if (sm && values.sm !== void 0) return values.sm;
|
|
2913
|
+
if (xs && values.xs !== void 0) return values.xs;
|
|
2914
|
+
return void 0;
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2844
2917
|
// src/hooks/usePlaces.ts
|
|
2845
2918
|
import { useAutocompletePlaces as useAutocompletePlaces2 } from "@yr3/autocomplete-places";
|
|
2846
2919
|
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
@@ -2954,6 +3027,7 @@ export {
|
|
|
2954
3027
|
getNumberPhone,
|
|
2955
3028
|
hexToRgb,
|
|
2956
3029
|
initTheme,
|
|
3030
|
+
inputCurrency,
|
|
2957
3031
|
isEmpty,
|
|
2958
3032
|
lighten,
|
|
2959
3033
|
mergeDeep,
|