@yr3/ui 1.0.15 → 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 +207 -143
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +206 -143
- 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,
|
|
@@ -1542,7 +1551,14 @@ var initialComponents = {
|
|
|
1542
1551
|
},
|
|
1543
1552
|
item: {
|
|
1544
1553
|
ui: {},
|
|
1545
|
-
style: {}
|
|
1554
|
+
style: {},
|
|
1555
|
+
text: {
|
|
1556
|
+
variant: "caption",
|
|
1557
|
+
color: "primary",
|
|
1558
|
+
as: "span",
|
|
1559
|
+
ui: {},
|
|
1560
|
+
style: {}
|
|
1561
|
+
}
|
|
1546
1562
|
}
|
|
1547
1563
|
};
|
|
1548
1564
|
var Group = ({
|
|
@@ -1552,8 +1568,10 @@ var Group = ({
|
|
|
1552
1568
|
variant,
|
|
1553
1569
|
type = "rounded",
|
|
1554
1570
|
color = "primary",
|
|
1555
|
-
|
|
1571
|
+
exclude = false,
|
|
1572
|
+
propsComponent
|
|
1556
1573
|
}) => {
|
|
1574
|
+
const properties = mergeDeep(initialComponents, propsComponent || {});
|
|
1557
1575
|
const [internalValue, setInternalValue] = React10.useState(null);
|
|
1558
1576
|
const isControlled = value !== void 0;
|
|
1559
1577
|
React10.useEffect(() => {
|
|
@@ -1562,20 +1580,51 @@ var Group = ({
|
|
|
1562
1580
|
}
|
|
1563
1581
|
}, [value, isControlled]);
|
|
1564
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]);
|
|
1565
1614
|
return /* @__PURE__ */ jsx20(
|
|
1566
1615
|
"div",
|
|
1567
1616
|
{
|
|
1568
1617
|
className: groupVariants({ variant, color, type }),
|
|
1569
1618
|
"data-testid": "yr3Group",
|
|
1570
|
-
style: composeStyles(
|
|
1571
|
-
children: options.map((opt) => /* @__PURE__ */ jsx20(
|
|
1619
|
+
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
1620
|
+
children: options.map((opt, index) => /* @__PURE__ */ jsx20(
|
|
1572
1621
|
"div",
|
|
1573
1622
|
{
|
|
1574
1623
|
"data-testid": "yr3Group-item",
|
|
1575
|
-
className:
|
|
1576
|
-
onClick: () => onChange?.(opt.value),
|
|
1577
|
-
style: composeStyles(
|
|
1578
|
-
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 })
|
|
1579
1628
|
},
|
|
1580
1629
|
opt.value
|
|
1581
1630
|
))
|
|
@@ -1745,11 +1794,12 @@ var Input = React12.forwardRef(
|
|
|
1745
1794
|
defaultValue,
|
|
1746
1795
|
onChange,
|
|
1747
1796
|
variant = "outlined",
|
|
1748
|
-
error =
|
|
1797
|
+
error = "ce un errore",
|
|
1798
|
+
separatorCurrency = ",",
|
|
1749
1799
|
ui,
|
|
1750
1800
|
style,
|
|
1751
1801
|
propsComponent = initiaPropsComponent,
|
|
1752
|
-
|
|
1802
|
+
pattern = "text",
|
|
1753
1803
|
color = "primary",
|
|
1754
1804
|
size = "auto",
|
|
1755
1805
|
...props
|
|
@@ -1759,20 +1809,24 @@ var Input = React12.forwardRef(
|
|
|
1759
1809
|
const isControlled = value !== void 0;
|
|
1760
1810
|
const currentValue = isControlled ? value : internalValue;
|
|
1761
1811
|
const isActive = focused || !!currentValue;
|
|
1762
|
-
const checkPattern = (
|
|
1763
|
-
switch (
|
|
1812
|
+
const checkPattern = (type, value2) => {
|
|
1813
|
+
switch (type) {
|
|
1764
1814
|
case "email":
|
|
1765
1815
|
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
1766
1816
|
case "phone":
|
|
1767
1817
|
return /^\d{10}$/.test(value2);
|
|
1768
1818
|
case "number":
|
|
1769
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);
|
|
1770
1823
|
default:
|
|
1771
1824
|
return true;
|
|
1772
1825
|
}
|
|
1773
1826
|
};
|
|
1774
1827
|
const handleChange = (e) => {
|
|
1775
1828
|
const newValue = e.target.value;
|
|
1829
|
+
if (newValue && !checkPattern(pattern, newValue)) return;
|
|
1776
1830
|
if (!isControlled) {
|
|
1777
1831
|
setInternalValue(newValue);
|
|
1778
1832
|
}
|
|
@@ -1794,10 +1848,10 @@ var Input = React12.forwardRef(
|
|
|
1794
1848
|
{
|
|
1795
1849
|
ref,
|
|
1796
1850
|
value: currentValue,
|
|
1797
|
-
|
|
1851
|
+
inputMode: pattern === "currency" ? "numeric" : pattern === "phone" ? "tel" : void 0,
|
|
1798
1852
|
autoComplete: "off",
|
|
1853
|
+
type: "text",
|
|
1799
1854
|
onChange: handleChange,
|
|
1800
|
-
onKeyDown: (e) => checkPattern(type, e.key),
|
|
1801
1855
|
onFocus: () => setFocused(true),
|
|
1802
1856
|
onBlur: () => setFocused(false),
|
|
1803
1857
|
className: classes,
|
|
@@ -2430,104 +2484,7 @@ var Radio = ({
|
|
|
2430
2484
|
};
|
|
2431
2485
|
|
|
2432
2486
|
// src/components/Select/Select.tsx
|
|
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
2487
|
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
|
-
}
|
|
2531
2488
|
|
|
2532
2489
|
// src/components/Select/select.variants.ts
|
|
2533
2490
|
var selectVariants = createVariants({
|
|
@@ -2587,7 +2544,7 @@ var selectIconVariants = createVariants({
|
|
|
2587
2544
|
});
|
|
2588
2545
|
|
|
2589
2546
|
// src/components/Select/Select.tsx
|
|
2590
|
-
import { jsx as
|
|
2547
|
+
import { jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2591
2548
|
var initiaPropsComponent3 = {
|
|
2592
2549
|
control: {
|
|
2593
2550
|
variant: "outlined",
|
|
@@ -2627,36 +2584,35 @@ var initiaPropsComponent3 = {
|
|
|
2627
2584
|
}
|
|
2628
2585
|
};
|
|
2629
2586
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2630
|
-
const [open, setOpen] =
|
|
2631
|
-
const [valueState, setValueState] =
|
|
2632
|
-
const ref =
|
|
2587
|
+
const [open, setOpen] = React19.useState(false);
|
|
2588
|
+
const [valueState, setValueState] = React19.useState(value || defaultValue || null);
|
|
2589
|
+
const ref = React19.useRef(null);
|
|
2633
2590
|
useClickAway(ref, () => setOpen(false));
|
|
2634
|
-
const theme = useTheme();
|
|
2635
2591
|
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2636
2592
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2637
2593
|
const classes = selectVariants({ wrapper: true });
|
|
2638
|
-
return /* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2594
|
+
return /* @__PURE__ */ jsxs15("div", { className: classes, ref, children: [
|
|
2595
|
+
/* @__PURE__ */ jsx36(
|
|
2640
2596
|
Input,
|
|
2641
2597
|
{
|
|
2642
2598
|
label,
|
|
2643
2599
|
variant: "base",
|
|
2644
2600
|
disabled: true,
|
|
2645
|
-
value: valueState,
|
|
2601
|
+
value: options.find((opt) => opt.value === valueState)?.label || "",
|
|
2646
2602
|
propsComponent: {
|
|
2647
2603
|
control: properties?.control,
|
|
2648
2604
|
label: properties?.label
|
|
2649
2605
|
}
|
|
2650
2606
|
}
|
|
2651
2607
|
),
|
|
2652
|
-
/* @__PURE__ */
|
|
2608
|
+
/* @__PURE__ */ jsx36(
|
|
2653
2609
|
"div",
|
|
2654
2610
|
{
|
|
2655
2611
|
className: classesIcon,
|
|
2656
2612
|
style: properties?.icon?.style,
|
|
2657
2613
|
onClick: () => setOpen((prev) => !prev),
|
|
2658
2614
|
"data-testid": "yr3Select-icon",
|
|
2659
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */
|
|
2615
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ jsx36(
|
|
2660
2616
|
IconDown,
|
|
2661
2617
|
{
|
|
2662
2618
|
width: properties?.icon?.style?.width,
|
|
@@ -2667,13 +2623,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2667
2623
|
)
|
|
2668
2624
|
}
|
|
2669
2625
|
),
|
|
2670
|
-
open && /* @__PURE__ */
|
|
2626
|
+
open && /* @__PURE__ */ jsx36(
|
|
2671
2627
|
"div",
|
|
2672
2628
|
{
|
|
2673
2629
|
className: "yr3Select--menu",
|
|
2674
2630
|
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2675
2631
|
"data-testid": "yr3Select-menu",
|
|
2676
|
-
children: options.map((opt) => /* @__PURE__ */
|
|
2632
|
+
children: options.map((opt) => /* @__PURE__ */ jsx36(
|
|
2677
2633
|
"div",
|
|
2678
2634
|
{
|
|
2679
2635
|
className: "yr3Select--option",
|
|
@@ -2695,7 +2651,7 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2695
2651
|
onChange?.(event, opt.value);
|
|
2696
2652
|
},
|
|
2697
2653
|
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2698
|
-
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 })
|
|
2699
2655
|
},
|
|
2700
2656
|
opt.value
|
|
2701
2657
|
))
|
|
@@ -2705,8 +2661,15 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2705
2661
|
};
|
|
2706
2662
|
|
|
2707
2663
|
// src/components/Slide/Slide.tsx
|
|
2708
|
-
import * as
|
|
2709
|
-
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
|
+
};
|
|
2710
2673
|
var Slide = ({
|
|
2711
2674
|
in: inProp,
|
|
2712
2675
|
children,
|
|
@@ -2715,12 +2678,14 @@ var Slide = ({
|
|
|
2715
2678
|
onTransitionEnd,
|
|
2716
2679
|
propsComponent
|
|
2717
2680
|
}) => {
|
|
2681
|
+
const properties = mergeDeep(initialPropsComponent4, propsComponent || {});
|
|
2718
2682
|
const bemContent = bem("yr3Slide--content");
|
|
2719
2683
|
const classNameContent = bemContent(void 0, {
|
|
2720
2684
|
[direction]: true,
|
|
2721
|
-
"in": !!inProp
|
|
2685
|
+
"in": !!inProp,
|
|
2686
|
+
"out": !inProp
|
|
2722
2687
|
});
|
|
2723
|
-
|
|
2688
|
+
React20.useEffect(() => {
|
|
2724
2689
|
let timeoutId;
|
|
2725
2690
|
if (inProp) {
|
|
2726
2691
|
timeoutId = setTimeout(() => {
|
|
@@ -2729,20 +2694,20 @@ var Slide = ({
|
|
|
2729
2694
|
}
|
|
2730
2695
|
return () => clearTimeout(timeoutId);
|
|
2731
2696
|
}, [inProp, duration, onTransitionEnd]);
|
|
2732
|
-
const uiStyleContent = uiStyle({ ...
|
|
2733
|
-
return /* @__PURE__ */
|
|
2697
|
+
const uiStyleContent = uiStyle({ ...properties?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2698
|
+
return /* @__PURE__ */ jsx37(
|
|
2734
2699
|
"div",
|
|
2735
2700
|
{
|
|
2736
2701
|
className: "yr3Slide",
|
|
2737
|
-
style:
|
|
2702
|
+
style: composeStyles(),
|
|
2738
2703
|
"data-testid": "yr3Slide",
|
|
2739
|
-
children: /* @__PURE__ */
|
|
2704
|
+
children: /* @__PURE__ */ jsx37(
|
|
2740
2705
|
"div",
|
|
2741
2706
|
{
|
|
2742
2707
|
className: classNameContent,
|
|
2743
|
-
style: composeStyles(uiStyleContent,
|
|
2708
|
+
style: composeStyles(uiStyleContent, properties?.slide?.style || {}),
|
|
2744
2709
|
"data-testid": "yr3Slide-content",
|
|
2745
|
-
children: /* @__PURE__ */
|
|
2710
|
+
children: /* @__PURE__ */ jsx37(Box, { ...properties?.box, "data-testid": "yr3Slide-box", children })
|
|
2746
2711
|
}
|
|
2747
2712
|
)
|
|
2748
2713
|
}
|
|
@@ -2750,7 +2715,7 @@ var Slide = ({
|
|
|
2750
2715
|
};
|
|
2751
2716
|
|
|
2752
2717
|
// src/components/Switch/Switch.tsx
|
|
2753
|
-
import * as
|
|
2718
|
+
import * as React21 from "react";
|
|
2754
2719
|
|
|
2755
2720
|
// src/components/Switch/switch.variants.ts
|
|
2756
2721
|
var switchVariants = createVariants({
|
|
@@ -2787,7 +2752,7 @@ var switchVariants = createVariants({
|
|
|
2787
2752
|
});
|
|
2788
2753
|
|
|
2789
2754
|
// src/components/Switch/Switch.tsx
|
|
2790
|
-
import { jsx as
|
|
2755
|
+
import { jsx as jsx38, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2791
2756
|
var Switch = ({
|
|
2792
2757
|
checked,
|
|
2793
2758
|
defaultChecked,
|
|
@@ -2799,7 +2764,7 @@ var Switch = ({
|
|
|
2799
2764
|
placement = "end",
|
|
2800
2765
|
propsComponent
|
|
2801
2766
|
}) => {
|
|
2802
|
-
const [internal, setInternal] =
|
|
2767
|
+
const [internal, setInternal] = React21.useState(defaultChecked || false);
|
|
2803
2768
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2804
2769
|
const isControlled = checked !== void 0;
|
|
2805
2770
|
const value = isControlled ? checked : internal;
|
|
@@ -2807,13 +2772,13 @@ var Switch = ({
|
|
|
2807
2772
|
if (!isControlled) setInternal(e.target.checked);
|
|
2808
2773
|
onChange?.(e, e.target.checked);
|
|
2809
2774
|
};
|
|
2810
|
-
return /* @__PURE__ */
|
|
2775
|
+
return /* @__PURE__ */ jsxs16(
|
|
2811
2776
|
"label",
|
|
2812
2777
|
{
|
|
2813
2778
|
className: classname,
|
|
2814
2779
|
"data-testid": "yr3Switch",
|
|
2815
2780
|
children: [
|
|
2816
|
-
/* @__PURE__ */
|
|
2781
|
+
/* @__PURE__ */ jsx38(
|
|
2817
2782
|
"input",
|
|
2818
2783
|
{
|
|
2819
2784
|
type: "checkbox",
|
|
@@ -2822,8 +2787,8 @@ var Switch = ({
|
|
|
2822
2787
|
disabled
|
|
2823
2788
|
}
|
|
2824
2789
|
),
|
|
2825
|
-
/* @__PURE__ */
|
|
2826
|
-
/* @__PURE__ */
|
|
2790
|
+
/* @__PURE__ */ jsx38("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx38("span", { className: "yr3Switch--thumb" }) }),
|
|
2791
|
+
/* @__PURE__ */ jsx38(
|
|
2827
2792
|
"span",
|
|
2828
2793
|
{
|
|
2829
2794
|
className: "yr3Switch--label",
|
|
@@ -2838,9 +2803,9 @@ var Switch = ({
|
|
|
2838
2803
|
};
|
|
2839
2804
|
|
|
2840
2805
|
// src/Icons/IconSearch.tsx
|
|
2841
|
-
import { jsx as
|
|
2806
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2842
2807
|
var IconSearch = (props) => {
|
|
2843
|
-
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(
|
|
2844
2809
|
"path",
|
|
2845
2810
|
{
|
|
2846
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",
|
|
@@ -2852,6 +2817,103 @@ var IconSearch = (props) => {
|
|
|
2852
2817
|
) });
|
|
2853
2818
|
};
|
|
2854
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
|
+
|
|
2855
2917
|
// src/hooks/usePlaces.ts
|
|
2856
2918
|
import { useAutocompletePlaces as useAutocompletePlaces2 } from "@yr3/autocomplete-places";
|
|
2857
2919
|
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
@@ -2965,6 +3027,7 @@ export {
|
|
|
2965
3027
|
getNumberPhone,
|
|
2966
3028
|
hexToRgb,
|
|
2967
3029
|
initTheme,
|
|
3030
|
+
inputCurrency,
|
|
2968
3031
|
isEmpty,
|
|
2969
3032
|
lighten,
|
|
2970
3033
|
mergeDeep,
|
package/dist/styles/index.css
CHANGED
|
@@ -1351,21 +1351,22 @@ input[type=date]::-webkit-calendar-picker-indicator {
|
|
|
1351
1351
|
border-color: var(--group-border-color, var(--color-primary));
|
|
1352
1352
|
background: var(--bg-group, var(--color-primary));
|
|
1353
1353
|
--group-bg-item: var(--color-surface, #fff);
|
|
1354
|
-
|
|
1355
|
-
}
|
|
1356
|
-
.yr3Group--filled .yr3Group--item {
|
|
1357
|
-
color: var(--color-surface, var(--color-surface));
|
|
1358
|
-
border-radius: var(--group-border-radius, 40px);
|
|
1354
|
+
transition: all 0.2s;
|
|
1359
1355
|
}
|
|
1360
1356
|
.yr3Group--filled .yr3Group--item--active {
|
|
1361
1357
|
background: var(--color-surface);
|
|
1362
1358
|
color: var(--group-color-text);
|
|
1359
|
+
border-radius: var(--group-border-radius, 0px);
|
|
1360
|
+
}
|
|
1361
|
+
.yr3Group--filled .yr3Group--item--exclude {
|
|
1362
|
+
background: var(--color-surface);
|
|
1363
|
+
color: var(--group-color-text);
|
|
1363
1364
|
}
|
|
1364
1365
|
|
|
1365
1366
|
.yr3Group--outlined {
|
|
1366
1367
|
border: 1px solid;
|
|
1367
1368
|
border-color: var(--group-border-color, var(--color-primary));
|
|
1368
|
-
|
|
1369
|
+
transition: all 0.2s;
|
|
1369
1370
|
}
|
|
1370
1371
|
.yr3Group--outlined .yr3Group--item {
|
|
1371
1372
|
background: var(--group-bg-item, transparent);
|
|
@@ -1374,6 +1375,11 @@ input[type=date]::-webkit-calendar-picker-indicator {
|
|
|
1374
1375
|
.yr3Group--outlined .yr3Group--item--active {
|
|
1375
1376
|
background: var(--group-active, var(--color-surface));
|
|
1376
1377
|
color: var(--color-surface);
|
|
1378
|
+
border-radius: var(--group-border-radius, 0px);
|
|
1379
|
+
}
|
|
1380
|
+
.yr3Group--outlined .yr3Group--item--exclude {
|
|
1381
|
+
background: var(--color-surface);
|
|
1382
|
+
color: var(--group-color-text);
|
|
1377
1383
|
}
|
|
1378
1384
|
|
|
1379
1385
|
.yr3Group--text {
|
|
@@ -2569,6 +2575,10 @@ input::placeholder {
|
|
|
2569
2575
|
transform: translate(0, 0);
|
|
2570
2576
|
}
|
|
2571
2577
|
|
|
2578
|
+
.yr3Slide--content--out {
|
|
2579
|
+
transition: all 0.3s ease;
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2572
2582
|
.yr3Switch {
|
|
2573
2583
|
display: inline-flex;
|
|
2574
2584
|
align-items: center;
|