@lightsparkdev/ui 0.0.7 → 0.0.8
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/CHANGELOG.md +11 -0
- package/dist/{chunk-JYWYEOM6.js → chunk-2JM7UTAZ.js} +18 -5
- package/dist/{chunk-UO6U7AYM.js → chunk-2YB7653N.js} +1 -1
- package/dist/{chunk-RTUZVKPK.js → chunk-36C653MV.js} +1 -1
- package/dist/{chunk-IQFU7CM5.js → chunk-4KWTXZRY.js} +1 -1
- package/dist/{chunk-CLU2FRJZ.js → chunk-55OQPFLF.js} +1 -1
- package/dist/{chunk-3CZOYF3X.js → chunk-6FHLZM6N.js} +2 -2
- package/dist/{chunk-K7D7A34K.js → chunk-744FBGRP.js} +1 -1
- package/dist/{chunk-FKETYVPP.js → chunk-76Q4BK35.js} +87 -43
- package/dist/{chunk-NGS4OSWT.js → chunk-BAO4T4G5.js} +1 -1
- package/dist/{chunk-NH25O7PC.js → chunk-CW3W2VTZ.js} +1 -1
- package/dist/{chunk-G2PZZFJL.js → chunk-DAVVD7YE.js} +10 -10
- package/dist/{chunk-VBWTKANQ.js → chunk-FN5PM3HQ.js} +6 -6
- package/dist/{chunk-RFGKH3R6.js → chunk-HNVQIY5U.js} +0 -8
- package/dist/{chunk-I74XQIVV.js → chunk-MAMSU2XB.js} +3 -3
- package/dist/chunk-NRXJA2PM.js +67 -0
- package/dist/{chunk-M56R3RJ7.js → chunk-OGSDZTHM.js} +7 -3
- package/dist/chunk-SZVMKB4E.js +222 -0
- package/dist/chunk-U6XT5JKC.js +25 -0
- package/dist/{chunk-WWFDI534.js → chunk-UWN53KLJ.js} +13 -6
- package/dist/{chunk-TAI352I3.js → chunk-VE7J2N47.js} +1 -1
- package/dist/{chunk-NZJCJJH5.js → chunk-VHW2KROZ.js} +1 -1
- package/dist/{chunk-N2RDQJQ5.js → chunk-WTO7C7WA.js} +1 -1
- package/dist/{chunk-23SR7TFO.js → chunk-XAZ6NZ6I.js} +1 -1
- package/dist/chunk-YPB5SA65.js +163 -0
- package/dist/{chunk-SVQELXFK.js → chunk-Z5TPS2BO.js} +1 -1
- package/dist/{chunk-T33SBHYI.js → chunk-ZSUX6RLD.js} +3 -1
- package/dist/{chunk-2WYVO6B2.js → chunk-ZYHA6MJC.js} +1 -1
- package/dist/components/Badge.cjs +1332 -0
- package/dist/components/Badge.d.cts +10 -0
- package/dist/components/Badge.d.ts +10 -0
- package/dist/components/Badge.js +13 -0
- package/dist/components/Button.cjs +197 -83
- package/dist/components/Button.d.cts +3 -1
- package/dist/components/Button.d.ts +3 -1
- package/dist/components/Button.js +8 -7
- package/dist/components/ButtonRow.cjs +212 -82
- package/dist/components/ButtonRow.d.cts +6 -2
- package/dist/components/ButtonRow.d.ts +6 -2
- package/dist/components/ButtonRow.js +14 -11
- package/dist/components/Collapsible.cjs +0 -30
- package/dist/components/Collapsible.js +4 -5
- package/dist/components/ContentTable.cjs +0 -30
- package/dist/components/ContentTable.js +3 -4
- package/dist/components/CopyToClipboardButton.cjs +123 -41
- package/dist/components/CopyToClipboardButton.js +6 -5
- package/dist/components/CurrencyAmount.cjs +0 -30
- package/dist/components/CurrencyAmount.js +3 -4
- package/dist/components/FileInput.cjs +1945 -0
- package/dist/components/FileInput.d.cts +21 -0
- package/dist/components/FileInput.d.ts +21 -0
- package/dist/components/FileInput.js +113 -0
- package/dist/components/Icon.cjs +0 -30
- package/dist/components/Icon.js +2 -3
- package/dist/components/LightTooltip.cjs +1414 -0
- package/dist/components/LightTooltip.d.cts +9 -0
- package/dist/components/LightTooltip.d.ts +9 -0
- package/dist/components/LightTooltip.js +12 -0
- package/dist/components/LightboxImage.cjs +1 -1
- package/dist/components/LightboxImage.js +2 -2
- package/dist/components/LightsparkProvider.cjs +3 -33
- package/dist/components/LightsparkProvider.js +3 -4
- package/dist/components/Loading.cjs +0 -30
- package/dist/components/Loading.js +3 -4
- package/dist/components/Modal.cjs +208 -114
- package/dist/components/Modal.js +12 -11
- package/dist/components/Pill.cjs +1703 -0
- package/dist/components/Pill.d.cts +19 -0
- package/dist/components/Pill.d.ts +19 -0
- package/dist/components/Pill.js +16 -0
- package/dist/components/ProgressBar.cjs +0 -32
- package/dist/components/ProgressBar.js +2 -3
- package/dist/components/SecretContainer.cjs +124 -42
- package/dist/components/SecretContainer.js +7 -6
- package/dist/components/TextIconAligner.cjs +0 -30
- package/dist/components/TextIconAligner.js +3 -4
- package/dist/components/UnstyledButton.cjs +0 -30
- package/dist/components/UnstyledButton.js +2 -3
- package/dist/components/documentation/AnchorLinkHeader.cjs +0 -32
- package/dist/components/documentation/AnchorLinkHeader.js +3 -4
- package/dist/components/documentation/index.cjs +0 -32
- package/dist/components/documentation/index.js +3 -4
- package/dist/components/index.cjs +608 -327
- package/dist/components/index.d.cts +5 -1
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +37 -25
- package/dist/icons/Copy.cjs +4 -3
- package/dist/icons/Copy.js +4 -3
- package/dist/icons/Download.cjs +22 -11
- package/dist/icons/Download.js +23 -12
- package/dist/icons/Upload.cjs +22 -11
- package/dist/icons/Upload.js +23 -12
- package/dist/icons/index.cjs +0 -30
- package/dist/icons/index.js +2 -3
- package/dist/router.cjs +7 -3
- package/dist/router.js +1 -1
- package/dist/styles/common.cjs +0 -32
- package/dist/styles/common.d.cts +1 -5
- package/dist/styles/common.d.ts +1 -5
- package/dist/styles/common.js +1 -4
- package/dist/styles/fields.cjs +65 -34
- package/dist/styles/fields.d.cts +8 -2
- package/dist/styles/fields.d.ts +8 -2
- package/dist/styles/fields.js +28 -164
- package/dist/styles/fonts/typography/Article.cjs +0 -30
- package/dist/styles/fonts/typography/Article.js +6 -7
- package/dist/styles/fonts/typography/index.cjs +0 -30
- package/dist/styles/fonts/typography/index.js +11 -12
- package/dist/styles/global.cjs +3 -33
- package/dist/styles/global.js +2 -3
- package/dist/styles/type.cjs +0 -30
- package/dist/styles/type.js +2 -3
- package/dist/styles/utils.cjs +0 -30
- package/dist/styles/utils.js +2 -3
- package/dist/styles/z-index.cjs +1 -1
- package/dist/styles/z-index.d.cts +1 -1
- package/dist/styles/z-index.d.ts +1 -1
- package/dist/styles/z-index.js +1 -1
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/utils/toReactNodes.cjs +7 -3
- package/dist/utils/toReactNodes.js +2 -2
- package/package.json +5 -4
|
@@ -72,8 +72,8 @@ __export(Modal_exports, {
|
|
|
72
72
|
});
|
|
73
73
|
module.exports = __toCommonJS(Modal_exports);
|
|
74
74
|
var import_styled7 = __toESM(require("@emotion/styled"), 1);
|
|
75
|
-
var
|
|
76
|
-
var
|
|
75
|
+
var import_react15 = __toESM(require("react"), 1);
|
|
76
|
+
var import_react_dom2 = __toESM(require("react-dom"), 1);
|
|
77
77
|
|
|
78
78
|
// src/hooks/useLiveRef.tsx
|
|
79
79
|
var import_react = require("react");
|
|
@@ -207,7 +207,6 @@ function useBreakpoints() {
|
|
|
207
207
|
// src/styles/common.tsx
|
|
208
208
|
var import_react5 = require("@emotion/react");
|
|
209
209
|
var import_styled = __toESM(require("@emotion/styled"), 1);
|
|
210
|
-
var import_react_tooltip = require("react-tooltip");
|
|
211
210
|
|
|
212
211
|
// src/styles/colors.tsx
|
|
213
212
|
var import_react4 = require("@emotion/react");
|
|
@@ -1321,32 +1320,6 @@ function hexToRGB(hex) {
|
|
|
1321
1320
|
] : [0, 0, 0];
|
|
1322
1321
|
}
|
|
1323
1322
|
|
|
1324
|
-
// src/styles/z-index.tsx
|
|
1325
|
-
var z = {
|
|
1326
|
-
card: 1,
|
|
1327
|
-
fieldError: 1,
|
|
1328
|
-
textInput: 2,
|
|
1329
|
-
select: 3,
|
|
1330
|
-
selectFocused: 4,
|
|
1331
|
-
walletActionPreviewTopGradient: 1,
|
|
1332
|
-
headerContainer: 99,
|
|
1333
|
-
smBanner: 99,
|
|
1334
|
-
headerTop: 100,
|
|
1335
|
-
navMenu: 100,
|
|
1336
|
-
smNavMenu: 100,
|
|
1337
|
-
navAction: 101,
|
|
1338
|
-
smNavAction: 100,
|
|
1339
|
-
// keep under navDropdown
|
|
1340
|
-
tooltip: 160,
|
|
1341
|
-
notificationBanner: 170,
|
|
1342
|
-
qrReaderVideo: 180,
|
|
1343
|
-
qrReaderOverlay: 181,
|
|
1344
|
-
modalOverlay: 190,
|
|
1345
|
-
modalContainer: 191,
|
|
1346
|
-
dropdown: 192,
|
|
1347
|
-
toast: 200
|
|
1348
|
-
};
|
|
1349
|
-
|
|
1350
1323
|
// src/styles/common.tsx
|
|
1351
1324
|
var rootFontSizePx = 12;
|
|
1352
1325
|
var rootFontSizeRems = rootFontSizePx / 16;
|
|
@@ -1414,9 +1387,6 @@ var Subtext = import_styled.default.div`
|
|
|
1414
1387
|
var darkGradientBg = import_react5.css`
|
|
1415
1388
|
background: ${darkGradient};
|
|
1416
1389
|
`;
|
|
1417
|
-
var StyledTooltip = (0, import_styled.default)(import_react_tooltip.Tooltip)`
|
|
1418
|
-
z-index: ${z.modalOverlay};
|
|
1419
|
-
`;
|
|
1420
1390
|
var overlaySurfaceBorderColor = ({
|
|
1421
1391
|
theme,
|
|
1422
1392
|
important = false
|
|
@@ -1499,6 +1469,32 @@ var overflowAutoWithoutScrollbars = import_react6.css`
|
|
|
1499
1469
|
}
|
|
1500
1470
|
`;
|
|
1501
1471
|
|
|
1472
|
+
// src/styles/z-index.tsx
|
|
1473
|
+
var z = {
|
|
1474
|
+
card: 1,
|
|
1475
|
+
fieldError: 1,
|
|
1476
|
+
textInput: 2,
|
|
1477
|
+
select: 3,
|
|
1478
|
+
selectFocused: 4,
|
|
1479
|
+
walletActionPreviewTopGradient: 1,
|
|
1480
|
+
headerContainer: 99,
|
|
1481
|
+
smBanner: 99,
|
|
1482
|
+
headerTop: 100,
|
|
1483
|
+
navMenu: 100,
|
|
1484
|
+
smNavMenu: 100,
|
|
1485
|
+
navAction: 101,
|
|
1486
|
+
smNavAction: 100,
|
|
1487
|
+
// keep under navDropdown
|
|
1488
|
+
notificationBanner: 170,
|
|
1489
|
+
qrReaderVideo: 180,
|
|
1490
|
+
qrReaderOverlay: 181,
|
|
1491
|
+
modalOverlay: 190,
|
|
1492
|
+
modalContainer: 191,
|
|
1493
|
+
dropdown: 192,
|
|
1494
|
+
tooltip: 193,
|
|
1495
|
+
toast: 200
|
|
1496
|
+
};
|
|
1497
|
+
|
|
1502
1498
|
// src/utils/emotion.tsx
|
|
1503
1499
|
function select(component) {
|
|
1504
1500
|
return component.toString();
|
|
@@ -1546,32 +1542,36 @@ function Link({
|
|
|
1546
1542
|
externalLink,
|
|
1547
1543
|
params,
|
|
1548
1544
|
children,
|
|
1549
|
-
css:
|
|
1545
|
+
css: css7,
|
|
1550
1546
|
onClick,
|
|
1551
1547
|
className,
|
|
1552
1548
|
hash = null,
|
|
1553
1549
|
blue = false,
|
|
1554
1550
|
newTab = false
|
|
1555
1551
|
}) {
|
|
1556
|
-
if (!isString(to) && !externalLink) {
|
|
1557
|
-
throw new Error(
|
|
1552
|
+
if (!isString(to) && !externalLink && !onClick) {
|
|
1553
|
+
throw new Error(
|
|
1554
|
+
"Link must have either `to` or `externalLink` or `onClick` defined"
|
|
1555
|
+
);
|
|
1558
1556
|
}
|
|
1559
1557
|
let toStr;
|
|
1560
1558
|
if (isString(to)) {
|
|
1561
1559
|
toStr = replaceParams(to, params);
|
|
1562
1560
|
toStr += hash ? `#${hash}` : "";
|
|
1563
|
-
} else {
|
|
1561
|
+
} else if (externalLink) {
|
|
1564
1562
|
const definedExternalLink = externalLink;
|
|
1565
1563
|
if (!definedExternalLink.startsWith("http")) {
|
|
1566
1564
|
throw new Error("Link's externalLink must start with http");
|
|
1567
1565
|
}
|
|
1568
1566
|
toStr = definedExternalLink;
|
|
1567
|
+
} else {
|
|
1568
|
+
toStr = "#";
|
|
1569
1569
|
}
|
|
1570
1570
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1571
1571
|
import_react_router_dom.Link,
|
|
1572
1572
|
{
|
|
1573
1573
|
to: toStr,
|
|
1574
|
-
css:
|
|
1574
|
+
css: css7,
|
|
1575
1575
|
onClick,
|
|
1576
1576
|
className,
|
|
1577
1577
|
style: { color: blue ? colors.blue43 : "inherit" },
|
|
@@ -1604,8 +1604,10 @@ function toReactNodes(toReactNodesArg) {
|
|
|
1604
1604
|
}
|
|
1605
1605
|
|
|
1606
1606
|
// src/components/Button.tsx
|
|
1607
|
-
var
|
|
1607
|
+
var import_react12 = require("@emotion/react");
|
|
1608
1608
|
var import_styled5 = __toESM(require("@emotion/styled"), 1);
|
|
1609
|
+
var import_lodash_es3 = require("lodash-es");
|
|
1610
|
+
var import_react13 = require("react");
|
|
1609
1611
|
|
|
1610
1612
|
// src/components/Icon.tsx
|
|
1611
1613
|
var import_styled2 = __toESM(require("@emotion/styled"), 1);
|
|
@@ -1686,9 +1688,62 @@ var IconContainer = import_styled2.default.span`
|
|
|
1686
1688
|
`}
|
|
1687
1689
|
`;
|
|
1688
1690
|
|
|
1691
|
+
// src/components/LightTooltip.tsx
|
|
1692
|
+
var import_css = require("@emotion/css");
|
|
1693
|
+
var import_react10 = require("@emotion/react");
|
|
1694
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
1695
|
+
var import_react_dom = __toESM(require("react-dom"), 1);
|
|
1696
|
+
var import_react_tooltip = require("react-tooltip");
|
|
1697
|
+
var import_jsx_runtime5 = require("@emotion/react/jsx-runtime");
|
|
1698
|
+
function LightTooltip(props) {
|
|
1699
|
+
const nodeRef = (0, import_react11.useRef)(null);
|
|
1700
|
+
const [nodeReady, setNodeReady] = import_react11.default.useState(false);
|
|
1701
|
+
(0, import_react11.useEffect)(() => {
|
|
1702
|
+
if (!nodeRef.current) {
|
|
1703
|
+
nodeRef.current = document.createElement("div");
|
|
1704
|
+
document.body.appendChild(nodeRef.current);
|
|
1705
|
+
}
|
|
1706
|
+
setNodeReady(true);
|
|
1707
|
+
return () => {
|
|
1708
|
+
if (nodeRef.current) {
|
|
1709
|
+
document.body.removeChild(nodeRef.current);
|
|
1710
|
+
nodeRef.current = null;
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
}, []);
|
|
1714
|
+
const theme = (0, import_react10.useTheme)();
|
|
1715
|
+
console.log("LightTooltip.tsx: tooltipProps:", props);
|
|
1716
|
+
return nodeReady && nodeRef.current ? import_react_dom.default.createPortal(
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1718
|
+
import_react_tooltip.Tooltip,
|
|
1719
|
+
__spreadProps(__spreadValues({}, props), {
|
|
1720
|
+
id: props.id || "",
|
|
1721
|
+
content: props.content || "",
|
|
1722
|
+
noArrow: true,
|
|
1723
|
+
border: "0.05rem solid rgba(0, 0, 0, 0.1)",
|
|
1724
|
+
className: styles({ theme }),
|
|
1725
|
+
variant: "light",
|
|
1726
|
+
delayShow: 180
|
|
1727
|
+
})
|
|
1728
|
+
),
|
|
1729
|
+
nodeRef.current
|
|
1730
|
+
) : null;
|
|
1731
|
+
}
|
|
1732
|
+
var styles = ({ theme }) => import_css.css`
|
|
1733
|
+
font-size: "10px",
|
|
1734
|
+
color: ${theme.c2Neutral};
|
|
1735
|
+
border-radius: 8px !important;
|
|
1736
|
+
padding: 16px !important;
|
|
1737
|
+
z-index: ${z.tooltip};
|
|
1738
|
+
${overlaySurface({ theme, important: true })};
|
|
1739
|
+
|
|
1740
|
+
max-width: 260px;
|
|
1741
|
+
box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.10), 0px 4px 8px 0px rgba(0, 0, 0, 0.08) !important;
|
|
1742
|
+
`;
|
|
1743
|
+
|
|
1689
1744
|
// src/components/Loading.tsx
|
|
1690
1745
|
var import_styled3 = __toESM(require("@emotion/styled"), 1);
|
|
1691
|
-
var
|
|
1746
|
+
var import_jsx_runtime6 = require("@emotion/react/jsx-runtime");
|
|
1692
1747
|
var defaultProps = {
|
|
1693
1748
|
size: 60,
|
|
1694
1749
|
center: true,
|
|
@@ -1699,7 +1754,7 @@ function Loading({
|
|
|
1699
1754
|
size: size2 = defaultProps.size,
|
|
1700
1755
|
ml = defaultProps.ml
|
|
1701
1756
|
}) {
|
|
1702
|
-
return /* @__PURE__ */ (0,
|
|
1757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LoadingWrapper, { center, ml, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Rotate, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { name: "LoadingSpinner", width: size2 }) }) });
|
|
1703
1758
|
}
|
|
1704
1759
|
Loading.defaultProps = defaultProps;
|
|
1705
1760
|
var LoadingWrapper = import_styled3.default.div`
|
|
@@ -1753,7 +1808,7 @@ var UnstyledButton = import_styled4.default.button`
|
|
|
1753
1808
|
`;
|
|
1754
1809
|
|
|
1755
1810
|
// src/components/Button.tsx
|
|
1756
|
-
var
|
|
1811
|
+
var import_jsx_runtime7 = require("@emotion/react/jsx-runtime");
|
|
1757
1812
|
function getTextColor({ color, theme, primary: primary2, blue }) {
|
|
1758
1813
|
if (color) {
|
|
1759
1814
|
return color;
|
|
@@ -1788,12 +1843,37 @@ function getBackgroundColor({
|
|
|
1788
1843
|
}
|
|
1789
1844
|
return themeOr(colors.white, theme.c1Neutral)({ theme });
|
|
1790
1845
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1846
|
+
var paddingsY = {
|
|
1847
|
+
lg: 14,
|
|
1848
|
+
md: 9,
|
|
1849
|
+
sm: 6
|
|
1850
|
+
};
|
|
1851
|
+
var roundPaddingsX = {
|
|
1852
|
+
lg: 19,
|
|
1853
|
+
md: 14,
|
|
1854
|
+
sm: 10
|
|
1855
|
+
};
|
|
1856
|
+
var paddingsX = {
|
|
1857
|
+
lg: 24,
|
|
1858
|
+
md: 18,
|
|
1859
|
+
sm: 16
|
|
1860
|
+
};
|
|
1861
|
+
function getPaddingX({
|
|
1862
|
+
size: size2,
|
|
1863
|
+
ghost,
|
|
1864
|
+
isRound
|
|
1865
|
+
}) {
|
|
1866
|
+
return ghost ? 0 : isRound ? roundPaddingsX[size2] : paddingsX[size2];
|
|
1793
1867
|
}
|
|
1794
|
-
function getPadding({
|
|
1795
|
-
|
|
1796
|
-
|
|
1868
|
+
function getPadding({
|
|
1869
|
+
iconWidth,
|
|
1870
|
+
size: size2,
|
|
1871
|
+
ghost,
|
|
1872
|
+
iconSide,
|
|
1873
|
+
isRound
|
|
1874
|
+
}) {
|
|
1875
|
+
const paddingY = ghost ? 0 : paddingsY[size2];
|
|
1876
|
+
const paddingX = getPaddingX({ size: size2, ghost, isRound });
|
|
1797
1877
|
const paddingForIcon = iconWidth && !ghost ? iconWidth : 0;
|
|
1798
1878
|
return `${paddingY}px ${paddingX + (iconSide === "right" ? paddingForIcon : 0)}px ${paddingY}px ${paddingX + (iconSide === "left" ? paddingForIcon : 0)}px`;
|
|
1799
1879
|
}
|
|
@@ -1842,40 +1922,46 @@ function Button({
|
|
|
1842
1922
|
type = "button",
|
|
1843
1923
|
blue = false,
|
|
1844
1924
|
newTab = false,
|
|
1845
|
-
zIndex = void 0
|
|
1925
|
+
zIndex = void 0,
|
|
1926
|
+
tooltipText
|
|
1846
1927
|
}) {
|
|
1928
|
+
const tooltipId = (0, import_react13.useRef)((0, import_lodash_es3.uniqueId)());
|
|
1847
1929
|
const iconMarginRight = 6;
|
|
1848
1930
|
const iconSize = size2 === "lg" ? 16 : 12;
|
|
1849
1931
|
let currentIcon = null;
|
|
1850
1932
|
if (loading) {
|
|
1851
|
-
currentIcon = /* @__PURE__ */ (0,
|
|
1933
|
+
currentIcon = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ButtonIcon, { ghost, iconSide, text, size: size2, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loading, { size: iconSize, center: false }) });
|
|
1852
1934
|
} else if (icon) {
|
|
1853
|
-
currentIcon = /* @__PURE__ */ (0,
|
|
1935
|
+
currentIcon = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ButtonIcon, { ghost, iconSide, text, size: size2, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { name: icon, width: iconSize }) });
|
|
1854
1936
|
}
|
|
1855
|
-
const content = /* @__PURE__ */ (0,
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1937
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react13.Fragment, { children: [
|
|
1938
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1939
|
+
"div",
|
|
1940
|
+
__spreadProps(__spreadValues({}, tooltipText ? { "data-tooltip-id": tooltipId.current } : {}), {
|
|
1941
|
+
css: {
|
|
1942
|
+
display: "flex",
|
|
1943
|
+
alignItems: "center",
|
|
1944
|
+
justifyContent: "center"
|
|
1945
|
+
},
|
|
1946
|
+
children: [
|
|
1947
|
+
iconSide === "left" && currentIcon,
|
|
1948
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1949
|
+
"div",
|
|
1950
|
+
{
|
|
1951
|
+
css: {
|
|
1952
|
+
textOverflow: "ellipsis",
|
|
1953
|
+
overflow: "hidden"
|
|
1954
|
+
},
|
|
1955
|
+
children: text
|
|
1956
|
+
}
|
|
1957
|
+
),
|
|
1958
|
+
iconSide === "right" && currentIcon
|
|
1959
|
+
]
|
|
1960
|
+
})
|
|
1961
|
+
),
|
|
1962
|
+
tooltipText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LightTooltip, { id: tooltipId.current, content: tooltipText }) : null
|
|
1963
|
+
] });
|
|
1964
|
+
const isSingleCharRoundButton = Boolean(text && text.length === 1 && !icon);
|
|
1879
1965
|
const commonProps = {
|
|
1880
1966
|
backgroundColor,
|
|
1881
1967
|
color,
|
|
@@ -1888,6 +1974,7 @@ function Button({
|
|
|
1888
1974
|
fullWidth,
|
|
1889
1975
|
blue,
|
|
1890
1976
|
iconSide,
|
|
1977
|
+
isRound: isSingleCharRoundButton,
|
|
1891
1978
|
iconWidth: currentIcon ? iconSize + iconMarginRight : 0,
|
|
1892
1979
|
isLoading: loading,
|
|
1893
1980
|
disabled: disabled || loading,
|
|
@@ -1900,11 +1987,10 @@ function Button({
|
|
|
1900
1987
|
zIndex
|
|
1901
1988
|
};
|
|
1902
1989
|
if (to) {
|
|
1903
|
-
return /* @__PURE__ */ (0,
|
|
1990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ButtonLink, __spreadProps(__spreadValues({}, commonProps), { to, params: toParams, hash, children: content }));
|
|
1904
1991
|
}
|
|
1905
|
-
return href ? /* @__PURE__ */ (0,
|
|
1992
|
+
return href ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ButtonHrefLink, __spreadProps(__spreadValues({}, commonProps), { href, target: "_blank", children: content })) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyledButton, __spreadProps(__spreadValues({}, commonProps), { children: content }));
|
|
1906
1993
|
}
|
|
1907
|
-
var hPaddingPx = 24;
|
|
1908
1994
|
var buttonStyle = ({
|
|
1909
1995
|
color,
|
|
1910
1996
|
backgroundColor,
|
|
@@ -1920,8 +2006,9 @@ var buttonStyle = ({
|
|
|
1920
2006
|
blue,
|
|
1921
2007
|
text,
|
|
1922
2008
|
zIndex,
|
|
1923
|
-
iconSide
|
|
1924
|
-
|
|
2009
|
+
iconSide,
|
|
2010
|
+
isRound
|
|
2011
|
+
}) => import_react12.css`
|
|
1925
2012
|
display: inline-flex;
|
|
1926
2013
|
opacity: ${disabled && !isLoading ? 0.2 : 1};
|
|
1927
2014
|
transition: opacity 0.2s;
|
|
@@ -1957,8 +2044,15 @@ var buttonStyle = ({
|
|
|
1957
2044
|
primary: primary2,
|
|
1958
2045
|
blue
|
|
1959
2046
|
})};
|
|
1960
|
-
border-radius: 32px;
|
|
1961
|
-
padding: ${getPadding({
|
|
2047
|
+
border-radius: ${isRound ? "100%" : "32px"};
|
|
2048
|
+
padding: ${getPadding({
|
|
2049
|
+
size: size2,
|
|
2050
|
+
iconWidth,
|
|
2051
|
+
text,
|
|
2052
|
+
ghost,
|
|
2053
|
+
iconSide,
|
|
2054
|
+
isRound
|
|
2055
|
+
})};
|
|
1962
2056
|
color: ${getTextColor({ color, theme, primary: primary2, blue })};
|
|
1963
2057
|
transition:
|
|
1964
2058
|
background-color 0.2s ease-out,
|
|
@@ -1971,7 +2065,7 @@ var buttonStyle = ({
|
|
|
1971
2065
|
`;
|
|
1972
2066
|
var ButtonIcon = import_styled5.default.div`
|
|
1973
2067
|
${(props) => props.ghost ? "" : "position: absolute;"}
|
|
1974
|
-
${({ iconSide, ghost, text, size: size2 }) => `${iconSide}: ${ghost && text ? 0 : getPaddingX({ size: size2, ghost })}px;`}
|
|
2068
|
+
${({ iconSide, ghost, text, size: size2 }) => `${iconSide}: ${ghost && text ? 0 : getPaddingX({ size: size2, ghost, isRound: false })}px;`}
|
|
1975
2069
|
`;
|
|
1976
2070
|
var StyledButton = (0, import_styled5.default)(UnstyledButton)`
|
|
1977
2071
|
${(props) => buttonStyle(props)}
|
|
@@ -1985,8 +2079,8 @@ var ButtonHrefLink = import_styled5.default.a`
|
|
|
1985
2079
|
|
|
1986
2080
|
// src/components/ProgressBar.tsx
|
|
1987
2081
|
var import_styled6 = __toESM(require("@emotion/styled"), 1);
|
|
1988
|
-
var
|
|
1989
|
-
var
|
|
2082
|
+
var import_react14 = require("react");
|
|
2083
|
+
var import_jsx_runtime8 = require("@emotion/react/jsx-runtime");
|
|
1990
2084
|
var defaultProps2 = {
|
|
1991
2085
|
isSm: false,
|
|
1992
2086
|
stepDuration: 0.5
|
|
@@ -1997,8 +2091,8 @@ function ProgressBar({
|
|
|
1997
2091
|
isSm = defaultProps2.isSm,
|
|
1998
2092
|
stepDuration = defaultProps2.stepDuration
|
|
1999
2093
|
}) {
|
|
2000
|
-
const [percentage, setPercentage] = (0,
|
|
2001
|
-
(0,
|
|
2094
|
+
const [percentage, setPercentage] = (0, import_react14.useState)(5);
|
|
2095
|
+
(0, import_react14.useEffect)(() => {
|
|
2002
2096
|
if (progressPercentage !== void 0) {
|
|
2003
2097
|
setPercentage(progressPercentage);
|
|
2004
2098
|
} else {
|
|
@@ -2007,7 +2101,7 @@ function ProgressBar({
|
|
|
2007
2101
|
}, 0);
|
|
2008
2102
|
}
|
|
2009
2103
|
}, [progressPercentage]);
|
|
2010
|
-
return /* @__PURE__ */ (0,
|
|
2104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ProgressBarContainer, { isSm, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Bar, { isSm, percentage, stepDuration, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2011
2105
|
BarBg,
|
|
2012
2106
|
{
|
|
2013
2107
|
background,
|
|
@@ -2054,7 +2148,7 @@ var Bar = import_styled6.default.div`
|
|
|
2054
2148
|
`;
|
|
2055
2149
|
|
|
2056
2150
|
// src/components/Modal.tsx
|
|
2057
|
-
var
|
|
2151
|
+
var import_jsx_runtime9 = require("@emotion/react/jsx-runtime");
|
|
2058
2152
|
function Modal({
|
|
2059
2153
|
visible,
|
|
2060
2154
|
title,
|
|
@@ -2076,24 +2170,24 @@ function Modal({
|
|
|
2076
2170
|
width = 460,
|
|
2077
2171
|
progressBar
|
|
2078
2172
|
}) {
|
|
2079
|
-
const visibleChangedRef = (0,
|
|
2080
|
-
const nodeRef = (0,
|
|
2173
|
+
const visibleChangedRef = (0, import_react15.useRef)(false);
|
|
2174
|
+
const nodeRef = (0, import_react15.useRef)(null);
|
|
2081
2175
|
const [defaultFirstFocusRef, defaultFirstFocusRefCb] = useLiveRef();
|
|
2082
2176
|
const ref = firstFocusRef || defaultFirstFocusRef;
|
|
2083
|
-
const [nodeReady, setNodeReady] =
|
|
2084
|
-
const overlayRef = (0,
|
|
2085
|
-
const prevFocusedElement = (0,
|
|
2086
|
-
const modalContainerRef = (0,
|
|
2177
|
+
const [nodeReady, setNodeReady] = import_react15.default.useState(false);
|
|
2178
|
+
const overlayRef = (0, import_react15.useRef)(null);
|
|
2179
|
+
const prevFocusedElement = (0, import_react15.useRef)();
|
|
2180
|
+
const modalContainerRef = (0, import_react15.useRef)(null);
|
|
2087
2181
|
const bp2 = useBreakpoints();
|
|
2088
2182
|
const isSm = bp2.current("sm" /* sm */);
|
|
2089
2183
|
const formattedDescription = description ? toReactNodes(description) : null;
|
|
2090
|
-
(0,
|
|
2184
|
+
(0, import_react15.useEffect)(() => {
|
|
2091
2185
|
if (visible !== visibleChangedRef.current) {
|
|
2092
2186
|
visibleChangedRef.current = visible;
|
|
2093
2187
|
}
|
|
2094
2188
|
}, [visible]);
|
|
2095
2189
|
const visibleChanged = visible !== visibleChangedRef.current;
|
|
2096
|
-
(0,
|
|
2190
|
+
(0, import_react15.useEffect)(() => {
|
|
2097
2191
|
prevFocusedElement.current = document.activeElement;
|
|
2098
2192
|
if (!nodeRef.current) {
|
|
2099
2193
|
nodeRef.current = document.createElement("div");
|
|
@@ -2107,7 +2201,7 @@ function Modal({
|
|
|
2107
2201
|
}
|
|
2108
2202
|
};
|
|
2109
2203
|
}, []);
|
|
2110
|
-
(0,
|
|
2204
|
+
(0, import_react15.useEffect)(() => {
|
|
2111
2205
|
const handleOutsideClick = (event) => {
|
|
2112
2206
|
if (visible && overlayRef.current && event.target && overlayRef.current.contains(event.target) && !nonDismissable) {
|
|
2113
2207
|
onClose();
|
|
@@ -2144,7 +2238,7 @@ function Modal({
|
|
|
2144
2238
|
}
|
|
2145
2239
|
};
|
|
2146
2240
|
}, [onClose, visible, nonDismissable]);
|
|
2147
|
-
(0,
|
|
2241
|
+
(0, import_react15.useLayoutEffect)(() => {
|
|
2148
2242
|
if (visible) {
|
|
2149
2243
|
if (visibleChanged) {
|
|
2150
2244
|
prevFocusedElement.current = document.activeElement;
|
|
@@ -2173,9 +2267,9 @@ function Modal({
|
|
|
2173
2267
|
onClose();
|
|
2174
2268
|
}
|
|
2175
2269
|
}
|
|
2176
|
-
const modalContent = /* @__PURE__ */ (0,
|
|
2177
|
-
/* @__PURE__ */ (0,
|
|
2178
|
-
/* @__PURE__ */ (0,
|
|
2270
|
+
const modalContent = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react15.Fragment, { children: [
|
|
2271
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModalOverlay, { ref: overlayRef }),
|
|
2272
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2179
2273
|
ModalContainer,
|
|
2180
2274
|
{
|
|
2181
2275
|
"aria-modal": true,
|
|
@@ -2183,22 +2277,22 @@ function Modal({
|
|
|
2183
2277
|
tabIndex: -1,
|
|
2184
2278
|
role: "dialog",
|
|
2185
2279
|
ref: modalContainerRef,
|
|
2186
|
-
children: /* @__PURE__ */ (0,
|
|
2187
|
-
!firstFocusRef && /* @__PURE__ */ (0,
|
|
2188
|
-
!(nonDismissable || ghost) && /* @__PURE__ */ (0,
|
|
2189
|
-
/* @__PURE__ */ (0,
|
|
2190
|
-
progressBar ? /* @__PURE__ */ (0,
|
|
2280
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalContent, { width, ghost, children: [
|
|
2281
|
+
!firstFocusRef && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DefaultFocusTarget, { ref: defaultFirstFocusRefCb }),
|
|
2282
|
+
!(nonDismissable || ghost) && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CloseButton, { onClick: onClickCloseButton, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "Close", width: 9 }) }),
|
|
2283
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalContentInner, { ghost, children: [
|
|
2284
|
+
progressBar ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { css: { marginBottom: "20px" }, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2191
2285
|
ProgressBar,
|
|
2192
2286
|
{
|
|
2193
2287
|
progressPercentage: progressBar.progressPercentage,
|
|
2194
2288
|
isSm: progressBar.isSm
|
|
2195
2289
|
}
|
|
2196
2290
|
) }) : null,
|
|
2197
|
-
title ? /* @__PURE__ */ (0,
|
|
2198
|
-
formattedDescription ? /* @__PURE__ */ (0,
|
|
2199
|
-
/* @__PURE__ */ (0,
|
|
2200
|
-
onSubmit ? /* @__PURE__ */ (0,
|
|
2201
|
-
!isSm && !cancelHidden && /* @__PURE__ */ (0,
|
|
2291
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h4", { children: title }) : null,
|
|
2292
|
+
formattedDescription ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Description, { children: formattedDescription }) : null,
|
|
2293
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children }),
|
|
2294
|
+
onSubmit ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalButtonRow, { children: [
|
|
2295
|
+
!isSm && !cancelHidden && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2202
2296
|
Button,
|
|
2203
2297
|
{
|
|
2204
2298
|
disabled: cancelDisabled,
|
|
@@ -2206,7 +2300,7 @@ function Modal({
|
|
|
2206
2300
|
text: cancelText != null ? cancelText : "Cancel"
|
|
2207
2301
|
}
|
|
2208
2302
|
),
|
|
2209
|
-
/* @__PURE__ */ (0,
|
|
2303
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2210
2304
|
Button,
|
|
2211
2305
|
{
|
|
2212
2306
|
disabled: submitDisabled,
|
|
@@ -2216,15 +2310,15 @@ function Modal({
|
|
|
2216
2310
|
type: "submit"
|
|
2217
2311
|
}
|
|
2218
2312
|
),
|
|
2219
|
-
isSm && !cancelHidden && /* @__PURE__ */ (0,
|
|
2313
|
+
isSm && !cancelHidden && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button, { onClick: onClose, text: "Cancel" })
|
|
2220
2314
|
] }) : null
|
|
2221
2315
|
] })
|
|
2222
2316
|
] })
|
|
2223
2317
|
}
|
|
2224
2318
|
)
|
|
2225
2319
|
] });
|
|
2226
|
-
return visible && nodeReady && nodeRef.current ?
|
|
2227
|
-
onSubmit ? /* @__PURE__ */ (0,
|
|
2320
|
+
return visible && nodeReady && nodeRef.current ? import_react_dom2.default.createPortal(
|
|
2321
|
+
onSubmit ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("form", { onSubmit: onSubmitForm, children: modalContent }) : modalContent,
|
|
2228
2322
|
nodeRef.current
|
|
2229
2323
|
) : null;
|
|
2230
2324
|
}
|
package/dist/components/Modal.js
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Modal
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-DAVVD7YE.js";
|
|
5
|
+
import "../chunk-VE7J2N47.js";
|
|
6
6
|
import "../chunk-NBCCPGA4.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-36C653MV.js";
|
|
8
|
+
import "../chunk-76Q4BK35.js";
|
|
9
|
+
import "../chunk-OGSDZTHM.js";
|
|
10
10
|
import "../chunk-YMNSXZ5D.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-BAO4T4G5.js";
|
|
12
|
+
import "../chunk-2YB7653N.js";
|
|
13
|
+
import "../chunk-4KWTXZRY.js";
|
|
14
|
+
import "../chunk-NRXJA2PM.js";
|
|
15
|
+
import "../chunk-55OQPFLF.js";
|
|
16
|
+
import "../chunk-VHW2KROZ.js";
|
|
15
17
|
import "../chunk-LAMQKQU3.js";
|
|
16
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-HNVQIY5U.js";
|
|
17
19
|
import "../chunk-2VBDEO6M.js";
|
|
18
20
|
import "../chunk-E4EXM4SY.js";
|
|
19
21
|
import "../chunk-JSGRNWSB.js";
|
|
20
|
-
import "../chunk-CLU2FRJZ.js";
|
|
21
22
|
import "../chunk-CIGAQ47A.js";
|
|
22
23
|
export {
|
|
23
24
|
Modal
|