react-better-html 1.1.217 → 1.1.219
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/README.md +1 -1
- package/dist/index.d.mts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +1021 -912
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1148 -1038
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -98,9 +98,9 @@ module.exports = __toCommonJS(index_exports);
|
|
|
98
98
|
var import_react_better_core30 = require("react-better-core");
|
|
99
99
|
|
|
100
100
|
// src/components/BetterHtmlProvider.tsx
|
|
101
|
-
var
|
|
102
|
-
var
|
|
103
|
-
var
|
|
101
|
+
var import_react14 = require("react");
|
|
102
|
+
var import_react_better_core13 = require("react-better-core");
|
|
103
|
+
var import_styled_components9 = require("styled-components");
|
|
104
104
|
|
|
105
105
|
// src/constants/app.ts
|
|
106
106
|
var appConfig = {
|
|
@@ -109,6 +109,9 @@ var appConfig = {
|
|
|
109
109
|
var defaultAlertDuration = 2.3 * 1e3;
|
|
110
110
|
var defaultSideMenuWidth = 300;
|
|
111
111
|
|
|
112
|
+
// src/constants/theme.ts
|
|
113
|
+
var theme = {};
|
|
114
|
+
|
|
112
115
|
// src/constants/icons.ts
|
|
113
116
|
var icons = {
|
|
114
117
|
uploadCloud: {
|
|
@@ -187,13 +190,13 @@ var icons = {
|
|
|
187
190
|
var assets = {};
|
|
188
191
|
|
|
189
192
|
// src/components/alerts/AlertsHolder.tsx
|
|
190
|
-
var
|
|
191
|
-
var
|
|
193
|
+
var import_react13 = require("react");
|
|
194
|
+
var import_react_better_core12 = require("react-better-core");
|
|
192
195
|
|
|
193
196
|
// src/components/Div.tsx
|
|
194
|
-
var
|
|
195
|
-
var
|
|
196
|
-
var
|
|
197
|
+
var import_react8 = require("react");
|
|
198
|
+
var import_react_better_core7 = require("react-better-core");
|
|
199
|
+
var import_styled_components4 = __toESM(require("styled-components"));
|
|
197
200
|
|
|
198
201
|
// src/constants.ts
|
|
199
202
|
var isMobileDevice = /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
@@ -875,7 +878,7 @@ var cssPropsToExclude = /* @__PURE__ */ new Set([
|
|
|
875
878
|
|
|
876
879
|
// src/utils/hooks.ts
|
|
877
880
|
function useComponentPropsGrouper(props, excludeStyleProps) {
|
|
878
|
-
const
|
|
881
|
+
const theme2 = (0, import_react_better_core.useTheme)();
|
|
879
882
|
return (0, import_react.useMemo)(() => {
|
|
880
883
|
const style = {};
|
|
881
884
|
const hoverStyle = {};
|
|
@@ -902,8 +905,8 @@ function useComponentPropsGrouper(props, excludeStyleProps) {
|
|
|
902
905
|
}
|
|
903
906
|
}
|
|
904
907
|
if (haveHover && !style.transition) {
|
|
905
|
-
style.transition =
|
|
906
|
-
style.WebkitTransition =
|
|
908
|
+
style.transition = theme2.styles.transition;
|
|
909
|
+
style.WebkitTransition = theme2.styles.transition;
|
|
907
910
|
}
|
|
908
911
|
return {
|
|
909
912
|
style,
|
|
@@ -925,7 +928,7 @@ function useComponentPropsWithPrefix(props, prefix) {
|
|
|
925
928
|
}, [props, prefix]);
|
|
926
929
|
}
|
|
927
930
|
function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
928
|
-
const
|
|
931
|
+
const theme2 = (0, import_react_better_core.useTheme)();
|
|
929
932
|
const [isOpen, setIsOpen] = (0, import_react_better_core.useBooleanState)();
|
|
930
933
|
const [isOpenLate, setIsOpenLate] = (0, import_react_better_core.useBooleanState)();
|
|
931
934
|
const [isFocused, setIsFocused] = (0, import_react_better_core.useBooleanState)();
|
|
@@ -956,13 +959,13 @@ function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
|
956
959
|
);
|
|
957
960
|
const insideInputFieldComponentProps = (0, import_react.useMemo)(
|
|
958
961
|
() => ({
|
|
959
|
-
border: `1px solid ${isFocused ?
|
|
962
|
+
border: `1px solid ${isFocused ? theme2.colors.primary : theme2.colors.border}`,
|
|
960
963
|
borderTop: "none",
|
|
961
964
|
opacity: !isOpen ? 0 : void 0,
|
|
962
965
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
963
966
|
transform: `translateY(${!isOpen ? -10 : 0}px)`,
|
|
964
967
|
zIndex: 1e3,
|
|
965
|
-
transition:
|
|
968
|
+
transition: theme2.styles.transition
|
|
966
969
|
}),
|
|
967
970
|
[isOpen, isFocused]
|
|
968
971
|
);
|
|
@@ -1382,8 +1385,8 @@ var TextComponent = (0, import_react2.forwardRef)(function Text({ htmlContentTra
|
|
|
1382
1385
|
);
|
|
1383
1386
|
});
|
|
1384
1387
|
TextComponent.unknown = (0, import_react2.forwardRef)(function Unknown(props, ref) {
|
|
1385
|
-
const
|
|
1386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextComponent, { fontStyle: "italic", textAlign: "center", color:
|
|
1388
|
+
const theme2 = (0, import_react_better_core2.useTheme)();
|
|
1389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextComponent, { fontStyle: "italic", textAlign: "center", color: theme2.colors.textSecondary, ref, ...props });
|
|
1387
1390
|
});
|
|
1388
1391
|
TextComponent.oneLine = (0, import_react2.forwardRef)(function OneLine(props, ref) {
|
|
1389
1392
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TextComponent, { textOverflow: "ellipsis", whiteSpace: "nowrap", overflow: "hidden", ref, ...props });
|
|
@@ -1398,14 +1401,14 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
1398
1401
|
var Divider_default = {
|
|
1399
1402
|
vertical: (0, import_react3.memo)(
|
|
1400
1403
|
(0, import_react3.forwardRef)(function Divider({ width = 1, backgroundColor, height, ...props }, ref) {
|
|
1401
|
-
const
|
|
1404
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
1402
1405
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1403
1406
|
Div_default,
|
|
1404
1407
|
{
|
|
1405
1408
|
width,
|
|
1406
1409
|
height: height ?? "100%",
|
|
1407
1410
|
flexShrink: 0,
|
|
1408
|
-
backgroundColor: backgroundColor ??
|
|
1411
|
+
backgroundColor: backgroundColor ?? theme2.colors.border,
|
|
1409
1412
|
...props,
|
|
1410
1413
|
ref
|
|
1411
1414
|
}
|
|
@@ -1414,19 +1417,19 @@ var Divider_default = {
|
|
|
1414
1417
|
),
|
|
1415
1418
|
horizontal: (0, import_react3.memo)(
|
|
1416
1419
|
(0, import_react3.forwardRef)(function Divider2({ width = 1, backgroundColor, text, textFontSize, textColor, ...props }, ref) {
|
|
1417
|
-
const
|
|
1418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: text ?
|
|
1419
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ??
|
|
1420
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text_default, { fontSize: textFontSize, color: textColor ??
|
|
1421
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ??
|
|
1420
|
+
const theme2 = (0, import_react_better_core3.useTheme)();
|
|
1421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, ref, children: [
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
|
|
1423
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text_default, { fontSize: textFontSize, color: textColor ?? theme2.colors.textSecondary, children: text }),
|
|
1424
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
|
|
1422
1425
|
] });
|
|
1423
1426
|
})
|
|
1424
1427
|
)
|
|
1425
1428
|
};
|
|
1426
1429
|
|
|
1427
1430
|
// src/components/PageHeader.tsx
|
|
1428
|
-
var
|
|
1429
|
-
var
|
|
1431
|
+
var import_react7 = require("react");
|
|
1432
|
+
var import_react_better_core6 = require("react-better-core");
|
|
1430
1433
|
|
|
1431
1434
|
// src/components/Image.tsx
|
|
1432
1435
|
var import_react4 = require("react");
|
|
@@ -1472,19 +1475,19 @@ var Image = (0, import_react4.forwardRef)(function Image2({ name, src, ...props
|
|
|
1472
1475
|
);
|
|
1473
1476
|
});
|
|
1474
1477
|
Image.profileImage = (0, import_react4.forwardRef)(function ProfileImage({ size = 40, letters, backgroundColor, ...props }, ref) {
|
|
1475
|
-
const
|
|
1478
|
+
const theme2 = (0, import_react_better_core4.useTheme)();
|
|
1476
1479
|
return letters ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1477
1480
|
Div_default.row,
|
|
1478
1481
|
{
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
backgroundColor: backgroundColor ?? theme.colors.backgroundSecondary,
|
|
1482
|
-
border: `solid 1px ${theme.colors.border}`,
|
|
1482
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
1483
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
1483
1484
|
borderRadius: 999,
|
|
1484
1485
|
alignItems: "center",
|
|
1485
1486
|
justifyContent: "center",
|
|
1486
1487
|
ref,
|
|
1487
1488
|
...props,
|
|
1489
|
+
width: size,
|
|
1490
|
+
height: size,
|
|
1488
1491
|
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
1489
1492
|
}
|
|
1490
1493
|
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -1492,7 +1495,7 @@ Image.profileImage = (0, import_react4.forwardRef)(function ProfileImage({ size
|
|
|
1492
1495
|
{
|
|
1493
1496
|
width: size,
|
|
1494
1497
|
height: size,
|
|
1495
|
-
border: `solid 1px ${
|
|
1498
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
1496
1499
|
borderRadius: 999,
|
|
1497
1500
|
objectFit: "cover",
|
|
1498
1501
|
ref,
|
|
@@ -1504,11 +1507,89 @@ var MemoizedImage = (0, import_react4.memo)(Image);
|
|
|
1504
1507
|
MemoizedImage.profileImage = Image.profileImage;
|
|
1505
1508
|
var Image_default = { Image: MemoizedImage }.Image;
|
|
1506
1509
|
|
|
1507
|
-
// src/components/
|
|
1510
|
+
// src/components/Icon.tsx
|
|
1511
|
+
var import_react5 = require("react");
|
|
1512
|
+
var import_react_better_core5 = require("react-better-core");
|
|
1513
|
+
var import_styled_components3 = __toESM(require("styled-components"));
|
|
1508
1514
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1509
|
-
var
|
|
1515
|
+
var import_react6 = require("react");
|
|
1516
|
+
var IconElement = import_styled_components3.default.svg.withConfig({
|
|
1517
|
+
shouldForwardProp: (prop) => !["theme", "style", "hoverStyle", "hoverColor"].includes(prop)
|
|
1518
|
+
})`
|
|
1519
|
+
${(props) => props.style}
|
|
1520
|
+
|
|
1521
|
+
path {
|
|
1522
|
+
${(props) => props.hoverColor ? `transition: ${props.theme.styles.transition};` : ""}
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
&:hover {
|
|
1526
|
+
path.react-better-html-icon-path-with-fill {
|
|
1527
|
+
fill: ${(props) => props.hoverColor};
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
path.react-better-html-icon-path-with-stroke {
|
|
1531
|
+
stroke: ${(props) => props.hoverColor};
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
&:hover {
|
|
1536
|
+
${(props) => props.hoverStyle}
|
|
1537
|
+
}
|
|
1538
|
+
`;
|
|
1539
|
+
var Icon = (0, import_react5.forwardRef)(function Icon2({ name, size = 16, ...props }, ref) {
|
|
1540
|
+
const theme2 = (0, import_react_better_core5.useTheme)();
|
|
1541
|
+
const { icons: icons2 } = (0, import_react_better_core5.useBetterCoreContext)();
|
|
1542
|
+
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
1543
|
+
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
1544
|
+
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
1545
|
+
const svgColor = props.color ?? theme2.colors.textPrimary;
|
|
1546
|
+
const svgHoverColorColor = props.colorHover;
|
|
1547
|
+
(0, import_react5.useEffect)(() => {
|
|
1548
|
+
if (!icons2[name.toString()])
|
|
1549
|
+
console.warn(
|
|
1550
|
+
`The icon \`${name}\` you are trying to use does not exist. Make sure to add it to the \`icons\` object in \`<BetterHtmlProvider>\` config value prop.`
|
|
1551
|
+
);
|
|
1552
|
+
}, [icons2, name]);
|
|
1553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1554
|
+
IconElement,
|
|
1555
|
+
{
|
|
1556
|
+
width: size,
|
|
1557
|
+
height: size,
|
|
1558
|
+
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1559
|
+
fill: "none",
|
|
1560
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1561
|
+
theme: theme2,
|
|
1562
|
+
hoverColor: svgHoverColorColor,
|
|
1563
|
+
style,
|
|
1564
|
+
hoverStyle,
|
|
1565
|
+
...restProps,
|
|
1566
|
+
...dataProps,
|
|
1567
|
+
...ariaProps,
|
|
1568
|
+
ref,
|
|
1569
|
+
children: icons2[name.toString()]?.paths.map((path) => /* @__PURE__ */ (0, import_react6.createElement)(
|
|
1570
|
+
"path",
|
|
1571
|
+
{
|
|
1572
|
+
...path,
|
|
1573
|
+
className: path.type === "fill" ? "react-better-html-icon-path-with-fill" : "react-better-html-icon-path-with-stroke",
|
|
1574
|
+
fill: path.type === "fill" ? svgColor : void 0,
|
|
1575
|
+
stroke: path.type === "stroke" ? svgColor : void 0,
|
|
1576
|
+
key: path.d
|
|
1577
|
+
}
|
|
1578
|
+
))
|
|
1579
|
+
}
|
|
1580
|
+
);
|
|
1581
|
+
});
|
|
1582
|
+
var MemoizedIcon = (0, import_react5.memo)(Icon);
|
|
1583
|
+
var Icon_default = { Icon: MemoizedIcon }.Icon;
|
|
1584
|
+
|
|
1585
|
+
// src/components/PageHeader.tsx
|
|
1586
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1587
|
+
var PageHeaderComponent = (0, import_react7.forwardRef)(function PageHeader({
|
|
1588
|
+
icon,
|
|
1589
|
+
image,
|
|
1510
1590
|
imageUrl,
|
|
1511
1591
|
imageSize = 60,
|
|
1592
|
+
imageAzProfileImage,
|
|
1512
1593
|
title,
|
|
1513
1594
|
titleAs = "h1",
|
|
1514
1595
|
titleColor,
|
|
@@ -1520,38 +1601,51 @@ var PageHeaderComponent = (0, import_react5.forwardRef)(function PageHeader({
|
|
|
1520
1601
|
lightMode,
|
|
1521
1602
|
marginBottom
|
|
1522
1603
|
}, ref) {
|
|
1523
|
-
const
|
|
1604
|
+
const theme2 = (0, import_react_better_core6.useTheme)();
|
|
1524
1605
|
const { app } = useBetterHtmlContextInternal();
|
|
1525
1606
|
const mediaQuery = useMediaQuery();
|
|
1526
|
-
|
|
1607
|
+
const ImageTag = imageAzProfileImage ? Image_default.profileImage : Image_default;
|
|
1608
|
+
const readyImageSize = imageSize ?? (mediaQuery.size600 ? 46 : 60);
|
|
1609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1527
1610
|
Div_default.row,
|
|
1528
1611
|
{
|
|
1529
1612
|
alignItems: "center",
|
|
1530
|
-
gap:
|
|
1531
|
-
marginBottom: marginBottom ??
|
|
1613
|
+
gap: theme2.styles.space,
|
|
1614
|
+
marginBottom: marginBottom ?? theme2.styles.space * 2,
|
|
1532
1615
|
ref,
|
|
1533
1616
|
children: [
|
|
1534
|
-
|
|
1535
|
-
/* @__PURE__ */ (0,
|
|
1617
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
1618
|
+
(image || imageUrl) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1619
|
+
ImageTag,
|
|
1620
|
+
{
|
|
1621
|
+
name: image,
|
|
1622
|
+
src: imageUrl,
|
|
1623
|
+
width: readyImageSize,
|
|
1624
|
+
height: readyImageSize,
|
|
1625
|
+
size: readyImageSize,
|
|
1626
|
+
flexShrink: 0
|
|
1627
|
+
}
|
|
1628
|
+
),
|
|
1629
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1536
1630
|
Div_default.column,
|
|
1537
1631
|
{
|
|
1538
1632
|
alignItems: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
|
|
1539
1633
|
flex: 1,
|
|
1540
|
-
gap:
|
|
1634
|
+
gap: theme2.styles.gap / 2,
|
|
1541
1635
|
children: [
|
|
1542
|
-
/* @__PURE__ */ (0,
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1543
1637
|
Div_default.row,
|
|
1544
1638
|
{
|
|
1545
1639
|
alignItems: "center",
|
|
1546
1640
|
justifyContent: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
|
|
1547
|
-
gap:
|
|
1641
|
+
gap: theme2.styles.space,
|
|
1548
1642
|
children: [
|
|
1549
|
-
/* @__PURE__ */ (0,
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1550
1644
|
Text_default,
|
|
1551
1645
|
{
|
|
1552
1646
|
as: titleAs,
|
|
1553
1647
|
textAlign,
|
|
1554
|
-
color: titleColor ?? (lightMode ?
|
|
1648
|
+
color: titleColor ?? (lightMode ? theme2.colors.base : theme2.colors.textPrimary),
|
|
1555
1649
|
children: title
|
|
1556
1650
|
}
|
|
1557
1651
|
),
|
|
@@ -1559,12 +1653,12 @@ var PageHeaderComponent = (0, import_react5.forwardRef)(function PageHeader({
|
|
|
1559
1653
|
]
|
|
1560
1654
|
}
|
|
1561
1655
|
),
|
|
1562
|
-
description && /* @__PURE__ */ (0,
|
|
1656
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1563
1657
|
Text_default,
|
|
1564
1658
|
{
|
|
1565
1659
|
maxWidth: !mediaQuery.size600 ? app.contentMaxWidth * 0.6 : void 0,
|
|
1566
1660
|
textAlign,
|
|
1567
|
-
color: descriptionColor ?? (lightMode ?
|
|
1661
|
+
color: descriptionColor ?? (lightMode ? theme2.colors.base : theme2.colors.textSecondary),
|
|
1568
1662
|
opacity: lightMode ? 0.7 : void 0,
|
|
1569
1663
|
children: description
|
|
1570
1664
|
}
|
|
@@ -1577,12 +1671,12 @@ var PageHeaderComponent = (0, import_react5.forwardRef)(function PageHeader({
|
|
|
1577
1671
|
}
|
|
1578
1672
|
);
|
|
1579
1673
|
});
|
|
1580
|
-
var PageHeader2 = (0,
|
|
1674
|
+
var PageHeader2 = (0, import_react7.memo)(PageHeaderComponent);
|
|
1581
1675
|
var PageHeader_default = PageHeader2;
|
|
1582
1676
|
|
|
1583
1677
|
// src/components/Div.tsx
|
|
1584
|
-
var
|
|
1585
|
-
var DivStyledComponent =
|
|
1678
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1679
|
+
var DivStyledComponent = import_styled_components4.default.div.withConfig({
|
|
1586
1680
|
shouldForwardProp: (prop) => !["style", "hoverStyle"].includes(prop)
|
|
1587
1681
|
})`
|
|
1588
1682
|
${(props) => props.style}
|
|
@@ -1591,7 +1685,7 @@ var DivStyledComponent = import_styled_components3.default.div.withConfig({
|
|
|
1591
1685
|
${(props) => props.hoverStyle}
|
|
1592
1686
|
}
|
|
1593
1687
|
`;
|
|
1594
|
-
var DivComponent = (0,
|
|
1688
|
+
var DivComponent = (0, import_react8.forwardRef)(function Div({
|
|
1595
1689
|
as = "div",
|
|
1596
1690
|
value,
|
|
1597
1691
|
isTabAccessed,
|
|
@@ -1606,14 +1700,14 @@ var DivComponent = (0, import_react6.forwardRef)(function Div({
|
|
|
1606
1700
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
1607
1701
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
1608
1702
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
1609
|
-
const onClickElement = (0,
|
|
1703
|
+
const onClickElement = (0, import_react8.useCallback)(
|
|
1610
1704
|
(event) => {
|
|
1611
1705
|
onClick?.(event);
|
|
1612
1706
|
onClickWithValue?.(value);
|
|
1613
1707
|
},
|
|
1614
1708
|
[onClick, onClickWithValue, value]
|
|
1615
1709
|
);
|
|
1616
|
-
const onKeyDownElement = (0,
|
|
1710
|
+
const onKeyDownElement = (0, import_react8.useCallback)(
|
|
1617
1711
|
(event) => {
|
|
1618
1712
|
onKeyDown?.(event);
|
|
1619
1713
|
if (!isTabAccessed) return;
|
|
@@ -1624,7 +1718,7 @@ var DivComponent = (0, import_react6.forwardRef)(function Div({
|
|
|
1624
1718
|
},
|
|
1625
1719
|
[onKeyDown, isTabAccessed]
|
|
1626
1720
|
);
|
|
1627
|
-
return /* @__PURE__ */ (0,
|
|
1721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1628
1722
|
DivStyledComponent,
|
|
1629
1723
|
{
|
|
1630
1724
|
as,
|
|
@@ -1643,9 +1737,9 @@ var DivComponent = (0, import_react6.forwardRef)(function Div({
|
|
|
1643
1737
|
}
|
|
1644
1738
|
);
|
|
1645
1739
|
});
|
|
1646
|
-
DivComponent.row = (0,
|
|
1740
|
+
DivComponent.row = (0, import_react8.forwardRef)(function Row({ flexReverse, invertFlexDirection, ...props }, ref) {
|
|
1647
1741
|
const reverseSuffix = flexReverse ? "-reverse" : "";
|
|
1648
|
-
return /* @__PURE__ */ (0,
|
|
1742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1649
1743
|
DivComponent,
|
|
1650
1744
|
{
|
|
1651
1745
|
display: "flex",
|
|
@@ -1655,9 +1749,9 @@ DivComponent.row = (0, import_react6.forwardRef)(function Row({ flexReverse, inv
|
|
|
1655
1749
|
}
|
|
1656
1750
|
);
|
|
1657
1751
|
});
|
|
1658
|
-
DivComponent.column = (0,
|
|
1752
|
+
DivComponent.column = (0, import_react8.forwardRef)(function Column({ flexReverse, invertFlexDirection, ...props }, ref) {
|
|
1659
1753
|
const reverseSuffix = flexReverse ? "-reverse" : "";
|
|
1660
|
-
return /* @__PURE__ */ (0,
|
|
1754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1661
1755
|
DivComponent,
|
|
1662
1756
|
{
|
|
1663
1757
|
display: "flex",
|
|
@@ -1667,10 +1761,10 @@ DivComponent.column = (0, import_react6.forwardRef)(function Column({ flexRevers
|
|
|
1667
1761
|
}
|
|
1668
1762
|
);
|
|
1669
1763
|
});
|
|
1670
|
-
DivComponent.grid = (0,
|
|
1671
|
-
return /* @__PURE__ */ (0,
|
|
1764
|
+
DivComponent.grid = (0, import_react8.forwardRef)(function Grid(props, ref) {
|
|
1765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DivComponent, { display: "grid", ref, ...props });
|
|
1672
1766
|
});
|
|
1673
|
-
DivComponent.box = (0,
|
|
1767
|
+
DivComponent.box = (0, import_react8.forwardRef)(function Box({
|
|
1674
1768
|
imageUrl,
|
|
1675
1769
|
imageSize,
|
|
1676
1770
|
title,
|
|
@@ -1687,36 +1781,36 @@ DivComponent.box = (0, import_react6.forwardRef)(function Box({
|
|
|
1687
1781
|
children,
|
|
1688
1782
|
...props
|
|
1689
1783
|
}, ref) {
|
|
1690
|
-
const
|
|
1784
|
+
const theme2 = (0, import_react_better_core7.useTheme)();
|
|
1691
1785
|
const withClick = props.onClick || props.onClickWithValue;
|
|
1692
|
-
return /* @__PURE__ */ (0,
|
|
1786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1693
1787
|
DivComponent,
|
|
1694
1788
|
{
|
|
1695
|
-
color: isActive ?
|
|
1696
|
-
backgroundColor: isActive ?
|
|
1697
|
-
border: `1px solid ${isActive ?
|
|
1698
|
-
borderRadius:
|
|
1699
|
-
borderColorHover: withClick && !isActive ?
|
|
1789
|
+
color: isActive ? theme2.colors.base : void 0,
|
|
1790
|
+
backgroundColor: isActive ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
1791
|
+
border: `1px solid ${isActive ? theme2.colors.primary : theme2.colors.border}`,
|
|
1792
|
+
borderRadius: theme2.styles.borderRadius,
|
|
1793
|
+
borderColorHover: withClick && !isActive ? theme2.colors.primary : void 0,
|
|
1700
1794
|
filterHover: withClick && isActive ? "brightness(0.9)" : void 0,
|
|
1701
1795
|
cursor: withClick ? "pointer" : void 0,
|
|
1702
|
-
paddingBlock: title ?
|
|
1703
|
-
paddingInline:
|
|
1796
|
+
paddingBlock: title ? theme2.styles.space : theme2.styles.gap,
|
|
1797
|
+
paddingInline: theme2.styles.space,
|
|
1704
1798
|
ref,
|
|
1705
1799
|
...props,
|
|
1706
1800
|
children: [
|
|
1707
|
-
title && /* @__PURE__ */ (0,
|
|
1801
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
1708
1802
|
Div2,
|
|
1709
1803
|
{
|
|
1710
1804
|
backgroundColor: headerBackgroundColor,
|
|
1711
|
-
borderTopLeftRadius: props.borderTopLeftRadius ?? props.borderRadius ??
|
|
1712
|
-
borderTopRightRadius: props.borderTopRightRadius ?? props.borderRadius ??
|
|
1713
|
-
marginInline: -
|
|
1714
|
-
marginTop: -
|
|
1715
|
-
marginBottom:
|
|
1716
|
-
paddingInline:
|
|
1717
|
-
paddingTop:
|
|
1805
|
+
borderTopLeftRadius: props.borderTopLeftRadius ?? props.borderRadius ?? theme2.styles.borderRadius - 1,
|
|
1806
|
+
borderTopRightRadius: props.borderTopRightRadius ?? props.borderRadius ?? theme2.styles.borderRadius - 1,
|
|
1807
|
+
marginInline: -theme2.styles.space,
|
|
1808
|
+
marginTop: -theme2.styles.space,
|
|
1809
|
+
marginBottom: theme2.styles.space,
|
|
1810
|
+
paddingInline: theme2.styles.space,
|
|
1811
|
+
paddingTop: theme2.styles.space,
|
|
1718
1812
|
children: [
|
|
1719
|
-
/* @__PURE__ */ (0,
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1720
1814
|
PageHeader_default,
|
|
1721
1815
|
{
|
|
1722
1816
|
imageUrl,
|
|
@@ -1730,10 +1824,10 @@ DivComponent.box = (0, import_react6.forwardRef)(function Box({
|
|
|
1730
1824
|
textAlign,
|
|
1731
1825
|
rightElement,
|
|
1732
1826
|
lightMode,
|
|
1733
|
-
marginBottom:
|
|
1827
|
+
marginBottom: theme2.styles.space
|
|
1734
1828
|
}
|
|
1735
1829
|
),
|
|
1736
|
-
/* @__PURE__ */ (0,
|
|
1830
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Div2, { width: `calc(100% + ${theme2.styles.space * 2}px)`, marginLeft: -theme2.styles.space, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Divider_default.horizontal, {}) })
|
|
1737
1831
|
]
|
|
1738
1832
|
}
|
|
1739
1833
|
),
|
|
@@ -1742,7 +1836,7 @@ DivComponent.box = (0, import_react6.forwardRef)(function Box({
|
|
|
1742
1836
|
}
|
|
1743
1837
|
);
|
|
1744
1838
|
});
|
|
1745
|
-
var Div2 = (0,
|
|
1839
|
+
var Div2 = (0, import_react8.memo)(DivComponent);
|
|
1746
1840
|
Div2.row = DivComponent.row;
|
|
1747
1841
|
Div2.column = DivComponent.column;
|
|
1748
1842
|
Div2.grid = DivComponent.grid;
|
|
@@ -1750,15 +1844,16 @@ Div2.box = DivComponent.box;
|
|
|
1750
1844
|
var Div_default = Div2;
|
|
1751
1845
|
|
|
1752
1846
|
// src/components/alerts/Alert.tsx
|
|
1753
|
-
var
|
|
1754
|
-
var
|
|
1755
|
-
var
|
|
1847
|
+
var import_react12 = require("react");
|
|
1848
|
+
var import_react_better_core11 = require("react-better-core");
|
|
1849
|
+
var import_styled_components8 = __toESM(require("styled-components"));
|
|
1756
1850
|
|
|
1757
1851
|
// src/plugins/alerts.ts
|
|
1758
1852
|
var defaultAlertsPluginOptions = {
|
|
1759
1853
|
position: "bottom",
|
|
1760
1854
|
align: "right",
|
|
1761
1855
|
defaultDuration: "auto",
|
|
1856
|
+
defaultDisplay: {},
|
|
1762
1857
|
maxWidth: 460,
|
|
1763
1858
|
withLoaderBar: true,
|
|
1764
1859
|
withCloseButton: true
|
|
@@ -1809,81 +1904,6 @@ var localStoragePlugin = (options) => ({
|
|
|
1809
1904
|
})
|
|
1810
1905
|
});
|
|
1811
1906
|
|
|
1812
|
-
// src/components/Icon.tsx
|
|
1813
|
-
var import_react7 = require("react");
|
|
1814
|
-
var import_react_better_core7 = require("react-better-core");
|
|
1815
|
-
var import_styled_components4 = __toESM(require("styled-components"));
|
|
1816
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1817
|
-
var import_react8 = require("react");
|
|
1818
|
-
var IconElement = import_styled_components4.default.svg.withConfig({
|
|
1819
|
-
shouldForwardProp: (prop) => !["theme", "style", "hoverStyle", "hoverColor"].includes(prop)
|
|
1820
|
-
})`
|
|
1821
|
-
${(props) => props.style}
|
|
1822
|
-
|
|
1823
|
-
path {
|
|
1824
|
-
${(props) => props.hoverColor ? `transition: ${props.theme.styles.transition};` : ""}
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
&:hover {
|
|
1828
|
-
path.react-better-html-icon-path-with-fill {
|
|
1829
|
-
fill: ${(props) => props.hoverColor};
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
path.react-better-html-icon-path-with-stroke {
|
|
1833
|
-
stroke: ${(props) => props.hoverColor};
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
&:hover {
|
|
1838
|
-
${(props) => props.hoverStyle}
|
|
1839
|
-
}
|
|
1840
|
-
`;
|
|
1841
|
-
var Icon = (0, import_react7.forwardRef)(function Icon2({ name, size = 16, ...props }, ref) {
|
|
1842
|
-
const theme = (0, import_react_better_core7.useTheme)();
|
|
1843
|
-
const { icons: icons2 } = (0, import_react_better_core7.useBetterCoreContext)();
|
|
1844
|
-
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
1845
|
-
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
1846
|
-
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
1847
|
-
const svgColor = props.color ?? theme.colors.textPrimary;
|
|
1848
|
-
const svgHoverColorColor = props.colorHover;
|
|
1849
|
-
(0, import_react7.useEffect)(() => {
|
|
1850
|
-
if (!icons2[name.toString()])
|
|
1851
|
-
console.warn(
|
|
1852
|
-
`The icon \`${name}\` you are trying to use does not exist. Make sure to add it to the \`icons\` object in \`<BetterHtmlProvider>\` config value prop.`
|
|
1853
|
-
);
|
|
1854
|
-
}, [icons2, name]);
|
|
1855
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1856
|
-
IconElement,
|
|
1857
|
-
{
|
|
1858
|
-
width: size,
|
|
1859
|
-
height: size,
|
|
1860
|
-
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1861
|
-
fill: "none",
|
|
1862
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1863
|
-
theme,
|
|
1864
|
-
hoverColor: svgHoverColorColor,
|
|
1865
|
-
style,
|
|
1866
|
-
hoverStyle,
|
|
1867
|
-
...restProps,
|
|
1868
|
-
...dataProps,
|
|
1869
|
-
...ariaProps,
|
|
1870
|
-
ref,
|
|
1871
|
-
children: icons2[name.toString()]?.paths.map((path) => /* @__PURE__ */ (0, import_react8.createElement)(
|
|
1872
|
-
"path",
|
|
1873
|
-
{
|
|
1874
|
-
...path,
|
|
1875
|
-
className: path.type === "fill" ? "react-better-html-icon-path-with-fill" : "react-better-html-icon-path-with-stroke",
|
|
1876
|
-
fill: path.type === "fill" ? svgColor : void 0,
|
|
1877
|
-
stroke: path.type === "stroke" ? svgColor : void 0,
|
|
1878
|
-
key: path.d
|
|
1879
|
-
}
|
|
1880
|
-
))
|
|
1881
|
-
}
|
|
1882
|
-
);
|
|
1883
|
-
});
|
|
1884
|
-
var MemoizedIcon = (0, import_react7.memo)(Icon);
|
|
1885
|
-
var Icon_default = { Icon: MemoizedIcon }.Icon;
|
|
1886
|
-
|
|
1887
1907
|
// src/components/Button.tsx
|
|
1888
1908
|
var import_react10 = require("react");
|
|
1889
1909
|
var import_react_better_core9 = require("react-better-core");
|
|
@@ -1914,8 +1934,8 @@ var LoaderComponent = function Loader({
|
|
|
1914
1934
|
disabled,
|
|
1915
1935
|
...props
|
|
1916
1936
|
}) {
|
|
1917
|
-
const
|
|
1918
|
-
const readyColor = color ??
|
|
1937
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1938
|
+
const readyColor = color ?? theme2.colors.textPrimary;
|
|
1919
1939
|
const readyWidth = width ?? size / 3;
|
|
1920
1940
|
const mask = `radial-gradient(farthest-side, #0000 calc(100% - ${readyWidth}px), #000 0)`;
|
|
1921
1941
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyledDiv, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -1934,17 +1954,17 @@ var LoaderComponent = function Loader({
|
|
|
1934
1954
|
) });
|
|
1935
1955
|
};
|
|
1936
1956
|
LoaderComponent.box = function Box2({ text = "Loading...", size = 20, ...props }) {
|
|
1937
|
-
const
|
|
1938
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Div_default.column, { width: "100%", alignItems: "center", gap:
|
|
1957
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Div_default.column, { width: "100%", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
1939
1959
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader2, { size, ...props }),
|
|
1940
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ??
|
|
1960
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ?? theme2.colors.textSecondary, children: text })
|
|
1941
1961
|
] });
|
|
1942
1962
|
};
|
|
1943
1963
|
LoaderComponent.text = function LoaderText({ text = "Loading...", size = 14, ...props }) {
|
|
1944
|
-
const
|
|
1945
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
1964
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
1946
1966
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader2, { size, ...props }),
|
|
1947
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ??
|
|
1967
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ?? theme2.colors.textSecondary, children: text })
|
|
1948
1968
|
] });
|
|
1949
1969
|
};
|
|
1950
1970
|
var Loader2 = (0, import_react9.memo)(LoaderComponent);
|
|
@@ -2028,7 +2048,7 @@ var ButtonComponent = function Button({
|
|
|
2028
2048
|
onClickWithValue,
|
|
2029
2049
|
...props
|
|
2030
2050
|
}) {
|
|
2031
|
-
const
|
|
2051
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2032
2052
|
const isLoadingHook = (0, import_react_better_core9.useLoader)(loaderName);
|
|
2033
2053
|
const { components } = useBetterHtmlContextInternal();
|
|
2034
2054
|
const { colorTheme } = (0, import_react_better_core9.useBetterCoreContext)();
|
|
@@ -2050,7 +2070,7 @@ var ButtonComponent = function Button({
|
|
|
2050
2070
|
Icon_default,
|
|
2051
2071
|
{
|
|
2052
2072
|
name: icon,
|
|
2053
|
-
color: iconColor ?? props.color ??
|
|
2073
|
+
color: iconColor ?? props.color ?? theme2.colors.base,
|
|
2054
2074
|
size: iconSize ?? parseInt(style.fontSize?.toString() ?? "16")
|
|
2055
2075
|
}
|
|
2056
2076
|
) }) : void 0;
|
|
@@ -2058,7 +2078,7 @@ var ButtonComponent = function Button({
|
|
|
2058
2078
|
Image_default,
|
|
2059
2079
|
{
|
|
2060
2080
|
name: image,
|
|
2061
|
-
color: iconColor ?? props.color ??
|
|
2081
|
+
color: iconColor ?? props.color ?? theme2.colors.base,
|
|
2062
2082
|
width: imageWidth ?? parseInt(style.fontSize?.toString() ?? "16"),
|
|
2063
2083
|
height: imageHeight
|
|
2064
2084
|
}
|
|
@@ -2069,7 +2089,7 @@ var ButtonComponent = function Button({
|
|
|
2069
2089
|
ButtonElement,
|
|
2070
2090
|
{
|
|
2071
2091
|
as: href ? linkComponentTag : buttonComponentTag,
|
|
2072
|
-
theme,
|
|
2092
|
+
theme: theme2,
|
|
2073
2093
|
colorTheme,
|
|
2074
2094
|
isSmall,
|
|
2075
2095
|
withText: text !== void 0,
|
|
@@ -2095,7 +2115,7 @@ var ButtonComponent = function Button({
|
|
|
2095
2115
|
gap: 10,
|
|
2096
2116
|
pointerEvents: "none",
|
|
2097
2117
|
opacity: isLoadingElement ? 0 : 1,
|
|
2098
|
-
transition:
|
|
2118
|
+
transition: theme2.styles.transition,
|
|
2099
2119
|
children: [
|
|
2100
2120
|
iconPosition === "left" && iconComponent,
|
|
2101
2121
|
imagePosition === "left" && imageComponent,
|
|
@@ -2117,11 +2137,11 @@ var ButtonComponent = function Button({
|
|
|
2117
2137
|
alignItems: "center",
|
|
2118
2138
|
justifyContent: "center",
|
|
2119
2139
|
opacity: isLoadingElement ? 1 : 0,
|
|
2120
|
-
transition:
|
|
2140
|
+
transition: theme2.styles.transition,
|
|
2121
2141
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2122
2142
|
Loader_default,
|
|
2123
2143
|
{
|
|
2124
|
-
color: props.color ??
|
|
2144
|
+
color: props.color ?? theme2.colors.base,
|
|
2125
2145
|
size: loaderSize,
|
|
2126
2146
|
disabled: !isLoadingElement
|
|
2127
2147
|
}
|
|
@@ -2133,43 +2153,43 @@ var ButtonComponent = function Button({
|
|
|
2133
2153
|
);
|
|
2134
2154
|
};
|
|
2135
2155
|
ButtonComponent.secondary = function Secondary({ className, ...props }) {
|
|
2136
|
-
const
|
|
2156
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2137
2157
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2138
2158
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2139
2159
|
ButtonComponent,
|
|
2140
2160
|
{
|
|
2141
2161
|
...betterHtmlContext2.components.button?.style?.secondary,
|
|
2142
2162
|
className: `secondary${className ? ` ${className}` : ""}`,
|
|
2143
|
-
color:
|
|
2163
|
+
color: theme2.colors.textPrimary,
|
|
2144
2164
|
...props
|
|
2145
2165
|
}
|
|
2146
2166
|
);
|
|
2147
2167
|
};
|
|
2148
2168
|
ButtonComponent.destructive = function Destructive(props) {
|
|
2149
|
-
const
|
|
2169
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2150
2170
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2151
2171
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2152
2172
|
ButtonComponent,
|
|
2153
2173
|
{
|
|
2154
2174
|
...betterHtmlContext2.components.button?.style?.destructive,
|
|
2155
|
-
backgroundColor:
|
|
2156
|
-
color:
|
|
2175
|
+
backgroundColor: theme2.colors.error,
|
|
2176
|
+
color: theme2.colors.base,
|
|
2157
2177
|
...props
|
|
2158
2178
|
}
|
|
2159
2179
|
);
|
|
2160
2180
|
};
|
|
2161
2181
|
ButtonComponent.icon = function Icon3({ size = 16, backgroundButtonColor, ...props }) {
|
|
2162
|
-
const
|
|
2182
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2163
2183
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2164
|
-
const buttonSize = size +
|
|
2165
|
-
const backgroundButtonColorReady = backgroundButtonColor ??
|
|
2184
|
+
const buttonSize = size + theme2.styles.space;
|
|
2185
|
+
const backgroundButtonColorReady = backgroundButtonColor ?? theme2.colors.textPrimary;
|
|
2166
2186
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2167
2187
|
ButtonComponent,
|
|
2168
2188
|
{
|
|
2169
2189
|
...betterHtmlContext2.components.button?.style?.icon,
|
|
2170
2190
|
width: buttonSize,
|
|
2171
2191
|
height: buttonSize,
|
|
2172
|
-
color:
|
|
2192
|
+
color: theme2.colors.textPrimary,
|
|
2173
2193
|
backgroundColor: backgroundButtonColorReady + "00",
|
|
2174
2194
|
backgroundImage: "none",
|
|
2175
2195
|
backgroundColorHover: backgroundButtonColorReady + "20",
|
|
@@ -2213,82 +2233,416 @@ Button2.icon = ButtonComponent.icon;
|
|
|
2213
2233
|
Button2.upload = ButtonComponent.upload;
|
|
2214
2234
|
var Button_default = Button2;
|
|
2215
2235
|
|
|
2216
|
-
// src/components/
|
|
2236
|
+
// src/components/Modal.tsx
|
|
2237
|
+
var import_react11 = require("react");
|
|
2238
|
+
var import_react_dom = require("react-dom");
|
|
2239
|
+
var import_react_better_core10 = require("react-better-core");
|
|
2240
|
+
var import_styled_components7 = __toESM(require("styled-components"));
|
|
2217
2241
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2218
|
-
var
|
|
2219
|
-
shouldForwardProp: (prop) => !["theme"].includes(prop)
|
|
2242
|
+
var DialogStylesElement = import_styled_components7.default.dialog.withConfig({
|
|
2243
|
+
shouldForwardProp: (prop) => !["theme", "colorTheme", "opacity"].includes(prop)
|
|
2220
2244
|
})`
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
}
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
from {
|
|
2234
|
-
opacity: 0;
|
|
2235
|
-
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2236
|
-
}
|
|
2237
|
-
to {
|
|
2238
|
-
opacity: 1;
|
|
2239
|
-
transform: translateX(0px);
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2245
|
+
width: 100%;
|
|
2246
|
+
max-width: none;
|
|
2247
|
+
height: 100%;
|
|
2248
|
+
max-height: none;
|
|
2249
|
+
color: ${(props) => props.theme.colors.textPrimary};
|
|
2250
|
+
border: none;
|
|
2251
|
+
outline: none;
|
|
2252
|
+
background-color: transparent;
|
|
2253
|
+
margin: auto auto;
|
|
2254
|
+
padding-inline: ${(props) => props.theme.styles.gap}px;
|
|
2255
|
+
opacity: ${(props) => props.opacity};
|
|
2256
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
2242
2257
|
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
}
|
|
2248
|
-
to {
|
|
2249
|
-
opacity: 1;
|
|
2250
|
-
transform: translateX(0px);
|
|
2251
|
-
}
|
|
2258
|
+
&::backdrop {
|
|
2259
|
+
background-color: ${(props) => props.colorTheme === "light" ? "#000000a0" : "#222222e0"};
|
|
2260
|
+
opacity: ${(props) => props.opacity};
|
|
2261
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
2252
2262
|
}
|
|
2253
2263
|
|
|
2254
|
-
@keyframes
|
|
2264
|
+
@keyframes fadeInAnimation {
|
|
2255
2265
|
from {
|
|
2256
|
-
opacity: 0;
|
|
2257
2266
|
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2258
2267
|
}
|
|
2259
2268
|
to {
|
|
2260
|
-
opacity: 1;
|
|
2261
2269
|
transform: translateY(0px);
|
|
2262
2270
|
}
|
|
2263
2271
|
}
|
|
2264
2272
|
|
|
2265
|
-
@keyframes
|
|
2266
|
-
from {
|
|
2267
|
-
opacity: 1;
|
|
2268
|
-
transform: translateX(0px);
|
|
2269
|
-
}
|
|
2270
|
-
to {
|
|
2271
|
-
opacity: 0;
|
|
2272
|
-
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2273
|
-
}
|
|
2274
|
-
}
|
|
2275
|
-
|
|
2276
|
-
@keyframes fadeOutToRight {
|
|
2273
|
+
@keyframes fadeOutAnimation {
|
|
2277
2274
|
from {
|
|
2278
|
-
|
|
2279
|
-
transform: translateX(0px);
|
|
2275
|
+
transform: translateY(0px);
|
|
2280
2276
|
}
|
|
2281
2277
|
to {
|
|
2282
|
-
|
|
2283
|
-
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2278
|
+
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2284
2279
|
}
|
|
2285
2280
|
}
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2281
|
+
`;
|
|
2282
|
+
var ModalComponent = (0, import_react11.forwardRef)(function Modal({
|
|
2283
|
+
maxWidth,
|
|
2284
|
+
icon,
|
|
2285
|
+
title,
|
|
2286
|
+
titleColor,
|
|
2287
|
+
description,
|
|
2288
|
+
descriptionColor,
|
|
2289
|
+
headerTextAlign,
|
|
2290
|
+
headerBackgroundColor,
|
|
2291
|
+
backgroundColor,
|
|
2292
|
+
name,
|
|
2293
|
+
overflow,
|
|
2294
|
+
withoutCloseButton,
|
|
2295
|
+
defaultIsOpened = false,
|
|
2296
|
+
onOpen,
|
|
2297
|
+
onClose,
|
|
2298
|
+
children
|
|
2299
|
+
}, ref) {
|
|
2300
|
+
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
2301
|
+
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
2302
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
2303
|
+
const { app } = useBetterHtmlContextInternal();
|
|
2304
|
+
const { colorTheme } = (0, import_react_better_core10.useBetterCoreContext)();
|
|
2305
|
+
const dialogRef = (0, import_react11.useRef)(null);
|
|
2306
|
+
const [isOpened, setIsOpened] = (0, import_react_better_core10.useBooleanState)(false);
|
|
2307
|
+
const [isOpenedLate, setIsOpenedLate] = (0, import_react_better_core10.useBooleanState)(false);
|
|
2308
|
+
const onClickOpen = (0, import_react11.useCallback)(() => {
|
|
2309
|
+
dialogRef.current?.showModal();
|
|
2310
|
+
setIsOpened.setTrue();
|
|
2311
|
+
setIsOpenedLate.setTrue();
|
|
2312
|
+
if (urlQuery && name) {
|
|
2313
|
+
urlQuery.setQuery(
|
|
2314
|
+
{
|
|
2315
|
+
[`${name}-modal`]: "opened"
|
|
2316
|
+
},
|
|
2317
|
+
false
|
|
2318
|
+
);
|
|
2319
|
+
}
|
|
2320
|
+
onOpen?.();
|
|
2321
|
+
}, [onOpen, urlQuery, name]);
|
|
2322
|
+
const onClickClose = (0, import_react11.useCallback)(() => {
|
|
2323
|
+
setIsOpened.setFalse();
|
|
2324
|
+
onClose?.();
|
|
2325
|
+
if (urlQuery && name) urlQuery.removeQuery(`${name}-modal`, false);
|
|
2326
|
+
setTimeout(() => {
|
|
2327
|
+
dialogRef.current?.close();
|
|
2328
|
+
setIsOpenedLate.setFalse();
|
|
2329
|
+
}, 0.2 * 1e3);
|
|
2330
|
+
}, [onClose, urlQuery, name]);
|
|
2331
|
+
const onKeyDown = (0, import_react11.useCallback)(
|
|
2332
|
+
(event) => {
|
|
2333
|
+
if (event.key === "Escape") {
|
|
2334
|
+
if (!withoutCloseButton) return;
|
|
2335
|
+
event.preventDefault();
|
|
2336
|
+
}
|
|
2337
|
+
},
|
|
2338
|
+
[withoutCloseButton]
|
|
2339
|
+
);
|
|
2340
|
+
(0, import_react11.useEffect)(() => {
|
|
2341
|
+
if (!defaultIsOpened) return;
|
|
2342
|
+
onClickOpen();
|
|
2343
|
+
}, []);
|
|
2344
|
+
(0, import_react11.useImperativeHandle)(
|
|
2345
|
+
ref,
|
|
2346
|
+
() => {
|
|
2347
|
+
return {
|
|
2348
|
+
open: onClickOpen,
|
|
2349
|
+
close: onClickClose,
|
|
2350
|
+
isOpened
|
|
2351
|
+
};
|
|
2352
|
+
},
|
|
2353
|
+
[onClickOpen, onClickClose, isOpened]
|
|
2354
|
+
);
|
|
2355
|
+
const headerVertical = headerTextAlign === "center";
|
|
2356
|
+
return (0, import_react_dom.createPortal)(
|
|
2357
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2358
|
+
DialogStylesElement,
|
|
2359
|
+
{
|
|
2360
|
+
theme: theme2,
|
|
2361
|
+
colorTheme,
|
|
2362
|
+
opacity: !isOpened ? 0 : 1,
|
|
2363
|
+
onClose: onClickClose,
|
|
2364
|
+
onKeyDown,
|
|
2365
|
+
ref: dialogRef,
|
|
2366
|
+
children: isOpenedLate ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2367
|
+
Div_default.column,
|
|
2368
|
+
{
|
|
2369
|
+
position: "relative",
|
|
2370
|
+
width: "100%",
|
|
2371
|
+
maxWidth: maxWidth ?? app.contentMaxWidth / 1.3,
|
|
2372
|
+
minHeight: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
2373
|
+
alignItems: "center",
|
|
2374
|
+
justifyContent: "center",
|
|
2375
|
+
marginBlock: theme2.styles.space,
|
|
2376
|
+
marginInline: "auto",
|
|
2377
|
+
transform: `translateY(${theme2.styles.space}px)`,
|
|
2378
|
+
transition: theme2.styles.transition,
|
|
2379
|
+
animation: isOpened ? "fadeInAnimation 0.2s ease forwards" : "fadeOutAnimation 0.2s ease forwards",
|
|
2380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2381
|
+
Div_default,
|
|
2382
|
+
{
|
|
2383
|
+
position: "relative",
|
|
2384
|
+
width: "100%",
|
|
2385
|
+
minHeight: 32 + theme2.styles.space * 2,
|
|
2386
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
2387
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
2388
|
+
padding: !title ? theme2.styles.space : void 0,
|
|
2389
|
+
overflow,
|
|
2390
|
+
children: [
|
|
2391
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2393
|
+
Div_default.row,
|
|
2394
|
+
{
|
|
2395
|
+
alignItems: "center",
|
|
2396
|
+
gap: theme2.styles.gap,
|
|
2397
|
+
backgroundColor: headerBackgroundColor,
|
|
2398
|
+
borderTopLeftRadius: theme2.styles.borderRadius * 2 - 1,
|
|
2399
|
+
borderTopRightRadius: theme2.styles.borderRadius * 2 - 1,
|
|
2400
|
+
paddingInline: theme2.styles.space,
|
|
2401
|
+
paddingBlock: theme2.styles.space,
|
|
2402
|
+
transition: theme2.styles.transition,
|
|
2403
|
+
children: [
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2405
|
+
Div_default.row,
|
|
2406
|
+
{
|
|
2407
|
+
flex: 1,
|
|
2408
|
+
alignItems: "center",
|
|
2409
|
+
gap: headerVertical ? theme2.styles.space * 2 : theme2.styles.space,
|
|
2410
|
+
invertFlexDirection: headerVertical,
|
|
2411
|
+
children: [
|
|
2412
|
+
icon && (headerVertical ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2413
|
+
Div_default.row,
|
|
2414
|
+
{
|
|
2415
|
+
width: 76,
|
|
2416
|
+
height: 76,
|
|
2417
|
+
alignItems: "center",
|
|
2418
|
+
justifyContent: "center",
|
|
2419
|
+
backgroundColor: titleColor ?? theme2.colors.textPrimary,
|
|
2420
|
+
borderRadius: 999,
|
|
2421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2422
|
+
Icon_default,
|
|
2423
|
+
{
|
|
2424
|
+
name: icon,
|
|
2425
|
+
size: 36,
|
|
2426
|
+
color: headerBackgroundColor ?? theme2.colors.backgroundBase,
|
|
2427
|
+
flexShrink: 0
|
|
2428
|
+
}
|
|
2429
|
+
)
|
|
2430
|
+
}
|
|
2431
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2432
|
+
Icon_default,
|
|
2433
|
+
{
|
|
2434
|
+
name: icon,
|
|
2435
|
+
size: 24,
|
|
2436
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
2437
|
+
flexShrink: 0
|
|
2438
|
+
}
|
|
2439
|
+
)),
|
|
2440
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
2441
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2442
|
+
Text_default,
|
|
2443
|
+
{
|
|
2444
|
+
as: "h1",
|
|
2445
|
+
textAlign: headerTextAlign,
|
|
2446
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
2447
|
+
transition: theme2.styles.transition,
|
|
2448
|
+
children: title
|
|
2449
|
+
}
|
|
2450
|
+
),
|
|
2451
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2452
|
+
Text_default,
|
|
2453
|
+
{
|
|
2454
|
+
textAlign: headerTextAlign,
|
|
2455
|
+
color: descriptionColor ?? theme2.colors.textSecondary,
|
|
2456
|
+
transition: theme2.styles.transition,
|
|
2457
|
+
children: description
|
|
2458
|
+
}
|
|
2459
|
+
)
|
|
2460
|
+
] })
|
|
2461
|
+
]
|
|
2462
|
+
}
|
|
2463
|
+
),
|
|
2464
|
+
!withoutCloseButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2465
|
+
Button_default.icon,
|
|
2466
|
+
{
|
|
2467
|
+
icon: "XMark",
|
|
2468
|
+
marginTop: 1,
|
|
2469
|
+
iconColor: titleColor,
|
|
2470
|
+
onClick: onClickClose,
|
|
2471
|
+
transition: theme2.styles.transition,
|
|
2472
|
+
zIndex: 10
|
|
2473
|
+
}
|
|
2474
|
+
)
|
|
2475
|
+
]
|
|
2476
|
+
}
|
|
2477
|
+
),
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Divider_default.horizontal, {})
|
|
2479
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: !withoutCloseButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Div_default, { position: "absolute", top: theme2.styles.space, right: theme2.styles.space, zIndex: 10, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default.icon, { icon: "XMark", iconColor: titleColor, onClick: onClickClose }) }) }),
|
|
2480
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Div_default, { padding: title ? theme2.styles.space : void 0, children })
|
|
2481
|
+
]
|
|
2482
|
+
}
|
|
2483
|
+
)
|
|
2484
|
+
}
|
|
2485
|
+
) : void 0
|
|
2486
|
+
}
|
|
2487
|
+
),
|
|
2488
|
+
document.body
|
|
2489
|
+
);
|
|
2490
|
+
});
|
|
2491
|
+
ModalComponent.confirmation = (0, import_react11.forwardRef)(function Confirmation({ message, continueButtonText = "Continue", continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
2492
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
2493
|
+
const modalRef = (0, import_react11.useRef)(null);
|
|
2494
|
+
const onCancelElement = (0, import_react11.useCallback)(() => {
|
|
2495
|
+
onCancel?.();
|
|
2496
|
+
modalRef.current?.close();
|
|
2497
|
+
}, [onCancel]);
|
|
2498
|
+
const onContinueElement = (0, import_react11.useCallback)(() => {
|
|
2499
|
+
onContinue?.();
|
|
2500
|
+
modalRef.current?.close();
|
|
2501
|
+
}, [onContinue]);
|
|
2502
|
+
(0, import_react11.useImperativeHandle)(ref, () => modalRef.current, []);
|
|
2503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
2504
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { color: theme2.colors.textSecondary, children: message ?? "Do you really want to continue? This action may be irreversible." }),
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2506
|
+
Div_default.row,
|
|
2507
|
+
{
|
|
2508
|
+
alignItems: "center",
|
|
2509
|
+
justifyContent: "flex-end",
|
|
2510
|
+
gap: theme2.styles.gap,
|
|
2511
|
+
marginTop: theme2.styles.space * 2,
|
|
2512
|
+
children: [
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default, { text: continueButtonText, loaderName: continueButtonLoaderName, onClick: onContinueElement })
|
|
2515
|
+
]
|
|
2516
|
+
}
|
|
2517
|
+
)
|
|
2518
|
+
] });
|
|
2519
|
+
});
|
|
2520
|
+
ModalComponent.destructive = (0, import_react11.forwardRef)(function Destructive2({
|
|
2521
|
+
message,
|
|
2522
|
+
deleteButtonText = "Delete",
|
|
2523
|
+
deleteButtonIconName = "trash",
|
|
2524
|
+
deleteButtonLoaderName,
|
|
2525
|
+
onDelete,
|
|
2526
|
+
onCancel,
|
|
2527
|
+
...props
|
|
2528
|
+
}, ref) {
|
|
2529
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
2530
|
+
const modalRef = (0, import_react11.useRef)(null);
|
|
2531
|
+
const onCancelElement = (0, import_react11.useCallback)(() => {
|
|
2532
|
+
onCancel?.();
|
|
2533
|
+
modalRef.current?.close();
|
|
2534
|
+
}, [onCancel]);
|
|
2535
|
+
const onDeleteElement = (0, import_react11.useCallback)(() => {
|
|
2536
|
+
onDelete?.();
|
|
2537
|
+
modalRef.current?.close();
|
|
2538
|
+
}, [onDelete]);
|
|
2539
|
+
(0, import_react11.useImperativeHandle)(ref, () => modalRef.current, []);
|
|
2540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
2541
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text_default, { color: theme2.colors.textSecondary, children: message ?? "Do you really want to continue with the deleting of the item? This action may be irreversible." }),
|
|
2542
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2543
|
+
Div_default.row,
|
|
2544
|
+
{
|
|
2545
|
+
alignItems: "center",
|
|
2546
|
+
justifyContent: "flex-end",
|
|
2547
|
+
gap: theme2.styles.gap,
|
|
2548
|
+
marginTop: theme2.styles.space * 2,
|
|
2549
|
+
children: [
|
|
2550
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2552
|
+
Button_default.destructive,
|
|
2553
|
+
{
|
|
2554
|
+
icon: deleteButtonIconName,
|
|
2555
|
+
text: deleteButtonText,
|
|
2556
|
+
loaderName: deleteButtonLoaderName,
|
|
2557
|
+
onClick: onDeleteElement
|
|
2558
|
+
}
|
|
2559
|
+
)
|
|
2560
|
+
]
|
|
2561
|
+
}
|
|
2562
|
+
)
|
|
2563
|
+
] });
|
|
2564
|
+
});
|
|
2565
|
+
var Modal2 = (0, import_react11.memo)(ModalComponent);
|
|
2566
|
+
Modal2.confirmation = ModalComponent.confirmation;
|
|
2567
|
+
Modal2.destructive = ModalComponent.destructive;
|
|
2568
|
+
var Modal_default = Modal2;
|
|
2569
|
+
|
|
2570
|
+
// src/components/alerts/Alert.tsx
|
|
2571
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2572
|
+
var StyledDiv2 = import_styled_components8.default.div.withConfig({
|
|
2573
|
+
shouldForwardProp: (prop) => !["theme"].includes(prop)
|
|
2574
|
+
})`
|
|
2575
|
+
@keyframes fadeInFromLeft {
|
|
2576
|
+
from {
|
|
2577
|
+
opacity: 0;
|
|
2578
|
+
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2579
|
+
}
|
|
2580
|
+
to {
|
|
2581
|
+
opacity: 1;
|
|
2582
|
+
transform: translateX(0px);
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
|
|
2586
|
+
@keyframes fadeInFromRight {
|
|
2587
|
+
from {
|
|
2588
|
+
opacity: 0;
|
|
2589
|
+
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2590
|
+
}
|
|
2591
|
+
to {
|
|
2592
|
+
opacity: 1;
|
|
2593
|
+
transform: translateX(0px);
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
@keyframes fadeInFromTop {
|
|
2598
|
+
from {
|
|
2599
|
+
opacity: 0;
|
|
2600
|
+
transform: translateY(-${(props) => props.theme.styles.space}px);
|
|
2601
|
+
}
|
|
2602
|
+
to {
|
|
2603
|
+
opacity: 1;
|
|
2604
|
+
transform: translateX(0px);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
@keyframes fadeInFromBottom {
|
|
2609
|
+
from {
|
|
2610
|
+
opacity: 0;
|
|
2611
|
+
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2612
|
+
}
|
|
2613
|
+
to {
|
|
2614
|
+
opacity: 1;
|
|
2615
|
+
transform: translateY(0px);
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
@keyframes fadeOutToLeft {
|
|
2620
|
+
from {
|
|
2621
|
+
opacity: 1;
|
|
2622
|
+
transform: translateX(0px);
|
|
2623
|
+
}
|
|
2624
|
+
to {
|
|
2625
|
+
opacity: 0;
|
|
2626
|
+
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
|
|
2630
|
+
@keyframes fadeOutToRight {
|
|
2631
|
+
from {
|
|
2632
|
+
opacity: 1;
|
|
2633
|
+
transform: translateX(0px);
|
|
2634
|
+
}
|
|
2635
|
+
to {
|
|
2636
|
+
opacity: 0;
|
|
2637
|
+
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
@keyframes fadeOutToTop {
|
|
2642
|
+
from {
|
|
2643
|
+
opacity: 1;
|
|
2644
|
+
transform: translateY(0px);
|
|
2645
|
+
}
|
|
2292
2646
|
to {
|
|
2293
2647
|
opacity: 0;
|
|
2294
2648
|
transform: translateY(-${(props) => props.theme.styles.space}px);
|
|
@@ -2327,22 +2681,24 @@ var getAlertDurationFromAuto = (duration, alert) => {
|
|
|
2327
2681
|
return duration;
|
|
2328
2682
|
};
|
|
2329
2683
|
function Alert2({ alert }) {
|
|
2330
|
-
const
|
|
2684
|
+
const theme2 = (0, import_react_better_core11.useTheme)();
|
|
2331
2685
|
const alertControls2 = useAlertControls();
|
|
2332
2686
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2333
2687
|
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
2688
|
+
const modalRef = (0, import_react12.useRef)(null);
|
|
2334
2689
|
const defaultAlertDurationNumber = getAlertDurationFromAuto(
|
|
2335
2690
|
alert.duration ?? pluginConfig.defaultDuration ?? defaultAlertsPluginOptions.defaultDuration,
|
|
2336
2691
|
alert
|
|
2337
2692
|
);
|
|
2338
|
-
const
|
|
2339
|
-
const
|
|
2340
|
-
const
|
|
2341
|
-
const
|
|
2342
|
-
const
|
|
2343
|
-
const [
|
|
2344
|
-
const [
|
|
2345
|
-
const
|
|
2693
|
+
const defaultAlertDisplay = alert.display ?? pluginConfig.defaultDisplay?.[alert.type] ?? defaultAlertsPluginOptions.defaultDisplay[alert.type] ?? "default";
|
|
2694
|
+
const intervalRef = (0, import_react12.useRef)(void 0);
|
|
2695
|
+
const startTimeRef = (0, import_react12.useRef)(Date.now());
|
|
2696
|
+
const remainingTimeRef = (0, import_react12.useRef)(defaultAlertDurationNumber);
|
|
2697
|
+
const calledOnCloseRef = (0, import_react12.useRef)(false);
|
|
2698
|
+
const [isPaused, setIsPaused] = (0, import_react12.useState)(false);
|
|
2699
|
+
const [progress, setProgress] = (0, import_react12.useState)(100);
|
|
2700
|
+
const [isRemoved, setIsRemoved] = (0, import_react12.useState)(false);
|
|
2701
|
+
const startProgressTimer = (0, import_react12.useCallback)(() => {
|
|
2346
2702
|
if (intervalRef.current) {
|
|
2347
2703
|
clearInterval(intervalRef.current);
|
|
2348
2704
|
}
|
|
@@ -2354,6 +2710,7 @@ function Alert2({ alert }) {
|
|
|
2354
2710
|
setProgress(newProgress);
|
|
2355
2711
|
if (newProgress <= 0) {
|
|
2356
2712
|
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
2713
|
+
if (defaultAlertDisplay === "prominent") return;
|
|
2357
2714
|
setIsRemoved(true);
|
|
2358
2715
|
setTimeout(() => {
|
|
2359
2716
|
alertControls2.removeAlert(alert.id);
|
|
@@ -2364,8 +2721,8 @@ function Alert2({ alert }) {
|
|
|
2364
2721
|
}, 0.2 * 1e3 - 10);
|
|
2365
2722
|
}
|
|
2366
2723
|
}, updateInterval);
|
|
2367
|
-
}, [alert, progress]);
|
|
2368
|
-
const onClickCloseAlert = (0,
|
|
2724
|
+
}, [alert, progress, defaultAlertDisplay]);
|
|
2725
|
+
const onClickCloseAlert = (0, import_react12.useCallback)(() => {
|
|
2369
2726
|
setIsRemoved(true);
|
|
2370
2727
|
setTimeout(() => {
|
|
2371
2728
|
alertControls2.removeAlert(alert.id);
|
|
@@ -2375,7 +2732,7 @@ function Alert2({ alert }) {
|
|
|
2375
2732
|
}
|
|
2376
2733
|
}, 0.2 * 1e3 - 10);
|
|
2377
2734
|
}, [alert]);
|
|
2378
|
-
const onMouseEnter = (0,
|
|
2735
|
+
const onMouseEnter = (0, import_react12.useCallback)(() => {
|
|
2379
2736
|
setIsPaused(true);
|
|
2380
2737
|
if (intervalRef.current) {
|
|
2381
2738
|
clearInterval(intervalRef.current);
|
|
@@ -2383,36 +2740,47 @@ function Alert2({ alert }) {
|
|
|
2383
2740
|
}
|
|
2384
2741
|
remainingTimeRef.current = defaultAlertDurationNumber * (progress / 100);
|
|
2385
2742
|
}, [defaultAlertDurationNumber, progress]);
|
|
2386
|
-
const onMouseLeave = (0,
|
|
2743
|
+
const onMouseLeave = (0, import_react12.useCallback)(() => {
|
|
2387
2744
|
setIsPaused(false);
|
|
2388
2745
|
startProgressTimer();
|
|
2389
2746
|
}, [startProgressTimer]);
|
|
2390
|
-
const
|
|
2747
|
+
const onClickAlertModalDone = (0, import_react12.useCallback)(() => {
|
|
2748
|
+
setIsRemoved(true);
|
|
2749
|
+
modalRef.current?.close();
|
|
2750
|
+
setTimeout(() => {
|
|
2751
|
+
alertControls2.removeAlert(alert.id);
|
|
2752
|
+
if (!calledOnCloseRef.current) {
|
|
2753
|
+
alert.onClose?.(alert);
|
|
2754
|
+
calledOnCloseRef.current = true;
|
|
2755
|
+
}
|
|
2756
|
+
}, 0.2 * 1e3 - 10);
|
|
2757
|
+
}, [alert]);
|
|
2758
|
+
const alertData = (0, import_react12.useMemo)(
|
|
2391
2759
|
() => ({
|
|
2392
2760
|
info: {
|
|
2393
2761
|
icon: "infoI",
|
|
2394
|
-
backgroundColor:
|
|
2762
|
+
backgroundColor: theme2.colors.info,
|
|
2395
2763
|
title: "Info"
|
|
2396
2764
|
},
|
|
2397
2765
|
success: {
|
|
2398
2766
|
icon: "check",
|
|
2399
|
-
backgroundColor:
|
|
2767
|
+
backgroundColor: theme2.colors.success,
|
|
2400
2768
|
title: "Success"
|
|
2401
2769
|
},
|
|
2402
2770
|
warning: {
|
|
2403
2771
|
icon: "warningTriangle",
|
|
2404
|
-
backgroundColor:
|
|
2772
|
+
backgroundColor: theme2.colors.warn,
|
|
2405
2773
|
title: "Warning"
|
|
2406
2774
|
},
|
|
2407
2775
|
error: {
|
|
2408
2776
|
icon: "XMark",
|
|
2409
|
-
backgroundColor:
|
|
2777
|
+
backgroundColor: theme2.colors.error,
|
|
2410
2778
|
title: "Error"
|
|
2411
2779
|
}
|
|
2412
2780
|
}),
|
|
2413
|
-
[
|
|
2781
|
+
[theme2]
|
|
2414
2782
|
);
|
|
2415
|
-
(0,
|
|
2783
|
+
(0, import_react12.useEffect)(() => {
|
|
2416
2784
|
startTimeRef.current = Date.now();
|
|
2417
2785
|
remainingTimeRef.current = defaultAlertDurationNumber;
|
|
2418
2786
|
startProgressTimer();
|
|
@@ -2420,8 +2788,31 @@ function Alert2({ alert }) {
|
|
|
2420
2788
|
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
2421
2789
|
};
|
|
2422
2790
|
}, [defaultAlertDurationNumber, startProgressTimer]);
|
|
2423
|
-
const animation = `${isRemoved ? getAnimationOutName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align] : getAnimationInName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align]} ${
|
|
2424
|
-
|
|
2791
|
+
const animation = `${isRemoved ? getAnimationOutName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align] : getAnimationInName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align]} ${theme2.styles.transition}`;
|
|
2792
|
+
const alertTitle = alert.title ?? alertData[alert.type].title;
|
|
2793
|
+
return defaultAlertDisplay === "prominent" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2794
|
+
Modal_default,
|
|
2795
|
+
{
|
|
2796
|
+
defaultIsOpened: true,
|
|
2797
|
+
icon: alertData[alert.type].icon,
|
|
2798
|
+
title: alertTitle,
|
|
2799
|
+
description: alert.message,
|
|
2800
|
+
titleColor: theme2.colors.base,
|
|
2801
|
+
descriptionColor: theme2.colors.base + "a0",
|
|
2802
|
+
headerTextAlign: "center",
|
|
2803
|
+
headerBackgroundColor: alertData[alert.type].backgroundColor,
|
|
2804
|
+
withoutCloseButton: true,
|
|
2805
|
+
ref: modalRef,
|
|
2806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default.row, { width: "100%", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2807
|
+
Button_default,
|
|
2808
|
+
{
|
|
2809
|
+
text: "Close",
|
|
2810
|
+
backgroundColor: alertData[alert.type].backgroundColor,
|
|
2811
|
+
onClick: onClickAlertModalDone
|
|
2812
|
+
}
|
|
2813
|
+
) })
|
|
2814
|
+
}
|
|
2815
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StyledDiv2, { theme: theme2, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2425
2816
|
Div_default.box,
|
|
2426
2817
|
{
|
|
2427
2818
|
width: "fit-content",
|
|
@@ -2432,9 +2823,9 @@ function Alert2({ alert }) {
|
|
|
2432
2823
|
onMouseMove: onMouseEnter,
|
|
2433
2824
|
onMouseLeave,
|
|
2434
2825
|
animation,
|
|
2435
|
-
children: /* @__PURE__ */ (0,
|
|
2436
|
-
/* @__PURE__ */ (0,
|
|
2437
|
-
/* @__PURE__ */ (0,
|
|
2826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.column, { gap: theme2.styles.space, children: [
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2438
2829
|
Div_default.row,
|
|
2439
2830
|
{
|
|
2440
2831
|
width: 36,
|
|
@@ -2443,32 +2834,32 @@ function Alert2({ alert }) {
|
|
|
2443
2834
|
justifyContent: "center",
|
|
2444
2835
|
backgroundColor: alertData[alert.type].backgroundColor,
|
|
2445
2836
|
borderRadius: 999,
|
|
2446
|
-
marginTop:
|
|
2447
|
-
children: /* @__PURE__ */ (0,
|
|
2837
|
+
marginTop: theme2.styles.gap / 2,
|
|
2838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2448
2839
|
Icon_default,
|
|
2449
2840
|
{
|
|
2450
2841
|
name: alertData[alert.type].icon,
|
|
2451
2842
|
size: 18,
|
|
2452
|
-
color: alertData[alert.type].iconColor ??
|
|
2843
|
+
color: alertData[alert.type].iconColor ?? theme2.colors.base
|
|
2453
2844
|
}
|
|
2454
2845
|
)
|
|
2455
2846
|
}
|
|
2456
2847
|
),
|
|
2457
|
-
/* @__PURE__ */ (0,
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2459
|
-
/* @__PURE__ */ (0,
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { fontSize: 18, fontWeight: 700, children: alertTitle }),
|
|
2850
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { color: theme2.colors.textSecondary, children: alert.message })
|
|
2460
2851
|
] }),
|
|
2461
|
-
pluginConfig.withCloseButton && /* @__PURE__ */ (0,
|
|
2852
|
+
pluginConfig.withCloseButton && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button_default.icon, { icon: "XMark", alignSelf: "flex-start", onClick: onClickCloseAlert })
|
|
2462
2853
|
] }),
|
|
2463
|
-
pluginConfig.withLoaderBar && /* @__PURE__ */ (0,
|
|
2854
|
+
pluginConfig.withLoaderBar && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2464
2855
|
Div_default,
|
|
2465
2856
|
{
|
|
2466
2857
|
width: "100%",
|
|
2467
2858
|
height: 5,
|
|
2468
|
-
backgroundColor:
|
|
2859
|
+
backgroundColor: theme2.colors.backgroundBase,
|
|
2469
2860
|
borderRadius: 999,
|
|
2470
2861
|
overflow: "hidden",
|
|
2471
|
-
children: /* @__PURE__ */ (0,
|
|
2862
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2472
2863
|
Div_default,
|
|
2473
2864
|
{
|
|
2474
2865
|
width: `${progress}%`,
|
|
@@ -2484,20 +2875,20 @@ function Alert2({ alert }) {
|
|
|
2484
2875
|
}
|
|
2485
2876
|
) });
|
|
2486
2877
|
}
|
|
2487
|
-
var Alert_default = (0,
|
|
2878
|
+
var Alert_default = (0, import_react12.memo)(Alert2);
|
|
2488
2879
|
|
|
2489
2880
|
// src/components/alerts/AlertsHolder.tsx
|
|
2490
|
-
var
|
|
2881
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2491
2882
|
function AlertsHolder() {
|
|
2492
|
-
const
|
|
2883
|
+
const theme2 = (0, import_react_better_core12.useTheme)();
|
|
2493
2884
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2494
2885
|
const { alerts } = useBetterHtmlContextInternal();
|
|
2495
2886
|
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
2496
|
-
const top = pluginConfig.position === "top" ?
|
|
2497
|
-
const bottom = pluginConfig.position === "bottom" ?
|
|
2498
|
-
const left = pluginConfig.align === "left" ?
|
|
2499
|
-
const right = pluginConfig.align === "right" ?
|
|
2500
|
-
return /* @__PURE__ */ (0,
|
|
2887
|
+
const top = pluginConfig.position === "top" ? theme2.styles.gap : void 0;
|
|
2888
|
+
const bottom = pluginConfig.position === "bottom" ? theme2.styles.gap : void 0;
|
|
2889
|
+
const left = pluginConfig.align === "left" ? theme2.styles.space : pluginConfig.align === "center" ? "50%" : void 0;
|
|
2890
|
+
const right = pluginConfig.align === "right" ? theme2.styles.space : void 0;
|
|
2891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2501
2892
|
Div_default.column,
|
|
2502
2893
|
{
|
|
2503
2894
|
position: "fixed",
|
|
@@ -2505,19 +2896,19 @@ function AlertsHolder() {
|
|
|
2505
2896
|
bottom,
|
|
2506
2897
|
left,
|
|
2507
2898
|
right,
|
|
2508
|
-
gap:
|
|
2899
|
+
gap: theme2.styles.gap,
|
|
2509
2900
|
alignItems: pluginConfig.align === "center" ? "center" : pluginConfig.align === "right" ? "flex-end" : void 0,
|
|
2510
2901
|
transform: pluginConfig.align === "center" ? "translateX(-50%)" : void 0,
|
|
2511
2902
|
zIndex: 1e3,
|
|
2512
|
-
children: alerts.map((alert) => /* @__PURE__ */ (0,
|
|
2903
|
+
children: alerts.map((alert) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Alert_default, { alert }, alert.id))
|
|
2513
2904
|
}
|
|
2514
2905
|
);
|
|
2515
2906
|
}
|
|
2516
|
-
var AlertsHolder_default = (0,
|
|
2907
|
+
var AlertsHolder_default = (0, import_react13.memo)(AlertsHolder);
|
|
2517
2908
|
|
|
2518
2909
|
// src/components/BetterHtmlProvider.tsx
|
|
2519
|
-
var
|
|
2520
|
-
var GlobalStyle =
|
|
2910
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2911
|
+
var GlobalStyle = import_styled_components9.createGlobalStyle`
|
|
2521
2912
|
html {
|
|
2522
2913
|
background-color: ${(props) => props.backgroundColor};
|
|
2523
2914
|
}
|
|
@@ -2544,12 +2935,12 @@ var GlobalStyle = import_styled_components8.createGlobalStyle`
|
|
|
2544
2935
|
display: none;
|
|
2545
2936
|
}
|
|
2546
2937
|
`;
|
|
2547
|
-
var betterHtmlContext = (0,
|
|
2938
|
+
var betterHtmlContext = (0, import_react14.createContext)(void 0);
|
|
2548
2939
|
var externalBetterCoreContextValue;
|
|
2549
2940
|
var externalBetterHtmlContextValue;
|
|
2550
2941
|
var useBetterHtmlContext = () => {
|
|
2551
|
-
const coreContext = (0,
|
|
2552
|
-
const context = (0,
|
|
2942
|
+
const coreContext = (0, import_react_better_core13.useBetterCoreContext)();
|
|
2943
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2553
2944
|
if (context === void 0)
|
|
2554
2945
|
throw new Error(
|
|
2555
2946
|
"`useBetterHtmlContext()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
@@ -2561,7 +2952,7 @@ var useBetterHtmlContext = () => {
|
|
|
2561
2952
|
};
|
|
2562
2953
|
};
|
|
2563
2954
|
var useBetterHtmlContextInternal = () => {
|
|
2564
|
-
const context = (0,
|
|
2955
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2565
2956
|
if (context === void 0)
|
|
2566
2957
|
throw new Error(
|
|
2567
2958
|
"`useBetterHtmlContextInternal()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
@@ -2569,12 +2960,12 @@ var useBetterHtmlContextInternal = () => {
|
|
|
2569
2960
|
return context;
|
|
2570
2961
|
};
|
|
2571
2962
|
var useAlertControls = () => {
|
|
2572
|
-
const context = (0,
|
|
2963
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2573
2964
|
if (context === void 0)
|
|
2574
2965
|
throw new Error(
|
|
2575
2966
|
"`useAlertControls()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
2576
2967
|
);
|
|
2577
|
-
const createAlert = (0,
|
|
2968
|
+
const createAlert = (0, import_react14.useCallback)((alert) => {
|
|
2578
2969
|
const readyAlert = {
|
|
2579
2970
|
id: crypto.randomUUID(),
|
|
2580
2971
|
...alert
|
|
@@ -2582,7 +2973,7 @@ var useAlertControls = () => {
|
|
|
2582
2973
|
context.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
2583
2974
|
return readyAlert;
|
|
2584
2975
|
}, []);
|
|
2585
|
-
const removeAlert = (0,
|
|
2976
|
+
const removeAlert = (0, import_react14.useCallback)((alertId) => {
|
|
2586
2977
|
context.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
2587
2978
|
}, []);
|
|
2588
2979
|
return {
|
|
@@ -2591,41 +2982,41 @@ var useAlertControls = () => {
|
|
|
2591
2982
|
};
|
|
2592
2983
|
};
|
|
2593
2984
|
var usePlugin = (pluginName) => {
|
|
2594
|
-
const context = (0,
|
|
2985
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2595
2986
|
if (context === void 0) {
|
|
2596
2987
|
throw new Error(
|
|
2597
2988
|
"`usePlugin()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
2598
2989
|
);
|
|
2599
2990
|
}
|
|
2600
|
-
return (0,
|
|
2991
|
+
return (0, import_react14.useMemo)(
|
|
2601
2992
|
() => context.plugins.find((plugin) => plugin.name === pluginName),
|
|
2602
2993
|
[context.plugins, pluginName]
|
|
2603
2994
|
);
|
|
2604
2995
|
};
|
|
2605
2996
|
function BetterHtmlProviderInternalContent({ children }) {
|
|
2606
|
-
const
|
|
2997
|
+
const theme2 = (0, import_react_better_core13.useTheme)();
|
|
2607
2998
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2608
|
-
return /* @__PURE__ */ (0,
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
3000
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2610
3001
|
GlobalStyle,
|
|
2611
3002
|
{
|
|
2612
|
-
fontFamily:
|
|
2613
|
-
color:
|
|
2614
|
-
backgroundColor:
|
|
3003
|
+
fontFamily: theme2.styles.fontFamily,
|
|
3004
|
+
color: theme2.colors.textPrimary,
|
|
3005
|
+
backgroundColor: theme2.colors.backgroundBase
|
|
2615
3006
|
}
|
|
2616
3007
|
),
|
|
2617
3008
|
children,
|
|
2618
|
-
alertsPlugin2 && /* @__PURE__ */ (0,
|
|
3009
|
+
alertsPlugin2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AlertsHolder_default, {})
|
|
2619
3010
|
] });
|
|
2620
3011
|
}
|
|
2621
3012
|
function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
2622
|
-
const betterCoreContext = (0,
|
|
2623
|
-
const [alerts, setAlerts] = (0,
|
|
2624
|
-
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = (0,
|
|
2625
|
-
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = (0,
|
|
2626
|
-
const [tabGroups, setTabGroups] = (0,
|
|
2627
|
-
const [tabsWithDots, setTabsWithDots] = (0,
|
|
2628
|
-
const readyConfig = (0,
|
|
3013
|
+
const betterCoreContext = (0, import_react_better_core13.useBetterCoreContext)();
|
|
3014
|
+
const [alerts, setAlerts] = (0, import_react14.useState)([]);
|
|
3015
|
+
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = (0, import_react_better_core13.useBooleanState)();
|
|
3016
|
+
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = (0, import_react_better_core13.useBooleanState)();
|
|
3017
|
+
const [tabGroups, setTabGroups] = (0, import_react14.useState)([]);
|
|
3018
|
+
const [tabsWithDots, setTabsWithDots] = (0, import_react14.useState)([]);
|
|
3019
|
+
const readyConfig = (0, import_react14.useMemo)(
|
|
2629
3020
|
() => ({
|
|
2630
3021
|
app: {
|
|
2631
3022
|
...appConfig,
|
|
@@ -2652,7 +3043,7 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
2652
3043
|
}),
|
|
2653
3044
|
[config, alerts, sideMenuIsCollapsed, sideMenuIsOpenMobile, plugins, tabGroups, tabsWithDots]
|
|
2654
3045
|
);
|
|
2655
|
-
(0,
|
|
3046
|
+
(0, import_react14.useEffect)(() => {
|
|
2656
3047
|
if (!plugins) return;
|
|
2657
3048
|
plugins.forEach((plugin) => {
|
|
2658
3049
|
plugin.initialize?.();
|
|
@@ -2660,12 +3051,15 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
2660
3051
|
}, []);
|
|
2661
3052
|
externalBetterCoreContextValue = betterCoreContext;
|
|
2662
3053
|
externalBetterHtmlContextValue = readyConfig;
|
|
2663
|
-
return /* @__PURE__ */ (0,
|
|
3054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(betterHtmlContext.Provider, { value: readyConfig, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BetterHtmlProviderInternalContent, { children }) });
|
|
2664
3055
|
}
|
|
2665
3056
|
function BetterHtmlProvider({ config, ...props }) {
|
|
2666
|
-
const coreConfig = (0,
|
|
3057
|
+
const coreConfig = (0, import_react14.useMemo)(
|
|
2667
3058
|
() => ({
|
|
2668
|
-
theme:
|
|
3059
|
+
theme: {
|
|
3060
|
+
...theme,
|
|
3061
|
+
...config?.theme
|
|
3062
|
+
},
|
|
2669
3063
|
colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
2670
3064
|
icons: {
|
|
2671
3065
|
...icons,
|
|
@@ -2679,7 +3073,7 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2679
3073
|
}),
|
|
2680
3074
|
[config]
|
|
2681
3075
|
);
|
|
2682
|
-
const htmlConfig = (0,
|
|
3076
|
+
const htmlConfig = (0, import_react14.useMemo)(
|
|
2683
3077
|
() => ({
|
|
2684
3078
|
app: config?.app,
|
|
2685
3079
|
sideMenuIsCollapsed: config?.sideMenuIsCollapsed,
|
|
@@ -2688,7 +3082,7 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2688
3082
|
}),
|
|
2689
3083
|
[config]
|
|
2690
3084
|
);
|
|
2691
|
-
(0,
|
|
3085
|
+
(0, import_react14.useEffect)(() => {
|
|
2692
3086
|
const html = document.querySelector("html");
|
|
2693
3087
|
if (!html) return;
|
|
2694
3088
|
html.setAttribute("data-theme", localStorage.getItem("theme") === "dark" ? "dark" : "light");
|
|
@@ -2696,7 +3090,7 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2696
3090
|
mutations.forEach((mutation) => {
|
|
2697
3091
|
if (mutation.type === "attributes") {
|
|
2698
3092
|
const newColorTheme = html.getAttribute("data-theme") === "dark" ? "dark" : "light";
|
|
2699
|
-
|
|
3093
|
+
import_react_better_core13.colorThemeControls.toggleTheme(newColorTheme);
|
|
2700
3094
|
localStorage.setItem("theme", newColorTheme);
|
|
2701
3095
|
}
|
|
2702
3096
|
});
|
|
@@ -2709,9 +3103,9 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2709
3103
|
observer.disconnect();
|
|
2710
3104
|
};
|
|
2711
3105
|
}, []);
|
|
2712
|
-
return /* @__PURE__ */ (0,
|
|
3106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_better_core13.BetterCoreProvider, { config: coreConfig, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BetterHtmlProviderInternal, { config: htmlConfig, ...props }) });
|
|
2713
3107
|
}
|
|
2714
|
-
var BetterHtmlProvider_default = (0,
|
|
3108
|
+
var BetterHtmlProvider_default = (0, import_react14.memo)(BetterHtmlProvider);
|
|
2715
3109
|
|
|
2716
3110
|
// src/utils/functions.ts
|
|
2717
3111
|
var import_crypto_js = __toESM(require("crypto-js"));
|
|
@@ -2898,297 +3292,12 @@ function generateLocalStorage() {
|
|
|
2898
3292
|
};
|
|
2899
3293
|
}
|
|
2900
3294
|
|
|
2901
|
-
// src/components/Modal.tsx
|
|
2902
|
-
var import_react14 = require("react");
|
|
2903
|
-
var import_react_dom = require("react-dom");
|
|
2904
|
-
var import_react_better_core13 = require("react-better-core");
|
|
2905
|
-
var import_styled_components9 = __toESM(require("styled-components"));
|
|
2906
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2907
|
-
var DialogStylesElement = import_styled_components9.default.dialog.withConfig({
|
|
2908
|
-
shouldForwardProp: (prop) => !["theme", "colorTheme", "opacity"].includes(prop)
|
|
2909
|
-
})`
|
|
2910
|
-
width: 100%;
|
|
2911
|
-
max-width: none;
|
|
2912
|
-
height: 100%;
|
|
2913
|
-
max-height: none;
|
|
2914
|
-
color: ${(props) => props.theme.colors.textPrimary};
|
|
2915
|
-
border: none;
|
|
2916
|
-
outline: none;
|
|
2917
|
-
background-color: transparent;
|
|
2918
|
-
margin: auto auto;
|
|
2919
|
-
padding-inline: ${(props) => props.theme.styles.gap}px;
|
|
2920
|
-
opacity: ${(props) => props.opacity};
|
|
2921
|
-
transition: ${(props) => props.theme.styles.transition};
|
|
2922
|
-
|
|
2923
|
-
&::backdrop {
|
|
2924
|
-
background-color: ${(props) => props.colorTheme === "light" ? "#000000a0" : "#222222e0"};
|
|
2925
|
-
opacity: ${(props) => props.opacity};
|
|
2926
|
-
transition: ${(props) => props.theme.styles.transition};
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
|
-
@keyframes fadeInAnimation {
|
|
2930
|
-
from {
|
|
2931
|
-
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2932
|
-
}
|
|
2933
|
-
to {
|
|
2934
|
-
transform: translateY(0px);
|
|
2935
|
-
}
|
|
2936
|
-
}
|
|
2937
|
-
|
|
2938
|
-
@keyframes fadeOutAnimation {
|
|
2939
|
-
from {
|
|
2940
|
-
transform: translateY(0px);
|
|
2941
|
-
}
|
|
2942
|
-
to {
|
|
2943
|
-
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2944
|
-
}
|
|
2945
|
-
}
|
|
2946
|
-
`;
|
|
2947
|
-
var ModalComponent = (0, import_react14.forwardRef)(function Modal({
|
|
2948
|
-
maxWidth,
|
|
2949
|
-
title,
|
|
2950
|
-
titleColor,
|
|
2951
|
-
description,
|
|
2952
|
-
descriptionColor,
|
|
2953
|
-
headerBackgroundColor,
|
|
2954
|
-
backgroundColor,
|
|
2955
|
-
name,
|
|
2956
|
-
overflow,
|
|
2957
|
-
withoutCloseButton,
|
|
2958
|
-
onOpen,
|
|
2959
|
-
onClose,
|
|
2960
|
-
children
|
|
2961
|
-
}, ref) {
|
|
2962
|
-
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
2963
|
-
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
2964
|
-
const theme = (0, import_react_better_core13.useTheme)();
|
|
2965
|
-
const { app } = useBetterHtmlContextInternal();
|
|
2966
|
-
const { colorTheme } = (0, import_react_better_core13.useBetterCoreContext)();
|
|
2967
|
-
const dialogRef = (0, import_react14.useRef)(null);
|
|
2968
|
-
const [isOpened, setIsOpened] = (0, import_react14.useState)(false);
|
|
2969
|
-
const [isOpenedLate, setIsOpenedLate] = (0, import_react14.useState)(false);
|
|
2970
|
-
const onClickOpen = (0, import_react14.useCallback)(() => {
|
|
2971
|
-
dialogRef.current?.showModal();
|
|
2972
|
-
setIsOpened(true);
|
|
2973
|
-
setIsOpenedLate(true);
|
|
2974
|
-
if (urlQuery && name) {
|
|
2975
|
-
urlQuery.setQuery(
|
|
2976
|
-
{
|
|
2977
|
-
[`${name}-modal`]: "opened"
|
|
2978
|
-
},
|
|
2979
|
-
false
|
|
2980
|
-
);
|
|
2981
|
-
}
|
|
2982
|
-
onOpen?.();
|
|
2983
|
-
}, [onOpen, urlQuery, name]);
|
|
2984
|
-
const onClickClose = (0, import_react14.useCallback)(() => {
|
|
2985
|
-
setIsOpened(false);
|
|
2986
|
-
onClose?.();
|
|
2987
|
-
if (urlQuery && name) urlQuery.removeQuery(`${name}-modal`, false);
|
|
2988
|
-
setTimeout(() => {
|
|
2989
|
-
dialogRef.current?.close();
|
|
2990
|
-
setIsOpenedLate(false);
|
|
2991
|
-
}, 0.2 * 1e3);
|
|
2992
|
-
}, [onClose, urlQuery, name]);
|
|
2993
|
-
const onKeyDown = (0, import_react14.useCallback)(
|
|
2994
|
-
(event) => {
|
|
2995
|
-
if (event.key === "Escape") {
|
|
2996
|
-
if (!withoutCloseButton) return;
|
|
2997
|
-
event.preventDefault();
|
|
2998
|
-
}
|
|
2999
|
-
},
|
|
3000
|
-
[withoutCloseButton]
|
|
3001
|
-
);
|
|
3002
|
-
(0, import_react14.useImperativeHandle)(
|
|
3003
|
-
ref,
|
|
3004
|
-
() => {
|
|
3005
|
-
return {
|
|
3006
|
-
open: onClickOpen,
|
|
3007
|
-
close: onClickClose,
|
|
3008
|
-
isOpened
|
|
3009
|
-
};
|
|
3010
|
-
},
|
|
3011
|
-
[onClickOpen, onClickClose, isOpened]
|
|
3012
|
-
);
|
|
3013
|
-
return (0, import_react_dom.createPortal)(
|
|
3014
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3015
|
-
DialogStylesElement,
|
|
3016
|
-
{
|
|
3017
|
-
theme,
|
|
3018
|
-
colorTheme,
|
|
3019
|
-
opacity: !isOpened ? 0 : 1,
|
|
3020
|
-
onClose: onClickClose,
|
|
3021
|
-
onKeyDown,
|
|
3022
|
-
ref: dialogRef,
|
|
3023
|
-
children: isOpenedLate ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3024
|
-
Div_default.column,
|
|
3025
|
-
{
|
|
3026
|
-
position: "relative",
|
|
3027
|
-
width: "100%",
|
|
3028
|
-
maxWidth: maxWidth ?? app.contentMaxWidth / 1.3,
|
|
3029
|
-
minHeight: `calc(100% - ${theme.styles.space * 2}px)`,
|
|
3030
|
-
alignItems: "center",
|
|
3031
|
-
justifyContent: "center",
|
|
3032
|
-
marginBlock: theme.styles.space,
|
|
3033
|
-
marginInline: "auto",
|
|
3034
|
-
transform: `translateY(${theme.styles.space}px)`,
|
|
3035
|
-
transition: theme.styles.transition,
|
|
3036
|
-
animation: isOpened ? "fadeInAnimation 0.2s ease forwards" : "fadeOutAnimation 0.2s ease forwards",
|
|
3037
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3038
|
-
Div_default,
|
|
3039
|
-
{
|
|
3040
|
-
position: "relative",
|
|
3041
|
-
width: "100%",
|
|
3042
|
-
minHeight: 32 + theme.styles.space * 2,
|
|
3043
|
-
backgroundColor: backgroundColor ?? theme.colors.backgroundBase,
|
|
3044
|
-
borderRadius: theme.styles.borderRadius * 2,
|
|
3045
|
-
padding: !title ? theme.styles.space : void 0,
|
|
3046
|
-
overflow,
|
|
3047
|
-
children: [
|
|
3048
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
3049
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3050
|
-
Div_default.row,
|
|
3051
|
-
{
|
|
3052
|
-
alignItems: "center",
|
|
3053
|
-
gap: theme.styles.gap,
|
|
3054
|
-
backgroundColor: headerBackgroundColor,
|
|
3055
|
-
borderTopLeftRadius: theme.styles.borderRadius * 2 - 1,
|
|
3056
|
-
borderTopRightRadius: theme.styles.borderRadius * 2 - 1,
|
|
3057
|
-
paddingInline: theme.styles.space,
|
|
3058
|
-
paddingBlock: theme.styles.space,
|
|
3059
|
-
transition: theme.styles.transition,
|
|
3060
|
-
children: [
|
|
3061
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Div_default.column, { flex: 1, gap: theme.styles.gap / 2, children: [
|
|
3062
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3063
|
-
Text_default,
|
|
3064
|
-
{
|
|
3065
|
-
as: "h1",
|
|
3066
|
-
color: titleColor ?? theme.colors.textPrimary,
|
|
3067
|
-
transition: theme.styles.transition,
|
|
3068
|
-
children: title
|
|
3069
|
-
}
|
|
3070
|
-
),
|
|
3071
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3072
|
-
Text_default,
|
|
3073
|
-
{
|
|
3074
|
-
color: descriptionColor ?? theme.colors.textSecondary,
|
|
3075
|
-
transition: theme.styles.transition,
|
|
3076
|
-
children: description
|
|
3077
|
-
}
|
|
3078
|
-
)
|
|
3079
|
-
] }),
|
|
3080
|
-
!withoutCloseButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3081
|
-
Button_default.icon,
|
|
3082
|
-
{
|
|
3083
|
-
icon: "XMark",
|
|
3084
|
-
marginTop: 1,
|
|
3085
|
-
iconColor: titleColor,
|
|
3086
|
-
onClick: onClickClose,
|
|
3087
|
-
transition: theme.styles.transition,
|
|
3088
|
-
zIndex: 10
|
|
3089
|
-
}
|
|
3090
|
-
)
|
|
3091
|
-
]
|
|
3092
|
-
}
|
|
3093
|
-
),
|
|
3094
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Divider_default.horizontal, {})
|
|
3095
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: !withoutCloseButton && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Div_default, { position: "absolute", top: theme.styles.space, right: theme.styles.space, zIndex: 10, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button_default.icon, { icon: "XMark", iconColor: titleColor, onClick: onClickClose }) }) }),
|
|
3096
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Div_default, { padding: title ? theme.styles.space : void 0, children })
|
|
3097
|
-
]
|
|
3098
|
-
}
|
|
3099
|
-
)
|
|
3100
|
-
}
|
|
3101
|
-
) : void 0
|
|
3102
|
-
}
|
|
3103
|
-
),
|
|
3104
|
-
document.body
|
|
3105
|
-
);
|
|
3106
|
-
});
|
|
3107
|
-
ModalComponent.confirmation = (0, import_react14.forwardRef)(function Confirmation({ message, continueButtonText = "Continue", continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
3108
|
-
const theme = (0, import_react_better_core13.useTheme)();
|
|
3109
|
-
const modalRef = (0, import_react14.useRef)(null);
|
|
3110
|
-
const onCancelElement = (0, import_react14.useCallback)(() => {
|
|
3111
|
-
onCancel?.();
|
|
3112
|
-
modalRef.current?.close();
|
|
3113
|
-
}, [onCancel]);
|
|
3114
|
-
const onContinueElement = (0, import_react14.useCallback)(() => {
|
|
3115
|
-
onContinue?.();
|
|
3116
|
-
modalRef.current?.close();
|
|
3117
|
-
}, [onContinue]);
|
|
3118
|
-
(0, import_react14.useImperativeHandle)(ref, () => modalRef.current, []);
|
|
3119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
3120
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { color: theme.colors.textSecondary, children: message ?? "Do you really want to continue? This action may be irreversible." }),
|
|
3121
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3122
|
-
Div_default.row,
|
|
3123
|
-
{
|
|
3124
|
-
alignItems: "center",
|
|
3125
|
-
justifyContent: "flex-end",
|
|
3126
|
-
gap: theme.styles.gap,
|
|
3127
|
-
marginTop: theme.styles.space * 2,
|
|
3128
|
-
children: [
|
|
3129
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
3130
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button_default, { text: continueButtonText, loaderName: continueButtonLoaderName, onClick: onContinueElement })
|
|
3131
|
-
]
|
|
3132
|
-
}
|
|
3133
|
-
)
|
|
3134
|
-
] });
|
|
3135
|
-
});
|
|
3136
|
-
ModalComponent.destructive = (0, import_react14.forwardRef)(function Destructive2({
|
|
3137
|
-
message,
|
|
3138
|
-
deleteButtonText = "Delete",
|
|
3139
|
-
deleteButtonIconName = "trash",
|
|
3140
|
-
deleteButtonLoaderName,
|
|
3141
|
-
onDelete,
|
|
3142
|
-
onCancel,
|
|
3143
|
-
...props
|
|
3144
|
-
}, ref) {
|
|
3145
|
-
const theme = (0, import_react_better_core13.useTheme)();
|
|
3146
|
-
const modalRef = (0, import_react14.useRef)(null);
|
|
3147
|
-
const onCancelElement = (0, import_react14.useCallback)(() => {
|
|
3148
|
-
onCancel?.();
|
|
3149
|
-
modalRef.current?.close();
|
|
3150
|
-
}, [onCancel]);
|
|
3151
|
-
const onDeleteElement = (0, import_react14.useCallback)(() => {
|
|
3152
|
-
onDelete?.();
|
|
3153
|
-
modalRef.current?.close();
|
|
3154
|
-
}, [onDelete]);
|
|
3155
|
-
(0, import_react14.useImperativeHandle)(ref, () => modalRef.current, []);
|
|
3156
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
3157
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text_default, { color: theme.colors.textSecondary, children: message ?? "Do you really want to continue with the deleting of the item? This action may be irreversible." }),
|
|
3158
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3159
|
-
Div_default.row,
|
|
3160
|
-
{
|
|
3161
|
-
alignItems: "center",
|
|
3162
|
-
justifyContent: "flex-end",
|
|
3163
|
-
gap: theme.styles.gap,
|
|
3164
|
-
marginTop: theme.styles.space * 2,
|
|
3165
|
-
children: [
|
|
3166
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
3167
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3168
|
-
Button_default.destructive,
|
|
3169
|
-
{
|
|
3170
|
-
icon: deleteButtonIconName,
|
|
3171
|
-
text: deleteButtonText,
|
|
3172
|
-
loaderName: deleteButtonLoaderName,
|
|
3173
|
-
onClick: onDeleteElement
|
|
3174
|
-
}
|
|
3175
|
-
)
|
|
3176
|
-
]
|
|
3177
|
-
}
|
|
3178
|
-
)
|
|
3179
|
-
] });
|
|
3180
|
-
});
|
|
3181
|
-
var Modal2 = (0, import_react14.memo)(ModalComponent);
|
|
3182
|
-
Modal2.confirmation = ModalComponent.confirmation;
|
|
3183
|
-
Modal2.destructive = ModalComponent.destructive;
|
|
3184
|
-
var Modal_default = Modal2;
|
|
3185
|
-
|
|
3186
3295
|
// src/components/PageHolder.tsx
|
|
3187
3296
|
var import_react15 = require("react");
|
|
3188
3297
|
var import_react_better_core14 = require("react-better-core");
|
|
3189
3298
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3190
3299
|
var PageHolderComponent = (0, import_react15.forwardRef)(function PageHolder({ noMaxContentWidth, children, ...props }, ref) {
|
|
3191
|
-
const
|
|
3300
|
+
const theme2 = (0, import_react_better_core14.useTheme)();
|
|
3192
3301
|
const { app } = useBetterHtmlContextInternal();
|
|
3193
3302
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3194
3303
|
Div_default,
|
|
@@ -3197,7 +3306,7 @@ var PageHolderComponent = (0, import_react15.forwardRef)(function PageHolder({ n
|
|
|
3197
3306
|
width: "100%",
|
|
3198
3307
|
maxWidth: !noMaxContentWidth ? app.contentMaxWidth : void 0,
|
|
3199
3308
|
margin: "0px auto",
|
|
3200
|
-
padding:
|
|
3309
|
+
padding: theme2.styles.space,
|
|
3201
3310
|
...props,
|
|
3202
3311
|
ref,
|
|
3203
3312
|
children
|
|
@@ -3216,7 +3325,7 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3216
3325
|
children,
|
|
3217
3326
|
...props
|
|
3218
3327
|
}, ref) {
|
|
3219
|
-
const
|
|
3328
|
+
const theme2 = (0, import_react_better_core14.useTheme)();
|
|
3220
3329
|
const mediaQuery = useMediaQuery();
|
|
3221
3330
|
const { app } = useBetterHtmlContextInternal();
|
|
3222
3331
|
const breakingPoint = mediaQuery.size1000;
|
|
@@ -3250,10 +3359,10 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3250
3359
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3251
3360
|
ContentTag,
|
|
3252
3361
|
{
|
|
3253
|
-
width: `calc(100% - ${
|
|
3362
|
+
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3254
3363
|
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3255
|
-
marginInline:
|
|
3256
|
-
marginBlock:
|
|
3364
|
+
marginInline: theme2.styles.space,
|
|
3365
|
+
marginBlock: theme2.styles.space,
|
|
3257
3366
|
...props,
|
|
3258
3367
|
ref,
|
|
3259
3368
|
children
|
|
@@ -3296,7 +3405,7 @@ var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
|
3296
3405
|
onClickWithValue,
|
|
3297
3406
|
...props
|
|
3298
3407
|
}, ref) {
|
|
3299
|
-
const
|
|
3408
|
+
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
3300
3409
|
const onClickElement = (0, import_react16.useCallback)(
|
|
3301
3410
|
(event) => {
|
|
3302
3411
|
onClick?.(event);
|
|
@@ -3308,23 +3417,23 @@ var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
|
3308
3417
|
Div_default,
|
|
3309
3418
|
{
|
|
3310
3419
|
width: "fit-content",
|
|
3311
|
-
backgroundColor: backgroundColor ??
|
|
3312
|
-
borderRadius: isCircle ? 999 : borderRadius ??
|
|
3313
|
-
paddingBlock:
|
|
3314
|
-
paddingInline:
|
|
3420
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
3421
|
+
borderRadius: isCircle ? 999 : borderRadius ?? theme2.styles.borderRadius / borderRadiusOffset,
|
|
3422
|
+
paddingBlock: theme2.styles.gap / 2,
|
|
3423
|
+
paddingInline: theme2.styles.space / 1.5,
|
|
3315
3424
|
filterHover: onClick || onClickWithValue ? filterHover().z1 : void 0,
|
|
3316
3425
|
onClick: onClickElement,
|
|
3317
3426
|
cursor: onClick || onClickWithValue ? "pointer" : void 0,
|
|
3318
3427
|
...props,
|
|
3319
3428
|
ref,
|
|
3320
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { color: color ??
|
|
3429
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { color: color ?? theme2.colors.textPrimary, children: text })
|
|
3321
3430
|
}
|
|
3322
3431
|
);
|
|
3323
3432
|
});
|
|
3324
3433
|
ChipComponent.colored = (0, import_react16.forwardRef)(function Colored({ color, withWhiteBackground, ...props }, ref) {
|
|
3325
|
-
const
|
|
3434
|
+
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
3326
3435
|
const { colorTheme } = (0, import_react_better_core15.useBetterCoreContext)();
|
|
3327
|
-
const readyColor = color ??
|
|
3436
|
+
const readyColor = color ?? theme2.colors.textSecondary;
|
|
3328
3437
|
const chip = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3329
3438
|
ChipComponent,
|
|
3330
3439
|
{
|
|
@@ -3340,7 +3449,7 @@ ChipComponent.colored = (0, import_react16.forwardRef)(function Colored({ color,
|
|
|
3340
3449
|
{
|
|
3341
3450
|
width: "fit-content",
|
|
3342
3451
|
backgroundColor: withWhiteBackground ? colorTheme === "light" ? "#ffffff" : "#000000" : void 0,
|
|
3343
|
-
borderRadius: withWhiteBackground ? props.borderRadius ??
|
|
3452
|
+
borderRadius: withWhiteBackground ? props.borderRadius ?? theme2.styles.borderRadius / borderRadiusOffset + 0.3 : void 0,
|
|
3344
3453
|
children: chip
|
|
3345
3454
|
}
|
|
3346
3455
|
) : chip;
|
|
@@ -3359,7 +3468,7 @@ var import_react17 = require("react");
|
|
|
3359
3468
|
var import_react_better_core16 = require("react-better-core");
|
|
3360
3469
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3361
3470
|
function Label({ text, required, isError, color, htmlFor }) {
|
|
3362
|
-
const
|
|
3471
|
+
const theme2 = (0, import_react_better_core16.useTheme)();
|
|
3363
3472
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3364
3473
|
Text_default,
|
|
3365
3474
|
{
|
|
@@ -3367,12 +3476,12 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
3367
3476
|
width: "fit-content",
|
|
3368
3477
|
height: 16,
|
|
3369
3478
|
fontSize: 14,
|
|
3370
|
-
color: isError ?
|
|
3479
|
+
color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
|
|
3371
3480
|
htmlFor,
|
|
3372
3481
|
"aria-required": required,
|
|
3373
3482
|
children: [
|
|
3374
3483
|
text,
|
|
3375
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
3484
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
3376
3485
|
" ",
|
|
3377
3486
|
"*"
|
|
3378
3487
|
] })
|
|
@@ -3416,7 +3525,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3416
3525
|
id,
|
|
3417
3526
|
...props
|
|
3418
3527
|
}, ref) {
|
|
3419
|
-
const
|
|
3528
|
+
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3420
3529
|
const inputFieldHolderRef = (0, import_react18.useRef)(null);
|
|
3421
3530
|
const buttonsRef = (0, import_react18.useRef)(null);
|
|
3422
3531
|
const inputRef = (0, import_react18.useRef)(null);
|
|
@@ -3546,12 +3655,12 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3546
3655
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3547
3656
|
Div_default,
|
|
3548
3657
|
{
|
|
3549
|
-
color: isDisabled ?
|
|
3550
|
-
backgroundColor: isSelected ?
|
|
3658
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
3659
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
3551
3660
|
filter: isFocused2 ? isDisabled ? "brightness(0.95)" : "brightness(0.9)" : void 0,
|
|
3552
3661
|
filterHover: focusedOptionIndex === void 0 && !isDisabled ? "brightness(0.9)" : void 0,
|
|
3553
3662
|
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
3554
|
-
padding: `${
|
|
3663
|
+
padding: `${theme2.styles.gap}px ${theme2.styles.space}px`,
|
|
3555
3664
|
value: option,
|
|
3556
3665
|
onClickWithValue: onClickOption,
|
|
3557
3666
|
onMouseMove: () => setFocusedOptionIndex(void 0),
|
|
@@ -3575,7 +3684,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3575
3684
|
filteredOptions,
|
|
3576
3685
|
value,
|
|
3577
3686
|
focusedOptionIndex,
|
|
3578
|
-
|
|
3687
|
+
theme2.colors,
|
|
3579
3688
|
onClickOption,
|
|
3580
3689
|
renderOption,
|
|
3581
3690
|
renderOptionDivider
|
|
@@ -3647,16 +3756,16 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3647
3756
|
Div_default,
|
|
3648
3757
|
{
|
|
3649
3758
|
width: "100%",
|
|
3650
|
-
backgroundColor:
|
|
3651
|
-
border: `solid 1px ${
|
|
3652
|
-
borderColor: isFocused ?
|
|
3759
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
3760
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
3761
|
+
borderColor: isFocused ? theme2.colors.primary : void 0,
|
|
3653
3762
|
borderBottom: "none",
|
|
3654
|
-
borderTopLeftRadius:
|
|
3655
|
-
borderTopRightRadius:
|
|
3656
|
-
paddingBlock:
|
|
3657
|
-
paddingInline: (
|
|
3658
|
-
transition:
|
|
3659
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default.row, { width: "100%", flexWrap: "wrap", gap:
|
|
3763
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
3764
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
3765
|
+
paddingBlock: theme2.styles.gap,
|
|
3766
|
+
paddingInline: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
3767
|
+
transition: theme2.styles.transition,
|
|
3768
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default.row, { width: "100%", flexWrap: "wrap", gap: theme2.styles.gap, children: selectedOption.map((option) => {
|
|
3660
3769
|
const ChipComponentTag = !option.renderType || option.renderType === "default" || option.renderType === "chip" ? Chip_default : option.renderType === "chip.colored" ? Chip_default.colored : Chip_default;
|
|
3661
3770
|
return /* @__PURE__ */ (0, import_react19.createElement)(
|
|
3662
3771
|
ChipComponentTag,
|
|
@@ -3679,21 +3788,21 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3679
3788
|
left: 0,
|
|
3680
3789
|
width: "100%",
|
|
3681
3790
|
maxHeight: 300,
|
|
3682
|
-
backgroundColor:
|
|
3683
|
-
border: `1px solid ${isFocused ?
|
|
3791
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
3792
|
+
border: `1px solid ${isFocused ? theme2.colors.primary : theme2.colors.border}`,
|
|
3684
3793
|
borderTop: "none",
|
|
3685
|
-
borderBottomLeftRadius:
|
|
3686
|
-
borderBottomRightRadius:
|
|
3794
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
3795
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
3687
3796
|
boxShadow: "0px 10px 20px #00000020",
|
|
3688
3797
|
zIndex: 1e3,
|
|
3689
3798
|
overflowY: "auto",
|
|
3690
3799
|
opacity: !isOpen ? 0 : void 0,
|
|
3691
3800
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
3692
3801
|
transform: `translateY(${!isOpen ? -10 : 0}px)`,
|
|
3693
|
-
transition:
|
|
3802
|
+
transition: theme2.styles.transition,
|
|
3694
3803
|
role: "listbox",
|
|
3695
3804
|
"aria-label": label,
|
|
3696
|
-
children: isLoadingDebouncedSearchQuery || debounceIsLoading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default, { padding: `${
|
|
3805
|
+
children: isLoadingDebouncedSearchQuery || debounceIsLoading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default, { padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Loader_default.text, {}) }) : filteredOptions.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: (withoutRenderingOptionsWhenClosed ? isOpen || isOpenLate : true) ? renderedOptions : void 0 }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default, { padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default.unknown, { textAlign: "left", children: debounceMinimumSymbolsRequired !== void 0 && searchQuery.length < debounceMinimumSymbolsRequired ? `Enter at least ${debounceMinimumSymbolsRequired} characters` : "No options" }) })
|
|
3697
3806
|
}
|
|
3698
3807
|
),
|
|
3699
3808
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
@@ -3701,9 +3810,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3701
3810
|
{
|
|
3702
3811
|
position: "absolute",
|
|
3703
3812
|
top: 46 / 2,
|
|
3704
|
-
right:
|
|
3813
|
+
right: theme2.styles.space + 1,
|
|
3705
3814
|
alignItems: "center",
|
|
3706
|
-
gap:
|
|
3815
|
+
gap: theme2.styles.gap,
|
|
3707
3816
|
transform: "translateY(-50%)",
|
|
3708
3817
|
pointerEvents: "none",
|
|
3709
3818
|
filter: disabled ? "brightness(0.9)" : void 0,
|
|
@@ -3730,9 +3839,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3730
3839
|
name: "chevronDown",
|
|
3731
3840
|
position: "relative",
|
|
3732
3841
|
size: 16,
|
|
3733
|
-
color:
|
|
3842
|
+
color: theme2.colors.textSecondary,
|
|
3734
3843
|
transform: `rotate(${isOpen ? 180 : 0}deg)`,
|
|
3735
|
-
transition:
|
|
3844
|
+
transition: theme2.styles.transition,
|
|
3736
3845
|
pointerEvents: "none",
|
|
3737
3846
|
"aria-hidden": true
|
|
3738
3847
|
}
|
|
@@ -3753,9 +3862,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3753
3862
|
) });
|
|
3754
3863
|
});
|
|
3755
3864
|
DropdownComponent.countries = (0, import_react18.forwardRef)(function Countries({ ...props }, ref) {
|
|
3756
|
-
const
|
|
3865
|
+
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3757
3866
|
const renderOption = (0, import_react18.useCallback)(
|
|
3758
|
-
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
3867
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
3759
3868
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
3760
3869
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { children: option.label })
|
|
3761
3870
|
] }),
|
|
@@ -3842,7 +3951,7 @@ var SelectComponent = import_styled_components10.default.select.withConfig({
|
|
|
3842
3951
|
opacity: 0;
|
|
3843
3952
|
`;
|
|
3844
3953
|
function Calendar({ value, minDate, maxDate, onChange }) {
|
|
3845
|
-
const
|
|
3954
|
+
const theme2 = (0, import_react_better_core18.useTheme)();
|
|
3846
3955
|
const internalYearSelectId = (0, import_react20.useId)();
|
|
3847
3956
|
const [currentDate, setCurrentDate] = (0, import_react20.useState)(value ? new Date(value) : void 0);
|
|
3848
3957
|
const [currentMonth, setCurrentMonth] = (0, import_react20.useState)(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
@@ -3906,7 +4015,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3906
4015
|
setCurrentMonth(date.getMonth());
|
|
3907
4016
|
setCurrentYear(date.getFullYear());
|
|
3908
4017
|
}, [value]);
|
|
3909
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "100%", maxWidth: 320, gap:
|
|
4018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
|
|
3910
4019
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
3911
4020
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
|
|
3912
4021
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", gap: 4, children: [
|
|
@@ -3917,7 +4026,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3917
4026
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3918
4027
|
SelectComponent,
|
|
3919
4028
|
{
|
|
3920
|
-
theme,
|
|
4029
|
+
theme: theme2,
|
|
3921
4030
|
value: currentYear,
|
|
3922
4031
|
onChange: onChangeYearSelect,
|
|
3923
4032
|
id: internalYearSelectId,
|
|
@@ -3928,7 +4037,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3928
4037
|
] }),
|
|
3929
4038
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
|
|
3930
4039
|
] }),
|
|
3931
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap:
|
|
4040
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap: theme2.styles.gap / 2, children: [
|
|
3932
4041
|
weekDaysIndex.map((day) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Div_default.row, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", children: getWeekDayName(day, true) }) }, day)),
|
|
3933
4042
|
days.map((day, index) => {
|
|
3934
4043
|
const thisDayDate = new Date(currentYear, currentMonth, day);
|
|
@@ -3944,11 +4053,11 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3944
4053
|
aspectRatio: "1",
|
|
3945
4054
|
alignItems: "center",
|
|
3946
4055
|
justifyContent: "center",
|
|
3947
|
-
backgroundColor: isSelected ?
|
|
4056
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
3948
4057
|
filterHover: day && !isDisabled ? "brightness(0.9)" : void 0,
|
|
3949
|
-
border: `1px solid ${isToday ?
|
|
3950
|
-
borderRadius:
|
|
3951
|
-
padding:
|
|
4058
|
+
border: `1px solid ${isToday ? theme2.colors.primary : theme2.colors.primary + "00"}`,
|
|
4059
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4060
|
+
padding: theme2.styles.space / 2,
|
|
3952
4061
|
cursor: day ? !isDisabled ? "pointer" : "not-allowed" : void 0,
|
|
3953
4062
|
value: day,
|
|
3954
4063
|
onClickWithValue: !isDisabled ? onClickDay : void 0,
|
|
@@ -3958,7 +4067,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3958
4067
|
{
|
|
3959
4068
|
fontSize: 14,
|
|
3960
4069
|
textAlign: "center",
|
|
3961
|
-
color: isDisabled ?
|
|
4070
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : isWeekend ? theme2.colors.textSecondary : void 0,
|
|
3962
4071
|
children: day
|
|
3963
4072
|
}
|
|
3964
4073
|
),
|
|
@@ -3970,7 +4079,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3970
4079
|
height: 1,
|
|
3971
4080
|
top: "50%",
|
|
3972
4081
|
left: "50%",
|
|
3973
|
-
backgroundColor:
|
|
4082
|
+
backgroundColor: theme2.colors.textSecondary,
|
|
3974
4083
|
borderRadius: 999,
|
|
3975
4084
|
transform: "translate(-50%, -50%) rotate(45deg)"
|
|
3976
4085
|
}
|
|
@@ -3987,8 +4096,8 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3987
4096
|
{
|
|
3988
4097
|
fontSize: 14,
|
|
3989
4098
|
textDecorationHover: "underline",
|
|
3990
|
-
color:
|
|
3991
|
-
colorHover:
|
|
4099
|
+
color: theme2.colors.textSecondary,
|
|
4100
|
+
colorHover: theme2.colors.textPrimary,
|
|
3992
4101
|
children: "Clear"
|
|
3993
4102
|
}
|
|
3994
4103
|
) }),
|
|
@@ -3997,8 +4106,8 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3997
4106
|
{
|
|
3998
4107
|
fontSize: 14,
|
|
3999
4108
|
textDecorationHover: "underline",
|
|
4000
|
-
color:
|
|
4001
|
-
colorHover:
|
|
4109
|
+
color: theme2.colors.textSecondary,
|
|
4110
|
+
colorHover: theme2.colors.textPrimary,
|
|
4002
4111
|
children: "Today"
|
|
4003
4112
|
}
|
|
4004
4113
|
) })
|
|
@@ -4195,7 +4304,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4195
4304
|
id,
|
|
4196
4305
|
...props
|
|
4197
4306
|
}, ref) {
|
|
4198
|
-
const
|
|
4307
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4199
4308
|
const internalId = (0, import_react21.useId)();
|
|
4200
4309
|
const { colorTheme } = (0, import_react_better_core19.useBetterCoreContext)();
|
|
4201
4310
|
const [_, debouncedValue, setDebouncedValue] = (0, import_react_better_core19.useDebounceState)(
|
|
@@ -4229,7 +4338,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4229
4338
|
onChangeValue?.(debouncedValue);
|
|
4230
4339
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
4231
4340
|
const readyId = id ?? internalId;
|
|
4232
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap:
|
|
4341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...excludeStyle, children: [
|
|
4233
4342
|
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
4234
4343
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "stretch", width: "100%", children: [
|
|
4235
4344
|
prefix && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
@@ -4237,12 +4346,12 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4237
4346
|
{
|
|
4238
4347
|
alignItems: "center",
|
|
4239
4348
|
justifyContent: "center",
|
|
4240
|
-
border: `1px solid ${
|
|
4349
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
4241
4350
|
borderRight: "none",
|
|
4242
|
-
backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? (0, import_react_better_core19.darkenColor)(
|
|
4243
|
-
borderTopLeftRadius:
|
|
4244
|
-
borderBottomLeftRadius:
|
|
4245
|
-
paddingInline:
|
|
4351
|
+
backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? (0, import_react_better_core19.darkenColor)(theme2.colors.backgroundContent, 0.03) : (0, import_react_better_core19.lightenColor)(theme2.colors.backgroundContent, 0.1)),
|
|
4352
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
4353
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4354
|
+
paddingInline: theme2.styles.space,
|
|
4246
4355
|
children: prefix
|
|
4247
4356
|
}
|
|
4248
4357
|
),
|
|
@@ -4255,7 +4364,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4255
4364
|
name: leftIcon,
|
|
4256
4365
|
position: "absolute",
|
|
4257
4366
|
top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
|
|
4258
|
-
left:
|
|
4367
|
+
left: theme2.styles.space + 1,
|
|
4259
4368
|
transform: "translateY(-50%)",
|
|
4260
4369
|
pointerEvents: "none",
|
|
4261
4370
|
zIndex: leftIconZIndex
|
|
@@ -4264,7 +4373,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4264
4373
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4265
4374
|
InputElement,
|
|
4266
4375
|
{
|
|
4267
|
-
theme,
|
|
4376
|
+
theme: theme2,
|
|
4268
4377
|
withLeftIcon: leftIcon !== void 0,
|
|
4269
4378
|
withRightIcon: rightIcon !== void 0,
|
|
4270
4379
|
withPrefix: prefix !== void 0,
|
|
@@ -4287,7 +4396,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4287
4396
|
icon: rightIcon,
|
|
4288
4397
|
position: "absolute",
|
|
4289
4398
|
top: 46 / 2,
|
|
4290
|
-
right:
|
|
4399
|
+
right: theme2.styles.space + 1 - theme2.styles.space / 2,
|
|
4291
4400
|
transform: "translateY(-50%)",
|
|
4292
4401
|
onClick: onClickRightIcon
|
|
4293
4402
|
}
|
|
@@ -4297,7 +4406,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4297
4406
|
name: rightIcon,
|
|
4298
4407
|
position: "absolute",
|
|
4299
4408
|
top: 46 / 2,
|
|
4300
|
-
right:
|
|
4409
|
+
right: theme2.styles.space + 1,
|
|
4301
4410
|
transform: "translateY(-50%)",
|
|
4302
4411
|
pointerEvents: "none"
|
|
4303
4412
|
}
|
|
@@ -4310,12 +4419,12 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4310
4419
|
{
|
|
4311
4420
|
alignItems: "center",
|
|
4312
4421
|
justifyContent: "center",
|
|
4313
|
-
border: `1px solid ${
|
|
4422
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
4314
4423
|
borderLeft: "none",
|
|
4315
|
-
backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? (0, import_react_better_core19.darkenColor)(
|
|
4316
|
-
borderTopRightRadius:
|
|
4317
|
-
borderBottomRightRadius:
|
|
4318
|
-
paddingInline:
|
|
4424
|
+
backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? (0, import_react_better_core19.darkenColor)(theme2.colors.backgroundContent, 0.03) : (0, import_react_better_core19.lightenColor)(theme2.colors.backgroundContent, 0.1)),
|
|
4425
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
4426
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4427
|
+
paddingInline: theme2.styles.space,
|
|
4319
4428
|
children: suffix
|
|
4320
4429
|
}
|
|
4321
4430
|
)
|
|
@@ -4326,7 +4435,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4326
4435
|
as: "span",
|
|
4327
4436
|
display: "block",
|
|
4328
4437
|
fontSize: 14,
|
|
4329
|
-
color: errorText ?
|
|
4438
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4330
4439
|
children: errorText || infoText
|
|
4331
4440
|
}
|
|
4332
4441
|
)
|
|
@@ -4346,7 +4455,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4346
4455
|
id,
|
|
4347
4456
|
...props
|
|
4348
4457
|
}, ref) {
|
|
4349
|
-
const
|
|
4458
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4350
4459
|
const internalId = (0, import_react21.useId)();
|
|
4351
4460
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
4352
4461
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -4359,7 +4468,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4359
4468
|
[onChange, onChangeValue]
|
|
4360
4469
|
);
|
|
4361
4470
|
const readyId = id ?? internalId;
|
|
4362
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap:
|
|
4471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
4363
4472
|
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label_default, { text: label, required, isError: !!errorText, htmlFor: readyId }),
|
|
4364
4473
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
4365
4474
|
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
@@ -4368,7 +4477,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4368
4477
|
name: leftIcon,
|
|
4369
4478
|
position: "absolute",
|
|
4370
4479
|
top: 46 / 2,
|
|
4371
|
-
left:
|
|
4480
|
+
left: theme2.styles.space + 1,
|
|
4372
4481
|
transform: "translateY(-50%)",
|
|
4373
4482
|
pointerEvents: "none"
|
|
4374
4483
|
}
|
|
@@ -4376,7 +4485,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4376
4485
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4377
4486
|
TextareaElement,
|
|
4378
4487
|
{
|
|
4379
|
-
theme,
|
|
4488
|
+
theme: theme2,
|
|
4380
4489
|
withLeftIcon: leftIcon !== void 0,
|
|
4381
4490
|
withRightIcon: rightIcon !== void 0,
|
|
4382
4491
|
required,
|
|
@@ -4397,7 +4506,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4397
4506
|
icon: rightIcon,
|
|
4398
4507
|
position: "absolute",
|
|
4399
4508
|
top: 46 / 2,
|
|
4400
|
-
right:
|
|
4509
|
+
right: theme2.styles.space + 1 - theme2.styles.space / 2,
|
|
4401
4510
|
transform: "translateY(-50%)",
|
|
4402
4511
|
onClick: onClickRightIcon
|
|
4403
4512
|
}
|
|
@@ -4407,7 +4516,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4407
4516
|
name: rightIcon,
|
|
4408
4517
|
position: "absolute",
|
|
4409
4518
|
top: 46 / 2,
|
|
4410
|
-
right:
|
|
4519
|
+
right: theme2.styles.space + 1,
|
|
4411
4520
|
transform: "translateY(-50%)",
|
|
4412
4521
|
pointerEvents: "none"
|
|
4413
4522
|
}
|
|
@@ -4418,8 +4527,8 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4418
4527
|
{
|
|
4419
4528
|
as: "span",
|
|
4420
4529
|
display: "block",
|
|
4421
|
-
marginTop:
|
|
4422
|
-
color: errorText ?
|
|
4530
|
+
marginTop: theme2.styles.gap / 2,
|
|
4531
|
+
color: errorText ? theme2.colors.error : props.labelColor ?? theme2.colors.textSecondary,
|
|
4423
4532
|
fontSize: 14,
|
|
4424
4533
|
children: errorText || infoText
|
|
4425
4534
|
}
|
|
@@ -4501,12 +4610,12 @@ InputFieldComponent.search = (0, import_react21.forwardRef)(function Search({ va
|
|
|
4501
4610
|
);
|
|
4502
4611
|
});
|
|
4503
4612
|
InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneNumber({ label, value, onChangeValue, labelColor, id, ...props }, ref) {
|
|
4504
|
-
const
|
|
4613
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4505
4614
|
const internalId = (0, import_react21.useId)();
|
|
4506
4615
|
const [dropdownValue, setDropdownValue] = (0, import_react21.useState)();
|
|
4507
4616
|
const [inputFieldValue, setInputFieldValue] = (0, import_react21.useState)(value?.toString() ?? "");
|
|
4508
4617
|
const renderOption = (0, import_react21.useCallback)(
|
|
4509
|
-
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
4618
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
4510
4619
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
4511
4620
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { children: option.label })
|
|
4512
4621
|
] }),
|
|
@@ -4558,7 +4667,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4558
4667
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
4559
4668
|
}, [value]);
|
|
4560
4669
|
const readyId = id ?? internalId;
|
|
4561
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap:
|
|
4670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
4562
4671
|
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4563
4672
|
Label_default,
|
|
4564
4673
|
{
|
|
@@ -4604,7 +4713,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4604
4713
|
] });
|
|
4605
4714
|
});
|
|
4606
4715
|
InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDate, maxDate, ...props }, ref) {
|
|
4607
|
-
const
|
|
4716
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4608
4717
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4609
4718
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4610
4719
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
@@ -4626,9 +4735,9 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
4626
4735
|
top: "100%",
|
|
4627
4736
|
left: 0,
|
|
4628
4737
|
width: "fit-content",
|
|
4629
|
-
backgroundColor:
|
|
4630
|
-
borderBottomLeftRadius:
|
|
4631
|
-
borderBottomRightRadius:
|
|
4738
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4739
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4740
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4632
4741
|
boxShadow: "0px 10px 20px #00000020",
|
|
4633
4742
|
userSelect: "none",
|
|
4634
4743
|
...insideInputFieldComponentProps,
|
|
@@ -4643,7 +4752,7 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
4643
4752
|
);
|
|
4644
4753
|
});
|
|
4645
4754
|
InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime({ minDate, maxDate, defaultDateAfterTimePick, defaultTimeAfterDatePick = "00:00", ...props }, ref) {
|
|
4646
|
-
const
|
|
4755
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4647
4756
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4648
4757
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4649
4758
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
@@ -4685,7 +4794,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4685
4794
|
}, [isOpen]);
|
|
4686
4795
|
const valueHour = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[0]).toString();
|
|
4687
4796
|
const valueMinute = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[1]).toString();
|
|
4688
|
-
const topSpacing = 32 +
|
|
4797
|
+
const topSpacing = 32 + theme2.styles.space / 2 + theme2.styles.gap;
|
|
4689
4798
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4690
4799
|
InputFieldComponent,
|
|
4691
4800
|
{
|
|
@@ -4697,32 +4806,32 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4697
4806
|
top: "100%",
|
|
4698
4807
|
left: 0,
|
|
4699
4808
|
width: "fit-content",
|
|
4700
|
-
backgroundColor:
|
|
4701
|
-
borderBottomLeftRadius:
|
|
4702
|
-
borderBottomRightRadius:
|
|
4809
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4810
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4811
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4703
4812
|
boxShadow: "0px 10px 20px #00000020",
|
|
4704
4813
|
overflow: "hidden",
|
|
4705
4814
|
userSelect: "none",
|
|
4706
4815
|
...insideInputFieldComponentProps,
|
|
4707
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { gap:
|
|
4816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { gap: theme2.styles.space, children: [
|
|
4708
4817
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
4709
4818
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4710
4819
|
Div_default.row,
|
|
4711
4820
|
{
|
|
4712
4821
|
height: 276,
|
|
4713
|
-
gap:
|
|
4822
|
+
gap: theme2.styles.gap / 2,
|
|
4714
4823
|
paddingTop: topSpacing,
|
|
4715
|
-
paddingBottom:
|
|
4716
|
-
paddingRight:
|
|
4824
|
+
paddingBottom: theme2.styles.space / 2,
|
|
4825
|
+
paddingRight: theme2.styles.space / 2,
|
|
4717
4826
|
children: [
|
|
4718
4827
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { height: "100%", children: [
|
|
4719
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom:
|
|
4828
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
4720
4829
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4721
4830
|
Div_default,
|
|
4722
4831
|
{
|
|
4723
4832
|
className: "react-better-html-no-scrollbar",
|
|
4724
4833
|
width: buttonWidth,
|
|
4725
|
-
height: `calc(100% - ${16 +
|
|
4834
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4726
4835
|
overflowY: "auto",
|
|
4727
4836
|
tabIndex: -1,
|
|
4728
4837
|
children: hours.map((hour) => {
|
|
@@ -4732,12 +4841,12 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4732
4841
|
{
|
|
4733
4842
|
alignItems: "center",
|
|
4734
4843
|
justifyContent: "center",
|
|
4735
|
-
color: isSelected ?
|
|
4736
|
-
backgroundColor: isSelected ?
|
|
4737
|
-
borderRadius:
|
|
4844
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4845
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4846
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4738
4847
|
filterHover: "brightness(0.9)",
|
|
4739
4848
|
cursor: "pointer",
|
|
4740
|
-
padding: `${
|
|
4849
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4741
4850
|
value: hour,
|
|
4742
4851
|
onClickWithValue: onClickHour,
|
|
4743
4852
|
ref: isSelected ? selectedHourRef : void 0,
|
|
@@ -4750,13 +4859,13 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4750
4859
|
)
|
|
4751
4860
|
] }),
|
|
4752
4861
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { height: "100%", children: [
|
|
4753
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom:
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
4754
4863
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4755
4864
|
Div_default,
|
|
4756
4865
|
{
|
|
4757
4866
|
className: "react-better-html-no-scrollbar",
|
|
4758
4867
|
width: buttonWidth,
|
|
4759
|
-
height: `calc(100% - ${16 +
|
|
4868
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4760
4869
|
overflowY: "auto",
|
|
4761
4870
|
tabIndex: -1,
|
|
4762
4871
|
children: minutes.map((minute) => {
|
|
@@ -4766,12 +4875,12 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4766
4875
|
{
|
|
4767
4876
|
alignItems: "center",
|
|
4768
4877
|
justifyContent: "center",
|
|
4769
|
-
color: isSelected ?
|
|
4770
|
-
backgroundColor: isSelected ?
|
|
4771
|
-
borderRadius:
|
|
4878
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4879
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4880
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4772
4881
|
filterHover: "brightness(0.9)",
|
|
4773
4882
|
cursor: "pointer",
|
|
4774
|
-
padding: `${
|
|
4883
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4775
4884
|
value: minute,
|
|
4776
4885
|
onClickWithValue: onClickMinute,
|
|
4777
4886
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
@@ -4797,7 +4906,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4797
4906
|
);
|
|
4798
4907
|
});
|
|
4799
4908
|
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...props }, ref) {
|
|
4800
|
-
const
|
|
4909
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4801
4910
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4802
4911
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4803
4912
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
@@ -4839,9 +4948,9 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
4839
4948
|
left: 0,
|
|
4840
4949
|
width: buttonWidth * 2 + 2,
|
|
4841
4950
|
height: 300,
|
|
4842
|
-
backgroundColor:
|
|
4843
|
-
borderBottomLeftRadius:
|
|
4844
|
-
borderBottomRightRadius:
|
|
4951
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4952
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4953
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4845
4954
|
boxShadow: "0px 10px 20px #00000020",
|
|
4846
4955
|
overflowY: "auto",
|
|
4847
4956
|
userSelect: "none",
|
|
@@ -4862,11 +4971,11 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
4862
4971
|
{
|
|
4863
4972
|
alignItems: "center",
|
|
4864
4973
|
justifyContent: "center",
|
|
4865
|
-
color: isSelected ?
|
|
4866
|
-
backgroundColor: isSelected ?
|
|
4974
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4975
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4867
4976
|
filterHover: "brightness(0.9)",
|
|
4868
4977
|
cursor: "pointer",
|
|
4869
|
-
padding: `${
|
|
4978
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4870
4979
|
value: hour,
|
|
4871
4980
|
onClickWithValue: onClickHour,
|
|
4872
4981
|
ref: isSelected ? selectedHourRef : void 0,
|
|
@@ -4892,11 +5001,11 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
4892
5001
|
{
|
|
4893
5002
|
alignItems: "center",
|
|
4894
5003
|
justifyContent: "center",
|
|
4895
|
-
color: isSelected ?
|
|
4896
|
-
backgroundColor: isSelected ?
|
|
5004
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5005
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4897
5006
|
filterHover: "brightness(0.9)",
|
|
4898
5007
|
cursor: "pointer",
|
|
4899
|
-
padding: `${
|
|
5008
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4900
5009
|
value: minute,
|
|
4901
5010
|
onClickWithValue: onClickMinute,
|
|
4902
5011
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
@@ -5081,7 +5190,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5081
5190
|
id,
|
|
5082
5191
|
...props
|
|
5083
5192
|
}, ref) {
|
|
5084
|
-
const
|
|
5193
|
+
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5085
5194
|
const internalId = (0, import_react22.useId)();
|
|
5086
5195
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5087
5196
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -5102,14 +5211,14 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5102
5211
|
onChange?.(newIsChecked, value);
|
|
5103
5212
|
}, [checked, controlledChecked, onChange, value]);
|
|
5104
5213
|
const readyId = id ?? internalId;
|
|
5105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap:
|
|
5214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5106
5215
|
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
5107
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
5216
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5108
5217
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5109
5218
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5110
5219
|
InputElement2,
|
|
5111
5220
|
{
|
|
5112
|
-
theme,
|
|
5221
|
+
theme: theme2,
|
|
5113
5222
|
type: props.type ?? "checkbox",
|
|
5114
5223
|
checked,
|
|
5115
5224
|
onChange: onChangeElement,
|
|
@@ -5128,12 +5237,12 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5128
5237
|
position: "absolute",
|
|
5129
5238
|
top: "50%",
|
|
5130
5239
|
left: "50%",
|
|
5131
|
-
color:
|
|
5240
|
+
color: theme2.colors.base,
|
|
5132
5241
|
size: 14,
|
|
5133
5242
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
5134
5243
|
opacity: checked ? 1 : 0,
|
|
5135
5244
|
pointerEvents: "none",
|
|
5136
|
-
transition:
|
|
5245
|
+
transition: theme2.styles.transition
|
|
5137
5246
|
}
|
|
5138
5247
|
) : props.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5139
5248
|
Div_default,
|
|
@@ -5143,7 +5252,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5143
5252
|
height: 10,
|
|
5144
5253
|
top: "50%",
|
|
5145
5254
|
left: "50%",
|
|
5146
|
-
backgroundColor:
|
|
5255
|
+
backgroundColor: theme2.colors.base,
|
|
5147
5256
|
borderRadius: 999,
|
|
5148
5257
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
5149
5258
|
opacity: checked ? 1 : 0,
|
|
@@ -5153,13 +5262,13 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5153
5262
|
] }),
|
|
5154
5263
|
text ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5155
5264
|
text,
|
|
5156
|
-
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
5265
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5157
5266
|
" ",
|
|
5158
5267
|
"*"
|
|
5159
5268
|
] })
|
|
5160
5269
|
] }) : textAdvanced ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5161
5270
|
textAdvanced,
|
|
5162
|
-
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
5271
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
|
|
5163
5272
|
" ",
|
|
5164
5273
|
"*"
|
|
5165
5274
|
] })
|
|
@@ -5171,7 +5280,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5171
5280
|
as: "span",
|
|
5172
5281
|
display: "block",
|
|
5173
5282
|
fontSize: 14,
|
|
5174
|
-
color: errorText ?
|
|
5283
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
5175
5284
|
children: errorText || infoText
|
|
5176
5285
|
}
|
|
5177
5286
|
)
|
|
@@ -5197,7 +5306,7 @@ var ToggleInput_default = {
|
|
|
5197
5306
|
id,
|
|
5198
5307
|
...props
|
|
5199
5308
|
}, ref) {
|
|
5200
|
-
const
|
|
5309
|
+
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5201
5310
|
const internalId = (0, import_react22.useId)();
|
|
5202
5311
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5203
5312
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -5212,13 +5321,13 @@ var ToggleInput_default = {
|
|
|
5212
5321
|
onChange?.(newIsChecked, value);
|
|
5213
5322
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5214
5323
|
const readyId = id ?? internalId;
|
|
5215
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "fit-content", gap:
|
|
5324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5216
5325
|
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
5217
5326
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5218
5327
|
Div_default.row,
|
|
5219
5328
|
{
|
|
5220
5329
|
alignItems: "center",
|
|
5221
|
-
gap:
|
|
5330
|
+
gap: theme2.styles.gap,
|
|
5222
5331
|
borderRadius: 999,
|
|
5223
5332
|
isTabAccessed: true,
|
|
5224
5333
|
onClick: onClickElement,
|
|
@@ -5231,7 +5340,7 @@ var ToggleInput_default = {
|
|
|
5231
5340
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5232
5341
|
SwitchElement,
|
|
5233
5342
|
{
|
|
5234
|
-
theme,
|
|
5343
|
+
theme: theme2,
|
|
5235
5344
|
checked,
|
|
5236
5345
|
disabled: disabled ?? false,
|
|
5237
5346
|
isMouseDown,
|
|
@@ -5254,7 +5363,7 @@ var ToggleInput_default = {
|
|
|
5254
5363
|
as: "span",
|
|
5255
5364
|
display: "block",
|
|
5256
5365
|
fontSize: 14,
|
|
5257
|
-
color: errorText ?
|
|
5366
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
5258
5367
|
children: errorText || infoText
|
|
5259
5368
|
}
|
|
5260
5369
|
)
|
|
@@ -5289,7 +5398,7 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
5289
5398
|
children,
|
|
5290
5399
|
...props
|
|
5291
5400
|
}, ref) {
|
|
5292
|
-
const
|
|
5401
|
+
const theme2 = (0, import_react_better_core21.useTheme)();
|
|
5293
5402
|
const submitButtonIsDisabledInternal = (0, import_react23.useMemo)(() => {
|
|
5294
5403
|
if (!form || !form.requiredFields) return false;
|
|
5295
5404
|
return Object.entries(form.values).some(
|
|
@@ -5299,7 +5408,7 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
5299
5408
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
5300
5409
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
5301
5410
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("form", { name, onSubmit: onSubmit ?? form?.onSubmit, ref, children: [
|
|
5302
|
-
gap !== void 0 || withDividers ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Div_default.column, { gap: gap ?? (withDividers ?
|
|
5411
|
+
gap !== void 0 || withDividers ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? import_react23.Children.toArray(children).map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react23.Fragment, { children: [
|
|
5303
5412
|
child,
|
|
5304
5413
|
index < import_react23.Children.toArray(children).length - 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Divider_default.horizontal, {})
|
|
5305
5414
|
] }, index)) : children }) : children,
|
|
@@ -5308,8 +5417,8 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
5308
5417
|
{
|
|
5309
5418
|
alignItems: "center",
|
|
5310
5419
|
justifyContent: actionButtonsLocation === "left" ? "flex-start" : actionButtonsLocation === "center" ? "center" : "flex-end",
|
|
5311
|
-
gap:
|
|
5312
|
-
marginTop:
|
|
5420
|
+
gap: theme2.styles.gap,
|
|
5421
|
+
marginTop: theme2.styles.space,
|
|
5313
5422
|
children: [
|
|
5314
5423
|
renderActionButtons,
|
|
5315
5424
|
onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -5347,10 +5456,10 @@ var import_react24 = require("react");
|
|
|
5347
5456
|
var import_react_better_core22 = require("react-better-core");
|
|
5348
5457
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5349
5458
|
var FormRowComponent = (0, import_react24.forwardRef)(function FormRow({ oneItemOnly, noBreakingPoint, asColumn, gap, children, ...props }, ref) {
|
|
5350
|
-
const
|
|
5459
|
+
const theme2 = (0, import_react_better_core22.useTheme)();
|
|
5351
5460
|
const mediaQuery = useMediaQuery();
|
|
5352
5461
|
const breakingPoint = asColumn ?? (!noBreakingPoint ? mediaQuery.size900 : false);
|
|
5353
|
-
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ?
|
|
5462
|
+
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
5354
5463
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
5355
5464
|
children,
|
|
5356
5465
|
oneItemOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default, { width: "100%" })
|
|
@@ -5374,21 +5483,21 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
5374
5483
|
children,
|
|
5375
5484
|
...props
|
|
5376
5485
|
}, ref) {
|
|
5377
|
-
const
|
|
5486
|
+
const theme2 = (0, import_react_better_core22.useTheme)();
|
|
5378
5487
|
const mediaQuery = useMediaQuery();
|
|
5379
|
-
const titleGap =
|
|
5488
|
+
const titleGap = theme2.styles.space;
|
|
5380
5489
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(FormRowComponent, { ...props, ref, children: [
|
|
5381
5490
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: titleGap, children: [
|
|
5382
5491
|
icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon_default, { name: icon }),
|
|
5383
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { flex: 1, gap:
|
|
5492
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
5384
5493
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: titleAs, fontSize: titleFontSize, children: [
|
|
5385
5494
|
title,
|
|
5386
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
5495
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5387
5496
|
" ",
|
|
5388
5497
|
"*"
|
|
5389
5498
|
] })
|
|
5390
5499
|
] }),
|
|
5391
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { fontSize: descriptionFontSize, color:
|
|
5500
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { fontSize: descriptionFontSize, color: theme2.colors.textSecondary, children: description })
|
|
5392
5501
|
] }),
|
|
5393
5502
|
isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default, { width: 26 - titleGap })
|
|
5394
5503
|
] }),
|
|
@@ -5399,14 +5508,14 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
5399
5508
|
width: props.noBreakingPoint && mediaQuery.size900 ? void 0 : "100%",
|
|
5400
5509
|
alignItems: "center",
|
|
5401
5510
|
justifyContent: alignChildren,
|
|
5402
|
-
gap:
|
|
5511
|
+
gap: theme2.styles.gap,
|
|
5403
5512
|
children: [
|
|
5404
5513
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5405
5514
|
Div_default,
|
|
5406
5515
|
{
|
|
5407
5516
|
position: "absolute",
|
|
5408
5517
|
top: "50%",
|
|
5409
|
-
right: `calc(100% + ${
|
|
5518
|
+
right: `calc(100% + ${theme2.styles.space}px)`,
|
|
5410
5519
|
transform: "translateY(-50%)",
|
|
5411
5520
|
opacity: !isLoading ? 0 : void 0,
|
|
5412
5521
|
pointerEvents: !isLoading ? "none" : void 0,
|
|
@@ -5414,7 +5523,7 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
5414
5523
|
}
|
|
5415
5524
|
),
|
|
5416
5525
|
children,
|
|
5417
|
-
withActions && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
5526
|
+
withActions && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5418
5527
|
onClickReset && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
5419
5528
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
5420
5529
|
] })
|
|
@@ -5470,8 +5579,8 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5470
5579
|
);
|
|
5471
5580
|
};
|
|
5472
5581
|
ColorThemeSwitchComponent.withText = function WithText({ withMoon, className, ...props }) {
|
|
5473
|
-
const
|
|
5474
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.row, { width: "fit-content", alignItems: "center", gap:
|
|
5582
|
+
const theme2 = (0, import_react_better_core23.useTheme)();
|
|
5583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
5475
5584
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { children: "Light" }),
|
|
5476
5585
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ColorThemeSwitchComponent, { withMoon, className }),
|
|
5477
5586
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { children: "Dark" })
|
|
@@ -5500,7 +5609,7 @@ var PaginationComponent = function Pagination({
|
|
|
5500
5609
|
onClickNextPage,
|
|
5501
5610
|
onChangePage
|
|
5502
5611
|
}) {
|
|
5503
|
-
const
|
|
5612
|
+
const theme2 = (0, import_react_better_core24.useTheme)();
|
|
5504
5613
|
const mediaQuery = useMediaQuery();
|
|
5505
5614
|
const [currentPageInternal, setCurrentPage] = (0, import_react26.useState)(currentPage);
|
|
5506
5615
|
const pageCountInternal = pageCount ?? (itemsPerPage !== void 0 ? Math.ceil(itemsLength / itemsPerPage) : 1);
|
|
@@ -5536,7 +5645,7 @@ var PaginationComponent = function Pagination({
|
|
|
5536
5645
|
setCurrentPage(currentPage);
|
|
5537
5646
|
}, [currentPage]);
|
|
5538
5647
|
const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages2 / 1.4;
|
|
5539
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap:
|
|
5648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
|
|
5540
5649
|
pageCountInternal > maximumVisiblePages2 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5541
5650
|
Button_default.icon,
|
|
5542
5651
|
{
|
|
@@ -5553,7 +5662,7 @@ var PaginationComponent = function Pagination({
|
|
|
5553
5662
|
alignItems: "center",
|
|
5554
5663
|
justifyContent: "center",
|
|
5555
5664
|
flexWrap: mobileFooterBreakingPoint ? "wrap" : void 0,
|
|
5556
|
-
gap:
|
|
5665
|
+
gap: theme2.styles.gap,
|
|
5557
5666
|
children: paginationItems.map((pageIndex) => {
|
|
5558
5667
|
const isActive = currentPageInternal === pageIndex;
|
|
5559
5668
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -5567,8 +5676,8 @@ var PaginationComponent = function Pagination({
|
|
|
5567
5676
|
Text_default,
|
|
5568
5677
|
{
|
|
5569
5678
|
fontWeight: isActive ? 700 : 400,
|
|
5570
|
-
color: isActive ?
|
|
5571
|
-
transition:
|
|
5679
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
5680
|
+
transition: theme2.styles.transition,
|
|
5572
5681
|
children: pageIndex
|
|
5573
5682
|
}
|
|
5574
5683
|
)
|
|
@@ -5770,7 +5879,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5770
5879
|
onChangeFilterDataValue,
|
|
5771
5880
|
...props
|
|
5772
5881
|
}, ref) {
|
|
5773
|
-
const
|
|
5882
|
+
const theme2 = (0, import_react_better_core25.useTheme)();
|
|
5774
5883
|
const mediaQuery = useMediaQuery();
|
|
5775
5884
|
const { colorTheme } = (0, import_react_better_core25.useBetterCoreContext)();
|
|
5776
5885
|
const filterModalRef = (0, import_react27.useRef)(null);
|
|
@@ -5834,7 +5943,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5834
5943
|
}
|
|
5835
5944
|
case "image": {
|
|
5836
5945
|
const imageProps = (typeof column.getImageProps === "function" ? column.getImageProps?.(item, itemIndex) : column.getImageProps) ?? {};
|
|
5837
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Image_default, { width: "100%", borderRadius:
|
|
5946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Image_default, { width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...imageProps });
|
|
5838
5947
|
}
|
|
5839
5948
|
case "checkbox": {
|
|
5840
5949
|
const { onChange, ...toggleInputProps } = (typeof column.getToggleInputProps === "function" ? column.getToggleInputProps?.(item, itemIndex) : column.getToggleInputProps) ?? {};
|
|
@@ -5865,7 +5974,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5865
5974
|
{
|
|
5866
5975
|
name: "chevronDown",
|
|
5867
5976
|
transform: `rotate(${expandedRows[itemIndex] ? 180 : 0}deg)`,
|
|
5868
|
-
transition:
|
|
5977
|
+
transition: theme2.styles.transition
|
|
5869
5978
|
}
|
|
5870
5979
|
) });
|
|
5871
5980
|
}
|
|
@@ -5874,7 +5983,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5874
5983
|
}
|
|
5875
5984
|
}
|
|
5876
5985
|
},
|
|
5877
|
-
[
|
|
5986
|
+
[theme2, checkedItems, expandedRows]
|
|
5878
5987
|
);
|
|
5879
5988
|
const onClickRowElement = (0, import_react27.useCallback)(
|
|
5880
5989
|
(item, index) => {
|
|
@@ -6131,8 +6240,8 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6131
6240
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6132
6241
|
Div_default,
|
|
6133
6242
|
{
|
|
6134
|
-
border: `1px solid ${
|
|
6135
|
-
borderRadius:
|
|
6243
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
6244
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
6136
6245
|
overflow: !containsOverflowComponents ? "auto" : void 0,
|
|
6137
6246
|
...props,
|
|
6138
6247
|
ref: wrapperComponentRef,
|
|
@@ -6143,7 +6252,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6143
6252
|
withHover: onClickRow !== void 0 || expandColumn !== void 0,
|
|
6144
6253
|
withStickyHeader,
|
|
6145
6254
|
colorTheme,
|
|
6146
|
-
theme,
|
|
6255
|
+
theme: theme2,
|
|
6147
6256
|
containsOverflowComponents,
|
|
6148
6257
|
withFooter,
|
|
6149
6258
|
children: [
|
|
@@ -6160,7 +6269,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6160
6269
|
width: "100%",
|
|
6161
6270
|
alignItems: "center",
|
|
6162
6271
|
justifyContent: column.filter ? "space-between" : column.align === "center" ? "center" : column.align === "right" ? "flex-end" : "flex-start",
|
|
6163
|
-
gap:
|
|
6272
|
+
gap: theme2.styles.gap,
|
|
6164
6273
|
children: [
|
|
6165
6274
|
column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6166
6275
|
ToggleInput_default.checkbox,
|
|
@@ -6174,7 +6283,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6174
6283
|
Button_default.icon,
|
|
6175
6284
|
{
|
|
6176
6285
|
icon: "filter",
|
|
6177
|
-
color: filterData[index] ?
|
|
6286
|
+
color: filterData[index] ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
6178
6287
|
value: index,
|
|
6179
6288
|
onClickWithValue: onClickFilterButton
|
|
6180
6289
|
}
|
|
@@ -6217,14 +6326,14 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6217
6326
|
width: "100%",
|
|
6218
6327
|
justifyContent: "center",
|
|
6219
6328
|
flexReverse: true,
|
|
6220
|
-
gap:
|
|
6329
|
+
gap: theme2.styles.gap / 2,
|
|
6221
6330
|
children: [
|
|
6222
6331
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
6223
6332
|
Text_default,
|
|
6224
6333
|
{
|
|
6225
6334
|
position: mobileFooterBreakingPoint ? "relative" : "absolute",
|
|
6226
6335
|
top: !mobileFooterBreakingPoint ? "50%" : void 0,
|
|
6227
|
-
color:
|
|
6336
|
+
color: theme2.colors.textSecondary,
|
|
6228
6337
|
transform: !mobileFooterBreakingPoint ? "translateY(-50%)" : void 0,
|
|
6229
6338
|
userSelect: "none",
|
|
6230
6339
|
children: [
|
|
@@ -6276,7 +6385,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6276
6385
|
Form_default,
|
|
6277
6386
|
{
|
|
6278
6387
|
form: filterForm,
|
|
6279
|
-
gap:
|
|
6388
|
+
gap: theme2.styles.gap,
|
|
6280
6389
|
submitButtonText: "Filter",
|
|
6281
6390
|
cancelButtonText: "Clear",
|
|
6282
6391
|
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
@@ -6288,9 +6397,9 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6288
6397
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(InputField_default.dateTime, { label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
6289
6398
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(InputField_default.dateTime, { label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
6290
6399
|
] }) }),
|
|
6291
|
-
openedFilterColumn.presets && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap:
|
|
6400
|
+
openedFilterColumn.presets && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
6292
6401
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label_default, { text: "Presets" }),
|
|
6293
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default.row, { alignItems: "center", flexWrap: "wrap", gap:
|
|
6402
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default.row, { alignItems: "center", flexWrap: "wrap", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6294
6403
|
Button_default.secondary,
|
|
6295
6404
|
{
|
|
6296
6405
|
text: filterPresetsText[preset],
|
|
@@ -6306,10 +6415,10 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6306
6415
|
) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
6307
6416
|
Form_default,
|
|
6308
6417
|
{
|
|
6309
|
-
gap:
|
|
6418
|
+
gap: theme2.styles.space,
|
|
6310
6419
|
submitButtonText: "Filter",
|
|
6311
6420
|
cancelButtonText: "Clear",
|
|
6312
|
-
renderActionButtons: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { marginRight: "auto", alignItems: "center", gap:
|
|
6421
|
+
renderActionButtons: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { marginRight: "auto", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6313
6422
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6314
6423
|
Button_default.secondary,
|
|
6315
6424
|
{
|
|
@@ -6340,9 +6449,9 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6340
6449
|
...filterForm.getInputFieldProps("search")
|
|
6341
6450
|
}
|
|
6342
6451
|
) }),
|
|
6343
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap:
|
|
6452
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
6344
6453
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label_default, { text: "Possible values" }),
|
|
6345
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default.row, { flexWrap: "wrap", gap:
|
|
6454
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default.row, { flexWrap: "wrap", gap: theme2.styles.gap, children: possibleFilterListValues.length > 0 ? possibleFilterListValues.map((value) => {
|
|
6346
6455
|
const isActive = filterListSelectedItems?.includes(value.value);
|
|
6347
6456
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6348
6457
|
Div_default.box,
|
|
@@ -6350,13 +6459,13 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6350
6459
|
isActive,
|
|
6351
6460
|
value: value.value,
|
|
6352
6461
|
onClickWithValue: onClickFilterListItem,
|
|
6353
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
6462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
6354
6463
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { children: value.label || value.value }),
|
|
6355
6464
|
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
6356
6465
|
Text_default,
|
|
6357
6466
|
{
|
|
6358
6467
|
fontSize: 14,
|
|
6359
|
-
color: isActive ?
|
|
6468
|
+
color: isActive ? theme2.colors.base + "c0" : theme2.colors.textSecondary,
|
|
6360
6469
|
children: [
|
|
6361
6470
|
"(",
|
|
6362
6471
|
value.count,
|
|
@@ -6488,14 +6597,14 @@ var arrowStyle = (props, borderWidth) => ({
|
|
|
6488
6597
|
}
|
|
6489
6598
|
});
|
|
6490
6599
|
var Arrow = (0, import_react28.memo)(function Arrow2(props) {
|
|
6491
|
-
const
|
|
6600
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6492
6601
|
const { position, size } = props;
|
|
6493
6602
|
const outerProps = (0, import_react28.useMemo)(
|
|
6494
6603
|
() => ({
|
|
6495
6604
|
...props,
|
|
6496
|
-
color:
|
|
6605
|
+
color: theme2.colors.border
|
|
6497
6606
|
}),
|
|
6498
|
-
[props,
|
|
6607
|
+
[props, theme2]
|
|
6499
6608
|
);
|
|
6500
6609
|
const borderWidth = 1;
|
|
6501
6610
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -6539,16 +6648,16 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6539
6648
|
onClose,
|
|
6540
6649
|
children
|
|
6541
6650
|
}, ref) {
|
|
6542
|
-
const
|
|
6651
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6543
6652
|
const triggerHolderRef = (0, import_react28.useRef)(null);
|
|
6544
6653
|
const contentRef = (0, import_react28.useRef)(null);
|
|
6545
6654
|
const tooltipContainerRef = (0, import_react28.useRef)(null);
|
|
6546
6655
|
const closeTimerRef = (0, import_react28.useRef)(void 0);
|
|
6547
6656
|
const [isOpen, setIsOpen] = (0, import_react28.useState)(false);
|
|
6548
6657
|
const [isOpenLate, setIsOpenLate] = (0, import_react28.useState)(false);
|
|
6549
|
-
const arrowSize = withArrow ?
|
|
6550
|
-
const gap =
|
|
6551
|
-
const outsideScreenGap =
|
|
6658
|
+
const arrowSize = withArrow ? theme2.styles.gap : 0;
|
|
6659
|
+
const gap = theme2.styles.gap / 2;
|
|
6660
|
+
const outsideScreenGap = theme2.styles.gap / 2;
|
|
6552
6661
|
const totalGap = arrowSize + gap;
|
|
6553
6662
|
const openTooltip = (0, import_react28.useCallback)(() => {
|
|
6554
6663
|
if (disabled) return;
|
|
@@ -6651,7 +6760,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6651
6760
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6652
6761
|
TooltipContainer,
|
|
6653
6762
|
{
|
|
6654
|
-
theme,
|
|
6763
|
+
theme: theme2,
|
|
6655
6764
|
position,
|
|
6656
6765
|
align,
|
|
6657
6766
|
pointerEvents: contentPointerEvents,
|
|
@@ -6668,10 +6777,10 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6668
6777
|
position: "relative",
|
|
6669
6778
|
width: contentWidth,
|
|
6670
6779
|
minWidth: contentMinWidth,
|
|
6671
|
-
backgroundColor: backgroundColor ??
|
|
6780
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
|
|
6672
6781
|
boxShadow: "0px 10px 20px #00000020",
|
|
6673
|
-
paddingBlock: isSmall ?
|
|
6674
|
-
paddingInline: asContextMenu ? 0 : isSmall ?
|
|
6782
|
+
paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
|
|
6783
|
+
paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
|
|
6675
6784
|
overflow: asContextMenu ? "hidden" : void 0,
|
|
6676
6785
|
children: content
|
|
6677
6786
|
}
|
|
@@ -6695,9 +6804,9 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6695
6804
|
{
|
|
6696
6805
|
position,
|
|
6697
6806
|
align,
|
|
6698
|
-
sideSpace:
|
|
6807
|
+
sideSpace: theme2.styles.borderRadius,
|
|
6699
6808
|
size: arrowSize,
|
|
6700
|
-
color: backgroundColor ??
|
|
6809
|
+
color: backgroundColor ?? theme2.colors.backgroundContent,
|
|
6701
6810
|
isOpen
|
|
6702
6811
|
}
|
|
6703
6812
|
)
|
|
@@ -6721,16 +6830,16 @@ TooltipComponent.item = (0, import_react28.forwardRef)(function Item({
|
|
|
6721
6830
|
onClick,
|
|
6722
6831
|
onClickWithValue
|
|
6723
6832
|
}, ref) {
|
|
6724
|
-
const
|
|
6833
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6725
6834
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
6726
6835
|
Div_default.row,
|
|
6727
6836
|
{
|
|
6728
6837
|
alignItems: "center",
|
|
6729
|
-
gap:
|
|
6730
|
-
backgroundColor:
|
|
6838
|
+
gap: theme2.styles.space,
|
|
6839
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
6731
6840
|
filterHover: !disabled ? "brightness(0.9)" : "brightness(0.94)",
|
|
6732
|
-
paddingBlock:
|
|
6733
|
-
paddingInline:
|
|
6841
|
+
paddingBlock: theme2.styles.gap,
|
|
6842
|
+
paddingInline: theme2.styles.space,
|
|
6734
6843
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
6735
6844
|
isTabAccessed: true,
|
|
6736
6845
|
id,
|
|
@@ -6740,29 +6849,29 @@ TooltipComponent.item = (0, import_react28.forwardRef)(function Item({
|
|
|
6740
6849
|
onClickWithValue: !disabled ? onClickWithValue : void 0,
|
|
6741
6850
|
ref,
|
|
6742
6851
|
children: [
|
|
6743
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon_default, { name: icon, color: iconColor ?? (!isActive ?
|
|
6744
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Div_default.column, { flex: 1, gap:
|
|
6745
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ??
|
|
6746
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { fontSize: 14, color:
|
|
6852
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon_default, { name: icon, color: iconColor ?? (!isActive ? theme2.colors.textSecondary : void 0) }),
|
|
6853
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6854
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ?? theme2.colors.textPrimary, children: text }),
|
|
6855
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
|
|
6747
6856
|
] })
|
|
6748
6857
|
]
|
|
6749
6858
|
}
|
|
6750
6859
|
);
|
|
6751
6860
|
});
|
|
6752
6861
|
TooltipComponent.divider = (0, import_react28.forwardRef)(function DividerComponent(props, ref) {
|
|
6753
|
-
const
|
|
6754
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Divider_default.horizontal, { marginBlock:
|
|
6862
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Divider_default.horizontal, { marginBlock: theme2.styles.gap, ...props, ref });
|
|
6755
6864
|
});
|
|
6756
6865
|
TooltipComponent.sectionTitle = (0, import_react28.forwardRef)(function SectionTitle({ text, ...props }, ref) {
|
|
6757
|
-
const
|
|
6866
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6758
6867
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6759
6868
|
Text_default,
|
|
6760
6869
|
{
|
|
6761
6870
|
fontSize: 12,
|
|
6762
6871
|
fontWeight: 700,
|
|
6763
6872
|
textTransform: "uppercase",
|
|
6764
|
-
marginBlock:
|
|
6765
|
-
marginInline:
|
|
6873
|
+
marginBlock: theme2.styles.gap / 2,
|
|
6874
|
+
marginInline: theme2.styles.space,
|
|
6766
6875
|
...props,
|
|
6767
6876
|
ref,
|
|
6768
6877
|
children: text
|
|
@@ -6784,7 +6893,7 @@ var tabDotSize = 6;
|
|
|
6784
6893
|
var defaultTabName = "tab";
|
|
6785
6894
|
var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
6786
6895
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
6787
|
-
const
|
|
6896
|
+
const theme2 = (0, import_react_better_core27.useTheme)();
|
|
6788
6897
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
6789
6898
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
6790
6899
|
const { colorTheme } = (0, import_react_better_core27.useBetterCoreContext)();
|
|
@@ -6800,7 +6909,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6800
6909
|
return selectedTabValue;
|
|
6801
6910
|
});
|
|
6802
6911
|
const [rerenderState, setRerenderState] = (0, import_react29.useState)(0);
|
|
6803
|
-
const tabsGap = style === "box" ?
|
|
6912
|
+
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
6804
6913
|
const onClickTab = (0, import_react29.useCallback)(
|
|
6805
6914
|
(tab) => {
|
|
6806
6915
|
setSelectedTab(tab);
|
|
@@ -6878,7 +6987,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6878
6987
|
},
|
|
6879
6988
|
[selectedTab, onClickTab]
|
|
6880
6989
|
);
|
|
6881
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { width: "100%", gap:
|
|
6990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
6882
6991
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
6883
6992
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
6884
6993
|
const selected = tab === selectedTab;
|
|
@@ -6887,14 +6996,14 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6887
6996
|
{
|
|
6888
6997
|
position: "relative",
|
|
6889
6998
|
width: "fit-content",
|
|
6890
|
-
backgroundColor: style === "box" ? selected ?
|
|
6891
|
-
borderRadius: style === "box" ?
|
|
6892
|
-
borderTopLeftRadius: style === "borderRadiusTop" ?
|
|
6893
|
-
borderTopRightRadius: style === "borderRadiusTop" ?
|
|
6894
|
-
border: style === "box" ? `1px solid ${selected ? "transparent" :
|
|
6999
|
+
backgroundColor: style === "box" ? selected ? theme2.colors.primary : theme2.colors.backgroundContent : theme2.colors.backgroundBase,
|
|
7000
|
+
borderRadius: style === "box" ? theme2.styles.borderRadius : void 0,
|
|
7001
|
+
borderTopLeftRadius: style === "borderRadiusTop" ? theme2.styles.borderRadius : void 0,
|
|
7002
|
+
borderTopRightRadius: style === "borderRadiusTop" ? theme2.styles.borderRadius : void 0,
|
|
7003
|
+
border: style === "box" ? `1px solid ${selected ? "transparent" : theme2.colors.border}` : void 0,
|
|
6895
7004
|
filterHover: colorTheme === "dark" ? style === "box" ? "brightness(1.2)" : "brightness(2)" : "brightness(0.9)",
|
|
6896
|
-
paddingInline:
|
|
6897
|
-
paddingBlock:
|
|
7005
|
+
paddingInline: theme2.styles.space,
|
|
7006
|
+
paddingBlock: theme2.styles.gap,
|
|
6898
7007
|
value: tab,
|
|
6899
7008
|
cursor: "pointer",
|
|
6900
7009
|
isTabAccessed: true,
|
|
@@ -6907,21 +7016,21 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6907
7016
|
Div_default,
|
|
6908
7017
|
{
|
|
6909
7018
|
position: "absolute",
|
|
6910
|
-
top: (
|
|
6911
|
-
right: (
|
|
7019
|
+
top: (theme2.styles.space - tabDotSize) / 2,
|
|
7020
|
+
right: (theme2.styles.space - tabDotSize) / 2,
|
|
6912
7021
|
width: tabDotSize,
|
|
6913
7022
|
height: tabDotSize,
|
|
6914
|
-
backgroundColor: style === "box" && selected ?
|
|
7023
|
+
backgroundColor: style === "box" && selected ? theme2.colors.base : theme2.colors.primary,
|
|
6915
7024
|
borderRadius: 999,
|
|
6916
|
-
transition:
|
|
7025
|
+
transition: theme2.styles.transition
|
|
6917
7026
|
}
|
|
6918
7027
|
),
|
|
6919
7028
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6920
7029
|
Text_default,
|
|
6921
7030
|
{
|
|
6922
7031
|
fontWeight: 700,
|
|
6923
|
-
color: !selected ?
|
|
6924
|
-
transition:
|
|
7032
|
+
color: !selected ? theme2.colors.textSecondary : style === "box" ? theme2.colors.base : void 0,
|
|
7033
|
+
transition: theme2.styles.transition,
|
|
6925
7034
|
whiteSpace: "nowrap",
|
|
6926
7035
|
children: tab
|
|
6927
7036
|
}
|
|
@@ -6939,8 +7048,8 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6939
7048
|
height: tabBottomLineWidth,
|
|
6940
7049
|
bottom: 0,
|
|
6941
7050
|
left: leftSpacing,
|
|
6942
|
-
backgroundColor: accentColor ??
|
|
6943
|
-
transition: firstRenderPassedRef.current ?
|
|
7051
|
+
backgroundColor: accentColor ?? theme2.colors.primary,
|
|
7052
|
+
transition: firstRenderPassedRef.current ? theme2.styles.transition : "none"
|
|
6944
7053
|
}
|
|
6945
7054
|
)
|
|
6946
7055
|
] }),
|
|
@@ -6993,7 +7102,7 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
6993
7102
|
children,
|
|
6994
7103
|
...props
|
|
6995
7104
|
}, ref) {
|
|
6996
|
-
const
|
|
7105
|
+
const theme2 = (0, import_react_better_core28.useTheme)();
|
|
6997
7106
|
const bodyRef = (0, import_react30.useRef)(null);
|
|
6998
7107
|
const [internalIsOpen, setInternalIsOpen] = (0, import_react_better_core28.useBooleanState)(defaultOpen);
|
|
6999
7108
|
const [bodyVirtualHeight, setBodyVirtualHeight] = (0, import_react30.useState)();
|
|
@@ -7051,31 +7160,31 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7051
7160
|
{
|
|
7052
7161
|
width: "100%",
|
|
7053
7162
|
alignItems: "center",
|
|
7054
|
-
gap:
|
|
7055
|
-
paddingBlock: headerPaddingBlock ??
|
|
7163
|
+
gap: theme2.styles.space,
|
|
7164
|
+
paddingBlock: headerPaddingBlock ?? theme2.styles.gap,
|
|
7056
7165
|
paddingInline: headerPaddingInline,
|
|
7057
7166
|
cursor: "pointer",
|
|
7058
7167
|
onClick: toggleOpen,
|
|
7059
7168
|
userSelect: "none",
|
|
7060
7169
|
children: [
|
|
7061
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { flex: 1, alignItems: "center", gap:
|
|
7170
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
|
|
7062
7171
|
icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
7063
7172
|
image && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
|
|
7064
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.column, { gap:
|
|
7065
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
7173
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7174
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.space, children: [
|
|
7066
7175
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7067
7176
|
Text_default,
|
|
7068
7177
|
{
|
|
7069
7178
|
as: titleAs,
|
|
7070
7179
|
fontWeight: 700,
|
|
7071
7180
|
lineHeight: "20px",
|
|
7072
|
-
color: titleColor ??
|
|
7181
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
7073
7182
|
children: title
|
|
7074
7183
|
}
|
|
7075
7184
|
),
|
|
7076
7185
|
titleRightElement
|
|
7077
7186
|
] }),
|
|
7078
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { color: descriptionColor ??
|
|
7187
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { color: descriptionColor ?? theme2.colors.textSecondary, children: description })
|
|
7079
7188
|
] })
|
|
7080
7189
|
] }),
|
|
7081
7190
|
rightElement,
|
|
@@ -7084,37 +7193,37 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7084
7193
|
{
|
|
7085
7194
|
name: "chevronDown",
|
|
7086
7195
|
transform: `rotate(${isOpen ? 180 : 0}deg)`,
|
|
7087
|
-
transition:
|
|
7196
|
+
transition: theme2.styles.transition
|
|
7088
7197
|
}
|
|
7089
7198
|
)
|
|
7090
7199
|
]
|
|
7091
7200
|
}
|
|
7092
7201
|
),
|
|
7093
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition:
|
|
7202
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Divider_default.horizontal, {}) }),
|
|
7094
7203
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7095
7204
|
Div_default,
|
|
7096
7205
|
{
|
|
7097
7206
|
maxHeight: isOpen ? bodyVirtualHeight : 0,
|
|
7098
7207
|
opacity: !isOpen ? 0 : void 0,
|
|
7099
|
-
transition: `max-height ${isOpen ? animationDurationOpen : animationDurationClose}s ease, opacity ${
|
|
7208
|
+
transition: `max-height ${isOpen ? animationDurationOpen : animationDurationClose}s ease, opacity ${theme2.styles.transition}`,
|
|
7100
7209
|
overflow: !isOpen ? "hidden" : void 0,
|
|
7101
7210
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
7102
7211
|
ref: bodyRef,
|
|
7103
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { paddingBlock:
|
|
7212
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
|
|
7104
7213
|
}
|
|
7105
7214
|
)
|
|
7106
7215
|
] });
|
|
7107
7216
|
});
|
|
7108
7217
|
FoldableComponent.box = (0, import_react30.forwardRef)(function Box3({ ...props }, ref) {
|
|
7109
|
-
const
|
|
7218
|
+
const theme2 = (0, import_react_better_core28.useTheme)();
|
|
7110
7219
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7111
7220
|
FoldableComponent,
|
|
7112
7221
|
{
|
|
7113
|
-
backgroundColor:
|
|
7114
|
-
border: `1px solid ${
|
|
7115
|
-
borderRadius:
|
|
7116
|
-
headerPaddingBlock: (
|
|
7117
|
-
headerPaddingInline:
|
|
7222
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
7223
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
7224
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7225
|
+
headerPaddingBlock: (theme2.styles.gap + theme2.styles.space) / 2,
|
|
7226
|
+
headerPaddingInline: theme2.styles.space,
|
|
7118
7227
|
...props,
|
|
7119
7228
|
ref
|
|
7120
7229
|
}
|
|
@@ -7145,7 +7254,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7145
7254
|
);
|
|
7146
7255
|
}
|
|
7147
7256
|
const reactRouterDomPluginConfig = reactRouterDomPlugin2.getConfig();
|
|
7148
|
-
const
|
|
7257
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7149
7258
|
const mediaQuery = useMediaQuery();
|
|
7150
7259
|
const location = reactRouterDomPluginConfig.useLocation();
|
|
7151
7260
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
@@ -7166,20 +7275,20 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7166
7275
|
}
|
|
7167
7276
|
}, [onClick, item, isCollapsed]);
|
|
7168
7277
|
const isActive = activeItem && item.href && activeItem.href === item.href;
|
|
7169
|
-
const readyBackgroundColor = backgroundColor ??
|
|
7278
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
7170
7279
|
const iconSize = 16;
|
|
7171
|
-
const paddingBlock =
|
|
7172
|
-
const paddingLeft =
|
|
7173
|
-
const iconGap =
|
|
7280
|
+
const paddingBlock = theme2.styles.gap;
|
|
7281
|
+
const paddingLeft = theme2.styles.gap + 2;
|
|
7282
|
+
const iconGap = theme2.styles.gap;
|
|
7174
7283
|
const lineHeight = 20;
|
|
7175
7284
|
const lineWidth = 2;
|
|
7176
7285
|
const lineEndRadius = iconSize / 2 + iconGap * 2;
|
|
7177
7286
|
const content = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7178
7287
|
Tooltip_default,
|
|
7179
7288
|
{
|
|
7180
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
7289
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
7181
7290
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text_default, { whiteSpace: "nowrap", children: item.text }),
|
|
7182
|
-
item.children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: "chevronDown", color:
|
|
7291
|
+
item.children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: "chevronDown", color: theme2.colors.textSecondary, size: 14 })
|
|
7183
7292
|
] }),
|
|
7184
7293
|
contentPointerEvents: "none",
|
|
7185
7294
|
withArrow: true,
|
|
@@ -7192,26 +7301,26 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7192
7301
|
alignItems: "center",
|
|
7193
7302
|
gap: iconGap,
|
|
7194
7303
|
whiteSpace: "nowrap",
|
|
7195
|
-
backgroundColor: isActive ? colorTheme === "dark" ? (0, import_react_better_core29.lightenColor)(
|
|
7196
|
-
borderRadius:
|
|
7304
|
+
backgroundColor: isActive ? colorTheme === "dark" ? (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.7) : (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.85) : readyBackgroundColor,
|
|
7305
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7197
7306
|
paddingBlock,
|
|
7198
|
-
paddingLeft: isCollapsed ?
|
|
7199
|
-
paddingRight:
|
|
7307
|
+
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
7308
|
+
paddingRight: theme2.styles.space,
|
|
7200
7309
|
filterHover: `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})`,
|
|
7201
7310
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
7202
7311
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
7203
7312
|
opacity: item.disabled ? 0.6 : void 0,
|
|
7204
7313
|
onClick: onClickElement,
|
|
7205
7314
|
children: [
|
|
7206
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: item.iconName, color:
|
|
7315
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: item.iconName, color: theme2.colors.primary, size: iconSize, flexShrink: 0 }),
|
|
7207
7316
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7208
7317
|
Text_default,
|
|
7209
7318
|
{
|
|
7210
7319
|
flex: 1,
|
|
7211
7320
|
lineHeight: `${lineHeight}px`,
|
|
7212
|
-
color: isActive ?
|
|
7321
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
|
|
7213
7322
|
opacity: isCollapsed ? 0 : void 0,
|
|
7214
|
-
transition:
|
|
7323
|
+
transition: theme2.styles.transition,
|
|
7215
7324
|
children: item.text
|
|
7216
7325
|
}
|
|
7217
7326
|
),
|
|
@@ -7219,10 +7328,10 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7219
7328
|
Icon_default,
|
|
7220
7329
|
{
|
|
7221
7330
|
name: "chevronDown",
|
|
7222
|
-
color:
|
|
7331
|
+
color: theme2.colors.textSecondary,
|
|
7223
7332
|
size: 14,
|
|
7224
7333
|
transform: isOpened ? "rotate(180deg)" : void 0,
|
|
7225
|
-
transition:
|
|
7334
|
+
transition: theme2.styles.transition
|
|
7226
7335
|
}
|
|
7227
7336
|
)
|
|
7228
7337
|
]
|
|
@@ -7260,11 +7369,11 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7260
7369
|
{
|
|
7261
7370
|
position: "relative",
|
|
7262
7371
|
maxHeight: isOpened ? 1e3 : 0,
|
|
7263
|
-
gap:
|
|
7264
|
-
marginTop: isOpened ?
|
|
7372
|
+
gap: theme2.styles.gap / 2,
|
|
7373
|
+
marginTop: isOpened ? theme2.styles.gap / 2 : void 0,
|
|
7265
7374
|
paddingLeft: paddingLeft + iconSize + iconGap,
|
|
7266
7375
|
overflow: "hidden",
|
|
7267
|
-
transition: `max-height ${
|
|
7376
|
+
transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
|
|
7268
7377
|
children: [
|
|
7269
7378
|
item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7270
7379
|
MenuItemComponent2,
|
|
@@ -7290,7 +7399,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7290
7399
|
position: "relative",
|
|
7291
7400
|
width: lineWidth,
|
|
7292
7401
|
height: "100%",
|
|
7293
|
-
backgroundColor:
|
|
7402
|
+
backgroundColor: theme2.colors.border,
|
|
7294
7403
|
zIndex: 1
|
|
7295
7404
|
}
|
|
7296
7405
|
),
|
|
@@ -7302,7 +7411,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7302
7411
|
height: lineEndRadius,
|
|
7303
7412
|
top: `calc(100% - ${lineEndRadius / 2}px)`,
|
|
7304
7413
|
left: 0,
|
|
7305
|
-
border: `${lineWidth}px solid ${
|
|
7414
|
+
border: `${lineWidth}px solid ${theme2.colors.border}`,
|
|
7306
7415
|
borderRadius: 999,
|
|
7307
7416
|
borderTopColor: readyBackgroundColor,
|
|
7308
7417
|
borderLeftColor: readyBackgroundColor,
|
|
@@ -7335,7 +7444,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7335
7444
|
backgroundColor,
|
|
7336
7445
|
paddingTop
|
|
7337
7446
|
}) {
|
|
7338
|
-
const
|
|
7447
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7339
7448
|
const mediaQuery = useMediaQuery();
|
|
7340
7449
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed, sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
7341
7450
|
const [activeItem, setActiveItem] = (0, import_react31.useState)();
|
|
@@ -7355,9 +7464,9 @@ var SideMenuComponent = function SideMenu({
|
|
|
7355
7464
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
7356
7465
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
7357
7466
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
7358
|
-
const sideMenuCollapsedWidth =
|
|
7359
|
-
const readyBackgroundColor = backgroundColor ??
|
|
7360
|
-
const logoSize = sideMenuCollapsedWidth -
|
|
7467
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
7468
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
7469
|
+
const logoSize = sideMenuCollapsedWidth - theme2.styles.space * 2;
|
|
7361
7470
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SideMenuContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
7362
7471
|
Div_default.column,
|
|
7363
7472
|
{
|
|
@@ -7367,15 +7476,15 @@ var SideMenuComponent = function SideMenu({
|
|
|
7367
7476
|
top: topSpace,
|
|
7368
7477
|
left: 0,
|
|
7369
7478
|
backgroundColor: readyBackgroundColor,
|
|
7370
|
-
borderRight: `solid 1px ${
|
|
7479
|
+
borderRight: `solid 1px ${theme2.colors.border}`,
|
|
7371
7480
|
transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
|
|
7372
|
-
paddingTop: paddingTop ?? (logoAssetName || logoUrl ?
|
|
7373
|
-
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${
|
|
7481
|
+
paddingTop: paddingTop ?? (logoAssetName || logoUrl ? theme2.styles.gap : theme2.styles.space),
|
|
7482
|
+
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${theme2.styles.transition}` : "none" : theme2.styles.transition,
|
|
7374
7483
|
userSelect: "none",
|
|
7375
7484
|
zIndex: 10,
|
|
7376
7485
|
children: [
|
|
7377
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.column, { width: "100%", height: "100%", gap:
|
|
7378
|
-
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.row, { alignItems: "center", paddingInline:
|
|
7486
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.column, { width: "100%", height: "100%", gap: theme2.styles.space, children: [
|
|
7487
|
+
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.row, { alignItems: "center", paddingInline: theme2.styles.space, children: [
|
|
7379
7488
|
(logoAssetName || logoUrl) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LinkComponentTag, { to: "/", href: "/", onClick: onClickXButton, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
7380
7489
|
Div_default.row,
|
|
7381
7490
|
{
|
|
@@ -7383,7 +7492,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7383
7492
|
width: sideMenuCollapsedWidth ? logoSize : void 0,
|
|
7384
7493
|
height: logoSize,
|
|
7385
7494
|
whiteSpace: "nowrap",
|
|
7386
|
-
gap:
|
|
7495
|
+
gap: theme2.styles.gap,
|
|
7387
7496
|
children: [
|
|
7388
7497
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7389
7498
|
Image_default,
|
|
@@ -7402,7 +7511,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7402
7511
|
fontSize: 22,
|
|
7403
7512
|
fontWeight: 800,
|
|
7404
7513
|
opacity: !isCollapsed ? 1 : 0,
|
|
7405
|
-
transition:
|
|
7514
|
+
transition: theme2.styles.transition,
|
|
7406
7515
|
userSelect: "none",
|
|
7407
7516
|
children: logoText
|
|
7408
7517
|
}
|
|
@@ -7419,9 +7528,9 @@ var SideMenuComponent = function SideMenu({
|
|
|
7419
7528
|
width: "100%",
|
|
7420
7529
|
height: "100%",
|
|
7421
7530
|
overflowY: !isCollapsed ? "auto" : void 0,
|
|
7422
|
-
paddingInline:
|
|
7423
|
-
paddingBottom: !isCollapsable && !readyBottomItems ?
|
|
7424
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default.column, { gap:
|
|
7531
|
+
paddingInline: theme2.styles.space,
|
|
7532
|
+
paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
|
|
7533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7425
7534
|
MenuItemComponent,
|
|
7426
7535
|
{
|
|
7427
7536
|
item,
|
|
@@ -7435,12 +7544,12 @@ var SideMenuComponent = function SideMenu({
|
|
|
7435
7544
|
readyBottomItems && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7436
7545
|
Div_default.column,
|
|
7437
7546
|
{
|
|
7438
|
-
borderTop: mediaQuery.size1000 ? `solid 1px ${
|
|
7439
|
-
gap:
|
|
7547
|
+
borderTop: mediaQuery.size1000 ? `solid 1px ${theme2.colors.border}` : void 0,
|
|
7548
|
+
gap: theme2.styles.gap / 2,
|
|
7440
7549
|
marginTop: "auto",
|
|
7441
|
-
paddingTop: mediaQuery.size1000 ?
|
|
7442
|
-
paddingInline:
|
|
7443
|
-
paddingBottom: !isCollapsable ?
|
|
7550
|
+
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
7551
|
+
paddingInline: theme2.styles.space,
|
|
7552
|
+
paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
|
|
7444
7553
|
children: readyBottomItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7445
7554
|
MenuItemComponent,
|
|
7446
7555
|
{
|
|
@@ -7457,30 +7566,30 @@ var SideMenuComponent = function SideMenu({
|
|
|
7457
7566
|
isCollapsable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7458
7567
|
Div_default,
|
|
7459
7568
|
{
|
|
7460
|
-
borderTop: `solid 1px ${
|
|
7569
|
+
borderTop: `solid 1px ${theme2.colors.border}`,
|
|
7461
7570
|
marginTop: !readyBottomItems ? "auto" : void 0,
|
|
7462
|
-
paddingInline:
|
|
7463
|
-
paddingBlock:
|
|
7571
|
+
paddingInline: theme2.styles.space,
|
|
7572
|
+
paddingBlock: theme2.styles.space,
|
|
7464
7573
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7465
7574
|
Div_default.row,
|
|
7466
7575
|
{
|
|
7467
7576
|
alignItems: "center",
|
|
7468
7577
|
justifyContent: "center",
|
|
7469
7578
|
backgroundColor: readyBackgroundColor,
|
|
7470
|
-
borderRadius:
|
|
7579
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7471
7580
|
cursor: "pointer",
|
|
7472
7581
|
filterHover: filterHover().z1,
|
|
7473
7582
|
isTabAccessed: true,
|
|
7474
|
-
paddingBlock:
|
|
7583
|
+
paddingBlock: theme2.styles.gap,
|
|
7475
7584
|
onClick: setSideMenuIsCollapsed.toggle,
|
|
7476
7585
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7477
7586
|
Icon_default,
|
|
7478
7587
|
{
|
|
7479
7588
|
name: "chevronRight",
|
|
7480
7589
|
size: 20,
|
|
7481
|
-
color:
|
|
7590
|
+
color: theme2.colors.textSecondary,
|
|
7482
7591
|
transform: `rotate(${isCollapsed ? 0 : 180}deg)`,
|
|
7483
|
-
transition:
|
|
7592
|
+
transition: theme2.styles.transition
|
|
7484
7593
|
}
|
|
7485
7594
|
)
|
|
7486
7595
|
}
|
|
@@ -7492,30 +7601,30 @@ var SideMenuComponent = function SideMenu({
|
|
|
7492
7601
|
Div_default.row,
|
|
7493
7602
|
{
|
|
7494
7603
|
position: "absolute",
|
|
7495
|
-
top:
|
|
7604
|
+
top: theme2.styles.space,
|
|
7496
7605
|
left: "100%",
|
|
7497
7606
|
backgroundColor: readyBackgroundColor,
|
|
7498
|
-
border: `solid 1px ${
|
|
7607
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
7499
7608
|
borderLeft: "none",
|
|
7500
|
-
borderTopRightRadius:
|
|
7501
|
-
borderBottomRightRadius:
|
|
7609
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
7610
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
7502
7611
|
alignItems: "center",
|
|
7503
7612
|
cursor: "pointer",
|
|
7504
7613
|
opacity: !mediaQuery.size1000 ? 0 : void 0,
|
|
7505
7614
|
pointerEvents: !mediaQuery.size1000 ? "none" : void 0,
|
|
7506
|
-
padding:
|
|
7507
|
-
paddingRight: (
|
|
7615
|
+
padding: theme2.styles.gap,
|
|
7616
|
+
paddingRight: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
7508
7617
|
transform: !mediaQuery.size1000 ? "translateX(-100%)" : void 0,
|
|
7509
|
-
transition:
|
|
7618
|
+
transition: theme2.styles.transition,
|
|
7510
7619
|
onClick: setSideMenuIsOpenMobile.toggle,
|
|
7511
7620
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7512
7621
|
Icon_default,
|
|
7513
7622
|
{
|
|
7514
7623
|
name: "chevronRight",
|
|
7515
7624
|
size: 20,
|
|
7516
|
-
color:
|
|
7625
|
+
color: theme2.colors.textSecondary,
|
|
7517
7626
|
transform: sideMenuIsOpenMobile ? "rotate(180deg)" : void 0,
|
|
7518
|
-
transition:
|
|
7627
|
+
transition: theme2.styles.transition
|
|
7519
7628
|
}
|
|
7520
7629
|
)
|
|
7521
7630
|
}
|
|
@@ -7526,18 +7635,18 @@ var SideMenuComponent = function SideMenu({
|
|
|
7526
7635
|
) });
|
|
7527
7636
|
};
|
|
7528
7637
|
SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, ...props }) {
|
|
7529
|
-
const
|
|
7638
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7530
7639
|
const mediaQuery = useMediaQuery();
|
|
7531
7640
|
const { components, sideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
7532
7641
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
7533
|
-
const sideMenuCollapsedWidth =
|
|
7642
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
7534
7643
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
7535
7644
|
Div_default,
|
|
7536
7645
|
{
|
|
7537
7646
|
position: "relative",
|
|
7538
7647
|
width: "100%",
|
|
7539
7648
|
paddingLeft: !mediaQuery.size1000 ? !sideMenuIsCollapsed ? sideMenuWidth : sideMenuCollapsedWidth : void 0,
|
|
7540
|
-
transition:
|
|
7649
|
+
transition: theme2.styles.transition,
|
|
7541
7650
|
children: [
|
|
7542
7651
|
outsideComponent,
|
|
7543
7652
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PageHolder_default, { ...props })
|
|
@@ -7546,7 +7655,7 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
|
|
|
7546
7655
|
);
|
|
7547
7656
|
};
|
|
7548
7657
|
SideMenuComponent.burgerButton = function BurgerButton() {
|
|
7549
|
-
const
|
|
7658
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7550
7659
|
const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
7551
7660
|
const [isHovered, setIsHovered] = (0, import_react_better_core29.useBooleanState)();
|
|
7552
7661
|
const width = 2;
|
|
@@ -7570,10 +7679,10 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7570
7679
|
height: width,
|
|
7571
7680
|
top: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
|
|
7572
7681
|
left: 0,
|
|
7573
|
-
backgroundColor:
|
|
7682
|
+
backgroundColor: theme2.colors.border,
|
|
7574
7683
|
borderRadius: 999,
|
|
7575
7684
|
transform: sideMenuIsOpenMobile ? "rotate(45deg)" : void 0,
|
|
7576
|
-
transition:
|
|
7685
|
+
transition: theme2.styles.transition
|
|
7577
7686
|
}
|
|
7578
7687
|
),
|
|
7579
7688
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -7584,11 +7693,11 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7584
7693
|
height: width,
|
|
7585
7694
|
top: "50%",
|
|
7586
7695
|
left: 0,
|
|
7587
|
-
backgroundColor:
|
|
7696
|
+
backgroundColor: theme2.colors.border,
|
|
7588
7697
|
borderRadius: 999,
|
|
7589
7698
|
transform: "translateY(-50%)",
|
|
7590
7699
|
opacity: sideMenuIsOpenMobile ? 0 : void 0,
|
|
7591
|
-
transition:
|
|
7700
|
+
transition: theme2.styles.transition
|
|
7592
7701
|
}
|
|
7593
7702
|
),
|
|
7594
7703
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -7599,10 +7708,10 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7599
7708
|
height: width,
|
|
7600
7709
|
bottom: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
|
|
7601
7710
|
left: 0,
|
|
7602
|
-
backgroundColor:
|
|
7711
|
+
backgroundColor: theme2.colors.border,
|
|
7603
7712
|
borderRadius: 999,
|
|
7604
7713
|
transform: sideMenuIsOpenMobile ? "rotate(-45deg)" : void 0,
|
|
7605
|
-
transition:
|
|
7714
|
+
transition: theme2.styles.transition
|
|
7606
7715
|
}
|
|
7607
7716
|
)
|
|
7608
7717
|
]
|