@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/index.js CHANGED
@@ -250,6 +250,49 @@ var createVariants = (config) => {
250
250
  };
251
251
  };
252
252
 
253
+ // src/utils/phone.ts
254
+ var normalizePhone = (phone, dial) => {
255
+ if (!phone) return null;
256
+ let clean = phone.replace(/[^\d+]/g, "");
257
+ let number = clean;
258
+ if (clean.startsWith(dial)) {
259
+ number = clean.slice(dial.length);
260
+ } else if (clean.startsWith("+")) {
261
+ const match = clean.match(/^\+\d{1,3}(.*)$/);
262
+ if (match) {
263
+ number = match[1];
264
+ }
265
+ }
266
+ number = number.replace(/^0+/, "");
267
+ return {
268
+ number,
269
+ full: `${dial}${number}`
270
+ };
271
+ };
272
+ var getDialPhone = (phone, countries) => {
273
+ for (const country of countries) {
274
+ console.log("checking", phone, "against", country.dial);
275
+ if (phone.startsWith(country.dial)) {
276
+ return country.dial;
277
+ }
278
+ }
279
+ return null;
280
+ };
281
+ var getCountryCodePhone = (phone, countries) => {
282
+ for (const country of countries) {
283
+ if (phone.startsWith(country.dial)) {
284
+ return country.code;
285
+ }
286
+ }
287
+ return null;
288
+ };
289
+ var getNumberPhone = (phone, dial) => {
290
+ if (phone.startsWith(dial)) {
291
+ return phone.slice(dial.length);
292
+ }
293
+ return phone;
294
+ };
295
+
253
296
  // src/theme/breakpoint.ts
254
297
  var breakpoints = {
255
298
  xs: 0,
@@ -413,6 +456,9 @@ function initTheme() {
413
456
  applyTheme(createTheme());
414
457
  }
415
458
 
459
+ // src/index.ts
460
+ export * from "@yr3/autocomplete-places";
461
+
416
462
  // src/components/Avatar/Avatar.tsx
417
463
  import * as React from "react";
418
464
 
@@ -1569,143 +1615,13 @@ var Input = React12.forwardRef(
1569
1615
  "data-testid": "yr3Input"
1570
1616
  }
1571
1617
  ),
1572
- /* @__PURE__ */ jsx24(Text, { variant: "helper", "data-testid": "yr3Input-helper", children: error || internalError || "" })
1618
+ /* @__PURE__ */ jsx24(Text, { variant: "helper", color: "disabled", "data-testid": "yr3Input-helper", ui: { position: "absolute", bottom: -18, left: 0 }, children: error || internalError || "" })
1573
1619
  ] });
1574
1620
  }
1575
1621
  );
1576
1622
 
