@yr3/ui 1.0.3 → 1.0.4
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/Calendar/calendar.css +5 -3
- package/dist/components/Calendar/calendar.css.map +1 -1
- package/dist/index.cjs +260 -95
- package/dist/index.d.cts +61 -20
- package/dist/index.d.ts +61 -20
- package/dist/index.js +258 -95
- package/dist/styles/index.css +92 -3
- package/dist/styles/index.css.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,9 @@ __export(index_exports, {
|
|
|
53
53
|
IconDown: () => IconDown,
|
|
54
54
|
IconSearch: () => IconSearch,
|
|
55
55
|
Image: () => Image,
|
|
56
|
+
ImageDropzone: () => ImageDropzone,
|
|
56
57
|
Input: () => Input,
|
|
58
|
+
InputArea: () => InputArea,
|
|
57
59
|
Label: () => Label,
|
|
58
60
|
Modal: () => Modal,
|
|
59
61
|
ModalContainer: () => ModalContainer,
|
|
@@ -1469,16 +1471,72 @@ var Image = ({
|
|
|
1469
1471
|
);
|
|
1470
1472
|
};
|
|
1471
1473
|
|
|
1472
|
-
// src/components/
|
|
1474
|
+
// src/components/ImageDropzone/ImageDropzone.tsx
|
|
1473
1475
|
var React11 = __toESM(require("react"), 1);
|
|
1476
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1477
|
+
var ImageDropzone = ({ onChange, multiple, ui, style, propsComponent, bordered, component, defaultImage, variant = "outlined" }) => {
|
|
1478
|
+
const [dragging, setDragging] = React11.useState(false);
|
|
1479
|
+
const [files, setFiles] = React11.useState([]);
|
|
1480
|
+
const inputRef = React11.useRef(null);
|
|
1481
|
+
const handleFiles = (fileList) => {
|
|
1482
|
+
if (!fileList) return;
|
|
1483
|
+
const newFiles = Array.from(fileList);
|
|
1484
|
+
setFiles((prev) => {
|
|
1485
|
+
const updated = multiple ? [...prev, ...newFiles] : newFiles;
|
|
1486
|
+
onChange?.(updated);
|
|
1487
|
+
return updated;
|
|
1488
|
+
});
|
|
1489
|
+
};
|
|
1490
|
+
const classes = bem("yr3Dropzone");
|
|
1491
|
+
const classComponent = classes(void 0, { "dragging": !!dragging, "bordered": !!bordered, variant });
|
|
1492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { as: "div", position: "relative", content: "center", ...propsComponent?.box, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1493
|
+
"div",
|
|
1494
|
+
{
|
|
1495
|
+
className: classComponent,
|
|
1496
|
+
onDragOver: (e) => {
|
|
1497
|
+
e.preventDefault();
|
|
1498
|
+
setDragging(true);
|
|
1499
|
+
},
|
|
1500
|
+
onDragLeave: () => setDragging(false),
|
|
1501
|
+
onDrop: (e) => {
|
|
1502
|
+
e.preventDefault();
|
|
1503
|
+
setDragging(false);
|
|
1504
|
+
handleFiles(e.dataTransfer.files);
|
|
1505
|
+
},
|
|
1506
|
+
onClick: () => inputRef.current?.click(),
|
|
1507
|
+
style: composeStyles(ui, style),
|
|
1508
|
+
children: [
|
|
1509
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1510
|
+
"input",
|
|
1511
|
+
{
|
|
1512
|
+
ref: inputRef,
|
|
1513
|
+
type: "file",
|
|
1514
|
+
hidden: true,
|
|
1515
|
+
multiple,
|
|
1516
|
+
accept: "image/*",
|
|
1517
|
+
onChange: (e) => handleFiles(e.target.files)
|
|
1518
|
+
}
|
|
1519
|
+
),
|
|
1520
|
+
isEmpty(files) && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--content", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { variant: "helper", color: "disabled", ...propsComponent?.text, children: propsComponent?.text?.primary || "Drag and drop an image here, or click to select one" }) }),
|
|
1521
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--previews", children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1522
|
+
!multiple && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--preview", children: files.map((file, i) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: URL.createObjectURL(file) }, i)) }),
|
|
1523
|
+
!!defaultImage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "yr3Dropzone--preview", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("img", { src: defaultImage }) }),
|
|
1524
|
+
component
|
|
1525
|
+
]
|
|
1526
|
+
}
|
|
1527
|
+
) });
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
// src/components/Input/Input.tsx
|
|
1531
|
+
var React12 = __toESM(require("react"), 1);
|
|
1474
1532
|
|
|
1475
1533
|
// src/components/Label/Label.tsx
|
|
1476
|
-
var
|
|
1534
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1477
1535
|
var Label = ({ text: text2, children, className, color = "primary", ui, style }) => {
|
|
1478
1536
|
const classes = bem("yr3Label");
|
|
1479
1537
|
const classComponent = classes(void 0, { color: `color-${color}` });
|
|
1480
1538
|
const classnames = bemMerge(classComponent, className);
|
|
1481
|
-
return /* @__PURE__ */ (0,
|
|
1539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1482
1540
|
"span",
|
|
1483
1541
|
{
|
|
1484
1542
|
className: classnames,
|
|
@@ -1530,7 +1588,7 @@ var inputVariants = createVariants({
|
|
|
1530
1588
|
});
|
|
1531
1589
|
|
|
1532
1590
|
// src/components/Input/Input.tsx
|
|
1533
|
-
var
|
|
1591
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1534
1592
|
var initiaPropsComponent = {
|
|
1535
1593
|
label: {
|
|
1536
1594
|
display: true,
|
|
@@ -1538,7 +1596,7 @@ var initiaPropsComponent = {
|
|
|
1538
1596
|
style: {}
|
|
1539
1597
|
}
|
|
1540
1598
|
};
|
|
1541
|
-
var Input =
|
|
1599
|
+
var Input = React12.forwardRef(
|
|
1542
1600
|
({
|
|
1543
1601
|
label,
|
|
1544
1602
|
value,
|
|
@@ -1553,9 +1611,9 @@ var Input = React11.forwardRef(
|
|
|
1553
1611
|
color = "primary",
|
|
1554
1612
|
...props
|
|
1555
1613
|
}, ref) => {
|
|
1556
|
-
const [focused, setFocused] =
|
|
1557
|
-
const [internalValue, setInternalValue] =
|
|
1558
|
-
const [internalError, setInternalError] =
|
|
1614
|
+
const [focused, setFocused] = React12.useState(false);
|
|
1615
|
+
const [internalValue, setInternalValue] = React12.useState(defaultValue);
|
|
1616
|
+
const [internalError, setInternalError] = React12.useState(null);
|
|
1559
1617
|
const isControlled = value !== void 0;
|
|
1560
1618
|
const currentValue = isControlled ? value : internalValue;
|
|
1561
1619
|
const isActive = focused || !!currentValue;
|
|
@@ -1585,8 +1643,8 @@ var Input = React11.forwardRef(
|
|
|
1585
1643
|
onChange?.(e, newValue);
|
|
1586
1644
|
};
|
|
1587
1645
|
const classes = inputVariants({ color, label: propsComponent?.label?.display });
|
|
1588
|
-
return /* @__PURE__ */ (0,
|
|
1589
|
-
propsComponent?.label?.display && /* @__PURE__ */ (0,
|
|
1646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Control, { variant, color, label: propsComponent?.label?.display, children: [
|
|
1647
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1590
1648
|
Label,
|
|
1591
1649
|
{
|
|
1592
1650
|
text: label || "",
|
|
@@ -1595,7 +1653,7 @@ var Input = React11.forwardRef(
|
|
|
1595
1653
|
...propsComponent.label
|
|
1596
1654
|
}
|
|
1597
1655
|
),
|
|
1598
|
-
/* @__PURE__ */ (0,
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1599
1657
|
"input",
|
|
1600
1658
|
{
|
|
1601
1659
|
ref,
|
|
@@ -1611,36 +1669,36 @@ var Input = React11.forwardRef(
|
|
|
1611
1669
|
"data-testid": "yr3Input"
|
|
1612
1670
|
}
|
|
1613
1671
|
),
|
|
1614
|
-
/* @__PURE__ */ (0,
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { variant: "helper", "data-testid": "yr3Input-helper", children: error || internalError || "" })
|
|
1615
1673
|
] });
|
|
1616
1674
|
}
|
|
1617
1675
|
);
|
|
1618
1676
|
|
|
1619
1677
|
// src/components/Input/InputPhone.tsx
|
|
1620
|
-
var
|
|
1678
|
+
var React15 = __toESM(require("react"), 1);
|
|
1621
1679
|
|
|
1622
1680
|
// src/components/Select/Selector.tsx
|
|
1623
|
-
var
|
|
1681
|
+
var React13 = __toESM(require("react"), 1);
|
|
1624
1682
|
|
|
1625
1683
|
// src/Icons/IconDown.tsx
|
|
1626
|
-
var
|
|
1684
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1627
1685
|
var IconDown = (props) => {
|
|
1628
|
-
return /* @__PURE__ */ (0,
|
|
1686
|
+
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" }) });
|
|
1629
1687
|
};
|
|
1630
1688
|
|
|
1631
1689
|
// src/components/Select/Selector.tsx
|
|
1632
|
-
var
|
|
1690
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1633
1691
|
var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconColor, icon }) => {
|
|
1634
|
-
const [open, setOpen] =
|
|
1635
|
-
const [valueState, setValueState] =
|
|
1636
|
-
const ref =
|
|
1692
|
+
const [open, setOpen] = React13.useState(false);
|
|
1693
|
+
const [valueState, setValueState] = React13.useState(value || defaultValue || null);
|
|
1694
|
+
const ref = React13.useRef(null);
|
|
1637
1695
|
useClickAway(ref, () => setOpen(false));
|
|
1638
|
-
return /* @__PURE__ */ (0,
|
|
1639
|
-
/* @__PURE__ */ (0,
|
|
1640
|
-
/* @__PURE__ */ (0,
|
|
1696
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "yr3Selector-wrapper", ref, children: [
|
|
1697
|
+
/* @__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: [
|
|
1698
|
+
/* @__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 }) }),
|
|
1641
1699
|
valueState
|
|
1642
1700
|
] }) }),
|
|
1643
|
-
open && /* @__PURE__ */ (0,
|
|
1701
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "yr3Select--menu", children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1644
1702
|
"div",
|
|
1645
1703
|
{
|
|
1646
1704
|
className: "yr3Select--option",
|
|
@@ -1670,19 +1728,19 @@ var Selector = ({ ui, style, options, name, value, defaultValue, onChange, iconC
|
|
|
1670
1728
|
var Selector_default = Selector;
|
|
1671
1729
|
|
|
1672
1730
|
// src/theme/ThemeProvider.tsx
|
|
1673
|
-
var
|
|
1674
|
-
var
|
|
1675
|
-
var ThemeContext =
|
|
1731
|
+
var React14 = __toESM(require("react"), 1);
|
|
1732
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1733
|
+
var ThemeContext = React14.createContext(null);
|
|
1676
1734
|
var ThemeProvider = ({ theme, children }) => {
|
|
1677
|
-
|
|
1735
|
+
React14.useEffect(() => {
|
|
1678
1736
|
applyTheme(theme);
|
|
1679
1737
|
}, [theme]);
|
|
1680
|
-
return /* @__PURE__ */ (0,
|
|
1738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ThemeContext.Provider, { value: theme, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BackdropProvider, { children }) });
|
|
1681
1739
|
};
|
|
1682
|
-
var useTheme = () =>
|
|
1740
|
+
var useTheme = () => React14.useContext(ThemeContext);
|
|
1683
1741
|
|
|
1684
1742
|
// src/components/Input/InputPhone.tsx
|
|
1685
|
-
var
|
|
1743
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1686
1744
|
var Phone = ({
|
|
1687
1745
|
name,
|
|
1688
1746
|
value,
|
|
@@ -1692,8 +1750,8 @@ var Phone = ({
|
|
|
1692
1750
|
countries = [],
|
|
1693
1751
|
propsComponent
|
|
1694
1752
|
}) => {
|
|
1695
|
-
const [prefixValue, setPrefixValue] =
|
|
1696
|
-
const [number, setNumber] =
|
|
1753
|
+
const [prefixValue, setPrefixValue] = React15.useState(prefix);
|
|
1754
|
+
const [number, setNumber] = React15.useState(Number(value) || null);
|
|
1697
1755
|
const theme = useTheme();
|
|
1698
1756
|
const handleChange = (newPrefix, newNumber) => {
|
|
1699
1757
|
const full = `${newPrefix}${newNumber.toString()}`;
|
|
@@ -1705,10 +1763,10 @@ var Phone = ({
|
|
|
1705
1763
|
};
|
|
1706
1764
|
onChange?.(event, full);
|
|
1707
1765
|
};
|
|
1708
|
-
return /* @__PURE__ */ (0,
|
|
1709
|
-
/* @__PURE__ */ (0,
|
|
1710
|
-
/* @__PURE__ */ (0,
|
|
1711
|
-
/* @__PURE__ */ (0,
|
|
1766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Control, { variant: "outlined", children: [
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Label, { text: label, className: "yr3Input--active" }),
|
|
1768
|
+
/* @__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: [
|
|
1769
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1712
1770
|
Selector_default,
|
|
1713
1771
|
{
|
|
1714
1772
|
options: countries.map((c) => ({
|
|
@@ -1728,8 +1786,8 @@ var Phone = ({
|
|
|
1728
1786
|
style: propsComponent?.selector?.style
|
|
1729
1787
|
}
|
|
1730
1788
|
),
|
|
1731
|
-
/* @__PURE__ */ (0,
|
|
1732
|
-
/* @__PURE__ */ (0,
|
|
1789
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Divider, { orientation: "vertical", ...propsComponent?.divider }),
|
|
1790
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1733
1791
|
Input,
|
|
1734
1792
|
{
|
|
1735
1793
|
type: "phone",
|
|
@@ -1746,22 +1804,127 @@ var Phone = ({
|
|
|
1746
1804
|
] });
|
|
1747
1805
|
};
|
|
1748
1806
|
|
|
1807
|
+
// src/components/InputArea/InputArea.tsx
|
|
1808
|
+
var React16 = __toESM(require("react"), 1);
|
|
1809
|
+
|
|
1810
|
+
// src/components/InputArea/inputAreaVariants.ts
|
|
1811
|
+
var inputAreaVariants = createVariants({
|
|
1812
|
+
base: "yr3InputArea",
|
|
1813
|
+
variants: {
|
|
1814
|
+
variant: {
|
|
1815
|
+
filled: "yr3InputArea--filled",
|
|
1816
|
+
outlined: "yr3InputArea--outlined",
|
|
1817
|
+
base: "yr3InputArea--base",
|
|
1818
|
+
lined: "yr3InputArea--lined"
|
|
1819
|
+
},
|
|
1820
|
+
color: {
|
|
1821
|
+
primary: "yr3InputArea--color-primary",
|
|
1822
|
+
secondary: "yr3InputArea--color-secondary",
|
|
1823
|
+
success: "yr3InputArea--color-success",
|
|
1824
|
+
text: "yr3InputArea--color-text",
|
|
1825
|
+
disabled: "yr3InputArea--color-disabled"
|
|
1826
|
+
},
|
|
1827
|
+
size: {
|
|
1828
|
+
auto: "yr3InputArea--size-auto",
|
|
1829
|
+
full: "yr3InputArea--size-full"
|
|
1830
|
+
},
|
|
1831
|
+
rounded: {
|
|
1832
|
+
true: "yr3InputArea--rounded"
|
|
1833
|
+
},
|
|
1834
|
+
disabled: {
|
|
1835
|
+
true: "yr3InputArea--disabled"
|
|
1836
|
+
},
|
|
1837
|
+
animated: {
|
|
1838
|
+
true: "yr3InputArea--animated"
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
// src/components/InputArea/InputArea.tsx
|
|
1844
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1845
|
+
var initiaPropsComponent2 = {
|
|
1846
|
+
label: {
|
|
1847
|
+
display: true,
|
|
1848
|
+
ui: {},
|
|
1849
|
+
style: {}
|
|
1850
|
+
},
|
|
1851
|
+
helperText: ""
|
|
1852
|
+
};
|
|
1853
|
+
var InputArea = ({
|
|
1854
|
+
value,
|
|
1855
|
+
defaultValue = "",
|
|
1856
|
+
onChange,
|
|
1857
|
+
rows = 1,
|
|
1858
|
+
ui,
|
|
1859
|
+
style,
|
|
1860
|
+
label,
|
|
1861
|
+
validate,
|
|
1862
|
+
color = "primary",
|
|
1863
|
+
maxLength = 0,
|
|
1864
|
+
resize = "vertical",
|
|
1865
|
+
variant = "outlined",
|
|
1866
|
+
rounded = false,
|
|
1867
|
+
propsComponent = initiaPropsComponent2
|
|
1868
|
+
}) => {
|
|
1869
|
+
const ref = React16.useRef(null);
|
|
1870
|
+
const [internalValue, setInternalValue] = React16.useState(defaultValue);
|
|
1871
|
+
const isControlled = value !== void 0;
|
|
1872
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1873
|
+
const handleChange = (e) => {
|
|
1874
|
+
const newValue = e.target.value;
|
|
1875
|
+
if (!isControlled) {
|
|
1876
|
+
setInternalValue(newValue);
|
|
1877
|
+
}
|
|
1878
|
+
onChange?.(e, newValue);
|
|
1879
|
+
};
|
|
1880
|
+
const el = ref.current;
|
|
1881
|
+
if (el) {
|
|
1882
|
+
el.style.height = "auto";
|
|
1883
|
+
el.style.height = el.scrollHeight + "px";
|
|
1884
|
+
el.style.resize = resize;
|
|
1885
|
+
}
|
|
1886
|
+
const classes = inputAreaVariants({ variant, color, rounded });
|
|
1887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { position: "relative" }, children: [
|
|
1888
|
+
propsComponent?.label?.display && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1889
|
+
Label,
|
|
1890
|
+
{
|
|
1891
|
+
text: label || "",
|
|
1892
|
+
className: "yr3Input--active",
|
|
1893
|
+
...propsComponent.label
|
|
1894
|
+
}
|
|
1895
|
+
),
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1897
|
+
"textarea",
|
|
1898
|
+
{
|
|
1899
|
+
className: classes,
|
|
1900
|
+
ref,
|
|
1901
|
+
value: currentValue,
|
|
1902
|
+
rows,
|
|
1903
|
+
onChange: handleChange,
|
|
1904
|
+
style: composeStyles(ui, style),
|
|
1905
|
+
"data-testid": "yr3InputArea"
|
|
1906
|
+
}
|
|
1907
|
+
),
|
|
1908
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { variant: "helper", color: currentValue.length > maxLength ? "error" : "disabled", ui: { textAlign: "right" }, "data-testid": "yr3InputAreaError", children: validate && maxLength ? `${currentValue.length}/${maxLength}` || propsComponent.helperText : "" })
|
|
1909
|
+
] });
|
|
1910
|
+
};
|
|
1911
|
+
|
|
1749
1912
|
// src/components/Modal/Modal.tsx
|
|
1750
|
-
var
|
|
1913
|
+
var React17 = __toESM(require("react"), 1);
|
|
1751
1914
|
|
|
1752
1915
|
// src/components/Modal/ModalContainer.tsx
|
|
1753
|
-
var
|
|
1916
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1754
1917
|
var ModalContainer = ({ children, size = "sm", ui, style }) => {
|
|
1755
1918
|
const classes = bem("yr3Modal-container");
|
|
1756
1919
|
const classComponent = classes(void 0, { [`${size}`]: !!size });
|
|
1757
|
-
return /* @__PURE__ */ (0,
|
|
1920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: classComponent, style: composeStyles(ui, style), "data-testid": "yr3Modal-container", children });
|
|
1758
1921
|
};
|
|
1759
1922
|
|
|
1760
1923
|
// src/components/Modal/Modal.tsx
|
|
1761
|
-
var
|
|
1924
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1762
1925
|
var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
1763
1926
|
const { show, hide } = useBackdrop();
|
|
1764
|
-
|
|
1927
|
+
React17.useEffect(() => {
|
|
1765
1928
|
if (open) {
|
|
1766
1929
|
show();
|
|
1767
1930
|
} else {
|
|
@@ -1770,9 +1933,9 @@ var Modal = ({ open, onClose, children, propsComponent }) => {
|
|
|
1770
1933
|
}, [open, show]);
|
|
1771
1934
|
const classes = bem("yr3Modal");
|
|
1772
1935
|
const classComponent = classes(void 0, { "open": !!open });
|
|
1773
|
-
return /* @__PURE__ */ (0,
|
|
1936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: classComponent, onClick: (e) => e.stopPropagation(), "data-testid": "yr3Modal", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ModalContainer, { ...propsComponent?.container, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { variant: "column", container: true, center: true, gap: 1, children: [
|
|
1774
1937
|
children,
|
|
1775
|
-
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0,
|
|
1938
|
+
propsComponent?.close ? propsComponent.close : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Button, { variant: "filled", color: "secondary", onClick: onClose, "data-testid": "yr3Modal-close", children: "Close" })
|
|
1776
1939
|
] }) }) });
|
|
1777
1940
|
};
|
|
1778
1941
|
|
|
@@ -1812,15 +1975,15 @@ var notistackVariants = createVariants({
|
|
|
1812
1975
|
});
|
|
1813
1976
|
|
|
1814
1977
|
// src/components/Notistack/Notistack.tsx
|
|
1815
|
-
var
|
|
1978
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1816
1979
|
var Notistack = ({ message, duration = 3e3, variant = "info", color, propsComponent, anchor, exiting = false }) => {
|
|
1817
1980
|
const classes = notistackVariants({ type: variant, color, exiting, direction: `${anchor?.vertical || "bottom"}-${anchor?.horizontal || "right"}` });
|
|
1818
1981
|
const containerStyle = composeStyles(propsComponent?.container?.ui, propsComponent?.container?.style);
|
|
1819
1982
|
const notistackStyle = composeStyles(propsComponent?.notistack?.ui, propsComponent?.notistack?.style);
|
|
1820
1983
|
const progressStyle = composeStyles(propsComponent?.progress?.ui, propsComponent?.progress?.style);
|
|
1821
|
-
return /* @__PURE__ */ (0,
|
|
1822
|
-
/* @__PURE__ */ (0,
|
|
1823
|
-
/* @__PURE__ */ (0,
|
|
1984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: classes, "data-testid": "yr3Notistack", style: notistackStyle, children: [
|
|
1985
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { style: containerStyle, children: message }),
|
|
1986
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1824
1987
|
"div",
|
|
1825
1988
|
{
|
|
1826
1989
|
className: "yr3Notistack--progress",
|
|
@@ -1854,7 +2017,7 @@ var pendingVariants = createVariants({
|
|
|
1854
2017
|
});
|
|
1855
2018
|
|
|
1856
2019
|
// src/components/Pending/Pending.tsx
|
|
1857
|
-
var
|
|
2020
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1858
2021
|
var Pending = ({
|
|
1859
2022
|
variant,
|
|
1860
2023
|
width,
|
|
@@ -1867,7 +2030,7 @@ var Pending = ({
|
|
|
1867
2030
|
const widthStyle = variant === "circle" ? size : width;
|
|
1868
2031
|
const heightStyle = variant === "circle" ? size : height;
|
|
1869
2032
|
const uiStylePending = uiStyle({ width: widthStyle, height: heightStyle, ...ui });
|
|
1870
|
-
return /* @__PURE__ */ (0,
|
|
2033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1871
2034
|
"div",
|
|
1872
2035
|
{
|
|
1873
2036
|
className: pendingVariants({ variant, color }),
|
|
@@ -1896,7 +2059,7 @@ var radioVariant = createVariants({
|
|
|
1896
2059
|
});
|
|
1897
2060
|
|
|
1898
2061
|
// src/components/Radio/Radio.tsx
|
|
1899
|
-
var
|
|
2062
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1900
2063
|
var Radio = ({
|
|
1901
2064
|
checked,
|
|
1902
2065
|
value,
|
|
@@ -1912,8 +2075,8 @@ var Radio = ({
|
|
|
1912
2075
|
const bemClass = bem("yr3Radio");
|
|
1913
2076
|
const classes = bemClass(void 0, { [color]: `color-${color}` });
|
|
1914
2077
|
const variantClass = radioVariant({ variant });
|
|
1915
|
-
return /* @__PURE__ */ (0,
|
|
1916
|
-
/* @__PURE__ */ (0,
|
|
2078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: classes, "data-testid": "yr3Radio", style: composeStyles(propsComponent?.radio?.ui, propsComponent?.radio?.style), children: [
|
|
2079
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1917
2080
|
"input",
|
|
1918
2081
|
{
|
|
1919
2082
|
type: "radio",
|
|
@@ -1925,8 +2088,8 @@ var Radio = ({
|
|
|
1925
2088
|
}
|
|
1926
2089
|
),
|
|
1927
2090
|
iconChecked && checked ? iconChecked : !checked && iconUnchecked ? iconUnchecked : null,
|
|
1928
|
-
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0,
|
|
1929
|
-
typeof label === "string" && /* @__PURE__ */ (0,
|
|
2091
|
+
!iconChecked && !iconUnchecked && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: variantClass, "data-testid": "yr3Radio-dot" }),
|
|
2092
|
+
typeof label === "string" && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1930
2093
|
"span",
|
|
1931
2094
|
{
|
|
1932
2095
|
className: "yr3Radio--label",
|
|
@@ -1939,15 +2102,15 @@ var Radio = ({
|
|
|
1939
2102
|
};
|
|
1940
2103
|
|
|
1941
2104
|
// src/components/Select/Select.tsx
|
|
1942
|
-
var
|
|
1943
|
-
var
|
|
2105
|
+
var React18 = __toESM(require("react"), 1);
|
|
2106
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1944
2107
|
var Select = ({ label, options, name, value, defaultValue, onChange, propsComponent }) => {
|
|
1945
|
-
const [open, setOpen] =
|
|
1946
|
-
const [valueState, setValueState] =
|
|
1947
|
-
const ref =
|
|
2108
|
+
const [open, setOpen] = React18.useState(false);
|
|
2109
|
+
const [valueState, setValueState] = React18.useState(value || defaultValue || null);
|
|
2110
|
+
const ref = React18.useRef(null);
|
|
1948
2111
|
useClickAway(ref, () => setOpen(false));
|
|
1949
|
-
return /* @__PURE__ */ (0,
|
|
1950
|
-
/* @__PURE__ */ (0,
|
|
2112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Control, { ...propsComponent?.control, children: [
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1951
2114
|
Label,
|
|
1952
2115
|
{
|
|
1953
2116
|
...propsComponent?.label,
|
|
@@ -1955,10 +2118,10 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
1955
2118
|
className: open || valueState ? "yr3Input--active" : ""
|
|
1956
2119
|
}
|
|
1957
2120
|
),
|
|
1958
|
-
/* @__PURE__ */ (0,
|
|
1959
|
-
/* @__PURE__ */ (0,
|
|
1960
|
-
/* @__PURE__ */ (0,
|
|
1961
|
-
/* @__PURE__ */ (0,
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "yr3Select-wrapper", ref, children: [
|
|
2122
|
+
/* @__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: [
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "yr3Select--control", children: valueState }),
|
|
2124
|
+
/* @__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)(
|
|
1962
2125
|
IconDown,
|
|
1963
2126
|
{
|
|
1964
2127
|
width: propsComponent?.icon?.style?.width || 26,
|
|
@@ -1968,13 +2131,13 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
1968
2131
|
}
|
|
1969
2132
|
) })
|
|
1970
2133
|
] }),
|
|
1971
|
-
open && /* @__PURE__ */ (0,
|
|
2134
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1972
2135
|
"div",
|
|
1973
2136
|
{
|
|
1974
2137
|
className: "yr3Select--menu",
|
|
1975
2138
|
style: composeStyles(propsComponent?.menu?.ui, propsComponent?.menu?.style),
|
|
1976
2139
|
"data-testid": "yr3Select-menu",
|
|
1977
|
-
children: options.map((opt) => /* @__PURE__ */ (0,
|
|
2140
|
+
children: options.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1978
2141
|
"div",
|
|
1979
2142
|
{
|
|
1980
2143
|
className: "yr3Select--option",
|
|
@@ -2006,8 +2169,8 @@ var Select = ({ label, options, name, value, defaultValue, onChange, propsCompon
|
|
|
2006
2169
|
};
|
|
2007
2170
|
|
|
2008
2171
|
// src/components/Slide/Slide.tsx
|
|
2009
|
-
var
|
|
2010
|
-
var
|
|
2172
|
+
var React19 = __toESM(require("react"), 1);
|
|
2173
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2011
2174
|
var Slide = ({
|
|
2012
2175
|
in: inProp,
|
|
2013
2176
|
children,
|
|
@@ -2021,7 +2184,7 @@ var Slide = ({
|
|
|
2021
2184
|
[direction]: true,
|
|
2022
2185
|
"in": !!inProp
|
|
2023
2186
|
});
|
|
2024
|
-
|
|
2187
|
+
React19.useEffect(() => {
|
|
2025
2188
|
let timeoutId;
|
|
2026
2189
|
if (inProp) {
|
|
2027
2190
|
timeoutId = setTimeout(() => {
|
|
@@ -2031,19 +2194,19 @@ var Slide = ({
|
|
|
2031
2194
|
return () => clearTimeout(timeoutId);
|
|
2032
2195
|
}, [inProp, duration, onTransitionEnd]);
|
|
2033
2196
|
const uiStyleContent = uiStyle({ ...propsComponent?.slide?.ui, transitionDuration: `${duration}ms` });
|
|
2034
|
-
return /* @__PURE__ */ (0,
|
|
2197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2035
2198
|
"div",
|
|
2036
2199
|
{
|
|
2037
2200
|
className: "yr3Slide",
|
|
2038
2201
|
style: uiStyle({ position: "relative", zIndex: 4, overflow: "hidden" }),
|
|
2039
2202
|
"data-testid": "yr3Slide",
|
|
2040
|
-
children: /* @__PURE__ */ (0,
|
|
2203
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2041
2204
|
"div",
|
|
2042
2205
|
{
|
|
2043
2206
|
className: classNameContent,
|
|
2044
2207
|
style: composeStyles(uiStyleContent, propsComponent?.slide?.style || {}),
|
|
2045
2208
|
"data-testid": "yr3Slide-content",
|
|
2046
|
-
children: /* @__PURE__ */ (0,
|
|
2209
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { ...propsComponent?.box, "data-testid": "yr3Slide-box", children })
|
|
2047
2210
|
}
|
|
2048
2211
|
)
|
|
2049
2212
|
}
|
|
@@ -2051,7 +2214,7 @@ var Slide = ({
|
|
|
2051
2214
|
};
|
|
2052
2215
|
|
|
2053
2216
|
// src/components/Switch/Switch.tsx
|
|
2054
|
-
var
|
|
2217
|
+
var React20 = __toESM(require("react"), 1);
|
|
2055
2218
|
|
|
2056
2219
|
// src/components/Switch/switch.variants.ts
|
|
2057
2220
|
var switchVariants = createVariants({
|
|
@@ -2080,7 +2243,7 @@ var switchVariants = createVariants({
|
|
|
2080
2243
|
});
|
|
2081
2244
|
|
|
2082
2245
|
// src/components/Switch/Switch.tsx
|
|
2083
|
-
var
|
|
2246
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2084
2247
|
var Switch = ({
|
|
2085
2248
|
checked,
|
|
2086
2249
|
defaultChecked,
|
|
@@ -2090,7 +2253,7 @@ var Switch = ({
|
|
|
2090
2253
|
size = "sm",
|
|
2091
2254
|
label
|
|
2092
2255
|
}) => {
|
|
2093
|
-
const [internal, setInternal] =
|
|
2256
|
+
const [internal, setInternal] = React20.useState(defaultChecked || false);
|
|
2094
2257
|
const classname = switchVariants({ colors: color, size, disabled: !!disabled, checked: checked ?? internal });
|
|
2095
2258
|
const isControlled = checked !== void 0;
|
|
2096
2259
|
const value = isControlled ? checked : internal;
|
|
@@ -2098,13 +2261,13 @@ var Switch = ({
|
|
|
2098
2261
|
if (!isControlled) setInternal(e.target.checked);
|
|
2099
2262
|
onChange?.(e, e.target.checked);
|
|
2100
2263
|
};
|
|
2101
|
-
return /* @__PURE__ */ (0,
|
|
2264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2102
2265
|
"label",
|
|
2103
2266
|
{
|
|
2104
2267
|
className: classname,
|
|
2105
2268
|
"data-testid": "yr3Switch",
|
|
2106
2269
|
children: [
|
|
2107
|
-
/* @__PURE__ */ (0,
|
|
2270
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2108
2271
|
"input",
|
|
2109
2272
|
{
|
|
2110
2273
|
type: "checkbox",
|
|
@@ -2113,17 +2276,17 @@ var Switch = ({
|
|
|
2113
2276
|
disabled
|
|
2114
2277
|
}
|
|
2115
2278
|
),
|
|
2116
|
-
/* @__PURE__ */ (0,
|
|
2117
|
-
/* @__PURE__ */ (0,
|
|
2279
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--track", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--thumb" }) }),
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "yr3Switch--label", "data-testid": "yr3Switch-label", children: label })
|
|
2118
2281
|
]
|
|
2119
2282
|
}
|
|
2120
2283
|
);
|
|
2121
2284
|
};
|
|
2122
2285
|
|
|
2123
2286
|
// src/Icons/IconSearch.tsx
|
|
2124
|
-
var
|
|
2287
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2125
2288
|
var IconSearch = (props) => {
|
|
2126
|
-
return /* @__PURE__ */ (0,
|
|
2289
|
+
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)(
|
|
2127
2290
|
"path",
|
|
2128
2291
|
{
|
|
2129
2292
|
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",
|
|
@@ -2154,11 +2317,11 @@ var baseTokens = {
|
|
|
2154
2317
|
};
|
|
2155
2318
|
|
|
2156
2319
|
// src/theme/notistackContext.tsx
|
|
2157
|
-
var
|
|
2158
|
-
var
|
|
2159
|
-
var NotistackContext =
|
|
2320
|
+
var React21 = __toESM(require("react"), 1);
|
|
2321
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2322
|
+
var NotistackContext = React21.createContext(null);
|
|
2160
2323
|
var NotistackProvider = ({ children }) => {
|
|
2161
|
-
const [snacks, setSnacks] =
|
|
2324
|
+
const [snacks, setSnacks] = React21.useState([]);
|
|
2162
2325
|
const enqueueNotistack = (snack) => {
|
|
2163
2326
|
const id = Date.now();
|
|
2164
2327
|
setSnacks((prev) => [...prev, { ...snack, id, exiting: false }]);
|
|
@@ -2173,23 +2336,23 @@ var NotistackProvider = ({ children }) => {
|
|
|
2173
2336
|
setSnacks((prev) => prev.filter((s) => s.id !== id));
|
|
2174
2337
|
}, duration + exitDuration);
|
|
2175
2338
|
};
|
|
2176
|
-
return /* @__PURE__ */ (0,
|
|
2339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(NotistackContext.Provider, { value: { enqueueNotistack }, children: [
|
|
2177
2340
|
children,
|
|
2178
|
-
/* @__PURE__ */ (0,
|
|
2341
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "yr3NotistackContainer", children: snacks.map((snack) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Notistack, { ...snack }, snack.id)) })
|
|
2179
2342
|
] });
|
|
2180
2343
|
};
|
|
2181
|
-
var useNotistack = () =>
|
|
2344
|
+
var useNotistack = () => React21.useContext(NotistackContext);
|
|
2182
2345
|
|
|
2183
2346
|
// src/theme/useMediaQuery.tsx
|
|
2184
|
-
var
|
|
2347
|
+
var React22 = __toESM(require("react"), 1);
|
|
2185
2348
|
function useMediaQuery(query) {
|
|
2186
2349
|
const theme = useTheme();
|
|
2187
2350
|
const computedQuery = typeof query === "function" ? query(theme) : query;
|
|
2188
|
-
const [matches, setMatches] =
|
|
2351
|
+
const [matches, setMatches] = React22.useState(() => {
|
|
2189
2352
|
if (typeof window === "undefined") return false;
|
|
2190
2353
|
return window.matchMedia(computedQuery).matches;
|
|
2191
2354
|
});
|
|
2192
|
-
|
|
2355
|
+
React22.useEffect(() => {
|
|
2193
2356
|
if (typeof window === "undefined") return;
|
|
2194
2357
|
const media = window.matchMedia(computedQuery);
|
|
2195
2358
|
const listener = () => setMatches(media.matches);
|
|
@@ -2239,7 +2402,9 @@ initTheme();
|
|
|
2239
2402
|
IconDown,
|
|
2240
2403
|
IconSearch,
|
|
2241
2404
|
Image,
|
|
2405
|
+
ImageDropzone,
|
|
2242
2406
|
Input,
|
|
2407
|
+
InputArea,
|
|
2243
2408
|
Label,
|
|
2244
2409
|
Modal,
|
|
2245
2410
|
ModalContainer,
|