@yr3/ui 1.0.5 → 1.0.6
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/Input/input.css +0 -19
- 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 +47 -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 +274 -197
- package/dist/index.d.cts +63 -50
- package/dist/index.d.ts +63 -50
- package/dist/index.js +261 -190
- package/dist/styles/index.css +50 -25
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -83,9 +84,13 @@ __export(index_exports, {
|
|
|
83
84
|
createVariants: () => createVariants,
|
|
84
85
|
cx: () => cx,
|
|
85
86
|
getContrast: () => getContrast,
|
|
87
|
+
getCountryCodePhone: () => getCountryCodePhone,
|
|
88
|
+
getDialPhone: () => getDialPhone,
|
|
86
89
|
getMonthCalendar: () => getMonthCalendar,
|
|
90
|
+
getNumberPhone: () => getNumberPhone,
|
|
87
91
|
initTheme: () => initTheme,
|
|
88
92
|
isEmpty: () => isEmpty,
|
|
93
|
+
normalizePhone: () => normalizePhone,
|
|
89
94
|
text: () => text,
|
|
90
95
|
times: () => times,
|
|
91
96
|
uiStyle: () => uiStyle,
|
|
@@ -351,6 +356,49 @@ 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
|
+
console.log("checking", phone, "against", country.dial);
|
|
381
|
+
if (phone.startsWith(country.dial)) {
|
|
382
|
+
return country.dial;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return null;
|
|
386
|
+
};
|
|
387
|
+
var getCountryCodePhone = (phone, countries) => {
|
|
388
|
+
for (const country of countries) {
|
|
389
|
+
if (phone.startsWith(country.dial)) {
|
|
390
|
+
return country.code;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return null;
|
|
394
|
+
};
|
|
395
|
+
var getNumberPhone = (phone, dial) => {
|
|
396
|
+
if (phone.startsWith(dial)) {
|
|
397
|
+
return phone.slice(dial.length);
|
|
398
|
+
}
|
|
399
|
+
return phone;
|
|
400
|
+
};
|
|
401
|
+
|
|
354
402
|
// src/theme/breakpoint.ts
|
|
355
403
|
var breakpoints = {
|
|
356
404
|
xs: 0,
|
|
@@ -514,6 +562,9 @@ function initTheme() {
|
|
|
514
562
|
applyTheme(createTheme());
|
|
515
563
|
}
|
|
516
564
|
|
|
565
|
+
// src/index.ts
|
|
566
|
+
__reExport(index_exports, require("@yr3/autocomplete-places"), module.exports);
|
|
567
|
+
|
|
517
568
|
// src/components/Avatar/Avatar.tsx
|
|
518
569
|
var React = __toESM(require("react"), 1);
|
|
519
570
|
|
|
@@ -1670,143 +1721,13 @@ var Input = React12.forwardRef(
|
|
|
1670
1721
|
"data-testid": "yr3Input"
|
|
1671
1722
|
}
|
|
1672
1723
|
),
|
|
1673
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { variant: "helper", "data-testid": "yr3Input-helper", children: error || internalError || "" })
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { variant: "helper", color: "disabled", "data-testid": "yr3Input-helper", ui: { position: "absolute", bottom: -18, left: 0 }, children: error || internalError || "" })
|
|
1674
1725
|
] });
|
|
1675
1726
|
}
|
|
1676
1727
|
);
|
|
1677
1728
|
|
|
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
1729
|
// src/components/InputArea/InputArea.tsx
|
|
1809
|
-
var
|
|
1730
|
+
var React13 = __toESM(require("react"), 1);
|
|
1810
1731
|
|
|
1811
1732
|
// src/components/InputArea/inputAreaVariants.ts
|
|
1812
1733
|
var inputAreaVariants = createVariants({
|
|
@@ -1842,7 +1763,7 @@ var inputAreaVariants = createVariants({
|
|
|
1842
1763
|
});
|
|
1843
1764
|
|
|
1844
1765
|
// src/components/InputArea/InputArea.tsx
|
|
1845
|
-
var
|
|
1766
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1846
1767
|
var initiaPropsComponent2 = {
|
|
1847
1768
|
label: {
|
|
1848
1769
|
display: true,
|
|
@@ -1867,8 +1788,8 @@ var InputArea = ({
|
|
|
1867
1788
|
rounded = false,
|
|
1868
1789
|
propsComponent = initiaPropsComponent2
|
|
1869
1790
|
}) => {
|
|
1870
|
-
const ref =
|
|
1871
|
-
const [internalValue, setInternalValue] =
|
|
1791
|
+
const ref = React13.useRef(null);
|
|
1792
|
+
const [internalValue, setInternalValue] = React13.useState(defaultValue);
|
|
1872
1793
|
const isControlled = value !== void 0;
|
|
1873
1794
|
const currentValue = isControlled ? value : internalValue;
|
|
1874
1795
|
const handleChange = (e) => {
|
|
@@ -1885,8 +1806,8 @@ var InputArea = ({
|
|
|
1885
1806
|
el.style.resize = resize;
|
|
1886
1807
|
}
|
|
1887
1808
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
1888
|
-
return /* @__PURE__ */ (0,
|
|
1889
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
1809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { position: "relative" }, children: [
|
|
1810
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1890
1811
|
Label,
|
|
1891
1812
|
{
|
|
1892
1813
|
text: label || "",
|
|
@@ -1894,7 +1815,7 @@ var InputArea = ({
|
|
|
1894
1815
|
...propsComponent.label
|
|
1895
1816
|
}
|
|
1896
1817
|
),
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1898
1819
|
"textarea",
|
|
1899
1820
|
{
|
|
1900
1821
|
className: classes,
|
|
@@ -1906,26 +1827,26 @@ var InputArea = ({
|
|
|
1906
1827
|
"data-testid": "yr3InputArea"
|
|
1907
1828
|
}
|
|
1908
1829
|
),
|
|
1909
|
-
/* @__PURE__ */ (0,
|
|
1830
|
+
/* @__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
1831
|
] });
|
|
1911
1832
|
};
|
|
1912
1833
|
|
|
1913
1834
|
// src/components/Modal/Modal.tsx
|
|
1914
|
-
var
|
|
1835
|
+
var React14 = __toESM(require("react"), 1);
|
|
1915
1836
|
|
|
1916
1837
|
// src/components/Modal/ModalContainer.tsx
|
|
1917
|
-
var
|
|
1838
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1918
1839
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
1919
1840
|
const classes = bem("yr3Modal-container");
|
|
1920
1841
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
1921
|
-
return /* @__PURE__ */ (0,
|
|
1842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
1922
1843
|
};
|
|
1923
1844
|
|
|
1924
1845
|
// src/components/Modal/Modal.tsx
|
|
1925
|
-
var
|
|
1846
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1926
1847
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
1927
1848
|
const { show, hide } = useBackdrop();
|
|
1928
|
-
|
|
1849
|
+
React14.useEffect(() => {
|
|
1929
1850
|
if (open) {
|
|
1930
1851
|
show();
|
|
1931
1852
|
} else {
|
|
@@ -1934,9 +1855,9 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
1934
1855
|
}, [open, show]);
|
|
1935
1856
|
const classes = bem("yr3Modal");
|
|
1936
1857
|
const classComponent = classes(void 0, { "open": !!open });
|
|
1937
|
-
return /* @__PURE__ */ (0,
|
|
1858
|
+
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
1859
|
children,
|
|
1939
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0,
|
|
1860
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
1940
1861
|
] }) }) });
|
|
1941
1862
|
};
|
|
1942
1863
|
|
|
@@ -1976,15 +1897,15 @@ var notistackVariants = createVariants({
|
|
|
1976
1897
|
});
|
|
1977
1898
|
|
|
1978
1899
|
// src/components/Notistack/Notistack.tsx
|
|
1979
|
-
var
|
|
1900
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1980
1901
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
1981
1902
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
1982
1903
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
1983
1904
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
1984
1905
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
1985
|
-
return /* @__PURE__ */ (0,
|
|
1986
|
-
/* @__PURE__ */ (0,
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
1906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
1907
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { style: containerStyle, children: message }),
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1988
1909
|
"div",
|
|
1989
1910
|
{
|
|
1990
1911
|
className: "yr3Notistack--progress",
|
|
@@ -2018,7 +1939,7 @@ var pendingVariants = createVariants({
|
|
|
2018
1939
|
});
|
|
2019
1940
|
|
|
2020
1941
|
// src/components/Pending/Pending.tsx
|
|
2021
|
-
var
|
|
1942
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2022
1943
|
var Pending = ({
|
|
2023
1944
|
variant,
|
|
2024
1945
|
width,
|
|
@@ -2031,7 +1952,7 @@ var Pending = ({
|
|
|
2031
1952
|
const widthStyle = variant === "circle" ? size : width;
|
|
2032
1953
|
const heightStyle = variant === "circle" ? size : height;
|
|
2033
1954
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
2034
|
-
return /* @__PURE__ */ (0,
|
|
1955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2035
1956
|
"div",
|
|
2036
1957
|
{
|
|
2037
1958
|
className: pendingVariants({ variant, color }),
|
|
@@ -2041,10 +1962,149 @@ var Pending = ({
|
|
|
2041
1962
|
);
|
|
2042
1963
|
};
|
|
2043
1964
|
|
|
1965
|
+
// src/components/Phone/Phone.tsx
|
|
1966
|
+
var React16 = __toESM(require("react"), 1);
|
|
1967
|
+
|
|
1968
|
+
// src/components/Selector/Selector.tsx
|
|
1969
|
+
var React15 = __toESM(require("react"), 1);
|
|
1970
|
+
|
|
1971
|
+
// src/Icons/IconDown.tsx
|
|
1972
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1973
|
+
var IconDown = (props) => {
|
|
1974
|
+
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" }) });
|
|
1975
|
+
};
|
|
1976
|
+
|
|
1977
|
+
// src/components/Selector/Selector.tsx
|
|
1978
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1979
|
+
var initalPropsComponent2 = {
|
|
1980
|
+
text: {
|
|
1981
|
+
variant: "caption",
|
|
1982
|
+
color: "primary",
|
|
1983
|
+
children: void 0
|
|
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", 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 [prefixValue, setPrefixValue] = React16.useState(countries?.[0].dial);
|
|
2037
|
+
const [internalValue, setInternalValue] = React16.useState(defaultValue);
|
|
2038
|
+
const isControlled = value !== void 0;
|
|
2039
|
+
const currentValue = isControlled ? value : internalValue;
|
|
2040
|
+
const checkPattern = (type, value2) => {
|
|
2041
|
+
switch (type) {
|
|
2042
|
+
case "phone":
|
|
2043
|
+
return /^\d{10}$/.test(value2);
|
|
2044
|
+
default:
|
|
2045
|
+
return true;
|
|
2046
|
+
}
|
|
2047
|
+
};
|
|
2048
|
+
React16.useEffect(() => {
|
|
2049
|
+
if (internalValue && countries.length > 0) {
|
|
2050
|
+
const dial = getDialPhone(internalValue, countries) || null;
|
|
2051
|
+
setPrefixValue(dial);
|
|
2052
|
+
}
|
|
2053
|
+
}, [internalValue, countries]);
|
|
2054
|
+
const handleChange = (e, value2) => {
|
|
2055
|
+
const newValue = value2;
|
|
2056
|
+
const isValid = checkPattern("phone", newValue);
|
|
2057
|
+
if (!isValid) {
|
|
2058
|
+
return;
|
|
2059
|
+
}
|
|
2060
|
+
if (!isControlled) {
|
|
2061
|
+
setInternalValue(newValue);
|
|
2062
|
+
}
|
|
2063
|
+
onChange?.(e, normalizePhone(currentValue, prefixValue)?.full);
|
|
2064
|
+
};
|
|
2065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "yr3PhoneInput", "data-testid": "yr3Phone", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { variant: "row", container: true, center: true, children: [
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2069
|
+
Selector_default,
|
|
2070
|
+
{
|
|
2071
|
+
options: countries.map((c) => ({
|
|
2072
|
+
value: c.dial,
|
|
2073
|
+
label: c.code
|
|
2074
|
+
})),
|
|
2075
|
+
value: prefixValue,
|
|
2076
|
+
onChange: (_, val) => {
|
|
2077
|
+
setPrefixValue(val);
|
|
2078
|
+
},
|
|
2079
|
+
...propsComponent?.selector,
|
|
2080
|
+
ui: {
|
|
2081
|
+
...propsComponent?.selector?.ui,
|
|
2082
|
+
padding: 4
|
|
2083
|
+
},
|
|
2084
|
+
style: propsComponent?.selector?.style
|
|
2085
|
+
}
|
|
2086
|
+
),
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Divider, { orientation: "vertical", color: "primary", ui: { height: 50 - 1, mb: -1 }, ...propsComponent?.divider }),
|
|
2088
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2089
|
+
Input,
|
|
2090
|
+
{
|
|
2091
|
+
type: "phone",
|
|
2092
|
+
variant: "base",
|
|
2093
|
+
name,
|
|
2094
|
+
value: normalizePhone(currentValue, prefixValue)?.number.toString() || "",
|
|
2095
|
+
...propsComponent?.input,
|
|
2096
|
+
onChange: handleChange
|
|
2097
|
+
},
|
|
2098
|
+
currentValue
|
|
2099
|
+
)
|
|
2100
|
+
] }) })
|
|
2101
|
+
] }, prefixValue);
|
|
2102
|
+
};
|
|
2103
|
+
|
|
2044
2104
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
2045
|
-
var
|
|
2105
|
+
var React17 = __toESM(require("react"), 1);
|
|
2046
2106
|
var import_autocomplete_places = require("@yr3/autocomplete-places");
|
|
2047
|
-
var
|
|
2107
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2048
2108
|
var initPropsComponent = {
|
|
2049
2109
|
label: {
|
|
2050
2110
|
display: true,
|
|
@@ -2084,9 +2144,9 @@ var PlacesAutocomplete = ({
|
|
|
2084
2144
|
keyApi,
|
|
2085
2145
|
propsComponent = initPropsComponent
|
|
2086
2146
|
}) => {
|
|
2087
|
-
const [value, setValue] =
|
|
2088
|
-
const inputRef =
|
|
2089
|
-
const [anchorEl, setAnchorEl] =
|
|
2147
|
+
const [value, setValue] = React17.useState(null);
|
|
2148
|
+
const inputRef = React17.useRef(null);
|
|
2149
|
+
const [anchorEl, setAnchorEl] = React17.useState(null);
|
|
2090
2150
|
const { suggestions, selectPlace } = (0, import_autocomplete_places.useAutocompletePlaces)({ input: value, apiKey: keyApi, language, provider });
|
|
2091
2151
|
const handleSelect = async (id) => {
|
|
2092
2152
|
const place = await selectPlace(id);
|
|
@@ -2106,12 +2166,12 @@ var PlacesAutocomplete = ({
|
|
|
2106
2166
|
setValue(place.address);
|
|
2107
2167
|
setAnchorEl(null);
|
|
2108
2168
|
};
|
|
2109
|
-
|
|
2169
|
+
React17.useEffect(() => {
|
|
2110
2170
|
if (defaultLocation) {
|
|
2111
2171
|
setValue(defaultLocation);
|
|
2112
2172
|
}
|
|
2113
2173
|
}, [defaultLocation]);
|
|
2114
|
-
|
|
2174
|
+
React17.useEffect(() => {
|
|
2115
2175
|
if (value === "") {
|
|
2116
2176
|
onSelect(null);
|
|
2117
2177
|
}
|
|
@@ -2121,13 +2181,13 @@ var PlacesAutocomplete = ({
|
|
|
2121
2181
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2122
2182
|
};
|
|
2123
2183
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2124
|
-
|
|
2184
|
+
React17.useEffect(() => {
|
|
2125
2185
|
if (onChangeForm) {
|
|
2126
2186
|
onChangeForm({ target: { value } });
|
|
2127
2187
|
}
|
|
2128
2188
|
}, [onChangeForm]);
|
|
2129
|
-
return /* @__PURE__ */ (0,
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2131
2191
|
Input,
|
|
2132
2192
|
{
|
|
2133
2193
|
ref: inputRef,
|
|
@@ -2141,7 +2201,7 @@ var PlacesAutocomplete = ({
|
|
|
2141
2201
|
},
|
|
2142
2202
|
"input-places"
|
|
2143
2203
|
),
|
|
2144
|
-
open && /* @__PURE__ */ (0,
|
|
2204
|
+
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
2205
|
] });
|
|
2146
2206
|
};
|
|
2147
2207
|
|
|
@@ -2164,7 +2224,7 @@ var radioVariant = createVariants({
|
|
|
2164
2224
|
});
|
|
2165
2225
|
|
|
2166
2226
|
// src/components/Radio/Radio.tsx
|
|
2167
|
-
var
|
|
2227
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2168
2228
|
var Radio = ({
|
|
2169
2229
|
checked,
|
|
2170
2230
|
value,
|
|
@@ -2180,8 +2240,8 @@ var Radio = ({
|
|
|
2180
2240
|
const bemClass = bem("yr3Radio");
|
|
2181
2241
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2182
2242
|
const variantClass = radioVariant({ variant });
|
|
2183
|
-
return /* @__PURE__ */ (0,
|
|
2184
|
-
/* @__PURE__ */ (0,
|
|
2243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2185
2245
|
"input",
|
|
2186
2246
|
{
|
|
2187
2247
|
type: "radio",
|
|
@@ -2193,8 +2253,8 @@ var Radio = ({
|
|
|
2193
2253
|
}
|
|
2194
2254
|
),
|
|
2195
2255
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2196
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0,
|
|
2197
|
-
typeof label === "string" && /* @__PURE__ */ (0,
|
|
2256
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2257
|
+
typeof label === "string" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2198
2258
|
"span",
|
|
2199
2259
|
{
|
|
2200
2260
|
className: "yr3Radio--label",
|
|
@@ -2207,15 +2267,15 @@ var Radio = ({
|
|
|
2207
2267
|
};
|
|
2208
2268
|
|
|
2209
2269
|
// src/components/Select/Select.tsx
|
|
2210
|
-
var
|
|
2211
|
-
var
|
|
2270
|
+
var React18 = __toESM(require("react"), 1);
|
|
2271
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2212
2272
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2213
|
-
const [open, setOpen] =
|
|
2214
|
-
const [valueState, setValueState] =
|
|
2215
|
-
const ref =
|
|
2273
|
+
const [open, setOpen] = React18.useState(false);
|
|
2274
|
+
const [valueState, setValueState] = React18.useState(value || defaultValue || null);
|
|
2275
|
+
const ref = React18.useRef(null);
|
|
2216
2276
|
useClickAway(ref, () => setOpen(false));
|
|
2217
|
-
return /* @__PURE__ */ (0,
|
|
2218
|
-
/* @__PURE__ */ (0,
|
|
2277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2219
2279
|
Label,
|
|
2220
2280
|
{
|
|
2221
2281
|
...propsComponent?.label,
|
|
@@ -2223,10 +2283,10 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2223
2283
|
className: open || valueState ? "yr3Input--active" : ""
|
|
2224
2284
|
}
|
|
2225
2285
|
),
|
|
2226
|
-
/* @__PURE__ */ (0,
|
|
2227
|
-
/* @__PURE__ */ (0,
|
|
2228
|
-
/* @__PURE__ */ (0,
|
|
2229
|
-
/* @__PURE__ */ (0,
|
|
2286
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "yr3Select-wrapper", ref, children: [
|
|
2287
|
+
/* @__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: [
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "yr3Select--control", children: valueState }),
|
|
2289
|
+
/* @__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
2290
|
IconDown,
|
|
2231
2291
|
{
|
|
2232
2292
|
width: propsComponent?.icon?.style?.width || 26,
|
|
@@ -2236,13 +2296,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2236
2296
|
}
|
|
2237
2297
|
) })
|
|
2238
2298
|
] }),
|
|
2239
|
-
open && /* @__PURE__ */ (0,
|
|
2299
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2240
2300
|
"div",
|
|
2241
2301
|
{
|
|
2242
2302
|
className: "yr3Select--menu",
|
|
2243
2303
|
style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
|
|
2244
2304
|
"data-testid": "yr3Select-menu",
|
|
2245
|
-
children: options.map((opt) => /* @__PURE__ */ (0,
|
|
2305
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2246
2306
|
"div",
|
|
2247
2307
|
{
|
|
2248
2308
|
className: "yr3Select--option",
|
|
@@ -2274,8 +2334,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2274
2334
|
};
|
|
2275
2335
|
|
|
2276
2336
|
// src/components/Slide/Slide.tsx
|
|
2277
|
-
var
|
|
2278
|
-
var
|
|
2337
|
+
var React19 = __toESM(require("react"), 1);
|
|
2338
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2279
2339
|
var Slide = ({
|
|
2280
2340
|
in: inProp,
|
|
2281
2341
|
children,
|
|
@@ -2289,7 +2349,7 @@ var Slide = ({
|
|
|
2289
2349
|
[direction]: true,
|
|
2290
2350
|
"in": !!inProp
|
|
2291
2351
|
});
|
|
2292
|
-
|
|
2352
|
+
React19.useEffect(() => {
|
|
2293
2353
|
let timeoutId;
|
|
2294
2354
|
if (inProp) {
|
|
2295
2355
|
timeoutId = setTimeout(() => {
|
|
@@ -2299,19 +2359,19 @@ var Slide = ({
|
|
|
2299
2359
|
return () => clearTimeout(timeoutId);
|
|
2300
2360
|
}, [inProp, duration, onTransitionEnd]);
|
|
2301
2361
|
const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2302
|
-
return /* @__PURE__ */ (0,
|
|
2362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2303
2363
|
"div",
|
|
2304
2364
|
{
|
|
2305
2365
|
className: "yr3Slide",
|
|
2306
2366
|
style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
|
|
2307
2367
|
"data-testid": "yr3Slide",
|
|
2308
|
-
children: /* @__PURE__ */ (0,
|
|
2368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2309
2369
|
"div",
|
|
2310
2370
|
{
|
|
2311
2371
|
className: classNameContent,
|
|
2312
2372
|
style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
|
|
2313
2373
|
"data-testid": "yr3Slide-content",
|
|
2314
|
-
children: /* @__PURE__ */ (0,
|
|
2374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
|
|
2315
2375
|
}
|
|
2316
2376
|
)
|
|
2317
2377
|
}
|
|
@@ -2319,7 +2379,7 @@ var Slide = ({
|
|
|
2319
2379
|
};
|
|
2320
2380
|
|
|
2321
2381
|
// src/components/Switch/Switch.tsx
|
|
2322
|
-
var
|
|
2382
|
+
var React20 = __toESM(require("react"), 1);
|
|
2323
2383
|
|
|
2324
2384
|
// src/components/Switch/switch.variants.ts
|
|
2325
2385
|
var switchVariants = createVariants({
|
|
@@ -2348,7 +2408,7 @@ var switchVariants = createVariants({
|
|
|
2348
2408
|
});
|
|
2349
2409
|
|
|
2350
2410
|
// src/components/Switch/Switch.tsx
|
|
2351
|
-
var
|
|
2411
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2352
2412
|
var Switch = ({
|
|
2353
2413
|
checked,
|
|
2354
2414
|
defaultChecked,
|
|
@@ -2358,7 +2418,7 @@ var Switch = ({
|
|
|
2358
2418
|
size = "sm",
|
|
2359
2419
|
label
|
|
2360
2420
|
}) => {
|
|
2361
|
-
const [internal, setInternal] =
|
|
2421
|
+
const [internal, setInternal] = React20.useState(defaultChecked || false);
|
|
2362
2422
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
|
|
2363
2423
|
const isControlled = checked !== void 0;
|
|
2364
2424
|
const value = isControlled ? checked : internal;
|
|
@@ -2366,13 +2426,13 @@ var Switch = ({
|
|
|
2366
2426
|
if (!isControlled) setInternal(e.target.checked);
|
|
2367
2427
|
onChange?.(e, e.target.checked);
|
|
2368
2428
|
};
|
|
2369
|
-
return /* @__PURE__ */ (0,
|
|
2429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2370
2430
|
"label",
|
|
2371
2431
|
{
|
|
2372
2432
|
className: classname,
|
|
2373
2433
|
"data-testid": "yr3Switch",
|
|
2374
2434
|
children: [
|
|
2375
|
-
/* @__PURE__ */ (0,
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2376
2436
|
"input",
|
|
2377
2437
|
{
|
|
2378
2438
|
type: "checkbox",
|
|
@@ -2381,17 +2441,17 @@ var Switch = ({
|
|
|
2381
2441
|
disabled
|
|
2382
2442
|
}
|
|
2383
2443
|
),
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2385
|
-
/* @__PURE__ */ (0,
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
2445
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--label", "data-testid": "yr3Switch-label", children: label })
|
|
2386
2446
|
]
|
|
2387
2447
|
}
|
|
2388
2448
|
);
|
|
2389
2449
|
};
|
|
2390
2450
|
|
|
2391
2451
|
// src/Icons/IconSearch.tsx
|
|
2392
|
-
var
|
|
2452
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2393
2453
|
var IconSearch = (props) => {
|
|
2394
|
-
return /* @__PURE__ */ (0,
|
|
2454
|
+
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
2455
|
"path",
|
|
2396
2456
|
{
|
|
2397
2457
|
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 +2463,18 @@ var IconSearch = (props) => {
|
|
|
2403
2463
|
) });
|
|
2404
2464
|
};
|
|
2405
2465
|
|
|
2466
|
+
// src/theme/ThemeProvider.tsx
|
|
2467
|
+
var React21 = __toESM(require("react"), 1);
|
|
2468
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2469
|
+
var ThemeContext = React21.createContext(null);
|
|
2470
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2471
|
+
React21.useEffect(() => {
|
|
2472
|
+
applyTheme(theme);
|
|
2473
|
+
}, [theme]);
|
|
2474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BackdropProvider, { children }) });
|
|
2475
|
+
};
|
|
2476
|
+
var useTheme = () => React21.useContext(ThemeContext);
|
|
2477
|
+
|
|
2406
2478
|
// src/theme/tokens.ts
|
|
2407
2479
|
var baseTokens = {
|
|
2408
2480
|
colors: {
|
|
@@ -2537,9 +2609,13 @@ initTheme();
|
|
|
2537
2609
|
createVariants,
|
|
2538
2610
|
cx,
|
|
2539
2611
|
getContrast,
|
|
2612
|
+
getCountryCodePhone,
|
|
2613
|
+
getDialPhone,
|
|
2540
2614
|
getMonthCalendar,
|
|
2615
|
+
getNumberPhone,
|
|
2541
2616
|
initTheme,
|
|
2542
2617
|
isEmpty,
|
|
2618
|
+
normalizePhone,
|
|
2543
2619
|
text,
|
|
2544
2620
|
times,
|
|
2545
2621
|
uiStyle,
|
|
@@ -2549,5 +2625,6 @@ initTheme();
|
|
|
2549
2625
|
useControl,
|
|
2550
2626
|
useMediaQuery,
|
|
2551
2627
|
useNotistack,
|
|
2552
|
-
useTheme
|
|
2628
|
+
useTheme,
|
|
2629
|
+
...require("@yr3/autocomplete-places")
|
|
2553
2630
|
});
|