1577
- // src/components/Input/InputPhone.tsx
1578
- import * as React15 from "react";
1579
-
1580
- // src/components/Select/Selector.tsx
1581
- import * as React13 from "react";
1582
-
1583
- // src/Icons/IconDown.tsx
1584
- import { jsx as jsx25 } from "react/jsx-runtime";
1585
- var IconDown = (props) => {
1586
- return /* @__PURE__ */ jsx25("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__ */ jsx25("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1587
- };
1588
-
1589
- // src/components/Select/Selector.tsx
1590
- import { jsx as jsx26, jsxs as jsxs7 } from "react/jsx-runtime";
1591
- var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon }) => {
1592
- const [open, setOpen] = React13.useState(false);
1593
- const [valueState, setValueState] = React13.useState(value || defaultValue || null);
1594
- const ref = React13.useRef(null);
1595
- useClickAway(ref, () => setOpen(false));
1596
- return /* @__PURE__ */ jsxs7("div", { className: "yr3Selector-wrapper", ref, children: [
1597
- /* @__PURE__ */ jsx26("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ jsxs7("div", { className: "yr3Selector--control", children: [
1598
- /* @__PURE__ */ jsx26("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ jsx26(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
1599
- valueState
1600
- ] }) }),
1601
- open && /* @__PURE__ */ jsx26("div", { className: "yr3Select--menu", children: options.map((opt) => /* @__PURE__ */ jsx26(
1602
- "div",
1603
- {
1604
- className: "yr3Select--option",
1605
- onClick: (e) => {
1606
- e.stopPropagation();
1607
- setValueState(opt.value);
1608
- setOpen(false);
1609
- const event = {
1610
- event: e,
1611
- target: {
1612
- name,
1613
- value: opt.value
1614
- },
1615
- currentTarget: {
1616
- name,
1617
- value: opt.value
1618
- }
1619
- };
1620
- onChange?.(event, opt.value);
1621
- },
1622
- children: opt.label
1623
- },
1624
- opt.value
1625
- )) })
1626
- ] });
1627
- };
1628
- var Selector_default = Selector;
1629
-
1630
- // src/theme/ThemeProvider.tsx
1631
- import * as React14 from "react";
1632
- import { jsx as jsx27 } from "react/jsx-runtime";
1633
- var ThemeContext = React14.createContext(null);
1634
- var ThemeProvider = ({ theme, children }) => {
1635
- React14.useEffect(() => {
1636
- applyTheme(theme);
1637
- }, [theme]);
1638
- return /* @__PURE__ */ jsx27(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx27(BackdropProvider, { children }) });
1639
- };
1640
- var useTheme = () => React14.useContext(ThemeContext);
1641
-
1642
- // src/components/Input/InputPhone.tsx
1643
- import { jsx as jsx28, jsxs as jsxs8 } from "react/jsx-runtime";
1644
- var Phone = ({
1645
- name,
1646
- value,
1647
- onChange,
1648
- prefix = "+39",
1649
- label = "Phone",
1650
- countries = [],
1651
- propsComponent
1652
- }) => {
1653
- const [prefixValue, setPrefixValue] = React15.useState(prefix);
1654
- const [number, setNumber] = React15.useState(Number(value) || null);
1655
- const theme = useTheme();
1656
- const handleChange = (newPrefix, newNumber) => {
1657
- const full = `${newPrefix}${newNumber.toString()}`;
1658
- const event = {
1659
- target: {
1660
- name,
1661
- value: full
1662
- }
1663
- };
1664
- onChange?.(event, full);
1665
- };
1666
- return /* @__PURE__ */ jsxs8(Control, { variant: "outlined", children: [
1667
- /* @__PURE__ */ jsx28(Label, { text: label, className: "yr3Input--active" }),
1668
- /* @__PURE__ */ jsx28("div", { className: "yr3PhoneInput", "data-testid": "yr3Phone", children: /* @__PURE__ */ jsxs8(Flex, { variant: "row", container: true, center: true, children: [
1669
- /* @__PURE__ */ jsx28(
1670
- Selector_default,
1671
- {
1672
- options: countries.map((c) => ({
1673
- value: c.dial,
1674
- label: c.code
1675
- })),
1676
- value: prefixValue,
1677
- onChange: (_, val) => {
1678
- setPrefixValue(val);
1679
- handleChange(val, number);
1680
- },
1681
- ...propsComponent?.selector,
1682
- ui: {
1683
- ...propsComponent?.selector?.ui,
1684
- padding: 4
1685
- },
1686
- style: propsComponent?.selector?.style
1687
- }
1688
- ),
1689
- /* @__PURE__ */ jsx28(Divider, { orientation: "vertical", ...propsComponent?.divider }),
1690
- /* @__PURE__ */ jsx28(
1691
- Input,
1692
- {
1693
- type: "phone",
1694
- variant: "base",
1695
- value: number,
1696
- ...propsComponent?.input,
1697
- onChange: (e, value2) => {
1698
- setNumber(value2);
1699
- handleChange(prefixValue, value2);
1700
- }
1701
- }
1702
- )
1703
- ] }) })
1704
- ] });
1705
- };
1706
-
1707
1623
  // src/components/InputArea/InputArea.tsx
1708
- import * as React16 from "react";
1624
+ import * as React13 from "react";
1709
1625
 
1710
1626
  // src/components/InputArea/inputAreaVariants.ts
