react-better-html 1.1.217 → 1.1.218
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 +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +1019 -911
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1022 -914
- 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,9 +1844,9 @@ 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 = {
|
|
@@ -1809,81 +1903,6 @@ var localStoragePlugin = (options) => ({
|
|
|
1809
1903
|
})
|
|
1810
1904
|
});
|
|
1811
1905
|
|
|
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
1906
|
// src/components/Button.tsx
|
|
1888
1907
|
var import_react10 = require("react");
|
|
1889
1908
|
var import_react_better_core9 = require("react-better-core");
|
|
@@ -1914,8 +1933,8 @@ var LoaderComponent = function Loader({
|
|
|
1914
1933
|
disabled,
|
|
1915
1934
|
...props
|
|
1916
1935
|
}) {
|
|
1917
|
-
const
|
|
1918
|
-
const readyColor = color ??
|
|
1936
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1937
|
+
const readyColor = color ?? theme2.colors.textPrimary;
|
|
1919
1938
|
const readyWidth = width ?? size / 3;
|
|
1920
1939
|
const mask = `radial-gradient(farthest-side, #0000 calc(100% - ${readyWidth}px), #000 0)`;
|
|
1921
1940
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StyledDiv, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
@@ -1934,17 +1953,17 @@ var LoaderComponent = function Loader({
|
|
|
1934
1953
|
) });
|
|
1935
1954
|
};
|
|
1936
1955
|
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:
|
|
1956
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Div_default.column, { width: "100%", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
1939
1958
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader2, { size, ...props }),
|
|
1940
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ??
|
|
1959
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ?? theme2.colors.textSecondary, children: text })
|
|
1941
1960
|
] });
|
|
1942
1961
|
};
|
|
1943
1962
|
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:
|
|
1963
|
+
const theme2 = (0, import_react_better_core8.useTheme)();
|
|
1964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
1946
1965
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Loader2, { size, ...props }),
|
|
1947
|
-
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ??
|
|
1966
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text_default, { textAlign: "center", color: props.color ?? theme2.colors.textSecondary, children: text })
|
|
1948
1967
|
] });
|
|
1949
1968
|
};
|
|
1950
1969
|
var Loader2 = (0, import_react9.memo)(LoaderComponent);
|
|
@@ -2028,7 +2047,7 @@ var ButtonComponent = function Button({
|
|
|
2028
2047
|
onClickWithValue,
|
|
2029
2048
|
...props
|
|
2030
2049
|
}) {
|
|
2031
|
-
const
|
|
2050
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2032
2051
|
const isLoadingHook = (0, import_react_better_core9.useLoader)(loaderName);
|
|
2033
2052
|
const { components } = useBetterHtmlContextInternal();
|
|
2034
2053
|
const { colorTheme } = (0, import_react_better_core9.useBetterCoreContext)();
|
|
@@ -2050,7 +2069,7 @@ var ButtonComponent = function Button({
|
|
|
2050
2069
|
Icon_default,
|
|
2051
2070
|
{
|
|
2052
2071
|
name: icon,
|
|
2053
|
-
color: iconColor ?? props.color ??
|
|
2072
|
+
color: iconColor ?? props.color ?? theme2.colors.base,
|
|
2054
2073
|
size: iconSize ?? parseInt(style.fontSize?.toString() ?? "16")
|
|
2055
2074
|
}
|
|
2056
2075
|
) }) : void 0;
|
|
@@ -2058,7 +2077,7 @@ var ButtonComponent = function Button({
|
|
|
2058
2077
|
Image_default,
|
|
2059
2078
|
{
|
|
2060
2079
|
name: image,
|
|
2061
|
-
color: iconColor ?? props.color ??
|
|
2080
|
+
color: iconColor ?? props.color ?? theme2.colors.base,
|
|
2062
2081
|
width: imageWidth ?? parseInt(style.fontSize?.toString() ?? "16"),
|
|
2063
2082
|
height: imageHeight
|
|
2064
2083
|
}
|
|
@@ -2069,7 +2088,7 @@ var ButtonComponent = function Button({
|
|
|
2069
2088
|
ButtonElement,
|
|
2070
2089
|
{
|
|
2071
2090
|
as: href ? linkComponentTag : buttonComponentTag,
|
|
2072
|
-
theme,
|
|
2091
|
+
theme: theme2,
|
|
2073
2092
|
colorTheme,
|
|
2074
2093
|
isSmall,
|
|
2075
2094
|
withText: text !== void 0,
|
|
@@ -2095,7 +2114,7 @@ var ButtonComponent = function Button({
|
|
|
2095
2114
|
gap: 10,
|
|
2096
2115
|
pointerEvents: "none",
|
|
2097
2116
|
opacity: isLoadingElement ? 0 : 1,
|
|
2098
|
-
transition:
|
|
2117
|
+
transition: theme2.styles.transition,
|
|
2099
2118
|
children: [
|
|
2100
2119
|
iconPosition === "left" && iconComponent,
|
|
2101
2120
|
imagePosition === "left" && imageComponent,
|
|
@@ -2117,11 +2136,11 @@ var ButtonComponent = function Button({
|
|
|
2117
2136
|
alignItems: "center",
|
|
2118
2137
|
justifyContent: "center",
|
|
2119
2138
|
opacity: isLoadingElement ? 1 : 0,
|
|
2120
|
-
transition:
|
|
2139
|
+
transition: theme2.styles.transition,
|
|
2121
2140
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2122
2141
|
Loader_default,
|
|
2123
2142
|
{
|
|
2124
|
-
color: props.color ??
|
|
2143
|
+
color: props.color ?? theme2.colors.base,
|
|
2125
2144
|
size: loaderSize,
|
|
2126
2145
|
disabled: !isLoadingElement
|
|
2127
2146
|
}
|
|
@@ -2133,43 +2152,43 @@ var ButtonComponent = function Button({
|
|
|
2133
2152
|
);
|
|
2134
2153
|
};
|
|
2135
2154
|
ButtonComponent.secondary = function Secondary({ className, ...props }) {
|
|
2136
|
-
const
|
|
2155
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2137
2156
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2138
2157
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2139
2158
|
ButtonComponent,
|
|
2140
2159
|
{
|
|
2141
2160
|
...betterHtmlContext2.components.button?.style?.secondary,
|
|
2142
2161
|
className: `secondary${className ? ` ${className}` : ""}`,
|
|
2143
|
-
color:
|
|
2162
|
+
color: theme2.colors.textPrimary,
|
|
2144
2163
|
...props
|
|
2145
2164
|
}
|
|
2146
2165
|
);
|
|
2147
2166
|
};
|
|
2148
2167
|
ButtonComponent.destructive = function Destructive(props) {
|
|
2149
|
-
const
|
|
2168
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2150
2169
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2151
2170
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2152
2171
|
ButtonComponent,
|
|
2153
2172
|
{
|
|
2154
2173
|
...betterHtmlContext2.components.button?.style?.destructive,
|
|
2155
|
-
backgroundColor:
|
|
2156
|
-
color:
|
|
2174
|
+
backgroundColor: theme2.colors.error,
|
|
2175
|
+
color: theme2.colors.base,
|
|
2157
2176
|
...props
|
|
2158
2177
|
}
|
|
2159
2178
|
);
|
|
2160
2179
|
};
|
|
2161
2180
|
ButtonComponent.icon = function Icon3({ size = 16, backgroundButtonColor, ...props }) {
|
|
2162
|
-
const
|
|
2181
|
+
const theme2 = (0, import_react_better_core9.useTheme)();
|
|
2163
2182
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2164
|
-
const buttonSize = size +
|
|
2165
|
-
const backgroundButtonColorReady = backgroundButtonColor ??
|
|
2183
|
+
const buttonSize = size + theme2.styles.space;
|
|
2184
|
+
const backgroundButtonColorReady = backgroundButtonColor ?? theme2.colors.textPrimary;
|
|
2166
2185
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2167
2186
|
ButtonComponent,
|
|
2168
2187
|
{
|
|
2169
2188
|
...betterHtmlContext2.components.button?.style?.icon,
|
|
2170
2189
|
width: buttonSize,
|
|
2171
2190
|
height: buttonSize,
|
|
2172
|
-
color:
|
|
2191
|
+
color: theme2.colors.textPrimary,
|
|
2173
2192
|
backgroundColor: backgroundButtonColorReady + "00",
|
|
2174
2193
|
backgroundImage: "none",
|
|
2175
2194
|
backgroundColorHover: backgroundButtonColorReady + "20",
|
|
@@ -2213,82 +2232,411 @@ Button2.icon = ButtonComponent.icon;
|
|
|
2213
2232
|
Button2.upload = ButtonComponent.upload;
|
|
2214
2233
|
var Button_default = Button2;
|
|
2215
2234
|
|
|
2216
|
-
// src/components/
|
|
2235
|
+
// src/components/Modal.tsx
|
|
2236
|
+
var import_react11 = require("react");
|
|
2237
|
+
var import_react_dom = require("react-dom");
|
|
2238
|
+
var import_react_better_core10 = require("react-better-core");
|
|
2239
|
+
var import_styled_components7 = __toESM(require("styled-components"));
|
|
2217
2240
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2218
|
-
var
|
|
2219
|
-
shouldForwardProp: (prop) => !["theme"].includes(prop)
|
|
2241
|
+
var DialogStylesElement = import_styled_components7.default.dialog.withConfig({
|
|
2242
|
+
shouldForwardProp: (prop) => !["theme", "colorTheme", "opacity"].includes(prop)
|
|
2220
2243
|
})`
|
|
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
|
-
}
|
|
2244
|
+
width: 100%;
|
|
2245
|
+
max-width: none;
|
|
2246
|
+
height: 100%;
|
|
2247
|
+
max-height: none;
|
|
2248
|
+
color: ${(props) => props.theme.colors.textPrimary};
|
|
2249
|
+
border: none;
|
|
2250
|
+
outline: none;
|
|
2251
|
+
background-color: transparent;
|
|
2252
|
+
margin: auto auto;
|
|
2253
|
+
padding-inline: ${(props) => props.theme.styles.gap}px;
|
|
2254
|
+
opacity: ${(props) => props.opacity};
|
|
2255
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
2242
2256
|
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
}
|
|
2248
|
-
to {
|
|
2249
|
-
opacity: 1;
|
|
2250
|
-
transform: translateX(0px);
|
|
2251
|
-
}
|
|
2257
|
+
&::backdrop {
|
|
2258
|
+
background-color: ${(props) => props.colorTheme === "light" ? "#000000a0" : "#222222e0"};
|
|
2259
|
+
opacity: ${(props) => props.opacity};
|
|
2260
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
2252
2261
|
}
|
|
2253
2262
|
|
|
2254
|
-
@keyframes
|
|
2263
|
+
@keyframes fadeInAnimation {
|
|
2255
2264
|
from {
|
|
2256
|
-
opacity: 0;
|
|
2257
2265
|
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2258
2266
|
}
|
|
2259
2267
|
to {
|
|
2260
|
-
opacity: 1;
|
|
2261
2268
|
transform: translateY(0px);
|
|
2262
2269
|
}
|
|
2263
2270
|
}
|
|
2264
2271
|
|
|
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 {
|
|
2272
|
+
@keyframes fadeOutAnimation {
|
|
2277
2273
|
from {
|
|
2278
|
-
|
|
2279
|
-
transform: translateX(0px);
|
|
2274
|
+
transform: translateY(0px);
|
|
2280
2275
|
}
|
|
2281
2276
|
to {
|
|
2282
|
-
|
|
2283
|
-
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2277
|
+
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2284
2278
|
}
|
|
2285
2279
|
}
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2280
|
+
`;
|
|
2281
|
+
var ModalComponent = (0, import_react11.forwardRef)(function Modal({
|
|
2282
|
+
maxWidth,
|
|
2283
|
+
icon,
|
|
2284
|
+
title,
|
|
2285
|
+
titleColor,
|
|
2286
|
+
description,
|
|
2287
|
+
descriptionColor,
|
|
2288
|
+
headerTextAlign,
|
|
2289
|
+
headerBackgroundColor,
|
|
2290
|
+
backgroundColor,
|
|
2291
|
+
name,
|
|
2292
|
+
overflow,
|
|
2293
|
+
withoutCloseButton,
|
|
2294
|
+
onOpen,
|
|
2295
|
+
onClose,
|
|
2296
|
+
children
|
|
2297
|
+
}, ref) {
|
|
2298
|
+
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
2299
|
+
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
2300
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
2301
|
+
const { app } = useBetterHtmlContextInternal();
|
|
2302
|
+
const { colorTheme } = (0, import_react_better_core10.useBetterCoreContext)();
|
|
2303
|
+
const dialogRef = (0, import_react11.useRef)(null);
|
|
2304
|
+
const [isOpened, setIsOpened] = (0, import_react11.useState)(false);
|
|
2305
|
+
const [isOpenedLate, setIsOpenedLate] = (0, import_react11.useState)(false);
|
|
2306
|
+
const onClickOpen = (0, import_react11.useCallback)(() => {
|
|
2307
|
+
dialogRef.current?.showModal();
|
|
2308
|
+
setIsOpened(true);
|
|
2309
|
+
setIsOpenedLate(true);
|
|
2310
|
+
if (urlQuery && name) {
|
|
2311
|
+
urlQuery.setQuery(
|
|
2312
|
+
{
|
|
2313
|
+
[`${name}-modal`]: "opened"
|
|
2314
|
+
},
|
|
2315
|
+
false
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
onOpen?.();
|
|
2319
|
+
}, [onOpen, urlQuery, name]);
|
|
2320
|
+
const onClickClose = (0, import_react11.useCallback)(() => {
|
|
2321
|
+
setIsOpened(false);
|
|
2322
|
+
onClose?.();
|
|
2323
|
+
if (urlQuery && name) urlQuery.removeQuery(`${name}-modal`, false);
|
|
2324
|
+
setTimeout(() => {
|
|
2325
|
+
dialogRef.current?.close();
|
|
2326
|
+
setIsOpenedLate(false);
|
|
2327
|
+
}, 0.2 * 1e3);
|
|
2328
|
+
}, [onClose, urlQuery, name]);
|
|
2329
|
+
const onKeyDown = (0, import_react11.useCallback)(
|
|
2330
|
+
(event) => {
|
|
2331
|
+
if (event.key === "Escape") {
|
|
2332
|
+
if (!withoutCloseButton) return;
|
|
2333
|
+
event.preventDefault();
|
|
2334
|
+
}
|
|
2335
|
+
},
|
|
2336
|
+
[withoutCloseButton]
|
|
2337
|
+
);
|
|
2338
|
+
(0, import_react11.useImperativeHandle)(
|
|
2339
|
+
ref,
|
|
2340
|
+
() => {
|
|
2341
|
+
return {
|
|
2342
|
+
open: onClickOpen,
|
|
2343
|
+
close: onClickClose,
|
|
2344
|
+
isOpened
|
|
2345
|
+
};
|
|
2346
|
+
},
|
|
2347
|
+
[onClickOpen, onClickClose, isOpened]
|
|
2348
|
+
);
|
|
2349
|
+
const headerVertical = headerTextAlign === "center";
|
|
2350
|
+
return (0, import_react_dom.createPortal)(
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2352
|
+
DialogStylesElement,
|
|
2353
|
+
{
|
|
2354
|
+
theme: theme2,
|
|
2355
|
+
colorTheme,
|
|
2356
|
+
opacity: !isOpened ? 0 : 1,
|
|
2357
|
+
onClose: onClickClose,
|
|
2358
|
+
onKeyDown,
|
|
2359
|
+
ref: dialogRef,
|
|
2360
|
+
children: isOpenedLate ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2361
|
+
Div_default.column,
|
|
2362
|
+
{
|
|
2363
|
+
position: "relative",
|
|
2364
|
+
width: "100%",
|
|
2365
|
+
maxWidth: maxWidth ?? app.contentMaxWidth / 1.3,
|
|
2366
|
+
minHeight: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
2367
|
+
alignItems: "center",
|
|
2368
|
+
justifyContent: "center",
|
|
2369
|
+
marginBlock: theme2.styles.space,
|
|
2370
|
+
marginInline: "auto",
|
|
2371
|
+
transform: `translateY(${theme2.styles.space}px)`,
|
|
2372
|
+
transition: theme2.styles.transition,
|
|
2373
|
+
animation: isOpened ? "fadeInAnimation 0.2s ease forwards" : "fadeOutAnimation 0.2s ease forwards",
|
|
2374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2375
|
+
Div_default,
|
|
2376
|
+
{
|
|
2377
|
+
position: "relative",
|
|
2378
|
+
width: "100%",
|
|
2379
|
+
minHeight: 32 + theme2.styles.space * 2,
|
|
2380
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
2381
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
2382
|
+
padding: !title ? theme2.styles.space : void 0,
|
|
2383
|
+
overflow,
|
|
2384
|
+
children: [
|
|
2385
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
2386
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2387
|
+
Div_default.row,
|
|
2388
|
+
{
|
|
2389
|
+
alignItems: "center",
|
|
2390
|
+
gap: theme2.styles.gap,
|
|
2391
|
+
backgroundColor: headerBackgroundColor,
|
|
2392
|
+
borderTopLeftRadius: theme2.styles.borderRadius * 2 - 1,
|
|
2393
|
+
borderTopRightRadius: theme2.styles.borderRadius * 2 - 1,
|
|
2394
|
+
paddingInline: theme2.styles.space,
|
|
2395
|
+
paddingBlock: theme2.styles.space,
|
|
2396
|
+
transition: theme2.styles.transition,
|
|
2397
|
+
children: [
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2399
|
+
Div_default.row,
|
|
2400
|
+
{
|
|
2401
|
+
flex: 1,
|
|
2402
|
+
alignItems: "center",
|
|
2403
|
+
gap: headerVertical ? theme2.styles.space * 2 : theme2.styles.space,
|
|
2404
|
+
invertFlexDirection: headerVertical,
|
|
2405
|
+
children: [
|
|
2406
|
+
icon && (headerVertical ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2407
|
+
Div_default.row,
|
|
2408
|
+
{
|
|
2409
|
+
width: 76,
|
|
2410
|
+
height: 76,
|
|
2411
|
+
alignItems: "center",
|
|
2412
|
+
justifyContent: "center",
|
|
2413
|
+
backgroundColor: titleColor ?? theme2.colors.textPrimary,
|
|
2414
|
+
borderRadius: 999,
|
|
2415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2416
|
+
Icon_default,
|
|
2417
|
+
{
|
|
2418
|
+
name: icon,
|
|
2419
|
+
size: 36,
|
|
2420
|
+
color: headerBackgroundColor ?? theme2.colors.backgroundBase,
|
|
2421
|
+
flexShrink: 0
|
|
2422
|
+
}
|
|
2423
|
+
)
|
|
2424
|
+
}
|
|
2425
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2426
|
+
Icon_default,
|
|
2427
|
+
{
|
|
2428
|
+
name: icon,
|
|
2429
|
+
size: 24,
|
|
2430
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
2431
|
+
flexShrink: 0
|
|
2432
|
+
}
|
|
2433
|
+
)),
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
2435
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2436
|
+
Text_default,
|
|
2437
|
+
{
|
|
2438
|
+
as: "h1",
|
|
2439
|
+
textAlign: headerTextAlign,
|
|
2440
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
2441
|
+
transition: theme2.styles.transition,
|
|
2442
|
+
children: title
|
|
2443
|
+
}
|
|
2444
|
+
),
|
|
2445
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2446
|
+
Text_default,
|
|
2447
|
+
{
|
|
2448
|
+
textAlign: headerTextAlign,
|
|
2449
|
+
color: descriptionColor ?? theme2.colors.textSecondary,
|
|
2450
|
+
transition: theme2.styles.transition,
|
|
2451
|
+
children: description
|
|
2452
|
+
}
|
|
2453
|
+
)
|
|
2454
|
+
] })
|
|
2455
|
+
]
|
|
2456
|
+
}
|
|
2457
|
+
),
|
|
2458
|
+
!withoutCloseButton && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2459
|
+
Button_default.icon,
|
|
2460
|
+
{
|
|
2461
|
+
icon: "XMark",
|
|
2462
|
+
marginTop: 1,
|
|
2463
|
+
iconColor: titleColor,
|
|
2464
|
+
onClick: onClickClose,
|
|
2465
|
+
transition: theme2.styles.transition,
|
|
2466
|
+
zIndex: 10
|
|
2467
|
+
}
|
|
2468
|
+
)
|
|
2469
|
+
]
|
|
2470
|
+
}
|
|
2471
|
+
),
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Divider_default.horizontal, {})
|
|
2473
|
+
] }) : /* @__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 }) }) }),
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Div_default, { padding: title ? theme2.styles.space : void 0, children })
|
|
2475
|
+
]
|
|
2476
|
+
}
|
|
2477
|
+
)
|
|
2478
|
+
}
|
|
2479
|
+
) : void 0
|
|
2480
|
+
}
|
|
2481
|
+
),
|
|
2482
|
+
document.body
|
|
2483
|
+
);
|
|
2484
|
+
});
|
|
2485
|
+
ModalComponent.confirmation = (0, import_react11.forwardRef)(function Confirmation({ message, continueButtonText = "Continue", continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
2486
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
2487
|
+
const modalRef = (0, import_react11.useRef)(null);
|
|
2488
|
+
const onCancelElement = (0, import_react11.useCallback)(() => {
|
|
2489
|
+
onCancel?.();
|
|
2490
|
+
modalRef.current?.close();
|
|
2491
|
+
}, [onCancel]);
|
|
2492
|
+
const onContinueElement = (0, import_react11.useCallback)(() => {
|
|
2493
|
+
onContinue?.();
|
|
2494
|
+
modalRef.current?.close();
|
|
2495
|
+
}, [onContinue]);
|
|
2496
|
+
(0, import_react11.useImperativeHandle)(ref, () => modalRef.current, []);
|
|
2497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
2498
|
+
/* @__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." }),
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2500
|
+
Div_default.row,
|
|
2501
|
+
{
|
|
2502
|
+
alignItems: "center",
|
|
2503
|
+
justifyContent: "flex-end",
|
|
2504
|
+
gap: theme2.styles.gap,
|
|
2505
|
+
marginTop: theme2.styles.space * 2,
|
|
2506
|
+
children: [
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default, { text: continueButtonText, loaderName: continueButtonLoaderName, onClick: onContinueElement })
|
|
2509
|
+
]
|
|
2510
|
+
}
|
|
2511
|
+
)
|
|
2512
|
+
] });
|
|
2513
|
+
});
|
|
2514
|
+
ModalComponent.destructive = (0, import_react11.forwardRef)(function Destructive2({
|
|
2515
|
+
message,
|
|
2516
|
+
deleteButtonText = "Delete",
|
|
2517
|
+
deleteButtonIconName = "trash",
|
|
2518
|
+
deleteButtonLoaderName,
|
|
2519
|
+
onDelete,
|
|
2520
|
+
onCancel,
|
|
2521
|
+
...props
|
|
2522
|
+
}, ref) {
|
|
2523
|
+
const theme2 = (0, import_react_better_core10.useTheme)();
|
|
2524
|
+
const modalRef = (0, import_react11.useRef)(null);
|
|
2525
|
+
const onCancelElement = (0, import_react11.useCallback)(() => {
|
|
2526
|
+
onCancel?.();
|
|
2527
|
+
modalRef.current?.close();
|
|
2528
|
+
}, [onCancel]);
|
|
2529
|
+
const onDeleteElement = (0, import_react11.useCallback)(() => {
|
|
2530
|
+
onDelete?.();
|
|
2531
|
+
modalRef.current?.close();
|
|
2532
|
+
}, [onDelete]);
|
|
2533
|
+
(0, import_react11.useImperativeHandle)(ref, () => modalRef.current, []);
|
|
2534
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
2535
|
+
/* @__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." }),
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2537
|
+
Div_default.row,
|
|
2538
|
+
{
|
|
2539
|
+
alignItems: "center",
|
|
2540
|
+
justifyContent: "flex-end",
|
|
2541
|
+
gap: theme2.styles.gap,
|
|
2542
|
+
marginTop: theme2.styles.space * 2,
|
|
2543
|
+
children: [
|
|
2544
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2546
|
+
Button_default.destructive,
|
|
2547
|
+
{
|
|
2548
|
+
icon: deleteButtonIconName,
|
|
2549
|
+
text: deleteButtonText,
|
|
2550
|
+
loaderName: deleteButtonLoaderName,
|
|
2551
|
+
onClick: onDeleteElement
|
|
2552
|
+
}
|
|
2553
|
+
)
|
|
2554
|
+
]
|
|
2555
|
+
}
|
|
2556
|
+
)
|
|
2557
|
+
] });
|
|
2558
|
+
});
|
|
2559
|
+
var Modal2 = (0, import_react11.memo)(ModalComponent);
|
|
2560
|
+
Modal2.confirmation = ModalComponent.confirmation;
|
|
2561
|
+
Modal2.destructive = ModalComponent.destructive;
|
|
2562
|
+
var Modal_default = Modal2;
|
|
2563
|
+
|
|
2564
|
+
// src/components/alerts/Alert.tsx
|
|
2565
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2566
|
+
var StyledDiv2 = import_styled_components8.default.div.withConfig({
|
|
2567
|
+
shouldForwardProp: (prop) => !["theme"].includes(prop)
|
|
2568
|
+
})`
|
|
2569
|
+
@keyframes fadeInFromLeft {
|
|
2570
|
+
from {
|
|
2571
|
+
opacity: 0;
|
|
2572
|
+
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2573
|
+
}
|
|
2574
|
+
to {
|
|
2575
|
+
opacity: 1;
|
|
2576
|
+
transform: translateX(0px);
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
@keyframes fadeInFromRight {
|
|
2581
|
+
from {
|
|
2582
|
+
opacity: 0;
|
|
2583
|
+
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2584
|
+
}
|
|
2585
|
+
to {
|
|
2586
|
+
opacity: 1;
|
|
2587
|
+
transform: translateX(0px);
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
@keyframes fadeInFromTop {
|
|
2592
|
+
from {
|
|
2593
|
+
opacity: 0;
|
|
2594
|
+
transform: translateY(-${(props) => props.theme.styles.space}px);
|
|
2595
|
+
}
|
|
2596
|
+
to {
|
|
2597
|
+
opacity: 1;
|
|
2598
|
+
transform: translateX(0px);
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
@keyframes fadeInFromBottom {
|
|
2603
|
+
from {
|
|
2604
|
+
opacity: 0;
|
|
2605
|
+
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2606
|
+
}
|
|
2607
|
+
to {
|
|
2608
|
+
opacity: 1;
|
|
2609
|
+
transform: translateY(0px);
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
@keyframes fadeOutToLeft {
|
|
2614
|
+
from {
|
|
2615
|
+
opacity: 1;
|
|
2616
|
+
transform: translateX(0px);
|
|
2617
|
+
}
|
|
2618
|
+
to {
|
|
2619
|
+
opacity: 0;
|
|
2620
|
+
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
@keyframes fadeOutToRight {
|
|
2625
|
+
from {
|
|
2626
|
+
opacity: 1;
|
|
2627
|
+
transform: translateX(0px);
|
|
2628
|
+
}
|
|
2629
|
+
to {
|
|
2630
|
+
opacity: 0;
|
|
2631
|
+
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
@keyframes fadeOutToTop {
|
|
2636
|
+
from {
|
|
2637
|
+
opacity: 1;
|
|
2638
|
+
transform: translateY(0px);
|
|
2639
|
+
}
|
|
2292
2640
|
to {
|
|
2293
2641
|
opacity: 0;
|
|
2294
2642
|
transform: translateY(-${(props) => props.theme.styles.space}px);
|
|
@@ -2327,22 +2675,23 @@ var getAlertDurationFromAuto = (duration, alert) => {
|
|
|
2327
2675
|
return duration;
|
|
2328
2676
|
};
|
|
2329
2677
|
function Alert2({ alert }) {
|
|
2330
|
-
const
|
|
2678
|
+
const theme2 = (0, import_react_better_core11.useTheme)();
|
|
2331
2679
|
const alertControls2 = useAlertControls();
|
|
2332
2680
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2333
2681
|
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
2682
|
+
const modalRef = (0, import_react12.useRef)(null);
|
|
2334
2683
|
const defaultAlertDurationNumber = getAlertDurationFromAuto(
|
|
2335
2684
|
alert.duration ?? pluginConfig.defaultDuration ?? defaultAlertsPluginOptions.defaultDuration,
|
|
2336
2685
|
alert
|
|
2337
2686
|
);
|
|
2338
|
-
const intervalRef = (0,
|
|
2339
|
-
const startTimeRef = (0,
|
|
2340
|
-
const remainingTimeRef = (0,
|
|
2341
|
-
const calledOnCloseRef = (0,
|
|
2342
|
-
const [isPaused, setIsPaused] = (0,
|
|
2343
|
-
const [progress, setProgress] = (0,
|
|
2344
|
-
const [isRemoved, setIsRemoved] = (0,
|
|
2345
|
-
const startProgressTimer = (0,
|
|
2687
|
+
const intervalRef = (0, import_react12.useRef)(void 0);
|
|
2688
|
+
const startTimeRef = (0, import_react12.useRef)(Date.now());
|
|
2689
|
+
const remainingTimeRef = (0, import_react12.useRef)(defaultAlertDurationNumber);
|
|
2690
|
+
const calledOnCloseRef = (0, import_react12.useRef)(false);
|
|
2691
|
+
const [isPaused, setIsPaused] = (0, import_react12.useState)(false);
|
|
2692
|
+
const [progress, setProgress] = (0, import_react12.useState)(100);
|
|
2693
|
+
const [isRemoved, setIsRemoved] = (0, import_react12.useState)(false);
|
|
2694
|
+
const startProgressTimer = (0, import_react12.useCallback)(() => {
|
|
2346
2695
|
if (intervalRef.current) {
|
|
2347
2696
|
clearInterval(intervalRef.current);
|
|
2348
2697
|
}
|
|
@@ -2354,6 +2703,7 @@ function Alert2({ alert }) {
|
|
|
2354
2703
|
setProgress(newProgress);
|
|
2355
2704
|
if (newProgress <= 0) {
|
|
2356
2705
|
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
2706
|
+
if (alert.display === "prominent") return;
|
|
2357
2707
|
setIsRemoved(true);
|
|
2358
2708
|
setTimeout(() => {
|
|
2359
2709
|
alertControls2.removeAlert(alert.id);
|
|
@@ -2365,7 +2715,7 @@ function Alert2({ alert }) {
|
|
|
2365
2715
|
}
|
|
2366
2716
|
}, updateInterval);
|
|
2367
2717
|
}, [alert, progress]);
|
|
2368
|
-
const onClickCloseAlert = (0,
|
|
2718
|
+
const onClickCloseAlert = (0, import_react12.useCallback)(() => {
|
|
2369
2719
|
setIsRemoved(true);
|
|
2370
2720
|
setTimeout(() => {
|
|
2371
2721
|
alertControls2.removeAlert(alert.id);
|
|
@@ -2375,7 +2725,7 @@ function Alert2({ alert }) {
|
|
|
2375
2725
|
}
|
|
2376
2726
|
}, 0.2 * 1e3 - 10);
|
|
2377
2727
|
}, [alert]);
|
|
2378
|
-
const onMouseEnter = (0,
|
|
2728
|
+
const onMouseEnter = (0, import_react12.useCallback)(() => {
|
|
2379
2729
|
setIsPaused(true);
|
|
2380
2730
|
if (intervalRef.current) {
|
|
2381
2731
|
clearInterval(intervalRef.current);
|
|
@@ -2383,36 +2733,54 @@ function Alert2({ alert }) {
|
|
|
2383
2733
|
}
|
|
2384
2734
|
remainingTimeRef.current = defaultAlertDurationNumber * (progress / 100);
|
|
2385
2735
|
}, [defaultAlertDurationNumber, progress]);
|
|
2386
|
-
const onMouseLeave = (0,
|
|
2736
|
+
const onMouseLeave = (0, import_react12.useCallback)(() => {
|
|
2387
2737
|
setIsPaused(false);
|
|
2388
2738
|
startProgressTimer();
|
|
2389
2739
|
}, [startProgressTimer]);
|
|
2390
|
-
const
|
|
2740
|
+
const onClickAlertModalDone = (0, import_react12.useCallback)(() => {
|
|
2741
|
+
setIsRemoved(true);
|
|
2742
|
+
modalRef.current?.close();
|
|
2743
|
+
setTimeout(() => {
|
|
2744
|
+
alertControls2.removeAlert(alert.id);
|
|
2745
|
+
if (!calledOnCloseRef.current) {
|
|
2746
|
+
alert.onClose?.(alert);
|
|
2747
|
+
calledOnCloseRef.current = true;
|
|
2748
|
+
}
|
|
2749
|
+
}, 0.2 * 1e3 - 10);
|
|
2750
|
+
}, [alert]);
|
|
2751
|
+
const alertData = (0, import_react12.useMemo)(
|
|
2391
2752
|
() => ({
|
|
2392
2753
|
info: {
|
|
2393
2754
|
icon: "infoI",
|
|
2394
|
-
backgroundColor:
|
|
2755
|
+
backgroundColor: theme2.colors.info,
|
|
2395
2756
|
title: "Info"
|
|
2396
2757
|
},
|
|
2397
2758
|
success: {
|
|
2398
2759
|
icon: "check",
|
|
2399
|
-
backgroundColor:
|
|
2760
|
+
backgroundColor: theme2.colors.success,
|
|
2400
2761
|
title: "Success"
|
|
2401
2762
|
},
|
|
2402
2763
|
warning: {
|
|
2403
2764
|
icon: "warningTriangle",
|
|
2404
|
-
backgroundColor:
|
|
2765
|
+
backgroundColor: theme2.colors.warn,
|
|
2405
2766
|
title: "Warning"
|
|
2406
2767
|
},
|
|
2407
2768
|
error: {
|
|
2408
2769
|
icon: "XMark",
|
|
2409
|
-
backgroundColor:
|
|
2770
|
+
backgroundColor: theme2.colors.error,
|
|
2410
2771
|
title: "Error"
|
|
2411
2772
|
}
|
|
2412
2773
|
}),
|
|
2413
|
-
[
|
|
2774
|
+
[theme2]
|
|
2414
2775
|
);
|
|
2415
|
-
(0,
|
|
2776
|
+
(0, import_react12.useEffect)(() => {
|
|
2777
|
+
if (alert.display === "prominent") {
|
|
2778
|
+
setTimeout(() => {
|
|
2779
|
+
modalRef.current?.open();
|
|
2780
|
+
}, 0.1 * 1e3);
|
|
2781
|
+
}
|
|
2782
|
+
}, []);
|
|
2783
|
+
(0, import_react12.useEffect)(() => {
|
|
2416
2784
|
startTimeRef.current = Date.now();
|
|
2417
2785
|
remainingTimeRef.current = defaultAlertDurationNumber;
|
|
2418
2786
|
startProgressTimer();
|
|
@@ -2420,8 +2788,30 @@ 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 alert.display === "prominent" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2794
|
+
Modal_default,
|
|
2795
|
+
{
|
|
2796
|
+
icon: alertData[alert.type].icon,
|
|
2797
|
+
title: alertTitle,
|
|
2798
|
+
description: alert.message,
|
|
2799
|
+
titleColor: theme2.colors.base,
|
|
2800
|
+
descriptionColor: theme2.colors.base + "a0",
|
|
2801
|
+
headerTextAlign: "center",
|
|
2802
|
+
headerBackgroundColor: alertData[alert.type].backgroundColor,
|
|
2803
|
+
withoutCloseButton: true,
|
|
2804
|
+
ref: modalRef,
|
|
2805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default.row, { width: "100%", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2806
|
+
Button_default,
|
|
2807
|
+
{
|
|
2808
|
+
text: "Close",
|
|
2809
|
+
backgroundColor: alertData[alert.type].backgroundColor,
|
|
2810
|
+
onClick: onClickAlertModalDone
|
|
2811
|
+
}
|
|
2812
|
+
) })
|
|
2813
|
+
}
|
|
2814
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(StyledDiv2, { theme: theme2, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2425
2815
|
Div_default.box,
|
|
2426
2816
|
{
|
|
2427
2817
|
width: "fit-content",
|
|
@@ -2432,9 +2822,9 @@ function Alert2({ alert }) {
|
|
|
2432
2822
|
onMouseMove: onMouseEnter,
|
|
2433
2823
|
onMouseLeave,
|
|
2434
2824
|
animation,
|
|
2435
|
-
children: /* @__PURE__ */ (0,
|
|
2436
|
-
/* @__PURE__ */ (0,
|
|
2437
|
-
/* @__PURE__ */ (0,
|
|
2825
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.column, { gap: theme2.styles.space, children: [
|
|
2826
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2438
2828
|
Div_default.row,
|
|
2439
2829
|
{
|
|
2440
2830
|
width: 36,
|
|
@@ -2443,32 +2833,32 @@ function Alert2({ alert }) {
|
|
|
2443
2833
|
justifyContent: "center",
|
|
2444
2834
|
backgroundColor: alertData[alert.type].backgroundColor,
|
|
2445
2835
|
borderRadius: 999,
|
|
2446
|
-
marginTop:
|
|
2447
|
-
children: /* @__PURE__ */ (0,
|
|
2836
|
+
marginTop: theme2.styles.gap / 2,
|
|
2837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2448
2838
|
Icon_default,
|
|
2449
2839
|
{
|
|
2450
2840
|
name: alertData[alert.type].icon,
|
|
2451
2841
|
size: 18,
|
|
2452
|
-
color: alertData[alert.type].iconColor ??
|
|
2842
|
+
color: alertData[alert.type].iconColor ?? theme2.colors.base
|
|
2453
2843
|
}
|
|
2454
2844
|
)
|
|
2455
2845
|
}
|
|
2456
2846
|
),
|
|
2457
|
-
/* @__PURE__ */ (0,
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2459
|
-
/* @__PURE__ */ (0,
|
|
2847
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
2848
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { fontSize: 18, fontWeight: 700, children: alertTitle }),
|
|
2849
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Text_default, { color: theme2.colors.textSecondary, children: alert.message })
|
|
2460
2850
|
] }),
|
|
2461
|
-
pluginConfig.withCloseButton && /* @__PURE__ */ (0,
|
|
2851
|
+
pluginConfig.withCloseButton && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button_default.icon, { icon: "XMark", alignSelf: "flex-start", onClick: onClickCloseAlert })
|
|
2462
2852
|
] }),
|
|
2463
|
-
pluginConfig.withLoaderBar && /* @__PURE__ */ (0,
|
|
2853
|
+
pluginConfig.withLoaderBar && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2464
2854
|
Div_default,
|
|
2465
2855
|
{
|
|
2466
2856
|
width: "100%",
|
|
2467
2857
|
height: 5,
|
|
2468
|
-
backgroundColor:
|
|
2858
|
+
backgroundColor: theme2.colors.backgroundBase,
|
|
2469
2859
|
borderRadius: 999,
|
|
2470
2860
|
overflow: "hidden",
|
|
2471
|
-
children: /* @__PURE__ */ (0,
|
|
2861
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2472
2862
|
Div_default,
|
|
2473
2863
|
{
|
|
2474
2864
|
width: `${progress}%`,
|
|
@@ -2484,20 +2874,20 @@ function Alert2({ alert }) {
|
|
|
2484
2874
|
}
|
|
2485
2875
|
) });
|
|
2486
2876
|
}
|
|
2487
|
-
var Alert_default = (0,
|
|
2877
|
+
var Alert_default = (0, import_react12.memo)(Alert2);
|
|
2488
2878
|
|
|
2489
2879
|
// src/components/alerts/AlertsHolder.tsx
|
|
2490
|
-
var
|
|
2880
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2491
2881
|
function AlertsHolder() {
|
|
2492
|
-
const
|
|
2882
|
+
const theme2 = (0, import_react_better_core12.useTheme)();
|
|
2493
2883
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2494
2884
|
const { alerts } = useBetterHtmlContextInternal();
|
|
2495
2885
|
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,
|
|
2886
|
+
const top = pluginConfig.position === "top" ? theme2.styles.gap : void 0;
|
|
2887
|
+
const bottom = pluginConfig.position === "bottom" ? theme2.styles.gap : void 0;
|
|
2888
|
+
const left = pluginConfig.align === "left" ? theme2.styles.space : pluginConfig.align === "center" ? "50%" : void 0;
|
|
2889
|
+
const right = pluginConfig.align === "right" ? theme2.styles.space : void 0;
|
|
2890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2501
2891
|
Div_default.column,
|
|
2502
2892
|
{
|
|
2503
2893
|
position: "fixed",
|
|
@@ -2505,19 +2895,19 @@ function AlertsHolder() {
|
|
|
2505
2895
|
bottom,
|
|
2506
2896
|
left,
|
|
2507
2897
|
right,
|
|
2508
|
-
gap:
|
|
2898
|
+
gap: theme2.styles.gap,
|
|
2509
2899
|
alignItems: pluginConfig.align === "center" ? "center" : pluginConfig.align === "right" ? "flex-end" : void 0,
|
|
2510
2900
|
transform: pluginConfig.align === "center" ? "translateX(-50%)" : void 0,
|
|
2511
2901
|
zIndex: 1e3,
|
|
2512
|
-
children: alerts.map((alert) => /* @__PURE__ */ (0,
|
|
2902
|
+
children: alerts.map((alert) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Alert_default, { alert }, alert.id))
|
|
2513
2903
|
}
|
|
2514
2904
|
);
|
|
2515
2905
|
}
|
|
2516
|
-
var AlertsHolder_default = (0,
|
|
2906
|
+
var AlertsHolder_default = (0, import_react13.memo)(AlertsHolder);
|
|
2517
2907
|
|
|
2518
2908
|
// src/components/BetterHtmlProvider.tsx
|
|
2519
|
-
var
|
|
2520
|
-
var GlobalStyle =
|
|
2909
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2910
|
+
var GlobalStyle = import_styled_components9.createGlobalStyle`
|
|
2521
2911
|
html {
|
|
2522
2912
|
background-color: ${(props) => props.backgroundColor};
|
|
2523
2913
|
}
|
|
@@ -2544,12 +2934,12 @@ var GlobalStyle = import_styled_components8.createGlobalStyle`
|
|
|
2544
2934
|
display: none;
|
|
2545
2935
|
}
|
|
2546
2936
|
`;
|
|
2547
|
-
var betterHtmlContext = (0,
|
|
2937
|
+
var betterHtmlContext = (0, import_react14.createContext)(void 0);
|
|
2548
2938
|
var externalBetterCoreContextValue;
|
|
2549
2939
|
var externalBetterHtmlContextValue;
|
|
2550
2940
|
var useBetterHtmlContext = () => {
|
|
2551
|
-
const coreContext = (0,
|
|
2552
|
-
const context = (0,
|
|
2941
|
+
const coreContext = (0, import_react_better_core13.useBetterCoreContext)();
|
|
2942
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2553
2943
|
if (context === void 0)
|
|
2554
2944
|
throw new Error(
|
|
2555
2945
|
"`useBetterHtmlContext()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
@@ -2561,7 +2951,7 @@ var useBetterHtmlContext = () => {
|
|
|
2561
2951
|
};
|
|
2562
2952
|
};
|
|
2563
2953
|
var useBetterHtmlContextInternal = () => {
|
|
2564
|
-
const context = (0,
|
|
2954
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2565
2955
|
if (context === void 0)
|
|
2566
2956
|
throw new Error(
|
|
2567
2957
|
"`useBetterHtmlContextInternal()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
@@ -2569,12 +2959,12 @@ var useBetterHtmlContextInternal = () => {
|
|
|
2569
2959
|
return context;
|
|
2570
2960
|
};
|
|
2571
2961
|
var useAlertControls = () => {
|
|
2572
|
-
const context = (0,
|
|
2962
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2573
2963
|
if (context === void 0)
|
|
2574
2964
|
throw new Error(
|
|
2575
2965
|
"`useAlertControls()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
2576
2966
|
);
|
|
2577
|
-
const createAlert = (0,
|
|
2967
|
+
const createAlert = (0, import_react14.useCallback)((alert) => {
|
|
2578
2968
|
const readyAlert = {
|
|
2579
2969
|
id: crypto.randomUUID(),
|
|
2580
2970
|
...alert
|
|
@@ -2582,7 +2972,7 @@ var useAlertControls = () => {
|
|
|
2582
2972
|
context.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
2583
2973
|
return readyAlert;
|
|
2584
2974
|
}, []);
|
|
2585
|
-
const removeAlert = (0,
|
|
2975
|
+
const removeAlert = (0, import_react14.useCallback)((alertId) => {
|
|
2586
2976
|
context.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
2587
2977
|
}, []);
|
|
2588
2978
|
return {
|
|
@@ -2591,41 +2981,41 @@ var useAlertControls = () => {
|
|
|
2591
2981
|
};
|
|
2592
2982
|
};
|
|
2593
2983
|
var usePlugin = (pluginName) => {
|
|
2594
|
-
const context = (0,
|
|
2984
|
+
const context = (0, import_react14.useContext)(betterHtmlContext);
|
|
2595
2985
|
if (context === void 0) {
|
|
2596
2986
|
throw new Error(
|
|
2597
2987
|
"`usePlugin()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
2598
2988
|
);
|
|
2599
2989
|
}
|
|
2600
|
-
return (0,
|
|
2990
|
+
return (0, import_react14.useMemo)(
|
|
2601
2991
|
() => context.plugins.find((plugin) => plugin.name === pluginName),
|
|
2602
2992
|
[context.plugins, pluginName]
|
|
2603
2993
|
);
|
|
2604
2994
|
};
|
|
2605
2995
|
function BetterHtmlProviderInternalContent({ children }) {
|
|
2606
|
-
const
|
|
2996
|
+
const theme2 = (0, import_react_better_core13.useTheme)();
|
|
2607
2997
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2608
|
-
return /* @__PURE__ */ (0,
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2999
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2610
3000
|
GlobalStyle,
|
|
2611
3001
|
{
|
|
2612
|
-
fontFamily:
|
|
2613
|
-
color:
|
|
2614
|
-
backgroundColor:
|
|
3002
|
+
fontFamily: theme2.styles.fontFamily,
|
|
3003
|
+
color: theme2.colors.textPrimary,
|
|
3004
|
+
backgroundColor: theme2.colors.backgroundBase
|
|
2615
3005
|
}
|
|
2616
3006
|
),
|
|
2617
3007
|
children,
|
|
2618
|
-
alertsPlugin2 && /* @__PURE__ */ (0,
|
|
3008
|
+
alertsPlugin2 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AlertsHolder_default, {})
|
|
2619
3009
|
] });
|
|
2620
3010
|
}
|
|
2621
3011
|
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,
|
|
3012
|
+
const betterCoreContext = (0, import_react_better_core13.useBetterCoreContext)();
|
|
3013
|
+
const [alerts, setAlerts] = (0, import_react14.useState)([]);
|
|
3014
|
+
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = (0, import_react_better_core13.useBooleanState)();
|
|
3015
|
+
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = (0, import_react_better_core13.useBooleanState)();
|
|
3016
|
+
const [tabGroups, setTabGroups] = (0, import_react14.useState)([]);
|
|
3017
|
+
const [tabsWithDots, setTabsWithDots] = (0, import_react14.useState)([]);
|
|
3018
|
+
const readyConfig = (0, import_react14.useMemo)(
|
|
2629
3019
|
() => ({
|
|
2630
3020
|
app: {
|
|
2631
3021
|
...appConfig,
|
|
@@ -2652,7 +3042,7 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
2652
3042
|
}),
|
|
2653
3043
|
[config, alerts, sideMenuIsCollapsed, sideMenuIsOpenMobile, plugins, tabGroups, tabsWithDots]
|
|
2654
3044
|
);
|
|
2655
|
-
(0,
|
|
3045
|
+
(0, import_react14.useEffect)(() => {
|
|
2656
3046
|
if (!plugins) return;
|
|
2657
3047
|
plugins.forEach((plugin) => {
|
|
2658
3048
|
plugin.initialize?.();
|
|
@@ -2660,12 +3050,15 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
2660
3050
|
}, []);
|
|
2661
3051
|
externalBetterCoreContextValue = betterCoreContext;
|
|
2662
3052
|
externalBetterHtmlContextValue = readyConfig;
|
|
2663
|
-
return /* @__PURE__ */ (0,
|
|
3053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(betterHtmlContext.Provider, { value: readyConfig, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(BetterHtmlProviderInternalContent, { children }) });
|
|
2664
3054
|
}
|
|
2665
3055
|
function BetterHtmlProvider({ config, ...props }) {
|
|
2666
|
-
const coreConfig = (0,
|
|
3056
|
+
const coreConfig = (0, import_react14.useMemo)(
|
|
2667
3057
|
() => ({
|
|
2668
|
-
theme:
|
|
3058
|
+
theme: {
|
|
3059
|
+
...theme,
|
|
3060
|
+
...config?.theme
|
|
3061
|
+
},
|
|
2669
3062
|
colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
2670
3063
|
icons: {
|
|
2671
3064
|
...icons,
|
|
@@ -2679,7 +3072,7 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2679
3072
|
}),
|
|
2680
3073
|
[config]
|
|
2681
3074
|
);
|
|
2682
|
-
const htmlConfig = (0,
|
|
3075
|
+
const htmlConfig = (0, import_react14.useMemo)(
|
|
2683
3076
|
() => ({
|
|
2684
3077
|
app: config?.app,
|
|
2685
3078
|
sideMenuIsCollapsed: config?.sideMenuIsCollapsed,
|
|
@@ -2688,7 +3081,7 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2688
3081
|
}),
|
|
2689
3082
|
[config]
|
|
2690
3083
|
);
|
|
2691
|
-
(0,
|
|
3084
|
+
(0, import_react14.useEffect)(() => {
|
|
2692
3085
|
const html = document.querySelector("html");
|
|
2693
3086
|
if (!html) return;
|
|
2694
3087
|
html.setAttribute("data-theme", localStorage.getItem("theme") === "dark" ? "dark" : "light");
|
|
@@ -2696,7 +3089,7 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2696
3089
|
mutations.forEach((mutation) => {
|
|
2697
3090
|
if (mutation.type === "attributes") {
|
|
2698
3091
|
const newColorTheme = html.getAttribute("data-theme") === "dark" ? "dark" : "light";
|
|
2699
|
-
|
|
3092
|
+
import_react_better_core13.colorThemeControls.toggleTheme(newColorTheme);
|
|
2700
3093
|
localStorage.setItem("theme", newColorTheme);
|
|
2701
3094
|
}
|
|
2702
3095
|
});
|
|
@@ -2709,9 +3102,9 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2709
3102
|
observer.disconnect();
|
|
2710
3103
|
};
|
|
2711
3104
|
}, []);
|
|
2712
|
-
return /* @__PURE__ */ (0,
|
|
3105
|
+
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
3106
|
}
|
|
2714
|
-
var BetterHtmlProvider_default = (0,
|
|
3107
|
+
var BetterHtmlProvider_default = (0, import_react14.memo)(BetterHtmlProvider);
|
|
2715
3108
|
|
|
2716
3109
|
// src/utils/functions.ts
|
|
2717
3110
|
var import_crypto_js = __toESM(require("crypto-js"));
|
|
@@ -2898,297 +3291,12 @@ function generateLocalStorage() {
|
|
|
2898
3291
|
};
|
|
2899
3292
|
}
|
|
2900
3293
|
|
|
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
3294
|
// src/components/PageHolder.tsx
|
|
3187
3295
|
var import_react15 = require("react");
|
|
3188
3296
|
var import_react_better_core14 = require("react-better-core");
|
|
3189
3297
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3190
3298
|
var PageHolderComponent = (0, import_react15.forwardRef)(function PageHolder({ noMaxContentWidth, children, ...props }, ref) {
|
|
3191
|
-
const
|
|
3299
|
+
const theme2 = (0, import_react_better_core14.useTheme)();
|
|
3192
3300
|
const { app } = useBetterHtmlContextInternal();
|
|
3193
3301
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3194
3302
|
Div_default,
|
|
@@ -3197,7 +3305,7 @@ var PageHolderComponent = (0, import_react15.forwardRef)(function PageHolder({ n
|
|
|
3197
3305
|
width: "100%",
|
|
3198
3306
|
maxWidth: !noMaxContentWidth ? app.contentMaxWidth : void 0,
|
|
3199
3307
|
margin: "0px auto",
|
|
3200
|
-
padding:
|
|
3308
|
+
padding: theme2.styles.space,
|
|
3201
3309
|
...props,
|
|
3202
3310
|
ref,
|
|
3203
3311
|
children
|
|
@@ -3216,7 +3324,7 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3216
3324
|
children,
|
|
3217
3325
|
...props
|
|
3218
3326
|
}, ref) {
|
|
3219
|
-
const
|
|
3327
|
+
const theme2 = (0, import_react_better_core14.useTheme)();
|
|
3220
3328
|
const mediaQuery = useMediaQuery();
|
|
3221
3329
|
const { app } = useBetterHtmlContextInternal();
|
|
3222
3330
|
const breakingPoint = mediaQuery.size1000;
|
|
@@ -3250,10 +3358,10 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
|
|
|
3250
3358
|
/* @__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
3359
|
ContentTag,
|
|
3252
3360
|
{
|
|
3253
|
-
width: `calc(100% - ${
|
|
3361
|
+
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3254
3362
|
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3255
|
-
marginInline:
|
|
3256
|
-
marginBlock:
|
|
3363
|
+
marginInline: theme2.styles.space,
|
|
3364
|
+
marginBlock: theme2.styles.space,
|
|
3257
3365
|
...props,
|
|
3258
3366
|
ref,
|
|
3259
3367
|
children
|
|
@@ -3296,7 +3404,7 @@ var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
|
3296
3404
|
onClickWithValue,
|
|
3297
3405
|
...props
|
|
3298
3406
|
}, ref) {
|
|
3299
|
-
const
|
|
3407
|
+
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
3300
3408
|
const onClickElement = (0, import_react16.useCallback)(
|
|
3301
3409
|
(event) => {
|
|
3302
3410
|
onClick?.(event);
|
|
@@ -3308,23 +3416,23 @@ var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
|
3308
3416
|
Div_default,
|
|
3309
3417
|
{
|
|
3310
3418
|
width: "fit-content",
|
|
3311
|
-
backgroundColor: backgroundColor ??
|
|
3312
|
-
borderRadius: isCircle ? 999 : borderRadius ??
|
|
3313
|
-
paddingBlock:
|
|
3314
|
-
paddingInline:
|
|
3419
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
3420
|
+
borderRadius: isCircle ? 999 : borderRadius ?? theme2.styles.borderRadius / borderRadiusOffset,
|
|
3421
|
+
paddingBlock: theme2.styles.gap / 2,
|
|
3422
|
+
paddingInline: theme2.styles.space / 1.5,
|
|
3315
3423
|
filterHover: onClick || onClickWithValue ? filterHover().z1 : void 0,
|
|
3316
3424
|
onClick: onClickElement,
|
|
3317
3425
|
cursor: onClick || onClickWithValue ? "pointer" : void 0,
|
|
3318
3426
|
...props,
|
|
3319
3427
|
ref,
|
|
3320
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { color: color ??
|
|
3428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { color: color ?? theme2.colors.textPrimary, children: text })
|
|
3321
3429
|
}
|
|
3322
3430
|
);
|
|
3323
3431
|
});
|
|
3324
3432
|
ChipComponent.colored = (0, import_react16.forwardRef)(function Colored({ color, withWhiteBackground, ...props }, ref) {
|
|
3325
|
-
const
|
|
3433
|
+
const theme2 = (0, import_react_better_core15.useTheme)();
|
|
3326
3434
|
const { colorTheme } = (0, import_react_better_core15.useBetterCoreContext)();
|
|
3327
|
-
const readyColor = color ??
|
|
3435
|
+
const readyColor = color ?? theme2.colors.textSecondary;
|
|
3328
3436
|
const chip = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3329
3437
|
ChipComponent,
|
|
3330
3438
|
{
|
|
@@ -3340,7 +3448,7 @@ ChipComponent.colored = (0, import_react16.forwardRef)(function Colored({ color,
|
|
|
3340
3448
|
{
|
|
3341
3449
|
width: "fit-content",
|
|
3342
3450
|
backgroundColor: withWhiteBackground ? colorTheme === "light" ? "#ffffff" : "#000000" : void 0,
|
|
3343
|
-
borderRadius: withWhiteBackground ? props.borderRadius ??
|
|
3451
|
+
borderRadius: withWhiteBackground ? props.borderRadius ?? theme2.styles.borderRadius / borderRadiusOffset + 0.3 : void 0,
|
|
3344
3452
|
children: chip
|
|
3345
3453
|
}
|
|
3346
3454
|
) : chip;
|
|
@@ -3359,7 +3467,7 @@ var import_react17 = require("react");
|
|
|
3359
3467
|
var import_react_better_core16 = require("react-better-core");
|
|
3360
3468
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3361
3469
|
function Label({ text, required, isError, color, htmlFor }) {
|
|
3362
|
-
const
|
|
3470
|
+
const theme2 = (0, import_react_better_core16.useTheme)();
|
|
3363
3471
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3364
3472
|
Text_default,
|
|
3365
3473
|
{
|
|
@@ -3367,12 +3475,12 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
3367
3475
|
width: "fit-content",
|
|
3368
3476
|
height: 16,
|
|
3369
3477
|
fontSize: 14,
|
|
3370
|
-
color: isError ?
|
|
3478
|
+
color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
|
|
3371
3479
|
htmlFor,
|
|
3372
3480
|
"aria-required": required,
|
|
3373
3481
|
children: [
|
|
3374
3482
|
text,
|
|
3375
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
3483
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
3376
3484
|
" ",
|
|
3377
3485
|
"*"
|
|
3378
3486
|
] })
|
|
@@ -3416,7 +3524,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3416
3524
|
id,
|
|
3417
3525
|
...props
|
|
3418
3526
|
}, ref) {
|
|
3419
|
-
const
|
|
3527
|
+
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3420
3528
|
const inputFieldHolderRef = (0, import_react18.useRef)(null);
|
|
3421
3529
|
const buttonsRef = (0, import_react18.useRef)(null);
|
|
3422
3530
|
const inputRef = (0, import_react18.useRef)(null);
|
|
@@ -3546,12 +3654,12 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3546
3654
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3547
3655
|
Div_default,
|
|
3548
3656
|
{
|
|
3549
|
-
color: isDisabled ?
|
|
3550
|
-
backgroundColor: isSelected ?
|
|
3657
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
3658
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
3551
3659
|
filter: isFocused2 ? isDisabled ? "brightness(0.95)" : "brightness(0.9)" : void 0,
|
|
3552
3660
|
filterHover: focusedOptionIndex === void 0 && !isDisabled ? "brightness(0.9)" : void 0,
|
|
3553
3661
|
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
3554
|
-
padding: `${
|
|
3662
|
+
padding: `${theme2.styles.gap}px ${theme2.styles.space}px`,
|
|
3555
3663
|
value: option,
|
|
3556
3664
|
onClickWithValue: onClickOption,
|
|
3557
3665
|
onMouseMove: () => setFocusedOptionIndex(void 0),
|
|
@@ -3575,7 +3683,7 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3575
3683
|
filteredOptions,
|
|
3576
3684
|
value,
|
|
3577
3685
|
focusedOptionIndex,
|
|
3578
|
-
|
|
3686
|
+
theme2.colors,
|
|
3579
3687
|
onClickOption,
|
|
3580
3688
|
renderOption,
|
|
3581
3689
|
renderOptionDivider
|
|
@@ -3647,16 +3755,16 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3647
3755
|
Div_default,
|
|
3648
3756
|
{
|
|
3649
3757
|
width: "100%",
|
|
3650
|
-
backgroundColor:
|
|
3651
|
-
border: `solid 1px ${
|
|
3652
|
-
borderColor: isFocused ?
|
|
3758
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
3759
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
3760
|
+
borderColor: isFocused ? theme2.colors.primary : void 0,
|
|
3653
3761
|
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:
|
|
3762
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
3763
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
3764
|
+
paddingBlock: theme2.styles.gap,
|
|
3765
|
+
paddingInline: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
3766
|
+
transition: theme2.styles.transition,
|
|
3767
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default.row, { width: "100%", flexWrap: "wrap", gap: theme2.styles.gap, children: selectedOption.map((option) => {
|
|
3660
3768
|
const ChipComponentTag = !option.renderType || option.renderType === "default" || option.renderType === "chip" ? Chip_default : option.renderType === "chip.colored" ? Chip_default.colored : Chip_default;
|
|
3661
3769
|
return /* @__PURE__ */ (0, import_react19.createElement)(
|
|
3662
3770
|
ChipComponentTag,
|
|
@@ -3679,21 +3787,21 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3679
3787
|
left: 0,
|
|
3680
3788
|
width: "100%",
|
|
3681
3789
|
maxHeight: 300,
|
|
3682
|
-
backgroundColor:
|
|
3683
|
-
border: `1px solid ${isFocused ?
|
|
3790
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
3791
|
+
border: `1px solid ${isFocused ? theme2.colors.primary : theme2.colors.border}`,
|
|
3684
3792
|
borderTop: "none",
|
|
3685
|
-
borderBottomLeftRadius:
|
|
3686
|
-
borderBottomRightRadius:
|
|
3793
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
3794
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
3687
3795
|
boxShadow: "0px 10px 20px #00000020",
|
|
3688
3796
|
zIndex: 1e3,
|
|
3689
3797
|
overflowY: "auto",
|
|
3690
3798
|
opacity: !isOpen ? 0 : void 0,
|
|
3691
3799
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
3692
3800
|
transform: `translateY(${!isOpen ? -10 : 0}px)`,
|
|
3693
|
-
transition:
|
|
3801
|
+
transition: theme2.styles.transition,
|
|
3694
3802
|
role: "listbox",
|
|
3695
3803
|
"aria-label": label,
|
|
3696
|
-
children: isLoadingDebouncedSearchQuery || debounceIsLoading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Div_default, { padding: `${
|
|
3804
|
+
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
3805
|
}
|
|
3698
3806
|
),
|
|
3699
3807
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
@@ -3701,9 +3809,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3701
3809
|
{
|
|
3702
3810
|
position: "absolute",
|
|
3703
3811
|
top: 46 / 2,
|
|
3704
|
-
right:
|
|
3812
|
+
right: theme2.styles.space + 1,
|
|
3705
3813
|
alignItems: "center",
|
|
3706
|
-
gap:
|
|
3814
|
+
gap: theme2.styles.gap,
|
|
3707
3815
|
transform: "translateY(-50%)",
|
|
3708
3816
|
pointerEvents: "none",
|
|
3709
3817
|
filter: disabled ? "brightness(0.9)" : void 0,
|
|
@@ -3730,9 +3838,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3730
3838
|
name: "chevronDown",
|
|
3731
3839
|
position: "relative",
|
|
3732
3840
|
size: 16,
|
|
3733
|
-
color:
|
|
3841
|
+
color: theme2.colors.textSecondary,
|
|
3734
3842
|
transform: `rotate(${isOpen ? 180 : 0}deg)`,
|
|
3735
|
-
transition:
|
|
3843
|
+
transition: theme2.styles.transition,
|
|
3736
3844
|
pointerEvents: "none",
|
|
3737
3845
|
"aria-hidden": true
|
|
3738
3846
|
}
|
|
@@ -3753,9 +3861,9 @@ var DropdownComponent = (0, import_react18.forwardRef)(function Dropdown({
|
|
|
3753
3861
|
) });
|
|
3754
3862
|
});
|
|
3755
3863
|
DropdownComponent.countries = (0, import_react18.forwardRef)(function Countries({ ...props }, ref) {
|
|
3756
|
-
const
|
|
3864
|
+
const theme2 = (0, import_react_better_core17.useTheme)();
|
|
3757
3865
|
const renderOption = (0, import_react18.useCallback)(
|
|
3758
|
-
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
3866
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
3759
3867
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
3760
3868
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { children: option.label })
|
|
3761
3869
|
] }),
|
|
@@ -3842,7 +3950,7 @@ var SelectComponent = import_styled_components10.default.select.withConfig({
|
|
|
3842
3950
|
opacity: 0;
|
|
3843
3951
|
`;
|
|
3844
3952
|
function Calendar({ value, minDate, maxDate, onChange }) {
|
|
3845
|
-
const
|
|
3953
|
+
const theme2 = (0, import_react_better_core18.useTheme)();
|
|
3846
3954
|
const internalYearSelectId = (0, import_react20.useId)();
|
|
3847
3955
|
const [currentDate, setCurrentDate] = (0, import_react20.useState)(value ? new Date(value) : void 0);
|
|
3848
3956
|
const [currentMonth, setCurrentMonth] = (0, import_react20.useState)(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
@@ -3906,7 +4014,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3906
4014
|
setCurrentMonth(date.getMonth());
|
|
3907
4015
|
setCurrentYear(date.getFullYear());
|
|
3908
4016
|
}, [value]);
|
|
3909
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.column, { width: "100%", maxWidth: 320, gap:
|
|
4017
|
+
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
4018
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
3911
4019
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
|
|
3912
4020
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.row, { alignItems: "center", gap: 4, children: [
|
|
@@ -3917,7 +4025,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3917
4025
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3918
4026
|
SelectComponent,
|
|
3919
4027
|
{
|
|
3920
|
-
theme,
|
|
4028
|
+
theme: theme2,
|
|
3921
4029
|
value: currentYear,
|
|
3922
4030
|
onChange: onChangeYearSelect,
|
|
3923
4031
|
id: internalYearSelectId,
|
|
@@ -3928,7 +4036,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3928
4036
|
] }),
|
|
3929
4037
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
|
|
3930
4038
|
] }),
|
|
3931
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap:
|
|
4039
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap: theme2.styles.gap / 2, children: [
|
|
3932
4040
|
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
4041
|
days.map((day, index) => {
|
|
3934
4042
|
const thisDayDate = new Date(currentYear, currentMonth, day);
|
|
@@ -3944,11 +4052,11 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3944
4052
|
aspectRatio: "1",
|
|
3945
4053
|
alignItems: "center",
|
|
3946
4054
|
justifyContent: "center",
|
|
3947
|
-
backgroundColor: isSelected ?
|
|
4055
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
3948
4056
|
filterHover: day && !isDisabled ? "brightness(0.9)" : void 0,
|
|
3949
|
-
border: `1px solid ${isToday ?
|
|
3950
|
-
borderRadius:
|
|
3951
|
-
padding:
|
|
4057
|
+
border: `1px solid ${isToday ? theme2.colors.primary : theme2.colors.primary + "00"}`,
|
|
4058
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4059
|
+
padding: theme2.styles.space / 2,
|
|
3952
4060
|
cursor: day ? !isDisabled ? "pointer" : "not-allowed" : void 0,
|
|
3953
4061
|
value: day,
|
|
3954
4062
|
onClickWithValue: !isDisabled ? onClickDay : void 0,
|
|
@@ -3958,7 +4066,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3958
4066
|
{
|
|
3959
4067
|
fontSize: 14,
|
|
3960
4068
|
textAlign: "center",
|
|
3961
|
-
color: isDisabled ?
|
|
4069
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : isWeekend ? theme2.colors.textSecondary : void 0,
|
|
3962
4070
|
children: day
|
|
3963
4071
|
}
|
|
3964
4072
|
),
|
|
@@ -3970,7 +4078,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3970
4078
|
height: 1,
|
|
3971
4079
|
top: "50%",
|
|
3972
4080
|
left: "50%",
|
|
3973
|
-
backgroundColor:
|
|
4081
|
+
backgroundColor: theme2.colors.textSecondary,
|
|
3974
4082
|
borderRadius: 999,
|
|
3975
4083
|
transform: "translate(-50%, -50%) rotate(45deg)"
|
|
3976
4084
|
}
|
|
@@ -3987,8 +4095,8 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3987
4095
|
{
|
|
3988
4096
|
fontSize: 14,
|
|
3989
4097
|
textDecorationHover: "underline",
|
|
3990
|
-
color:
|
|
3991
|
-
colorHover:
|
|
4098
|
+
color: theme2.colors.textSecondary,
|
|
4099
|
+
colorHover: theme2.colors.textPrimary,
|
|
3992
4100
|
children: "Clear"
|
|
3993
4101
|
}
|
|
3994
4102
|
) }),
|
|
@@ -3997,8 +4105,8 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3997
4105
|
{
|
|
3998
4106
|
fontSize: 14,
|
|
3999
4107
|
textDecorationHover: "underline",
|
|
4000
|
-
color:
|
|
4001
|
-
colorHover:
|
|
4108
|
+
color: theme2.colors.textSecondary,
|
|
4109
|
+
colorHover: theme2.colors.textPrimary,
|
|
4002
4110
|
children: "Today"
|
|
4003
4111
|
}
|
|
4004
4112
|
) })
|
|
@@ -4195,7 +4303,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4195
4303
|
id,
|
|
4196
4304
|
...props
|
|
4197
4305
|
}, ref) {
|
|
4198
|
-
const
|
|
4306
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4199
4307
|
const internalId = (0, import_react21.useId)();
|
|
4200
4308
|
const { colorTheme } = (0, import_react_better_core19.useBetterCoreContext)();
|
|
4201
4309
|
const [_, debouncedValue, setDebouncedValue] = (0, import_react_better_core19.useDebounceState)(
|
|
@@ -4229,7 +4337,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4229
4337
|
onChangeValue?.(debouncedValue);
|
|
4230
4338
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
4231
4339
|
const readyId = id ?? internalId;
|
|
4232
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap:
|
|
4340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...excludeStyle, children: [
|
|
4233
4341
|
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
4234
4342
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "stretch", width: "100%", children: [
|
|
4235
4343
|
prefix && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
@@ -4237,12 +4345,12 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4237
4345
|
{
|
|
4238
4346
|
alignItems: "center",
|
|
4239
4347
|
justifyContent: "center",
|
|
4240
|
-
border: `1px solid ${
|
|
4348
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
4241
4349
|
borderRight: "none",
|
|
4242
|
-
backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? (0, import_react_better_core19.darkenColor)(
|
|
4243
|
-
borderTopLeftRadius:
|
|
4244
|
-
borderBottomLeftRadius:
|
|
4245
|
-
paddingInline:
|
|
4350
|
+
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)),
|
|
4351
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
4352
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4353
|
+
paddingInline: theme2.styles.space,
|
|
4246
4354
|
children: prefix
|
|
4247
4355
|
}
|
|
4248
4356
|
),
|
|
@@ -4255,7 +4363,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4255
4363
|
name: leftIcon,
|
|
4256
4364
|
position: "absolute",
|
|
4257
4365
|
top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
|
|
4258
|
-
left:
|
|
4366
|
+
left: theme2.styles.space + 1,
|
|
4259
4367
|
transform: "translateY(-50%)",
|
|
4260
4368
|
pointerEvents: "none",
|
|
4261
4369
|
zIndex: leftIconZIndex
|
|
@@ -4264,7 +4372,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4264
4372
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4265
4373
|
InputElement,
|
|
4266
4374
|
{
|
|
4267
|
-
theme,
|
|
4375
|
+
theme: theme2,
|
|
4268
4376
|
withLeftIcon: leftIcon !== void 0,
|
|
4269
4377
|
withRightIcon: rightIcon !== void 0,
|
|
4270
4378
|
withPrefix: prefix !== void 0,
|
|
@@ -4287,7 +4395,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4287
4395
|
icon: rightIcon,
|
|
4288
4396
|
position: "absolute",
|
|
4289
4397
|
top: 46 / 2,
|
|
4290
|
-
right:
|
|
4398
|
+
right: theme2.styles.space + 1 - theme2.styles.space / 2,
|
|
4291
4399
|
transform: "translateY(-50%)",
|
|
4292
4400
|
onClick: onClickRightIcon
|
|
4293
4401
|
}
|
|
@@ -4297,7 +4405,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4297
4405
|
name: rightIcon,
|
|
4298
4406
|
position: "absolute",
|
|
4299
4407
|
top: 46 / 2,
|
|
4300
|
-
right:
|
|
4408
|
+
right: theme2.styles.space + 1,
|
|
4301
4409
|
transform: "translateY(-50%)",
|
|
4302
4410
|
pointerEvents: "none"
|
|
4303
4411
|
}
|
|
@@ -4310,12 +4418,12 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4310
4418
|
{
|
|
4311
4419
|
alignItems: "center",
|
|
4312
4420
|
justifyContent: "center",
|
|
4313
|
-
border: `1px solid ${
|
|
4421
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
4314
4422
|
borderLeft: "none",
|
|
4315
|
-
backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? (0, import_react_better_core19.darkenColor)(
|
|
4316
|
-
borderTopRightRadius:
|
|
4317
|
-
borderBottomRightRadius:
|
|
4318
|
-
paddingInline:
|
|
4423
|
+
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)),
|
|
4424
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
4425
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4426
|
+
paddingInline: theme2.styles.space,
|
|
4319
4427
|
children: suffix
|
|
4320
4428
|
}
|
|
4321
4429
|
)
|
|
@@ -4326,7 +4434,7 @@ var InputFieldComponent = (0, import_react21.forwardRef)(function InputField({
|
|
|
4326
4434
|
as: "span",
|
|
4327
4435
|
display: "block",
|
|
4328
4436
|
fontSize: 14,
|
|
4329
|
-
color: errorText ?
|
|
4437
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4330
4438
|
children: errorText || infoText
|
|
4331
4439
|
}
|
|
4332
4440
|
)
|
|
@@ -4346,7 +4454,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4346
4454
|
id,
|
|
4347
4455
|
...props
|
|
4348
4456
|
}, ref) {
|
|
4349
|
-
const
|
|
4457
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4350
4458
|
const internalId = (0, import_react21.useId)();
|
|
4351
4459
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
4352
4460
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -4359,7 +4467,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4359
4467
|
[onChange, onChangeValue]
|
|
4360
4468
|
);
|
|
4361
4469
|
const readyId = id ?? internalId;
|
|
4362
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap:
|
|
4470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
4363
4471
|
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Label_default, { text: label, required, isError: !!errorText, htmlFor: readyId }),
|
|
4364
4472
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default, { position: "relative", width: "100%", children: [
|
|
4365
4473
|
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
@@ -4368,7 +4476,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4368
4476
|
name: leftIcon,
|
|
4369
4477
|
position: "absolute",
|
|
4370
4478
|
top: 46 / 2,
|
|
4371
|
-
left:
|
|
4479
|
+
left: theme2.styles.space + 1,
|
|
4372
4480
|
transform: "translateY(-50%)",
|
|
4373
4481
|
pointerEvents: "none"
|
|
4374
4482
|
}
|
|
@@ -4376,7 +4484,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4376
4484
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4377
4485
|
TextareaElement,
|
|
4378
4486
|
{
|
|
4379
|
-
theme,
|
|
4487
|
+
theme: theme2,
|
|
4380
4488
|
withLeftIcon: leftIcon !== void 0,
|
|
4381
4489
|
withRightIcon: rightIcon !== void 0,
|
|
4382
4490
|
required,
|
|
@@ -4397,7 +4505,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4397
4505
|
icon: rightIcon,
|
|
4398
4506
|
position: "absolute",
|
|
4399
4507
|
top: 46 / 2,
|
|
4400
|
-
right:
|
|
4508
|
+
right: theme2.styles.space + 1 - theme2.styles.space / 2,
|
|
4401
4509
|
transform: "translateY(-50%)",
|
|
4402
4510
|
onClick: onClickRightIcon
|
|
4403
4511
|
}
|
|
@@ -4407,7 +4515,7 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4407
4515
|
name: rightIcon,
|
|
4408
4516
|
position: "absolute",
|
|
4409
4517
|
top: 46 / 2,
|
|
4410
|
-
right:
|
|
4518
|
+
right: theme2.styles.space + 1,
|
|
4411
4519
|
transform: "translateY(-50%)",
|
|
4412
4520
|
pointerEvents: "none"
|
|
4413
4521
|
}
|
|
@@ -4418,8 +4526,8 @@ InputFieldComponent.multiline = (0, import_react21.forwardRef)(function Multilin
|
|
|
4418
4526
|
{
|
|
4419
4527
|
as: "span",
|
|
4420
4528
|
display: "block",
|
|
4421
|
-
marginTop:
|
|
4422
|
-
color: errorText ?
|
|
4529
|
+
marginTop: theme2.styles.gap / 2,
|
|
4530
|
+
color: errorText ? theme2.colors.error : props.labelColor ?? theme2.colors.textSecondary,
|
|
4423
4531
|
fontSize: 14,
|
|
4424
4532
|
children: errorText || infoText
|
|
4425
4533
|
}
|
|
@@ -4501,12 +4609,12 @@ InputFieldComponent.search = (0, import_react21.forwardRef)(function Search({ va
|
|
|
4501
4609
|
);
|
|
4502
4610
|
});
|
|
4503
4611
|
InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneNumber({ label, value, onChangeValue, labelColor, id, ...props }, ref) {
|
|
4504
|
-
const
|
|
4612
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4505
4613
|
const internalId = (0, import_react21.useId)();
|
|
4506
4614
|
const [dropdownValue, setDropdownValue] = (0, import_react21.useState)();
|
|
4507
4615
|
const [inputFieldValue, setInputFieldValue] = (0, import_react21.useState)(value?.toString() ?? "");
|
|
4508
4616
|
const renderOption = (0, import_react21.useCallback)(
|
|
4509
|
-
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
4617
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
4510
4618
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
4511
4619
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { children: option.label })
|
|
4512
4620
|
] }),
|
|
@@ -4558,7 +4666,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4558
4666
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
4559
4667
|
}, [value]);
|
|
4560
4668
|
const readyId = id ?? internalId;
|
|
4561
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap:
|
|
4669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
4562
4670
|
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4563
4671
|
Label_default,
|
|
4564
4672
|
{
|
|
@@ -4604,7 +4712,7 @@ InputFieldComponent.phoneNumber = (0, import_react21.forwardRef)(function PhoneN
|
|
|
4604
4712
|
] });
|
|
4605
4713
|
});
|
|
4606
4714
|
InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDate, maxDate, ...props }, ref) {
|
|
4607
|
-
const
|
|
4715
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4608
4716
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4609
4717
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4610
4718
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
@@ -4626,9 +4734,9 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
4626
4734
|
top: "100%",
|
|
4627
4735
|
left: 0,
|
|
4628
4736
|
width: "fit-content",
|
|
4629
|
-
backgroundColor:
|
|
4630
|
-
borderBottomLeftRadius:
|
|
4631
|
-
borderBottomRightRadius:
|
|
4737
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4738
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4739
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4632
4740
|
boxShadow: "0px 10px 20px #00000020",
|
|
4633
4741
|
userSelect: "none",
|
|
4634
4742
|
...insideInputFieldComponentProps,
|
|
@@ -4643,7 +4751,7 @@ InputFieldComponent.date = (0, import_react21.forwardRef)(function Date2({ minDa
|
|
|
4643
4751
|
);
|
|
4644
4752
|
});
|
|
4645
4753
|
InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime({ minDate, maxDate, defaultDateAfterTimePick, defaultTimeAfterDatePick = "00:00", ...props }, ref) {
|
|
4646
|
-
const
|
|
4754
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4647
4755
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4648
4756
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4649
4757
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
@@ -4685,7 +4793,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4685
4793
|
}, [isOpen]);
|
|
4686
4794
|
const valueHour = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[0]).toString();
|
|
4687
4795
|
const valueMinute = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[1]).toString();
|
|
4688
|
-
const topSpacing = 32 +
|
|
4796
|
+
const topSpacing = 32 + theme2.styles.space / 2 + theme2.styles.gap;
|
|
4689
4797
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4690
4798
|
InputFieldComponent,
|
|
4691
4799
|
{
|
|
@@ -4697,32 +4805,32 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4697
4805
|
top: "100%",
|
|
4698
4806
|
left: 0,
|
|
4699
4807
|
width: "fit-content",
|
|
4700
|
-
backgroundColor:
|
|
4701
|
-
borderBottomLeftRadius:
|
|
4702
|
-
borderBottomRightRadius:
|
|
4808
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4809
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4810
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4703
4811
|
boxShadow: "0px 10px 20px #00000020",
|
|
4704
4812
|
overflow: "hidden",
|
|
4705
4813
|
userSelect: "none",
|
|
4706
4814
|
...insideInputFieldComponentProps,
|
|
4707
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { gap:
|
|
4815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Div_default.row, { gap: theme2.styles.space, children: [
|
|
4708
4816
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
4709
4817
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
4710
4818
|
Div_default.row,
|
|
4711
4819
|
{
|
|
4712
4820
|
height: 276,
|
|
4713
|
-
gap:
|
|
4821
|
+
gap: theme2.styles.gap / 2,
|
|
4714
4822
|
paddingTop: topSpacing,
|
|
4715
|
-
paddingBottom:
|
|
4716
|
-
paddingRight:
|
|
4823
|
+
paddingBottom: theme2.styles.space / 2,
|
|
4824
|
+
paddingRight: theme2.styles.space / 2,
|
|
4717
4825
|
children: [
|
|
4718
4826
|
/* @__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:
|
|
4827
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
4720
4828
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4721
4829
|
Div_default,
|
|
4722
4830
|
{
|
|
4723
4831
|
className: "react-better-html-no-scrollbar",
|
|
4724
4832
|
width: buttonWidth,
|
|
4725
|
-
height: `calc(100% - ${16 +
|
|
4833
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4726
4834
|
overflowY: "auto",
|
|
4727
4835
|
tabIndex: -1,
|
|
4728
4836
|
children: hours.map((hour) => {
|
|
@@ -4732,12 +4840,12 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4732
4840
|
{
|
|
4733
4841
|
alignItems: "center",
|
|
4734
4842
|
justifyContent: "center",
|
|
4735
|
-
color: isSelected ?
|
|
4736
|
-
backgroundColor: isSelected ?
|
|
4737
|
-
borderRadius:
|
|
4843
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4844
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4845
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4738
4846
|
filterHover: "brightness(0.9)",
|
|
4739
4847
|
cursor: "pointer",
|
|
4740
|
-
padding: `${
|
|
4848
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4741
4849
|
value: hour,
|
|
4742
4850
|
onClickWithValue: onClickHour,
|
|
4743
4851
|
ref: isSelected ? selectedHourRef : void 0,
|
|
@@ -4750,13 +4858,13 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4750
4858
|
)
|
|
4751
4859
|
] }),
|
|
4752
4860
|
/* @__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:
|
|
4861
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
4754
4862
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4755
4863
|
Div_default,
|
|
4756
4864
|
{
|
|
4757
4865
|
className: "react-better-html-no-scrollbar",
|
|
4758
4866
|
width: buttonWidth,
|
|
4759
|
-
height: `calc(100% - ${16 +
|
|
4867
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4760
4868
|
overflowY: "auto",
|
|
4761
4869
|
tabIndex: -1,
|
|
4762
4870
|
children: minutes.map((minute) => {
|
|
@@ -4766,12 +4874,12 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4766
4874
|
{
|
|
4767
4875
|
alignItems: "center",
|
|
4768
4876
|
justifyContent: "center",
|
|
4769
|
-
color: isSelected ?
|
|
4770
|
-
backgroundColor: isSelected ?
|
|
4771
|
-
borderRadius:
|
|
4877
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4878
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4879
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4772
4880
|
filterHover: "brightness(0.9)",
|
|
4773
4881
|
cursor: "pointer",
|
|
4774
|
-
padding: `${
|
|
4882
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4775
4883
|
value: minute,
|
|
4776
4884
|
onClickWithValue: onClickMinute,
|
|
4777
4885
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
@@ -4797,7 +4905,7 @@ InputFieldComponent.dateTime = (0, import_react21.forwardRef)(function DateTime(
|
|
|
4797
4905
|
);
|
|
4798
4906
|
});
|
|
4799
4907
|
InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...props }, ref) {
|
|
4800
|
-
const
|
|
4908
|
+
const theme2 = (0, import_react_better_core19.useTheme)();
|
|
4801
4909
|
const holderRef = (0, import_react21.useRef)(null);
|
|
4802
4910
|
const selectedHourRef = (0, import_react21.useRef)(null);
|
|
4803
4911
|
const selectedMinuteRef = (0, import_react21.useRef)(null);
|
|
@@ -4839,9 +4947,9 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
4839
4947
|
left: 0,
|
|
4840
4948
|
width: buttonWidth * 2 + 2,
|
|
4841
4949
|
height: 300,
|
|
4842
|
-
backgroundColor:
|
|
4843
|
-
borderBottomLeftRadius:
|
|
4844
|
-
borderBottomRightRadius:
|
|
4950
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4951
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4952
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4845
4953
|
boxShadow: "0px 10px 20px #00000020",
|
|
4846
4954
|
overflowY: "auto",
|
|
4847
4955
|
userSelect: "none",
|
|
@@ -4862,11 +4970,11 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
4862
4970
|
{
|
|
4863
4971
|
alignItems: "center",
|
|
4864
4972
|
justifyContent: "center",
|
|
4865
|
-
color: isSelected ?
|
|
4866
|
-
backgroundColor: isSelected ?
|
|
4973
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4974
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4867
4975
|
filterHover: "brightness(0.9)",
|
|
4868
4976
|
cursor: "pointer",
|
|
4869
|
-
padding: `${
|
|
4977
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4870
4978
|
value: hour,
|
|
4871
4979
|
onClickWithValue: onClickHour,
|
|
4872
4980
|
ref: isSelected ? selectedHourRef : void 0,
|
|
@@ -4892,11 +5000,11 @@ InputFieldComponent.time = (0, import_react21.forwardRef)(function Time({ ...pro
|
|
|
4892
5000
|
{
|
|
4893
5001
|
alignItems: "center",
|
|
4894
5002
|
justifyContent: "center",
|
|
4895
|
-
color: isSelected ?
|
|
4896
|
-
backgroundColor: isSelected ?
|
|
5003
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
5004
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4897
5005
|
filterHover: "brightness(0.9)",
|
|
4898
5006
|
cursor: "pointer",
|
|
4899
|
-
padding: `${
|
|
5007
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4900
5008
|
value: minute,
|
|
4901
5009
|
onClickWithValue: onClickMinute,
|
|
4902
5010
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
@@ -5081,7 +5189,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5081
5189
|
id,
|
|
5082
5190
|
...props
|
|
5083
5191
|
}, ref) {
|
|
5084
|
-
const
|
|
5192
|
+
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5085
5193
|
const internalId = (0, import_react22.useId)();
|
|
5086
5194
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5087
5195
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -5102,14 +5210,14 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5102
5210
|
onChange?.(newIsChecked, value);
|
|
5103
5211
|
}, [checked, controlledChecked, onChange, value]);
|
|
5104
5212
|
const readyId = id ?? internalId;
|
|
5105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap:
|
|
5213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5106
5214
|
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:
|
|
5215
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5108
5216
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5109
5217
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5110
5218
|
InputElement2,
|
|
5111
5219
|
{
|
|
5112
|
-
theme,
|
|
5220
|
+
theme: theme2,
|
|
5113
5221
|
type: props.type ?? "checkbox",
|
|
5114
5222
|
checked,
|
|
5115
5223
|
onChange: onChangeElement,
|
|
@@ -5128,12 +5236,12 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5128
5236
|
position: "absolute",
|
|
5129
5237
|
top: "50%",
|
|
5130
5238
|
left: "50%",
|
|
5131
|
-
color:
|
|
5239
|
+
color: theme2.colors.base,
|
|
5132
5240
|
size: 14,
|
|
5133
5241
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
5134
5242
|
opacity: checked ? 1 : 0,
|
|
5135
5243
|
pointerEvents: "none",
|
|
5136
|
-
transition:
|
|
5244
|
+
transition: theme2.styles.transition
|
|
5137
5245
|
}
|
|
5138
5246
|
) : props.type === "radio" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5139
5247
|
Div_default,
|
|
@@ -5143,7 +5251,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5143
5251
|
height: 10,
|
|
5144
5252
|
top: "50%",
|
|
5145
5253
|
left: "50%",
|
|
5146
|
-
backgroundColor:
|
|
5254
|
+
backgroundColor: theme2.colors.base,
|
|
5147
5255
|
borderRadius: 999,
|
|
5148
5256
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
5149
5257
|
opacity: checked ? 1 : 0,
|
|
@@ -5153,13 +5261,13 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5153
5261
|
] }),
|
|
5154
5262
|
text ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5155
5263
|
text,
|
|
5156
|
-
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
5264
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5157
5265
|
" ",
|
|
5158
5266
|
"*"
|
|
5159
5267
|
] })
|
|
5160
5268
|
] }) : textAdvanced ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5161
5269
|
textAdvanced,
|
|
5162
|
-
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
5270
|
+
required && !label && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
|
|
5163
5271
|
" ",
|
|
5164
5272
|
"*"
|
|
5165
5273
|
] })
|
|
@@ -5171,7 +5279,7 @@ var ToggleInputComponent = (0, import_react22.forwardRef)(function ToggleInput({
|
|
|
5171
5279
|
as: "span",
|
|
5172
5280
|
display: "block",
|
|
5173
5281
|
fontSize: 14,
|
|
5174
|
-
color: errorText ?
|
|
5282
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
5175
5283
|
children: errorText || infoText
|
|
5176
5284
|
}
|
|
5177
5285
|
)
|
|
@@ -5197,7 +5305,7 @@ var ToggleInput_default = {
|
|
|
5197
5305
|
id,
|
|
5198
5306
|
...props
|
|
5199
5307
|
}, ref) {
|
|
5200
|
-
const
|
|
5308
|
+
const theme2 = (0, import_react_better_core20.useTheme)();
|
|
5201
5309
|
const internalId = (0, import_react22.useId)();
|
|
5202
5310
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5203
5311
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -5212,13 +5320,13 @@ var ToggleInput_default = {
|
|
|
5212
5320
|
onChange?.(newIsChecked, value);
|
|
5213
5321
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5214
5322
|
const readyId = id ?? internalId;
|
|
5215
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "fit-content", gap:
|
|
5323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5216
5324
|
label && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
5217
5325
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5218
5326
|
Div_default.row,
|
|
5219
5327
|
{
|
|
5220
5328
|
alignItems: "center",
|
|
5221
|
-
gap:
|
|
5329
|
+
gap: theme2.styles.gap,
|
|
5222
5330
|
borderRadius: 999,
|
|
5223
5331
|
isTabAccessed: true,
|
|
5224
5332
|
onClick: onClickElement,
|
|
@@ -5231,7 +5339,7 @@ var ToggleInput_default = {
|
|
|
5231
5339
|
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
5232
5340
|
SwitchElement,
|
|
5233
5341
|
{
|
|
5234
|
-
theme,
|
|
5342
|
+
theme: theme2,
|
|
5235
5343
|
checked,
|
|
5236
5344
|
disabled: disabled ?? false,
|
|
5237
5345
|
isMouseDown,
|
|
@@ -5254,7 +5362,7 @@ var ToggleInput_default = {
|
|
|
5254
5362
|
as: "span",
|
|
5255
5363
|
display: "block",
|
|
5256
5364
|
fontSize: 14,
|
|
5257
|
-
color: errorText ?
|
|
5365
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
5258
5366
|
children: errorText || infoText
|
|
5259
5367
|
}
|
|
5260
5368
|
)
|
|
@@ -5289,7 +5397,7 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
5289
5397
|
children,
|
|
5290
5398
|
...props
|
|
5291
5399
|
}, ref) {
|
|
5292
|
-
const
|
|
5400
|
+
const theme2 = (0, import_react_better_core21.useTheme)();
|
|
5293
5401
|
const submitButtonIsDisabledInternal = (0, import_react23.useMemo)(() => {
|
|
5294
5402
|
if (!form || !form.requiredFields) return false;
|
|
5295
5403
|
return Object.entries(form.values).some(
|
|
@@ -5299,7 +5407,7 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
5299
5407
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
5300
5408
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
5301
5409
|
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 ?
|
|
5410
|
+
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
5411
|
child,
|
|
5304
5412
|
index < import_react23.Children.toArray(children).length - 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Divider_default.horizontal, {})
|
|
5305
5413
|
] }, index)) : children }) : children,
|
|
@@ -5308,8 +5416,8 @@ var FormComponent = (0, import_react23.forwardRef)(function Form({
|
|
|
5308
5416
|
{
|
|
5309
5417
|
alignItems: "center",
|
|
5310
5418
|
justifyContent: actionButtonsLocation === "left" ? "flex-start" : actionButtonsLocation === "center" ? "center" : "flex-end",
|
|
5311
|
-
gap:
|
|
5312
|
-
marginTop:
|
|
5419
|
+
gap: theme2.styles.gap,
|
|
5420
|
+
marginTop: theme2.styles.space,
|
|
5313
5421
|
children: [
|
|
5314
5422
|
renderActionButtons,
|
|
5315
5423
|
onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -5347,10 +5455,10 @@ var import_react24 = require("react");
|
|
|
5347
5455
|
var import_react_better_core22 = require("react-better-core");
|
|
5348
5456
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
5349
5457
|
var FormRowComponent = (0, import_react24.forwardRef)(function FormRow({ oneItemOnly, noBreakingPoint, asColumn, gap, children, ...props }, ref) {
|
|
5350
|
-
const
|
|
5458
|
+
const theme2 = (0, import_react_better_core22.useTheme)();
|
|
5351
5459
|
const mediaQuery = useMediaQuery();
|
|
5352
5460
|
const breakingPoint = asColumn ?? (!noBreakingPoint ? mediaQuery.size900 : false);
|
|
5353
|
-
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ?
|
|
5461
|
+
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
5354
5462
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
5355
5463
|
children,
|
|
5356
5464
|
oneItemOnly && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default, { width: "100%" })
|
|
@@ -5374,21 +5482,21 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
5374
5482
|
children,
|
|
5375
5483
|
...props
|
|
5376
5484
|
}, ref) {
|
|
5377
|
-
const
|
|
5485
|
+
const theme2 = (0, import_react_better_core22.useTheme)();
|
|
5378
5486
|
const mediaQuery = useMediaQuery();
|
|
5379
|
-
const titleGap =
|
|
5487
|
+
const titleGap = theme2.styles.space;
|
|
5380
5488
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(FormRowComponent, { ...props, ref, children: [
|
|
5381
5489
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: titleGap, children: [
|
|
5382
5490
|
icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon_default, { name: icon }),
|
|
5383
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { flex: 1, gap:
|
|
5491
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
5384
5492
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: titleAs, fontSize: titleFontSize, children: [
|
|
5385
5493
|
title,
|
|
5386
|
-
required && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: "span", fontSize: 16, color:
|
|
5494
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5387
5495
|
" ",
|
|
5388
5496
|
"*"
|
|
5389
5497
|
] })
|
|
5390
5498
|
] }),
|
|
5391
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { fontSize: descriptionFontSize, color:
|
|
5499
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { fontSize: descriptionFontSize, color: theme2.colors.textSecondary, children: description })
|
|
5392
5500
|
] }),
|
|
5393
5501
|
isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default, { width: 26 - titleGap })
|
|
5394
5502
|
] }),
|
|
@@ -5399,14 +5507,14 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
5399
5507
|
width: props.noBreakingPoint && mediaQuery.size900 ? void 0 : "100%",
|
|
5400
5508
|
alignItems: "center",
|
|
5401
5509
|
justifyContent: alignChildren,
|
|
5402
|
-
gap:
|
|
5510
|
+
gap: theme2.styles.gap,
|
|
5403
5511
|
children: [
|
|
5404
5512
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
5405
5513
|
Div_default,
|
|
5406
5514
|
{
|
|
5407
5515
|
position: "absolute",
|
|
5408
5516
|
top: "50%",
|
|
5409
|
-
right: `calc(100% + ${
|
|
5517
|
+
right: `calc(100% + ${theme2.styles.space}px)`,
|
|
5410
5518
|
transform: "translateY(-50%)",
|
|
5411
5519
|
opacity: !isLoading ? 0 : void 0,
|
|
5412
5520
|
pointerEvents: !isLoading ? "none" : void 0,
|
|
@@ -5414,7 +5522,7 @@ FormRowComponent.withTitle = (0, import_react24.forwardRef)(function WithTitle({
|
|
|
5414
5522
|
}
|
|
5415
5523
|
),
|
|
5416
5524
|
children,
|
|
5417
|
-
withActions && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
5525
|
+
withActions && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5418
5526
|
onClickReset && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
5419
5527
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
5420
5528
|
] })
|
|
@@ -5470,8 +5578,8 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5470
5578
|
);
|
|
5471
5579
|
};
|
|
5472
5580
|
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:
|
|
5581
|
+
const theme2 = (0, import_react_better_core23.useTheme)();
|
|
5582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
5475
5583
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { children: "Light" }),
|
|
5476
5584
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ColorThemeSwitchComponent, { withMoon, className }),
|
|
5477
5585
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text_default, { children: "Dark" })
|
|
@@ -5500,7 +5608,7 @@ var PaginationComponent = function Pagination({
|
|
|
5500
5608
|
onClickNextPage,
|
|
5501
5609
|
onChangePage
|
|
5502
5610
|
}) {
|
|
5503
|
-
const
|
|
5611
|
+
const theme2 = (0, import_react_better_core24.useTheme)();
|
|
5504
5612
|
const mediaQuery = useMediaQuery();
|
|
5505
5613
|
const [currentPageInternal, setCurrentPage] = (0, import_react26.useState)(currentPage);
|
|
5506
5614
|
const pageCountInternal = pageCount ?? (itemsPerPage !== void 0 ? Math.ceil(itemsLength / itemsPerPage) : 1);
|
|
@@ -5536,7 +5644,7 @@ var PaginationComponent = function Pagination({
|
|
|
5536
5644
|
setCurrentPage(currentPage);
|
|
5537
5645
|
}, [currentPage]);
|
|
5538
5646
|
const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages2 / 1.4;
|
|
5539
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap:
|
|
5647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
|
|
5540
5648
|
pageCountInternal > maximumVisiblePages2 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5541
5649
|
Button_default.icon,
|
|
5542
5650
|
{
|
|
@@ -5553,7 +5661,7 @@ var PaginationComponent = function Pagination({
|
|
|
5553
5661
|
alignItems: "center",
|
|
5554
5662
|
justifyContent: "center",
|
|
5555
5663
|
flexWrap: mobileFooterBreakingPoint ? "wrap" : void 0,
|
|
5556
|
-
gap:
|
|
5664
|
+
gap: theme2.styles.gap,
|
|
5557
5665
|
children: paginationItems.map((pageIndex) => {
|
|
5558
5666
|
const isActive = currentPageInternal === pageIndex;
|
|
5559
5667
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -5567,8 +5675,8 @@ var PaginationComponent = function Pagination({
|
|
|
5567
5675
|
Text_default,
|
|
5568
5676
|
{
|
|
5569
5677
|
fontWeight: isActive ? 700 : 400,
|
|
5570
|
-
color: isActive ?
|
|
5571
|
-
transition:
|
|
5678
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
5679
|
+
transition: theme2.styles.transition,
|
|
5572
5680
|
children: pageIndex
|
|
5573
5681
|
}
|
|
5574
5682
|
)
|
|
@@ -5770,7 +5878,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5770
5878
|
onChangeFilterDataValue,
|
|
5771
5879
|
...props
|
|
5772
5880
|
}, ref) {
|
|
5773
|
-
const
|
|
5881
|
+
const theme2 = (0, import_react_better_core25.useTheme)();
|
|
5774
5882
|
const mediaQuery = useMediaQuery();
|
|
5775
5883
|
const { colorTheme } = (0, import_react_better_core25.useBetterCoreContext)();
|
|
5776
5884
|
const filterModalRef = (0, import_react27.useRef)(null);
|
|
@@ -5834,7 +5942,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5834
5942
|
}
|
|
5835
5943
|
case "image": {
|
|
5836
5944
|
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:
|
|
5945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Image_default, { width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...imageProps });
|
|
5838
5946
|
}
|
|
5839
5947
|
case "checkbox": {
|
|
5840
5948
|
const { onChange, ...toggleInputProps } = (typeof column.getToggleInputProps === "function" ? column.getToggleInputProps?.(item, itemIndex) : column.getToggleInputProps) ?? {};
|
|
@@ -5865,7 +5973,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5865
5973
|
{
|
|
5866
5974
|
name: "chevronDown",
|
|
5867
5975
|
transform: `rotate(${expandedRows[itemIndex] ? 180 : 0}deg)`,
|
|
5868
|
-
transition:
|
|
5976
|
+
transition: theme2.styles.transition
|
|
5869
5977
|
}
|
|
5870
5978
|
) });
|
|
5871
5979
|
}
|
|
@@ -5874,7 +5982,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
5874
5982
|
}
|
|
5875
5983
|
}
|
|
5876
5984
|
},
|
|
5877
|
-
[
|
|
5985
|
+
[theme2, checkedItems, expandedRows]
|
|
5878
5986
|
);
|
|
5879
5987
|
const onClickRowElement = (0, import_react27.useCallback)(
|
|
5880
5988
|
(item, index) => {
|
|
@@ -6131,8 +6239,8 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6131
6239
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6132
6240
|
Div_default,
|
|
6133
6241
|
{
|
|
6134
|
-
border: `1px solid ${
|
|
6135
|
-
borderRadius:
|
|
6242
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
6243
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
6136
6244
|
overflow: !containsOverflowComponents ? "auto" : void 0,
|
|
6137
6245
|
...props,
|
|
6138
6246
|
ref: wrapperComponentRef,
|
|
@@ -6143,7 +6251,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6143
6251
|
withHover: onClickRow !== void 0 || expandColumn !== void 0,
|
|
6144
6252
|
withStickyHeader,
|
|
6145
6253
|
colorTheme,
|
|
6146
|
-
theme,
|
|
6254
|
+
theme: theme2,
|
|
6147
6255
|
containsOverflowComponents,
|
|
6148
6256
|
withFooter,
|
|
6149
6257
|
children: [
|
|
@@ -6160,7 +6268,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6160
6268
|
width: "100%",
|
|
6161
6269
|
alignItems: "center",
|
|
6162
6270
|
justifyContent: column.filter ? "space-between" : column.align === "center" ? "center" : column.align === "right" ? "flex-end" : "flex-start",
|
|
6163
|
-
gap:
|
|
6271
|
+
gap: theme2.styles.gap,
|
|
6164
6272
|
children: [
|
|
6165
6273
|
column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6166
6274
|
ToggleInput_default.checkbox,
|
|
@@ -6174,7 +6282,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6174
6282
|
Button_default.icon,
|
|
6175
6283
|
{
|
|
6176
6284
|
icon: "filter",
|
|
6177
|
-
color: filterData[index] ?
|
|
6285
|
+
color: filterData[index] ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
6178
6286
|
value: index,
|
|
6179
6287
|
onClickWithValue: onClickFilterButton
|
|
6180
6288
|
}
|
|
@@ -6217,14 +6325,14 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6217
6325
|
width: "100%",
|
|
6218
6326
|
justifyContent: "center",
|
|
6219
6327
|
flexReverse: true,
|
|
6220
|
-
gap:
|
|
6328
|
+
gap: theme2.styles.gap / 2,
|
|
6221
6329
|
children: [
|
|
6222
6330
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
6223
6331
|
Text_default,
|
|
6224
6332
|
{
|
|
6225
6333
|
position: mobileFooterBreakingPoint ? "relative" : "absolute",
|
|
6226
6334
|
top: !mobileFooterBreakingPoint ? "50%" : void 0,
|
|
6227
|
-
color:
|
|
6335
|
+
color: theme2.colors.textSecondary,
|
|
6228
6336
|
transform: !mobileFooterBreakingPoint ? "translateY(-50%)" : void 0,
|
|
6229
6337
|
userSelect: "none",
|
|
6230
6338
|
children: [
|
|
@@ -6276,7 +6384,7 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6276
6384
|
Form_default,
|
|
6277
6385
|
{
|
|
6278
6386
|
form: filterForm,
|
|
6279
|
-
gap:
|
|
6387
|
+
gap: theme2.styles.gap,
|
|
6280
6388
|
submitButtonText: "Filter",
|
|
6281
6389
|
cancelButtonText: "Clear",
|
|
6282
6390
|
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
@@ -6288,9 +6396,9 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6288
6396
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(InputField_default.dateTime, { label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
6289
6397
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(InputField_default.dateTime, { label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
6290
6398
|
] }) }),
|
|
6291
|
-
openedFilterColumn.presets && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap:
|
|
6399
|
+
openedFilterColumn.presets && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
6292
6400
|
/* @__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:
|
|
6401
|
+
/* @__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
6402
|
Button_default.secondary,
|
|
6295
6403
|
{
|
|
6296
6404
|
text: filterPresetsText[preset],
|
|
@@ -6306,10 +6414,10 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6306
6414
|
) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
6307
6415
|
Form_default,
|
|
6308
6416
|
{
|
|
6309
|
-
gap:
|
|
6417
|
+
gap: theme2.styles.space,
|
|
6310
6418
|
submitButtonText: "Filter",
|
|
6311
6419
|
cancelButtonText: "Clear",
|
|
6312
|
-
renderActionButtons: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { marginRight: "auto", alignItems: "center", gap:
|
|
6420
|
+
renderActionButtons: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { marginRight: "auto", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6313
6421
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6314
6422
|
Button_default.secondary,
|
|
6315
6423
|
{
|
|
@@ -6340,9 +6448,9 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6340
6448
|
...filterForm.getInputFieldProps("search")
|
|
6341
6449
|
}
|
|
6342
6450
|
) }),
|
|
6343
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap:
|
|
6451
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
6344
6452
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Label_default, { text: "Possible values" }),
|
|
6345
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default.row, { flexWrap: "wrap", gap:
|
|
6453
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Div_default.row, { flexWrap: "wrap", gap: theme2.styles.gap, children: possibleFilterListValues.length > 0 ? possibleFilterListValues.map((value) => {
|
|
6346
6454
|
const isActive = filterListSelectedItems?.includes(value.value);
|
|
6347
6455
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
6348
6456
|
Div_default.box,
|
|
@@ -6350,13 +6458,13 @@ var TableComponent = (0, import_react27.forwardRef)(function Table({
|
|
|
6350
6458
|
isActive,
|
|
6351
6459
|
value: value.value,
|
|
6352
6460
|
onClickWithValue: onClickFilterListItem,
|
|
6353
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
6461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
6354
6462
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text_default, { children: value.label || value.value }),
|
|
6355
6463
|
openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
6356
6464
|
Text_default,
|
|
6357
6465
|
{
|
|
6358
6466
|
fontSize: 14,
|
|
6359
|
-
color: isActive ?
|
|
6467
|
+
color: isActive ? theme2.colors.base + "c0" : theme2.colors.textSecondary,
|
|
6360
6468
|
children: [
|
|
6361
6469
|
"(",
|
|
6362
6470
|
value.count,
|
|
@@ -6488,14 +6596,14 @@ var arrowStyle = (props, borderWidth) => ({
|
|
|
6488
6596
|
}
|
|
6489
6597
|
});
|
|
6490
6598
|
var Arrow = (0, import_react28.memo)(function Arrow2(props) {
|
|
6491
|
-
const
|
|
6599
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6492
6600
|
const { position, size } = props;
|
|
6493
6601
|
const outerProps = (0, import_react28.useMemo)(
|
|
6494
6602
|
() => ({
|
|
6495
6603
|
...props,
|
|
6496
|
-
color:
|
|
6604
|
+
color: theme2.colors.border
|
|
6497
6605
|
}),
|
|
6498
|
-
[props,
|
|
6606
|
+
[props, theme2]
|
|
6499
6607
|
);
|
|
6500
6608
|
const borderWidth = 1;
|
|
6501
6609
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -6539,16 +6647,16 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6539
6647
|
onClose,
|
|
6540
6648
|
children
|
|
6541
6649
|
}, ref) {
|
|
6542
|
-
const
|
|
6650
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6543
6651
|
const triggerHolderRef = (0, import_react28.useRef)(null);
|
|
6544
6652
|
const contentRef = (0, import_react28.useRef)(null);
|
|
6545
6653
|
const tooltipContainerRef = (0, import_react28.useRef)(null);
|
|
6546
6654
|
const closeTimerRef = (0, import_react28.useRef)(void 0);
|
|
6547
6655
|
const [isOpen, setIsOpen] = (0, import_react28.useState)(false);
|
|
6548
6656
|
const [isOpenLate, setIsOpenLate] = (0, import_react28.useState)(false);
|
|
6549
|
-
const arrowSize = withArrow ?
|
|
6550
|
-
const gap =
|
|
6551
|
-
const outsideScreenGap =
|
|
6657
|
+
const arrowSize = withArrow ? theme2.styles.gap : 0;
|
|
6658
|
+
const gap = theme2.styles.gap / 2;
|
|
6659
|
+
const outsideScreenGap = theme2.styles.gap / 2;
|
|
6552
6660
|
const totalGap = arrowSize + gap;
|
|
6553
6661
|
const openTooltip = (0, import_react28.useCallback)(() => {
|
|
6554
6662
|
if (disabled) return;
|
|
@@ -6651,7 +6759,7 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6651
6759
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6652
6760
|
TooltipContainer,
|
|
6653
6761
|
{
|
|
6654
|
-
theme,
|
|
6762
|
+
theme: theme2,
|
|
6655
6763
|
position,
|
|
6656
6764
|
align,
|
|
6657
6765
|
pointerEvents: contentPointerEvents,
|
|
@@ -6668,10 +6776,10 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6668
6776
|
position: "relative",
|
|
6669
6777
|
width: contentWidth,
|
|
6670
6778
|
minWidth: contentMinWidth,
|
|
6671
|
-
backgroundColor: backgroundColor ??
|
|
6779
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
|
|
6672
6780
|
boxShadow: "0px 10px 20px #00000020",
|
|
6673
|
-
paddingBlock: isSmall ?
|
|
6674
|
-
paddingInline: asContextMenu ? 0 : isSmall ?
|
|
6781
|
+
paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
|
|
6782
|
+
paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
|
|
6675
6783
|
overflow: asContextMenu ? "hidden" : void 0,
|
|
6676
6784
|
children: content
|
|
6677
6785
|
}
|
|
@@ -6695,9 +6803,9 @@ var TooltipComponent = (0, import_react28.forwardRef)(function Tooltip({
|
|
|
6695
6803
|
{
|
|
6696
6804
|
position,
|
|
6697
6805
|
align,
|
|
6698
|
-
sideSpace:
|
|
6806
|
+
sideSpace: theme2.styles.borderRadius,
|
|
6699
6807
|
size: arrowSize,
|
|
6700
|
-
color: backgroundColor ??
|
|
6808
|
+
color: backgroundColor ?? theme2.colors.backgroundContent,
|
|
6701
6809
|
isOpen
|
|
6702
6810
|
}
|
|
6703
6811
|
)
|
|
@@ -6721,16 +6829,16 @@ TooltipComponent.item = (0, import_react28.forwardRef)(function Item({
|
|
|
6721
6829
|
onClick,
|
|
6722
6830
|
onClickWithValue
|
|
6723
6831
|
}, ref) {
|
|
6724
|
-
const
|
|
6832
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6725
6833
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
6726
6834
|
Div_default.row,
|
|
6727
6835
|
{
|
|
6728
6836
|
alignItems: "center",
|
|
6729
|
-
gap:
|
|
6730
|
-
backgroundColor:
|
|
6837
|
+
gap: theme2.styles.space,
|
|
6838
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
6731
6839
|
filterHover: !disabled ? "brightness(0.9)" : "brightness(0.94)",
|
|
6732
|
-
paddingBlock:
|
|
6733
|
-
paddingInline:
|
|
6840
|
+
paddingBlock: theme2.styles.gap,
|
|
6841
|
+
paddingInline: theme2.styles.space,
|
|
6734
6842
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
6735
6843
|
isTabAccessed: true,
|
|
6736
6844
|
id,
|
|
@@ -6740,29 +6848,29 @@ TooltipComponent.item = (0, import_react28.forwardRef)(function Item({
|
|
|
6740
6848
|
onClickWithValue: !disabled ? onClickWithValue : void 0,
|
|
6741
6849
|
ref,
|
|
6742
6850
|
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:
|
|
6851
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Icon_default, { name: icon, color: iconColor ?? (!isActive ? theme2.colors.textSecondary : void 0) }),
|
|
6852
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6853
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ?? theme2.colors.textPrimary, children: text }),
|
|
6854
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
|
|
6747
6855
|
] })
|
|
6748
6856
|
]
|
|
6749
6857
|
}
|
|
6750
6858
|
);
|
|
6751
6859
|
});
|
|
6752
6860
|
TooltipComponent.divider = (0, import_react28.forwardRef)(function DividerComponent(props, ref) {
|
|
6753
|
-
const
|
|
6754
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Divider_default.horizontal, { marginBlock:
|
|
6861
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Divider_default.horizontal, { marginBlock: theme2.styles.gap, ...props, ref });
|
|
6755
6863
|
});
|
|
6756
6864
|
TooltipComponent.sectionTitle = (0, import_react28.forwardRef)(function SectionTitle({ text, ...props }, ref) {
|
|
6757
|
-
const
|
|
6865
|
+
const theme2 = (0, import_react_better_core26.useTheme)();
|
|
6758
6866
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6759
6867
|
Text_default,
|
|
6760
6868
|
{
|
|
6761
6869
|
fontSize: 12,
|
|
6762
6870
|
fontWeight: 700,
|
|
6763
6871
|
textTransform: "uppercase",
|
|
6764
|
-
marginBlock:
|
|
6765
|
-
marginInline:
|
|
6872
|
+
marginBlock: theme2.styles.gap / 2,
|
|
6873
|
+
marginInline: theme2.styles.space,
|
|
6766
6874
|
...props,
|
|
6767
6875
|
ref,
|
|
6768
6876
|
children: text
|
|
@@ -6784,7 +6892,7 @@ var tabDotSize = 6;
|
|
|
6784
6892
|
var defaultTabName = "tab";
|
|
6785
6893
|
var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
6786
6894
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
6787
|
-
const
|
|
6895
|
+
const theme2 = (0, import_react_better_core27.useTheme)();
|
|
6788
6896
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
6789
6897
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
6790
6898
|
const { colorTheme } = (0, import_react_better_core27.useBetterCoreContext)();
|
|
@@ -6800,7 +6908,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6800
6908
|
return selectedTabValue;
|
|
6801
6909
|
});
|
|
6802
6910
|
const [rerenderState, setRerenderState] = (0, import_react29.useState)(0);
|
|
6803
|
-
const tabsGap = style === "box" ?
|
|
6911
|
+
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
6804
6912
|
const onClickTab = (0, import_react29.useCallback)(
|
|
6805
6913
|
(tab) => {
|
|
6806
6914
|
setSelectedTab(tab);
|
|
@@ -6878,7 +6986,7 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6878
6986
|
},
|
|
6879
6987
|
[selectedTab, onClickTab]
|
|
6880
6988
|
);
|
|
6881
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { width: "100%", gap:
|
|
6989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
6882
6990
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
6883
6991
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
6884
6992
|
const selected = tab === selectedTab;
|
|
@@ -6887,14 +6995,14 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6887
6995
|
{
|
|
6888
6996
|
position: "relative",
|
|
6889
6997
|
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" :
|
|
6998
|
+
backgroundColor: style === "box" ? selected ? theme2.colors.primary : theme2.colors.backgroundContent : theme2.colors.backgroundBase,
|
|
6999
|
+
borderRadius: style === "box" ? theme2.styles.borderRadius : void 0,
|
|
7000
|
+
borderTopLeftRadius: style === "borderRadiusTop" ? theme2.styles.borderRadius : void 0,
|
|
7001
|
+
borderTopRightRadius: style === "borderRadiusTop" ? theme2.styles.borderRadius : void 0,
|
|
7002
|
+
border: style === "box" ? `1px solid ${selected ? "transparent" : theme2.colors.border}` : void 0,
|
|
6895
7003
|
filterHover: colorTheme === "dark" ? style === "box" ? "brightness(1.2)" : "brightness(2)" : "brightness(0.9)",
|
|
6896
|
-
paddingInline:
|
|
6897
|
-
paddingBlock:
|
|
7004
|
+
paddingInline: theme2.styles.space,
|
|
7005
|
+
paddingBlock: theme2.styles.gap,
|
|
6898
7006
|
value: tab,
|
|
6899
7007
|
cursor: "pointer",
|
|
6900
7008
|
isTabAccessed: true,
|
|
@@ -6907,21 +7015,21 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6907
7015
|
Div_default,
|
|
6908
7016
|
{
|
|
6909
7017
|
position: "absolute",
|
|
6910
|
-
top: (
|
|
6911
|
-
right: (
|
|
7018
|
+
top: (theme2.styles.space - tabDotSize) / 2,
|
|
7019
|
+
right: (theme2.styles.space - tabDotSize) / 2,
|
|
6912
7020
|
width: tabDotSize,
|
|
6913
7021
|
height: tabDotSize,
|
|
6914
|
-
backgroundColor: style === "box" && selected ?
|
|
7022
|
+
backgroundColor: style === "box" && selected ? theme2.colors.base : theme2.colors.primary,
|
|
6915
7023
|
borderRadius: 999,
|
|
6916
|
-
transition:
|
|
7024
|
+
transition: theme2.styles.transition
|
|
6917
7025
|
}
|
|
6918
7026
|
),
|
|
6919
7027
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6920
7028
|
Text_default,
|
|
6921
7029
|
{
|
|
6922
7030
|
fontWeight: 700,
|
|
6923
|
-
color: !selected ?
|
|
6924
|
-
transition:
|
|
7031
|
+
color: !selected ? theme2.colors.textSecondary : style === "box" ? theme2.colors.base : void 0,
|
|
7032
|
+
transition: theme2.styles.transition,
|
|
6925
7033
|
whiteSpace: "nowrap",
|
|
6926
7034
|
children: tab
|
|
6927
7035
|
}
|
|
@@ -6939,8 +7047,8 @@ var TabsComponent = (0, import_react29.forwardRef)(function Tabs({ tabs, name, a
|
|
|
6939
7047
|
height: tabBottomLineWidth,
|
|
6940
7048
|
bottom: 0,
|
|
6941
7049
|
left: leftSpacing,
|
|
6942
|
-
backgroundColor: accentColor ??
|
|
6943
|
-
transition: firstRenderPassedRef.current ?
|
|
7050
|
+
backgroundColor: accentColor ?? theme2.colors.primary,
|
|
7051
|
+
transition: firstRenderPassedRef.current ? theme2.styles.transition : "none"
|
|
6944
7052
|
}
|
|
6945
7053
|
)
|
|
6946
7054
|
] }),
|
|
@@ -6993,7 +7101,7 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
6993
7101
|
children,
|
|
6994
7102
|
...props
|
|
6995
7103
|
}, ref) {
|
|
6996
|
-
const
|
|
7104
|
+
const theme2 = (0, import_react_better_core28.useTheme)();
|
|
6997
7105
|
const bodyRef = (0, import_react30.useRef)(null);
|
|
6998
7106
|
const [internalIsOpen, setInternalIsOpen] = (0, import_react_better_core28.useBooleanState)(defaultOpen);
|
|
6999
7107
|
const [bodyVirtualHeight, setBodyVirtualHeight] = (0, import_react30.useState)();
|
|
@@ -7051,31 +7159,31 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7051
7159
|
{
|
|
7052
7160
|
width: "100%",
|
|
7053
7161
|
alignItems: "center",
|
|
7054
|
-
gap:
|
|
7055
|
-
paddingBlock: headerPaddingBlock ??
|
|
7162
|
+
gap: theme2.styles.space,
|
|
7163
|
+
paddingBlock: headerPaddingBlock ?? theme2.styles.gap,
|
|
7056
7164
|
paddingInline: headerPaddingInline,
|
|
7057
7165
|
cursor: "pointer",
|
|
7058
7166
|
onClick: toggleOpen,
|
|
7059
7167
|
userSelect: "none",
|
|
7060
7168
|
children: [
|
|
7061
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { flex: 1, alignItems: "center", gap:
|
|
7169
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
|
|
7062
7170
|
icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
7063
7171
|
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:
|
|
7172
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7173
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.space, children: [
|
|
7066
7174
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7067
7175
|
Text_default,
|
|
7068
7176
|
{
|
|
7069
7177
|
as: titleAs,
|
|
7070
7178
|
fontWeight: 700,
|
|
7071
7179
|
lineHeight: "20px",
|
|
7072
|
-
color: titleColor ??
|
|
7180
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
7073
7181
|
children: title
|
|
7074
7182
|
}
|
|
7075
7183
|
),
|
|
7076
7184
|
titleRightElement
|
|
7077
7185
|
] }),
|
|
7078
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { color: descriptionColor ??
|
|
7186
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text_default, { color: descriptionColor ?? theme2.colors.textSecondary, children: description })
|
|
7079
7187
|
] })
|
|
7080
7188
|
] }),
|
|
7081
7189
|
rightElement,
|
|
@@ -7084,37 +7192,37 @@ var FoldableComponent = (0, import_react30.forwardRef)(function Foldable({
|
|
|
7084
7192
|
{
|
|
7085
7193
|
name: "chevronDown",
|
|
7086
7194
|
transform: `rotate(${isOpen ? 180 : 0}deg)`,
|
|
7087
|
-
transition:
|
|
7195
|
+
transition: theme2.styles.transition
|
|
7088
7196
|
}
|
|
7089
7197
|
)
|
|
7090
7198
|
]
|
|
7091
7199
|
}
|
|
7092
7200
|
),
|
|
7093
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition:
|
|
7201
|
+
/* @__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
7202
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7095
7203
|
Div_default,
|
|
7096
7204
|
{
|
|
7097
7205
|
maxHeight: isOpen ? bodyVirtualHeight : 0,
|
|
7098
7206
|
opacity: !isOpen ? 0 : void 0,
|
|
7099
|
-
transition: `max-height ${isOpen ? animationDurationOpen : animationDurationClose}s ease, opacity ${
|
|
7207
|
+
transition: `max-height ${isOpen ? animationDurationOpen : animationDurationClose}s ease, opacity ${theme2.styles.transition}`,
|
|
7100
7208
|
overflow: !isOpen ? "hidden" : void 0,
|
|
7101
7209
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
7102
7210
|
ref: bodyRef,
|
|
7103
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { paddingBlock:
|
|
7211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
|
|
7104
7212
|
}
|
|
7105
7213
|
)
|
|
7106
7214
|
] });
|
|
7107
7215
|
});
|
|
7108
7216
|
FoldableComponent.box = (0, import_react30.forwardRef)(function Box3({ ...props }, ref) {
|
|
7109
|
-
const
|
|
7217
|
+
const theme2 = (0, import_react_better_core28.useTheme)();
|
|
7110
7218
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
7111
7219
|
FoldableComponent,
|
|
7112
7220
|
{
|
|
7113
|
-
backgroundColor:
|
|
7114
|
-
border: `1px solid ${
|
|
7115
|
-
borderRadius:
|
|
7116
|
-
headerPaddingBlock: (
|
|
7117
|
-
headerPaddingInline:
|
|
7221
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
7222
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
7223
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7224
|
+
headerPaddingBlock: (theme2.styles.gap + theme2.styles.space) / 2,
|
|
7225
|
+
headerPaddingInline: theme2.styles.space,
|
|
7118
7226
|
...props,
|
|
7119
7227
|
ref
|
|
7120
7228
|
}
|
|
@@ -7145,7 +7253,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7145
7253
|
);
|
|
7146
7254
|
}
|
|
7147
7255
|
const reactRouterDomPluginConfig = reactRouterDomPlugin2.getConfig();
|
|
7148
|
-
const
|
|
7256
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7149
7257
|
const mediaQuery = useMediaQuery();
|
|
7150
7258
|
const location = reactRouterDomPluginConfig.useLocation();
|
|
7151
7259
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
@@ -7166,20 +7274,20 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7166
7274
|
}
|
|
7167
7275
|
}, [onClick, item, isCollapsed]);
|
|
7168
7276
|
const isActive = activeItem && item.href && activeItem.href === item.href;
|
|
7169
|
-
const readyBackgroundColor = backgroundColor ??
|
|
7277
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
7170
7278
|
const iconSize = 16;
|
|
7171
|
-
const paddingBlock =
|
|
7172
|
-
const paddingLeft =
|
|
7173
|
-
const iconGap =
|
|
7279
|
+
const paddingBlock = theme2.styles.gap;
|
|
7280
|
+
const paddingLeft = theme2.styles.gap + 2;
|
|
7281
|
+
const iconGap = theme2.styles.gap;
|
|
7174
7282
|
const lineHeight = 20;
|
|
7175
7283
|
const lineWidth = 2;
|
|
7176
7284
|
const lineEndRadius = iconSize / 2 + iconGap * 2;
|
|
7177
7285
|
const content = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7178
7286
|
Tooltip_default,
|
|
7179
7287
|
{
|
|
7180
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.row, { alignItems: "center", gap:
|
|
7288
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
7181
7289
|
/* @__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:
|
|
7290
|
+
item.children && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: "chevronDown", color: theme2.colors.textSecondary, size: 14 })
|
|
7183
7291
|
] }),
|
|
7184
7292
|
contentPointerEvents: "none",
|
|
7185
7293
|
withArrow: true,
|
|
@@ -7192,26 +7300,26 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7192
7300
|
alignItems: "center",
|
|
7193
7301
|
gap: iconGap,
|
|
7194
7302
|
whiteSpace: "nowrap",
|
|
7195
|
-
backgroundColor: isActive ? colorTheme === "dark" ? (0, import_react_better_core29.lightenColor)(
|
|
7196
|
-
borderRadius:
|
|
7303
|
+
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,
|
|
7304
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7197
7305
|
paddingBlock,
|
|
7198
|
-
paddingLeft: isCollapsed ?
|
|
7199
|
-
paddingRight:
|
|
7306
|
+
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
7307
|
+
paddingRight: theme2.styles.space,
|
|
7200
7308
|
filterHover: `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})`,
|
|
7201
7309
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
7202
7310
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
7203
7311
|
opacity: item.disabled ? 0.6 : void 0,
|
|
7204
7312
|
onClick: onClickElement,
|
|
7205
7313
|
children: [
|
|
7206
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: item.iconName, color:
|
|
7314
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: item.iconName, color: theme2.colors.primary, size: iconSize, flexShrink: 0 }),
|
|
7207
7315
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7208
7316
|
Text_default,
|
|
7209
7317
|
{
|
|
7210
7318
|
flex: 1,
|
|
7211
7319
|
lineHeight: `${lineHeight}px`,
|
|
7212
|
-
color: isActive ?
|
|
7320
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
|
|
7213
7321
|
opacity: isCollapsed ? 0 : void 0,
|
|
7214
|
-
transition:
|
|
7322
|
+
transition: theme2.styles.transition,
|
|
7215
7323
|
children: item.text
|
|
7216
7324
|
}
|
|
7217
7325
|
),
|
|
@@ -7219,10 +7327,10 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7219
7327
|
Icon_default,
|
|
7220
7328
|
{
|
|
7221
7329
|
name: "chevronDown",
|
|
7222
|
-
color:
|
|
7330
|
+
color: theme2.colors.textSecondary,
|
|
7223
7331
|
size: 14,
|
|
7224
7332
|
transform: isOpened ? "rotate(180deg)" : void 0,
|
|
7225
|
-
transition:
|
|
7333
|
+
transition: theme2.styles.transition
|
|
7226
7334
|
}
|
|
7227
7335
|
)
|
|
7228
7336
|
]
|
|
@@ -7260,11 +7368,11 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7260
7368
|
{
|
|
7261
7369
|
position: "relative",
|
|
7262
7370
|
maxHeight: isOpened ? 1e3 : 0,
|
|
7263
|
-
gap:
|
|
7264
|
-
marginTop: isOpened ?
|
|
7371
|
+
gap: theme2.styles.gap / 2,
|
|
7372
|
+
marginTop: isOpened ? theme2.styles.gap / 2 : void 0,
|
|
7265
7373
|
paddingLeft: paddingLeft + iconSize + iconGap,
|
|
7266
7374
|
overflow: "hidden",
|
|
7267
|
-
transition: `max-height ${
|
|
7375
|
+
transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
|
|
7268
7376
|
children: [
|
|
7269
7377
|
item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7270
7378
|
MenuItemComponent2,
|
|
@@ -7290,7 +7398,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7290
7398
|
position: "relative",
|
|
7291
7399
|
width: lineWidth,
|
|
7292
7400
|
height: "100%",
|
|
7293
|
-
backgroundColor:
|
|
7401
|
+
backgroundColor: theme2.colors.border,
|
|
7294
7402
|
zIndex: 1
|
|
7295
7403
|
}
|
|
7296
7404
|
),
|
|
@@ -7302,7 +7410,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
|
|
|
7302
7410
|
height: lineEndRadius,
|
|
7303
7411
|
top: `calc(100% - ${lineEndRadius / 2}px)`,
|
|
7304
7412
|
left: 0,
|
|
7305
|
-
border: `${lineWidth}px solid ${
|
|
7413
|
+
border: `${lineWidth}px solid ${theme2.colors.border}`,
|
|
7306
7414
|
borderRadius: 999,
|
|
7307
7415
|
borderTopColor: readyBackgroundColor,
|
|
7308
7416
|
borderLeftColor: readyBackgroundColor,
|
|
@@ -7335,7 +7443,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7335
7443
|
backgroundColor,
|
|
7336
7444
|
paddingTop
|
|
7337
7445
|
}) {
|
|
7338
|
-
const
|
|
7446
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7339
7447
|
const mediaQuery = useMediaQuery();
|
|
7340
7448
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed, sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
7341
7449
|
const [activeItem, setActiveItem] = (0, import_react31.useState)();
|
|
@@ -7355,9 +7463,9 @@ var SideMenuComponent = function SideMenu({
|
|
|
7355
7463
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
7356
7464
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
7357
7465
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
7358
|
-
const sideMenuCollapsedWidth =
|
|
7359
|
-
const readyBackgroundColor = backgroundColor ??
|
|
7360
|
-
const logoSize = sideMenuCollapsedWidth -
|
|
7466
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
7467
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
7468
|
+
const logoSize = sideMenuCollapsedWidth - theme2.styles.space * 2;
|
|
7361
7469
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SideMenuContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
7362
7470
|
Div_default.column,
|
|
7363
7471
|
{
|
|
@@ -7367,15 +7475,15 @@ var SideMenuComponent = function SideMenu({
|
|
|
7367
7475
|
top: topSpace,
|
|
7368
7476
|
left: 0,
|
|
7369
7477
|
backgroundColor: readyBackgroundColor,
|
|
7370
|
-
borderRight: `solid 1px ${
|
|
7478
|
+
borderRight: `solid 1px ${theme2.colors.border}`,
|
|
7371
7479
|
transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
|
|
7372
|
-
paddingTop: paddingTop ?? (logoAssetName || logoUrl ?
|
|
7373
|
-
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${
|
|
7480
|
+
paddingTop: paddingTop ?? (logoAssetName || logoUrl ? theme2.styles.gap : theme2.styles.space),
|
|
7481
|
+
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${theme2.styles.transition}` : "none" : theme2.styles.transition,
|
|
7374
7482
|
userSelect: "none",
|
|
7375
7483
|
zIndex: 10,
|
|
7376
7484
|
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:
|
|
7485
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.column, { width: "100%", height: "100%", gap: theme2.styles.space, children: [
|
|
7486
|
+
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default.row, { alignItems: "center", paddingInline: theme2.styles.space, children: [
|
|
7379
7487
|
(logoAssetName || logoUrl) && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LinkComponentTag, { to: "/", href: "/", onClick: onClickXButton, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
7380
7488
|
Div_default.row,
|
|
7381
7489
|
{
|
|
@@ -7383,7 +7491,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7383
7491
|
width: sideMenuCollapsedWidth ? logoSize : void 0,
|
|
7384
7492
|
height: logoSize,
|
|
7385
7493
|
whiteSpace: "nowrap",
|
|
7386
|
-
gap:
|
|
7494
|
+
gap: theme2.styles.gap,
|
|
7387
7495
|
children: [
|
|
7388
7496
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7389
7497
|
Image_default,
|
|
@@ -7402,7 +7510,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7402
7510
|
fontSize: 22,
|
|
7403
7511
|
fontWeight: 800,
|
|
7404
7512
|
opacity: !isCollapsed ? 1 : 0,
|
|
7405
|
-
transition:
|
|
7513
|
+
transition: theme2.styles.transition,
|
|
7406
7514
|
userSelect: "none",
|
|
7407
7515
|
children: logoText
|
|
7408
7516
|
}
|
|
@@ -7419,9 +7527,9 @@ var SideMenuComponent = function SideMenu({
|
|
|
7419
7527
|
width: "100%",
|
|
7420
7528
|
height: "100%",
|
|
7421
7529
|
overflowY: !isCollapsed ? "auto" : void 0,
|
|
7422
|
-
paddingInline:
|
|
7423
|
-
paddingBottom: !isCollapsable && !readyBottomItems ?
|
|
7424
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default.column, { gap:
|
|
7530
|
+
paddingInline: theme2.styles.space,
|
|
7531
|
+
paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
|
|
7532
|
+
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
7533
|
MenuItemComponent,
|
|
7426
7534
|
{
|
|
7427
7535
|
item,
|
|
@@ -7435,12 +7543,12 @@ var SideMenuComponent = function SideMenu({
|
|
|
7435
7543
|
readyBottomItems && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7436
7544
|
Div_default.column,
|
|
7437
7545
|
{
|
|
7438
|
-
borderTop: mediaQuery.size1000 ? `solid 1px ${
|
|
7439
|
-
gap:
|
|
7546
|
+
borderTop: mediaQuery.size1000 ? `solid 1px ${theme2.colors.border}` : void 0,
|
|
7547
|
+
gap: theme2.styles.gap / 2,
|
|
7440
7548
|
marginTop: "auto",
|
|
7441
|
-
paddingTop: mediaQuery.size1000 ?
|
|
7442
|
-
paddingInline:
|
|
7443
|
-
paddingBottom: !isCollapsable ?
|
|
7549
|
+
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
7550
|
+
paddingInline: theme2.styles.space,
|
|
7551
|
+
paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
|
|
7444
7552
|
children: readyBottomItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7445
7553
|
MenuItemComponent,
|
|
7446
7554
|
{
|
|
@@ -7457,30 +7565,30 @@ var SideMenuComponent = function SideMenu({
|
|
|
7457
7565
|
isCollapsable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7458
7566
|
Div_default,
|
|
7459
7567
|
{
|
|
7460
|
-
borderTop: `solid 1px ${
|
|
7568
|
+
borderTop: `solid 1px ${theme2.colors.border}`,
|
|
7461
7569
|
marginTop: !readyBottomItems ? "auto" : void 0,
|
|
7462
|
-
paddingInline:
|
|
7463
|
-
paddingBlock:
|
|
7570
|
+
paddingInline: theme2.styles.space,
|
|
7571
|
+
paddingBlock: theme2.styles.space,
|
|
7464
7572
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7465
7573
|
Div_default.row,
|
|
7466
7574
|
{
|
|
7467
7575
|
alignItems: "center",
|
|
7468
7576
|
justifyContent: "center",
|
|
7469
7577
|
backgroundColor: readyBackgroundColor,
|
|
7470
|
-
borderRadius:
|
|
7578
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7471
7579
|
cursor: "pointer",
|
|
7472
7580
|
filterHover: filterHover().z1,
|
|
7473
7581
|
isTabAccessed: true,
|
|
7474
|
-
paddingBlock:
|
|
7582
|
+
paddingBlock: theme2.styles.gap,
|
|
7475
7583
|
onClick: setSideMenuIsCollapsed.toggle,
|
|
7476
7584
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7477
7585
|
Icon_default,
|
|
7478
7586
|
{
|
|
7479
7587
|
name: "chevronRight",
|
|
7480
7588
|
size: 20,
|
|
7481
|
-
color:
|
|
7589
|
+
color: theme2.colors.textSecondary,
|
|
7482
7590
|
transform: `rotate(${isCollapsed ? 0 : 180}deg)`,
|
|
7483
|
-
transition:
|
|
7591
|
+
transition: theme2.styles.transition
|
|
7484
7592
|
}
|
|
7485
7593
|
)
|
|
7486
7594
|
}
|
|
@@ -7492,30 +7600,30 @@ var SideMenuComponent = function SideMenu({
|
|
|
7492
7600
|
Div_default.row,
|
|
7493
7601
|
{
|
|
7494
7602
|
position: "absolute",
|
|
7495
|
-
top:
|
|
7603
|
+
top: theme2.styles.space,
|
|
7496
7604
|
left: "100%",
|
|
7497
7605
|
backgroundColor: readyBackgroundColor,
|
|
7498
|
-
border: `solid 1px ${
|
|
7606
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
7499
7607
|
borderLeft: "none",
|
|
7500
|
-
borderTopRightRadius:
|
|
7501
|
-
borderBottomRightRadius:
|
|
7608
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
7609
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
7502
7610
|
alignItems: "center",
|
|
7503
7611
|
cursor: "pointer",
|
|
7504
7612
|
opacity: !mediaQuery.size1000 ? 0 : void 0,
|
|
7505
7613
|
pointerEvents: !mediaQuery.size1000 ? "none" : void 0,
|
|
7506
|
-
padding:
|
|
7507
|
-
paddingRight: (
|
|
7614
|
+
padding: theme2.styles.gap,
|
|
7615
|
+
paddingRight: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
7508
7616
|
transform: !mediaQuery.size1000 ? "translateX(-100%)" : void 0,
|
|
7509
|
-
transition:
|
|
7617
|
+
transition: theme2.styles.transition,
|
|
7510
7618
|
onClick: setSideMenuIsOpenMobile.toggle,
|
|
7511
7619
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7512
7620
|
Icon_default,
|
|
7513
7621
|
{
|
|
7514
7622
|
name: "chevronRight",
|
|
7515
7623
|
size: 20,
|
|
7516
|
-
color:
|
|
7624
|
+
color: theme2.colors.textSecondary,
|
|
7517
7625
|
transform: sideMenuIsOpenMobile ? "rotate(180deg)" : void 0,
|
|
7518
|
-
transition:
|
|
7626
|
+
transition: theme2.styles.transition
|
|
7519
7627
|
}
|
|
7520
7628
|
)
|
|
7521
7629
|
}
|
|
@@ -7526,18 +7634,18 @@ var SideMenuComponent = function SideMenu({
|
|
|
7526
7634
|
) });
|
|
7527
7635
|
};
|
|
7528
7636
|
SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, ...props }) {
|
|
7529
|
-
const
|
|
7637
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7530
7638
|
const mediaQuery = useMediaQuery();
|
|
7531
7639
|
const { components, sideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
7532
7640
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
7533
|
-
const sideMenuCollapsedWidth =
|
|
7641
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
7534
7642
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
7535
7643
|
Div_default,
|
|
7536
7644
|
{
|
|
7537
7645
|
position: "relative",
|
|
7538
7646
|
width: "100%",
|
|
7539
7647
|
paddingLeft: !mediaQuery.size1000 ? !sideMenuIsCollapsed ? sideMenuWidth : sideMenuCollapsedWidth : void 0,
|
|
7540
|
-
transition:
|
|
7648
|
+
transition: theme2.styles.transition,
|
|
7541
7649
|
children: [
|
|
7542
7650
|
outsideComponent,
|
|
7543
7651
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PageHolder_default, { ...props })
|
|
@@ -7546,7 +7654,7 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
|
|
|
7546
7654
|
);
|
|
7547
7655
|
};
|
|
7548
7656
|
SideMenuComponent.burgerButton = function BurgerButton() {
|
|
7549
|
-
const
|
|
7657
|
+
const theme2 = (0, import_react_better_core29.useTheme)();
|
|
7550
7658
|
const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
7551
7659
|
const [isHovered, setIsHovered] = (0, import_react_better_core29.useBooleanState)();
|
|
7552
7660
|
const width = 2;
|
|
@@ -7570,10 +7678,10 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7570
7678
|
height: width,
|
|
7571
7679
|
top: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
|
|
7572
7680
|
left: 0,
|
|
7573
|
-
backgroundColor:
|
|
7681
|
+
backgroundColor: theme2.colors.border,
|
|
7574
7682
|
borderRadius: 999,
|
|
7575
7683
|
transform: sideMenuIsOpenMobile ? "rotate(45deg)" : void 0,
|
|
7576
|
-
transition:
|
|
7684
|
+
transition: theme2.styles.transition
|
|
7577
7685
|
}
|
|
7578
7686
|
),
|
|
7579
7687
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -7584,11 +7692,11 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7584
7692
|
height: width,
|
|
7585
7693
|
top: "50%",
|
|
7586
7694
|
left: 0,
|
|
7587
|
-
backgroundColor:
|
|
7695
|
+
backgroundColor: theme2.colors.border,
|
|
7588
7696
|
borderRadius: 999,
|
|
7589
7697
|
transform: "translateY(-50%)",
|
|
7590
7698
|
opacity: sideMenuIsOpenMobile ? 0 : void 0,
|
|
7591
|
-
transition:
|
|
7699
|
+
transition: theme2.styles.transition
|
|
7592
7700
|
}
|
|
7593
7701
|
),
|
|
7594
7702
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -7599,10 +7707,10 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7599
7707
|
height: width,
|
|
7600
7708
|
bottom: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
|
|
7601
7709
|
left: 0,
|
|
7602
|
-
backgroundColor:
|
|
7710
|
+
backgroundColor: theme2.colors.border,
|
|
7603
7711
|
borderRadius: 999,
|
|
7604
7712
|
transform: sideMenuIsOpenMobile ? "rotate(-45deg)" : void 0,
|
|
7605
|
-
transition:
|
|
7713
|
+
transition: theme2.styles.transition
|
|
7606
7714
|
}
|
|
7607
7715
|
)
|
|
7608
7716
|
]
|