@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.js
CHANGED
|
@@ -250,6 +250,48 @@ 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
|
+
if (phone.startsWith(country.dial)) {
|
|
275
|
+
return country.dial;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
return null;
|
|
279
|
+
};
|
|
280
|
+
var getCountryCodePhone = (phone, countries) => {
|
|
281
|
+
for (const country of countries) {
|
|
282
|
+
if (phone.startsWith(country.dial)) {
|
|
283
|
+
return country.code;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return null;
|
|
287
|
+
};
|
|
288
|
+
var getNumberPhone = (phone, dial) => {
|
|
289
|
+
if (phone.startsWith(dial)) {
|
|
290
|
+
return phone.slice(dial.length);
|
|
291
|
+
}
|
|
292
|
+
return phone;
|
|
293
|
+
};
|
|
294
|
+
|
|
253
295
|
// src/theme/breakpoint.ts
|
|
254
296
|
var breakpoints = {
|
|
255
297
|
xs: 0,
|
|
@@ -716,7 +758,8 @@ var initalPropsComponent = {
|
|
|
716
758
|
color: "primary",
|
|
717
759
|
bordered: true,
|
|
718
760
|
ui: {},
|
|
719
|
-
style: {}
|
|
761
|
+
style: {},
|
|
762
|
+
component: null
|
|
720
763
|
},
|
|
721
764
|
buttonNext: {
|
|
722
765
|
disabled: false,
|
|
@@ -762,7 +805,7 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
762
805
|
children: dayjs2().day(i + 1).format("dd")
|
|
763
806
|
}
|
|
764
807
|
) }, `month_day_${i}`)),
|
|
765
|
-
times(program.calendar.length, (i) => /* @__PURE__ */ jsx7(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */
|
|
808
|
+
times(program.calendar.length, (i) => /* @__PURE__ */ jsx7(React3.Fragment, { children: times(program.calendar[i].length, (j) => /* @__PURE__ */ jsxs2(
|
|
766
809
|
"div",
|
|
767
810
|
{
|
|
768
811
|
className: calendarDayVariants({
|
|
@@ -784,14 +827,17 @@ var Calendar = ({ onSelect, propsComponent = initalPropsComponent, mapCalendar,
|
|
|
784
827
|
setSelected(program.calendar[i][j]);
|
|
785
828
|
}
|
|
786
829
|
},
|
|
787
|
-
children:
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
830
|
+
children: [
|
|
831
|
+
program.calendar[i][j]?.data && propsComponent?.day?.component ? propsComponent.day.component : null,
|
|
832
|
+
/* @__PURE__ */ jsx7(
|
|
833
|
+
Text,
|
|
834
|
+
{
|
|
835
|
+
variant: "body2",
|
|
836
|
+
color: program.calendar[i][j]?.isFuture ? "text" : "text",
|
|
837
|
+
children: program.calendar[i][j]?.day || ""
|
|
838
|
+
}
|
|
839
|
+
)
|
|
840
|
+
]
|
|
795
841
|
},
|
|
796
842
|
`day-${i}-${j}`
|
|
797
843
|
)) }, i))
|
|
@@ -1003,6 +1049,7 @@ var Control = ({
|
|
|
1003
1049
|
style,
|
|
1004
1050
|
ui,
|
|
1005
1051
|
color = "primary",
|
|
1052
|
+
size = "auto",
|
|
1006
1053
|
label = true
|
|
1007
1054
|
}) => {
|
|
1008
1055
|
const [focused, setFocused] = React7.useState(false);
|
|
@@ -1012,7 +1059,7 @@ var Control = ({
|
|
|
1012
1059
|
error,
|
|
1013
1060
|
disabled
|
|
1014
1061
|
};
|
|
1015
|
-
const classes = controlVariants({ variant, color, label });
|
|
1062
|
+
const classes = controlVariants({ variant, color, label, size });
|
|
1016
1063
|
return /* @__PURE__ */ jsx13(ControlContext.Provider, { value, children: /* @__PURE__ */ jsx13(
|
|
1017
1064
|
"div",
|
|
1018
1065
|
{
|
|
@@ -1494,7 +1541,8 @@ var initiaPropsComponent = {
|
|
|
1494
1541
|
display: true,
|
|
1495
1542
|
ui: {},
|
|
1496
1543
|
style: {}
|
|
1497
|
-
}
|
|
1544
|
+
},
|
|
1545
|
+
control: {}
|
|
1498
1546
|
};
|
|
1499
1547
|
var Input = React12.forwardRef(
|
|
1500
1548
|
({
|
|
@@ -1509,11 +1557,11 @@ var Input = React12.forwardRef(
|
|
|
1509
1557
|
propsComponent = initiaPropsComponent,
|
|
1510
1558
|
type = "text",
|
|
1511
1559
|
color = "primary",
|
|
1560
|
+
size = "auto",
|
|
1512
1561
|
...props
|
|
1513
1562
|
}, ref) => {
|
|
1514
1563
|
const [focused, setFocused] = React12.useState(false);
|
|
1515
1564
|
const [internalValue, setInternalValue] = React12.useState(defaultValue);
|
|
1516
|
-
const [internalError, setInternalError] = React12.useState(null);
|
|
1517
1565
|
const isControlled = value !== void 0;
|
|
1518
1566
|
const currentValue = isControlled ? value : internalValue;
|
|
1519
1567
|
const isActive = focused || !!currentValue;
|
|
@@ -1531,19 +1579,13 @@ var Input = React12.forwardRef(
|
|
|
1531
1579
|
};
|
|
1532
1580
|
const handleChange = (e) => {
|
|
1533
1581
|
const newValue = e.target.value;
|
|
1534
|
-
const isValid = checkPattern(type, newValue);
|
|
1535
|
-
if (!isValid) {
|
|
1536
|
-
setInternalError("Valore non valido");
|
|
1537
|
-
} else {
|
|
1538
|
-
setInternalError(null);
|
|
1539
|
-
}
|
|
1540
1582
|
if (!isControlled) {
|
|
1541
1583
|
setInternalValue(newValue);
|
|
1542
1584
|
}
|
|
1543
1585
|
onChange?.(e, newValue);
|
|
1544
1586
|
};
|
|
1545
1587
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1546
|
-
return /* @__PURE__ */ jsxs6(Control, { variant, color, label: propsComponent?.label?.display, children: [
|
|
1588
|
+
return /* @__PURE__ */ jsxs6(Control, { variant, color, label: propsComponent?.label?.display, ...propsComponent.control, children: [
|
|
1547
1589
|
propsComponent?.label?.display && /* @__PURE__ */ jsx24(
|
|
1548
1590
|
Label,
|
|
1549
1591
|
{
|
|
@@ -1561,6 +1603,7 @@ var Input = React12.forwardRef(
|
|
|
1561
1603
|
type,
|
|
1562
1604
|
autoComplete: "off",
|
|
1563
1605
|
onChange: handleChange,
|
|
1606
|
+
onKeyDown: (e) => checkPattern(type, e.key),
|
|
1564
1607
|
onFocus: () => setFocused(true),
|
|
1565
1608
|
onBlur: () => setFocused(false),
|
|
1566
1609
|
className: classes,
|
|
@@ -1568,144 +1611,13 @@ var Input = React12.forwardRef(
|
|
|
1568
1611
|
...props,
|
|
1569
1612
|
"data-testid": "yr3Input"
|
|
1570
1613
|
}
|
|
1571
|
-
)
|
|
1572
|
-
/* @__PURE__ */ jsx24(Text, { variant: "helper", "data-testid": "yr3Input-helper", children: error || internalError || "" })
|
|
1614
|
+
)
|
|
1573
1615
|
] });
|
|
1574
1616
|
}
|
|
1575
1617
|
);
|
|
1576
1618
|
|
|
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
1619
|
// src/components/InputArea/InputArea.tsx
|
|
1708
|
-
import * as
|
|
1620
|
+
import * as React13 from "react";
|
|
1709
1621
|
|
|
1710
1622
|
// src/components/InputArea/inputAreaVariants.ts
|
|
1711
1623
|
var inputAreaVariants = createVariants({
|
|
@@ -1741,7 +1653,7 @@ var inputAreaVariants = createVariants({
|
|
|
1741
1653
|
});
|
|
1742
1654
|
|
|
1743
1655
|
// src/components/InputArea/InputArea.tsx
|
|
1744
|
-
import { jsx as
|
|
1656
|
+
import { jsx as jsx25, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1745
1657
|
var initiaPropsComponent2 = {
|
|
1746
1658
|
label: {
|
|
1747
1659
|
display: true,
|
|
@@ -1766,8 +1678,8 @@ var InputArea = ({
|
|
|
1766
1678
|
rounded = false,
|
|
1767
1679
|
propsComponent = initiaPropsComponent2
|
|
1768
1680
|
}) => {
|
|
1769
|
-
const ref =
|
|
1770
|
-
const [internalValue, setInternalValue] =
|
|
1681
|
+
const ref = React13.useRef(null);
|
|
1682
|
+
const [internalValue, setInternalValue] = React13.useState(defaultValue);
|
|
1771
1683
|
const isControlled = value !== void 0;
|
|
1772
1684
|
const currentValue = isControlled ? value : internalValue;
|
|
1773
1685
|
const handleChange = (e) => {
|
|
@@ -1784,8 +1696,8 @@ var InputArea = ({
|
|
|
1784
1696
|
el.style.resize = resize;
|
|
1785
1697
|
}
|
|
1786
1698
|
const classes = inputAreaVariants({ variant, color, rounded });
|
|
1787
|
-
return /* @__PURE__ */
|
|
1788
|
-
propsComponent?.label?.display && /* @__PURE__ */
|
|
1699
|
+
return /* @__PURE__ */ jsxs7("div", { style: { position: "relative" }, children: [
|
|
1700
|
+
propsComponent?.label?.display && /* @__PURE__ */ jsx25(
|
|
1789
1701
|
Label,
|
|
1790
1702
|
{
|
|
1791
1703
|
text: label || "",
|
|
@@ -1793,7 +1705,7 @@ var InputArea = ({
|
|
|
1793
1705
|
...propsComponent.label
|
|
1794
1706
|
}
|
|
1795
1707
|
),
|
|
1796
|
-
/* @__PURE__ */
|
|
1708
|
+
/* @__PURE__ */ jsx25(
|
|
1797
1709
|
"textarea",
|
|
1798
1710
|
{
|
|
1799
1711
|
className: classes,
|
|
@@ -1805,26 +1717,26 @@ var InputArea = ({
|
|
|
1805
1717
|
"data-testid": "yr3InputArea"
|
|
1806
1718
|
}
|
|
1807
1719
|
),
|
|
1808
|
-
/* @__PURE__ */
|
|
1720
|
+
/* @__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
1721
|
] });
|
|
1810
1722
|
};
|
|
1811
1723
|
|
|
1812
1724
|
// src/components/Modal/Modal.tsx
|
|
1813
|
-
import * as
|
|
1725
|
+
import * as React14 from "react";
|
|
1814
1726
|
|
|
1815
1727
|
// src/components/Modal/ModalContainer.tsx
|
|
1816
|
-
import { jsx as
|
|
1728
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1817
1729
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
1818
1730
|
const classes = bem("yr3Modal-container");
|
|
1819
1731
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
1820
|
-
return /* @__PURE__ */
|
|
1732
|
+
return /* @__PURE__ */ jsx26("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
1821
1733
|
};
|
|
1822
1734
|
|
|
1823
1735
|
// src/components/Modal/Modal.tsx
|
|
1824
|
-
import { jsx as
|
|
1736
|
+
import { jsx as jsx27, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1825
1737
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
1826
1738
|
const { show, hide } = useBackdrop();
|
|
1827
|
-
|
|
1739
|
+
React14.useEffect(() => {
|
|
1828
1740
|
if (open) {
|
|
1829
1741
|
show();
|
|
1830
1742
|
} else {
|
|
@@ -1833,9 +1745,9 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
1833
1745
|
}, [open, show]);
|
|
1834
1746
|
const classes = bem("yr3Modal");
|
|
1835
1747
|
const classComponent = classes(void 0, { "open": !!open });
|
|
1836
|
-
return /* @__PURE__ */
|
|
1748
|
+
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
1749
|
children,
|
|
1838
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */
|
|
1750
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ jsx27(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
1839
1751
|
] }) }) });
|
|
1840
1752
|
};
|
|
1841
1753
|
|
|
@@ -1875,15 +1787,15 @@ var notistackVariants = createVariants({
|
|
|
1875
1787
|
});
|
|
1876
1788
|
|
|
1877
1789
|
// src/components/Notistack/Notistack.tsx
|
|
1878
|
-
import { jsx as
|
|
1790
|
+
import { jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1879
1791
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
1880
1792
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
1881
1793
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
1882
1794
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
1883
1795
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
1884
|
-
return /* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
/* @__PURE__ */
|
|
1796
|
+
return /* @__PURE__ */ jsxs9("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
1797
|
+
/* @__PURE__ */ jsx28("span", { style: containerStyle, children: message }),
|
|
1798
|
+
/* @__PURE__ */ jsx28(
|
|
1887
1799
|
"div",
|
|
1888
1800
|
{
|
|
1889
1801
|
className: "yr3Notistack--progress",
|
|
@@ -1917,7 +1829,7 @@ var pendingVariants = createVariants({
|
|
|
1917
1829
|
});
|
|
1918
1830
|
|
|
1919
1831
|
// src/components/Pending/Pending.tsx
|
|
1920
|
-
import { jsx as
|
|
1832
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1921
1833
|
var Pending = ({
|
|
1922
1834
|
variant,
|
|
1923
1835
|
width,
|
|
@@ -1930,7 +1842,7 @@ var Pending = ({
|
|
|
1930
1842
|
const widthStyle = variant === "circle" ? size : width;
|
|
1931
1843
|
const heightStyle = variant === "circle" ? size : height;
|
|
1932
1844
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
1933
|
-
return /* @__PURE__ */
|
|
1845
|
+
return /* @__PURE__ */ jsx29(
|
|
1934
1846
|
"div",
|
|
1935
1847
|
{
|
|
1936
1848
|
className: pendingVariants({ variant, color }),
|
|
@@ -1940,10 +1852,151 @@ var Pending = ({
|
|
|
1940
1852
|
);
|
|
1941
1853
|
};
|
|
1942
1854
|
|
|
1855
|
+
// src/components/Phone/Phone.tsx
|
|
1856
|
+
import * as React16 from "react";
|
|
1857
|
+
|
|
1858
|
+
// src/components/Selector/Selector.tsx
|
|
1859
|
+
import * as React15 from "react";
|
|
1860
|
+
|
|
1861
|
+
// src/Icons/IconDown.tsx
|
|
1862
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1863
|
+
var IconDown = (props) => {
|
|
1864
|
+
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" }) });
|
|
1865
|
+
};
|
|
1866
|
+
|
|
1867
|
+
// src/components/Selector/Selector.tsx
|
|
1868
|
+
import { jsx as jsx31, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1869
|
+
var initalPropsComponent2 = {
|
|
1870
|
+
text: {
|
|
1871
|
+
variant: "caption",
|
|
1872
|
+
color: "primary",
|
|
1873
|
+
children: void 0
|
|
1874
|
+
},
|
|
1875
|
+
menu: {
|
|
1876
|
+
ui: {},
|
|
1877
|
+
style: {}
|
|
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", style: composeStyles(propsComponent.menu?.ui, propsComponent.menu?.style), 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 isControlled = value !== void 0;
|
|
1931
|
+
const initial = value || defaultValue || "";
|
|
1932
|
+
const [prefix, setPrefix] = React16.useState(
|
|
1933
|
+
getDialPhone(initial, countries) || countries[0].dial
|
|
1934
|
+
);
|
|
1935
|
+
const [number, setNumber] = React16.useState(
|
|
1936
|
+
getNumberPhone(initial, prefix) || ""
|
|
1937
|
+
);
|
|
1938
|
+
React16.useEffect(() => {
|
|
1939
|
+
if (isControlled && value) {
|
|
1940
|
+
const dial = getDialPhone(value, countries);
|
|
1941
|
+
const num = getNumberPhone(value, dial);
|
|
1942
|
+
setPrefix(dial);
|
|
1943
|
+
setNumber(num);
|
|
1944
|
+
}
|
|
1945
|
+
}, [value]);
|
|
1946
|
+
const handleNumberChange = (e, val) => {
|
|
1947
|
+
const clean = val.replace(/[^\d]/g, "");
|
|
1948
|
+
if (!isControlled) {
|
|
1949
|
+
setNumber(clean);
|
|
1950
|
+
}
|
|
1951
|
+
onChange?.(e, `${prefix}${clean}`);
|
|
1952
|
+
};
|
|
1953
|
+
const handlePrefixChange = (_, val) => {
|
|
1954
|
+
setPrefix(val);
|
|
1955
|
+
onChange?.(null, `${val}${number}`);
|
|
1956
|
+
};
|
|
1957
|
+
return /* @__PURE__ */ jsxs11(Control, { variant: "outlined", ui: { height: 50, position: "relative" }, children: [
|
|
1958
|
+
/* @__PURE__ */ jsx32(Label, { text: label, className: "yr3Input--active" }),
|
|
1959
|
+
/* @__PURE__ */ jsxs11(Flex, { variant: "row", container: true, center: true, children: [
|
|
1960
|
+
/* @__PURE__ */ jsx32(
|
|
1961
|
+
Selector_default,
|
|
1962
|
+
{
|
|
1963
|
+
options: countries.map((c) => ({
|
|
1964
|
+
value: c.dial,
|
|
1965
|
+
label: c.code
|
|
1966
|
+
})),
|
|
1967
|
+
value: prefix,
|
|
1968
|
+
onChange: handlePrefixChange,
|
|
1969
|
+
...propsComponent?.selector
|
|
1970
|
+
}
|
|
1971
|
+
),
|
|
1972
|
+
/* @__PURE__ */ jsx32(
|
|
1973
|
+
Divider,
|
|
1974
|
+
{
|
|
1975
|
+
orientation: "vertical",
|
|
1976
|
+
color: "primary",
|
|
1977
|
+
ui: { height: 49 },
|
|
1978
|
+
...propsComponent?.divider
|
|
1979
|
+
}
|
|
1980
|
+
),
|
|
1981
|
+
/* @__PURE__ */ jsx32(
|
|
1982
|
+
Input,
|
|
1983
|
+
{
|
|
1984
|
+
type: "number",
|
|
1985
|
+
name,
|
|
1986
|
+
value: number,
|
|
1987
|
+
variant: "base",
|
|
1988
|
+
...propsComponent?.input,
|
|
1989
|
+
onChange: handleNumberChange
|
|
1990
|
+
}
|
|
1991
|
+
)
|
|
1992
|
+
] })
|
|
1993
|
+
] });
|
|
1994
|
+
};
|
|
1995
|
+
|
|
1943
1996
|
// src/components/Places/PlacesAutocomplete.tsx
|
|
1944
|
-
import * as
|
|
1997
|
+
import * as React17 from "react";
|
|
1945
1998
|
import { useAutocompletePlaces } from "@yr3/autocomplete-places";
|
|
1946
|
-
import { jsx as
|
|
1999
|
+
import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1947
2000
|
var initPropsComponent = {
|
|
1948
2001
|
label: {
|
|
1949
2002
|
display: true,
|
|
@@ -1983,9 +2036,9 @@ var PlacesAutocomplete = ({
|
|
|
1983
2036
|
keyApi,
|
|
1984
2037
|
propsComponent = initPropsComponent
|
|
1985
2038
|
}) => {
|
|
1986
|
-
const [value, setValue] =
|
|
1987
|
-
const inputRef =
|
|
1988
|
-
const [anchorEl, setAnchorEl] =
|
|
2039
|
+
const [value, setValue] = React17.useState(null);
|
|
2040
|
+
const inputRef = React17.useRef(null);
|
|
2041
|
+
const [anchorEl, setAnchorEl] = React17.useState(null);
|
|
1989
2042
|
const { suggestions, selectPlace } = useAutocompletePlaces({ input: value, apiKey: keyApi, language, provider });
|
|
1990
2043
|
const handleSelect = async (id) => {
|
|
1991
2044
|
const place = await selectPlace(id);
|
|
@@ -2005,12 +2058,12 @@ var PlacesAutocomplete = ({
|
|
|
2005
2058
|
setValue(place.address);
|
|
2006
2059
|
setAnchorEl(null);
|
|
2007
2060
|
};
|
|
2008
|
-
|
|
2061
|
+
React17.useEffect(() => {
|
|
2009
2062
|
if (defaultLocation) {
|
|
2010
2063
|
setValue(defaultLocation);
|
|
2011
2064
|
}
|
|
2012
2065
|
}, [defaultLocation]);
|
|
2013
|
-
|
|
2066
|
+
React17.useEffect(() => {
|
|
2014
2067
|
if (value === "") {
|
|
2015
2068
|
onSelect(null);
|
|
2016
2069
|
}
|
|
@@ -2020,13 +2073,13 @@ var PlacesAutocomplete = ({
|
|
|
2020
2073
|
setAnchorEl(e.target.value ? inputRef.current : null);
|
|
2021
2074
|
};
|
|
2022
2075
|
const open = suggestions.length > 0 && Boolean(anchorEl);
|
|
2023
|
-
|
|
2076
|
+
React17.useEffect(() => {
|
|
2024
2077
|
if (onChangeForm) {
|
|
2025
2078
|
onChangeForm({ target: { value } });
|
|
2026
2079
|
}
|
|
2027
2080
|
}, [onChangeForm]);
|
|
2028
2081
|
return /* @__PURE__ */ jsxs12(Control, { ...propsComponent?.control, children: [
|
|
2029
|
-
/* @__PURE__ */
|
|
2082
|
+
/* @__PURE__ */ jsx33(
|
|
2030
2083
|
Input,
|
|
2031
2084
|
{
|
|
2032
2085
|
ref: inputRef,
|
|
@@ -2040,7 +2093,7 @@ var PlacesAutocomplete = ({
|
|
|
2040
2093
|
},
|
|
2041
2094
|
"input-places"
|
|
2042
2095
|
),
|
|
2043
|
-
open && /* @__PURE__ */
|
|
2096
|
+
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
2097
|
] });
|
|
2045
2098
|
};
|
|
2046
2099
|
|
|
@@ -2063,7 +2116,7 @@ var radioVariant = createVariants({
|
|
|
2063
2116
|
});
|
|
2064
2117
|
|
|
2065
2118
|
// src/components/Radio/Radio.tsx
|
|
2066
|
-
import { jsx as
|
|
2119
|
+
import { jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2067
2120
|
var Radio = ({
|
|
2068
2121
|
checked,
|
|
2069
2122
|
value,
|
|
@@ -2080,7 +2133,7 @@ var Radio = ({
|
|
|
2080
2133
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
2081
2134
|
const variantClass = radioVariant({ variant });
|
|
2082
2135
|
return /* @__PURE__ */ jsxs13("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2083
|
-
/* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ jsx34(
|
|
2084
2137
|
"input",
|
|
2085
2138
|
{
|
|
2086
2139
|
type: "radio",
|
|
@@ -2092,8 +2145,8 @@ var Radio = ({
|
|
|
2092
2145
|
}
|
|
2093
2146
|
),
|
|
2094
2147
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
2095
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */
|
|
2096
|
-
typeof label === "string" && /* @__PURE__ */
|
|
2148
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ jsx34("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2149
|
+
typeof label === "string" && /* @__PURE__ */ jsx34(
|
|
2097
2150
|
"span",
|
|
2098
2151
|
{
|
|
2099
2152
|
className: "yr3Radio--label",
|
|
@@ -2106,26 +2159,25 @@ var Radio = ({
|
|
|
2106
2159
|
};
|
|
2107
2160
|
|
|
2108
2161
|
// src/components/Select/Select.tsx
|
|
2109
|
-
import * as
|
|
2110
|
-
import { jsx as
|
|
2162
|
+
import * as React18 from "react";
|
|
2163
|
+
import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2111
2164
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
2112
|
-
const [open, setOpen] =
|
|
2113
|
-
const [valueState, setValueState] =
|
|
2114
|
-
const ref =
|
|
2165
|
+
const [open, setOpen] = React18.useState(false);
|
|
2166
|
+
const [valueState, setValueState] = React18.useState(value || defaultValue || null);
|
|
2167
|
+
const ref = React18.useRef(null);
|
|
2115
2168
|
useClickAway(ref, () => setOpen(false));
|
|
2116
2169
|
return /* @__PURE__ */ jsxs14(Control, { ...propsComponent?.control, children: [
|
|
2117
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsx35(
|
|
2118
2171
|
Label,
|
|
2119
2172
|
{
|
|
2120
2173
|
...propsComponent?.label,
|
|
2121
|
-
text: label || "seleziona"
|
|
2122
|
-
className: open || valueState ? "yr3Input--active" : ""
|
|
2174
|
+
text: label || "seleziona"
|
|
2123
2175
|
}
|
|
2124
2176
|
),
|
|
2125
2177
|
/* @__PURE__ */ jsxs14("div", { className: "yr3Select-wrapper", ref, children: [
|
|
2126
2178
|
/* @__PURE__ */ jsxs14("div", { className: `yr3Select ${open ? "yr3Select--open" : ""}`, "data-testid": "yr3Select-wrapper", style: composeStyles(propsComponent?.wrapper?.ui, propsComponent?.wrapper?.style), children: [
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2179
|
+
/* @__PURE__ */ jsx35("div", { className: "yr3Select--control", children: valueState }),
|
|
2180
|
+
/* @__PURE__ */ jsx35("div", { className: "yr3Select--icon", onClick: () => setOpen((prev) => !prev), "data-testid": "yr3Select-icon", children: propsComponent?.icon?.component ? propsComponent.icon.component : /* @__PURE__ */ jsx35(
|
|
2129
2181
|
IconDown,
|
|
2130
2182
|
{
|
|
2131
2183
|
width: propsComponent?.icon?.style?.width || 26,
|
|
@@ -2135,13 +2187,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2135
2187
|
}
|
|
2136
2188
|
) })
|
|
2137
2189
|
] }),
|
|
2138
|
-
open && /* @__PURE__ */
|
|
2190
|
+
open && /* @__PURE__ */ jsx35(
|
|
2139
2191
|
"div",
|
|
2140
2192
|
{
|
|
2141
2193
|
className: "yr3Select--menu",
|
|
2142
2194
|
style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
|
|
2143
2195
|
"data-testid": "yr3Select-menu",
|
|
2144
|
-
children: options.map((opt) => /* @__PURE__ */
|
|
2196
|
+
children: options.map((opt) => /* @__PURE__ */ jsx35(
|
|
2145
2197
|
"div",
|
|
2146
2198
|
{
|
|
2147
2199
|
className: "yr3Select--option",
|
|
@@ -2173,8 +2225,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2173
2225
|
};
|
|
2174
2226
|
|
|
2175
2227
|
// src/components/Slide/Slide.tsx
|
|
2176
|
-
import * as
|
|
2177
|
-
import { jsx as
|
|
2228
|
+
import * as React19 from "react";
|
|
2229
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
2178
2230
|
var Slide = ({
|
|
2179
2231
|
in: inProp,
|
|
2180
2232
|
children,
|
|
@@ -2188,7 +2240,7 @@ var Slide = ({
|
|
|
2188
2240
|
[direction]: true,
|
|
2189
2241
|
"in": !!inProp
|
|
2190
2242
|
});
|
|
2191
|
-
|
|
2243
|
+
React19.useEffect(() => {
|
|
2192
2244
|
let timeoutId;
|
|
2193
2245
|
if (inProp) {
|
|
2194
2246
|
timeoutId = setTimeout(() => {
|
|
@@ -2198,19 +2250,19 @@ var Slide = ({
|
|
|
2198
2250
|
return () => clearTimeout(timeoutId);
|
|
2199
2251
|
}, [inProp, duration, onTransitionEnd]);
|
|
2200
2252
|
const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2201
|
-
return /* @__PURE__ */
|
|
2253
|
+
return /* @__PURE__ */ jsx36(
|
|
2202
2254
|
"div",
|
|
2203
2255
|
{
|
|
2204
2256
|
className: "yr3Slide",
|
|
2205
2257
|
style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
|
|
2206
2258
|
"data-testid": "yr3Slide",
|
|
2207
|
-
children: /* @__PURE__ */
|
|
2259
|
+
children: /* @__PURE__ */ jsx36(
|
|
2208
2260
|
"div",
|
|
2209
2261
|
{
|
|
2210
2262
|
className: classNameContent,
|
|
2211
2263
|
style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
|
|
2212
2264
|
"data-testid": "yr3Slide-content",
|
|
2213
|
-
children: /* @__PURE__ */
|
|
2265
|
+
children: /* @__PURE__ */ jsx36(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
|
|
2214
2266
|
}
|
|
2215
2267
|
)
|
|
2216
2268
|
}
|
|
@@ -2218,7 +2270,7 @@ var Slide = ({
|
|
|
2218
2270
|
};
|
|
2219
2271
|
|
|
2220
2272
|
// src/components/Switch/Switch.tsx
|
|
2221
|
-
import * as
|
|
2273
|
+
import * as React20 from "react";
|
|
2222
2274
|
|
|
2223
2275
|
// src/components/Switch/switch.variants.ts
|
|
2224
2276
|
var switchVariants = createVariants({
|
|
@@ -2247,7 +2299,7 @@ var switchVariants = createVariants({
|
|
|
2247
2299
|
});
|
|
2248
2300
|
|
|
2249
2301
|
// src/components/Switch/Switch.tsx
|
|
2250
|
-
import { jsx as
|
|
2302
|
+
import { jsx as jsx37, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2251
2303
|
var Switch = ({
|
|
2252
2304
|
checked,
|
|
2253
2305
|
defaultChecked,
|
|
@@ -2257,7 +2309,7 @@ var Switch = ({
|
|
|
2257
2309
|
size = "sm",
|
|
2258
2310
|
label
|
|
2259
2311
|
}) => {
|
|
2260
|
-
const [internal, setInternal] =
|
|
2312
|
+
const [internal, setInternal] = React20.useState(defaultChecked || false);
|
|
2261
2313
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
|
|
2262
2314
|
const isControlled = checked !== void 0;
|
|
2263
2315
|
const value = isControlled ? checked : internal;
|
|
@@ -2271,7 +2323,7 @@ var Switch = ({
|
|
|
2271
2323
|
className: classname,
|
|
2272
2324
|
"data-testid": "yr3Switch",
|
|
2273
2325
|
children: [
|
|
2274
|
-
/* @__PURE__ */
|
|
2326
|
+
/* @__PURE__ */ jsx37(
|
|
2275
2327
|
"input",
|
|
2276
2328
|
{
|
|
2277
2329
|
type: "checkbox",
|
|
@@ -2280,17 +2332,17 @@ var Switch = ({
|
|
|
2280
2332
|
disabled
|
|
2281
2333
|
}
|
|
2282
2334
|
),
|
|
2283
|
-
/* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */
|
|
2335
|
+
/* @__PURE__ */ jsx37("span", { className: "yr3Switch--track", children: /* @__PURE__ */ jsx37("span", { className: "yr3Switch--thumb" }) }),
|
|
2336
|
+
/* @__PURE__ */ jsx37("span", { className: "yr3Switch--label", "data-testid": "yr3Switch-label", children: label })
|
|
2285
2337
|
]
|
|
2286
2338
|
}
|
|
2287
2339
|
);
|
|
2288
2340
|
};
|
|
2289
2341
|
|
|
2290
2342
|
// src/Icons/IconSearch.tsx
|
|
2291
|
-
import { jsx as
|
|
2343
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2292
2344
|
var IconSearch = (props) => {
|
|
2293
|
-
return /* @__PURE__ */
|
|
2345
|
+
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
2346
|
"path",
|
|
2295
2347
|
{
|
|
2296
2348
|
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 +2354,18 @@ var IconSearch = (props) => {
|
|
|
2302
2354
|
) });
|
|
2303
2355
|
};
|
|
2304
2356
|
|
|
2357
|
+
// src/theme/ThemeProvider.tsx
|
|
2358
|
+
import * as React21 from "react";
|
|
2359
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2360
|
+
var ThemeContext = React21.createContext(null);
|
|
2361
|
+
var ThemeProvider = ({ theme, children }) => {
|
|
2362
|
+
React21.useEffect(() => {
|
|
2363
|
+
applyTheme(theme);
|
|
2364
|
+
}, [theme]);
|
|
2365
|
+
return /* @__PURE__ */ jsx39(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ jsx39(BackdropProvider, { children }) });
|
|
2366
|
+
};
|
|
2367
|
+
var useTheme = () => React21.useContext(ThemeContext);
|
|
2368
|
+
|
|
2305
2369
|
// src/theme/tokens.ts
|
|
2306
2370
|
var baseTokens = {
|
|
2307
2371
|
colors: {
|
|
@@ -2379,6 +2443,16 @@ function useBreakpointValue(values) {
|
|
|
2379
2443
|
return void 0;
|
|
2380
2444
|
}
|
|
2381
2445
|
|
|
2446
|
+
// src/hooks/usePlaces.ts
|
|
2447
|
+
import { useAutocompletePlaces as useAutocompletePlaces2 } from "@yr3/autocomplete-places";
|
|
2448
|
+
var usePlaces = ({ input, language, apiKey, provider }) => {
|
|
2449
|
+
const { suggestions, selectPlace } = useAutocompletePlaces2({ apiKey, provider, language, input });
|
|
2450
|
+
return {
|
|
2451
|
+
suggestions,
|
|
2452
|
+
selectPlace
|
|
2453
|
+
};
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2382
2456
|
// src/index.ts
|
|
2383
2457
|
initTheme();
|
|
2384
2458
|
export {
|
|
@@ -2435,9 +2509,13 @@ export {
|
|
|
2435
2509
|
createVariants,
|
|
2436
2510
|
cx,
|
|
2437
2511
|
getContrast,
|
|
2512
|
+
getCountryCodePhone,
|
|
2513
|
+
getDialPhone,
|
|
2438
2514
|
getMonthCalendar,
|
|
2515
|
+
getNumberPhone,
|
|
2439
2516
|
initTheme,
|
|
2440
2517
|
isEmpty,
|
|
2518
|
+
normalizePhone,
|
|
2441
2519
|
text,
|
|
2442
2520
|
times,
|
|
2443
2521
|
uiStyle,
|
|
@@ -2447,5 +2525,6 @@ export {
|
|
|
2447
2525
|
useControl,
|
|
2448
2526
|
useMediaQuery,
|
|
2449
2527
|
useNotistack,
|
|
2528
|
+
usePlaces,
|
|
2450
2529
|
useTheme
|
|
2451
2530
|
};
|