1711
1627
  var inputAreaVariants = createVariants({
@@ -1741,7 +1657,7 @@ var inputAreaVariants = createVariants({
1741
1657
  });
1742
1658
 
1743
1659
  // src/components/InputArea/InputArea.tsx
1744
- import { jsx as jsx29, jsxs as jsxs9 } from "react/jsx-runtime";
1660
+ import { jsx as jsx25, jsxs as jsxs7 } from "react/jsx-runtime";
1745
1661
  var initiaPropsComponent2 = {
1746
1662
  label: {
1747
1663
  display: true,
@@ -1766,8 +1682,8 @@ var InputArea = ({
1766
1682
  rounded = false,
1767
1683
  propsComponent = initiaPropsComponent2
1768
1684
  }) => {
1769
- const ref = React16.useRef(null);
1770
- const [internalValue, setInternalValue] = React16.useState(defaultValue);
1685
+ const ref = React13.useRef(null);
1686
+ const [internalValue, setInternalValue] = React13.useState(defaultValue);
1771
1687
  const isControlled = value !== void 0;
1772
1688
  const currentValue = isControlled ? value : internalValue;
1773
1689
  const handleChange = (e) => {
@@ -1784,8 +1700,8 @@ var InputArea = ({
1784
1700
  el.style.resize = resize;
1785
1701
  }
1786
1702
  const classes = inputAreaVariants({ variant, color, rounded });
1787
- return /* @__PURE__ */ jsxs9("div", { style: { position: "relative" }, children: [
1788
- propsComponent?.label?.display && /* @__PURE__ */ jsx29(
1703
+ return /* @__PURE__ */ jsxs7("div", { style: { position: "relative" }, children: [
1704
+ propsComponent?.label?.display && /* @__PURE__ */ jsx25(
1789
1705
  Label,
1790
1706
  {
1791
1707
  text: label || "",
@@ -1793,7 +1709,7 @@ var InputArea = ({
1793
1709
  ...propsComponent.label
1794
1710
  }
1795
1711
  ),
1796
- /* @__PURE__ */ jsx29(
1712
+ /* @__PURE__ */ jsx25(
1797
1713
  "textarea",
1798
1714
  {
1799
1715
  className: classes,
@@ -1805,26 +1721,26 @@ var InputArea = ({
1805
1721
  "data-testid": "yr3InputArea"
1806
1722
  }
1807
1723
  ),
1808
- /* @__PURE__ */ jsx29(Text, { variant: "helper", color: currentValue.length > maxLength ? "error" : "disabled", ui: { textAlign: "right" }, "data-testid": "yr3InputAreaError", children: validate && maxLength ? `${currentValue.length}/${maxLength}` || propsComponent.helperText : "" })
1724
+ /* @__PURE__ */ jsx25(Text, { variant: "helper", color: currentValue.length > maxLength ? "error" : "disabled", ui: { textAlign: "right" }, "data-testid": "yr3InputAreaError", children: validate && maxLength ? `${currentValue.length}/${maxLength}` || propsComponent.helperText : "" })
1809
1725
  ] });
1810
1726
  };
1811
1727
 
1812
1728
  // src/components/Modal/Modal.tsx
1813
- import * as React17 from "react";
1729
+ import * as React14 from "react";
1814
1730
 
1815
1731
  // src/components/Modal/ModalContainer.tsx
1816
- import { jsx as jsx30 } from "react/jsx-runtime";
1732
+ import { jsx as jsx26 } from "react/jsx-runtime";
1817
1733
  var ModalContainer = ({ children, size = "sm", ui, style }) => {
1818
1734
  const classes = bem("yr3Modal-container");
1819
1735
  const classComponent = classes(void 0, { [`${size}`]: !!size });
1820
- return /* @__PURE__ */ jsx30("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
1736
+ return /* @__PURE__ */ jsx26("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
1821
1737
  };
1822
1738
 
1823
1739
  // src/components/Modal/Modal.tsx
1824
- import { jsx as jsx31, jsxs as jsxs10 } from "react/jsx-runtime";
1740
+ import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
1825
1741
  var Modal = ({ open, onClose, children, propsComponent }) => {
1826
1742
  const { show, hide } = useBackdrop();
1827
- React17.useEffect(() => {
1743
+ React14.useEffect(() => {
1828
1744
  if (open) {
1829
1745
  show();
1830
1746
  } else {
@@ -1833,9 +1749,9 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
1833
1749
  }, [open, show]);
1834
1750
  const classes = bem("yr3Modal");
1835
1751
  const classComponent = classes(void 0, { "open": !!open });
1836
- return /* @__PURE__ */ jsx31("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ jsx31(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ jsxs10(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
1752
+ return /* @__PURE__ */ jsx27("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ jsx27(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ jsxs8(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
1837
1753
  children,
1838
- propsComponent?.close ? propsComponent.close : /* @__PURE__ */ jsx31(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
1754
+ propsComponent?.close ? propsComponent.close : /* @__PURE__ */ jsx27(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
1839
1755
  ] }) }) });
1840
1756
  };
1841
1757
 
@@ -1875,15 +1791,15 @@ var notistackVariants = createVariants({
1875
1791
  });
1876
1792
 
1877
1793
  // src/components/Notistack/Notistack.tsx
1878
- import { jsx as jsx32, jsxs as jsxs11 } from "react/jsx-runtime";
1794
+ import { jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
1879
1795
  var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
1880
1796
  const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
1881
1797
  const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
1882
1798
  const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
1883
1799
  const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
1884
- return /* @__PURE__ */ jsxs11("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
1885
- /* @__PURE__ */ jsx32("span", { style: containerStyle, children: message }),
1886
- /* @__PURE__ */ jsx32(
1800
+ return /* @__PURE__ */ jsxs9("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
1801
+ /* @__PURE__ */ jsx28("span", { style: containerStyle, children: message }),
1802
+ /* @__PURE__ */ jsx28(
1887
1803
  "div",
1888
1804
  {
1889
1805
  className: "yr3Notistack--progress",
@@ -1917,7 +1833,7 @@ var pendingVariants = createVariants({
1917
1833
  });
1918
1834
 
1919
1835
  // src/components/Pending/Pending.tsx
1920
- import { jsx as jsx33 } from "react/jsx-runtime";
1836
+ import { jsx as jsx29 } from "react/jsx-runtime";
1921
1837
  var Pending = ({
1922
1838
  variant,
1923
1839
  width,
@@ -1930,7 +1846,7 @@ var Pending = ({
1930
1846
  const widthStyle = variant === "circle" ? size : width;
1931
1847
  const heightStyle = variant === "circle" ? size : height;
1932
1848
  const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
1933
- return /* @__PURE__ */ jsx33(
1849
+ return /* @__PURE__ */ jsx29(
1934
1850
  "div",
1935
1851
  {
1936
1852
  className: pendingVariants({ variant, color }),
@@ -1940,10 +1856,149 @@ var Pending = ({
1940
1856
  );
1941
1857
  };
1942
1858
 
1859
+ // src/components/Phone/Phone.tsx
1860
+ import * as React16 from "react";
1861
+
1862
+ // src/components/Selector/Selector.tsx
1863
+ import * as React15 from "react";
1864
+
1865
+ // src/Icons/IconDown.tsx
1866
+ import { jsx as jsx30 } from "react/jsx-runtime";
1867
+ var IconDown = (props) => {
1868
+ return /* @__PURE__ */ jsx30("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__ */ jsx30("path", { d: "M7 10L12 15L17 10", stroke: props.stroke || "#fff", strokeWidth: props.strokeWidth || "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
1869
+ };
1870
+
1871
+ // src/components/Selector/Selector.tsx
1872
+ import { jsx as jsx31, jsxs as jsxs10 } from "react/jsx-runtime";
1873
+ var initalPropsComponent2 = {
1874
+ text: {
1875
+ variant: "caption",
1876
+ color: "primary",
1877
+ children: void 0
1878
+ }
1879
+ };
1880
+ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon, propsComponent = initalPropsComponent2 }) => {
1881
+ const [open, setOpen] = React15.useState(false);
1882
+ const [valueState, setValueState] = React15.useState(value || defaultValue || null);
1883
+ const ref = React15.useRef(null);
1884
+ useClickAway(ref, () => setOpen(false));
1885
+ return /* @__PURE__ */ jsxs10("div", { className: "yr3Selector-wrapper", ref, children: [
1886
+ /* @__PURE__ */ jsx31("div", { className: `yr3Selector ${open ? "yr3Selector--open" : ""}`, style: composeStyles(ui, style), children: /* @__PURE__ */ jsxs10("div", { className: "yr3Selector--control", children: [
1887
+ /* @__PURE__ */ jsx31("div", { className: "yr3Selector--icon", onClick: () => setOpen((prev) => !prev), children: icon ? icon : /* @__PURE__ */ jsx31(IconDown, { stroke: `var(--color-${iconColor || "disabled"})`, width: 24, height: 24 }) }),
1888
+ valueState
1889
+ ] }) }),
1890
+ open && /* @__PURE__ */ jsx31("div", { className: "yr3Selector--menu", children: options.map((opt) => /* @__PURE__ */ jsx31(
1891
+ "div",
1892
+ {
1893
+ className: "yr3Selector--option",
1894
+ onClick: (e) => {
1895
+ e.stopPropagation();
1896
+ setValueState(opt.value);
1897
+ setOpen(false);
1898
+ const event = {
1899
+ event: e,
1900
+ target: {
1901
+ name,
1902
+ value: opt.value
1903
+ },
1904
+ currentTarget: {
1905
+ name,
1906
+ value: opt.value
1907
+ }
1908
+ };
1909
+ onChange?.(event, opt.value);
1910
+ },
1911
+ children: /* @__PURE__ */ jsx31(Text, { ...propsComponent?.text, children: propsComponent?.text?.children || opt.label })
1912
+ },
1913
+ opt.value
1914
+ )) })
1915
+ ] });
1916
+ };
1917
+ var Selector_default = Selector;
1918
+
1919
+ // src/components/Phone/Phone.tsx
1920
+ import { jsx as jsx32, jsxs as jsxs11 } from "react/jsx-runtime";
1921
+ var Phone = ({
1922
+ name,
1923
+ value,
1924
+ onChange,
1925
+ label = "Phone",
1926
+ countries,
1927
+ propsComponent,
1928
+ defaultValue
1929
+ }) => {
1930
+ const [prefixValue, setPrefixValue] = React16.useState(countries?.[0].dial);
1931
+ const [internalValue, setInternalValue] = React16.useState(defaultValue);
1932
+ const isControlled = value !== void 0;
1933
+ const currentValue = isControlled ? value : internalValue;
1934
+ const checkPattern = (type, value2) => {
1935
+ switch (type) {
1936
+ case "phone":
1937
+ return /^\d{10}$/.test(value2);
1938
+ default:
1939
+ return true;
1940
+ }
1941
+ };
1942
+ React16.useEffect(() => {
1943
+ if (internalValue && countries.length > 0) {
1944
+ const dial = getDialPhone(internalValue, countries) || null;
1945
+ setPrefixValue(dial);
1946
+ }
1947
+ }, [internalValue, countries]);
1948
+ const handleChange = (e, value2) => {
1949
+ const newValue = value2;
1950
+ const isValid = checkPattern("phone", newValue);
1951
+ if (!isValid) {
1952
+ return;
1953
+ }
1954
+ if (!isControlled) {
1955
+ setInternalValue(newValue);
1956
+ }
1957
+ onChange?.(e, normalizePhone(currentValue, prefixValue)?.full);
1958
+ };
1959
+ return /* @__PURE__ */ jsxs11(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
1960
+ /* @__PURE__ */ jsx32(Label, { text: label, className: "yr3Input--active" }),
1961
+ /* @__PURE__ */ jsx32("div", { className: "yr3PhoneInput", "data-testid": "yr3Phone", children: /* @__PURE__ */ jsxs11(Flex, { variant: "row", container: true, center: true, children: [
1962
+ /* @__PURE__ */ jsx32(
1963
+ Selector_default,
1964
+ {
1965
+ options: countries.map((c) => ({
1966
+ value: c.dial,
1967
+ label: c.code
1968
+ })),
1969
+ value: prefixValue,
1970
+ onChange: (_, val) => {
1971
+ setPrefixValue(val);
1972
+ },
1973
+ ...propsComponent?.selector,
1974
+ ui: {
1975
+ ...propsComponent?.selector?.ui,
1976
+ padding: 4
1977
+ },
1978
+ style: propsComponent?.selector?.style
1979
+ }
1980
+ ),
1981
+ /* @__PURE__ */ jsx32(Divider, { orientation: "vertical", color: "primary", ui: { height: 50 - 1, mb: -1 }, ...propsComponent?.divider }),
1982
+ /* @__PURE__ */ jsx32(
1983
+ Input,
1984
+ {
1985
+ type: "phone",
1986
+ variant: "base",
1987
+ name,
1988
+ value: normalizePhone(currentValue, prefixValue)?.number.toString() || "",
1989
+ ...propsComponent?.input,
1990
+ onChange: handleChange
1991
+ },
1992
+ currentValue
1993
+ )
1994
+ ] }) })
1995
+ ] }, prefixValue);
1996
+ };
1997
+
1943
1998
  // src/components/Places/PlacesAutocomplete.tsx
1944
- import * as React18 from "react";
1999
+ import * as React17 from "react";
1945
2000
  import { useAutocompletePlaces } from "@yr3/autocomplete-places";
1946
- import { jsx as jsx34, jsxs as jsxs12 } from "react/jsx-runtime";
2001
+ import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
1947
2002
  var initPropsComponent = {
1948
2003
  label: {
1949
2004
  display: true,
@@ -1983,9 +2038,9 @@ var PlacesAutocomplete = ({
1983
2038
  keyApi,
1984
2039
  propsComponent = initPropsComponent
1985
2040
  }) => {
1986
- const [value, setValue] = React18.useState(null);
1987
- const inputRef = React18.useRef(null);
1988
- const [anchorEl, setAnchorEl] = React18.useState(null);
2041
+ const [value, setValue] = React17.useState(null);
2042
+ const inputRef = React17.useRef(null);
2043
+ const [anchorEl, setAnchorEl] = React17.useState(null);
1989
2044
  const { suggestions, selectPlace } = useAutocompletePlaces({ input: value, apiKey: keyApi, language, provider });
1990
2045
  const handleSelect = async (id) => {
1991
2046
  const place = await selectPlace(id);
@@ -2005,12 +2060,12 @@ var PlacesAutocomplete = ({
2005
2060
  setValue(place.address);
2006
2061
  setAnchorEl(null);
2007
2062
  };
2008
- React18.useEffect(() => {
2063
+ React17.useEffect(() => {
2009
2064
  if (defaultLocation) {
2010
2065
  setValue(defaultLocation);
2011
2066
  }
2012
2067
  }, [defaultLocation]);
2013
- React18.useEffect(() => {
2068
+ React17.useEffect(() => {
2014
2069
  if (value === "") {
2015
2070
  onSelect(null);
2016
2071
  }
@@ -2020,13 +2075,13 @@ var PlacesAutocomplete = ({
2020
2075
  setAnchorEl(e.target.value ? inputRef.current : null);
2021
2076
  };
2022
2077
  const open = suggestions.length > 0 && Boolean(anchorEl);
2023
- React18.useEffect(() => {
2078
+ React17.useEffect(() => {
2024
2079
  if (onChangeForm) {
2025
2080
  onChangeForm({ target: { value } });
2026
2081
  }
2027
2082
  }, [onChangeForm]);
2028
2083
  return /* @__PURE__ */ jsxs12(Control, { ...propsComponent?.control, children: [
2029
- /* @__PURE__ */ jsx34(
2084
+ /* @__PURE__ */ jsx33(
2030
2085
  Input,
2031
2086
  {
2032
2087
  ref: inputRef,
@@ -2040,7 +2095,7 @@ var PlacesAutocomplete = ({
2040
2095
  },
2041
2096
  "input-places"
2042
2097
  ),
2043
- open && /* @__PURE__ */ jsx34("div", { className: "yr3Places--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent?.menu?.style), children: /* @__PURE__ */ jsx34(Flex, { container: true, ui: { p: 1 }, children: suggestions.map((s) => /* @__PURE__ */ jsx34(Flex, { onClick: () => handleSelect(s.id), ui: { padding: 8, cursor: "pointer", "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" } }, children: /* @__PURE__ */ jsx34(Text, { ...propsComponent?.menu?.text, children: s.description }) }, s.id)) }) })
2098
+ open && /* @__PURE__ */ jsx33("div", { className: "yr3Places--menu", style: composeStyles(propsComponent.menu?.ui, propsComponent?.menu?.style), children: /* @__PURE__ */ jsx33(Flex, { container: true, ui: { p: 1 }, children: suggestions.map((s) => /* @__PURE__ */ jsx33(Flex, { onClick: () => handleSelect(s.id), ui: { padding: 8, cursor: "pointer", "&:hover": { backgroundColor: "rgba(0,0,0,0.1)" } }, children: /* @__PURE__ */ jsx33(Text, { ...propsComponent?.menu?.text, children: s.description }) }, s.id)) }) })
2044
2099
  ] });
2045
2100
  };
2046
2101
 
@@ -2063,7 +2118,7 @@ var radioVariant = createVariants({
2063
2118
  });
2064
2119
 
2065
2120
  // src/components/Radio/Radio.tsx
2066
- import { jsx as jsx35, jsxs as jsxs13 } from "react/jsx-runtime";
2121
+ import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
2067
2122
  var Radio = ({
2068
2123
  checked,
2069
2124
  value,
@@ -2080,7 +2135,7 @@ var Radio = ({
2080
2135
  const classes = bemClass(void 0, { [color]: `color-${color}` });
2081
2136
  const variantClass = radioVariant({ variant });
2082
2137
  return /* @__PURE__ */ jsxs13("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
2083
- /* @__PURE__ */ jsx35(
2138
+ /* @__PURE__ */ jsx34(
2084
2139
  "input",
2085
2140
  {
2086
2141
  type: "radio",
@@ -2092,8 +2147,8 @@ var Radio = ({
2092
2147
  }
2093
2148
  ),
2094
2149
  iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
2095
- !iconChecked && !iconUnchecked && /* @__PURE__ */ jsx35("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
2096
- typeof label === "string" && /* @__PURE__ */ jsx35(
2150
+ !iconChecked && !iconUnchecked && /* @__PURE__ */ jsx34("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
2151
+ typeof label === "string" && /* @__PURE__ */ jsx34(
2097
2152
  "span",
2098
2153
  {
2099
2154
  className: "yr3Radio--label",
@@ -2106,15 +2161,15 @@ var Radio = ({
2106
2161
  };
2107
2162
 
2108
2163
  // src/components/Select/Select.tsx
2109
- import * as React19 from "react";
2110
- import { jsx as jsx36, jsxs as jsxs14 } from "react/jsx-runtime";
2164
+ import * as React18 from "react";
2165
+ import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
2111
2166
  var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
2112
- const [open, setOpen] = React19.useState(false);
2113
- const [valueState, setValueState] = React19.useState(value || defaultValue || null);
2114
- const ref = React19.useRef(null);
2167
+ const [open, setOpen] = React18.useState(false);
2168
+ const [valueState, setValueState] = React18.useState(value || defaultValue || null);
2169
+ const ref = React18.useRef(null);
2115
2170
  useClickAway(ref, () => setOpen(false));
2116
2171
  return /* @__PURE__ */ jsxs14(Control, { ...propsComponent?.control, children: [
2117
- /* @__PURE__ */ jsx36(
2172
+ /* @__PURE__ */ jsx35(
2118
2173
  Label,
2119
2174
  {
2120
2175
  ...propsComponent?.label,
@@ -2124,8 +2179,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
2124
2179
  ),
2125
2180
  /* @__PURE__ */ jsxs14("div", { className: "yr3Select-wrapper", ref, children: [
2126
2181
  /* @__PURE__ */ jsxs14("div", { className: `yr3Select ${open ? "yr3Select--open" : ""}`, "data-testid": "yr3Select-wrapper", style: composeStyles(propsComponent?.wrapper?.ui, propsComponent?.wrapper?.style), children: [
2127
- /* @__PURE__ */ jsx36("div", { className: "yr3Select--control", children: valueState }),
2128
- /* @__PURE__ */ jsx36("div", { className: "yr3Select--icon", onClick: () => setOpen((prev) => !prev), "data-testid": "yr3Select-icon", children: propsComponent?.icon?.component ? propsComponent.icon.component : /* @__PURE__ */ jsx36(
2182
+ /* @__PURE__ */ jsx35("div", { className: "yr3Select--control", children: valueState }),
2183
+ /* @__PURE__ */ jsx35("div", { className: "yr3Select--icon", onClick: () => setOpen((prev) => !prev), "data-testid": "yr3Select-icon", children: propsComponent?.icon?.component ? propsComponent.icon.component : /* @__PURE__ */ jsx35(
2129
2184
  IconDown,
2130
2185
  {
2131
2186
  width: propsComponent?.icon?.style?.width || 26,
@@ -2135,13 +2190,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
2135
2190
  }
2136
2191
  ) })
2137
2192
  ] }),
2138
- open && /* @__PURE__ */ jsx36(
2193
+ open && /* @__PURE__ */ jsx35(
2139
2194
  "div",
2140
2195
  {
2141
2196
  className: "yr3Select--menu",
2142
2197
  style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
2143
2198
  "data-testid": "yr3Select-menu",
2144
- children: options.map((opt) => /* @__PURE__ */ jsx36(
2199
+ children: options.map((opt) => /* @__PURE__ */ jsx35(
2145
2200
  "div",
2146
2201
  {
2147
2202
  className: "yr3Select--option",
@@ -2173,8 +2228,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
2173
2228
  };
2174
2229
 
2175
2230
  // src/components/Slide/Slide.tsx
2176
- import * as React20 from "react";
2177
- import { jsx as jsx37 } from "react/jsx-runtime";
2231
+ import * as React19 from "react";
2232
+ import { jsx as jsx36 } from "react/jsx-runtime";
2178
2233
  var Slide = ({
2179
2234
  in: inProp,
2180
2235
  children,
@@ -2188,7 +2243,7 @@ var Slide = ({
2188
2243
  [direction]: true,
2189
2244
  "in": !!inProp
2190
2245
  });
2191
- React20.useEffect(() => {
2246
+ React19.useEffect(() => {
2192
2247
  let timeoutId;
2193
2248
  if (inProp) {
2194
2249
  timeoutId = setTimeout(() => {
@@ -2198,19 +2253,19 @@ var Slide = ({
2198
2253
  return () => clearTimeout(timeoutId);
2199
2254
  }, [inProp, duration, onTransitionEnd]);
2200
2255
  const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
2201
- return /* @__PURE__ */ jsx37(
2256
+ return /* @__PURE__ */ jsx36(
2202
2257
  "div",
2203
2258
  {
2204
2259
  className: "yr3Slide",
2205
2260
  style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
2206
2261
  "data-testid": "yr3Slide",
2207
- children: /* @__PURE__ */ jsx37(
2262
+ children: /* @__PURE__ */ jsx36(
2208
2263
  "div",
2209
2264
  {
2210
2265
  className: classNameContent,
2211
2266
  style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
2212
2267
  "data-testid": "yr3Slide-content",
2213
- children: /* @__PURE__ */ jsx37(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
2268
+ children: /* @__PURE__ */ jsx36(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
2214
2269
  }
2215
2270
  )
2216
2271
  }
@@ -2218,7 +2273,7 @@ var Slide = ({
2218
2273
  };
2219
2274
 
2220
2275
  // src/components/Switch/Switch.tsx
2221
- import * as React21 from "react";
2276
+ import * as React20 from "react";
2222
2277
 
2223
2278
  // src/components/Switch/switch.variants.ts
2224
2279
  var switchVariants = createVariants({
@@ -2247,7 +2302,7 @@ var switchVariants = createVariants({
2247
2302
  });
2248
2303
 
2249
2304
  // src/components/Switch/Switch.tsx
2250
- import { jsx as jsx38, jsxs as jsxs15 } from "react/jsx-runtime";
2305
+ import { jsx as jsx37, jsxs as jsxs15 } from "react/jsx-runtime";
2251
2306
  var Switch = ({
2252
2307
  checked,
2253
2308
  defaultChecked,
@@ -2257,7 +2312,7 @@ var Switch = ({
2257
2312
  size = "sm",
2258
2313
  label
2259
2314
  }) => {
2260
- const [internal, setInternal] = React21.useState(defaultChecked || false);
2315
+ const [internal, setInternal] = React20.useState(defaultChecked || false);
2261
2316
  const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
2262
2317
  const isControlled = checked !== void 0;
2263
2318
  const value = isControlled ? checked : internal;
@@ -2271,7 +2326,7 @@ var Switch = ({
2271
2326
  className: classname,
2272
2327
  "data-testid": "yr3Switch",
2273
2328
  children: [
2274
- /* @__PURE__ */ jsx38(
2329
+ /* @__PURE__ */ jsx37(
2275
2330
  "input",
2276
2331
  {
2277
2332
  type: "checkbox",
@@ -2280,17 +2335,17 @@ var Switch = ({
2280
2335
  disabled
2281
2336
  }
2282
2337
  ),
2283
- /* @__PURE__ */ jsx38("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx38("span", { className: "yr3Switch--thumb" }) }),
2284
- /* @__PURE__ */ jsx38("span", { className: "yr3Switch--label", "data-testid": "yr3Switch-label", children: label })
2338
+ /* @__PURE__ */ jsx37("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx37("span", { className: "yr3Switch--thumb" }) }),
2339
+ /* @__PURE__ */ jsx37("span", { className: "yr3Switch--label", "data-testid": "yr3Switch-label", children: label })
2285
2340
  ]
2286
2341
  }
2287
2342
  );
2288
2343
  };
2289
2344
 
2290
2345
  // src/Icons/IconSearch.tsx
2291
- import { jsx as jsx39 } from "react/jsx-runtime";
2346
+ import { jsx as jsx38 } from "react/jsx-runtime";
2292
2347
  var IconSearch = (props) => {
2293
- return /* @__PURE__ */ jsx39("svg", { width: props.width || "64px", height: props.height || "64px", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx39(
2348
+ return /* @__PURE__ */ jsx38("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__ */ jsx38(
2294
2349
  "path",
2295
2350
  {
2296
2351
  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",
@@ -2302,6 +2357,18 @@ var IconSearch = (props) => {
2302
2357
  ) });
2303
2358
  };
2304
2359
 
2360
+ // src/theme/ThemeProvider.tsx
2361
+ import * as React21 from "react";
2362
+ import { jsx as jsx39 } from "react/jsx-runtime";
2363
+ var ThemeContext = React21.createContext(null);
2364
+ var ThemeProvider = ({ theme, children }) => {
2365
+ React21.useEffect(() => {
2366
+ applyTheme(theme);
2367
+ }, [theme]);
2368
+ return /* @__PURE__ */ jsx39(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx39(BackdropProvider, { children }) });
2369
+ };
2370
+ var useTheme = () => React21.useContext(ThemeContext);
2371
+
2305
2372
  // src/theme/tokens.ts
2306
2373
  var baseTokens = {
2307
2374
  colors: {
@@ -2435,9 +2502,13 @@ export {
2435
2502
  createVariants,
2436
2503
  cx,
2437
2504
  getContrast,
2505
+ getCountryCodePhone,
2506
+ getDialPhone,
2438
2507
  getMonthCalendar,
2508
+ getNumberPhone,
2439
2509
  initTheme,
2440
2510
  isEmpty,
2511
+ normalizePhone,
2441
2512
  text,
2442
2513
  times,
2443
2514
  uiStyle,