@yr3/ui 1.0.17 → 1.0.18
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/Date/month.css +117 -0
- package/dist/components/Date/month.css.map +1 -0
- package/dist/index.cjs +503 -313
- package/dist/index.d.cts +97 -49
- package/dist/index.d.ts +97 -49
- package/dist/index.js +498 -313
- package/dist/styles/index.css +116 -0
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -49,8 +49,10 @@ __export(index_exports, {
|
|
|
49
49
|
Flex: () => Flex,
|
|
50
50
|
Grid: () => Grid,
|
|
51
51
|
Group: () => Group,
|
|
52
|
+
IconCalendar: () => IconCalendar,
|
|
52
53
|
IconClose: () => IconClose,
|
|
53
54
|
IconDown: () => IconDown,
|
|
55
|
+
IconLeft: () => IconLeft,
|
|
54
56
|
IconSearch: () => IconSearch,
|
|
55
57
|
Image: () => Image,
|
|
56
58
|
ImageDropzone: () => ImageDropzone,
|
|
@@ -60,6 +62,7 @@ __export(index_exports, {
|
|
|
60
62
|
Loader: () => Loader,
|
|
61
63
|
Modal: () => Modal,
|
|
62
64
|
ModalContainer: () => ModalContainer,
|
|
65
|
+
MonthSelector: () => MonthSelector,
|
|
63
66
|
Notistack: () => Notistack,
|
|
64
67
|
NotistackContext: () => NotistackContext,
|
|
65
68
|
NotistackProvider: () => NotistackProvider,
|
|
@@ -68,6 +71,7 @@ __export(index_exports, {
|
|
|
68
71
|
PlacesAutocomplete: () => PlacesAutocomplete,
|
|
69
72
|
Radio: () => Radio,
|
|
70
73
|
Select: () => Select,
|
|
74
|
+
Selector: () => Selector,
|
|
71
75
|
Slide: () => Slide,
|
|
72
76
|
Switch: () => Switch,
|
|
73
77
|
Text: () => Text,
|
|
@@ -92,6 +96,7 @@ __export(index_exports, {
|
|
|
92
96
|
getCountryCodePhone: () => getCountryCodePhone,
|
|
93
97
|
getDialPhone: () => getDialPhone,
|
|
94
98
|
getMonthCalendar: () => getMonthCalendar,
|
|
99
|
+
getMonthCalendarProps: () => getMonthCalendarProps,
|
|
95
100
|
getNumberPhone: () => getNumberPhone,
|
|
96
101
|
hexToRgb: () => hexToRgb,
|
|
97
102
|
initTheme: () => initTheme,
|
|
@@ -220,6 +225,20 @@ function getMonthCalendar(year, month, startIndex, selected, props) {
|
|
|
220
225
|
currentDay: dayCurrent
|
|
221
226
|
};
|
|
222
227
|
}
|
|
228
|
+
function getMonthCalendarProps({ year, years, month, formatMonth, monthsDisabled }) {
|
|
229
|
+
const startIndex = (0, import_dayjs.default)().year(year).month().valueOf();
|
|
230
|
+
return {
|
|
231
|
+
month: (0, import_dayjs.default)().set("m", month).format(formatMonth || "MMM"),
|
|
232
|
+
year,
|
|
233
|
+
startIndex,
|
|
234
|
+
years,
|
|
235
|
+
months: Array.from({ length: 12 }, (_, i) => ({
|
|
236
|
+
label: (0, import_dayjs.default)().month(i).format(formatMonth || "MMM"),
|
|
237
|
+
value: (0, import_dayjs.default)().month(i).format("MM"),
|
|
238
|
+
disabled: (0, import_dayjs.default)().year(year).month(i).isAfter((0, import_dayjs.default)(), "month") || monthsDisabled && monthsDisabled.includes(i)
|
|
239
|
+
}))
|
|
240
|
+
};
|
|
241
|
+
}
|
|
223
242
|
|
|
224
243
|
// src/utils/color.ts
|
|
225
244
|
var rgbToHex = (r, g, b) => {
|
|
@@ -1500,9 +1519,347 @@ var Drawer = ({ open, anchor = null, onClose, children, propsComponent }) => {
|
|
|
1500
1519
|
);
|
|
1501
1520
|
};
|
|
1502
1521
|
|
|
1503
|
-
// src/components/
|
|
1522
|
+
// src/components/Input/Input.tsx
|
|
1504
1523
|
var React9 = __toESM(require("react"), 1);
|
|
1524
|
+
|
|
1525
|
+
// src/components/Label/Label.tsx
|
|
1505
1526
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1527
|
+
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1528
|
+
const classes = bem("yr3Label");
|
|
1529
|
+
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1530
|
+
const classnames = bemMerge(classComponent, className);
|
|
1531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1532
|
+
"span",
|
|
1533
|
+
{
|
|
1534
|
+
className: classnames,
|
|
1535
|
+
"data-testid": "yr3Label",
|
|
1536
|
+
style: composeStyles(ui, style),
|
|
1537
|
+
children: text2 ? text2 : children
|
|
1538
|
+
}
|
|
1539
|
+
);
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
// src/components/Input/input.variants.ts
|
|
1543
|
+
var inputVariants = createVariants({
|
|
1544
|
+
base: "yr3Input",
|
|
1545
|
+
variants: {
|
|
1546
|
+
variant: {
|
|
1547
|
+
filled: "yr3Input--filled",
|
|
1548
|
+
outlined: "yr3Input--outlined",
|
|
1549
|
+
base: "yr3Input--base",
|
|
1550
|
+
lined: "yr3Input--lined"
|
|
1551
|
+
},
|
|
1552
|
+
color: {
|
|
1553
|
+
primary: "yr3Input--color-primary",
|
|
1554
|
+
secondary: "yr3Input--color-secondary",
|
|
1555
|
+
success: "yr3Input--color-success",
|
|
1556
|
+
text: "yr3Input--color-text",
|
|
1557
|
+
disabled: "yr3Input--color-disabled",
|
|
1558
|
+
background: "yr3Input--color-background",
|
|
1559
|
+
error: "yr3Input--color-error",
|
|
1560
|
+
warning: "yr3Input--color-warning",
|
|
1561
|
+
info: "yr3Input--color-info",
|
|
1562
|
+
common: "yr3Input--color-common"
|
|
1563
|
+
},
|
|
1564
|
+
size: {
|
|
1565
|
+
auto: "yr3Input--size-auto",
|
|
1566
|
+
full: "yr3Input--size-full"
|
|
1567
|
+
},
|
|
1568
|
+
rounded: {
|
|
1569
|
+
true: "yr3Input--rounded"
|
|
1570
|
+
},
|
|
1571
|
+
disabled: {
|
|
1572
|
+
true: "yr3Input--disabled"
|
|
1573
|
+
},
|
|
1574
|
+
animated: {
|
|
1575
|
+
true: "yr3Input--animated"
|
|
1576
|
+
},
|
|
1577
|
+
label: {
|
|
1578
|
+
true: "yr3Input--label"
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
|
|
1583
|
+
// src/components/Input/Input.tsx
|
|
1584
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1585
|
+
var initiaPropsComponent = {
|
|
1586
|
+
label: {
|
|
1587
|
+
display: true,
|
|
1588
|
+
ui: {},
|
|
1589
|
+
style: {}
|
|
1590
|
+
},
|
|
1591
|
+
control: {}
|
|
1592
|
+
};
|
|
1593
|
+
var Input = React9.forwardRef(
|
|
1594
|
+
({
|
|
1595
|
+
label,
|
|
1596
|
+
value,
|
|
1597
|
+
defaultValue,
|
|
1598
|
+
onChange,
|
|
1599
|
+
variant = "outlined",
|
|
1600
|
+
error = "ce un errore",
|
|
1601
|
+
separatorCurrency = ",",
|
|
1602
|
+
ui,
|
|
1603
|
+
style,
|
|
1604
|
+
propsComponent = initiaPropsComponent,
|
|
1605
|
+
pattern = "text",
|
|
1606
|
+
color = "primary",
|
|
1607
|
+
size = "auto",
|
|
1608
|
+
...props
|
|
1609
|
+
}, ref) => {
|
|
1610
|
+
const [focused, setFocused] = React9.useState(false);
|
|
1611
|
+
const [internalValue, setInternalValue] = React9.useState(defaultValue);
|
|
1612
|
+
const isControlled = value !== void 0;
|
|
1613
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1614
|
+
const isActive = focused || !!currentValue;
|
|
1615
|
+
const checkPattern = (type, value2) => {
|
|
1616
|
+
switch (type) {
|
|
1617
|
+
case "email":
|
|
1618
|
+
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
1619
|
+
case "phone":
|
|
1620
|
+
return /^\d{10}$/.test(value2);
|
|
1621
|
+
case "number":
|
|
1622
|
+
return /^\d+$/.test(value2);
|
|
1623
|
+
case "currency":
|
|
1624
|
+
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1625
|
+
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
1626
|
+
default:
|
|
1627
|
+
return true;
|
|
1628
|
+
}
|
|
1629
|
+
};
|
|
1630
|
+
const handleChange = (e) => {
|
|
1631
|
+
const newValue = e.target.value;
|
|
1632
|
+
if (newValue && !checkPattern(pattern, newValue)) return;
|
|
1633
|
+
if (!isControlled) {
|
|
1634
|
+
setInternalValue(newValue);
|
|
1635
|
+
}
|
|
1636
|
+
onChange?.(e, newValue);
|
|
1637
|
+
};
|
|
1638
|
+
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1639
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, ...propsComponent.control, children: [
|
|
1640
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1641
|
+
Label,
|
|
1642
|
+
{
|
|
1643
|
+
text: label || "",
|
|
1644
|
+
className: !!isActive ? "yr3Input--active" : "",
|
|
1645
|
+
color,
|
|
1646
|
+
...propsComponent.label
|
|
1647
|
+
}
|
|
1648
|
+
),
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1650
|
+
"input",
|
|
1651
|
+
{
|
|
1652
|
+
ref,
|
|
1653
|
+
value: currentValue,
|
|
1654
|
+
inputMode: pattern === "currency" ? "numeric" : pattern === "phone" ? "tel" : void 0,
|
|
1655
|
+
autoComplete: "off",
|
|
1656
|
+
type: "text",
|
|
1657
|
+
onChange: handleChange,
|
|
1658
|
+
onFocus: () => setFocused(true),
|
|
1659
|
+
onBlur: () => setFocused(false),
|
|
1660
|
+
className: classes,
|
|
1661
|
+
style: composeStyles(ui, style),
|
|
1662
|
+
...props,
|
|
1663
|
+
"data-testid": "yr3Input"
|
|
1664
|
+
}
|
|
1665
|
+
)
|
|
1666
|
+
] });
|
|
1667
|
+
}
|
|
1668
|
+
);
|
|
1669
|
+
|
|
1670
|
+
// src/components/Date/MonthSelector.tsx
|
|
1671
|
+
var React10 = __toESM(require("react"), 1);
|
|
1672
|
+
|
|
1673
|
+
// src/Icons/IconSearch.tsx
|
|
1674
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1675
|
+
var IconSearch = (props) => {
|
|
1676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.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_runtime19.jsx)(
|
|
1677
|
+
"path",
|
|
1678
|
+
{
|
|
1679
|
+
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",
|
|
1680
|
+
stroke: props.stroke || "#fff",
|
|
1681
|
+
strokeWidth: props.strokeWidth || "1.5",
|
|
1682
|
+
strokeLinecap: "round",
|
|
1683
|
+
strokeLinejoin: "round"
|
|
1684
|
+
}
|
|
1685
|
+
) });
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1688
|
+
// src/Icons/IconDown.tsx
|
|
1689
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1690
|
+
var IconDown = (props) => {
|
|
1691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "data-testid": "yr3Icons", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
// src/Icons/IconCalendar.tsx
|
|
1695
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1696
|
+
var IconCalendar = (props) => {
|
|
1697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { width: props.width || "24px", height: props.height || "24px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5" }) });
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
// src/Icons/IconLeft.tsx
|
|
1701
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1702
|
+
var IconLeft = (props) => {
|
|
1703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("svg", { width: props.width || "24px", height: props.height || "24px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M15 7L10 12L15 17", stroke: props.stroke || "currentColor", strokeWidth: props.strokeWidth || "2", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
// src/components/Date/month.variants.ts
|
|
1707
|
+
var monthSelectorIconVariants = createVariants({
|
|
1708
|
+
base: "yr3MonthSelector--icon",
|
|
1709
|
+
variants: {
|
|
1710
|
+
color: {
|
|
1711
|
+
primary: "yr3MonthSelector--icon-color-primary",
|
|
1712
|
+
secondary: "yr3MonthSelector--icon-color-secondary",
|
|
1713
|
+
success: "yr3MonthSelector--icon-color-success",
|
|
1714
|
+
text: "yr3MonthSelector--icon-color-text",
|
|
1715
|
+
disabled: "yr3MonthSelector--icon-color-disabled",
|
|
1716
|
+
background: "yr3MonthSelector--icon-color-background",
|
|
1717
|
+
error: "yr3MonthSelector--icon-color-error",
|
|
1718
|
+
warning: "yr3MonthSelector--icon-color-warning",
|
|
1719
|
+
info: "yr3MonthSelector--icon-color-info",
|
|
1720
|
+
common: "yr3MonthSelector--icon-color-common"
|
|
1721
|
+
},
|
|
1722
|
+
animated: {
|
|
1723
|
+
true: "yr3MonthSelector--icon-animated"
|
|
1724
|
+
},
|
|
1725
|
+
open: {
|
|
1726
|
+
true: "yr3MonthSelector--icon-open"
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
});
|
|
1730
|
+
|
|
1731
|
+
// src/Icons/IconRight.tsx
|
|
1732
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1733
|
+
var IconRight = (props) => {
|
|
1734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("svg", { width: props.width || "24px", height: props.height || "24px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1735
|
+
"path",
|
|
1736
|
+
{
|
|
1737
|
+
d: "M9 7L14 12L9 17",
|
|
1738
|
+
stroke: props.stroke || "currentColor",
|
|
1739
|
+
strokeWidth: props.strokeWidth || "2",
|
|
1740
|
+
strokeLinecap: "round",
|
|
1741
|
+
strokeLinejoin: "round"
|
|
1742
|
+
}
|
|
1743
|
+
) });
|
|
1744
|
+
};
|
|
1745
|
+
|
|
1746
|
+
// src/components/Date/MonthSelector.tsx
|
|
1747
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1748
|
+
var initialPropsComponent3 = {
|
|
1749
|
+
control: {
|
|
1750
|
+
variant: "outlined",
|
|
1751
|
+
color: "primary",
|
|
1752
|
+
ui: {},
|
|
1753
|
+
style: {}
|
|
1754
|
+
},
|
|
1755
|
+
label: {
|
|
1756
|
+
display: true,
|
|
1757
|
+
color: "primary",
|
|
1758
|
+
ui: {},
|
|
1759
|
+
style: {}
|
|
1760
|
+
},
|
|
1761
|
+
wrapper: {
|
|
1762
|
+
ui: {},
|
|
1763
|
+
style: {}
|
|
1764
|
+
},
|
|
1765
|
+
icon: {
|
|
1766
|
+
color: "primary",
|
|
1767
|
+
style: {},
|
|
1768
|
+
svg: {
|
|
1769
|
+
width: 20,
|
|
1770
|
+
height: 20
|
|
1771
|
+
},
|
|
1772
|
+
component: void 0
|
|
1773
|
+
}
|
|
1774
|
+
};
|
|
1775
|
+
var MonthSelector = ({ label, year, month, value, defaultValue, propsComponent, years, language, formatMonth = "MMM", monthsDisabled }) => {
|
|
1776
|
+
const [open, setOpen] = React10.useState(false);
|
|
1777
|
+
const [valueState, setValueState] = React10.useState(value || defaultValue || null);
|
|
1778
|
+
const [yearSelected, setYearSelected] = React10.useState(0);
|
|
1779
|
+
const ref = React10.useRef(null);
|
|
1780
|
+
useClickAway(ref, () => setOpen(false));
|
|
1781
|
+
const properties = mergeDeep(initialPropsComponent3, propsComponent || {});
|
|
1782
|
+
const iconClasses = monthSelectorIconVariants({ color: properties?.icon?.color });
|
|
1783
|
+
const data = React10.useMemo(() => getMonthCalendarProps({ year, month, years, language, formatMonth, monthsDisabled }), [year, month, years, language, formatMonth, monthsDisabled]);
|
|
1784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "yr3MonthSelector", ref, children: [
|
|
1785
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1786
|
+
Input,
|
|
1787
|
+
{
|
|
1788
|
+
label,
|
|
1789
|
+
variant: "base",
|
|
1790
|
+
disabled: true,
|
|
1791
|
+
value: valueState || "",
|
|
1792
|
+
propsComponent: {
|
|
1793
|
+
control: properties?.control,
|
|
1794
|
+
label: properties?.label
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
),
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1799
|
+
"div",
|
|
1800
|
+
{
|
|
1801
|
+
className: iconClasses,
|
|
1802
|
+
style: properties?.icon?.style,
|
|
1803
|
+
onClick: () => setOpen((prev) => !prev),
|
|
1804
|
+
"data-testid": "yr3MonthSelector--icon",
|
|
1805
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1806
|
+
IconCalendar,
|
|
1807
|
+
{
|
|
1808
|
+
width: properties?.icon?.svg?.width,
|
|
1809
|
+
height: properties?.icon?.svg?.height,
|
|
1810
|
+
stroke: "currentColor",
|
|
1811
|
+
style: properties?.icon?.svg
|
|
1812
|
+
}
|
|
1813
|
+
)
|
|
1814
|
+
}
|
|
1815
|
+
),
|
|
1816
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1817
|
+
"div",
|
|
1818
|
+
{
|
|
1819
|
+
className: "yr3MonthSelector--wrapper",
|
|
1820
|
+
style: composeStyles(properties?.wrapper?.ui, properties?.wrapper?.style),
|
|
1821
|
+
"data-testid": "yr3MonthSelector--wrapper",
|
|
1822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "yr3MonthSelector--component", children: [
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "yr3MonthSelector--year-options", children: [
|
|
1824
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("button", { disabled: yearSelected === 0, type: "button", className: `yr3MonthSelector--year-button-back ${yearSelected === 0 ? "yr3MonthSelector--year-button-back--disabled" : ""} `, onClick: () => setYearSelected(yearSelected - 1), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(IconLeft, { width: 20, height: 20, stroke: "currentColor" }) }),
|
|
1825
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `yr3MonthSelector--year-option`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { variant: "body1", color: "primary", children: [
|
|
1826
|
+
years[yearSelected],
|
|
1827
|
+
" "
|
|
1828
|
+
] }) }),
|
|
1829
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1830
|
+
"button",
|
|
1831
|
+
{
|
|
1832
|
+
disabled: yearSelected === years.length - 1,
|
|
1833
|
+
type: "button",
|
|
1834
|
+
className: `yr3MonthSelector--year-button-next ${yearSelected === years.length - 1 ? "yr3MonthSelector--year-button-next--disabled" : ""}`,
|
|
1835
|
+
onClick: () => setYearSelected(yearSelected + 1),
|
|
1836
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(IconRight, { width: 20, height: 30, stroke: "currentColor" })
|
|
1837
|
+
}
|
|
1838
|
+
)
|
|
1839
|
+
] }),
|
|
1840
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "yr3MonthSelector--months", children: data.months.map((m) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1841
|
+
"button",
|
|
1842
|
+
{
|
|
1843
|
+
type: "button",
|
|
1844
|
+
disabled: m.disabled,
|
|
1845
|
+
className: `yr3MonthSelector--month ${m.disabled ? "yr3MonthSelector--month-disabled" : ""}`,
|
|
1846
|
+
onClick: () => {
|
|
1847
|
+
setValueState(`${m.value}-${years[yearSelected]}`);
|
|
1848
|
+
setOpen(false);
|
|
1849
|
+
},
|
|
1850
|
+
children: m.label
|
|
1851
|
+
},
|
|
1852
|
+
"month-" + m.value
|
|
1853
|
+
)) })
|
|
1854
|
+
] })
|
|
1855
|
+
}
|
|
1856
|
+
)
|
|
1857
|
+
] });
|
|
1858
|
+
};
|
|
1859
|
+
|
|
1860
|
+
// src/components/Fade/Fade.tsx
|
|
1861
|
+
var React11 = __toESM(require("react"), 1);
|
|
1862
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1506
1863
|
var Fade = ({
|
|
1507
1864
|
in: inProp,
|
|
1508
1865
|
children,
|
|
@@ -1510,7 +1867,7 @@ var Fade = ({
|
|
|
1510
1867
|
onTransitionEnd,
|
|
1511
1868
|
style
|
|
1512
1869
|
}) => {
|
|
1513
|
-
|
|
1870
|
+
React11.useEffect(() => {
|
|
1514
1871
|
let timeoutId;
|
|
1515
1872
|
if (inProp) {
|
|
1516
1873
|
timeoutId = setTimeout(() => {
|
|
@@ -1519,7 +1876,7 @@ var Fade = ({
|
|
|
1519
1876
|
}
|
|
1520
1877
|
return () => clearTimeout(timeoutId);
|
|
1521
1878
|
}, [inProp, duration, onTransitionEnd]);
|
|
1522
|
-
return /* @__PURE__ */ (0,
|
|
1879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1523
1880
|
"div",
|
|
1524
1881
|
{
|
|
1525
1882
|
className: `yr3Fade ${inProp ? "yr3Fade--in" : ""}`,
|
|
@@ -1556,7 +1913,7 @@ var flexVariants = createVariants({
|
|
|
1556
1913
|
var flex_variants_default = flexVariants;
|
|
1557
1914
|
|
|
1558
1915
|
// src/components/Flex/Flex.tsx
|
|
1559
|
-
var
|
|
1916
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1560
1917
|
var Flex = ({
|
|
1561
1918
|
container = false,
|
|
1562
1919
|
spacing: spacing2 = 1,
|
|
@@ -1571,7 +1928,7 @@ var Flex = ({
|
|
|
1571
1928
|
...props
|
|
1572
1929
|
}) => {
|
|
1573
1930
|
const classes = flex_variants_default({ variant, container, center, between, bordered, spacing: spacing2 });
|
|
1574
|
-
return /* @__PURE__ */ (0,
|
|
1931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1575
1932
|
"div",
|
|
1576
1933
|
{
|
|
1577
1934
|
className: classes,
|
|
@@ -1584,7 +1941,7 @@ var Flex = ({
|
|
|
1584
1941
|
};
|
|
1585
1942
|
|
|
1586
1943
|
// src/components/Grid/Grid.tsx
|
|
1587
|
-
var
|
|
1944
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1588
1945
|
var Grid = ({
|
|
1589
1946
|
container = false,
|
|
1590
1947
|
spacing: spacing2 = 0,
|
|
@@ -1617,7 +1974,7 @@ var Grid = ({
|
|
|
1617
1974
|
}
|
|
1618
1975
|
const classes = bem("yr3Grid");
|
|
1619
1976
|
const className = classes(void 0, { container, [`spacing-${spacing2}`]: center, span: item && `Col-${size}` });
|
|
1620
|
-
return /* @__PURE__ */ (0,
|
|
1977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1621
1978
|
"div",
|
|
1622
1979
|
{
|
|
1623
1980
|
className,
|
|
@@ -1630,7 +1987,7 @@ var Grid = ({
|
|
|
1630
1987
|
};
|
|
1631
1988
|
|
|
1632
1989
|
// src/components/Group/Group.tsx
|
|
1633
|
-
var
|
|
1990
|
+
var React12 = __toESM(require("react"), 1);
|
|
1634
1991
|
|
|
1635
1992
|
// src/components/Group/group.variants.ts
|
|
1636
1993
|
var groupVariants = createVariants({
|
|
@@ -1661,7 +2018,7 @@ var groupVariants = createVariants({
|
|
|
1661
2018
|
});
|
|
1662
2019
|
|
|
1663
2020
|
// src/components/Group/Group.tsx
|
|
1664
|
-
var
|
|
2021
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1665
2022
|
var initialComponents = (color) => ({
|
|
1666
2023
|
group: {
|
|
1667
2024
|
ui: {},
|
|
@@ -1694,9 +2051,9 @@ var Group = ({
|
|
|
1694
2051
|
initialComponents(type === "rounded" ? "text" : color),
|
|
1695
2052
|
propsComponent || {}
|
|
1696
2053
|
);
|
|
1697
|
-
const [internalValue, setInternalValue] =
|
|
2054
|
+
const [internalValue, setInternalValue] = React12.useState(null);
|
|
1698
2055
|
const isControlled = value !== void 0;
|
|
1699
|
-
|
|
2056
|
+
React12.useEffect(() => {
|
|
1700
2057
|
if (isControlled) {
|
|
1701
2058
|
setInternalValue(value);
|
|
1702
2059
|
}
|
|
@@ -1707,7 +2064,7 @@ var Group = ({
|
|
|
1707
2064
|
active: !exclude ? Array.isArray(value) ? value.includes(item?.value) : internalValue === item.value : false,
|
|
1708
2065
|
exclude: exclude && Array.isArray(value) ? !value.includes(item?.value) : ""
|
|
1709
2066
|
});
|
|
1710
|
-
const mappingStyle =
|
|
2067
|
+
const mappingStyle = React12.useMemo(() => {
|
|
1711
2068
|
if (variant !== "filled") return options.map((opt, index) => ({
|
|
1712
2069
|
...opt,
|
|
1713
2070
|
index,
|
|
@@ -1738,13 +2095,13 @@ var Group = ({
|
|
|
1738
2095
|
}
|
|
1739
2096
|
}));
|
|
1740
2097
|
}, [exclude, value, options, type]);
|
|
1741
|
-
return /* @__PURE__ */ (0,
|
|
2098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1742
2099
|
"div",
|
|
1743
2100
|
{
|
|
1744
2101
|
className: groupVariants({ variant, color, type }),
|
|
1745
2102
|
"data-testid": "yr3Group",
|
|
1746
2103
|
style: composeStyles(properties.group?.ui, properties.group?.style),
|
|
1747
|
-
children: options.map((opt, index) => /* @__PURE__ */ (0,
|
|
2104
|
+
children: options.map((opt, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1748
2105
|
"div",
|
|
1749
2106
|
{
|
|
1750
2107
|
"data-testid": "yr3Group-item",
|
|
@@ -1762,7 +2119,7 @@ var Group = ({
|
|
|
1762
2119
|
...mappingStyle?.find((o) => o.value === opt.value)?.style
|
|
1763
2120
|
}
|
|
1764
2121
|
),
|
|
1765
|
-
children: /* @__PURE__ */ (0,
|
|
2122
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1766
2123
|
Text,
|
|
1767
2124
|
{
|
|
1768
2125
|
...properties.item?.text,
|
|
@@ -1778,14 +2135,14 @@ var Group = ({
|
|
|
1778
2135
|
};
|
|
1779
2136
|
|
|
1780
2137
|
// src/components/Image/Image.tsx
|
|
1781
|
-
var
|
|
2138
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1782
2139
|
var Image = ({
|
|
1783
2140
|
src,
|
|
1784
2141
|
alt = "",
|
|
1785
2142
|
ui,
|
|
1786
2143
|
style
|
|
1787
2144
|
}) => {
|
|
1788
|
-
return /* @__PURE__ */ (0,
|
|
2145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1789
2146
|
"img",
|
|
1790
2147
|
{
|
|
1791
2148
|
src,
|
|
@@ -1798,9 +2155,9 @@ var Image = ({
|
|
|
1798
2155
|
};
|
|
1799
2156
|
|
|
1800
2157
|
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
1801
|
-
var
|
|
1802
|
-
var
|
|
1803
|
-
var
|
|
2158
|
+
var React13 = __toESM(require("react"), 1);
|
|
2159
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2160
|
+
var initialPropsComponent4 = {
|
|
1804
2161
|
box: {},
|
|
1805
2162
|
text: {},
|
|
1806
2163
|
container: {},
|
|
@@ -1808,10 +2165,10 @@ var initialPropsComponent3 = {
|
|
|
1808
2165
|
content: {}
|
|
1809
2166
|
};
|
|
1810
2167
|
var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
1811
|
-
const properties = mergeDeep(
|
|
1812
|
-
const [dragging, setDragging] =
|
|
1813
|
-
const [files, setFiles] =
|
|
1814
|
-
const inputRef =
|
|
2168
|
+
const properties = mergeDeep(initialPropsComponent4, propsComponent || {});
|
|
2169
|
+
const [dragging, setDragging] = React13.useState(false);
|
|
2170
|
+
const [files, setFiles] = React13.useState([]);
|
|
2171
|
+
const inputRef = React13.useRef(null);
|
|
1815
2172
|
const handleFiles = (fileList) => {
|
|
1816
2173
|
if (!fileList) return;
|
|
1817
2174
|
const newFiles = Array.from(fileList);
|
|
@@ -1823,7 +2180,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
1823
2180
|
};
|
|
1824
2181
|
const classes = bem("yr3Dropzone");
|
|
1825
2182
|
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
1826
|
-
return /* @__PURE__ */ (0,
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { as: "div", position: "relative", content: "center", ...properties?.box, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1827
2184
|
"div",
|
|
1828
2185
|
{
|
|
1829
2186
|
className: classComponent,
|
|
@@ -1840,7 +2197,7 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
1840
2197
|
onClick: () => inputRef.current?.click(),
|
|
1841
2198
|
style: composeStyles(properties?.container?.ui, properties?.container?.style),
|
|
1842
2199
|
children: [
|
|
1843
|
-
/* @__PURE__ */ (0,
|
|
2200
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1844
2201
|
"input",
|
|
1845
2202
|
{
|
|
1846
2203
|
ref: inputRef,
|
|
@@ -1851,166 +2208,18 @@ var ImageDropzone = ({ onChange, multiple, propsComponent, bordered, component,
|
|
|
1851
2208
|
onChange: (e) => handleFiles(e.target.files)
|
|
1852
2209
|
}
|
|
1853
2210
|
),
|
|
1854
|
-
isEmpty(files) && /* @__PURE__ */ (0,
|
|
1855
|
-
multiple && /* @__PURE__ */ (0,
|
|
1856
|
-
!multiple && /* @__PURE__ */ (0,
|
|
1857
|
-
!!defaultImage && /* @__PURE__ */ (0,
|
|
2211
|
+
isEmpty(files) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "yr3Dropzone--content", style: composeStyles(properties?.content?.ui, properties?.content?.style), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
2212
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "yr3Dropzone--previews", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
2213
|
+
!multiple && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
2214
|
+
!!defaultImage && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "yr3Dropzone--preview", style: composeStyles(properties?.preview?.ui, properties?.preview?.style), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("img", { src: defaultImage }) }),
|
|
1858
2215
|
component
|
|
1859
2216
|
]
|
|
1860
2217
|
}
|
|
1861
2218
|
) });
|
|
1862
2219
|
};
|
|
1863
2220
|
|
|
1864
|
-
// src/components/Input/Input.tsx
|
|
1865
|
-
var React12 = __toESM(require("react"), 1);
|
|
1866
|
-
|
|
1867
|
-
// src/components/Label/Label.tsx
|
|
1868
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1869
|
-
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1870
|
-
const classes = bem("yr3Label");
|
|
1871
|
-
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1872
|
-
const classnames = bemMerge(classComponent, className);
|
|
1873
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1874
|
-
"span",
|
|
1875
|
-
{
|
|
1876
|
-
className: classnames,
|
|
1877
|
-
"data-testid": "yr3Label",
|
|
1878
|
-
style: composeStyles(ui, style),
|
|
1879
|
-
children: text2 ? text2 : children
|
|
1880
|
-
}
|
|
1881
|
-
);
|
|
1882
|
-
};
|
|
1883
|
-
|
|
1884
|
-
// src/components/Input/input.variants.ts
|
|
1885
|
-
var inputVariants = createVariants({
|
|
1886
|
-
base: "yr3Input",
|
|
1887
|
-
variants: {
|
|
1888
|
-
variant: {
|
|
1889
|
-
filled: "yr3Input--filled",
|
|
1890
|
-
outlined: "yr3Input--outlined",
|
|
1891
|
-
base: "yr3Input--base",
|
|
1892
|
-
lined: "yr3Input--lined"
|
|
1893
|
-
},
|
|
1894
|
-
color: {
|
|
1895
|
-
primary: "yr3Input--color-primary",
|
|
1896
|
-
secondary: "yr3Input--color-secondary",
|
|
1897
|
-
success: "yr3Input--color-success",
|
|
1898
|
-
text: "yr3Input--color-text",
|
|
1899
|
-
disabled: "yr3Input--color-disabled",
|
|
1900
|
-
background: "yr3Input--color-background",
|
|
1901
|
-
error: "yr3Input--color-error",
|
|
1902
|
-
warning: "yr3Input--color-warning",
|
|
1903
|
-
info: "yr3Input--color-info",
|
|
1904
|
-
common: "yr3Input--color-common"
|
|
1905
|
-
},
|
|
1906
|
-
size: {
|
|
1907
|
-
auto: "yr3Input--size-auto",
|
|
1908
|
-
full: "yr3Input--size-full"
|
|
1909
|
-
},
|
|
1910
|
-
rounded: {
|
|
1911
|
-
true: "yr3Input--rounded"
|
|
1912
|
-
},
|
|
1913
|
-
disabled: {
|
|
1914
|
-
true: "yr3Input--disabled"
|
|
1915
|
-
},
|
|
1916
|
-
animated: {
|
|
1917
|
-
true: "yr3Input--animated"
|
|
1918
|
-
},
|
|
1919
|
-
label: {
|
|
1920
|
-
true: "yr3Input--label"
|
|
1921
|
-
}
|
|
1922
|
-
}
|
|
1923
|
-
});
|
|
1924
|
-
|
|
1925
|
-
// src/components/Input/Input.tsx
|
|
1926
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1927
|
-
var initiaPropsComponent = {
|
|
1928
|
-
label: {
|
|
1929
|
-
display: true,
|
|
1930
|
-
ui: {},
|
|
1931
|
-
style: {}
|
|
1932
|
-
},
|
|
1933
|
-
control: {}
|
|
1934
|
-
};
|
|
1935
|
-
var Input = React12.forwardRef(
|
|
1936
|
-
({
|
|
1937
|
-
label,
|
|
1938
|
-
value,
|
|
1939
|
-
defaultValue,
|
|
1940
|
-
onChange,
|
|
1941
|
-
variant = "outlined",
|
|
1942
|
-
error = "ce un errore",
|
|
1943
|
-
separatorCurrency = ",",
|
|
1944
|
-
ui,
|
|
1945
|
-
style,
|
|
1946
|
-
propsComponent = initiaPropsComponent,
|
|
1947
|
-
pattern = "text",
|
|
1948
|
-
color = "primary",
|
|
1949
|
-
size = "auto",
|
|
1950
|
-
...props
|
|
1951
|
-
}, ref) => {
|
|
1952
|
-
const [focused, setFocused] = React12.useState(false);
|
|
1953
|
-
const [internalValue, setInternalValue] = React12.useState(defaultValue);
|
|
1954
|
-
const isControlled = value !== void 0;
|
|
1955
|
-
const currentValue = isControlled ? value : internalValue;
|
|
1956
|
-
const isActive = focused || !!currentValue;
|
|
1957
|
-
const checkPattern = (type, value2) => {
|
|
1958
|
-
switch (type) {
|
|
1959
|
-
case "email":
|
|
1960
|
-
return /^[\w.-]+@[\w.-]+\.\w{2,}$/.test(value2);
|
|
1961
|
-
case "phone":
|
|
1962
|
-
return /^\d{10}$/.test(value2);
|
|
1963
|
-
case "number":
|
|
1964
|
-
return /^\d+$/.test(value2);
|
|
1965
|
-
case "currency":
|
|
1966
|
-
if (separatorCurrency === ",") return /^\d+(\,\d{0,2})?$/.test(value2);
|
|
1967
|
-
if (separatorCurrency === ".") return /^\d+(\.\d{0,2})?$/.test(value2);
|
|
1968
|
-
default:
|
|
1969
|
-
return true;
|
|
1970
|
-
}
|
|
1971
|
-
};
|
|
1972
|
-
const handleChange = (e) => {
|
|
1973
|
-
const newValue = e.target.value;
|
|
1974
|
-
if (newValue && !checkPattern(pattern, newValue)) return;
|
|
1975
|
-
if (!isControlled) {
|
|
1976
|
-
setInternalValue(newValue);
|
|
1977
|
-
}
|
|
1978
|
-
onChange?.(e, newValue);
|
|
1979
|
-
};
|
|
1980
|
-
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1981
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, ...propsComponent.control, children: [
|
|
1982
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1983
|
-
Label,
|
|
1984
|
-
{
|
|
1985
|
-
text: label || "",
|
|
1986
|
-
className: !!isActive ? "yr3Input--active" : "",
|
|
1987
|
-
color,
|
|
1988
|
-
...propsComponent.label
|
|
1989
|
-
}
|
|
1990
|
-
),
|
|
1991
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1992
|
-
"input",
|
|
1993
|
-
{
|
|
1994
|
-
ref,
|
|
1995
|
-
value: currentValue,
|
|
1996
|
-
inputMode: pattern === "currency" ? "numeric" : pattern === "phone" ? "tel" : void 0,
|
|
1997
|
-
autoComplete: "off",
|
|
1998
|
-
type: "text",
|
|
1999
|
-
onChange: handleChange,
|
|
2000
|
-
onFocus: () => setFocused(true),
|
|
2001
|
-
onBlur: () => setFocused(false),
|
|
2002
|
-
className: classes,
|
|
2003
|
-
style: composeStyles(ui, style),
|
|
2004
|
-
...props,
|
|
2005
|
-
"data-testid": "yr3Input"
|
|
2006
|
-
}
|
|
2007
|
-
)
|
|
2008
|
-
] });
|
|
2009
|
-
}
|
|
2010
|
-
);
|
|
2011
|
-
|
|
2012
2221
|
// src/components/InputArea/InputArea.tsx
|
|
2013
|
-
var
|
|
2222
|
+
var React14 = __toESM(require("react"), 1);
|
|
2014
2223
|
|
|
2015
2224
|
// src/components/InputArea/inputAreaVariants.ts
|
|
2016
2225
|
var inputAreaVariants = createVariants({
|
|
@@ -2051,7 +2260,7 @@ var inputAreaVariants = createVariants({
|
|
|
2051
2260
|
});
|
|
2052
2261
|
|
|
2053
2262
|
// src/components/InputArea/InputArea.tsx
|
|
2054
|
-
var
|
|
2263
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2055
2264
|
var initiaPropsComponent2 = {
|
|
2056
2265
|
label: {
|
|
2057
2266
|
display: true,
|
|
@@ -2076,8 +2285,8 @@ var InputArea = ({
|
|
|
2076
2285
|
rounded = false,
|
|
2077
2286
|
propsComponent = initiaPropsComponent2
|
|
2078
2287
|
}) => {
|
|
2079
|
-
const ref =
|
|
2080
|
-
const [internalValue, setInternalValue] =
|
|
2288
|
+
const ref = React14.useRef(null);
|
|
2289
|
+
const [internalValue, setInternalValue] = React14.useState(defaultValue);
|
|
2081
2290
|
const isControlled = value !== void 0;
|
|
2082
2291
|
const currentValue = isControlled ? value : internalValue;
|
|
2083
2292
|
const handleChange = (e) => {
|
|
@@ -2094,8 +2303,8 @@ var InputArea = ({
|
|
|
2094
2303
|
el.style.resize = resize;
|
|
2095
2304
|
}
|
|
2096
2305
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
2097
|
-
return /* @__PURE__ */ (0,
|
|
2098
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
2306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { style: { position: "relative" }, children: [
|
|
2307
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2099
2308
|
Label,
|
|
2100
2309
|
{
|
|
2101
2310
|
text: label || "",
|
|
@@ -2103,7 +2312,7 @@ var InputArea = ({
|
|
|
2103
2312
|
...propsComponent.label
|
|
2104
2313
|
}
|
|
2105
2314
|
),
|
|
2106
|
-
/* @__PURE__ */ (0,
|
|
2315
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2107
2316
|
"textarea",
|
|
2108
2317
|
{
|
|
2109
2318
|
className: classes,
|
|
@@ -2115,7 +2324,7 @@ var InputArea = ({
|
|
|
2115
2324
|
"data-testid": "yr3InputArea"
|
|
2116
2325
|
}
|
|
2117
2326
|
),
|
|
2118
|
-
/* @__PURE__ */ (0,
|
|
2327
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { variant: "helper", color: currentValue.length > maxLength ? "error" : "disabled", ui: { textAlign: "right" }, "data-testid": "yr3InputAreaError", children: validate && maxLength ? `${currentValue.length}/${maxLength}` || propsComponent.helperText : "" })
|
|
2119
2328
|
] });
|
|
2120
2329
|
};
|
|
2121
2330
|
|
|
@@ -2149,8 +2358,8 @@ var loaderSpinnerVariants = createVariants({
|
|
|
2149
2358
|
});
|
|
2150
2359
|
|
|
2151
2360
|
// src/components/Loader/Loader.tsx
|
|
2152
|
-
var
|
|
2153
|
-
var
|
|
2361
|
+
var React15 = __toESM(require("react"), 1);
|
|
2362
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2154
2363
|
var initialComponents2 = {
|
|
2155
2364
|
loader: {
|
|
2156
2365
|
ui: {},
|
|
@@ -2178,29 +2387,29 @@ var Loader = ({ component, loading = false, propsComponent }) => {
|
|
|
2178
2387
|
size: properties?.spinner?.size
|
|
2179
2388
|
});
|
|
2180
2389
|
if (!loading) return null;
|
|
2181
|
-
return /* @__PURE__ */ (0,
|
|
2182
|
-
/* @__PURE__ */ (0,
|
|
2183
|
-
/* @__PURE__ */ (0,
|
|
2184
|
-
/* @__PURE__ */ (0,
|
|
2390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "yr3Loader", style: composeStyles(properties?.loader?.ui, properties?.loader?.style), children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Flex, { ...properties?.container, children: component || /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: classSpinner, children: properties?.spinner?.type === "dots" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(React15.Fragment, { children: [
|
|
2391
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {}),
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {}),
|
|
2393
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", {})
|
|
2185
2394
|
] }) }) }) });
|
|
2186
2395
|
};
|
|
2187
2396
|
|
|
2188
2397
|
// src/components/Modal/Modal.tsx
|
|
2189
|
-
var
|
|
2398
|
+
var React16 = __toESM(require("react"), 1);
|
|
2190
2399
|
|
|
2191
2400
|
// src/components/Modal/ModalContainer.tsx
|
|
2192
|
-
var
|
|
2401
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2193
2402
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
2194
2403
|
const classes = bem("yr3Modal-container");
|
|
2195
2404
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
2196
|
-
return /* @__PURE__ */ (0,
|
|
2405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
2197
2406
|
};
|
|
2198
2407
|
|
|
2199
2408
|
// src/components/Modal/Modal.tsx
|
|
2200
|
-
var
|
|
2409
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2201
2410
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
2202
2411
|
const { show, hide } = useBackdrop();
|
|
2203
|
-
|
|
2412
|
+
React16.useEffect(() => {
|
|
2204
2413
|
if (open) {
|
|
2205
2414
|
show("modal");
|
|
2206
2415
|
} else {
|
|
@@ -2209,9 +2418,9 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
2209
2418
|
}, [open]);
|
|
2210
2419
|
const classes = bem("yr3Modal");
|
|
2211
2420
|
const classComponent = classes(void 0, { "open": !!open });
|
|
2212
|
-
return /* @__PURE__ */ (0,
|
|
2421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
|
|
2213
2422
|
children,
|
|
2214
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0,
|
|
2423
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
2215
2424
|
] }) }) });
|
|
2216
2425
|
};
|
|
2217
2426
|
|
|
@@ -2251,15 +2460,15 @@ var notistackVariants = createVariants({
|
|
|
2251
2460
|
});
|
|
2252
2461
|
|
|
2253
2462
|
// src/components/Notistack/Notistack.tsx
|
|
2254
|
-
var
|
|
2463
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2255
2464
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
2256
2465
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
2257
2466
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
2258
2467
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
2259
2468
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
2260
|
-
return /* @__PURE__ */ (0,
|
|
2261
|
-
/* @__PURE__ */ (0,
|
|
2262
|
-
/* @__PURE__ */ (0,
|
|
2469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { style: containerStyle, children: message }),
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2263
2472
|
"div",
|
|
2264
2473
|
{
|
|
2265
2474
|
className: "yr3Notistack--progress",
|
|
@@ -2294,7 +2503,7 @@ var pendingVariants = createVariants({
|
|
|
2294
2503
|
});
|
|
2295
2504
|
|
|
2296
2505
|
// src/components/Pending/Pending.tsx
|
|
2297
|
-
var
|
|
2506
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2298
2507
|
var Pending = ({
|
|
2299
2508
|
variant,
|
|
2300
2509
|
width,
|
|
@@ -2307,7 +2516,7 @@ var Pending = ({
|
|
|
2307
2516
|
const widthStyle = variant === "circle" ? size : width;
|
|
2308
2517
|
const heightStyle = variant === "circle" ? size : height;
|
|
2309
2518
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
2310
|
-
return /* @__PURE__ */ (0,
|
|
2519
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2311
2520
|
"div",
|
|
2312
2521
|
{
|
|
2313
2522
|
className: pendingVariants({ variant, color }),
|
|
@@ -2318,19 +2527,11 @@ var Pending = ({
|
|
|
2318
2527
|
};
|
|
2319
2528
|
|
|
2320
2529
|
// src/components/Phone/Phone.tsx
|
|
2321
|
-
var
|
|
2322
|
-
|
|
2323
|
-
// src/components/Selector/Selector.tsx
|
|
2324
|
-
var React16 = __toESM(require("react"), 1);
|
|
2325
|
-
|
|
2326
|
-
// src/Icons/IconDown.tsx
|
|
2327
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2328
|
-
var IconDown = (props) => {
|
|
2329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", "data-testid": "yr3Icons", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2330
|
-
};
|
|
2530
|
+
var React18 = __toESM(require("react"), 1);
|
|
2331
2531
|
|
|
2332
2532
|
// src/components/Selector/Selector.tsx
|
|
2333
|
-
var
|
|
2533
|
+
var React17 = __toESM(require("react"), 1);
|
|
2534
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2334
2535
|
var initalPropsComponent2 = {
|
|
2335
2536
|
text: {
|
|
2336
2537
|
variant: "caption",
|
|
@@ -2343,16 +2544,16 @@ var initalPropsComponent2 = {
|
|
|
2343
2544
|
}
|
|
2344
2545
|
};
|
|
2345
2546
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
2346
|
-
const [open, setOpen] =
|
|
2347
|
-
const [valueState, setValueState] =
|
|
2348
|
-
const ref =
|
|
2547
|
+
const [open, setOpen] = React17.useState(false);
|
|
2548
|
+
const [valueState, setValueState] = React17.useState(value || defaultValue || null);
|
|
2549
|
+
const ref = React17.useRef(null);
|
|
2349
2550
|
useClickAway(ref, () => setOpen(false));
|
|
2350
|
-
return /* @__PURE__ */ (0,
|
|
2351
|
-
/* @__PURE__ */ (0,
|
|
2352
|
-
/* @__PURE__ */ (0,
|
|
2551
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "yr3Selector--control", children: [
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
2353
2554
|
valueState
|
|
2354
2555
|
] }) }),
|
|
2355
|
-
open && /* @__PURE__ */ (0,
|
|
2556
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "yr3Selector--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2356
2557
|
"div",
|
|
2357
2558
|
{
|
|
2358
2559
|
className: "yr3Selector--option",
|
|
@@ -2373,16 +2574,15 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
2373
2574
|
};
|
|
2374
2575
|
onChange?.(event, opt.value);
|
|
2375
2576
|
},
|
|
2376
|
-
children: /* @__PURE__ */ (0,
|
|
2577
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { ...propsComponent?.text, children: propsComponent?.text?.children || opt.label })
|
|
2377
2578
|
},
|
|
2378
2579
|
opt.value
|
|
2379
2580
|
)) })
|
|
2380
2581
|
] });
|
|
2381
2582
|
};
|
|
2382
|
-
var Selector_default = Selector;
|
|
2383
2583
|
|
|
2384
2584
|
// src/components/Phone/Phone.tsx
|
|
2385
|
-
var
|
|
2585
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2386
2586
|
var Phone = ({
|
|
2387
2587
|
name,
|
|
2388
2588
|
value,
|
|
@@ -2394,13 +2594,13 @@ var Phone = ({
|
|
|
2394
2594
|
}) => {
|
|
2395
2595
|
const isControlled = value !== void 0;
|
|
2396
2596
|
const initial = value || defaultValue || "";
|
|
2397
|
-
const [prefix, setPrefix] =
|
|
2597
|
+
const [prefix, setPrefix] = React18.useState(
|
|
2398
2598
|
getDialPhone(initial, countries) || countries[0].dial
|
|
2399
2599
|
);
|
|
2400
|
-
const [number, setNumber] =
|
|
2600
|
+
const [number, setNumber] = React18.useState(
|
|
2401
2601
|
getNumberPhone(initial, prefix) || ""
|
|
2402
2602
|
);
|
|
2403
|
-
|
|
2603
|
+
React18.useEffect(() => {
|
|
2404
2604
|
if (isControlled && value) {
|
|
2405
2605
|
const dial = getDialPhone(value, countries);
|
|
2406
2606
|
const num = getNumberPhone(value, dial);
|
|
@@ -2419,11 +2619,11 @@ var Phone = ({
|
|
|
2419
2619
|
setPrefix(val);
|
|
2420
2620
|
onChange?.(null, `${val}${number}`);
|
|
2421
2621
|
};
|
|
2422
|
-
return /* @__PURE__ */ (0,
|
|
2423
|
-
/* @__PURE__ */ (0,
|
|
2424
|
-
/* @__PURE__ */ (0,
|
|
2425
|
-
/* @__PURE__ */ (0,
|
|
2426
|
-
|
|
2622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
2624
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { variant: "row", container: true, center: true, children: [
|
|
2625
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2626
|
+
Selector,
|
|
2427
2627
|
{
|
|
2428
2628
|
options: countries.map((c) => ({
|
|
2429
2629
|
value: c.dial,
|
|
@@ -2434,7 +2634,7 @@ var Phone = ({
|
|
|
2434
2634
|
...propsComponent?.selector
|
|
2435
2635
|
}
|
|
2436
2636
|
),
|
|
2437
|
-
/* @__PURE__ */ (0,
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2438
2638
|
Divider,
|
|
2439
2639
|
{
|
|
2440
2640
|
orientation: "vertical",
|
|
@@ -2443,7 +2643,7 @@ var Phone = ({
|
|
|
2443
2643
|
...propsComponent?.divider
|
|
2444
2644
|
}
|
|
2445
2645
|
),
|
|
2446
|
-
/* @__PURE__ */ (0,
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2447
2647
|
Input,
|
|
2448
2648
|
{
|
|
2449
2649
|
type: "number",
|
|
@@ -2459,9 +2659,9 @@ var Phone = ({
|
|
|
2459
2659
|
};
|
|
2460
2660
|
|
|
2461
2661
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
2462
|
-
var
|
|
2662
|
+
var React19 = __toESM(require("react"), 1);
|
|
2463
2663
|
var import_autocomplete_places = require("@yr3/autocomplete-places");
|
|
2464
|
-
var
|
|
2664
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2465
2665
|
var initPropsComponent = {
|
|
2466
2666
|
label: {
|
|
2467
2667
|
display: true,
|
|
@@ -2501,9 +2701,9 @@ var PlacesAutocomplete = ({
|
|
|
2501
2701
|
keyApi,
|
|
2502
2702
|
propsComponent = initPropsComponent
|
|
2503
2703
|
}) => {
|
|
2504
|
-
const [value, setValue] =
|
|
2505
|
-
const inputRef =
|
|
2506
|
-
const [anchorEl, setAnchorEl] =
|
|
2704
|
+
const [value, setValue] = React19.useState(null);
|
|
2705
|
+
const inputRef = React19.useRef(null);
|
|
2706
|
+
const [anchorEl, setAnchorEl] = React19.useState(null);
|
|
2507
2707
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
2508
2708
|
const handleSelect = async (id) => {
|
|
2509
2709
|
const place = await selectPlace(id);
|
|
@@ -2523,12 +2723,12 @@ var PlacesAutocomplete = ({
|
|
|
2523
2723
|
setValue(place.address);
|
|
2524
2724
|
setAnchorEl(null);
|
|
2525
2725
|
};
|
|
2526
|
-
|
|
2726
|
+
React19.useEffect(() => {
|
|
2527
2727
|
if (defaultLocation) {
|
|
2528
2728
|
setValue(defaultLocation);
|
|
2529
2729
|
}
|
|
2530
2730
|
}, [defaultLocation]);
|
|
2531
|
-
|
|
2731
|
+
React19.useEffect(() => {
|
|
2532
2732
|
if (value === "") {
|
|
2533
2733
|
onSelect(null);
|
|
2534
2734
|
}
|
|
@@ -2538,13 +2738,13 @@ var PlacesAutocomplete = ({
|
|
|
2538
2738
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2539
2739
|
};
|
|
2540
2740
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2541
|
-
|
|
2741
|
+
React19.useEffect(() => {
|
|
2542
2742
|
if (onChangeForm) {
|
|
2543
2743
|
onChangeForm({ target: { value } });
|
|
2544
2744
|
}
|
|
2545
2745
|
}, [onChangeForm]);
|
|
2546
|
-
return /* @__PURE__ */ (0,
|
|
2547
|
-
/* @__PURE__ */ (0,
|
|
2746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2747
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2548
2748
|
Input,
|
|
2549
2749
|
{
|
|
2550
2750
|
ref: inputRef,
|
|
@@ -2558,7 +2758,7 @@ var PlacesAutocomplete = ({
|
|
|
2558
2758
|
},
|
|
2559
2759
|
"input-places"
|
|
2560
2760
|
),
|
|
2561
|
-
open && /* @__PURE__ */ (0,
|
|
2761
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "yr3Places--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent?.menu?.style), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { container: true, ui: { p: 1 }, children: suggestions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { onClick: () => handleSelect(s.id), ui: { padding: 8, cursor: "pointer", "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" } }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { ...propsComponent?.menu?.text, children: s.description }) }, s.id)) }) })
|
|
2562
2762
|
] });
|
|
2563
2763
|
};
|
|
2564
2764
|
|
|
@@ -2586,7 +2786,7 @@ var radioVariant = createVariants({
|
|
|
2586
2786
|
});
|
|
2587
2787
|
|
|
2588
2788
|
// src/components/Radio/Radio.tsx
|
|
2589
|
-
var
|
|
2789
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2590
2790
|
var Radio = ({
|
|
2591
2791
|
checked,
|
|
2592
2792
|
value,
|
|
@@ -2602,8 +2802,8 @@ var Radio = ({
|
|
|
2602
2802
|
const bemClass = bem("yr3Radio");
|
|
2603
2803
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2604
2804
|
const variantClass = radioVariant({ variant });
|
|
2605
|
-
return /* @__PURE__ */ (0,
|
|
2606
|
-
/* @__PURE__ */ (0,
|
|
2805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2806
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2607
2807
|
"input",
|
|
2608
2808
|
{
|
|
2609
2809
|
type: "radio",
|
|
@@ -2615,8 +2815,8 @@ var Radio = ({
|
|
|
2615
2815
|
}
|
|
2616
2816
|
),
|
|
2617
2817
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2618
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0,
|
|
2619
|
-
typeof label === "string" && /* @__PURE__ */ (0,
|
|
2818
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2819
|
+
typeof label === "string" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2620
2820
|
"span",
|
|
2621
2821
|
{
|
|
2622
2822
|
className: "yr3Radio--label",
|
|
@@ -2629,7 +2829,7 @@ var Radio = ({
|
|
|
2629
2829
|
};
|
|
2630
2830
|
|
|
2631
2831
|
// src/components/Select/Select.tsx
|
|
2632
|
-
var
|
|
2832
|
+
var React20 = __toESM(require("react"), 1);
|
|
2633
2833
|
|
|
2634
2834
|
// src/components/Select/select.variants.ts
|
|
2635
2835
|
var selectVariants = createVariants({
|
|
@@ -2689,7 +2889,7 @@ var selectIconVariants = createVariants({
|
|
|
2689
2889
|
});
|
|
2690
2890
|
|
|
2691
2891
|
// src/components/Select/Select.tsx
|
|
2692
|
-
var
|
|
2892
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2693
2893
|
var initiaPropsComponent3 = {
|
|
2694
2894
|
control: {
|
|
2695
2895
|
variant: "outlined",
|
|
@@ -2729,15 +2929,15 @@ var initiaPropsComponent3 = {
|
|
|
2729
2929
|
}
|
|
2730
2930
|
};
|
|
2731
2931
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2732
|
-
const [open, setOpen] =
|
|
2733
|
-
const [valueState, setValueState] =
|
|
2734
|
-
const ref =
|
|
2932
|
+
const [open, setOpen] = React20.useState(false);
|
|
2933
|
+
const [valueState, setValueState] = React20.useState(value || defaultValue || null);
|
|
2934
|
+
const ref = React20.useRef(null);
|
|
2735
2935
|
useClickAway(ref, () => setOpen(false));
|
|
2736
2936
|
const properties = mergeDeep(initiaPropsComponent3, propsComponent || {});
|
|
2737
2937
|
const classesIcon = selectIconVariants({ color: properties?.icon?.color, animated: open, open });
|
|
2738
2938
|
const classes = selectVariants({ wrapper: true });
|
|
2739
|
-
return /* @__PURE__ */ (0,
|
|
2740
|
-
/* @__PURE__ */ (0,
|
|
2939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: classes, ref, children: [
|
|
2940
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2741
2941
|
Input,
|
|
2742
2942
|
{
|
|
2743
2943
|
label,
|
|
@@ -2750,14 +2950,14 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2750
2950
|
}
|
|
2751
2951
|
}
|
|
2752
2952
|
),
|
|
2753
|
-
/* @__PURE__ */ (0,
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2754
2954
|
"div",
|
|
2755
2955
|
{
|
|
2756
2956
|
className: classesIcon,
|
|
2757
2957
|
style: properties?.icon?.style,
|
|
2758
2958
|
onClick: () => setOpen((prev) => !prev),
|
|
2759
2959
|
"data-testid": "yr3Select-icon",
|
|
2760
|
-
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0,
|
|
2960
|
+
children: properties?.icon?.component ? properties?.icon.component : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2761
2961
|
IconDown,
|
|
2762
2962
|
{
|
|
2763
2963
|
width: properties?.icon?.style?.width,
|
|
@@ -2768,13 +2968,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2768
2968
|
)
|
|
2769
2969
|
}
|
|
2770
2970
|
),
|
|
2771
|
-
open && /* @__PURE__ */ (0,
|
|
2971
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2772
2972
|
"div",
|
|
2773
2973
|
{
|
|
2774
2974
|
className: "yr3Select--menu",
|
|
2775
2975
|
style: composeStyles(properties?.menu?.ui, properties?.menu?.style),
|
|
2776
2976
|
"data-testid": "yr3Select-menu",
|
|
2777
|
-
children: options.map((opt) => /* @__PURE__ */ (0,
|
|
2977
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2778
2978
|
"div",
|
|
2779
2979
|
{
|
|
2780
2980
|
className: "yr3Select--option",
|
|
@@ -2796,7 +2996,7 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2796
2996
|
onChange?.(event, opt.value);
|
|
2797
2997
|
},
|
|
2798
2998
|
style: composeStyles(properties?.menu?.options?.ui, properties?.menu?.options?.style),
|
|
2799
|
-
children: /* @__PURE__ */ (0,
|
|
2999
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { as: "span", variant: "caption", color: properties?.menu?.options?.text?.color || "primary", ...properties?.menu?.options?.text, children: opt.label })
|
|
2800
3000
|
},
|
|
2801
3001
|
opt.value
|
|
2802
3002
|
))
|
|
@@ -2806,9 +3006,9 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2806
3006
|
};
|
|
2807
3007
|
|
|
2808
3008
|
// src/components/Slide/Slide.tsx
|
|
2809
|
-
var
|
|
2810
|
-
var
|
|
2811
|
-
var
|
|
3009
|
+
var React21 = __toESM(require("react"), 1);
|
|
3010
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3011
|
+
var initialPropsComponent5 = {
|
|
2812
3012
|
slide: {
|
|
2813
3013
|
ui: {},
|
|
2814
3014
|
style: {}
|
|
@@ -2823,14 +3023,14 @@ var Slide = ({
|
|
|
2823
3023
|
onTransitionEnd,
|
|
2824
3024
|
propsComponent
|
|
2825
3025
|
}) => {
|
|
2826
|
-
const properties = mergeDeep(
|
|
3026
|
+
const properties = mergeDeep(initialPropsComponent5, propsComponent || {});
|
|
2827
3027
|
const bemContent = bem("yr3Slide--content");
|
|
2828
3028
|
const classNameContent = bemContent(void 0, {
|
|
2829
3029
|
[direction]: true,
|
|
2830
3030
|
"in": !!inProp,
|
|
2831
3031
|
"out": !inProp
|
|
2832
3032
|
});
|
|
2833
|
-
|
|
3033
|
+
React21.useEffect(() => {
|
|
2834
3034
|
let timeoutId;
|
|
2835
3035
|
if (inProp) {
|
|
2836
3036
|
timeoutId = setTimeout(() => {
|
|
@@ -2840,19 +3040,19 @@ var Slide = ({
|
|
|
2840
3040
|
return () => clearTimeout(timeoutId);
|
|
2841
3041
|
}, [inProp, duration, onTransitionEnd]);
|
|
2842
3042
|
const uiStyleContent = uiStyle({ ...properties?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2843
|
-
return /* @__PURE__ */ (0,
|
|
3043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2844
3044
|
"div",
|
|
2845
3045
|
{
|
|
2846
3046
|
className: "yr3Slide",
|
|
2847
3047
|
style: composeStyles(),
|
|
2848
3048
|
"data-testid": "yr3Slide",
|
|
2849
|
-
children: /* @__PURE__ */ (0,
|
|
3049
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2850
3050
|
"div",
|
|
2851
3051
|
{
|
|
2852
3052
|
className: classNameContent,
|
|
2853
3053
|
style: composeStyles(uiStyleContent, properties?.slide?.style || {}),
|
|
2854
3054
|
"data-testid": "yr3Slide-content",
|
|
2855
|
-
children: /* @__PURE__ */ (0,
|
|
3055
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { ...properties?.box, "data-testid": "yr3Slide-box", children })
|
|
2856
3056
|
}
|
|
2857
3057
|
)
|
|
2858
3058
|
}
|
|
@@ -2860,7 +3060,7 @@ var Slide = ({
|
|
|
2860
3060
|
};
|
|
2861
3061
|
|
|
2862
3062
|
// src/components/Switch/Switch.tsx
|
|
2863
|
-
var
|
|
3063
|
+
var React22 = __toESM(require("react"), 1);
|
|
2864
3064
|
|
|
2865
3065
|
// src/components/Switch/switch.variants.ts
|
|
2866
3066
|
var switchVariants = createVariants({
|
|
@@ -2897,7 +3097,7 @@ var switchVariants = createVariants({
|
|
|
2897
3097
|
});
|
|
2898
3098
|
|
|
2899
3099
|
// src/components/Switch/Switch.tsx
|
|
2900
|
-
var
|
|
3100
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2901
3101
|
var Switch = ({
|
|
2902
3102
|
checked,
|
|
2903
3103
|
defaultChecked,
|
|
@@ -2909,7 +3109,7 @@ var Switch = ({
|
|
|
2909
3109
|
placement = "end",
|
|
2910
3110
|
propsComponent
|
|
2911
3111
|
}) => {
|
|
2912
|
-
const [internal, setInternal] =
|
|
3112
|
+
const [internal, setInternal] = React22.useState(defaultChecked || false);
|
|
2913
3113
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal, placement });
|
|
2914
3114
|
const isControlled = checked !== void 0;
|
|
2915
3115
|
const value = isControlled ? checked : internal;
|
|
@@ -2917,13 +3117,13 @@ var Switch = ({
|
|
|
2917
3117
|
if (!isControlled) setInternal(e.target.checked);
|
|
2918
3118
|
onChange?.(e, e.target.checked);
|
|
2919
3119
|
};
|
|
2920
|
-
return /* @__PURE__ */ (0,
|
|
3120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
2921
3121
|
"label",
|
|
2922
3122
|
{
|
|
2923
3123
|
className: classname,
|
|
2924
3124
|
"data-testid": "yr3Switch",
|
|
2925
3125
|
children: [
|
|
2926
|
-
/* @__PURE__ */ (0,
|
|
3126
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2927
3127
|
"input",
|
|
2928
3128
|
{
|
|
2929
3129
|
type: "checkbox",
|
|
@@ -2932,8 +3132,8 @@ var Switch = ({
|
|
|
2932
3132
|
disabled
|
|
2933
3133
|
}
|
|
2934
3134
|
),
|
|
2935
|
-
/* @__PURE__ */ (0,
|
|
2936
|
-
/* @__PURE__ */ (0,
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2937
3137
|
"span",
|
|
2938
3138
|
{
|
|
2939
3139
|
className: "yr3Switch--label",
|
|
@@ -2947,30 +3147,15 @@ var Switch = ({
|
|
|
2947
3147
|
);
|
|
2948
3148
|
};
|
|
2949
3149
|
|
|
2950
|
-
// src/Icons/IconSearch.tsx
|
|
2951
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2952
|
-
var IconSearch = (props) => {
|
|
2953
|
-
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)(
|
|
2954
|
-
"path",
|
|
2955
|
-
{
|
|
2956
|
-
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",
|
|
2957
|
-
stroke: props.stroke || "#fff",
|
|
2958
|
-
strokeWidth: props.strokeWidth || "1.5",
|
|
2959
|
-
strokeLinecap: "round",
|
|
2960
|
-
strokeLinejoin: "round"
|
|
2961
|
-
}
|
|
2962
|
-
) });
|
|
2963
|
-
};
|
|
2964
|
-
|
|
2965
3150
|
// src/theme/ThemeProvider.tsx
|
|
2966
|
-
var
|
|
3151
|
+
var React24 = __toESM(require("react"), 1);
|
|
2967
3152
|
|
|
2968
3153
|
// src/theme/notistackContext.tsx
|
|
2969
|
-
var
|
|
2970
|
-
var
|
|
2971
|
-
var NotistackContext =
|
|
3154
|
+
var React23 = __toESM(require("react"), 1);
|
|
3155
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3156
|
+
var NotistackContext = React23.createContext(null);
|
|
2972
3157
|
var NotistackProvider = ({ children }) => {
|
|
2973
|
-
const [snacks, setSnacks] =
|
|
3158
|
+
const [snacks, setSnacks] = React23.useState([]);
|
|
2974
3159
|
const notistack = (snack) => {
|
|
2975
3160
|
const id = Date.now();
|
|
2976
3161
|
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
@@ -2985,13 +3170,13 @@ var NotistackProvider = ({ children }) => {
|
|
|
2985
3170
|
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2986
3171
|
}, duration + exitDuration);
|
|
2987
3172
|
};
|
|
2988
|
-
return /* @__PURE__ */ (0,
|
|
3173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(NotistackContext.Provider, { value: { notistack }, children: [
|
|
2989
3174
|
children,
|
|
2990
|
-
/* @__PURE__ */ (0,
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Notistack, { ...snack }, snack.id)) })
|
|
2991
3176
|
] });
|
|
2992
3177
|
};
|
|
2993
3178
|
var useNotistack = () => {
|
|
2994
|
-
const ctx =
|
|
3179
|
+
const ctx = React23.useContext(NotistackContext);
|
|
2995
3180
|
if (!ctx) {
|
|
2996
3181
|
throw new Error("NotistackProvider missing");
|
|
2997
3182
|
}
|
|
@@ -2999,15 +3184,15 @@ var useNotistack = () => {
|
|
|
2999
3184
|
};
|
|
3000
3185
|
|
|
3001
3186
|
// src/theme/ThemeProvider.tsx
|
|
3002
|
-
var
|
|
3003
|
-
var ThemeContext =
|
|
3187
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3188
|
+
var ThemeContext = React24.createContext(null);
|
|
3004
3189
|
var ThemeProvider = ({ theme, children }) => {
|
|
3005
|
-
|
|
3190
|
+
React24.useEffect(() => {
|
|
3006
3191
|
applyTheme(theme);
|
|
3007
3192
|
}, [theme]);
|
|
3008
|
-
return /* @__PURE__ */ (0,
|
|
3193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BackdropProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(NotistackProvider, { children }) }) });
|
|
3009
3194
|
};
|
|
3010
|
-
var useTheme = () =>
|
|
3195
|
+
var useTheme = () => React24.useContext(ThemeContext);
|
|
3011
3196
|
|
|
3012
3197
|
// src/theme/tokens.ts
|
|
3013
3198
|
var baseTokens = {
|
|
@@ -3028,15 +3213,15 @@ var baseTokens = {
|
|
|
3028
3213
|
};
|
|
3029
3214
|
|
|
3030
3215
|
// src/theme/useMediaQuery.tsx
|
|
3031
|
-
var
|
|
3216
|
+
var React25 = __toESM(require("react"), 1);
|
|
3032
3217
|
function useMediaQuery(query) {
|
|
3033
3218
|
const theme = useTheme();
|
|
3034
3219
|
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
3035
|
-
const [matches, setMatches] =
|
|
3220
|
+
const [matches, setMatches] = React25.useState(() => {
|
|
3036
3221
|
if (typeof window === "undefined") return false;
|
|
3037
3222
|
return window.matchMedia(computedQuery).matches;
|
|
3038
3223
|
});
|
|
3039
|
-
|
|
3224
|
+
React25.useEffect(() => {
|
|
3040
3225
|
if (typeof window === "undefined") return;
|
|
3041
3226
|
const media = window.matchMedia(computedQuery);
|
|
3042
3227
|
const listener = () => setMatches(media.matches);
|
|
@@ -3070,7 +3255,7 @@ var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
|
3070
3255
|
};
|
|
3071
3256
|
|
|
3072
3257
|
// src/hooks/useBreakpoint.ts
|
|
3073
|
-
var
|
|
3258
|
+
var React26 = __toESM(require("react"), 1);
|
|
3074
3259
|
var breakUp = (bp) => `(min-width: ${bp}px)`;
|
|
3075
3260
|
var breakDown = (bp) => `(max-width: ${bp}px)`;
|
|
3076
3261
|
function useBreakpoint(queryInput) {
|
|
@@ -3080,8 +3265,8 @@ function useBreakpoint(queryInput) {
|
|
|
3080
3265
|
if (typeof window === "undefined") return false;
|
|
3081
3266
|
return window.matchMedia(query).matches;
|
|
3082
3267
|
};
|
|
3083
|
-
const [matches, setMatches] =
|
|
3084
|
-
|
|
3268
|
+
const [matches, setMatches] = React26.useState(getMatch);
|
|
3269
|
+
React26.useEffect(() => {
|
|
3085
3270
|
if (typeof window === "undefined") return;
|
|
3086
3271
|
const media = window.matchMedia(query);
|
|
3087
3272
|
const listener = (e) => {
|
|
@@ -3127,8 +3312,10 @@ initTheme();
|
|
|
3127
3312
|
Flex,
|
|
3128
3313
|
Grid,
|
|
3129
3314
|
Group,
|
|
3315
|
+
IconCalendar,
|
|
3130
3316
|
IconClose,
|
|
3131
3317
|
IconDown,
|
|
3318
|
+
IconLeft,
|
|
3132
3319
|
IconSearch,
|
|
3133
3320
|
Image,
|
|
3134
3321
|
ImageDropzone,
|
|
@@ -3138,6 +3325,7 @@ initTheme();
|
|
|
3138
3325
|
Loader,
|
|
3139
3326
|
Modal,
|
|
3140
3327
|
ModalContainer,
|
|
3328
|
+
MonthSelector,
|
|
3141
3329
|
Notistack,
|
|
3142
3330
|
NotistackContext,
|
|
3143
3331
|
NotistackProvider,
|
|
@@ -3146,6 +3334,7 @@ initTheme();
|
|
|
3146
3334
|
PlacesAutocomplete,
|
|
3147
3335
|
Radio,
|
|
3148
3336
|
Select,
|
|
3337
|
+
Selector,
|
|
3149
3338
|
Slide,
|
|
3150
3339
|
Switch,
|
|
3151
3340
|
Text,
|
|
@@ -3170,6 +3359,7 @@ initTheme();
|
|
|
3170
3359
|
getCountryCodePhone,
|
|
3171
3360
|
getDialPhone,
|
|
3172
3361
|
getMonthCalendar,
|
|
3362
|
+
getMonthCalendarProps,
|
|
3173
3363
|
getNumberPhone,
|
|
3174
3364
|
hexToRgb,
|
|
3175
3365
|
initTheme,
|