@yr3/ui 1.0.5 → 1.0.7
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/Control/control.css +8 -0
- package/dist/components/Control/control.css.map +1 -1
- package/dist/components/Input/input.css +9 -20
- package/dist/components/Input/input.css.map +1 -1
- package/dist/components/Phone/phone.css +20 -0
- package/dist/components/Phone/phone.css.map +1 -0
- package/dist/components/Select/select.css +0 -23
- package/dist/components/Select/select.css.map +1 -1
- package/dist/components/Selector/selector.css +46 -0
- package/dist/components/Selector/selector.css.map +1 -0
- package/dist/components/Switch/switch.css +8 -6
- package/dist/components/Switch/switch.css.map +1 -1
- package/dist/index.cjs +303 -219
- package/dist/index.d.cts +82 -50
- package/dist/index.d.ts +82 -50
- package/dist/index.js +292 -213
- package/dist/styles/index.css +66 -26
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -83,9 +83,13 @@ __export(index_exports, {
|
|
|
83
83
|
createVariants: () => createVariants,
|
|
84
84
|
cx: () => cx,
|
|
85
85
|
getContrast: () => getContrast,
|
|
86
|
+
getCountryCodePhone: () => getCountryCodePhone,
|
|
87
|
+
getDialPhone: () => getDialPhone,
|
|
86
88
|
getMonthCalendar: () => getMonthCalendar,
|
|
89
|
+
getNumberPhone: () => getNumberPhone,
|
|
87
90
|
initTheme: () => initTheme,
|
|
88
91
|
isEmpty: () => isEmpty,
|
|
92
|
+
normalizePhone: () => normalizePhone,
|
|
89
93
|
text: () => text,
|
|
90
94
|
times: () => times,
|
|
91
95
|
uiStyle: () => uiStyle,
|
|
@@ -95,6 +99,7 @@ __export(index_exports, {
|
|
|
95
99
|
useControl: () => useControl,
|
|
96
100
|
useMediaQuery: () => useMediaQuery,
|
|
97
101
|
useNotistack: () => useNotistack,
|
|
102
|
+
usePlaces: () => usePlaces,
|
|
98
103
|
useTheme: () => useTheme
|
|
99
104
|
});
|
|
100
105
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -351,6 +356,48 @@ var createVariants = (config) => {
|
|
|
351
356
|
};
|
|
352
357
|
};
|
|
353
358
|
|
|
359
|
+
// src/utils/phone.ts
|
|
360
|
+
var normalizePhone = (phone, dial) => {
|
|
361
|
+
if (!phone) return null;
|
|
362
|
+
let clean = phone.replace(/[^\d+]/g, "");
|
|
363
|
+
let number = clean;
|
|
364
|
+
if (clean.startsWith(dial)) {
|
|
365
|
+
number = clean.slice(dial.length);
|
|
366
|
+
} else if (clean.startsWith("+")) {
|
|
367
|
+
const match = clean.match(/^\+\d{1,3}(.*)$/);
|
|
368
|
+
if (match) {
|
|
369
|
+
number = match[1];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
number = number.replace(/^0+/, "");
|
|
373
|
+
return {
|
|
374
|
+
number,
|
|
375
|
+
full: `${dial}${number}`
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
var getDialPhone = (phone, countries) => {
|
|
379
|
+
for (const country of countries) {
|
|
380
|
+
if (phone.startsWith(country.dial)) {
|
|
381
|
+
return country.dial;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return null;
|
|
385
|
+
};
|
|
386
|
+
var getCountryCodePhone = (phone, countries) => {
|
|
387
|
+
for (const country of countries) {
|
|
388
|
+
if (phone.startsWith(country.dial)) {
|
|
389
|
+
return country.code;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return null;
|
|
393
|
+
};
|
|
394
|
+
var getNumberPhone = (phone, dial) => {
|
|
395
|
+
if (phone.startsWith(dial)) {
|
|
396
|
+
return phone.slice(dial.length);
|
|
397
|
+
}
|
|
398
|
+
return phone;
|
|
399
|
+
};
|
|
400
|
+
|
|
354
401
|
// src/theme/breakpoint.ts
|
|
355
402
|
var breakpoints = {
|
|
356
403
|
xs: 0,
|
|
@@ -817,7 +864,8 @@ var initalPropsComponent = {
|
|
|
817
864
|
color: "primary",
|
|
818
865
|
bordered: true,
|
|
819
866
|
ui: {},
|
|
820
|
-
style: {}
|
|
867
|
+
style: {},
|
|
868
|
+
component: null
|
|
821
869
|
},
|
|
822
870
|
buttonNext: {
|
|
823
871
|
disabled: false,
|
|
@@ -863,7 +911,7 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
863
911
|
children: (0, import_dayjs2.default)().day(i + 1).format("dd")
|
|
864
912
|
}
|
|
865
913
|
) }, `month_day_${i}`)),
|
|
866
|
-
times(program.calendar.length, (i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
914
|
+
times(program.calendar.length, (i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
867
915
|
"div",
|
|
868
916
|
{
|
|
869
917
|
className: calendarDayVariants({
|
|
@@ -885,14 +933,17 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
885
933
|
setSelected(program.calendar[i][j]);
|
|
886
934
|
}
|
|
887
935
|
},
|
|
888
|
-
children:
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
936
|
+
children: [
|
|
937
|
+
program.calendar[i][j]?.data && propsComponent?.day?.component ? propsComponent.day.component : null,
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
939
|
+
Text,
|
|
940
|
+
{
|
|
941
|
+
variant: "body2",
|
|
942
|
+
color: program.calendar[i][j]?.isFuture ? "text" : "text",
|
|
943
|
+
children: program.calendar[i][j]?.day || ""
|
|
944
|
+
}
|
|
945
|
+
)
|
|
946
|
+
]
|
|
896
947
|
},
|
|
897
948
|
`day-${i}-${j}`
|
|
898
949
|
)) }, i))
|
|
@@ -1104,6 +1155,7 @@ var Control = ({
|
|
|
1104
1155
|
style,
|
|
1105
1156
|
ui,
|
|
1106
1157
|
color = "primary",
|
|
1158
|
+
size = "auto",
|
|
1107
1159
|
label = true
|
|
1108
1160
|
}) => {
|
|
1109
1161
|
const [focused, setFocused] = React7.useState(false);
|
|
@@ -1113,7 +1165,7 @@ var Control = ({
|
|
|
1113
1165
|
error,
|
|
1114
1166
|
disabled
|
|
1115
1167
|
};
|
|
1116
|
-
const classes = controlVariants({ variant, color, label });
|
|
1168
|
+
const classes = controlVariants({ variant, color, label, size });
|
|
1117
1169
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ControlContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1118
1170
|
"div",
|
|
1119
1171
|
{
|
|
@@ -1595,7 +1647,8 @@ var initiaPropsComponent = {
|
|
|
1595
1647
|
display: true,
|
|
1596
1648
|
ui: {},
|
|
1597
1649
|
style: {}
|
|
1598
|
-
}
|
|
1650
|
+
},
|
|
1651
|
+
control: {}
|
|
1599
1652
|
};
|
|
1600
1653
|
var Input = React12.forwardRef(
|
|
1601
1654
|
({
|
|
@@ -1610,11 +1663,11 @@ var Input = React12.forwardRef(
|
|
|
1610
1663
|
propsComponent = initiaPropsComponent,
|
|
1611
1664
|
type = "text",
|
|
1612
1665
|
color = "primary",
|
|
1666
|
+
size = "auto",
|
|
1613
1667
|
...props
|
|
1614
1668
|
}, ref) => {
|
|
1615
1669
|
const [focused, setFocused] = React12.useState(false);
|
|
1616
1670
|
const [internalValue, setInternalValue] = React12.useState(defaultValue);
|
|
1617
|
-
const [internalError, setInternalError] = React12.useState(null);
|
|
1618
1671
|
const isControlled = value !== void 0;
|
|
1619
1672
|
const currentValue = isControlled ? value : internalValue;
|
|
1620
1673
|
const isActive = focused || !!currentValue;
|
|
@@ -1632,19 +1685,13 @@ var Input = React12.forwardRef(
|
|
|
1632
1685
|
};
|
|
1633
1686
|
const handleChange = (e) => {
|
|
1634
1687
|
const newValue = e.target.value;
|
|
1635
|
-
const isValid = checkPattern(type, newValue);
|
|
1636
|
-
if (!isValid) {
|
|
1637
|
-
setInternalError("Valore non valido");
|
|
1638
|
-
} else {
|
|
1639
|
-
setInternalError(null);
|
|
1640
|
-
}
|
|
1641
1688
|
if (!isControlled) {
|
|
1642
1689
|
setInternalValue(newValue);
|
|
1643
1690
|
}
|
|
1644
1691
|
onChange?.(e, newValue);
|
|
1645
1692
|
};
|
|
1646
1693
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1647
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, children: [
|
|
1694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, ...propsComponent.control, children: [
|
|
1648
1695
|
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1649
1696
|
Label,
|
|
1650
1697
|
{
|
|
@@ -1662,6 +1709,7 @@ var Input = React12.forwardRef(
|
|
|
1662
1709
|
type,
|
|
1663
1710
|
autoComplete: "off",
|
|
1664
1711
|
onChange: handleChange,
|
|
1712
|
+
onKeyDown: (e) => checkPattern(type, e.key),
|
|
1665
1713
|
onFocus: () => setFocused(true),
|
|
1666
1714
|
onBlur: () => setFocused(false),
|
|
1667
1715
|
className: classes,
|
|
@@ -1669,144 +1717,13 @@ var Input = React12.forwardRef(
|
|
|
1669
1717
|
...props,
|
|
1670
1718
|
"data-testid": "yr3Input"
|
|
1671
1719
|
}
|
|
1672
|
-
)
|
|
1673
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { variant: "helper", "data-testid": "yr3Input-helper", children: error || internalError || "" })
|
|
1720
|
+
)
|
|
1674
1721
|
] });
|
|
1675
1722
|
}
|
|
1676
1723
|
);
|
|
1677
1724
|
|
|
1678
|
-
// src/components/Input/InputPhone.tsx
|
|
1679
|
-
var React15 = __toESM(require("react"), 1);
|
|
1680
|
-
|
|
1681
|
-
// src/components/Select/Selector.tsx
|
|
1682
|
-
var React13 = __toESM(require("react"), 1);
|
|
1683
|
-
|
|
1684
|
-
// src/Icons/IconDown.tsx
|
|
1685
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1686
|
-
var IconDown = (props) => {
|
|
1687
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsx)("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1688
|
-
};
|
|
1689
|
-
|
|
1690
|
-
// src/components/Select/Selector.tsx
|
|
1691
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1692
|
-
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon }) => {
|
|
1693
|
-
const [open, setOpen] = React13.useState(false);
|
|
1694
|
-
const [valueState, setValueState] = React13.useState(value || defaultValue || null);
|
|
1695
|
-
const ref = React13.useRef(null);
|
|
1696
|
-
useClickAway(ref, () => setOpen(false));
|
|
1697
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
1698
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "yr3Selector--control", children: [
|
|
1699
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
1700
|
-
valueState
|
|
1701
|
-
] }) }),
|
|
1702
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "yr3Select--menu", children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1703
|
-
"div",
|
|
1704
|
-
{
|
|
1705
|
-
className: "yr3Select--option",
|
|
1706
|
-
onClick: (e) => {
|
|
1707
|
-
e.stopPropagation();
|
|
1708
|
-
setValueState(opt.value);
|
|
1709
|
-
setOpen(false);
|
|
1710
|
-
const event = {
|
|
1711
|
-
event: e,
|
|
1712
|
-
target: {
|
|
1713
|
-
name,
|
|
1714
|
-
value: opt.value
|
|
1715
|
-
},
|
|
1716
|
-
currentTarget: {
|
|
1717
|
-
name,
|
|
1718
|
-
value: opt.value
|
|
1719
|
-
}
|
|
1720
|
-
};
|
|
1721
|
-
onChange?.(event, opt.value);
|
|
1722
|
-
},
|
|
1723
|
-
children: opt.label
|
|
1724
|
-
},
|
|
1725
|
-
opt.value
|
|
1726
|
-
)) })
|
|
1727
|
-
] });
|
|
1728
|
-
};
|
|
1729
|
-
var Selector_default = Selector;
|
|
1730
|
-
|
|
1731
|
-
// src/theme/ThemeProvider.tsx
|
|
1732
|
-
var React14 = __toESM(require("react"), 1);
|
|
1733
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1734
|
-
var ThemeContext = React14.createContext(null);
|
|
1735
|
-
var ThemeProvider = ({ theme, children }) => {
|
|
1736
|
-
React14.useEffect(() => {
|
|
1737
|
-
applyTheme(theme);
|
|
1738
|
-
}, [theme]);
|
|
1739
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BackdropProvider, { children }) });
|
|
1740
|
-
};
|
|
1741
|
-
var useTheme = () => React14.useContext(ThemeContext);
|
|
1742
|
-
|
|
1743
|
-
// src/components/Input/InputPhone.tsx
|
|
1744
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1745
|
-
var Phone = ({
|
|
1746
|
-
name,
|
|
1747
|
-
value,
|
|
1748
|
-
onChange,
|
|
1749
|
-
prefix = "+39",
|
|
1750
|
-
label = "Phone",
|
|
1751
|
-
countries = [],
|
|
1752
|
-
propsComponent
|
|
1753
|
-
}) => {
|
|
1754
|
-
const [prefixValue, setPrefixValue] = React15.useState(prefix);
|
|
1755
|
-
const [number, setNumber] = React15.useState(Number(value) || null);
|
|
1756
|
-
const theme = useTheme();
|
|
1757
|
-
const handleChange = (newPrefix, newNumber) => {
|
|
1758
|
-
const full = `${newPrefix}${newNumber.toString()}`;
|
|
1759
|
-
const event = {
|
|
1760
|
-
target: {
|
|
1761
|
-
name,
|
|
1762
|
-
value: full
|
|
1763
|
-
}
|
|
1764
|
-
};
|
|
1765
|
-
onChange?.(event, full);
|
|
1766
|
-
};
|
|
1767
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Control, { variant: "outlined", children: [
|
|
1768
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
1769
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "yr3PhoneInput", "data-testid": "yr3Phone", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { variant: "row", container: true, center: true, children: [
|
|
1770
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1771
|
-
Selector_default,
|
|
1772
|
-
{
|
|
1773
|
-
options: countries.map((c) => ({
|
|
1774
|
-
value: c.dial,
|
|
1775
|
-
label: c.code
|
|
1776
|
-
})),
|
|
1777
|
-
value: prefixValue,
|
|
1778
|
-
onChange: (_, val) => {
|
|
1779
|
-
setPrefixValue(val);
|
|
1780
|
-
handleChange(val, number);
|
|
1781
|
-
},
|
|
1782
|
-
...propsComponent?.selector,
|
|
1783
|
-
ui: {
|
|
1784
|
-
...propsComponent?.selector?.ui,
|
|
1785
|
-
padding: 4
|
|
1786
|
-
},
|
|
1787
|
-
style: propsComponent?.selector?.style
|
|
1788
|
-
}
|
|
1789
|
-
),
|
|
1790
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Divider, { orientation: "vertical", ...propsComponent?.divider }),
|
|
1791
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1792
|
-
Input,
|
|
1793
|
-
{
|
|
1794
|
-
type: "phone",
|
|
1795
|
-
variant: "base",
|
|
1796
|
-
value: number,
|
|
1797
|
-
...propsComponent?.input,
|
|
1798
|
-
onChange: (e, value2) => {
|
|
1799
|
-
setNumber(value2);
|
|
1800
|
-
handleChange(prefixValue, value2);
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
)
|
|
1804
|
-
] }) })
|
|
1805
|
-
] });
|
|
1806
|
-
};
|
|
1807
|
-
|
|
1808
1725
|
// src/components/InputArea/InputArea.tsx
|
|
1809
|
-
var
|
|
1726
|
+
var React13 = __toESM(require("react"), 1);
|
|
1810
1727
|
|
|
1811
1728
|
// src/components/InputArea/inputAreaVariants.ts
|
|
1812
1729
|
var inputAreaVariants = createVariants({
|
|
@@ -1842,7 +1759,7 @@ var inputAreaVariants = createVariants({
|
|
|
1842
1759
|
});
|
|
1843
1760
|
|
|
1844
1761
|
// src/components/InputArea/InputArea.tsx
|
|
1845
|
-
var
|
|
1762
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1846
1763
|
var initiaPropsComponent2 = {
|
|
1847
1764
|
label: {
|
|
1848
1765
|
display: true,
|
|
@@ -1867,8 +1784,8 @@ var InputArea = ({
|
|
|
1867
1784
|
rounded = false,
|
|
1868
1785
|
propsComponent = initiaPropsComponent2
|
|
1869
1786
|
}) => {
|
|
1870
|
-
const ref =
|
|
1871
|
-
const [internalValue, setInternalValue] =
|
|
1787
|
+
const ref = React13.useRef(null);
|
|
1788
|
+
const [internalValue, setInternalValue] = React13.useState(defaultValue);
|
|
1872
1789
|
const isControlled = value !== void 0;
|
|
1873
1790
|
const currentValue = isControlled ? value : internalValue;
|
|
1874
1791
|
const handleChange = (e) => {
|
|
@@ -1885,8 +1802,8 @@ var InputArea = ({
|
|
|
1885
1802
|
el.style.resize = resize;
|
|
1886
1803
|
}
|
|
1887
1804
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
1888
|
-
return /* @__PURE__ */ (0,
|
|
1889
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
1805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { position: "relative" }, children: [
|
|
1806
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1890
1807
|
Label,
|
|
1891
1808
|
{
|
|
1892
1809
|
text: label || "",
|
|
@@ -1894,7 +1811,7 @@ var InputArea = ({
|
|
|
1894
1811
|
...propsComponent.label
|
|
1895
1812
|
}
|
|
1896
1813
|
),
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1898
1815
|
"textarea",
|
|
1899
1816
|
{
|
|
1900
1817
|
className: classes,
|
|
@@ -1906,26 +1823,26 @@ var InputArea = ({
|
|
|
1906
1823
|
"data-testid": "yr3InputArea"
|
|
1907
1824
|
}
|
|
1908
1825
|
),
|
|
1909
|
-
/* @__PURE__ */ (0,
|
|
1826
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { variant: "helper", color: currentValue.length > maxLength ? "error" : "disabled", ui: { textAlign: "right" }, "data-testid": "yr3InputAreaError", children: validate && maxLength ? `${currentValue.length}/${maxLength}` || propsComponent.helperText : "" })
|
|
1910
1827
|
] });
|
|
1911
1828
|
};
|
|
1912
1829
|
|
|
1913
1830
|
// src/components/Modal/Modal.tsx
|
|
1914
|
-
var
|
|
1831
|
+
var React14 = __toESM(require("react"), 1);
|
|
1915
1832
|
|
|
1916
1833
|
// src/components/Modal/ModalContainer.tsx
|
|
1917
|
-
var
|
|
1834
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1918
1835
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
1919
1836
|
const classes = bem("yr3Modal-container");
|
|
1920
1837
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
1921
|
-
return /* @__PURE__ */ (0,
|
|
1838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
1922
1839
|
};
|
|
1923
1840
|
|
|
1924
1841
|
// src/components/Modal/Modal.tsx
|
|
1925
|
-
var
|
|
1842
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1926
1843
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
1927
1844
|
const { show, hide } = useBackdrop();
|
|
1928
|
-
|
|
1845
|
+
React14.useEffect(() => {
|
|
1929
1846
|
if (open) {
|
|
1930
1847
|
show();
|
|
1931
1848
|
} else {
|
|
@@ -1934,9 +1851,9 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
1934
1851
|
}, [open, show]);
|
|
1935
1852
|
const classes = bem("yr3Modal");
|
|
1936
1853
|
const classComponent = classes(void 0, { "open": !!open });
|
|
1937
|
-
return /* @__PURE__ */ (0,
|
|
1854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
|
|
1938
1855
|
children,
|
|
1939
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0,
|
|
1856
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
1940
1857
|
] }) }) });
|
|
1941
1858
|
};
|
|
1942
1859
|
|
|
@@ -1976,15 +1893,15 @@ var notistackVariants = createVariants({
|
|
|
1976
1893
|
});
|
|
1977
1894
|
|
|
1978
1895
|
// src/components/Notistack/Notistack.tsx
|
|
1979
|
-
var
|
|
1896
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1980
1897
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
1981
1898
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
1982
1899
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
1983
1900
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
1984
1901
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
1985
|
-
return /* @__PURE__ */ (0,
|
|
1986
|
-
/* @__PURE__ */ (0,
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
1902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: containerStyle, children: message }),
|
|
1904
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1988
1905
|
"div",
|
|
1989
1906
|
{
|
|
1990
1907
|
className: "yr3Notistack--progress",
|
|
@@ -2018,7 +1935,7 @@ var pendingVariants = createVariants({
|
|
|
2018
1935
|
});
|
|
2019
1936
|
|
|
2020
1937
|
// src/components/Pending/Pending.tsx
|
|
2021
|
-
var
|
|
1938
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2022
1939
|
var Pending = ({
|
|
2023
1940
|
variant,
|
|
2024
1941
|
width,
|
|
@@ -2031,7 +1948,7 @@ var Pending = ({
|
|
|
2031
1948
|
const widthStyle = variant === "circle" ? size : width;
|
|
2032
1949
|
const heightStyle = variant === "circle" ? size : height;
|
|
2033
1950
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
2034
|
-
return /* @__PURE__ */ (0,
|
|
1951
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2035
1952
|
"div",
|
|
2036
1953
|
{
|
|
2037
1954
|
className: pendingVariants({ variant, color }),
|
|
@@ -2041,10 +1958,151 @@ var Pending = ({
|
|
|
2041
1958
|
);
|
|
2042
1959
|
};
|
|
2043
1960
|
|
|
1961
|
+
// src/components/Phone/Phone.tsx
|
|
1962
|
+
var React16 = __toESM(require("react"), 1);
|
|
1963
|
+
|
|
1964
|
+
// src/components/Selector/Selector.tsx
|
|
1965
|
+
var React15 = __toESM(require("react"), 1);
|
|
1966
|
+
|
|
1967
|
+
// src/Icons/IconDown.tsx
|
|
1968
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1969
|
+
var IconDown = (props) => {
|
|
1970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1971
|
+
};
|
|
1972
|
+
|
|
1973
|
+
// src/components/Selector/Selector.tsx
|
|
1974
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1975
|
+
var initalPropsComponent2 = {
|
|
1976
|
+
text: {
|
|
1977
|
+
variant: "caption",
|
|
1978
|
+
color: "primary",
|
|
1979
|
+
children: void 0
|
|
1980
|
+
},
|
|
1981
|
+
menu: {
|
|
1982
|
+
ui: {},
|
|
1983
|
+
style: {}
|
|
1984
|
+
}
|
|
1985
|
+
};
|
|
1986
|
+
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
|
|
1987
|
+
const [open, setOpen] = React15.useState(false);
|
|
1988
|
+
const [valueState, setValueState] = React15.useState(value || defaultValue || null);
|
|
1989
|
+
const ref = React15.useRef(null);
|
|
1990
|
+
useClickAway(ref, () => setOpen(false));
|
|
1991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
1992
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "yr3Selector--control", children: [
|
|
1993
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
|
|
1994
|
+
valueState
|
|
1995
|
+
] }) }),
|
|
1996
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "yr3Selector--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1997
|
+
"div",
|
|
1998
|
+
{
|
|
1999
|
+
className: "yr3Selector--option",
|
|
2000
|
+
onClick: (e) => {
|
|
2001
|
+
e.stopPropagation();
|
|
2002
|
+
setValueState(opt.value);
|
|
2003
|
+
setOpen(false);
|
|
2004
|
+
const event = {
|
|
2005
|
+
event: e,
|
|
2006
|
+
target: {
|
|
2007
|
+
name,
|
|
2008
|
+
value: opt.value
|
|
2009
|
+
},
|
|
2010
|
+
currentTarget: {
|
|
2011
|
+
name,
|
|
2012
|
+
value: opt.value
|
|
2013
|
+
}
|
|
2014
|
+
};
|
|
2015
|
+
onChange?.(event, opt.value);
|
|
2016
|
+
},
|
|
2017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { ...propsComponent?.text, children: propsComponent?.text?.children || opt.label })
|
|
2018
|
+
},
|
|
2019
|
+
opt.value
|
|
2020
|
+
)) })
|
|
2021
|
+
] });
|
|
2022
|
+
};
|
|
2023
|
+
var Selector_default = Selector;
|
|
2024
|
+
|
|
2025
|
+
// src/components/Phone/Phone.tsx
|
|
2026
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2027
|
+
var Phone = ({
|
|
2028
|
+
name,
|
|
2029
|
+
value,
|
|
2030
|
+
onChange,
|
|
2031
|
+
label = "Phone",
|
|
2032
|
+
countries,
|
|
2033
|
+
propsComponent,
|
|
2034
|
+
defaultValue
|
|
2035
|
+
}) => {
|
|
2036
|
+
const isControlled = value !== void 0;
|
|
2037
|
+
const initial = value || defaultValue || "";
|
|
2038
|
+
const [prefix, setPrefix] = React16.useState(
|
|
2039
|
+
getDialPhone(initial, countries) || countries[0].dial
|
|
2040
|
+
);
|
|
2041
|
+
const [number, setNumber] = React16.useState(
|
|
2042
|
+
getNumberPhone(initial, prefix) || ""
|
|
2043
|
+
);
|
|
2044
|
+
React16.useEffect(() => {
|
|
2045
|
+
if (isControlled && value) {
|
|
2046
|
+
const dial = getDialPhone(value, countries);
|
|
2047
|
+
const num = getNumberPhone(value, dial);
|
|
2048
|
+
setPrefix(dial);
|
|
2049
|
+
setNumber(num);
|
|
2050
|
+
}
|
|
2051
|
+
}, [value]);
|
|
2052
|
+
const handleNumberChange = (e, val) => {
|
|
2053
|
+
const clean = val.replace(/[^\d]/g, "");
|
|
2054
|
+
if (!isControlled) {
|
|
2055
|
+
setNumber(clean);
|
|
2056
|
+
}
|
|
2057
|
+
onChange?.(e, `${prefix}${clean}`);
|
|
2058
|
+
};
|
|
2059
|
+
const handlePrefixChange = (_, val) => {
|
|
2060
|
+
setPrefix(val);
|
|
2061
|
+
onChange?.(null, `${val}${number}`);
|
|
2062
|
+
};
|
|
2063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { variant: "row", container: true, center: true, children: [
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2067
|
+
Selector_default,
|
|
2068
|
+
{
|
|
2069
|
+
options: countries.map((c) => ({
|
|
2070
|
+
value: c.dial,
|
|
2071
|
+
label: c.code
|
|
2072
|
+
})),
|
|
2073
|
+
value: prefix,
|
|
2074
|
+
onChange: handlePrefixChange,
|
|
2075
|
+
...propsComponent?.selector
|
|
2076
|
+
}
|
|
2077
|
+
),
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2079
|
+
Divider,
|
|
2080
|
+
{
|
|
2081
|
+
orientation: "vertical",
|
|
2082
|
+
color: "primary",
|
|
2083
|
+
ui: { height: 49 },
|
|
2084
|
+
...propsComponent?.divider
|
|
2085
|
+
}
|
|
2086
|
+
),
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2088
|
+
Input,
|
|
2089
|
+
{
|
|
2090
|
+
type: "number",
|
|
2091
|
+
name,
|
|
2092
|
+
value: number,
|
|
2093
|
+
variant: "base",
|
|
2094
|
+
...propsComponent?.input,
|
|
2095
|
+
onChange: handleNumberChange
|
|
2096
|
+
}
|
|
2097
|
+
)
|
|
2098
|
+
] })
|
|
2099
|
+
] });
|
|
2100
|
+
};
|
|
2101
|
+
|
|
2044
2102
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
2045
|
-
var
|
|
2103
|
+
var React17 = __toESM(require("react"), 1);
|
|
2046
2104
|
var import_autocomplete_places = require("@yr3/autocomplete-places");
|
|
2047
|
-
var
|
|
2105
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2048
2106
|
var initPropsComponent = {
|
|
2049
2107
|
label: {
|
|
2050
2108
|
display: true,
|
|
@@ -2084,9 +2142,9 @@ var PlacesAutocomplete = ({
|
|
|
2084
2142
|
keyApi,
|
|
2085
2143
|
propsComponent = initPropsComponent
|
|
2086
2144
|
}) => {
|
|
2087
|
-
const [value, setValue] =
|
|
2088
|
-
const inputRef =
|
|
2089
|
-
const [anchorEl, setAnchorEl] =
|
|
2145
|
+
const [value, setValue] = React17.useState(null);
|
|
2146
|
+
const inputRef = React17.useRef(null);
|
|
2147
|
+
const [anchorEl, setAnchorEl] = React17.useState(null);
|
|
2090
2148
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
2091
2149
|
const handleSelect = async (id) => {
|
|
2092
2150
|
const place = await selectPlace(id);
|
|
@@ -2106,12 +2164,12 @@ var PlacesAutocomplete = ({
|
|
|
2106
2164
|
setValue(place.address);
|
|
2107
2165
|
setAnchorEl(null);
|
|
2108
2166
|
};
|
|
2109
|
-
|
|
2167
|
+
React17.useEffect(() => {
|
|
2110
2168
|
if (defaultLocation) {
|
|
2111
2169
|
setValue(defaultLocation);
|
|
2112
2170
|
}
|
|
2113
2171
|
}, [defaultLocation]);
|
|
2114
|
-
|
|
2172
|
+
React17.useEffect(() => {
|
|
2115
2173
|
if (value === "") {
|
|
2116
2174
|
onSelect(null);
|
|
2117
2175
|
}
|
|
@@ -2121,13 +2179,13 @@ var PlacesAutocomplete = ({
|
|
|
2121
2179
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2122
2180
|
};
|
|
2123
2181
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2124
|
-
|
|
2182
|
+
React17.useEffect(() => {
|
|
2125
2183
|
if (onChangeForm) {
|
|
2126
2184
|
onChangeForm({ target: { value } });
|
|
2127
2185
|
}
|
|
2128
2186
|
}, [onChangeForm]);
|
|
2129
|
-
return /* @__PURE__ */ (0,
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2131
2189
|
Input,
|
|
2132
2190
|
{
|
|
2133
2191
|
ref: inputRef,
|
|
@@ -2141,7 +2199,7 @@ var PlacesAutocomplete = ({
|
|
|
2141
2199
|
},
|
|
2142
2200
|
"input-places"
|
|
2143
2201
|
),
|
|
2144
|
-
open && /* @__PURE__ */ (0,
|
|
2202
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "yr3Places--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent?.menu?.style), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Flex, { container: true, ui: { p: 1 }, children: suggestions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Flex, { onClick: () => handleSelect(s.id), ui: { padding: 8, cursor: "pointer", "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" } }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { ...propsComponent?.menu?.text, children: s.description }) }, s.id)) }) })
|
|
2145
2203
|
] });
|
|
2146
2204
|
};
|
|
2147
2205
|
|
|
@@ -2164,7 +2222,7 @@ var radioVariant = createVariants({
|
|
|
2164
2222
|
});
|
|
2165
2223
|
|
|
2166
2224
|
// src/components/Radio/Radio.tsx
|
|
2167
|
-
var
|
|
2225
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2168
2226
|
var Radio = ({
|
|
2169
2227
|
checked,
|
|
2170
2228
|
value,
|
|
@@ -2180,8 +2238,8 @@ var Radio = ({
|
|
|
2180
2238
|
const bemClass = bem("yr3Radio");
|
|
2181
2239
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2182
2240
|
const variantClass = radioVariant({ variant });
|
|
2183
|
-
return /* @__PURE__ */ (0,
|
|
2184
|
-
/* @__PURE__ */ (0,
|
|
2241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2242
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2185
2243
|
"input",
|
|
2186
2244
|
{
|
|
2187
2245
|
type: "radio",
|
|
@@ -2193,8 +2251,8 @@ var Radio = ({
|
|
|
2193
2251
|
}
|
|
2194
2252
|
),
|
|
2195
2253
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2196
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0,
|
|
2197
|
-
typeof label === "string" && /* @__PURE__ */ (0,
|
|
2254
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2255
|
+
typeof label === "string" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2198
2256
|
"span",
|
|
2199
2257
|
{
|
|
2200
2258
|
className: "yr3Radio--label",
|
|
@@ -2207,26 +2265,25 @@ var Radio = ({
|
|
|
2207
2265
|
};
|
|
2208
2266
|
|
|
2209
2267
|
// src/components/Select/Select.tsx
|
|
2210
|
-
var
|
|
2211
|
-
var
|
|
2268
|
+
var React18 = __toESM(require("react"), 1);
|
|
2269
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2212
2270
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2213
|
-
const [open, setOpen] =
|
|
2214
|
-
const [valueState, setValueState] =
|
|
2215
|
-
const ref =
|
|
2271
|
+
const [open, setOpen] = React18.useState(false);
|
|
2272
|
+
const [valueState, setValueState] = React18.useState(value || defaultValue || null);
|
|
2273
|
+
const ref = React18.useRef(null);
|
|
2216
2274
|
useClickAway(ref, () => setOpen(false));
|
|
2217
|
-
return /* @__PURE__ */ (0,
|
|
2218
|
-
/* @__PURE__ */ (0,
|
|
2275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2219
2277
|
Label,
|
|
2220
2278
|
{
|
|
2221
2279
|
...propsComponent?.label,
|
|
2222
|
-
text: label || "seleziona"
|
|
2223
|
-
className: open || valueState ? "yr3Input--active" : ""
|
|
2280
|
+
text: label || "seleziona"
|
|
2224
2281
|
}
|
|
2225
2282
|
),
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2227
|
-
/* @__PURE__ */ (0,
|
|
2228
|
-
/* @__PURE__ */ (0,
|
|
2229
|
-
/* @__PURE__ */ (0,
|
|
2283
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "yr3Select-wrapper", ref, children: [
|
|
2284
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: `yr3Select ${open ? "yr3Select--open" : ""}`, "data-testid": "yr3Select-wrapper", style: composeStyles(propsComponent?.wrapper?.ui, propsComponent?.wrapper?.style), children: [
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "yr3Select--control", children: valueState }),
|
|
2286
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "yr3Select--icon", onClick: () => setOpen((prev) => !prev), "data-testid": "yr3Select-icon", children: propsComponent?.icon?.component ? propsComponent.icon.component : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2230
2287
|
IconDown,
|
|
2231
2288
|
{
|
|
2232
2289
|
width: propsComponent?.icon?.style?.width || 26,
|
|
@@ -2236,13 +2293,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2236
2293
|
}
|
|
2237
2294
|
) })
|
|
2238
2295
|
] }),
|
|
2239
|
-
open && /* @__PURE__ */ (0,
|
|
2296
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2240
2297
|
"div",
|
|
2241
2298
|
{
|
|
2242
2299
|
className: "yr3Select--menu",
|
|
2243
2300
|
style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
|
|
2244
2301
|
"data-testid": "yr3Select-menu",
|
|
2245
|
-
children: options.map((opt) => /* @__PURE__ */ (0,
|
|
2302
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2246
2303
|
"div",
|
|
2247
2304
|
{
|
|
2248
2305
|
className: "yr3Select--option",
|
|
@@ -2274,8 +2331,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2274
2331
|
};
|
|
2275
2332
|
|
|
2276
2333
|
// src/components/Slide/Slide.tsx
|
|
2277
|
-
var
|
|
2278
|
-
var
|
|
2334
|
+
var React19 = __toESM(require("react"), 1);
|
|
2335
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2279
2336
|
var Slide = ({
|
|
2280
2337
|
in: inProp,
|
|
2281
2338
|
children,
|
|
@@ -2289,7 +2346,7 @@ var Slide = ({
|
|
|
2289
2346
|
[direction]: true,
|
|
2290
2347
|
"in": !!inProp
|
|
2291
2348
|
});
|
|
2292
|
-
|
|
2349
|
+
React19.useEffect(() => {
|
|
2293
2350
|
let timeoutId;
|
|
2294
2351
|
if (inProp) {
|
|
2295
2352
|
timeoutId = setTimeout(() => {
|
|
@@ -2299,19 +2356,19 @@ var Slide = ({
|
|
|
2299
2356
|
return () => clearTimeout(timeoutId);
|
|
2300
2357
|
}, [inProp, duration, onTransitionEnd]);
|
|
2301
2358
|
const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2302
|
-
return /* @__PURE__ */ (0,
|
|
2359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2303
2360
|
"div",
|
|
2304
2361
|
{
|
|
2305
2362
|
className: "yr3Slide",
|
|
2306
2363
|
style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
|
|
2307
2364
|
"data-testid": "yr3Slide",
|
|
2308
|
-
children: /* @__PURE__ */ (0,
|
|
2365
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2309
2366
|
"div",
|
|
2310
2367
|
{
|
|
2311
2368
|
className: classNameContent,
|
|
2312
2369
|
style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
|
|
2313
2370
|
"data-testid": "yr3Slide-content",
|
|
2314
|
-
children: /* @__PURE__ */ (0,
|
|
2371
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
|
|
2315
2372
|
}
|
|
2316
2373
|
)
|
|
2317
2374
|
}
|
|
@@ -2319,7 +2376,7 @@ var Slide = ({
|
|
|
2319
2376
|
};
|
|
2320
2377
|
|
|
2321
2378
|
// src/components/Switch/Switch.tsx
|
|
2322
|
-
var
|
|
2379
|
+
var React20 = __toESM(require("react"), 1);
|
|
2323
2380
|
|
|
2324
2381
|
// src/components/Switch/switch.variants.ts
|
|
2325
2382
|
var switchVariants = createVariants({
|
|
@@ -2348,7 +2405,7 @@ var switchVariants = createVariants({
|
|
|
2348
2405
|
});
|
|
2349
2406
|
|
|
2350
2407
|
// src/components/Switch/Switch.tsx
|
|
2351
|
-
var
|
|
2408
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2352
2409
|
var Switch = ({
|
|
2353
2410
|
checked,
|
|
2354
2411
|
defaultChecked,
|
|
@@ -2358,7 +2415,7 @@ var Switch = ({
|
|
|
2358
2415
|
size = "sm",
|
|
2359
2416
|
label
|
|
2360
2417
|
}) => {
|
|
2361
|
-
const [internal, setInternal] =
|
|
2418
|
+
const [internal, setInternal] = React20.useState(defaultChecked || false);
|
|
2362
2419
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
|
|
2363
2420
|
const isControlled = checked !== void 0;
|
|
2364
2421
|
const value = isControlled ? checked : internal;
|
|
@@ -2366,13 +2423,13 @@ var Switch = ({
|
|
|
2366
2423
|
if (!isControlled) setInternal(e.target.checked);
|
|
2367
2424
|
onChange?.(e, e.target.checked);
|
|
2368
2425
|
};
|
|
2369
|
-
return /* @__PURE__ */ (0,
|
|
2426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2370
2427
|
"label",
|
|
2371
2428
|
{
|
|
2372
2429
|
className: classname,
|
|
2373
2430
|
"data-testid": "yr3Switch",
|
|
2374
2431
|
children: [
|
|
2375
|
-
/* @__PURE__ */ (0,
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2376
2433
|
"input",
|
|
2377
2434
|
{
|
|
2378
2435
|
type: "checkbox",
|
|
@@ -2381,17 +2438,17 @@ var Switch = ({
|
|
|
2381
2438
|
disabled
|
|
2382
2439
|
}
|
|
2383
2440
|
),
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2385
|
-
/* @__PURE__ */ (0,
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
2442
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--label", "data-testid": "yr3Switch-label", children: label })
|
|
2386
2443
|
]
|
|
2387
2444
|
}
|
|
2388
2445
|
);
|
|
2389
2446
|
};
|
|
2390
2447
|
|
|
2391
2448
|
// src/Icons/IconSearch.tsx
|
|
2392
|
-
var
|
|
2449
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2393
2450
|
var IconSearch = (props) => {
|
|
2394
|
-
return /* @__PURE__ */ (0,
|
|
2451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.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_runtime38.jsx)(
|
|
2395
2452
|
"path",
|
|
2396
2453
|
{
|
|
2397
2454
|
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",
|
|
@@ -2403,6 +2460,18 @@ var IconSearch = (props) => {
|
|
|
2403
2460
|
) });
|
|
2404
2461
|
};
|
|
2405
2462
|
|
|
2463
|
+
// src/theme/ThemeProvider.tsx
|
|
2464
|
+
var React21 = __toESM(require("react"), 1);
|
|
2465
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2466
|
+
var ThemeContext = React21.createContext(null);
|
|
2467
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2468
|
+
React21.useEffect(() => {
|
|
2469
|
+
applyTheme(theme);
|
|
2470
|
+
}, [theme]);
|
|
2471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BackdropProvider, { children }) });
|
|
2472
|
+
};
|
|
2473
|
+
var useTheme = () => React21.useContext(ThemeContext);
|
|
2474
|
+
|
|
2406
2475
|
// src/theme/tokens.ts
|
|
2407
2476
|
var baseTokens = {
|
|
2408
2477
|
colors: {
|
|
@@ -2480,6 +2549,16 @@ function useBreakpointValue(values) {
|
|
|
2480
2549
|
return void 0;
|
|
2481
2550
|
}
|
|
2482
2551
|
|
|
2552
|
+
// src/hooks/usePlaces.ts
|
|
2553
|
+
var import_autocomplete_places2 = require("@yr3/autocomplete-places");
|
|
2554
|
+
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
2555
|
+
const { suggestions, selectPlace } = (0, import_autocomplete_places2.useAutocompletePlaces)({ apiKey, provider, language, input });
|
|
2556
|
+
return {
|
|
2557
|
+
suggestions,
|
|
2558
|
+
selectPlace
|
|
2559
|
+
};
|
|
2560
|
+
};
|
|
2561
|
+
|
|
2483
2562
|
// src/index.ts
|
|
2484
2563
|
initTheme();
|
|
2485
2564
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2537,9 +2616,13 @@ initTheme();
|
|
|
2537
2616
|
createVariants,
|
|
2538
2617
|
cx,
|
|
2539
2618
|
getContrast,
|
|
2619
|
+
getCountryCodePhone,
|
|
2620
|
+
getDialPhone,
|
|
2540
2621
|
getMonthCalendar,
|
|
2622
|
+
getNumberPhone,
|
|
2541
2623
|
initTheme,
|
|
2542
2624
|
isEmpty,
|
|
2625
|
+
normalizePhone,
|
|
2543
2626
|
text,
|
|
2544
2627
|
times,
|
|
2545
2628
|
uiStyle,
|
|
@@ -2549,5 +2632,6 @@ initTheme();
|
|
|
2549
2632
|
useControl,
|
|
2550
2633
|
useMediaQuery,
|
|
2551
2634
|
useNotistack,
|
|
2635
|
+
usePlaces,
|
|
2552
2636
|
useTheme
|
|
2553
2637
|
});
|