react-better-html 1.1.217 → 1.1.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +1021 -912
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1148 -1038
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.mjs
CHANGED
|
@@ -14,20 +14,20 @@ import {
|
|
|
14
14
|
eventStopPropagation,
|
|
15
15
|
eventPreventStop,
|
|
16
16
|
getPluralWord as getPluralWord2,
|
|
17
|
-
useBooleanState as
|
|
17
|
+
useBooleanState as useBooleanState9,
|
|
18
18
|
useDebounceState as useDebounceState3,
|
|
19
19
|
loaderControls,
|
|
20
20
|
colorThemeControls as colorThemeControls2
|
|
21
21
|
} from "react-better-core";
|
|
22
22
|
|
|
23
23
|
// src/components/BetterHtmlProvider.tsx
|
|
24
|
-
import { createContext, memo as
|
|
24
|
+
import { createContext, memo as memo12, useCallback as useCallback6, useContext, useEffect as useEffect6, useMemo as useMemo3, useState as useState4 } from "react";
|
|
25
25
|
import {
|
|
26
|
-
useBooleanState as
|
|
26
|
+
useBooleanState as useBooleanState3,
|
|
27
27
|
colorThemeControls,
|
|
28
|
-
useTheme as
|
|
28
|
+
useTheme as useTheme13,
|
|
29
29
|
BetterCoreProvider,
|
|
30
|
-
useBetterCoreContext as
|
|
30
|
+
useBetterCoreContext as useBetterCoreContext5
|
|
31
31
|
} from "react-better-core";
|
|
32
32
|
import { createGlobalStyle } from "styled-components";
|
|
33
33
|
|
|
@@ -38,6 +38,9 @@ var appConfig = {
|
|
|
38
38
|
var defaultAlertDuration = 2.3 * 1e3;
|
|
39
39
|
var defaultSideMenuWidth = 300;
|
|
40
40
|
|
|
41
|
+
// src/constants/theme.ts
|
|
42
|
+
var theme = {};
|
|
43
|
+
|
|
41
44
|
// src/constants/icons.ts
|
|
42
45
|
var icons = {
|
|
43
46
|
uploadCloud: {
|
|
@@ -116,13 +119,13 @@ var icons = {
|
|
|
116
119
|
var assets = {};
|
|
117
120
|
|
|
118
121
|
// src/components/alerts/AlertsHolder.tsx
|
|
119
|
-
import { memo as
|
|
120
|
-
import { useTheme as
|
|
122
|
+
import { memo as memo11 } from "react";
|
|
123
|
+
import { useTheme as useTheme12 } from "react-better-core";
|
|
121
124
|
|
|
122
125
|
// src/components/Div.tsx
|
|
123
|
-
import { forwardRef as
|
|
124
|
-
import { useTheme as
|
|
125
|
-
import
|
|
126
|
+
import { forwardRef as forwardRef6, memo as memo6, useCallback as useCallback2 } from "react";
|
|
127
|
+
import { useTheme as useTheme7 } from "react-better-core";
|
|
128
|
+
import styled4 from "styled-components";
|
|
126
129
|
|
|
127
130
|
// src/constants.ts
|
|
128
131
|
var isMobileDevice = /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
@@ -804,7 +807,7 @@ var cssPropsToExclude = /* @__PURE__ */ new Set([
|
|
|
804
807
|
|
|
805
808
|
// src/utils/hooks.ts
|
|
806
809
|
function useComponentPropsGrouper(props, excludeStyleProps) {
|
|
807
|
-
const
|
|
810
|
+
const theme2 = useTheme();
|
|
808
811
|
return useMemo(() => {
|
|
809
812
|
const style = {};
|
|
810
813
|
const hoverStyle = {};
|
|
@@ -831,8 +834,8 @@ function useComponentPropsGrouper(props, excludeStyleProps) {
|
|
|
831
834
|
}
|
|
832
835
|
}
|
|
833
836
|
if (haveHover && !style.transition) {
|
|
834
|
-
style.transition =
|
|
835
|
-
style.WebkitTransition =
|
|
837
|
+
style.transition = theme2.styles.transition;
|
|
838
|
+
style.WebkitTransition = theme2.styles.transition;
|
|
836
839
|
}
|
|
837
840
|
return {
|
|
838
841
|
style,
|
|
@@ -854,7 +857,7 @@ function useComponentPropsWithPrefix(props, prefix) {
|
|
|
854
857
|
}, [props, prefix]);
|
|
855
858
|
}
|
|
856
859
|
function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
857
|
-
const
|
|
860
|
+
const theme2 = useTheme();
|
|
858
861
|
const [isOpen, setIsOpen] = useBooleanState();
|
|
859
862
|
const [isOpenLate, setIsOpenLate] = useBooleanState();
|
|
860
863
|
const [isFocused, setIsFocused] = useBooleanState();
|
|
@@ -885,13 +888,13 @@ function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
|
885
888
|
);
|
|
886
889
|
const insideInputFieldComponentProps = useMemo(
|
|
887
890
|
() => ({
|
|
888
|
-
border: `1px solid ${isFocused ?
|
|
891
|
+
border: `1px solid ${isFocused ? theme2.colors.primary : theme2.colors.border}`,
|
|
889
892
|
borderTop: "none",
|
|
890
893
|
opacity: !isOpen ? 0 : void 0,
|
|
891
894
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
892
895
|
transform: `translateY(${!isOpen ? -10 : 0}px)`,
|
|
893
896
|
zIndex: 1e3,
|
|
894
|
-
transition:
|
|
897
|
+
transition: theme2.styles.transition
|
|
895
898
|
}),
|
|
896
899
|
[isOpen, isFocused]
|
|
897
900
|
);
|
|
@@ -1311,8 +1314,8 @@ var TextComponent = forwardRef(function Text({ htmlContentTranslate, children, .
|
|
|
1311
1314
|
);
|
|
1312
1315
|
});
|
|
1313
1316
|
TextComponent.unknown = forwardRef(function Unknown(props, ref) {
|
|
1314
|
-
const
|
|
1315
|
-
return /* @__PURE__ */ jsx(TextComponent, { fontStyle: "italic", textAlign: "center", color:
|
|
1317
|
+
const theme2 = useTheme2();
|
|
1318
|
+
return /* @__PURE__ */ jsx(TextComponent, { fontStyle: "italic", textAlign: "center", color: theme2.colors.textSecondary, ref, ...props });
|
|
1316
1319
|
});
|
|
1317
1320
|
TextComponent.oneLine = forwardRef(function OneLine(props, ref) {
|
|
1318
1321
|
return /* @__PURE__ */ jsx(TextComponent, { textOverflow: "ellipsis", whiteSpace: "nowrap", overflow: "hidden", ref, ...props });
|
|
@@ -1327,14 +1330,14 @@ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
|
1327
1330
|
var Divider_default = {
|
|
1328
1331
|
vertical: memo2(
|
|
1329
1332
|
forwardRef2(function Divider({ width = 1, backgroundColor, height, ...props }, ref) {
|
|
1330
|
-
const
|
|
1333
|
+
const theme2 = useTheme3();
|
|
1331
1334
|
return /* @__PURE__ */ jsx2(
|
|
1332
1335
|
Div_default,
|
|
1333
1336
|
{
|
|
1334
1337
|
width,
|
|
1335
1338
|
height: height ?? "100%",
|
|
1336
1339
|
flexShrink: 0,
|
|
1337
|
-
backgroundColor: backgroundColor ??
|
|
1340
|
+
backgroundColor: backgroundColor ?? theme2.colors.border,
|
|
1338
1341
|
...props,
|
|
1339
1342
|
ref
|
|
1340
1343
|
}
|
|
@@ -1343,19 +1346,19 @@ var Divider_default = {
|
|
|
1343
1346
|
),
|
|
1344
1347
|
horizontal: memo2(
|
|
1345
1348
|
forwardRef2(function Divider2({ width = 1, backgroundColor, text, textFontSize, textColor, ...props }, ref) {
|
|
1346
|
-
const
|
|
1347
|
-
return /* @__PURE__ */ jsxs(Div_default.row, { width: "100%", alignItems: "center", gap: text ?
|
|
1348
|
-
/* @__PURE__ */ jsx2(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ??
|
|
1349
|
-
text && /* @__PURE__ */ jsx2(Text_default, { fontSize: textFontSize, color: textColor ??
|
|
1350
|
-
/* @__PURE__ */ jsx2(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ??
|
|
1349
|
+
const theme2 = useTheme3();
|
|
1350
|
+
return /* @__PURE__ */ jsxs(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, ref, children: [
|
|
1351
|
+
/* @__PURE__ */ jsx2(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
|
|
1352
|
+
text && /* @__PURE__ */ jsx2(Text_default, { fontSize: textFontSize, color: textColor ?? theme2.colors.textSecondary, children: text }),
|
|
1353
|
+
/* @__PURE__ */ jsx2(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
|
|
1351
1354
|
] });
|
|
1352
1355
|
})
|
|
1353
1356
|
)
|
|
1354
1357
|
};
|
|
1355
1358
|
|
|
1356
1359
|
// src/components/PageHeader.tsx
|
|
1357
|
-
import { forwardRef as
|
|
1358
|
-
import { useTheme as
|
|
1360
|
+
import { forwardRef as forwardRef5, memo as memo5 } from "react";
|
|
1361
|
+
import { useTheme as useTheme6 } from "react-better-core";
|
|
1359
1362
|
|
|
1360
1363
|
// src/components/Image.tsx
|
|
1361
1364
|
import { forwardRef as forwardRef3, memo as memo3, useEffect as useEffect2 } from "react";
|
|
@@ -1401,19 +1404,19 @@ var Image = forwardRef3(function Image2({ name, src, ...props }, ref) {
|
|
|
1401
1404
|
);
|
|
1402
1405
|
});
|
|
1403
1406
|
Image.profileImage = forwardRef3(function ProfileImage({ size = 40, letters, backgroundColor, ...props }, ref) {
|
|
1404
|
-
const
|
|
1407
|
+
const theme2 = useTheme4();
|
|
1405
1408
|
return letters ? /* @__PURE__ */ jsx3(
|
|
1406
1409
|
Div_default.row,
|
|
1407
1410
|
{
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
backgroundColor: backgroundColor ?? theme.colors.backgroundSecondary,
|
|
1411
|
-
border: `solid 1px ${theme.colors.border}`,
|
|
1411
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
1412
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
1412
1413
|
borderRadius: 999,
|
|
1413
1414
|
alignItems: "center",
|
|
1414
1415
|
justifyContent: "center",
|
|
1415
1416
|
ref,
|
|
1416
1417
|
...props,
|
|
1418
|
+
width: size,
|
|
1419
|
+
height: size,
|
|
1417
1420
|
children: /* @__PURE__ */ jsx3(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
1418
1421
|
}
|
|
1419
1422
|
) : /* @__PURE__ */ jsx3(
|
|
@@ -1421,7 +1424,7 @@ Image.profileImage = forwardRef3(function ProfileImage({ size = 40, letters, bac
|
|
|
1421
1424
|
{
|
|
1422
1425
|
width: size,
|
|
1423
1426
|
height: size,
|
|
1424
|
-
border: `solid 1px ${
|
|
1427
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
1425
1428
|
borderRadius: 999,
|
|
1426
1429
|
objectFit: "cover",
|
|
1427
1430
|
ref,
|
|
@@ -1433,11 +1436,89 @@ var MemoizedImage = memo3(Image);
|
|
|
1433
1436
|
MemoizedImage.profileImage = Image.profileImage;
|
|
1434
1437
|
var Image_default = { Image: MemoizedImage }.Image;
|
|
1435
1438
|
|
|
1439
|
+
// src/components/Icon.tsx
|
|
1440
|
+
import { forwardRef as forwardRef4, memo as memo4, useEffect as useEffect3 } from "react";
|
|
1441
|
+
import { useBetterCoreContext as useBetterCoreContext2, useTheme as useTheme5 } from "react-better-core";
|
|
1442
|
+
import styled3 from "styled-components";
|
|
1443
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
1444
|
+
import { createElement } from "react";
|
|
1445
|
+
var IconElement = styled3.svg.withConfig({
|
|
1446
|
+
shouldForwardProp: (prop) => !["theme", "style", "hoverStyle", "hoverColor"].includes(prop)
|
|
1447
|
+
})`
|
|
1448
|
+
${(props) => props.style}
|
|
1449
|
+
|
|
1450
|
+
path {
|
|
1451
|
+
${(props) => props.hoverColor ? `transition: ${props.theme.styles.transition};` : ""}
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
&:hover {
|
|
1455
|
+
path.react-better-html-icon-path-with-fill {
|
|
1456
|
+
fill: ${(props) => props.hoverColor};
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
path.react-better-html-icon-path-with-stroke {
|
|
1460
|
+
stroke: ${(props) => props.hoverColor};
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
&:hover {
|
|
1465
|
+
${(props) => props.hoverStyle}
|
|
1466
|
+
}
|
|
1467
|
+
`;
|
|
1468
|
+
var Icon = forwardRef4(function Icon2({ name, size = 16, ...props }, ref) {
|
|
1469
|
+
const theme2 = useTheme5();
|
|
1470
|
+
const { icons: icons2 } = useBetterCoreContext2();
|
|
1471
|
+
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
1472
|
+
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
1473
|
+
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
1474
|
+
const svgColor = props.color ?? theme2.colors.textPrimary;
|
|
1475
|
+
const svgHoverColorColor = props.colorHover;
|
|
1476
|
+
useEffect3(() => {
|
|
1477
|
+
if (!icons2[name.toString()])
|
|
1478
|
+
console.warn(
|
|
1479
|
+
`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.`
|
|
1480
|
+
);
|
|
1481
|
+
}, [icons2, name]);
|
|
1482
|
+
return /* @__PURE__ */ jsx4(
|
|
1483
|
+
IconElement,
|
|
1484
|
+
{
|
|
1485
|
+
width: size,
|
|
1486
|
+
height: size,
|
|
1487
|
+
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1488
|
+
fill: "none",
|
|
1489
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1490
|
+
theme: theme2,
|
|
1491
|
+
hoverColor: svgHoverColorColor,
|
|
1492
|
+
style,
|
|
1493
|
+
hoverStyle,
|
|
1494
|
+
...restProps,
|
|
1495
|
+
...dataProps,
|
|
1496
|
+
...ariaProps,
|
|
1497
|
+
ref,
|
|
1498
|
+
children: icons2[name.toString()]?.paths.map((path) => /* @__PURE__ */ createElement(
|
|
1499
|
+
"path",
|
|
1500
|
+
{
|
|
1501
|
+
...path,
|
|
1502
|
+
className: path.type === "fill" ? "react-better-html-icon-path-with-fill" : "react-better-html-icon-path-with-stroke",
|
|
1503
|
+
fill: path.type === "fill" ? svgColor : void 0,
|
|
1504
|
+
stroke: path.type === "stroke" ? svgColor : void 0,
|
|
1505
|
+
key: path.d
|
|
1506
|
+
}
|
|
1507
|
+
))
|
|
1508
|
+
}
|
|
1509
|
+
);
|
|
1510
|
+
});
|
|
1511
|
+
var MemoizedIcon = memo4(Icon);
|
|
1512
|
+
var Icon_default = { Icon: MemoizedIcon }.Icon;
|
|
1513
|
+
|
|
1436
1514
|
// src/components/PageHeader.tsx
|
|
1437
|
-
import { jsx as
|
|
1438
|
-
var PageHeaderComponent =
|
|
1515
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
1516
|
+
var PageHeaderComponent = forwardRef5(function PageHeader({
|
|
1517
|
+
icon,
|
|
1518
|
+
image,
|
|
1439
1519
|
imageUrl,
|
|
1440
1520
|
imageSize = 60,
|
|
1521
|
+
imageAzProfileImage,
|
|
1441
1522
|
title,
|
|
1442
1523
|
titleAs = "h1",
|
|
1443
1524
|
titleColor,
|
|
@@ -1449,38 +1530,51 @@ var PageHeaderComponent = forwardRef4(function PageHeader({
|
|
|
1449
1530
|
lightMode,
|
|
1450
1531
|
marginBottom
|
|
1451
1532
|
}, ref) {
|
|
1452
|
-
const
|
|
1533
|
+
const theme2 = useTheme6();
|
|
1453
1534
|
const { app } = useBetterHtmlContextInternal();
|
|
1454
1535
|
const mediaQuery = useMediaQuery();
|
|
1536
|
+
const ImageTag = imageAzProfileImage ? Image_default.profileImage : Image_default;
|
|
1537
|
+
const readyImageSize = imageSize ?? (mediaQuery.size600 ? 46 : 60);
|
|
1455
1538
|
return /* @__PURE__ */ jsxs2(
|
|
1456
1539
|
Div_default.row,
|
|
1457
1540
|
{
|
|
1458
1541
|
alignItems: "center",
|
|
1459
|
-
gap:
|
|
1460
|
-
marginBottom: marginBottom ??
|
|
1542
|
+
gap: theme2.styles.space,
|
|
1543
|
+
marginBottom: marginBottom ?? theme2.styles.space * 2,
|
|
1461
1544
|
ref,
|
|
1462
1545
|
children: [
|
|
1463
|
-
|
|
1546
|
+
icon && /* @__PURE__ */ jsx5(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
1547
|
+
(image || imageUrl) && /* @__PURE__ */ jsx5(
|
|
1548
|
+
ImageTag,
|
|
1549
|
+
{
|
|
1550
|
+
name: image,
|
|
1551
|
+
src: imageUrl,
|
|
1552
|
+
width: readyImageSize,
|
|
1553
|
+
height: readyImageSize,
|
|
1554
|
+
size: readyImageSize,
|
|
1555
|
+
flexShrink: 0
|
|
1556
|
+
}
|
|
1557
|
+
),
|
|
1464
1558
|
/* @__PURE__ */ jsxs2(
|
|
1465
1559
|
Div_default.column,
|
|
1466
1560
|
{
|
|
1467
1561
|
alignItems: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
|
|
1468
1562
|
flex: 1,
|
|
1469
|
-
gap:
|
|
1563
|
+
gap: theme2.styles.gap / 2,
|
|
1470
1564
|
children: [
|
|
1471
1565
|
/* @__PURE__ */ jsxs2(
|
|
1472
1566
|
Div_default.row,
|
|
1473
1567
|
{
|
|
1474
1568
|
alignItems: "center",
|
|
1475
1569
|
justifyContent: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
|
|
1476
|
-
gap:
|
|
1570
|
+
gap: theme2.styles.space,
|
|
1477
1571
|
children: [
|
|
1478
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ jsx5(
|
|
1479
1573
|
Text_default,
|
|
1480
1574
|
{
|
|
1481
1575
|
as: titleAs,
|
|
1482
1576
|
textAlign,
|
|
1483
|
-
color: titleColor ?? (lightMode ?
|
|
1577
|
+
color: titleColor ?? (lightMode ? theme2.colors.base : theme2.colors.textPrimary),
|
|
1484
1578
|
children: title
|
|
1485
1579
|
}
|
|
1486
1580
|
),
|
|
@@ -1488,12 +1582,12 @@ var PageHeaderComponent = forwardRef4(function PageHeader({
|
|
|
1488
1582
|
]
|
|
1489
1583
|
}
|
|
1490
1584
|
),
|
|
1491
|
-
description && /* @__PURE__ */
|
|
1585
|
+
description && /* @__PURE__ */ jsx5(
|
|
1492
1586
|
Text_default,
|
|
1493
1587
|
{
|
|
1494
1588
|
maxWidth: !mediaQuery.size600 ? app.contentMaxWidth * 0.6 : void 0,
|
|
1495
1589
|
textAlign,
|
|
1496
|
-
color: descriptionColor ?? (lightMode ?
|
|
1590
|
+
color: descriptionColor ?? (lightMode ? theme2.colors.base : theme2.colors.textSecondary),
|
|
1497
1591
|
opacity: lightMode ? 0.7 : void 0,
|
|
1498
1592
|
children: description
|
|
1499
1593
|
}
|
|
@@ -1506,12 +1600,12 @@ var PageHeaderComponent = forwardRef4(function PageHeader({
|
|
|
1506
1600
|
}
|
|
1507
1601
|
);
|
|
1508
1602
|
});
|
|
1509
|
-
var PageHeader2 =
|
|
1603
|
+
var PageHeader2 = memo5(PageHeaderComponent);
|
|
1510
1604
|
var PageHeader_default = PageHeader2;
|
|
1511
1605
|
|
|
1512
1606
|
// src/components/Div.tsx
|
|
1513
|
-
import { jsx as
|
|
1514
|
-
var DivStyledComponent =
|
|
1607
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1608
|
+
var DivStyledComponent = styled4.div.withConfig({
|
|
1515
1609
|
shouldForwardProp: (prop) => !["style", "hoverStyle"].includes(prop)
|
|
1516
1610
|
})`
|
|
1517
1611
|
${(props) => props.style}
|
|
@@ -1520,7 +1614,7 @@ var DivStyledComponent = styled3.div.withConfig({
|
|
|
1520
1614
|
${(props) => props.hoverStyle}
|
|
1521
1615
|
}
|
|
1522
1616
|
`;
|
|
1523
|
-
var DivComponent =
|
|
1617
|
+
var DivComponent = forwardRef6(function Div({
|
|
1524
1618
|
as = "div",
|
|
1525
1619
|
value,
|
|
1526
1620
|
isTabAccessed,
|
|
@@ -1553,7 +1647,7 @@ var DivComponent = forwardRef5(function Div({
|
|
|
1553
1647
|
},
|
|
1554
1648
|
[onKeyDown, isTabAccessed]
|
|
1555
1649
|
);
|
|
1556
|
-
return /* @__PURE__ */
|
|
1650
|
+
return /* @__PURE__ */ jsx6(
|
|
1557
1651
|
DivStyledComponent,
|
|
1558
1652
|
{
|
|
1559
1653
|
as,
|
|
@@ -1572,9 +1666,9 @@ var DivComponent = forwardRef5(function Div({
|
|
|
1572
1666
|
}
|
|
1573
1667
|
);
|
|
1574
1668
|
});
|
|
1575
|
-
DivComponent.row =
|
|
1669
|
+
DivComponent.row = forwardRef6(function Row({ flexReverse, invertFlexDirection, ...props }, ref) {
|
|
1576
1670
|
const reverseSuffix = flexReverse ? "-reverse" : "";
|
|
1577
|
-
return /* @__PURE__ */
|
|
1671
|
+
return /* @__PURE__ */ jsx6(
|
|
1578
1672
|
DivComponent,
|
|
1579
1673
|
{
|
|
1580
1674
|
display: "flex",
|
|
@@ -1584,9 +1678,9 @@ DivComponent.row = forwardRef5(function Row({ flexReverse, invertFlexDirection,
|
|
|
1584
1678
|
}
|
|
1585
1679
|
);
|
|
1586
1680
|
});
|
|
1587
|
-
DivComponent.column =
|
|
1681
|
+
DivComponent.column = forwardRef6(function Column({ flexReverse, invertFlexDirection, ...props }, ref) {
|
|
1588
1682
|
const reverseSuffix = flexReverse ? "-reverse" : "";
|
|
1589
|
-
return /* @__PURE__ */
|
|
1683
|
+
return /* @__PURE__ */ jsx6(
|
|
1590
1684
|
DivComponent,
|
|
1591
1685
|
{
|
|
1592
1686
|
display: "flex",
|
|
@@ -1596,10 +1690,10 @@ DivComponent.column = forwardRef5(function Column({ flexReverse, invertFlexDirec
|
|
|
1596
1690
|
}
|
|
1597
1691
|
);
|
|
1598
1692
|
});
|
|
1599
|
-
DivComponent.grid =
|
|
1600
|
-
return /* @__PURE__ */
|
|
1693
|
+
DivComponent.grid = forwardRef6(function Grid(props, ref) {
|
|
1694
|
+
return /* @__PURE__ */ jsx6(DivComponent, { display: "grid", ref, ...props });
|
|
1601
1695
|
});
|
|
1602
|
-
DivComponent.box =
|
|
1696
|
+
DivComponent.box = forwardRef6(function Box({
|
|
1603
1697
|
imageUrl,
|
|
1604
1698
|
imageSize,
|
|
1605
1699
|
title,
|
|
@@ -1616,20 +1710,20 @@ DivComponent.box = forwardRef5(function Box({
|
|
|
1616
1710
|
children,
|
|
1617
1711
|
...props
|
|
1618
1712
|
}, ref) {
|
|
1619
|
-
const
|
|
1713
|
+
const theme2 = useTheme7();
|
|
1620
1714
|
const withClick = props.onClick || props.onClickWithValue;
|
|
1621
1715
|
return /* @__PURE__ */ jsxs3(
|
|
1622
1716
|
DivComponent,
|
|
1623
1717
|
{
|
|
1624
|
-
color: isActive ?
|
|
1625
|
-
backgroundColor: isActive ?
|
|
1626
|
-
border: `1px solid ${isActive ?
|
|
1627
|
-
borderRadius:
|
|
1628
|
-
borderColorHover: withClick && !isActive ?
|
|
1718
|
+
color: isActive ? theme2.colors.base : void 0,
|
|
1719
|
+
backgroundColor: isActive ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
1720
|
+
border: `1px solid ${isActive ? theme2.colors.primary : theme2.colors.border}`,
|
|
1721
|
+
borderRadius: theme2.styles.borderRadius,
|
|
1722
|
+
borderColorHover: withClick && !isActive ? theme2.colors.primary : void 0,
|
|
1629
1723
|
filterHover: withClick && isActive ? "brightness(0.9)" : void 0,
|
|
1630
1724
|
cursor: withClick ? "pointer" : void 0,
|
|
1631
|
-
paddingBlock: title ?
|
|
1632
|
-
paddingInline:
|
|
1725
|
+
paddingBlock: title ? theme2.styles.space : theme2.styles.gap,
|
|
1726
|
+
paddingInline: theme2.styles.space,
|
|
1633
1727
|
ref,
|
|
1634
1728
|
...props,
|
|
1635
1729
|
children: [
|
|
@@ -1637,15 +1731,15 @@ DivComponent.box = forwardRef5(function Box({
|
|
|
1637
1731
|
Div2,
|
|
1638
1732
|
{
|
|
1639
1733
|
backgroundColor: headerBackgroundColor,
|
|
1640
|
-
borderTopLeftRadius: props.borderTopLeftRadius ?? props.borderRadius ??
|
|
1641
|
-
borderTopRightRadius: props.borderTopRightRadius ?? props.borderRadius ??
|
|
1642
|
-
marginInline: -
|
|
1643
|
-
marginTop: -
|
|
1644
|
-
marginBottom:
|
|
1645
|
-
paddingInline:
|
|
1646
|
-
paddingTop:
|
|
1734
|
+
borderTopLeftRadius: props.borderTopLeftRadius ?? props.borderRadius ?? theme2.styles.borderRadius - 1,
|
|
1735
|
+
borderTopRightRadius: props.borderTopRightRadius ?? props.borderRadius ?? theme2.styles.borderRadius - 1,
|
|
1736
|
+
marginInline: -theme2.styles.space,
|
|
1737
|
+
marginTop: -theme2.styles.space,
|
|
1738
|
+
marginBottom: theme2.styles.space,
|
|
1739
|
+
paddingInline: theme2.styles.space,
|
|
1740
|
+
paddingTop: theme2.styles.space,
|
|
1647
1741
|
children: [
|
|
1648
|
-
/* @__PURE__ */
|
|
1742
|
+
/* @__PURE__ */ jsx6(
|
|
1649
1743
|
PageHeader_default,
|
|
1650
1744
|
{
|
|
1651
1745
|
imageUrl,
|
|
@@ -1659,10 +1753,10 @@ DivComponent.box = forwardRef5(function Box({
|
|
|
1659
1753
|
textAlign,
|
|
1660
1754
|
rightElement,
|
|
1661
1755
|
lightMode,
|
|
1662
|
-
marginBottom:
|
|
1756
|
+
marginBottom: theme2.styles.space
|
|
1663
1757
|
}
|
|
1664
1758
|
),
|
|
1665
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ jsx6(Div2, { width: `calc(100% + ${theme2.styles.space * 2}px)`, marginLeft: -theme2.styles.space, children: /* @__PURE__ */ jsx6(Divider_default.horizontal, {}) })
|
|
1666
1760
|
]
|
|
1667
1761
|
}
|
|
1668
1762
|
),
|
|
@@ -1671,7 +1765,7 @@ DivComponent.box = forwardRef5(function Box({
|
|
|
1671
1765
|
}
|
|
1672
1766
|
);
|
|
1673
1767
|
});
|
|
1674
|
-
var Div2 =
|
|
1768
|
+
var Div2 = memo6(DivComponent);
|
|
1675
1769
|
Div2.row = DivComponent.row;
|
|
1676
1770
|
Div2.column = DivComponent.column;
|
|
1677
1771
|
Div2.grid = DivComponent.grid;
|
|
@@ -1679,15 +1773,16 @@ Div2.box = DivComponent.box;
|
|
|
1679
1773
|
var Div_default = Div2;
|
|
1680
1774
|
|
|
1681
1775
|
// src/components/alerts/Alert.tsx
|
|
1682
|
-
import { memo as
|
|
1683
|
-
import { useTheme as
|
|
1684
|
-
import
|
|
1776
|
+
import { memo as memo10, useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
|
|
1777
|
+
import { useTheme as useTheme11 } from "react-better-core";
|
|
1778
|
+
import styled8 from "styled-components";
|
|
1685
1779
|
|
|
1686
1780
|
// src/plugins/alerts.ts
|
|
1687
1781
|
var defaultAlertsPluginOptions = {
|
|
1688
1782
|
position: "bottom",
|
|
1689
1783
|
align: "right",
|
|
1690
1784
|
defaultDuration: "auto",
|
|
1785
|
+
defaultDisplay: {},
|
|
1691
1786
|
maxWidth: 460,
|
|
1692
1787
|
withLoaderBar: true,
|
|
1693
1788
|
withCloseButton: true
|
|
@@ -1738,81 +1833,6 @@ var localStoragePlugin = (options) => ({
|
|
|
1738
1833
|
})
|
|
1739
1834
|
});
|
|
1740
1835
|
|
|
1741
|
-
// src/components/Icon.tsx
|
|
1742
|
-
import { forwardRef as forwardRef6, memo as memo6, useEffect as useEffect3 } from "react";
|
|
1743
|
-
import { useBetterCoreContext as useBetterCoreContext2, useTheme as useTheme7 } from "react-better-core";
|
|
1744
|
-
import styled4 from "styled-components";
|
|
1745
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1746
|
-
import { createElement } from "react";
|
|
1747
|
-
var IconElement = styled4.svg.withConfig({
|
|
1748
|
-
shouldForwardProp: (prop) => !["theme", "style", "hoverStyle", "hoverColor"].includes(prop)
|
|
1749
|
-
})`
|
|
1750
|
-
${(props) => props.style}
|
|
1751
|
-
|
|
1752
|
-
path {
|
|
1753
|
-
${(props) => props.hoverColor ? `transition: ${props.theme.styles.transition};` : ""}
|
|
1754
|
-
}
|
|
1755
|
-
|
|
1756
|
-
&:hover {
|
|
1757
|
-
path.react-better-html-icon-path-with-fill {
|
|
1758
|
-
fill: ${(props) => props.hoverColor};
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
path.react-better-html-icon-path-with-stroke {
|
|
1762
|
-
stroke: ${(props) => props.hoverColor};
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1766
|
-
&:hover {
|
|
1767
|
-
${(props) => props.hoverStyle}
|
|
1768
|
-
}
|
|
1769
|
-
`;
|
|
1770
|
-
var Icon = forwardRef6(function Icon2({ name, size = 16, ...props }, ref) {
|
|
1771
|
-
const theme = useTheme7();
|
|
1772
|
-
const { icons: icons2 } = useBetterCoreContext2();
|
|
1773
|
-
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
1774
|
-
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
1775
|
-
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
1776
|
-
const svgColor = props.color ?? theme.colors.textPrimary;
|
|
1777
|
-
const svgHoverColorColor = props.colorHover;
|
|
1778
|
-
useEffect3(() => {
|
|
1779
|
-
if (!icons2[name.toString()])
|
|
1780
|
-
console.warn(
|
|
1781
|
-
`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.`
|
|
1782
|
-
);
|
|
1783
|
-
}, [icons2, name]);
|
|
1784
|
-
return /* @__PURE__ */ jsx6(
|
|
1785
|
-
IconElement,
|
|
1786
|
-
{
|
|
1787
|
-
width: size,
|
|
1788
|
-
height: size,
|
|
1789
|
-
viewBox: `0 0 ${icons2[name.toString()]?.width ?? 0} ${icons2[name.toString()]?.height ?? 0}`,
|
|
1790
|
-
fill: "none",
|
|
1791
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1792
|
-
theme,
|
|
1793
|
-
hoverColor: svgHoverColorColor,
|
|
1794
|
-
style,
|
|
1795
|
-
hoverStyle,
|
|
1796
|
-
...restProps,
|
|
1797
|
-
...dataProps,
|
|
1798
|
-
...ariaProps,
|
|
1799
|
-
ref,
|
|
1800
|
-
children: icons2[name.toString()]?.paths.map((path) => /* @__PURE__ */ createElement(
|
|
1801
|
-
"path",
|
|
1802
|
-
{
|
|
1803
|
-
...path,
|
|
1804
|
-
className: path.type === "fill" ? "react-better-html-icon-path-with-fill" : "react-better-html-icon-path-with-stroke",
|
|
1805
|
-
fill: path.type === "fill" ? svgColor : void 0,
|
|
1806
|
-
stroke: path.type === "stroke" ? svgColor : void 0,
|
|
1807
|
-
key: path.d
|
|
1808
|
-
}
|
|
1809
|
-
))
|
|
1810
|
-
}
|
|
1811
|
-
);
|
|
1812
|
-
});
|
|
1813
|
-
var MemoizedIcon = memo6(Icon);
|
|
1814
|
-
var Icon_default = { Icon: MemoizedIcon }.Icon;
|
|
1815
|
-
|
|
1816
1836
|
// src/components/Button.tsx
|
|
1817
1837
|
import { memo as memo8, useCallback as useCallback3 } from "react";
|
|
1818
1838
|
import {
|
|
@@ -1847,8 +1867,8 @@ var LoaderComponent = function Loader({
|
|
|
1847
1867
|
disabled,
|
|
1848
1868
|
...props
|
|
1849
1869
|
}) {
|
|
1850
|
-
const
|
|
1851
|
-
const readyColor = color ??
|
|
1870
|
+
const theme2 = useTheme8();
|
|
1871
|
+
const readyColor = color ?? theme2.colors.textPrimary;
|
|
1852
1872
|
const readyWidth = width ?? size / 3;
|
|
1853
1873
|
const mask = `radial-gradient(farthest-side, #0000 calc(100% - ${readyWidth}px), #000 0)`;
|
|
1854
1874
|
return /* @__PURE__ */ jsx7(StyledDiv, { children: /* @__PURE__ */ jsx7(
|
|
@@ -1867,17 +1887,17 @@ var LoaderComponent = function Loader({
|
|
|
1867
1887
|
) });
|
|
1868
1888
|
};
|
|
1869
1889
|
LoaderComponent.box = function Box2({ text = "Loading...", size = 20, ...props }) {
|
|
1870
|
-
const
|
|
1871
|
-
return /* @__PURE__ */ jsxs4(Div_default.column, { width: "100%", alignItems: "center", gap:
|
|
1890
|
+
const theme2 = useTheme8();
|
|
1891
|
+
return /* @__PURE__ */ jsxs4(Div_default.column, { width: "100%", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
1872
1892
|
/* @__PURE__ */ jsx7(Loader2, { size, ...props }),
|
|
1873
|
-
text && /* @__PURE__ */ jsx7(Text_default, { textAlign: "center", color: props.color ??
|
|
1893
|
+
text && /* @__PURE__ */ jsx7(Text_default, { textAlign: "center", color: props.color ?? theme2.colors.textSecondary, children: text })
|
|
1874
1894
|
] });
|
|
1875
1895
|
};
|
|
1876
1896
|
LoaderComponent.text = function LoaderText({ text = "Loading...", size = 14, ...props }) {
|
|
1877
|
-
const
|
|
1878
|
-
return /* @__PURE__ */ jsxs4(Div_default.row, { alignItems: "center", gap:
|
|
1897
|
+
const theme2 = useTheme8();
|
|
1898
|
+
return /* @__PURE__ */ jsxs4(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
1879
1899
|
/* @__PURE__ */ jsx7(Loader2, { size, ...props }),
|
|
1880
|
-
text && /* @__PURE__ */ jsx7(Text_default, { textAlign: "center", color: props.color ??
|
|
1900
|
+
text && /* @__PURE__ */ jsx7(Text_default, { textAlign: "center", color: props.color ?? theme2.colors.textSecondary, children: text })
|
|
1881
1901
|
] });
|
|
1882
1902
|
};
|
|
1883
1903
|
var Loader2 = memo7(LoaderComponent);
|
|
@@ -1961,7 +1981,7 @@ var ButtonComponent = function Button({
|
|
|
1961
1981
|
onClickWithValue,
|
|
1962
1982
|
...props
|
|
1963
1983
|
}) {
|
|
1964
|
-
const
|
|
1984
|
+
const theme2 = useTheme9();
|
|
1965
1985
|
const isLoadingHook = useLoader(loaderName);
|
|
1966
1986
|
const { components } = useBetterHtmlContextInternal();
|
|
1967
1987
|
const { colorTheme } = useBetterCoreContext3();
|
|
@@ -1983,7 +2003,7 @@ var ButtonComponent = function Button({
|
|
|
1983
2003
|
Icon_default,
|
|
1984
2004
|
{
|
|
1985
2005
|
name: icon,
|
|
1986
|
-
color: iconColor ?? props.color ??
|
|
2006
|
+
color: iconColor ?? props.color ?? theme2.colors.base,
|
|
1987
2007
|
size: iconSize ?? parseInt(style.fontSize?.toString() ?? "16")
|
|
1988
2008
|
}
|
|
1989
2009
|
) }) : void 0;
|
|
@@ -1991,7 +2011,7 @@ var ButtonComponent = function Button({
|
|
|
1991
2011
|
Image_default,
|
|
1992
2012
|
{
|
|
1993
2013
|
name: image,
|
|
1994
|
-
color: iconColor ?? props.color ??
|
|
2014
|
+
color: iconColor ?? props.color ?? theme2.colors.base,
|
|
1995
2015
|
width: imageWidth ?? parseInt(style.fontSize?.toString() ?? "16"),
|
|
1996
2016
|
height: imageHeight
|
|
1997
2017
|
}
|
|
@@ -2002,7 +2022,7 @@ var ButtonComponent = function Button({
|
|
|
2002
2022
|
ButtonElement,
|
|
2003
2023
|
{
|
|
2004
2024
|
as: href ? linkComponentTag : buttonComponentTag,
|
|
2005
|
-
theme,
|
|
2025
|
+
theme: theme2,
|
|
2006
2026
|
colorTheme,
|
|
2007
2027
|
isSmall,
|
|
2008
2028
|
withText: text !== void 0,
|
|
@@ -2028,7 +2048,7 @@ var ButtonComponent = function Button({
|
|
|
2028
2048
|
gap: 10,
|
|
2029
2049
|
pointerEvents: "none",
|
|
2030
2050
|
opacity: isLoadingElement ? 0 : 1,
|
|
2031
|
-
transition:
|
|
2051
|
+
transition: theme2.styles.transition,
|
|
2032
2052
|
children: [
|
|
2033
2053
|
iconPosition === "left" && iconComponent,
|
|
2034
2054
|
imagePosition === "left" && imageComponent,
|
|
@@ -2050,11 +2070,11 @@ var ButtonComponent = function Button({
|
|
|
2050
2070
|
alignItems: "center",
|
|
2051
2071
|
justifyContent: "center",
|
|
2052
2072
|
opacity: isLoadingElement ? 1 : 0,
|
|
2053
|
-
transition:
|
|
2073
|
+
transition: theme2.styles.transition,
|
|
2054
2074
|
children: /* @__PURE__ */ jsx8(
|
|
2055
2075
|
Loader_default,
|
|
2056
2076
|
{
|
|
2057
|
-
color: props.color ??
|
|
2077
|
+
color: props.color ?? theme2.colors.base,
|
|
2058
2078
|
size: loaderSize,
|
|
2059
2079
|
disabled: !isLoadingElement
|
|
2060
2080
|
}
|
|
@@ -2066,43 +2086,43 @@ var ButtonComponent = function Button({
|
|
|
2066
2086
|
);
|
|
2067
2087
|
};
|
|
2068
2088
|
ButtonComponent.secondary = function Secondary({ className, ...props }) {
|
|
2069
|
-
const
|
|
2089
|
+
const theme2 = useTheme9();
|
|
2070
2090
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2071
2091
|
return /* @__PURE__ */ jsx8(
|
|
2072
2092
|
ButtonComponent,
|
|
2073
2093
|
{
|
|
2074
2094
|
...betterHtmlContext2.components.button?.style?.secondary,
|
|
2075
2095
|
className: `secondary${className ? ` ${className}` : ""}`,
|
|
2076
|
-
color:
|
|
2096
|
+
color: theme2.colors.textPrimary,
|
|
2077
2097
|
...props
|
|
2078
2098
|
}
|
|
2079
2099
|
);
|
|
2080
2100
|
};
|
|
2081
2101
|
ButtonComponent.destructive = function Destructive(props) {
|
|
2082
|
-
const
|
|
2102
|
+
const theme2 = useTheme9();
|
|
2083
2103
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2084
2104
|
return /* @__PURE__ */ jsx8(
|
|
2085
2105
|
ButtonComponent,
|
|
2086
2106
|
{
|
|
2087
2107
|
...betterHtmlContext2.components.button?.style?.destructive,
|
|
2088
|
-
backgroundColor:
|
|
2089
|
-
color:
|
|
2108
|
+
backgroundColor: theme2.colors.error,
|
|
2109
|
+
color: theme2.colors.base,
|
|
2090
2110
|
...props
|
|
2091
2111
|
}
|
|
2092
2112
|
);
|
|
2093
2113
|
};
|
|
2094
2114
|
ButtonComponent.icon = function Icon3({ size = 16, backgroundButtonColor, ...props }) {
|
|
2095
|
-
const
|
|
2115
|
+
const theme2 = useTheme9();
|
|
2096
2116
|
const betterHtmlContext2 = useBetterHtmlContextInternal();
|
|
2097
|
-
const buttonSize = size +
|
|
2098
|
-
const backgroundButtonColorReady = backgroundButtonColor ??
|
|
2117
|
+
const buttonSize = size + theme2.styles.space;
|
|
2118
|
+
const backgroundButtonColorReady = backgroundButtonColor ?? theme2.colors.textPrimary;
|
|
2099
2119
|
return /* @__PURE__ */ jsx8(
|
|
2100
2120
|
ButtonComponent,
|
|
2101
2121
|
{
|
|
2102
2122
|
...betterHtmlContext2.components.button?.style?.icon,
|
|
2103
2123
|
width: buttonSize,
|
|
2104
2124
|
height: buttonSize,
|
|
2105
|
-
color:
|
|
2125
|
+
color: theme2.colors.textPrimary,
|
|
2106
2126
|
backgroundColor: backgroundButtonColorReady + "00",
|
|
2107
2127
|
backgroundImage: "none",
|
|
2108
2128
|
backgroundColorHover: backgroundButtonColorReady + "20",
|
|
@@ -2146,104 +2166,442 @@ Button2.icon = ButtonComponent.icon;
|
|
|
2146
2166
|
Button2.upload = ButtonComponent.upload;
|
|
2147
2167
|
var Button_default = Button2;
|
|
2148
2168
|
|
|
2149
|
-
// src/components/
|
|
2150
|
-
import {
|
|
2151
|
-
|
|
2152
|
-
|
|
2169
|
+
// src/components/Modal.tsx
|
|
2170
|
+
import { memo as memo9, useCallback as useCallback4, forwardRef as forwardRef7, useImperativeHandle, useRef as useRef2, useEffect as useEffect4 } from "react";
|
|
2171
|
+
import { createPortal } from "react-dom";
|
|
2172
|
+
import {
|
|
2173
|
+
useBetterCoreContext as useBetterCoreContext4,
|
|
2174
|
+
useBooleanState as useBooleanState2,
|
|
2175
|
+
useTheme as useTheme10
|
|
2176
|
+
} from "react-better-core";
|
|
2177
|
+
import styled7 from "styled-components";
|
|
2178
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2179
|
+
var DialogStylesElement = styled7.dialog.withConfig({
|
|
2180
|
+
shouldForwardProp: (prop) => !["theme", "colorTheme", "opacity"].includes(prop)
|
|
2153
2181
|
})`
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
}
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
from {
|
|
2167
|
-
opacity: 0;
|
|
2168
|
-
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2169
|
-
}
|
|
2170
|
-
to {
|
|
2171
|
-
opacity: 1;
|
|
2172
|
-
transform: translateX(0px);
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2182
|
+
width: 100%;
|
|
2183
|
+
max-width: none;
|
|
2184
|
+
height: 100%;
|
|
2185
|
+
max-height: none;
|
|
2186
|
+
color: ${(props) => props.theme.colors.textPrimary};
|
|
2187
|
+
border: none;
|
|
2188
|
+
outline: none;
|
|
2189
|
+
background-color: transparent;
|
|
2190
|
+
margin: auto auto;
|
|
2191
|
+
padding-inline: ${(props) => props.theme.styles.gap}px;
|
|
2192
|
+
opacity: ${(props) => props.opacity};
|
|
2193
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
2175
2194
|
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
}
|
|
2181
|
-
to {
|
|
2182
|
-
opacity: 1;
|
|
2183
|
-
transform: translateX(0px);
|
|
2184
|
-
}
|
|
2195
|
+
&::backdrop {
|
|
2196
|
+
background-color: ${(props) => props.colorTheme === "light" ? "#000000a0" : "#222222e0"};
|
|
2197
|
+
opacity: ${(props) => props.opacity};
|
|
2198
|
+
transition: ${(props) => props.theme.styles.transition};
|
|
2185
2199
|
}
|
|
2186
2200
|
|
|
2187
|
-
@keyframes
|
|
2201
|
+
@keyframes fadeInAnimation {
|
|
2188
2202
|
from {
|
|
2189
|
-
opacity: 0;
|
|
2190
2203
|
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2191
2204
|
}
|
|
2192
2205
|
to {
|
|
2193
|
-
opacity: 1;
|
|
2194
|
-
transform: translateY(0px);
|
|
2195
|
-
}
|
|
2196
|
-
}
|
|
2197
|
-
|
|
2198
|
-
@keyframes fadeOutToLeft {
|
|
2199
|
-
from {
|
|
2200
|
-
opacity: 1;
|
|
2201
|
-
transform: translateX(0px);
|
|
2202
|
-
}
|
|
2203
|
-
to {
|
|
2204
|
-
opacity: 0;
|
|
2205
|
-
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2206
|
-
}
|
|
2207
|
-
}
|
|
2208
|
-
|
|
2209
|
-
@keyframes fadeOutToRight {
|
|
2210
|
-
from {
|
|
2211
|
-
opacity: 1;
|
|
2212
|
-
transform: translateX(0px);
|
|
2213
|
-
}
|
|
2214
|
-
to {
|
|
2215
|
-
opacity: 0;
|
|
2216
|
-
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2217
|
-
}
|
|
2218
|
-
}
|
|
2219
|
-
|
|
2220
|
-
@keyframes fadeOutToTop {
|
|
2221
|
-
from {
|
|
2222
|
-
opacity: 1;
|
|
2223
2206
|
transform: translateY(0px);
|
|
2224
2207
|
}
|
|
2225
|
-
to {
|
|
2226
|
-
opacity: 0;
|
|
2227
|
-
transform: translateY(-${(props) => props.theme.styles.space}px);
|
|
2228
|
-
}
|
|
2229
2208
|
}
|
|
2230
2209
|
|
|
2231
|
-
@keyframes
|
|
2210
|
+
@keyframes fadeOutAnimation {
|
|
2232
2211
|
from {
|
|
2233
|
-
opacity: 1;
|
|
2234
2212
|
transform: translateY(0px);
|
|
2235
2213
|
}
|
|
2236
2214
|
to {
|
|
2237
|
-
opacity: 0;
|
|
2238
2215
|
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2239
2216
|
}
|
|
2240
2217
|
}
|
|
2241
2218
|
`;
|
|
2242
|
-
var
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2219
|
+
var ModalComponent = forwardRef7(function Modal({
|
|
2220
|
+
maxWidth,
|
|
2221
|
+
icon,
|
|
2222
|
+
title,
|
|
2223
|
+
titleColor,
|
|
2224
|
+
description,
|
|
2225
|
+
descriptionColor,
|
|
2226
|
+
headerTextAlign,
|
|
2227
|
+
headerBackgroundColor,
|
|
2228
|
+
backgroundColor,
|
|
2229
|
+
name,
|
|
2230
|
+
overflow,
|
|
2231
|
+
withoutCloseButton,
|
|
2232
|
+
defaultIsOpened = false,
|
|
2233
|
+
onOpen,
|
|
2234
|
+
onClose,
|
|
2235
|
+
children
|
|
2236
|
+
}, ref) {
|
|
2237
|
+
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
2238
|
+
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
2239
|
+
const theme2 = useTheme10();
|
|
2240
|
+
const { app } = useBetterHtmlContextInternal();
|
|
2241
|
+
const { colorTheme } = useBetterCoreContext4();
|
|
2242
|
+
const dialogRef = useRef2(null);
|
|
2243
|
+
const [isOpened, setIsOpened] = useBooleanState2(false);
|
|
2244
|
+
const [isOpenedLate, setIsOpenedLate] = useBooleanState2(false);
|
|
2245
|
+
const onClickOpen = useCallback4(() => {
|
|
2246
|
+
dialogRef.current?.showModal();
|
|
2247
|
+
setIsOpened.setTrue();
|
|
2248
|
+
setIsOpenedLate.setTrue();
|
|
2249
|
+
if (urlQuery && name) {
|
|
2250
|
+
urlQuery.setQuery(
|
|
2251
|
+
{
|
|
2252
|
+
[`${name}-modal`]: "opened"
|
|
2253
|
+
},
|
|
2254
|
+
false
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
onOpen?.();
|
|
2258
|
+
}, [onOpen, urlQuery, name]);
|
|
2259
|
+
const onClickClose = useCallback4(() => {
|
|
2260
|
+
setIsOpened.setFalse();
|
|
2261
|
+
onClose?.();
|
|
2262
|
+
if (urlQuery && name) urlQuery.removeQuery(`${name}-modal`, false);
|
|
2263
|
+
setTimeout(() => {
|
|
2264
|
+
dialogRef.current?.close();
|
|
2265
|
+
setIsOpenedLate.setFalse();
|
|
2266
|
+
}, 0.2 * 1e3);
|
|
2267
|
+
}, [onClose, urlQuery, name]);
|
|
2268
|
+
const onKeyDown = useCallback4(
|
|
2269
|
+
(event) => {
|
|
2270
|
+
if (event.key === "Escape") {
|
|
2271
|
+
if (!withoutCloseButton) return;
|
|
2272
|
+
event.preventDefault();
|
|
2273
|
+
}
|
|
2274
|
+
},
|
|
2275
|
+
[withoutCloseButton]
|
|
2276
|
+
);
|
|
2277
|
+
useEffect4(() => {
|
|
2278
|
+
if (!defaultIsOpened) return;
|
|
2279
|
+
onClickOpen();
|
|
2280
|
+
}, []);
|
|
2281
|
+
useImperativeHandle(
|
|
2282
|
+
ref,
|
|
2283
|
+
() => {
|
|
2284
|
+
return {
|
|
2285
|
+
open: onClickOpen,
|
|
2286
|
+
close: onClickClose,
|
|
2287
|
+
isOpened
|
|
2288
|
+
};
|
|
2289
|
+
},
|
|
2290
|
+
[onClickOpen, onClickClose, isOpened]
|
|
2291
|
+
);
|
|
2292
|
+
const headerVertical = headerTextAlign === "center";
|
|
2293
|
+
return createPortal(
|
|
2294
|
+
/* @__PURE__ */ jsx9(
|
|
2295
|
+
DialogStylesElement,
|
|
2296
|
+
{
|
|
2297
|
+
theme: theme2,
|
|
2298
|
+
colorTheme,
|
|
2299
|
+
opacity: !isOpened ? 0 : 1,
|
|
2300
|
+
onClose: onClickClose,
|
|
2301
|
+
onKeyDown,
|
|
2302
|
+
ref: dialogRef,
|
|
2303
|
+
children: isOpenedLate ? /* @__PURE__ */ jsx9(
|
|
2304
|
+
Div_default.column,
|
|
2305
|
+
{
|
|
2306
|
+
position: "relative",
|
|
2307
|
+
width: "100%",
|
|
2308
|
+
maxWidth: maxWidth ?? app.contentMaxWidth / 1.3,
|
|
2309
|
+
minHeight: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
2310
|
+
alignItems: "center",
|
|
2311
|
+
justifyContent: "center",
|
|
2312
|
+
marginBlock: theme2.styles.space,
|
|
2313
|
+
marginInline: "auto",
|
|
2314
|
+
transform: `translateY(${theme2.styles.space}px)`,
|
|
2315
|
+
transition: theme2.styles.transition,
|
|
2316
|
+
animation: isOpened ? "fadeInAnimation 0.2s ease forwards" : "fadeOutAnimation 0.2s ease forwards",
|
|
2317
|
+
children: /* @__PURE__ */ jsxs6(
|
|
2318
|
+
Div_default,
|
|
2319
|
+
{
|
|
2320
|
+
position: "relative",
|
|
2321
|
+
width: "100%",
|
|
2322
|
+
minHeight: 32 + theme2.styles.space * 2,
|
|
2323
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundBase,
|
|
2324
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
2325
|
+
padding: !title ? theme2.styles.space : void 0,
|
|
2326
|
+
overflow,
|
|
2327
|
+
children: [
|
|
2328
|
+
title ? /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
2329
|
+
/* @__PURE__ */ jsxs6(
|
|
2330
|
+
Div_default.row,
|
|
2331
|
+
{
|
|
2332
|
+
alignItems: "center",
|
|
2333
|
+
gap: theme2.styles.gap,
|
|
2334
|
+
backgroundColor: headerBackgroundColor,
|
|
2335
|
+
borderTopLeftRadius: theme2.styles.borderRadius * 2 - 1,
|
|
2336
|
+
borderTopRightRadius: theme2.styles.borderRadius * 2 - 1,
|
|
2337
|
+
paddingInline: theme2.styles.space,
|
|
2338
|
+
paddingBlock: theme2.styles.space,
|
|
2339
|
+
transition: theme2.styles.transition,
|
|
2340
|
+
children: [
|
|
2341
|
+
/* @__PURE__ */ jsxs6(
|
|
2342
|
+
Div_default.row,
|
|
2343
|
+
{
|
|
2344
|
+
flex: 1,
|
|
2345
|
+
alignItems: "center",
|
|
2346
|
+
gap: headerVertical ? theme2.styles.space * 2 : theme2.styles.space,
|
|
2347
|
+
invertFlexDirection: headerVertical,
|
|
2348
|
+
children: [
|
|
2349
|
+
icon && (headerVertical ? /* @__PURE__ */ jsx9(
|
|
2350
|
+
Div_default.row,
|
|
2351
|
+
{
|
|
2352
|
+
width: 76,
|
|
2353
|
+
height: 76,
|
|
2354
|
+
alignItems: "center",
|
|
2355
|
+
justifyContent: "center",
|
|
2356
|
+
backgroundColor: titleColor ?? theme2.colors.textPrimary,
|
|
2357
|
+
borderRadius: 999,
|
|
2358
|
+
children: /* @__PURE__ */ jsx9(
|
|
2359
|
+
Icon_default,
|
|
2360
|
+
{
|
|
2361
|
+
name: icon,
|
|
2362
|
+
size: 36,
|
|
2363
|
+
color: headerBackgroundColor ?? theme2.colors.backgroundBase,
|
|
2364
|
+
flexShrink: 0
|
|
2365
|
+
}
|
|
2366
|
+
)
|
|
2367
|
+
}
|
|
2368
|
+
) : /* @__PURE__ */ jsx9(
|
|
2369
|
+
Icon_default,
|
|
2370
|
+
{
|
|
2371
|
+
name: icon,
|
|
2372
|
+
size: 24,
|
|
2373
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
2374
|
+
flexShrink: 0
|
|
2375
|
+
}
|
|
2376
|
+
)),
|
|
2377
|
+
/* @__PURE__ */ jsxs6(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
2378
|
+
/* @__PURE__ */ jsx9(
|
|
2379
|
+
Text_default,
|
|
2380
|
+
{
|
|
2381
|
+
as: "h1",
|
|
2382
|
+
textAlign: headerTextAlign,
|
|
2383
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
2384
|
+
transition: theme2.styles.transition,
|
|
2385
|
+
children: title
|
|
2386
|
+
}
|
|
2387
|
+
),
|
|
2388
|
+
description && /* @__PURE__ */ jsx9(
|
|
2389
|
+
Text_default,
|
|
2390
|
+
{
|
|
2391
|
+
textAlign: headerTextAlign,
|
|
2392
|
+
color: descriptionColor ?? theme2.colors.textSecondary,
|
|
2393
|
+
transition: theme2.styles.transition,
|
|
2394
|
+
children: description
|
|
2395
|
+
}
|
|
2396
|
+
)
|
|
2397
|
+
] })
|
|
2398
|
+
]
|
|
2399
|
+
}
|
|
2400
|
+
),
|
|
2401
|
+
!withoutCloseButton && /* @__PURE__ */ jsx9(
|
|
2402
|
+
Button_default.icon,
|
|
2403
|
+
{
|
|
2404
|
+
icon: "XMark",
|
|
2405
|
+
marginTop: 1,
|
|
2406
|
+
iconColor: titleColor,
|
|
2407
|
+
onClick: onClickClose,
|
|
2408
|
+
transition: theme2.styles.transition,
|
|
2409
|
+
zIndex: 10
|
|
2410
|
+
}
|
|
2411
|
+
)
|
|
2412
|
+
]
|
|
2413
|
+
}
|
|
2414
|
+
),
|
|
2415
|
+
/* @__PURE__ */ jsx9(Divider_default.horizontal, {})
|
|
2416
|
+
] }) : /* @__PURE__ */ jsx9(Fragment, { children: !withoutCloseButton && /* @__PURE__ */ jsx9(Div_default, { position: "absolute", top: theme2.styles.space, right: theme2.styles.space, zIndex: 10, children: /* @__PURE__ */ jsx9(Button_default.icon, { icon: "XMark", iconColor: titleColor, onClick: onClickClose }) }) }),
|
|
2417
|
+
/* @__PURE__ */ jsx9(Div_default, { padding: title ? theme2.styles.space : void 0, children })
|
|
2418
|
+
]
|
|
2419
|
+
}
|
|
2420
|
+
)
|
|
2421
|
+
}
|
|
2422
|
+
) : void 0
|
|
2423
|
+
}
|
|
2424
|
+
),
|
|
2425
|
+
document.body
|
|
2426
|
+
);
|
|
2427
|
+
});
|
|
2428
|
+
ModalComponent.confirmation = forwardRef7(function Confirmation({ message, continueButtonText = "Continue", continueButtonLoaderName, onContinue, onCancel, ...props }, ref) {
|
|
2429
|
+
const theme2 = useTheme10();
|
|
2430
|
+
const modalRef = useRef2(null);
|
|
2431
|
+
const onCancelElement = useCallback4(() => {
|
|
2432
|
+
onCancel?.();
|
|
2433
|
+
modalRef.current?.close();
|
|
2434
|
+
}, [onCancel]);
|
|
2435
|
+
const onContinueElement = useCallback4(() => {
|
|
2436
|
+
onContinue?.();
|
|
2437
|
+
modalRef.current?.close();
|
|
2438
|
+
}, [onContinue]);
|
|
2439
|
+
useImperativeHandle(ref, () => modalRef.current, []);
|
|
2440
|
+
return /* @__PURE__ */ jsxs6(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
2441
|
+
/* @__PURE__ */ jsx9(Text_default, { color: theme2.colors.textSecondary, children: message ?? "Do you really want to continue? This action may be irreversible." }),
|
|
2442
|
+
/* @__PURE__ */ jsxs6(
|
|
2443
|
+
Div_default.row,
|
|
2444
|
+
{
|
|
2445
|
+
alignItems: "center",
|
|
2446
|
+
justifyContent: "flex-end",
|
|
2447
|
+
gap: theme2.styles.gap,
|
|
2448
|
+
marginTop: theme2.styles.space * 2,
|
|
2449
|
+
children: [
|
|
2450
|
+
/* @__PURE__ */ jsx9(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
2451
|
+
/* @__PURE__ */ jsx9(Button_default, { text: continueButtonText, loaderName: continueButtonLoaderName, onClick: onContinueElement })
|
|
2452
|
+
]
|
|
2453
|
+
}
|
|
2454
|
+
)
|
|
2455
|
+
] });
|
|
2456
|
+
});
|
|
2457
|
+
ModalComponent.destructive = forwardRef7(function Destructive2({
|
|
2458
|
+
message,
|
|
2459
|
+
deleteButtonText = "Delete",
|
|
2460
|
+
deleteButtonIconName = "trash",
|
|
2461
|
+
deleteButtonLoaderName,
|
|
2462
|
+
onDelete,
|
|
2463
|
+
onCancel,
|
|
2464
|
+
...props
|
|
2465
|
+
}, ref) {
|
|
2466
|
+
const theme2 = useTheme10();
|
|
2467
|
+
const modalRef = useRef2(null);
|
|
2468
|
+
const onCancelElement = useCallback4(() => {
|
|
2469
|
+
onCancel?.();
|
|
2470
|
+
modalRef.current?.close();
|
|
2471
|
+
}, [onCancel]);
|
|
2472
|
+
const onDeleteElement = useCallback4(() => {
|
|
2473
|
+
onDelete?.();
|
|
2474
|
+
modalRef.current?.close();
|
|
2475
|
+
}, [onDelete]);
|
|
2476
|
+
useImperativeHandle(ref, () => modalRef.current, []);
|
|
2477
|
+
return /* @__PURE__ */ jsxs6(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
2478
|
+
/* @__PURE__ */ jsx9(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." }),
|
|
2479
|
+
/* @__PURE__ */ jsxs6(
|
|
2480
|
+
Div_default.row,
|
|
2481
|
+
{
|
|
2482
|
+
alignItems: "center",
|
|
2483
|
+
justifyContent: "flex-end",
|
|
2484
|
+
gap: theme2.styles.gap,
|
|
2485
|
+
marginTop: theme2.styles.space * 2,
|
|
2486
|
+
children: [
|
|
2487
|
+
/* @__PURE__ */ jsx9(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
2488
|
+
/* @__PURE__ */ jsx9(
|
|
2489
|
+
Button_default.destructive,
|
|
2490
|
+
{
|
|
2491
|
+
icon: deleteButtonIconName,
|
|
2492
|
+
text: deleteButtonText,
|
|
2493
|
+
loaderName: deleteButtonLoaderName,
|
|
2494
|
+
onClick: onDeleteElement
|
|
2495
|
+
}
|
|
2496
|
+
)
|
|
2497
|
+
]
|
|
2498
|
+
}
|
|
2499
|
+
)
|
|
2500
|
+
] });
|
|
2501
|
+
});
|
|
2502
|
+
var Modal2 = memo9(ModalComponent);
|
|
2503
|
+
Modal2.confirmation = ModalComponent.confirmation;
|
|
2504
|
+
Modal2.destructive = ModalComponent.destructive;
|
|
2505
|
+
var Modal_default = Modal2;
|
|
2506
|
+
|
|
2507
|
+
// src/components/alerts/Alert.tsx
|
|
2508
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2509
|
+
var StyledDiv2 = styled8.div.withConfig({
|
|
2510
|
+
shouldForwardProp: (prop) => !["theme"].includes(prop)
|
|
2511
|
+
})`
|
|
2512
|
+
@keyframes fadeInFromLeft {
|
|
2513
|
+
from {
|
|
2514
|
+
opacity: 0;
|
|
2515
|
+
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2516
|
+
}
|
|
2517
|
+
to {
|
|
2518
|
+
opacity: 1;
|
|
2519
|
+
transform: translateX(0px);
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
@keyframes fadeInFromRight {
|
|
2524
|
+
from {
|
|
2525
|
+
opacity: 0;
|
|
2526
|
+
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2527
|
+
}
|
|
2528
|
+
to {
|
|
2529
|
+
opacity: 1;
|
|
2530
|
+
transform: translateX(0px);
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
@keyframes fadeInFromTop {
|
|
2535
|
+
from {
|
|
2536
|
+
opacity: 0;
|
|
2537
|
+
transform: translateY(-${(props) => props.theme.styles.space}px);
|
|
2538
|
+
}
|
|
2539
|
+
to {
|
|
2540
|
+
opacity: 1;
|
|
2541
|
+
transform: translateX(0px);
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
@keyframes fadeInFromBottom {
|
|
2546
|
+
from {
|
|
2547
|
+
opacity: 0;
|
|
2548
|
+
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2549
|
+
}
|
|
2550
|
+
to {
|
|
2551
|
+
opacity: 1;
|
|
2552
|
+
transform: translateY(0px);
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
@keyframes fadeOutToLeft {
|
|
2557
|
+
from {
|
|
2558
|
+
opacity: 1;
|
|
2559
|
+
transform: translateX(0px);
|
|
2560
|
+
}
|
|
2561
|
+
to {
|
|
2562
|
+
opacity: 0;
|
|
2563
|
+
transform: translateX(-${(props) => props.theme.styles.space}px);
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
@keyframes fadeOutToRight {
|
|
2568
|
+
from {
|
|
2569
|
+
opacity: 1;
|
|
2570
|
+
transform: translateX(0px);
|
|
2571
|
+
}
|
|
2572
|
+
to {
|
|
2573
|
+
opacity: 0;
|
|
2574
|
+
transform: translateX(${(props) => props.theme.styles.space}px);
|
|
2575
|
+
}
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
@keyframes fadeOutToTop {
|
|
2579
|
+
from {
|
|
2580
|
+
opacity: 1;
|
|
2581
|
+
transform: translateY(0px);
|
|
2582
|
+
}
|
|
2583
|
+
to {
|
|
2584
|
+
opacity: 0;
|
|
2585
|
+
transform: translateY(-${(props) => props.theme.styles.space}px);
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2589
|
+
@keyframes fadeOutToBottom {
|
|
2590
|
+
from {
|
|
2591
|
+
opacity: 1;
|
|
2592
|
+
transform: translateY(0px);
|
|
2593
|
+
}
|
|
2594
|
+
to {
|
|
2595
|
+
opacity: 0;
|
|
2596
|
+
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
`;
|
|
2600
|
+
var minWidth = 250;
|
|
2601
|
+
var updateInterval = 20;
|
|
2602
|
+
var getAnimationInName = (position) => ({
|
|
2603
|
+
left: "fadeInFromLeft",
|
|
2604
|
+
right: "fadeInFromRight",
|
|
2247
2605
|
center: position === "top" ? "fadeInFromTop" : "fadeInFromBottom"
|
|
2248
2606
|
});
|
|
2249
2607
|
var getAnimationOutName = (position) => ({
|
|
@@ -2260,22 +2618,24 @@ var getAlertDurationFromAuto = (duration, alert) => {
|
|
|
2260
2618
|
return duration;
|
|
2261
2619
|
};
|
|
2262
2620
|
function Alert2({ alert }) {
|
|
2263
|
-
const
|
|
2621
|
+
const theme2 = useTheme11();
|
|
2264
2622
|
const alertControls2 = useAlertControls();
|
|
2265
2623
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2266
2624
|
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
2625
|
+
const modalRef = useRef3(null);
|
|
2267
2626
|
const defaultAlertDurationNumber = getAlertDurationFromAuto(
|
|
2268
2627
|
alert.duration ?? pluginConfig.defaultDuration ?? defaultAlertsPluginOptions.defaultDuration,
|
|
2269
2628
|
alert
|
|
2270
2629
|
);
|
|
2271
|
-
const
|
|
2272
|
-
const
|
|
2273
|
-
const
|
|
2274
|
-
const
|
|
2275
|
-
const
|
|
2276
|
-
const [
|
|
2277
|
-
const [
|
|
2278
|
-
const
|
|
2630
|
+
const defaultAlertDisplay = alert.display ?? pluginConfig.defaultDisplay?.[alert.type] ?? defaultAlertsPluginOptions.defaultDisplay[alert.type] ?? "default";
|
|
2631
|
+
const intervalRef = useRef3(void 0);
|
|
2632
|
+
const startTimeRef = useRef3(Date.now());
|
|
2633
|
+
const remainingTimeRef = useRef3(defaultAlertDurationNumber);
|
|
2634
|
+
const calledOnCloseRef = useRef3(false);
|
|
2635
|
+
const [isPaused, setIsPaused] = useState3(false);
|
|
2636
|
+
const [progress, setProgress] = useState3(100);
|
|
2637
|
+
const [isRemoved, setIsRemoved] = useState3(false);
|
|
2638
|
+
const startProgressTimer = useCallback5(() => {
|
|
2279
2639
|
if (intervalRef.current) {
|
|
2280
2640
|
clearInterval(intervalRef.current);
|
|
2281
2641
|
}
|
|
@@ -2287,6 +2647,7 @@ function Alert2({ alert }) {
|
|
|
2287
2647
|
setProgress(newProgress);
|
|
2288
2648
|
if (newProgress <= 0) {
|
|
2289
2649
|
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
2650
|
+
if (defaultAlertDisplay === "prominent") return;
|
|
2290
2651
|
setIsRemoved(true);
|
|
2291
2652
|
setTimeout(() => {
|
|
2292
2653
|
alertControls2.removeAlert(alert.id);
|
|
@@ -2297,8 +2658,8 @@ function Alert2({ alert }) {
|
|
|
2297
2658
|
}, 0.2 * 1e3 - 10);
|
|
2298
2659
|
}
|
|
2299
2660
|
}, updateInterval);
|
|
2300
|
-
}, [alert, progress]);
|
|
2301
|
-
const onClickCloseAlert =
|
|
2661
|
+
}, [alert, progress, defaultAlertDisplay]);
|
|
2662
|
+
const onClickCloseAlert = useCallback5(() => {
|
|
2302
2663
|
setIsRemoved(true);
|
|
2303
2664
|
setTimeout(() => {
|
|
2304
2665
|
alertControls2.removeAlert(alert.id);
|
|
@@ -2308,7 +2669,7 @@ function Alert2({ alert }) {
|
|
|
2308
2669
|
}
|
|
2309
2670
|
}, 0.2 * 1e3 - 10);
|
|
2310
2671
|
}, [alert]);
|
|
2311
|
-
const onMouseEnter =
|
|
2672
|
+
const onMouseEnter = useCallback5(() => {
|
|
2312
2673
|
setIsPaused(true);
|
|
2313
2674
|
if (intervalRef.current) {
|
|
2314
2675
|
clearInterval(intervalRef.current);
|
|
@@ -2316,36 +2677,47 @@ function Alert2({ alert }) {
|
|
|
2316
2677
|
}
|
|
2317
2678
|
remainingTimeRef.current = defaultAlertDurationNumber * (progress / 100);
|
|
2318
2679
|
}, [defaultAlertDurationNumber, progress]);
|
|
2319
|
-
const onMouseLeave =
|
|
2680
|
+
const onMouseLeave = useCallback5(() => {
|
|
2320
2681
|
setIsPaused(false);
|
|
2321
2682
|
startProgressTimer();
|
|
2322
2683
|
}, [startProgressTimer]);
|
|
2684
|
+
const onClickAlertModalDone = useCallback5(() => {
|
|
2685
|
+
setIsRemoved(true);
|
|
2686
|
+
modalRef.current?.close();
|
|
2687
|
+
setTimeout(() => {
|
|
2688
|
+
alertControls2.removeAlert(alert.id);
|
|
2689
|
+
if (!calledOnCloseRef.current) {
|
|
2690
|
+
alert.onClose?.(alert);
|
|
2691
|
+
calledOnCloseRef.current = true;
|
|
2692
|
+
}
|
|
2693
|
+
}, 0.2 * 1e3 - 10);
|
|
2694
|
+
}, [alert]);
|
|
2323
2695
|
const alertData = useMemo2(
|
|
2324
2696
|
() => ({
|
|
2325
2697
|
info: {
|
|
2326
2698
|
icon: "infoI",
|
|
2327
|
-
backgroundColor:
|
|
2699
|
+
backgroundColor: theme2.colors.info,
|
|
2328
2700
|
title: "Info"
|
|
2329
2701
|
},
|
|
2330
2702
|
success: {
|
|
2331
2703
|
icon: "check",
|
|
2332
|
-
backgroundColor:
|
|
2704
|
+
backgroundColor: theme2.colors.success,
|
|
2333
2705
|
title: "Success"
|
|
2334
2706
|
},
|
|
2335
2707
|
warning: {
|
|
2336
2708
|
icon: "warningTriangle",
|
|
2337
|
-
backgroundColor:
|
|
2709
|
+
backgroundColor: theme2.colors.warn,
|
|
2338
2710
|
title: "Warning"
|
|
2339
2711
|
},
|
|
2340
2712
|
error: {
|
|
2341
2713
|
icon: "XMark",
|
|
2342
|
-
backgroundColor:
|
|
2714
|
+
backgroundColor: theme2.colors.error,
|
|
2343
2715
|
title: "Error"
|
|
2344
2716
|
}
|
|
2345
2717
|
}),
|
|
2346
|
-
[
|
|
2718
|
+
[theme2]
|
|
2347
2719
|
);
|
|
2348
|
-
|
|
2720
|
+
useEffect5(() => {
|
|
2349
2721
|
startTimeRef.current = Date.now();
|
|
2350
2722
|
remainingTimeRef.current = defaultAlertDurationNumber;
|
|
2351
2723
|
startProgressTimer();
|
|
@@ -2353,8 +2725,31 @@ function Alert2({ alert }) {
|
|
|
2353
2725
|
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
2354
2726
|
};
|
|
2355
2727
|
}, [defaultAlertDurationNumber, startProgressTimer]);
|
|
2356
|
-
const animation = `${isRemoved ? getAnimationOutName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align] : getAnimationInName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align]} ${
|
|
2357
|
-
|
|
2728
|
+
const animation = `${isRemoved ? getAnimationOutName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align] : getAnimationInName(pluginConfig.position ?? defaultAlertsPluginOptions.position)[pluginConfig.align ?? defaultAlertsPluginOptions.align]} ${theme2.styles.transition}`;
|
|
2729
|
+
const alertTitle = alert.title ?? alertData[alert.type].title;
|
|
2730
|
+
return defaultAlertDisplay === "prominent" ? /* @__PURE__ */ jsx10(
|
|
2731
|
+
Modal_default,
|
|
2732
|
+
{
|
|
2733
|
+
defaultIsOpened: true,
|
|
2734
|
+
icon: alertData[alert.type].icon,
|
|
2735
|
+
title: alertTitle,
|
|
2736
|
+
description: alert.message,
|
|
2737
|
+
titleColor: theme2.colors.base,
|
|
2738
|
+
descriptionColor: theme2.colors.base + "a0",
|
|
2739
|
+
headerTextAlign: "center",
|
|
2740
|
+
headerBackgroundColor: alertData[alert.type].backgroundColor,
|
|
2741
|
+
withoutCloseButton: true,
|
|
2742
|
+
ref: modalRef,
|
|
2743
|
+
children: /* @__PURE__ */ jsx10(Div_default.row, { width: "100%", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx10(
|
|
2744
|
+
Button_default,
|
|
2745
|
+
{
|
|
2746
|
+
text: "Close",
|
|
2747
|
+
backgroundColor: alertData[alert.type].backgroundColor,
|
|
2748
|
+
onClick: onClickAlertModalDone
|
|
2749
|
+
}
|
|
2750
|
+
) })
|
|
2751
|
+
}
|
|
2752
|
+
) : /* @__PURE__ */ jsx10(StyledDiv2, { theme: theme2, children: /* @__PURE__ */ jsx10(
|
|
2358
2753
|
Div_default.box,
|
|
2359
2754
|
{
|
|
2360
2755
|
width: "fit-content",
|
|
@@ -2365,9 +2760,9 @@ function Alert2({ alert }) {
|
|
|
2365
2760
|
onMouseMove: onMouseEnter,
|
|
2366
2761
|
onMouseLeave,
|
|
2367
2762
|
animation,
|
|
2368
|
-
children: /* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
2763
|
+
children: /* @__PURE__ */ jsxs7(Div_default.column, { gap: theme2.styles.space, children: [
|
|
2764
|
+
/* @__PURE__ */ jsxs7(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
2765
|
+
/* @__PURE__ */ jsx10(
|
|
2371
2766
|
Div_default.row,
|
|
2372
2767
|
{
|
|
2373
2768
|
width: 36,
|
|
@@ -2376,32 +2771,32 @@ function Alert2({ alert }) {
|
|
|
2376
2771
|
justifyContent: "center",
|
|
2377
2772
|
backgroundColor: alertData[alert.type].backgroundColor,
|
|
2378
2773
|
borderRadius: 999,
|
|
2379
|
-
marginTop:
|
|
2380
|
-
children: /* @__PURE__ */
|
|
2774
|
+
marginTop: theme2.styles.gap / 2,
|
|
2775
|
+
children: /* @__PURE__ */ jsx10(
|
|
2381
2776
|
Icon_default,
|
|
2382
2777
|
{
|
|
2383
2778
|
name: alertData[alert.type].icon,
|
|
2384
2779
|
size: 18,
|
|
2385
|
-
color: alertData[alert.type].iconColor ??
|
|
2780
|
+
color: alertData[alert.type].iconColor ?? theme2.colors.base
|
|
2386
2781
|
}
|
|
2387
2782
|
)
|
|
2388
2783
|
}
|
|
2389
2784
|
),
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2785
|
+
/* @__PURE__ */ jsxs7(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
2786
|
+
/* @__PURE__ */ jsx10(Text_default, { fontSize: 18, fontWeight: 700, children: alertTitle }),
|
|
2787
|
+
/* @__PURE__ */ jsx10(Text_default, { color: theme2.colors.textSecondary, children: alert.message })
|
|
2393
2788
|
] }),
|
|
2394
|
-
pluginConfig.withCloseButton && /* @__PURE__ */
|
|
2789
|
+
pluginConfig.withCloseButton && /* @__PURE__ */ jsx10(Button_default.icon, { icon: "XMark", alignSelf: "flex-start", onClick: onClickCloseAlert })
|
|
2395
2790
|
] }),
|
|
2396
|
-
pluginConfig.withLoaderBar && /* @__PURE__ */
|
|
2791
|
+
pluginConfig.withLoaderBar && /* @__PURE__ */ jsx10(
|
|
2397
2792
|
Div_default,
|
|
2398
2793
|
{
|
|
2399
2794
|
width: "100%",
|
|
2400
2795
|
height: 5,
|
|
2401
|
-
backgroundColor:
|
|
2796
|
+
backgroundColor: theme2.colors.backgroundBase,
|
|
2402
2797
|
borderRadius: 999,
|
|
2403
2798
|
overflow: "hidden",
|
|
2404
|
-
children: /* @__PURE__ */
|
|
2799
|
+
children: /* @__PURE__ */ jsx10(
|
|
2405
2800
|
Div_default,
|
|
2406
2801
|
{
|
|
2407
2802
|
width: `${progress}%`,
|
|
@@ -2417,20 +2812,20 @@ function Alert2({ alert }) {
|
|
|
2417
2812
|
}
|
|
2418
2813
|
) });
|
|
2419
2814
|
}
|
|
2420
|
-
var Alert_default =
|
|
2815
|
+
var Alert_default = memo10(Alert2);
|
|
2421
2816
|
|
|
2422
2817
|
// src/components/alerts/AlertsHolder.tsx
|
|
2423
|
-
import { jsx as
|
|
2818
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2424
2819
|
function AlertsHolder() {
|
|
2425
|
-
const
|
|
2820
|
+
const theme2 = useTheme12();
|
|
2426
2821
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2427
2822
|
const { alerts } = useBetterHtmlContextInternal();
|
|
2428
2823
|
const pluginConfig = alertsPlugin2?.getConfig() ?? {};
|
|
2429
|
-
const top = pluginConfig.position === "top" ?
|
|
2430
|
-
const bottom = pluginConfig.position === "bottom" ?
|
|
2431
|
-
const left = pluginConfig.align === "left" ?
|
|
2432
|
-
const right = pluginConfig.align === "right" ?
|
|
2433
|
-
return /* @__PURE__ */
|
|
2824
|
+
const top = pluginConfig.position === "top" ? theme2.styles.gap : void 0;
|
|
2825
|
+
const bottom = pluginConfig.position === "bottom" ? theme2.styles.gap : void 0;
|
|
2826
|
+
const left = pluginConfig.align === "left" ? theme2.styles.space : pluginConfig.align === "center" ? "50%" : void 0;
|
|
2827
|
+
const right = pluginConfig.align === "right" ? theme2.styles.space : void 0;
|
|
2828
|
+
return /* @__PURE__ */ jsx11(
|
|
2434
2829
|
Div_default.column,
|
|
2435
2830
|
{
|
|
2436
2831
|
position: "fixed",
|
|
@@ -2438,18 +2833,18 @@ function AlertsHolder() {
|
|
|
2438
2833
|
bottom,
|
|
2439
2834
|
left,
|
|
2440
2835
|
right,
|
|
2441
|
-
gap:
|
|
2836
|
+
gap: theme2.styles.gap,
|
|
2442
2837
|
alignItems: pluginConfig.align === "center" ? "center" : pluginConfig.align === "right" ? "flex-end" : void 0,
|
|
2443
2838
|
transform: pluginConfig.align === "center" ? "translateX(-50%)" : void 0,
|
|
2444
2839
|
zIndex: 1e3,
|
|
2445
|
-
children: alerts.map((alert) => /* @__PURE__ */
|
|
2840
|
+
children: alerts.map((alert) => /* @__PURE__ */ jsx11(Alert_default, { alert }, alert.id))
|
|
2446
2841
|
}
|
|
2447
2842
|
);
|
|
2448
2843
|
}
|
|
2449
|
-
var AlertsHolder_default =
|
|
2844
|
+
var AlertsHolder_default = memo11(AlertsHolder);
|
|
2450
2845
|
|
|
2451
2846
|
// src/components/BetterHtmlProvider.tsx
|
|
2452
|
-
import { Fragment, jsx as
|
|
2847
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2453
2848
|
var GlobalStyle = createGlobalStyle`
|
|
2454
2849
|
html {
|
|
2455
2850
|
background-color: ${(props) => props.backgroundColor};
|
|
@@ -2481,7 +2876,7 @@ var betterHtmlContext = createContext(void 0);
|
|
|
2481
2876
|
var externalBetterCoreContextValue;
|
|
2482
2877
|
var externalBetterHtmlContextValue;
|
|
2483
2878
|
var useBetterHtmlContext = () => {
|
|
2484
|
-
const coreContext =
|
|
2879
|
+
const coreContext = useBetterCoreContext5();
|
|
2485
2880
|
const context = useContext(betterHtmlContext);
|
|
2486
2881
|
if (context === void 0)
|
|
2487
2882
|
throw new Error(
|
|
@@ -2507,7 +2902,7 @@ var useAlertControls = () => {
|
|
|
2507
2902
|
throw new Error(
|
|
2508
2903
|
"`useAlertControls()` must be used within a `<BetterHtmlProvider>`. Make sure to add one at the root of your component tree."
|
|
2509
2904
|
);
|
|
2510
|
-
const createAlert =
|
|
2905
|
+
const createAlert = useCallback6((alert) => {
|
|
2511
2906
|
const readyAlert = {
|
|
2512
2907
|
id: crypto.randomUUID(),
|
|
2513
2908
|
...alert
|
|
@@ -2515,7 +2910,7 @@ var useAlertControls = () => {
|
|
|
2515
2910
|
context.setAlerts((oldValue) => [...oldValue, readyAlert]);
|
|
2516
2911
|
return readyAlert;
|
|
2517
2912
|
}, []);
|
|
2518
|
-
const removeAlert =
|
|
2913
|
+
const removeAlert = useCallback6((alertId) => {
|
|
2519
2914
|
context.setAlerts((oldValue) => oldValue.filter((alert) => alert.id !== alertId));
|
|
2520
2915
|
}, []);
|
|
2521
2916
|
return {
|
|
@@ -2536,28 +2931,28 @@ var usePlugin = (pluginName) => {
|
|
|
2536
2931
|
);
|
|
2537
2932
|
};
|
|
2538
2933
|
function BetterHtmlProviderInternalContent({ children }) {
|
|
2539
|
-
const
|
|
2934
|
+
const theme2 = useTheme13();
|
|
2540
2935
|
const alertsPlugin2 = usePlugin("alerts");
|
|
2541
|
-
return /* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2936
|
+
return /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
2937
|
+
/* @__PURE__ */ jsx12(
|
|
2543
2938
|
GlobalStyle,
|
|
2544
2939
|
{
|
|
2545
|
-
fontFamily:
|
|
2546
|
-
color:
|
|
2547
|
-
backgroundColor:
|
|
2940
|
+
fontFamily: theme2.styles.fontFamily,
|
|
2941
|
+
color: theme2.colors.textPrimary,
|
|
2942
|
+
backgroundColor: theme2.colors.backgroundBase
|
|
2548
2943
|
}
|
|
2549
2944
|
),
|
|
2550
2945
|
children,
|
|
2551
|
-
alertsPlugin2 && /* @__PURE__ */
|
|
2946
|
+
alertsPlugin2 && /* @__PURE__ */ jsx12(AlertsHolder_default, {})
|
|
2552
2947
|
] });
|
|
2553
2948
|
}
|
|
2554
2949
|
function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
2555
|
-
const betterCoreContext =
|
|
2556
|
-
const [alerts, setAlerts] =
|
|
2557
|
-
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] =
|
|
2558
|
-
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] =
|
|
2559
|
-
const [tabGroups, setTabGroups] =
|
|
2560
|
-
const [tabsWithDots, setTabsWithDots] =
|
|
2950
|
+
const betterCoreContext = useBetterCoreContext5();
|
|
2951
|
+
const [alerts, setAlerts] = useState4([]);
|
|
2952
|
+
const [sideMenuIsCollapsed, setSideMenuIsCollapsed] = useBooleanState3();
|
|
2953
|
+
const [sideMenuIsOpenMobile, setSideMenuIsOpenMobile] = useBooleanState3();
|
|
2954
|
+
const [tabGroups, setTabGroups] = useState4([]);
|
|
2955
|
+
const [tabsWithDots, setTabsWithDots] = useState4([]);
|
|
2561
2956
|
const readyConfig = useMemo3(
|
|
2562
2957
|
() => ({
|
|
2563
2958
|
app: {
|
|
@@ -2585,7 +2980,7 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
2585
2980
|
}),
|
|
2586
2981
|
[config, alerts, sideMenuIsCollapsed, sideMenuIsOpenMobile, plugins, tabGroups, tabsWithDots]
|
|
2587
2982
|
);
|
|
2588
|
-
|
|
2983
|
+
useEffect6(() => {
|
|
2589
2984
|
if (!plugins) return;
|
|
2590
2985
|
plugins.forEach((plugin) => {
|
|
2591
2986
|
plugin.initialize?.();
|
|
@@ -2593,12 +2988,15 @@ function BetterHtmlProviderInternal({ config, plugins, children }) {
|
|
|
2593
2988
|
}, []);
|
|
2594
2989
|
externalBetterCoreContextValue = betterCoreContext;
|
|
2595
2990
|
externalBetterHtmlContextValue = readyConfig;
|
|
2596
|
-
return /* @__PURE__ */
|
|
2991
|
+
return /* @__PURE__ */ jsx12(betterHtmlContext.Provider, { value: readyConfig, children: /* @__PURE__ */ jsx12(BetterHtmlProviderInternalContent, { children }) });
|
|
2597
2992
|
}
|
|
2598
2993
|
function BetterHtmlProvider({ config, ...props }) {
|
|
2599
2994
|
const coreConfig = useMemo3(
|
|
2600
2995
|
() => ({
|
|
2601
|
-
theme:
|
|
2996
|
+
theme: {
|
|
2997
|
+
...theme,
|
|
2998
|
+
...config?.theme
|
|
2999
|
+
},
|
|
2602
3000
|
colorTheme: config?.colorTheme ?? (localStorage.getItem("theme") === "dark" ? "dark" : "light"),
|
|
2603
3001
|
icons: {
|
|
2604
3002
|
...icons,
|
|
@@ -2621,7 +3019,7 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2621
3019
|
}),
|
|
2622
3020
|
[config]
|
|
2623
3021
|
);
|
|
2624
|
-
|
|
3022
|
+
useEffect6(() => {
|
|
2625
3023
|
const html = document.querySelector("html");
|
|
2626
3024
|
if (!html) return;
|
|
2627
3025
|
html.setAttribute("data-theme", localStorage.getItem("theme") === "dark" ? "dark" : "light");
|
|
@@ -2642,9 +3040,9 @@ function BetterHtmlProvider({ config, ...props }) {
|
|
|
2642
3040
|
observer.disconnect();
|
|
2643
3041
|
};
|
|
2644
3042
|
}, []);
|
|
2645
|
-
return /* @__PURE__ */
|
|
3043
|
+
return /* @__PURE__ */ jsx12(BetterCoreProvider, { config: coreConfig, children: /* @__PURE__ */ jsx12(BetterHtmlProviderInternal, { config: htmlConfig, ...props }) });
|
|
2646
3044
|
}
|
|
2647
|
-
var BetterHtmlProvider_default =
|
|
3045
|
+
var BetterHtmlProvider_default = memo12(BetterHtmlProvider);
|
|
2648
3046
|
|
|
2649
3047
|
// src/utils/functions.ts
|
|
2650
3048
|
import CryptoJS from "crypto-js";
|
|
@@ -2760,371 +3158,83 @@ var decryptString = (text) => {
|
|
|
2760
3158
|
if (!pluginConfig.encryption?.enabled) return text;
|
|
2761
3159
|
const decrypted = CryptoJS.AES.decrypt(text, CryptoJS.enc.Hex.parse(pluginConfig.encryption.secretKey), {
|
|
2762
3160
|
iv: CryptoJS.enc.Hex.parse(pluginConfig.encryption.iv),
|
|
2763
|
-
mode: CryptoJS.mode.CBC,
|
|
2764
|
-
padding: CryptoJS.pad.Pkcs7
|
|
2765
|
-
});
|
|
2766
|
-
return decrypted.toString(CryptoJS.enc.Utf8);
|
|
2767
|
-
};
|
|
2768
|
-
|
|
2769
|
-
// src/utils/localStorage.ts
|
|
2770
|
-
function generateLocalStorage() {
|
|
2771
|
-
return {
|
|
2772
|
-
setItem: (name, value) => {
|
|
2773
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage.setItem"))
|
|
2774
|
-
return void 0;
|
|
2775
|
-
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
2776
|
-
(plugin) => plugin.name === "localStorage"
|
|
2777
|
-
);
|
|
2778
|
-
if (!localStoragePlugin2) {
|
|
2779
|
-
throw new Error(
|
|
2780
|
-
"`generateLocalStorage.setItem` function requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
2781
|
-
);
|
|
2782
|
-
}
|
|
2783
|
-
const pluginConfig = localStoragePlugin2.getConfig();
|
|
2784
|
-
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
2785
|
-
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
2786
|
-
const readyValue = encryptionEnabled ? encryptString(JSON.stringify(value)) : JSON.stringify(value);
|
|
2787
|
-
if (value) localStorage.setItem(readyName.toString(), readyValue);
|
|
2788
|
-
else localStorage.removeItem(readyName.toString());
|
|
2789
|
-
},
|
|
2790
|
-
getItem: (name) => {
|
|
2791
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage.getItem"))
|
|
2792
|
-
return void 0;
|
|
2793
|
-
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
2794
|
-
(plugin) => plugin.name === "localStorage"
|
|
2795
|
-
);
|
|
2796
|
-
if (!localStoragePlugin2) {
|
|
2797
|
-
throw new Error(
|
|
2798
|
-
"`generateLocalStorage.getItem` function requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
2799
|
-
);
|
|
2800
|
-
}
|
|
2801
|
-
const pluginConfig = localStoragePlugin2.getConfig();
|
|
2802
|
-
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
2803
|
-
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
2804
|
-
const item = localStorage.getItem(readyName.toString());
|
|
2805
|
-
if (item === null) return void 0;
|
|
2806
|
-
try {
|
|
2807
|
-
return encryptionEnabled ? JSON.parse(decryptString(item)) : JSON.parse(item);
|
|
2808
|
-
} catch (error) {
|
|
2809
|
-
return void 0;
|
|
2810
|
-
}
|
|
2811
|
-
},
|
|
2812
|
-
removeItem: (name) => {
|
|
2813
|
-
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage.removeItem"))
|
|
2814
|
-
return void 0;
|
|
2815
|
-
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
2816
|
-
(plugin) => plugin.name === "localStorage"
|
|
2817
|
-
);
|
|
2818
|
-
if (!localStoragePlugin2) {
|
|
2819
|
-
throw new Error(
|
|
2820
|
-
"`generateLocalStorage.removeItem` function requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
2821
|
-
);
|
|
2822
|
-
}
|
|
2823
|
-
const pluginConfig = localStoragePlugin2.getConfig();
|
|
2824
|
-
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
2825
|
-
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
2826
|
-
localStorage.removeItem(readyName.toString());
|
|
2827
|
-
},
|
|
2828
|
-
removeAllItems: () => {
|
|
2829
|
-
localStorage.clear();
|
|
2830
|
-
}
|
|
2831
|
-
};
|
|
2832
|
-
}
|
|
2833
|
-
|
|
2834
|
-
// src/components/Modal.tsx
|
|
2835
|
-
import { memo as memo12, useCallback as useCallback6, forwardRef as forwardRef7, useImperativeHandle, useRef as useRef3, useState as useState4 } from "react";
|
|
2836
|
-
import { createPortal } from "react-dom";
|
|
2837
|
-
import {
|
|
2838
|
-
useBetterCoreContext as useBetterCoreContext5,
|
|
2839
|
-
useTheme as useTheme13
|
|
2840
|
-
} from "react-better-core";
|
|
2841
|
-
import styled8 from "styled-components";
|
|
2842
|
-
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2843
|
-
var DialogStylesElement = styled8.dialog.withConfig({
|
|
2844
|
-
shouldForwardProp: (prop) => !["theme", "colorTheme", "opacity"].includes(prop)
|
|
2845
|
-
})`
|
|
2846
|
-
width: 100%;
|
|
2847
|
-
max-width: none;
|
|
2848
|
-
height: 100%;
|
|
2849
|
-
max-height: none;
|
|
2850
|
-
color: ${(props) => props.theme.colors.textPrimary};
|
|
2851
|
-
border: none;
|
|
2852
|
-
outline: none;
|
|
2853
|
-
background-color: transparent;
|
|
2854
|
-
margin: auto auto;
|
|
2855
|
-
padding-inline: ${(props) => props.theme.styles.gap}px;
|
|
2856
|
-
opacity: ${(props) => props.opacity};
|
|
2857
|
-
transition: ${(props) => props.theme.styles.transition};
|
|
2858
|
-
|
|
2859
|
-
&::backdrop {
|
|
2860
|
-
background-color: ${(props) => props.colorTheme === "light" ? "#000000a0" : "#222222e0"};
|
|
2861
|
-
opacity: ${(props) => props.opacity};
|
|
2862
|
-
transition: ${(props) => props.theme.styles.transition};
|
|
2863
|
-
}
|
|
2864
|
-
|
|
2865
|
-
@keyframes fadeInAnimation {
|
|
2866
|
-
from {
|
|
2867
|
-
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2868
|
-
}
|
|
2869
|
-
to {
|
|
2870
|
-
transform: translateY(0px);
|
|
2871
|
-
}
|
|
2872
|
-
}
|
|
2873
|
-
|
|
2874
|
-
@keyframes fadeOutAnimation {
|
|
2875
|
-
from {
|
|
2876
|
-
transform: translateY(0px);
|
|
2877
|
-
}
|
|
2878
|
-
to {
|
|
2879
|
-
transform: translateY(${(props) => props.theme.styles.space}px);
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
`;
|
|
2883
|
-
var ModalComponent = forwardRef7(function Modal({
|
|
2884
|
-
maxWidth,
|
|
2885
|
-
title,
|
|
2886
|
-
titleColor,
|
|
2887
|
-
description,
|
|
2888
|
-
descriptionColor,
|
|
2889
|
-
headerBackgroundColor,
|
|
2890
|
-
backgroundColor,
|
|
2891
|
-
name,
|
|
2892
|
-
overflow,
|
|
2893
|
-
withoutCloseButton,
|
|
2894
|
-
onOpen,
|
|
2895
|
-
onClose,
|
|
2896
|
-
children
|
|
2897
|
-
}, ref) {
|
|
2898
|
-
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
2899
|
-
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
2900
|
-
const theme = useTheme13();
|
|
2901
|
-
const { app } = useBetterHtmlContextInternal();
|
|
2902
|
-
const { colorTheme } = useBetterCoreContext5();
|
|
2903
|
-
const dialogRef = useRef3(null);
|
|
2904
|
-
const [isOpened, setIsOpened] = useState4(false);
|
|
2905
|
-
const [isOpenedLate, setIsOpenedLate] = useState4(false);
|
|
2906
|
-
const onClickOpen = useCallback6(() => {
|
|
2907
|
-
dialogRef.current?.showModal();
|
|
2908
|
-
setIsOpened(true);
|
|
2909
|
-
setIsOpenedLate(true);
|
|
2910
|
-
if (urlQuery && name) {
|
|
2911
|
-
urlQuery.setQuery(
|
|
2912
|
-
{
|
|
2913
|
-
[`${name}-modal`]: "opened"
|
|
2914
|
-
},
|
|
2915
|
-
false
|
|
3161
|
+
mode: CryptoJS.mode.CBC,
|
|
3162
|
+
padding: CryptoJS.pad.Pkcs7
|
|
3163
|
+
});
|
|
3164
|
+
return decrypted.toString(CryptoJS.enc.Utf8);
|
|
3165
|
+
};
|
|
3166
|
+
|
|
3167
|
+
// src/utils/localStorage.ts
|
|
3168
|
+
function generateLocalStorage() {
|
|
3169
|
+
return {
|
|
3170
|
+
setItem: (name, value) => {
|
|
3171
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage.setItem"))
|
|
3172
|
+
return void 0;
|
|
3173
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
3174
|
+
(plugin) => plugin.name === "localStorage"
|
|
2916
3175
|
);
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
setIsOpened(false);
|
|
2922
|
-
onClose?.();
|
|
2923
|
-
if (urlQuery && name) urlQuery.removeQuery(`${name}-modal`, false);
|
|
2924
|
-
setTimeout(() => {
|
|
2925
|
-
dialogRef.current?.close();
|
|
2926
|
-
setIsOpenedLate(false);
|
|
2927
|
-
}, 0.2 * 1e3);
|
|
2928
|
-
}, [onClose, urlQuery, name]);
|
|
2929
|
-
const onKeyDown = useCallback6(
|
|
2930
|
-
(event) => {
|
|
2931
|
-
if (event.key === "Escape") {
|
|
2932
|
-
if (!withoutCloseButton) return;
|
|
2933
|
-
event.preventDefault();
|
|
3176
|
+
if (!localStoragePlugin2) {
|
|
3177
|
+
throw new Error(
|
|
3178
|
+
"`generateLocalStorage.setItem` function requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
3179
|
+
);
|
|
2934
3180
|
}
|
|
3181
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
3182
|
+
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
3183
|
+
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
3184
|
+
const readyValue = encryptionEnabled ? encryptString(JSON.stringify(value)) : JSON.stringify(value);
|
|
3185
|
+
if (value) localStorage.setItem(readyName.toString(), readyValue);
|
|
3186
|
+
else localStorage.removeItem(readyName.toString());
|
|
2935
3187
|
},
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
},
|
|
2947
|
-
[onClickOpen, onClickClose, isOpened]
|
|
2948
|
-
);
|
|
2949
|
-
return createPortal(
|
|
2950
|
-
/* @__PURE__ */ jsx12(
|
|
2951
|
-
DialogStylesElement,
|
|
2952
|
-
{
|
|
2953
|
-
theme,
|
|
2954
|
-
colorTheme,
|
|
2955
|
-
opacity: !isOpened ? 0 : 1,
|
|
2956
|
-
onClose: onClickClose,
|
|
2957
|
-
onKeyDown,
|
|
2958
|
-
ref: dialogRef,
|
|
2959
|
-
children: isOpenedLate ? /* @__PURE__ */ jsx12(
|
|
2960
|
-
Div_default.column,
|
|
2961
|
-
{
|
|
2962
|
-
position: "relative",
|
|
2963
|
-
width: "100%",
|
|
2964
|
-
maxWidth: maxWidth ?? app.contentMaxWidth / 1.3,
|
|
2965
|
-
minHeight: `calc(100% - ${theme.styles.space * 2}px)`,
|
|
2966
|
-
alignItems: "center",
|
|
2967
|
-
justifyContent: "center",
|
|
2968
|
-
marginBlock: theme.styles.space,
|
|
2969
|
-
marginInline: "auto",
|
|
2970
|
-
transform: `translateY(${theme.styles.space}px)`,
|
|
2971
|
-
transition: theme.styles.transition,
|
|
2972
|
-
animation: isOpened ? "fadeInAnimation 0.2s ease forwards" : "fadeOutAnimation 0.2s ease forwards",
|
|
2973
|
-
children: /* @__PURE__ */ jsxs8(
|
|
2974
|
-
Div_default,
|
|
2975
|
-
{
|
|
2976
|
-
position: "relative",
|
|
2977
|
-
width: "100%",
|
|
2978
|
-
minHeight: 32 + theme.styles.space * 2,
|
|
2979
|
-
backgroundColor: backgroundColor ?? theme.colors.backgroundBase,
|
|
2980
|
-
borderRadius: theme.styles.borderRadius * 2,
|
|
2981
|
-
padding: !title ? theme.styles.space : void 0,
|
|
2982
|
-
overflow,
|
|
2983
|
-
children: [
|
|
2984
|
-
title ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
2985
|
-
/* @__PURE__ */ jsxs8(
|
|
2986
|
-
Div_default.row,
|
|
2987
|
-
{
|
|
2988
|
-
alignItems: "center",
|
|
2989
|
-
gap: theme.styles.gap,
|
|
2990
|
-
backgroundColor: headerBackgroundColor,
|
|
2991
|
-
borderTopLeftRadius: theme.styles.borderRadius * 2 - 1,
|
|
2992
|
-
borderTopRightRadius: theme.styles.borderRadius * 2 - 1,
|
|
2993
|
-
paddingInline: theme.styles.space,
|
|
2994
|
-
paddingBlock: theme.styles.space,
|
|
2995
|
-
transition: theme.styles.transition,
|
|
2996
|
-
children: [
|
|
2997
|
-
/* @__PURE__ */ jsxs8(Div_default.column, { flex: 1, gap: theme.styles.gap / 2, children: [
|
|
2998
|
-
/* @__PURE__ */ jsx12(
|
|
2999
|
-
Text_default,
|
|
3000
|
-
{
|
|
3001
|
-
as: "h1",
|
|
3002
|
-
color: titleColor ?? theme.colors.textPrimary,
|
|
3003
|
-
transition: theme.styles.transition,
|
|
3004
|
-
children: title
|
|
3005
|
-
}
|
|
3006
|
-
),
|
|
3007
|
-
description && /* @__PURE__ */ jsx12(
|
|
3008
|
-
Text_default,
|
|
3009
|
-
{
|
|
3010
|
-
color: descriptionColor ?? theme.colors.textSecondary,
|
|
3011
|
-
transition: theme.styles.transition,
|
|
3012
|
-
children: description
|
|
3013
|
-
}
|
|
3014
|
-
)
|
|
3015
|
-
] }),
|
|
3016
|
-
!withoutCloseButton && /* @__PURE__ */ jsx12(
|
|
3017
|
-
Button_default.icon,
|
|
3018
|
-
{
|
|
3019
|
-
icon: "XMark",
|
|
3020
|
-
marginTop: 1,
|
|
3021
|
-
iconColor: titleColor,
|
|
3022
|
-
onClick: onClickClose,
|
|
3023
|
-
transition: theme.styles.transition,
|
|
3024
|
-
zIndex: 10
|
|
3025
|
-
}
|
|
3026
|
-
)
|
|
3027
|
-
]
|
|
3028
|
-
}
|
|
3029
|
-
),
|
|
3030
|
-
/* @__PURE__ */ jsx12(Divider_default.horizontal, {})
|
|
3031
|
-
] }) : /* @__PURE__ */ jsx12(Fragment2, { children: !withoutCloseButton && /* @__PURE__ */ jsx12(Div_default, { position: "absolute", top: theme.styles.space, right: theme.styles.space, zIndex: 10, children: /* @__PURE__ */ jsx12(Button_default.icon, { icon: "XMark", iconColor: titleColor, onClick: onClickClose }) }) }),
|
|
3032
|
-
/* @__PURE__ */ jsx12(Div_default, { padding: title ? theme.styles.space : void 0, children })
|
|
3033
|
-
]
|
|
3034
|
-
}
|
|
3035
|
-
)
|
|
3036
|
-
}
|
|
3037
|
-
) : void 0
|
|
3188
|
+
getItem: (name) => {
|
|
3189
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage.getItem"))
|
|
3190
|
+
return void 0;
|
|
3191
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
3192
|
+
(plugin) => plugin.name === "localStorage"
|
|
3193
|
+
);
|
|
3194
|
+
if (!localStoragePlugin2) {
|
|
3195
|
+
throw new Error(
|
|
3196
|
+
"`generateLocalStorage.getItem` function requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
3197
|
+
);
|
|
3038
3198
|
}
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
modalRef.current?.close();
|
|
3049
|
-
}, [onCancel]);
|
|
3050
|
-
const onContinueElement = useCallback6(() => {
|
|
3051
|
-
onContinue?.();
|
|
3052
|
-
modalRef.current?.close();
|
|
3053
|
-
}, [onContinue]);
|
|
3054
|
-
useImperativeHandle(ref, () => modalRef.current, []);
|
|
3055
|
-
return /* @__PURE__ */ jsxs8(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
3056
|
-
/* @__PURE__ */ jsx12(Text_default, { color: theme.colors.textSecondary, children: message ?? "Do you really want to continue? This action may be irreversible." }),
|
|
3057
|
-
/* @__PURE__ */ jsxs8(
|
|
3058
|
-
Div_default.row,
|
|
3059
|
-
{
|
|
3060
|
-
alignItems: "center",
|
|
3061
|
-
justifyContent: "flex-end",
|
|
3062
|
-
gap: theme.styles.gap,
|
|
3063
|
-
marginTop: theme.styles.space * 2,
|
|
3064
|
-
children: [
|
|
3065
|
-
/* @__PURE__ */ jsx12(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
3066
|
-
/* @__PURE__ */ jsx12(Button_default, { text: continueButtonText, loaderName: continueButtonLoaderName, onClick: onContinueElement })
|
|
3067
|
-
]
|
|
3199
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
3200
|
+
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
3201
|
+
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
3202
|
+
const item = localStorage.getItem(readyName.toString());
|
|
3203
|
+
if (item === null) return void 0;
|
|
3204
|
+
try {
|
|
3205
|
+
return encryptionEnabled ? JSON.parse(decryptString(item)) : JSON.parse(item);
|
|
3206
|
+
} catch (error) {
|
|
3207
|
+
return void 0;
|
|
3068
3208
|
}
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
}, ref) {
|
|
3081
|
-
const theme = useTheme13();
|
|
3082
|
-
const modalRef = useRef3(null);
|
|
3083
|
-
const onCancelElement = useCallback6(() => {
|
|
3084
|
-
onCancel?.();
|
|
3085
|
-
modalRef.current?.close();
|
|
3086
|
-
}, [onCancel]);
|
|
3087
|
-
const onDeleteElement = useCallback6(() => {
|
|
3088
|
-
onDelete?.();
|
|
3089
|
-
modalRef.current?.close();
|
|
3090
|
-
}, [onDelete]);
|
|
3091
|
-
useImperativeHandle(ref, () => modalRef.current, []);
|
|
3092
|
-
return /* @__PURE__ */ jsxs8(ModalComponent, { title: "Are you sure?", maxWidth: 660, ...props, ref: modalRef, children: [
|
|
3093
|
-
/* @__PURE__ */ jsx12(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." }),
|
|
3094
|
-
/* @__PURE__ */ jsxs8(
|
|
3095
|
-
Div_default.row,
|
|
3096
|
-
{
|
|
3097
|
-
alignItems: "center",
|
|
3098
|
-
justifyContent: "flex-end",
|
|
3099
|
-
gap: theme.styles.gap,
|
|
3100
|
-
marginTop: theme.styles.space * 2,
|
|
3101
|
-
children: [
|
|
3102
|
-
/* @__PURE__ */ jsx12(Button_default.secondary, { text: "Cancel", onClick: onCancelElement }),
|
|
3103
|
-
/* @__PURE__ */ jsx12(
|
|
3104
|
-
Button_default.destructive,
|
|
3105
|
-
{
|
|
3106
|
-
icon: deleteButtonIconName,
|
|
3107
|
-
text: deleteButtonText,
|
|
3108
|
-
loaderName: deleteButtonLoaderName,
|
|
3109
|
-
onClick: onDeleteElement
|
|
3110
|
-
}
|
|
3111
|
-
)
|
|
3112
|
-
]
|
|
3209
|
+
},
|
|
3210
|
+
removeItem: (name) => {
|
|
3211
|
+
if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "generateLocalStorage.removeItem"))
|
|
3212
|
+
return void 0;
|
|
3213
|
+
const localStoragePlugin2 = externalBetterHtmlContextValue.plugins.find(
|
|
3214
|
+
(plugin) => plugin.name === "localStorage"
|
|
3215
|
+
);
|
|
3216
|
+
if (!localStoragePlugin2) {
|
|
3217
|
+
throw new Error(
|
|
3218
|
+
"`generateLocalStorage.removeItem` function requires the `localStorage` plugin to be added to the `plugins` prop in `<BetterHtmlProvider>`."
|
|
3219
|
+
);
|
|
3113
3220
|
}
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3221
|
+
const pluginConfig = localStoragePlugin2.getConfig();
|
|
3222
|
+
const encryptionEnabled = pluginConfig.encryption?.enabled ?? false;
|
|
3223
|
+
const readyName = encryptionEnabled ? encryptString(name.toString()) : name;
|
|
3224
|
+
localStorage.removeItem(readyName.toString());
|
|
3225
|
+
},
|
|
3226
|
+
removeAllItems: () => {
|
|
3227
|
+
localStorage.clear();
|
|
3228
|
+
}
|
|
3229
|
+
};
|
|
3230
|
+
}
|
|
3121
3231
|
|
|
3122
3232
|
// src/components/PageHolder.tsx
|
|
3123
3233
|
import { forwardRef as forwardRef8, memo as memo13 } from "react";
|
|
3124
3234
|
import { useTheme as useTheme14 } from "react-better-core";
|
|
3125
3235
|
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3126
3236
|
var PageHolderComponent = forwardRef8(function PageHolder({ noMaxContentWidth, children, ...props }, ref) {
|
|
3127
|
-
const
|
|
3237
|
+
const theme2 = useTheme14();
|
|
3128
3238
|
const { app } = useBetterHtmlContextInternal();
|
|
3129
3239
|
return /* @__PURE__ */ jsx13(
|
|
3130
3240
|
Div_default,
|
|
@@ -3133,7 +3243,7 @@ var PageHolderComponent = forwardRef8(function PageHolder({ noMaxContentWidth, c
|
|
|
3133
3243
|
width: "100%",
|
|
3134
3244
|
maxWidth: !noMaxContentWidth ? app.contentMaxWidth : void 0,
|
|
3135
3245
|
margin: "0px auto",
|
|
3136
|
-
padding:
|
|
3246
|
+
padding: theme2.styles.space,
|
|
3137
3247
|
...props,
|
|
3138
3248
|
ref,
|
|
3139
3249
|
children
|
|
@@ -3152,7 +3262,7 @@ PageHolderComponent.center = forwardRef8(function Center({
|
|
|
3152
3262
|
children,
|
|
3153
3263
|
...props
|
|
3154
3264
|
}, ref) {
|
|
3155
|
-
const
|
|
3265
|
+
const theme2 = useTheme14();
|
|
3156
3266
|
const mediaQuery = useMediaQuery();
|
|
3157
3267
|
const { app } = useBetterHtmlContextInternal();
|
|
3158
3268
|
const breakingPoint = mediaQuery.size1000;
|
|
@@ -3186,10 +3296,10 @@ PageHolderComponent.center = forwardRef8(function Center({
|
|
|
3186
3296
|
/* @__PURE__ */ jsx13(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ jsx13(
|
|
3187
3297
|
ContentTag,
|
|
3188
3298
|
{
|
|
3189
|
-
width: `calc(100% - ${
|
|
3299
|
+
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3190
3300
|
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3191
|
-
marginInline:
|
|
3192
|
-
marginBlock:
|
|
3301
|
+
marginInline: theme2.styles.space,
|
|
3302
|
+
marginBlock: theme2.styles.space,
|
|
3193
3303
|
...props,
|
|
3194
3304
|
ref,
|
|
3195
3305
|
children
|
|
@@ -3232,7 +3342,7 @@ var ChipComponent = forwardRef9(function Chip({
|
|
|
3232
3342
|
onClickWithValue,
|
|
3233
3343
|
...props
|
|
3234
3344
|
}, ref) {
|
|
3235
|
-
const
|
|
3345
|
+
const theme2 = useTheme15();
|
|
3236
3346
|
const onClickElement = useCallback7(
|
|
3237
3347
|
(event) => {
|
|
3238
3348
|
onClick?.(event);
|
|
@@ -3244,23 +3354,23 @@ var ChipComponent = forwardRef9(function Chip({
|
|
|
3244
3354
|
Div_default,
|
|
3245
3355
|
{
|
|
3246
3356
|
width: "fit-content",
|
|
3247
|
-
backgroundColor: backgroundColor ??
|
|
3248
|
-
borderRadius: isCircle ? 999 : borderRadius ??
|
|
3249
|
-
paddingBlock:
|
|
3250
|
-
paddingInline:
|
|
3357
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
3358
|
+
borderRadius: isCircle ? 999 : borderRadius ?? theme2.styles.borderRadius / borderRadiusOffset,
|
|
3359
|
+
paddingBlock: theme2.styles.gap / 2,
|
|
3360
|
+
paddingInline: theme2.styles.space / 1.5,
|
|
3251
3361
|
filterHover: onClick || onClickWithValue ? filterHover().z1 : void 0,
|
|
3252
3362
|
onClick: onClickElement,
|
|
3253
3363
|
cursor: onClick || onClickWithValue ? "pointer" : void 0,
|
|
3254
3364
|
...props,
|
|
3255
3365
|
ref,
|
|
3256
|
-
children: /* @__PURE__ */ jsx14(Text_default, { color: color ??
|
|
3366
|
+
children: /* @__PURE__ */ jsx14(Text_default, { color: color ?? theme2.colors.textPrimary, children: text })
|
|
3257
3367
|
}
|
|
3258
3368
|
);
|
|
3259
3369
|
});
|
|
3260
3370
|
ChipComponent.colored = forwardRef9(function Colored({ color, withWhiteBackground, ...props }, ref) {
|
|
3261
|
-
const
|
|
3371
|
+
const theme2 = useTheme15();
|
|
3262
3372
|
const { colorTheme } = useBetterCoreContext6();
|
|
3263
|
-
const readyColor = color ??
|
|
3373
|
+
const readyColor = color ?? theme2.colors.textSecondary;
|
|
3264
3374
|
const chip = /* @__PURE__ */ jsx14(
|
|
3265
3375
|
ChipComponent,
|
|
3266
3376
|
{
|
|
@@ -3276,7 +3386,7 @@ ChipComponent.colored = forwardRef9(function Colored({ color, withWhiteBackgroun
|
|
|
3276
3386
|
{
|
|
3277
3387
|
width: "fit-content",
|
|
3278
3388
|
backgroundColor: withWhiteBackground ? colorTheme === "light" ? "#ffffff" : "#000000" : void 0,
|
|
3279
|
-
borderRadius: withWhiteBackground ? props.borderRadius ??
|
|
3389
|
+
borderRadius: withWhiteBackground ? props.borderRadius ?? theme2.styles.borderRadius / borderRadiusOffset + 0.3 : void 0,
|
|
3280
3390
|
children: chip
|
|
3281
3391
|
}
|
|
3282
3392
|
) : chip;
|
|
@@ -3286,11 +3396,11 @@ Chip2.colored = ChipComponent.colored;
|
|
|
3286
3396
|
var Chip_default = Chip2;
|
|
3287
3397
|
|
|
3288
3398
|
// src/components/InputField.tsx
|
|
3289
|
-
import { forwardRef as forwardRef11, memo as memo18, useCallback as useCallback10, useState as useState7, useEffect as
|
|
3399
|
+
import { forwardRef as forwardRef11, memo as memo18, useCallback as useCallback10, useState as useState7, useEffect as useEffect9, useMemo as useMemo6, useRef as useRef5, useId as useId2 } from "react";
|
|
3290
3400
|
import {
|
|
3291
3401
|
darkenColor as darkenColor2,
|
|
3292
3402
|
lightenColor as lightenColor2,
|
|
3293
|
-
useBooleanState as
|
|
3403
|
+
useBooleanState as useBooleanState5,
|
|
3294
3404
|
useDebounceState as useDebounceState2,
|
|
3295
3405
|
countries as countries2,
|
|
3296
3406
|
useTheme as useTheme19,
|
|
@@ -3303,7 +3413,7 @@ import { memo as memo15 } from "react";
|
|
|
3303
3413
|
import { useTheme as useTheme16 } from "react-better-core";
|
|
3304
3414
|
import { jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3305
3415
|
function Label({ text, required, isError, color, htmlFor }) {
|
|
3306
|
-
const
|
|
3416
|
+
const theme2 = useTheme16();
|
|
3307
3417
|
return /* @__PURE__ */ jsxs10(
|
|
3308
3418
|
Text_default,
|
|
3309
3419
|
{
|
|
@@ -3311,12 +3421,12 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
3311
3421
|
width: "fit-content",
|
|
3312
3422
|
height: 16,
|
|
3313
3423
|
fontSize: 14,
|
|
3314
|
-
color: isError ?
|
|
3424
|
+
color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
|
|
3315
3425
|
htmlFor,
|
|
3316
3426
|
"aria-required": required,
|
|
3317
3427
|
children: [
|
|
3318
3428
|
text,
|
|
3319
|
-
required && /* @__PURE__ */ jsxs10(Text_default, { as: "span", fontSize: 16, color:
|
|
3429
|
+
required && /* @__PURE__ */ jsxs10(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
3320
3430
|
" ",
|
|
3321
3431
|
"*"
|
|
3322
3432
|
] })
|
|
@@ -3327,10 +3437,10 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
3327
3437
|
var Label_default = memo15(Label);
|
|
3328
3438
|
|
|
3329
3439
|
// src/components/Dropdown.tsx
|
|
3330
|
-
import { forwardRef as forwardRef10, Fragment as Fragment3, memo as memo16, useCallback as useCallback8, useEffect as
|
|
3440
|
+
import { forwardRef as forwardRef10, Fragment as Fragment3, memo as memo16, useCallback as useCallback8, useEffect as useEffect7, useMemo as useMemo4, useRef as useRef4, useState as useState5 } from "react";
|
|
3331
3441
|
import {
|
|
3332
3442
|
getPluralWord,
|
|
3333
|
-
useBooleanState as
|
|
3443
|
+
useBooleanState as useBooleanState4,
|
|
3334
3444
|
useDebounceState,
|
|
3335
3445
|
countries,
|
|
3336
3446
|
useTheme as useTheme17
|
|
@@ -3366,13 +3476,13 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3366
3476
|
id,
|
|
3367
3477
|
...props
|
|
3368
3478
|
}, ref) {
|
|
3369
|
-
const
|
|
3479
|
+
const theme2 = useTheme17();
|
|
3370
3480
|
const inputFieldHolderRef = useRef4(null);
|
|
3371
3481
|
const buttonsRef = useRef4(null);
|
|
3372
3482
|
const inputRef = useRef4(null);
|
|
3373
|
-
const [isOpen, setIsOpen] =
|
|
3374
|
-
const [isOpenLate, setIsOpenLate] =
|
|
3375
|
-
const [isFocused, setIsFocused] =
|
|
3483
|
+
const [isOpen, setIsOpen] = useBooleanState4();
|
|
3484
|
+
const [isOpenLate, setIsOpenLate] = useBooleanState4();
|
|
3485
|
+
const [isFocused, setIsFocused] = useBooleanState4();
|
|
3376
3486
|
const [searchQuery, setSearchQuery] = useState5("");
|
|
3377
3487
|
const [_, debouncedSearchQuery, setDebouncedSearchQuery, isLoadingDebouncedSearchQuery] = useDebounceState(
|
|
3378
3488
|
"",
|
|
@@ -3496,12 +3606,12 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3496
3606
|
/* @__PURE__ */ jsx15(
|
|
3497
3607
|
Div_default,
|
|
3498
3608
|
{
|
|
3499
|
-
color: isDisabled ?
|
|
3500
|
-
backgroundColor: isSelected ?
|
|
3609
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
3610
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
3501
3611
|
filter: isFocused2 ? isDisabled ? "brightness(0.95)" : "brightness(0.9)" : void 0,
|
|
3502
3612
|
filterHover: focusedOptionIndex === void 0 && !isDisabled ? "brightness(0.9)" : void 0,
|
|
3503
3613
|
cursor: isDisabled ? "not-allowed" : "pointer",
|
|
3504
|
-
padding: `${
|
|
3614
|
+
padding: `${theme2.styles.gap}px ${theme2.styles.space}px`,
|
|
3505
3615
|
value: option,
|
|
3506
3616
|
onClickWithValue: onClickOption,
|
|
3507
3617
|
onMouseMove: () => setFocusedOptionIndex(void 0),
|
|
@@ -3525,16 +3635,16 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3525
3635
|
filteredOptions,
|
|
3526
3636
|
value,
|
|
3527
3637
|
focusedOptionIndex,
|
|
3528
|
-
|
|
3638
|
+
theme2.colors,
|
|
3529
3639
|
onClickOption,
|
|
3530
3640
|
renderOption,
|
|
3531
3641
|
renderOptionDivider
|
|
3532
3642
|
]
|
|
3533
3643
|
);
|
|
3534
|
-
|
|
3644
|
+
useEffect7(() => {
|
|
3535
3645
|
setInternalValue(controlledValue);
|
|
3536
3646
|
}, [controlledValue]);
|
|
3537
|
-
|
|
3647
|
+
useEffect7(() => {
|
|
3538
3648
|
if (isOpen) {
|
|
3539
3649
|
setIsOpenLate.setTrue();
|
|
3540
3650
|
if (withSearch && inputRef.current) inputRef.current.focus();
|
|
@@ -3545,10 +3655,10 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3545
3655
|
};
|
|
3546
3656
|
}
|
|
3547
3657
|
}, [isOpen, withSearch]);
|
|
3548
|
-
|
|
3658
|
+
useEffect7(() => {
|
|
3549
3659
|
setFocusedOptionIndex(void 0);
|
|
3550
3660
|
}, [filteredOptions]);
|
|
3551
|
-
|
|
3661
|
+
useEffect7(() => {
|
|
3552
3662
|
const handleClickOutside = (event) => {
|
|
3553
3663
|
if (inputFieldHolderRef.current && buttonsRef.current && !inputFieldHolderRef.current.contains(event.target) && !buttonsRef.current.contains(event.target)) {
|
|
3554
3664
|
setIsOpen.setFalse();
|
|
@@ -3563,7 +3673,7 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3563
3673
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
3564
3674
|
};
|
|
3565
3675
|
}, [isOpen]);
|
|
3566
|
-
|
|
3676
|
+
useEffect7(() => {
|
|
3567
3677
|
if (!withDebounce) return;
|
|
3568
3678
|
onChangeSearch?.(debouncedSearchQuery);
|
|
3569
3679
|
}, [withDebounce, onChangeSearch, debouncedSearchQuery]);
|
|
@@ -3597,16 +3707,16 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3597
3707
|
Div_default,
|
|
3598
3708
|
{
|
|
3599
3709
|
width: "100%",
|
|
3600
|
-
backgroundColor:
|
|
3601
|
-
border: `solid 1px ${
|
|
3602
|
-
borderColor: isFocused ?
|
|
3710
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
3711
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
3712
|
+
borderColor: isFocused ? theme2.colors.primary : void 0,
|
|
3603
3713
|
borderBottom: "none",
|
|
3604
|
-
borderTopLeftRadius:
|
|
3605
|
-
borderTopRightRadius:
|
|
3606
|
-
paddingBlock:
|
|
3607
|
-
paddingInline: (
|
|
3608
|
-
transition:
|
|
3609
|
-
children: /* @__PURE__ */ jsx15(Div_default.row, { width: "100%", flexWrap: "wrap", gap:
|
|
3714
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
3715
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
3716
|
+
paddingBlock: theme2.styles.gap,
|
|
3717
|
+
paddingInline: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
3718
|
+
transition: theme2.styles.transition,
|
|
3719
|
+
children: /* @__PURE__ */ jsx15(Div_default.row, { width: "100%", flexWrap: "wrap", gap: theme2.styles.gap, children: selectedOption.map((option) => {
|
|
3610
3720
|
const ChipComponentTag = !option.renderType || option.renderType === "default" || option.renderType === "chip" ? Chip_default : option.renderType === "chip.colored" ? Chip_default.colored : Chip_default;
|
|
3611
3721
|
return /* @__PURE__ */ createElement2(
|
|
3612
3722
|
ChipComponentTag,
|
|
@@ -3629,21 +3739,21 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3629
3739
|
left: 0,
|
|
3630
3740
|
width: "100%",
|
|
3631
3741
|
maxHeight: 300,
|
|
3632
|
-
backgroundColor:
|
|
3633
|
-
border: `1px solid ${isFocused ?
|
|
3742
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
3743
|
+
border: `1px solid ${isFocused ? theme2.colors.primary : theme2.colors.border}`,
|
|
3634
3744
|
borderTop: "none",
|
|
3635
|
-
borderBottomLeftRadius:
|
|
3636
|
-
borderBottomRightRadius:
|
|
3745
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
3746
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
3637
3747
|
boxShadow: "0px 10px 20px #00000020",
|
|
3638
3748
|
zIndex: 1e3,
|
|
3639
3749
|
overflowY: "auto",
|
|
3640
3750
|
opacity: !isOpen ? 0 : void 0,
|
|
3641
3751
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
3642
3752
|
transform: `translateY(${!isOpen ? -10 : 0}px)`,
|
|
3643
|
-
transition:
|
|
3753
|
+
transition: theme2.styles.transition,
|
|
3644
3754
|
role: "listbox",
|
|
3645
3755
|
"aria-label": label,
|
|
3646
|
-
children: isLoadingDebouncedSearchQuery || debounceIsLoading ? /* @__PURE__ */ jsx15(Div_default, { padding: `${
|
|
3756
|
+
children: isLoadingDebouncedSearchQuery || debounceIsLoading ? /* @__PURE__ */ jsx15(Div_default, { padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`, children: /* @__PURE__ */ jsx15(Loader_default.text, {}) }) : filteredOptions.length ? /* @__PURE__ */ jsx15(Fragment4, { children: (withoutRenderingOptionsWhenClosed ? isOpen || isOpenLate : true) ? renderedOptions : void 0 }) : /* @__PURE__ */ jsx15(Div_default, { padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`, children: /* @__PURE__ */ jsx15(Text_default.unknown, { textAlign: "left", children: debounceMinimumSymbolsRequired !== void 0 && searchQuery.length < debounceMinimumSymbolsRequired ? `Enter at least ${debounceMinimumSymbolsRequired} characters` : "No options" }) })
|
|
3647
3757
|
}
|
|
3648
3758
|
),
|
|
3649
3759
|
/* @__PURE__ */ jsxs11(
|
|
@@ -3651,9 +3761,9 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3651
3761
|
{
|
|
3652
3762
|
position: "absolute",
|
|
3653
3763
|
top: 46 / 2,
|
|
3654
|
-
right:
|
|
3764
|
+
right: theme2.styles.space + 1,
|
|
3655
3765
|
alignItems: "center",
|
|
3656
|
-
gap:
|
|
3766
|
+
gap: theme2.styles.gap,
|
|
3657
3767
|
transform: "translateY(-50%)",
|
|
3658
3768
|
pointerEvents: "none",
|
|
3659
3769
|
filter: disabled ? "brightness(0.9)" : void 0,
|
|
@@ -3680,9 +3790,9 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3680
3790
|
name: "chevronDown",
|
|
3681
3791
|
position: "relative",
|
|
3682
3792
|
size: 16,
|
|
3683
|
-
color:
|
|
3793
|
+
color: theme2.colors.textSecondary,
|
|
3684
3794
|
transform: `rotate(${isOpen ? 180 : 0}deg)`,
|
|
3685
|
-
transition:
|
|
3795
|
+
transition: theme2.styles.transition,
|
|
3686
3796
|
pointerEvents: "none",
|
|
3687
3797
|
"aria-hidden": true
|
|
3688
3798
|
}
|
|
@@ -3703,9 +3813,9 @@ var DropdownComponent = forwardRef10(function Dropdown({
|
|
|
3703
3813
|
) });
|
|
3704
3814
|
});
|
|
3705
3815
|
DropdownComponent.countries = forwardRef10(function Countries({ ...props }, ref) {
|
|
3706
|
-
const
|
|
3816
|
+
const theme2 = useTheme17();
|
|
3707
3817
|
const renderOption = useCallback8(
|
|
3708
|
-
(option, index, isSelected) => /* @__PURE__ */ jsxs11(Div_default.row, { alignItems: "center", gap:
|
|
3818
|
+
(option, index, isSelected) => /* @__PURE__ */ jsxs11(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
3709
3819
|
/* @__PURE__ */ jsx15(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
3710
3820
|
/* @__PURE__ */ jsx15(Text_default, { children: option.label })
|
|
3711
3821
|
] }),
|
|
@@ -3739,7 +3849,7 @@ Dropdown2.countries = DropdownComponent.countries;
|
|
|
3739
3849
|
var Dropdown_default = Dropdown2;
|
|
3740
3850
|
|
|
3741
3851
|
// src/components/Calendar.tsx
|
|
3742
|
-
import { useCallback as useCallback9, useMemo as useMemo5, useState as useState6, memo as memo17, useEffect as
|
|
3852
|
+
import { useCallback as useCallback9, useMemo as useMemo5, useState as useState6, memo as memo17, useEffect as useEffect8, useId } from "react";
|
|
3743
3853
|
import { useTheme as useTheme18 } from "react-better-core";
|
|
3744
3854
|
import styled9 from "styled-components";
|
|
3745
3855
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
@@ -3792,7 +3902,7 @@ var SelectComponent = styled9.select.withConfig({
|
|
|
3792
3902
|
opacity: 0;
|
|
3793
3903
|
`;
|
|
3794
3904
|
function Calendar({ value, minDate, maxDate, onChange }) {
|
|
3795
|
-
const
|
|
3905
|
+
const theme2 = useTheme18();
|
|
3796
3906
|
const internalYearSelectId = useId();
|
|
3797
3907
|
const [currentDate, setCurrentDate] = useState6(value ? new Date(value) : void 0);
|
|
3798
3908
|
const [currentMonth, setCurrentMonth] = useState6(currentDate?.getMonth() ?? (/* @__PURE__ */ new Date()).getMonth());
|
|
@@ -3849,14 +3959,14 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3849
3959
|
}
|
|
3850
3960
|
return result;
|
|
3851
3961
|
}, [daysInMonth, firstDayOfMonth]);
|
|
3852
|
-
|
|
3962
|
+
useEffect8(() => {
|
|
3853
3963
|
if (!value) return;
|
|
3854
3964
|
const date = new Date(value);
|
|
3855
3965
|
setCurrentDate(date);
|
|
3856
3966
|
setCurrentMonth(date.getMonth());
|
|
3857
3967
|
setCurrentYear(date.getFullYear());
|
|
3858
3968
|
}, [value]);
|
|
3859
|
-
return /* @__PURE__ */ jsxs12(Div_default.column, { width: "100%", maxWidth: 320, gap:
|
|
3969
|
+
return /* @__PURE__ */ jsxs12(Div_default.column, { width: "100%", maxWidth: 320, gap: theme2.styles.gap, padding: theme2.styles.space / 2, userSelect: "none", children: [
|
|
3860
3970
|
/* @__PURE__ */ jsxs12(Div_default.row, { width: "100%", justifyContent: "space-between", alignItems: "center", children: [
|
|
3861
3971
|
/* @__PURE__ */ jsx16(Button_default.icon, { icon: "chevronLeft", onClick: onClickPreviousMonthButton }),
|
|
3862
3972
|
/* @__PURE__ */ jsxs12(Div_default.row, { alignItems: "center", gap: 4, children: [
|
|
@@ -3867,7 +3977,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3867
3977
|
/* @__PURE__ */ jsx16(
|
|
3868
3978
|
SelectComponent,
|
|
3869
3979
|
{
|
|
3870
|
-
theme,
|
|
3980
|
+
theme: theme2,
|
|
3871
3981
|
value: currentYear,
|
|
3872
3982
|
onChange: onChangeYearSelect,
|
|
3873
3983
|
id: internalYearSelectId,
|
|
@@ -3878,7 +3988,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3878
3988
|
] }),
|
|
3879
3989
|
/* @__PURE__ */ jsx16(Button_default.icon, { icon: "chevronRight", onClick: onClickNextMonthButton })
|
|
3880
3990
|
] }),
|
|
3881
|
-
/* @__PURE__ */ jsxs12(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap:
|
|
3991
|
+
/* @__PURE__ */ jsxs12(Div_default.grid, { width: "100%", gridTemplateColumns: "repeat(7, 1fr)", gap: theme2.styles.gap / 2, children: [
|
|
3882
3992
|
weekDaysIndex.map((day) => /* @__PURE__ */ jsx16(Div_default.row, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx16(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", children: getWeekDayName(day, true) }) }, day)),
|
|
3883
3993
|
days.map((day, index) => {
|
|
3884
3994
|
const thisDayDate = new Date(currentYear, currentMonth, day);
|
|
@@ -3894,11 +4004,11 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3894
4004
|
aspectRatio: "1",
|
|
3895
4005
|
alignItems: "center",
|
|
3896
4006
|
justifyContent: "center",
|
|
3897
|
-
backgroundColor: isSelected ?
|
|
4007
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
3898
4008
|
filterHover: day && !isDisabled ? "brightness(0.9)" : void 0,
|
|
3899
|
-
border: `1px solid ${isToday ?
|
|
3900
|
-
borderRadius:
|
|
3901
|
-
padding:
|
|
4009
|
+
border: `1px solid ${isToday ? theme2.colors.primary : theme2.colors.primary + "00"}`,
|
|
4010
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4011
|
+
padding: theme2.styles.space / 2,
|
|
3902
4012
|
cursor: day ? !isDisabled ? "pointer" : "not-allowed" : void 0,
|
|
3903
4013
|
value: day,
|
|
3904
4014
|
onClickWithValue: !isDisabled ? onClickDay : void 0,
|
|
@@ -3908,7 +4018,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3908
4018
|
{
|
|
3909
4019
|
fontSize: 14,
|
|
3910
4020
|
textAlign: "center",
|
|
3911
|
-
color: isDisabled ?
|
|
4021
|
+
color: isDisabled ? theme2.colors.textSecondary + "80" : isSelected ? theme2.colors.base : isWeekend ? theme2.colors.textSecondary : void 0,
|
|
3912
4022
|
children: day
|
|
3913
4023
|
}
|
|
3914
4024
|
),
|
|
@@ -3920,7 +4030,7 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3920
4030
|
height: 1,
|
|
3921
4031
|
top: "50%",
|
|
3922
4032
|
left: "50%",
|
|
3923
|
-
backgroundColor:
|
|
4033
|
+
backgroundColor: theme2.colors.textSecondary,
|
|
3924
4034
|
borderRadius: 999,
|
|
3925
4035
|
transform: "translate(-50%, -50%) rotate(45deg)"
|
|
3926
4036
|
}
|
|
@@ -3937,8 +4047,8 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3937
4047
|
{
|
|
3938
4048
|
fontSize: 14,
|
|
3939
4049
|
textDecorationHover: "underline",
|
|
3940
|
-
color:
|
|
3941
|
-
colorHover:
|
|
4050
|
+
color: theme2.colors.textSecondary,
|
|
4051
|
+
colorHover: theme2.colors.textPrimary,
|
|
3942
4052
|
children: "Clear"
|
|
3943
4053
|
}
|
|
3944
4054
|
) }),
|
|
@@ -3947,8 +4057,8 @@ function Calendar({ value, minDate, maxDate, onChange }) {
|
|
|
3947
4057
|
{
|
|
3948
4058
|
fontSize: 14,
|
|
3949
4059
|
textDecorationHover: "underline",
|
|
3950
|
-
color:
|
|
3951
|
-
colorHover:
|
|
4060
|
+
color: theme2.colors.textSecondary,
|
|
4061
|
+
colorHover: theme2.colors.textPrimary,
|
|
3952
4062
|
children: "Today"
|
|
3953
4063
|
}
|
|
3954
4064
|
) })
|
|
@@ -4145,7 +4255,7 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4145
4255
|
id,
|
|
4146
4256
|
...props
|
|
4147
4257
|
}, ref) {
|
|
4148
|
-
const
|
|
4258
|
+
const theme2 = useTheme19();
|
|
4149
4259
|
const internalId = useId2();
|
|
4150
4260
|
const { colorTheme } = useBetterCoreContext7();
|
|
4151
4261
|
const [_, debouncedValue, setDebouncedValue] = useDebounceState2(
|
|
@@ -4174,12 +4284,12 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4174
4284
|
) ? 1002 : 1,
|
|
4175
4285
|
[props.className]
|
|
4176
4286
|
);
|
|
4177
|
-
|
|
4287
|
+
useEffect9(() => {
|
|
4178
4288
|
if (!withDebounce) return;
|
|
4179
4289
|
onChangeValue?.(debouncedValue);
|
|
4180
4290
|
}, [withDebounce, onChangeValue, debouncedValue]);
|
|
4181
4291
|
const readyId = id ?? internalId;
|
|
4182
|
-
return /* @__PURE__ */ jsxs13(Div_default.column, { width: "100%", gap:
|
|
4292
|
+
return /* @__PURE__ */ jsxs13(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...excludeStyle, children: [
|
|
4183
4293
|
label && /* @__PURE__ */ jsx17(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
4184
4294
|
/* @__PURE__ */ jsxs13(Div_default.row, { alignItems: "stretch", width: "100%", children: [
|
|
4185
4295
|
prefix && /* @__PURE__ */ jsx17(
|
|
@@ -4187,12 +4297,12 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4187
4297
|
{
|
|
4188
4298
|
alignItems: "center",
|
|
4189
4299
|
justifyContent: "center",
|
|
4190
|
-
border: `1px solid ${
|
|
4300
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
4191
4301
|
borderRight: "none",
|
|
4192
|
-
backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(
|
|
4193
|
-
borderTopLeftRadius:
|
|
4194
|
-
borderBottomLeftRadius:
|
|
4195
|
-
paddingInline:
|
|
4302
|
+
backgroundColor: prefixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(theme2.colors.backgroundContent, 0.03) : lightenColor2(theme2.colors.backgroundContent, 0.1)),
|
|
4303
|
+
borderTopLeftRadius: theme2.styles.borderRadius,
|
|
4304
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4305
|
+
paddingInline: theme2.styles.space,
|
|
4196
4306
|
children: prefix
|
|
4197
4307
|
}
|
|
4198
4308
|
),
|
|
@@ -4205,7 +4315,7 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4205
4315
|
name: leftIcon,
|
|
4206
4316
|
position: "absolute",
|
|
4207
4317
|
top: (props.type === "date" || props.type === "time" || props.type === "datetime-local" ? 48 : 46) / 2,
|
|
4208
|
-
left:
|
|
4318
|
+
left: theme2.styles.space + 1,
|
|
4209
4319
|
transform: "translateY(-50%)",
|
|
4210
4320
|
pointerEvents: "none",
|
|
4211
4321
|
zIndex: leftIconZIndex
|
|
@@ -4214,7 +4324,7 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4214
4324
|
/* @__PURE__ */ jsx17(
|
|
4215
4325
|
InputElement,
|
|
4216
4326
|
{
|
|
4217
|
-
theme,
|
|
4327
|
+
theme: theme2,
|
|
4218
4328
|
withLeftIcon: leftIcon !== void 0,
|
|
4219
4329
|
withRightIcon: rightIcon !== void 0,
|
|
4220
4330
|
withPrefix: prefix !== void 0,
|
|
@@ -4237,7 +4347,7 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4237
4347
|
icon: rightIcon,
|
|
4238
4348
|
position: "absolute",
|
|
4239
4349
|
top: 46 / 2,
|
|
4240
|
-
right:
|
|
4350
|
+
right: theme2.styles.space + 1 - theme2.styles.space / 2,
|
|
4241
4351
|
transform: "translateY(-50%)",
|
|
4242
4352
|
onClick: onClickRightIcon
|
|
4243
4353
|
}
|
|
@@ -4247,7 +4357,7 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4247
4357
|
name: rightIcon,
|
|
4248
4358
|
position: "absolute",
|
|
4249
4359
|
top: 46 / 2,
|
|
4250
|
-
right:
|
|
4360
|
+
right: theme2.styles.space + 1,
|
|
4251
4361
|
transform: "translateY(-50%)",
|
|
4252
4362
|
pointerEvents: "none"
|
|
4253
4363
|
}
|
|
@@ -4260,12 +4370,12 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4260
4370
|
{
|
|
4261
4371
|
alignItems: "center",
|
|
4262
4372
|
justifyContent: "center",
|
|
4263
|
-
border: `1px solid ${
|
|
4373
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
4264
4374
|
borderLeft: "none",
|
|
4265
|
-
backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(
|
|
4266
|
-
borderTopRightRadius:
|
|
4267
|
-
borderBottomRightRadius:
|
|
4268
|
-
paddingInline:
|
|
4375
|
+
backgroundColor: suffixBackgroundColor ?? (colorTheme === "light" ? darkenColor2(theme2.colors.backgroundContent, 0.03) : lightenColor2(theme2.colors.backgroundContent, 0.1)),
|
|
4376
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
4377
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4378
|
+
paddingInline: theme2.styles.space,
|
|
4269
4379
|
children: suffix
|
|
4270
4380
|
}
|
|
4271
4381
|
)
|
|
@@ -4276,7 +4386,7 @@ var InputFieldComponent = forwardRef11(function InputField({
|
|
|
4276
4386
|
as: "span",
|
|
4277
4387
|
display: "block",
|
|
4278
4388
|
fontSize: 14,
|
|
4279
|
-
color: errorText ?
|
|
4389
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
4280
4390
|
children: errorText || infoText
|
|
4281
4391
|
}
|
|
4282
4392
|
)
|
|
@@ -4296,7 +4406,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4296
4406
|
id,
|
|
4297
4407
|
...props
|
|
4298
4408
|
}, ref) {
|
|
4299
|
-
const
|
|
4409
|
+
const theme2 = useTheme19();
|
|
4300
4410
|
const internalId = useId2();
|
|
4301
4411
|
const { style, hoverStyle, restProps } = useComponentPropsGrouper(props);
|
|
4302
4412
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -4309,7 +4419,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4309
4419
|
[onChange, onChangeValue]
|
|
4310
4420
|
);
|
|
4311
4421
|
const readyId = id ?? internalId;
|
|
4312
|
-
return /* @__PURE__ */ jsxs13(Div_default.column, { gap:
|
|
4422
|
+
return /* @__PURE__ */ jsxs13(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
4313
4423
|
label && /* @__PURE__ */ jsx17(Label_default, { text: label, required, isError: !!errorText, htmlFor: readyId }),
|
|
4314
4424
|
/* @__PURE__ */ jsxs13(Div_default, { position: "relative", width: "100%", children: [
|
|
4315
4425
|
leftIcon && /* @__PURE__ */ jsx17(
|
|
@@ -4318,7 +4428,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4318
4428
|
name: leftIcon,
|
|
4319
4429
|
position: "absolute",
|
|
4320
4430
|
top: 46 / 2,
|
|
4321
|
-
left:
|
|
4431
|
+
left: theme2.styles.space + 1,
|
|
4322
4432
|
transform: "translateY(-50%)",
|
|
4323
4433
|
pointerEvents: "none"
|
|
4324
4434
|
}
|
|
@@ -4326,7 +4436,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4326
4436
|
/* @__PURE__ */ jsx17(
|
|
4327
4437
|
TextareaElement,
|
|
4328
4438
|
{
|
|
4329
|
-
theme,
|
|
4439
|
+
theme: theme2,
|
|
4330
4440
|
withLeftIcon: leftIcon !== void 0,
|
|
4331
4441
|
withRightIcon: rightIcon !== void 0,
|
|
4332
4442
|
required,
|
|
@@ -4347,7 +4457,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4347
4457
|
icon: rightIcon,
|
|
4348
4458
|
position: "absolute",
|
|
4349
4459
|
top: 46 / 2,
|
|
4350
|
-
right:
|
|
4460
|
+
right: theme2.styles.space + 1 - theme2.styles.space / 2,
|
|
4351
4461
|
transform: "translateY(-50%)",
|
|
4352
4462
|
onClick: onClickRightIcon
|
|
4353
4463
|
}
|
|
@@ -4357,7 +4467,7 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4357
4467
|
name: rightIcon,
|
|
4358
4468
|
position: "absolute",
|
|
4359
4469
|
top: 46 / 2,
|
|
4360
|
-
right:
|
|
4470
|
+
right: theme2.styles.space + 1,
|
|
4361
4471
|
transform: "translateY(-50%)",
|
|
4362
4472
|
pointerEvents: "none"
|
|
4363
4473
|
}
|
|
@@ -4368,8 +4478,8 @@ InputFieldComponent.multiline = forwardRef11(function Multiline({
|
|
|
4368
4478
|
{
|
|
4369
4479
|
as: "span",
|
|
4370
4480
|
display: "block",
|
|
4371
|
-
marginTop:
|
|
4372
|
-
color: errorText ?
|
|
4481
|
+
marginTop: theme2.styles.gap / 2,
|
|
4482
|
+
color: errorText ? theme2.colors.error : props.labelColor ?? theme2.colors.textSecondary,
|
|
4373
4483
|
fontSize: 14,
|
|
4374
4484
|
children: errorText || infoText
|
|
4375
4485
|
}
|
|
@@ -4391,7 +4501,7 @@ InputFieldComponent.email = forwardRef11(function Email({ ...props }, ref) {
|
|
|
4391
4501
|
);
|
|
4392
4502
|
});
|
|
4393
4503
|
InputFieldComponent.password = forwardRef11(function Password({ ...props }, ref) {
|
|
4394
|
-
const [isPassword, setIsPassword] =
|
|
4504
|
+
const [isPassword, setIsPassword] = useBooleanState5(true);
|
|
4395
4505
|
return /* @__PURE__ */ jsx17(
|
|
4396
4506
|
InputFieldComponent,
|
|
4397
4507
|
{
|
|
@@ -4409,7 +4519,7 @@ InputFieldComponent.password = forwardRef11(function Password({ ...props }, ref)
|
|
|
4409
4519
|
});
|
|
4410
4520
|
InputFieldComponent.search = forwardRef11(function Search({ value, onChangeValue, onFocus, onBlur, ...props }, ref) {
|
|
4411
4521
|
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
4412
|
-
const [inputFieldFocused, setInputFieldFocused] =
|
|
4522
|
+
const [inputFieldFocused, setInputFieldFocused] = useBooleanState5();
|
|
4413
4523
|
const onChangeValueElement = useCallback10(
|
|
4414
4524
|
(value2) => {
|
|
4415
4525
|
setInputFieldValue(value2);
|
|
@@ -4451,12 +4561,12 @@ InputFieldComponent.search = forwardRef11(function Search({ value, onChangeValue
|
|
|
4451
4561
|
);
|
|
4452
4562
|
});
|
|
4453
4563
|
InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, value, onChangeValue, labelColor, id, ...props }, ref) {
|
|
4454
|
-
const
|
|
4564
|
+
const theme2 = useTheme19();
|
|
4455
4565
|
const internalId = useId2();
|
|
4456
4566
|
const [dropdownValue, setDropdownValue] = useState7();
|
|
4457
4567
|
const [inputFieldValue, setInputFieldValue] = useState7(value?.toString() ?? "");
|
|
4458
4568
|
const renderOption = useCallback10(
|
|
4459
|
-
(option, index, isSelected) => /* @__PURE__ */ jsxs13(Div_default.row, { alignItems: "center", gap:
|
|
4569
|
+
(option, index, isSelected) => /* @__PURE__ */ jsxs13(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
4460
4570
|
/* @__PURE__ */ jsx17(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
4461
4571
|
/* @__PURE__ */ jsx17(Text_default, { children: option.label })
|
|
4462
4572
|
] }),
|
|
@@ -4491,7 +4601,7 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, val
|
|
|
4491
4601
|
setDropdownValue(initialDefaultValue);
|
|
4492
4602
|
return initialDefaultValue;
|
|
4493
4603
|
}, [options]);
|
|
4494
|
-
|
|
4604
|
+
useEffect9(() => {
|
|
4495
4605
|
if (value === void 0 || value === null) return;
|
|
4496
4606
|
const newValue = value.toString();
|
|
4497
4607
|
const country = countries2.find(
|
|
@@ -4508,7 +4618,7 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, val
|
|
|
4508
4618
|
setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
|
|
4509
4619
|
}, [value]);
|
|
4510
4620
|
const readyId = id ?? internalId;
|
|
4511
|
-
return /* @__PURE__ */ jsxs13(Div_default.column, { width: "100%", gap:
|
|
4621
|
+
return /* @__PURE__ */ jsxs13(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
|
|
4512
4622
|
label && /* @__PURE__ */ jsx17(
|
|
4513
4623
|
Label_default,
|
|
4514
4624
|
{
|
|
@@ -4554,7 +4664,7 @@ InputFieldComponent.phoneNumber = forwardRef11(function PhoneNumber({ label, val
|
|
|
4554
4664
|
] });
|
|
4555
4665
|
});
|
|
4556
4666
|
InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...props }, ref) {
|
|
4557
|
-
const
|
|
4667
|
+
const theme2 = useTheme19();
|
|
4558
4668
|
const holderRef = useRef5(null);
|
|
4559
4669
|
const isMobileIOS = isMobileDevice && getBrowser() === "safari";
|
|
4560
4670
|
const { internalValue, setInternalValue, inputFieldProps, insideInputFieldComponentProps } = useComponentInputFieldDateProps(props, holderRef, isMobileIOS);
|
|
@@ -4576,9 +4686,9 @@ InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...pr
|
|
|
4576
4686
|
top: "100%",
|
|
4577
4687
|
left: 0,
|
|
4578
4688
|
width: "fit-content",
|
|
4579
|
-
backgroundColor:
|
|
4580
|
-
borderBottomLeftRadius:
|
|
4581
|
-
borderBottomRightRadius:
|
|
4689
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4690
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4691
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4582
4692
|
boxShadow: "0px 10px 20px #00000020",
|
|
4583
4693
|
userSelect: "none",
|
|
4584
4694
|
...insideInputFieldComponentProps,
|
|
@@ -4593,7 +4703,7 @@ InputFieldComponent.date = forwardRef11(function Date2({ minDate, maxDate, ...pr
|
|
|
4593
4703
|
);
|
|
4594
4704
|
});
|
|
4595
4705
|
InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate, defaultDateAfterTimePick, defaultTimeAfterDatePick = "00:00", ...props }, ref) {
|
|
4596
|
-
const
|
|
4706
|
+
const theme2 = useTheme19();
|
|
4597
4707
|
const holderRef = useRef5(null);
|
|
4598
4708
|
const selectedHourRef = useRef5(null);
|
|
4599
4709
|
const selectedMinuteRef = useRef5(null);
|
|
@@ -4627,7 +4737,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
4627
4737
|
},
|
|
4628
4738
|
[defaultDateAfterTimePick, internalValue, inputFieldProps.onChangeValue]
|
|
4629
4739
|
);
|
|
4630
|
-
|
|
4740
|
+
useEffect9(() => {
|
|
4631
4741
|
if (isOpen && selectedHourRef.current)
|
|
4632
4742
|
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
4633
4743
|
if (isOpen && selectedMinuteRef.current)
|
|
@@ -4635,7 +4745,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
4635
4745
|
}, [isOpen]);
|
|
4636
4746
|
const valueHour = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[0]).toString();
|
|
4637
4747
|
const valueMinute = parseInt(internalValue?.toString().split("T")?.[1]?.split(":")?.[1]).toString();
|
|
4638
|
-
const topSpacing = 32 +
|
|
4748
|
+
const topSpacing = 32 + theme2.styles.space / 2 + theme2.styles.gap;
|
|
4639
4749
|
return /* @__PURE__ */ jsx17(
|
|
4640
4750
|
InputFieldComponent,
|
|
4641
4751
|
{
|
|
@@ -4647,32 +4757,32 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
4647
4757
|
top: "100%",
|
|
4648
4758
|
left: 0,
|
|
4649
4759
|
width: "fit-content",
|
|
4650
|
-
backgroundColor:
|
|
4651
|
-
borderBottomLeftRadius:
|
|
4652
|
-
borderBottomRightRadius:
|
|
4760
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4761
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4762
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4653
4763
|
boxShadow: "0px 10px 20px #00000020",
|
|
4654
4764
|
overflow: "hidden",
|
|
4655
4765
|
userSelect: "none",
|
|
4656
4766
|
...insideInputFieldComponentProps,
|
|
4657
|
-
children: /* @__PURE__ */ jsxs13(Div_default.row, { gap:
|
|
4767
|
+
children: /* @__PURE__ */ jsxs13(Div_default.row, { gap: theme2.styles.space, children: [
|
|
4658
4768
|
/* @__PURE__ */ jsx17(Calendar_default, { value: internalValue, minDate, maxDate, onChange }),
|
|
4659
4769
|
/* @__PURE__ */ jsxs13(
|
|
4660
4770
|
Div_default.row,
|
|
4661
4771
|
{
|
|
4662
4772
|
height: 276,
|
|
4663
|
-
gap:
|
|
4773
|
+
gap: theme2.styles.gap / 2,
|
|
4664
4774
|
paddingTop: topSpacing,
|
|
4665
|
-
paddingBottom:
|
|
4666
|
-
paddingRight:
|
|
4775
|
+
paddingBottom: theme2.styles.space / 2,
|
|
4776
|
+
paddingRight: theme2.styles.space / 2,
|
|
4667
4777
|
children: [
|
|
4668
4778
|
/* @__PURE__ */ jsxs13(Div_default, { height: "100%", children: [
|
|
4669
|
-
/* @__PURE__ */ jsx17(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom:
|
|
4779
|
+
/* @__PURE__ */ jsx17(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "H" }),
|
|
4670
4780
|
/* @__PURE__ */ jsx17(
|
|
4671
4781
|
Div_default,
|
|
4672
4782
|
{
|
|
4673
4783
|
className: "react-better-html-no-scrollbar",
|
|
4674
4784
|
width: buttonWidth,
|
|
4675
|
-
height: `calc(100% - ${16 +
|
|
4785
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4676
4786
|
overflowY: "auto",
|
|
4677
4787
|
tabIndex: -1,
|
|
4678
4788
|
children: hours.map((hour) => {
|
|
@@ -4682,12 +4792,12 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
4682
4792
|
{
|
|
4683
4793
|
alignItems: "center",
|
|
4684
4794
|
justifyContent: "center",
|
|
4685
|
-
color: isSelected ?
|
|
4686
|
-
backgroundColor: isSelected ?
|
|
4687
|
-
borderRadius:
|
|
4795
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4796
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4797
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4688
4798
|
filterHover: "brightness(0.9)",
|
|
4689
4799
|
cursor: "pointer",
|
|
4690
|
-
padding: `${
|
|
4800
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4691
4801
|
value: hour,
|
|
4692
4802
|
onClickWithValue: onClickHour,
|
|
4693
4803
|
ref: isSelected ? selectedHourRef : void 0,
|
|
@@ -4700,13 +4810,13 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
4700
4810
|
)
|
|
4701
4811
|
] }),
|
|
4702
4812
|
/* @__PURE__ */ jsxs13(Div_default, { height: "100%", children: [
|
|
4703
|
-
/* @__PURE__ */ jsx17(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom:
|
|
4813
|
+
/* @__PURE__ */ jsx17(Text_default, { fontSize: 14, fontWeight: 700, textAlign: "center", marginBottom: theme2.styles.gap / 2, children: "M" }),
|
|
4704
4814
|
/* @__PURE__ */ jsx17(
|
|
4705
4815
|
Div_default,
|
|
4706
4816
|
{
|
|
4707
4817
|
className: "react-better-html-no-scrollbar",
|
|
4708
4818
|
width: buttonWidth,
|
|
4709
|
-
height: `calc(100% - ${16 +
|
|
4819
|
+
height: `calc(100% - ${16 + theme2.styles.gap / 2}px)`,
|
|
4710
4820
|
overflowY: "auto",
|
|
4711
4821
|
tabIndex: -1,
|
|
4712
4822
|
children: minutes.map((minute) => {
|
|
@@ -4716,12 +4826,12 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
4716
4826
|
{
|
|
4717
4827
|
alignItems: "center",
|
|
4718
4828
|
justifyContent: "center",
|
|
4719
|
-
color: isSelected ?
|
|
4720
|
-
backgroundColor: isSelected ?
|
|
4721
|
-
borderRadius:
|
|
4829
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4830
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4831
|
+
borderRadius: theme2.styles.borderRadius / 2,
|
|
4722
4832
|
filterHover: "brightness(0.9)",
|
|
4723
4833
|
cursor: "pointer",
|
|
4724
|
-
padding: `${
|
|
4834
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4725
4835
|
value: minute,
|
|
4726
4836
|
onClickWithValue: onClickMinute,
|
|
4727
4837
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
@@ -4747,7 +4857,7 @@ InputFieldComponent.dateTime = forwardRef11(function DateTime({ minDate, maxDate
|
|
|
4747
4857
|
);
|
|
4748
4858
|
});
|
|
4749
4859
|
InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
4750
|
-
const
|
|
4860
|
+
const theme2 = useTheme19();
|
|
4751
4861
|
const holderRef = useRef5(null);
|
|
4752
4862
|
const selectedHourRef = useRef5(null);
|
|
4753
4863
|
const selectedMinuteRef = useRef5(null);
|
|
@@ -4769,7 +4879,7 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
|
4769
4879
|
},
|
|
4770
4880
|
[internalValue, inputFieldProps.onChangeValue]
|
|
4771
4881
|
);
|
|
4772
|
-
|
|
4882
|
+
useEffect9(() => {
|
|
4773
4883
|
if (isOpen && selectedHourRef.current)
|
|
4774
4884
|
selectedHourRef.current.scrollIntoView({ block: "nearest", behavior: "instant" });
|
|
4775
4885
|
if (isOpen && selectedMinuteRef.current)
|
|
@@ -4789,9 +4899,9 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
|
4789
4899
|
left: 0,
|
|
4790
4900
|
width: buttonWidth * 2 + 2,
|
|
4791
4901
|
height: 300,
|
|
4792
|
-
backgroundColor:
|
|
4793
|
-
borderBottomLeftRadius:
|
|
4794
|
-
borderBottomRightRadius:
|
|
4902
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
4903
|
+
borderBottomLeftRadius: theme2.styles.borderRadius,
|
|
4904
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
4795
4905
|
boxShadow: "0px 10px 20px #00000020",
|
|
4796
4906
|
overflowY: "auto",
|
|
4797
4907
|
userSelect: "none",
|
|
@@ -4812,11 +4922,11 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
|
4812
4922
|
{
|
|
4813
4923
|
alignItems: "center",
|
|
4814
4924
|
justifyContent: "center",
|
|
4815
|
-
color: isSelected ?
|
|
4816
|
-
backgroundColor: isSelected ?
|
|
4925
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4926
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4817
4927
|
filterHover: "brightness(0.9)",
|
|
4818
4928
|
cursor: "pointer",
|
|
4819
|
-
padding: `${
|
|
4929
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4820
4930
|
value: hour,
|
|
4821
4931
|
onClickWithValue: onClickHour,
|
|
4822
4932
|
ref: isSelected ? selectedHourRef : void 0,
|
|
@@ -4842,11 +4952,11 @@ InputFieldComponent.time = forwardRef11(function Time({ ...props }, ref) {
|
|
|
4842
4952
|
{
|
|
4843
4953
|
alignItems: "center",
|
|
4844
4954
|
justifyContent: "center",
|
|
4845
|
-
color: isSelected ?
|
|
4846
|
-
backgroundColor: isSelected ?
|
|
4955
|
+
color: isSelected ? theme2.colors.base : theme2.colors.textPrimary,
|
|
4956
|
+
backgroundColor: isSelected ? theme2.colors.primary : theme2.colors.backgroundContent,
|
|
4847
4957
|
filterHover: "brightness(0.9)",
|
|
4848
4958
|
cursor: "pointer",
|
|
4849
|
-
padding: `${
|
|
4959
|
+
padding: `${theme2.styles.space / 2}px ${theme2.styles.space + theme2.styles.gap}px`,
|
|
4850
4960
|
value: minute,
|
|
4851
4961
|
onClickWithValue: onClickMinute,
|
|
4852
4962
|
ref: isSelected ? selectedMinuteRef : void 0,
|
|
@@ -4877,7 +4987,7 @@ InputFieldComponent.color = forwardRef11(function Color4({ value, onChangeValue,
|
|
|
4877
4987
|
},
|
|
4878
4988
|
[onChangeValue]
|
|
4879
4989
|
);
|
|
4880
|
-
|
|
4990
|
+
useEffect9(() => {
|
|
4881
4991
|
if (value === void 0) return;
|
|
4882
4992
|
setInputFieldValue(value);
|
|
4883
4993
|
}, [value]);
|
|
@@ -4921,7 +5031,7 @@ var InputField_default = InputField2;
|
|
|
4921
5031
|
|
|
4922
5032
|
// src/components/ToggleInput.tsx
|
|
4923
5033
|
import { forwardRef as forwardRef12, useCallback as useCallback11, useId as useId3, useState as useState8 } from "react";
|
|
4924
|
-
import { useBooleanState as
|
|
5034
|
+
import { useBooleanState as useBooleanState6, useTheme as useTheme20 } from "react-better-core";
|
|
4925
5035
|
import styled11 from "styled-components";
|
|
4926
5036
|
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4927
5037
|
var componentSize = 26;
|
|
@@ -5031,7 +5141,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5031
5141
|
id,
|
|
5032
5142
|
...props
|
|
5033
5143
|
}, ref) {
|
|
5034
|
-
const
|
|
5144
|
+
const theme2 = useTheme20();
|
|
5035
5145
|
const internalId = useId3();
|
|
5036
5146
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5037
5147
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
@@ -5052,14 +5162,14 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5052
5162
|
onChange?.(newIsChecked, value);
|
|
5053
5163
|
}, [checked, controlledChecked, onChange, value]);
|
|
5054
5164
|
const readyId = id ?? internalId;
|
|
5055
|
-
return /* @__PURE__ */ jsxs14(Div_default.column, { gap:
|
|
5165
|
+
return /* @__PURE__ */ jsxs14(Div_default.column, { gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5056
5166
|
label && /* @__PURE__ */ jsx18(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
5057
|
-
/* @__PURE__ */ jsxs14(Div_default.row, { alignItems: "center", gap:
|
|
5167
|
+
/* @__PURE__ */ jsxs14(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5058
5168
|
/* @__PURE__ */ jsxs14(Div_default.row, { position: "relative", alignItems: "center", children: [
|
|
5059
5169
|
/* @__PURE__ */ jsx18(
|
|
5060
5170
|
InputElement2,
|
|
5061
5171
|
{
|
|
5062
|
-
theme,
|
|
5172
|
+
theme: theme2,
|
|
5063
5173
|
type: props.type ?? "checkbox",
|
|
5064
5174
|
checked,
|
|
5065
5175
|
onChange: onChangeElement,
|
|
@@ -5078,12 +5188,12 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5078
5188
|
position: "absolute",
|
|
5079
5189
|
top: "50%",
|
|
5080
5190
|
left: "50%",
|
|
5081
|
-
color:
|
|
5191
|
+
color: theme2.colors.base,
|
|
5082
5192
|
size: 14,
|
|
5083
5193
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
5084
5194
|
opacity: checked ? 1 : 0,
|
|
5085
5195
|
pointerEvents: "none",
|
|
5086
|
-
transition:
|
|
5196
|
+
transition: theme2.styles.transition
|
|
5087
5197
|
}
|
|
5088
5198
|
) : props.type === "radio" ? /* @__PURE__ */ jsx18(
|
|
5089
5199
|
Div_default,
|
|
@@ -5093,7 +5203,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5093
5203
|
height: 10,
|
|
5094
5204
|
top: "50%",
|
|
5095
5205
|
left: "50%",
|
|
5096
|
-
backgroundColor:
|
|
5206
|
+
backgroundColor: theme2.colors.base,
|
|
5097
5207
|
borderRadius: 999,
|
|
5098
5208
|
transform: `translate(-50%, -50%)${checked ? "" : " scale(0.4)"}`,
|
|
5099
5209
|
opacity: checked ? 1 : 0,
|
|
@@ -5103,13 +5213,13 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5103
5213
|
] }),
|
|
5104
5214
|
text ? /* @__PURE__ */ jsxs14(Text_default, { color, userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5105
5215
|
text,
|
|
5106
|
-
required && !label && /* @__PURE__ */ jsxs14(Text_default, { as: "span", fontSize: 16, color:
|
|
5216
|
+
required && !label && /* @__PURE__ */ jsxs14(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5107
5217
|
" ",
|
|
5108
5218
|
"*"
|
|
5109
5219
|
] })
|
|
5110
5220
|
] }) : textAdvanced ? /* @__PURE__ */ jsxs14(Div_default.row, { userSelect: "none", cursor: "pointer", onClick: onClickText, children: [
|
|
5111
5221
|
textAdvanced,
|
|
5112
|
-
required && !label && /* @__PURE__ */ jsxs14(Text_default, { as: "span", fontSize: 16, color:
|
|
5222
|
+
required && !label && /* @__PURE__ */ jsxs14(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, marginLeft: 4, children: [
|
|
5113
5223
|
" ",
|
|
5114
5224
|
"*"
|
|
5115
5225
|
] })
|
|
@@ -5121,7 +5231,7 @@ var ToggleInputComponent = forwardRef12(function ToggleInput({
|
|
|
5121
5231
|
as: "span",
|
|
5122
5232
|
display: "block",
|
|
5123
5233
|
fontSize: 14,
|
|
5124
|
-
color: errorText ?
|
|
5234
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
5125
5235
|
children: errorText || infoText
|
|
5126
5236
|
}
|
|
5127
5237
|
)
|
|
@@ -5147,13 +5257,13 @@ var ToggleInput_default = {
|
|
|
5147
5257
|
id,
|
|
5148
5258
|
...props
|
|
5149
5259
|
}, ref) {
|
|
5150
|
-
const
|
|
5260
|
+
const theme2 = useTheme20();
|
|
5151
5261
|
const internalId = useId3();
|
|
5152
5262
|
const { style, hoverStyle, excludeStyle, restProps } = useComponentPropsGrouper(props, true);
|
|
5153
5263
|
const dataProps = useComponentPropsWithPrefix(restProps, "data");
|
|
5154
5264
|
const ariaProps = useComponentPropsWithPrefix(restProps, "aria");
|
|
5155
|
-
const [internalChecked, setInternalChecked] =
|
|
5156
|
-
const [isMouseDown, setIsMouseDown] =
|
|
5265
|
+
const [internalChecked, setInternalChecked] = useBooleanState6();
|
|
5266
|
+
const [isMouseDown, setIsMouseDown] = useBooleanState6();
|
|
5157
5267
|
const checked = controlledChecked ?? internalChecked;
|
|
5158
5268
|
const onClickElement = useCallback11(() => {
|
|
5159
5269
|
if (disabled) return;
|
|
@@ -5162,13 +5272,13 @@ var ToggleInput_default = {
|
|
|
5162
5272
|
onChange?.(newIsChecked, value);
|
|
5163
5273
|
}, [disabled, checked, onChange, controlledChecked, value]);
|
|
5164
5274
|
const readyId = id ?? internalId;
|
|
5165
|
-
return /* @__PURE__ */ jsxs14(Div_default.column, { width: "fit-content", gap:
|
|
5275
|
+
return /* @__PURE__ */ jsxs14(Div_default.column, { width: "fit-content", gap: theme2.styles.gap, ...excludeStyle, children: [
|
|
5166
5276
|
label && /* @__PURE__ */ jsx18(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
|
|
5167
5277
|
/* @__PURE__ */ jsx18(
|
|
5168
5278
|
Div_default.row,
|
|
5169
5279
|
{
|
|
5170
5280
|
alignItems: "center",
|
|
5171
|
-
gap:
|
|
5281
|
+
gap: theme2.styles.gap,
|
|
5172
5282
|
borderRadius: 999,
|
|
5173
5283
|
isTabAccessed: true,
|
|
5174
5284
|
onClick: onClickElement,
|
|
@@ -5181,7 +5291,7 @@ var ToggleInput_default = {
|
|
|
5181
5291
|
children: /* @__PURE__ */ jsx18(
|
|
5182
5292
|
SwitchElement,
|
|
5183
5293
|
{
|
|
5184
|
-
theme,
|
|
5294
|
+
theme: theme2,
|
|
5185
5295
|
checked,
|
|
5186
5296
|
disabled: disabled ?? false,
|
|
5187
5297
|
isMouseDown,
|
|
@@ -5204,7 +5314,7 @@ var ToggleInput_default = {
|
|
|
5204
5314
|
as: "span",
|
|
5205
5315
|
display: "block",
|
|
5206
5316
|
fontSize: 14,
|
|
5207
|
-
color: errorText ?
|
|
5317
|
+
color: errorText ? theme2.colors.error : labelColor ?? theme2.colors.textSecondary,
|
|
5208
5318
|
children: errorText || infoText
|
|
5209
5319
|
}
|
|
5210
5320
|
)
|
|
@@ -5239,7 +5349,7 @@ var FormComponent = forwardRef13(function Form({
|
|
|
5239
5349
|
children,
|
|
5240
5350
|
...props
|
|
5241
5351
|
}, ref) {
|
|
5242
|
-
const
|
|
5352
|
+
const theme2 = useTheme21();
|
|
5243
5353
|
const submitButtonIsDisabledInternal = useMemo7(() => {
|
|
5244
5354
|
if (!form || !form.requiredFields) return false;
|
|
5245
5355
|
return Object.entries(form.values).some(
|
|
@@ -5249,7 +5359,7 @@ var FormComponent = forwardRef13(function Form({
|
|
|
5249
5359
|
const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
|
|
5250
5360
|
const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
|
|
5251
5361
|
return /* @__PURE__ */ jsx19(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ jsxs15("form", { name, onSubmit: onSubmit ?? form?.onSubmit, ref, children: [
|
|
5252
|
-
gap !== void 0 || withDividers ? /* @__PURE__ */ jsx19(Div_default.column, { gap: gap ?? (withDividers ?
|
|
5362
|
+
gap !== void 0 || withDividers ? /* @__PURE__ */ jsx19(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? Children.toArray(children).map((child, index) => /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
5253
5363
|
child,
|
|
5254
5364
|
index < Children.toArray(children).length - 1 && /* @__PURE__ */ jsx19(Divider_default.horizontal, {})
|
|
5255
5365
|
] }, index)) : children }) : children,
|
|
@@ -5258,8 +5368,8 @@ var FormComponent = forwardRef13(function Form({
|
|
|
5258
5368
|
{
|
|
5259
5369
|
alignItems: "center",
|
|
5260
5370
|
justifyContent: actionButtonsLocation === "left" ? "flex-start" : actionButtonsLocation === "center" ? "center" : "flex-end",
|
|
5261
|
-
gap:
|
|
5262
|
-
marginTop:
|
|
5371
|
+
gap: theme2.styles.gap,
|
|
5372
|
+
marginTop: theme2.styles.space,
|
|
5263
5373
|
children: [
|
|
5264
5374
|
renderActionButtons,
|
|
5265
5375
|
onClickCancel && /* @__PURE__ */ jsx19(
|
|
@@ -5297,10 +5407,10 @@ import { forwardRef as forwardRef14, memo as memo20 } from "react";
|
|
|
5297
5407
|
import { useTheme as useTheme22 } from "react-better-core";
|
|
5298
5408
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5299
5409
|
var FormRowComponent = forwardRef14(function FormRow({ oneItemOnly, noBreakingPoint, asColumn, gap, children, ...props }, ref) {
|
|
5300
|
-
const
|
|
5410
|
+
const theme2 = useTheme22();
|
|
5301
5411
|
const mediaQuery = useMediaQuery();
|
|
5302
5412
|
const breakingPoint = asColumn ?? (!noBreakingPoint ? mediaQuery.size900 : false);
|
|
5303
|
-
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ?
|
|
5413
|
+
const readyGap = breakingPoint || noBreakingPoint && mediaQuery.size900 ? theme2.styles.gap : theme2.styles.space * 2;
|
|
5304
5414
|
return /* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", gap: gap ?? readyGap, invertFlexDirection: breakingPoint, ...props, ref, children: [
|
|
5305
5415
|
children,
|
|
5306
5416
|
oneItemOnly && /* @__PURE__ */ jsx20(Div_default, { width: "100%" })
|
|
@@ -5324,21 +5434,21 @@ FormRowComponent.withTitle = forwardRef14(function WithTitle({
|
|
|
5324
5434
|
children,
|
|
5325
5435
|
...props
|
|
5326
5436
|
}, ref) {
|
|
5327
|
-
const
|
|
5437
|
+
const theme2 = useTheme22();
|
|
5328
5438
|
const mediaQuery = useMediaQuery();
|
|
5329
|
-
const titleGap =
|
|
5439
|
+
const titleGap = theme2.styles.space;
|
|
5330
5440
|
return /* @__PURE__ */ jsxs16(FormRowComponent, { ...props, ref, children: [
|
|
5331
5441
|
/* @__PURE__ */ jsxs16(Div_default.row, { width: "100%", alignItems: "center", gap: titleGap, children: [
|
|
5332
5442
|
icon && /* @__PURE__ */ jsx20(Icon_default, { name: icon }),
|
|
5333
|
-
/* @__PURE__ */ jsxs16(Div_default.column, { flex: 1, gap:
|
|
5443
|
+
/* @__PURE__ */ jsxs16(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
5334
5444
|
/* @__PURE__ */ jsxs16(Text_default, { as: titleAs, fontSize: titleFontSize, children: [
|
|
5335
5445
|
title,
|
|
5336
|
-
required && /* @__PURE__ */ jsxs16(Text_default, { as: "span", fontSize: 16, color:
|
|
5446
|
+
required && /* @__PURE__ */ jsxs16(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
|
|
5337
5447
|
" ",
|
|
5338
5448
|
"*"
|
|
5339
5449
|
] })
|
|
5340
5450
|
] }),
|
|
5341
|
-
description && /* @__PURE__ */ jsx20(Text_default, { fontSize: descriptionFontSize, color:
|
|
5451
|
+
description && /* @__PURE__ */ jsx20(Text_default, { fontSize: descriptionFontSize, color: theme2.colors.textSecondary, children: description })
|
|
5342
5452
|
] }),
|
|
5343
5453
|
isLoading && /* @__PURE__ */ jsx20(Div_default, { width: 26 - titleGap })
|
|
5344
5454
|
] }),
|
|
@@ -5349,14 +5459,14 @@ FormRowComponent.withTitle = forwardRef14(function WithTitle({
|
|
|
5349
5459
|
width: props.noBreakingPoint && mediaQuery.size900 ? void 0 : "100%",
|
|
5350
5460
|
alignItems: "center",
|
|
5351
5461
|
justifyContent: alignChildren,
|
|
5352
|
-
gap:
|
|
5462
|
+
gap: theme2.styles.gap,
|
|
5353
5463
|
children: [
|
|
5354
5464
|
/* @__PURE__ */ jsx20(
|
|
5355
5465
|
Div_default,
|
|
5356
5466
|
{
|
|
5357
5467
|
position: "absolute",
|
|
5358
5468
|
top: "50%",
|
|
5359
|
-
right: `calc(100% + ${
|
|
5469
|
+
right: `calc(100% + ${theme2.styles.space}px)`,
|
|
5360
5470
|
transform: "translateY(-50%)",
|
|
5361
5471
|
opacity: !isLoading ? 0 : void 0,
|
|
5362
5472
|
pointerEvents: !isLoading ? "none" : void 0,
|
|
@@ -5364,7 +5474,7 @@ FormRowComponent.withTitle = forwardRef14(function WithTitle({
|
|
|
5364
5474
|
}
|
|
5365
5475
|
),
|
|
5366
5476
|
children,
|
|
5367
|
-
withActions && /* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", gap:
|
|
5477
|
+
withActions && /* @__PURE__ */ jsxs16(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5368
5478
|
onClickReset && /* @__PURE__ */ jsx20(Button_default.icon, { icon: "XMark", loaderName: resetButtonLoaderName, onClick: onClickReset }),
|
|
5369
5479
|
/* @__PURE__ */ jsx20(Button_default.icon, { icon: "check", loaderName: saveButtonLoaderName, onClick: onClickSave })
|
|
5370
5480
|
] })
|
|
@@ -5378,7 +5488,7 @@ FormRow2.withTitle = FormRowComponent.withTitle;
|
|
|
5378
5488
|
var FormRow_default = FormRow2;
|
|
5379
5489
|
|
|
5380
5490
|
// src/components/ColorThemeSwitch.tsx
|
|
5381
|
-
import { memo as memo21, useCallback as useCallback12, useEffect as
|
|
5491
|
+
import { memo as memo21, useCallback as useCallback12, useEffect as useEffect10, useState as useState9 } from "react";
|
|
5382
5492
|
import { useTheme as useTheme23 } from "react-better-core";
|
|
5383
5493
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5384
5494
|
var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
@@ -5391,7 +5501,7 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5391
5501
|
setValue(checked);
|
|
5392
5502
|
document.querySelector("html")?.setAttribute("data-theme", checked ? "dark" : "light");
|
|
5393
5503
|
}, []);
|
|
5394
|
-
|
|
5504
|
+
useEffect10(() => {
|
|
5395
5505
|
const html = document.querySelector("html");
|
|
5396
5506
|
if (!html) return;
|
|
5397
5507
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -5420,8 +5530,8 @@ var ColorThemeSwitchComponent = function ColorThemeSwitch({
|
|
|
5420
5530
|
);
|
|
5421
5531
|
};
|
|
5422
5532
|
ColorThemeSwitchComponent.withText = function WithText({ withMoon, className, ...props }) {
|
|
5423
|
-
const
|
|
5424
|
-
return /* @__PURE__ */ jsxs17(Div_default.row, { width: "fit-content", alignItems: "center", gap:
|
|
5533
|
+
const theme2 = useTheme23();
|
|
5534
|
+
return /* @__PURE__ */ jsxs17(Div_default.row, { width: "fit-content", alignItems: "center", gap: theme2.styles.gap, userSelect: "none", ...props, children: [
|
|
5425
5535
|
/* @__PURE__ */ jsx21(Text_default, { children: "Light" }),
|
|
5426
5536
|
/* @__PURE__ */ jsx21(ColorThemeSwitchComponent, { withMoon, className }),
|
|
5427
5537
|
/* @__PURE__ */ jsx21(Text_default, { children: "Dark" })
|
|
@@ -5440,14 +5550,14 @@ import {
|
|
|
5440
5550
|
useState as useState11,
|
|
5441
5551
|
useImperativeHandle as useImperativeHandle2,
|
|
5442
5552
|
useRef as useRef6,
|
|
5443
|
-
useEffect as
|
|
5553
|
+
useEffect as useEffect12,
|
|
5444
5554
|
Fragment as Fragment6
|
|
5445
5555
|
} from "react";
|
|
5446
5556
|
import { darkenColor as darkenColor3, useBetterCoreContext as useBetterCoreContext8, useTheme as useTheme25 } from "react-better-core";
|
|
5447
5557
|
import styled12, { css as css2 } from "styled-components";
|
|
5448
5558
|
|
|
5449
5559
|
// src/components/Pagination.tsx
|
|
5450
|
-
import { memo as memo22, useCallback as useCallback13, useEffect as
|
|
5560
|
+
import { memo as memo22, useCallback as useCallback13, useEffect as useEffect11, useMemo as useMemo8, useState as useState10 } from "react";
|
|
5451
5561
|
import { useTheme as useTheme24 } from "react-better-core";
|
|
5452
5562
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5453
5563
|
var PaginationComponent = function Pagination({
|
|
@@ -5460,7 +5570,7 @@ var PaginationComponent = function Pagination({
|
|
|
5460
5570
|
onClickNextPage,
|
|
5461
5571
|
onChangePage
|
|
5462
5572
|
}) {
|
|
5463
|
-
const
|
|
5573
|
+
const theme2 = useTheme24();
|
|
5464
5574
|
const mediaQuery = useMediaQuery();
|
|
5465
5575
|
const [currentPageInternal, setCurrentPage] = useState10(currentPage);
|
|
5466
5576
|
const pageCountInternal = pageCount ?? (itemsPerPage !== void 0 ? Math.ceil(itemsLength / itemsPerPage) : 1);
|
|
@@ -5489,14 +5599,14 @@ var PaginationComponent = function Pagination({
|
|
|
5489
5599
|
(_, index) => startPage + index
|
|
5490
5600
|
);
|
|
5491
5601
|
}, [pageCountInternal, currentPageInternal]);
|
|
5492
|
-
|
|
5602
|
+
useEffect11(() => {
|
|
5493
5603
|
onChangePage?.(currentPageInternal);
|
|
5494
5604
|
}, [currentPageInternal, onChangePage]);
|
|
5495
|
-
|
|
5605
|
+
useEffect11(() => {
|
|
5496
5606
|
setCurrentPage(currentPage);
|
|
5497
5607
|
}, [currentPage]);
|
|
5498
5608
|
const mobileFooterBreakingPoint = mediaQuery.size700 && pageCountInternal > maximumVisiblePages2 / 1.4;
|
|
5499
|
-
return /* @__PURE__ */ jsxs18(Div_default.row, { alignItems: "center", justifyContent: "center", gap:
|
|
5609
|
+
return /* @__PURE__ */ jsxs18(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
|
|
5500
5610
|
pageCountInternal > maximumVisiblePages2 && /* @__PURE__ */ jsx22(
|
|
5501
5611
|
Button_default.icon,
|
|
5502
5612
|
{
|
|
@@ -5513,7 +5623,7 @@ var PaginationComponent = function Pagination({
|
|
|
5513
5623
|
alignItems: "center",
|
|
5514
5624
|
justifyContent: "center",
|
|
5515
5625
|
flexWrap: mobileFooterBreakingPoint ? "wrap" : void 0,
|
|
5516
|
-
gap:
|
|
5626
|
+
gap: theme2.styles.gap,
|
|
5517
5627
|
children: paginationItems.map((pageIndex) => {
|
|
5518
5628
|
const isActive = currentPageInternal === pageIndex;
|
|
5519
5629
|
return /* @__PURE__ */ jsx22(
|
|
@@ -5527,8 +5637,8 @@ var PaginationComponent = function Pagination({
|
|
|
5527
5637
|
Text_default,
|
|
5528
5638
|
{
|
|
5529
5639
|
fontWeight: isActive ? 700 : 400,
|
|
5530
|
-
color: isActive ?
|
|
5531
|
-
transition:
|
|
5640
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
5641
|
+
transition: theme2.styles.transition,
|
|
5532
5642
|
children: pageIndex
|
|
5533
5643
|
}
|
|
5534
5644
|
)
|
|
@@ -5730,7 +5840,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
5730
5840
|
onChangeFilterDataValue,
|
|
5731
5841
|
...props
|
|
5732
5842
|
}, ref) {
|
|
5733
|
-
const
|
|
5843
|
+
const theme2 = useTheme25();
|
|
5734
5844
|
const mediaQuery = useMediaQuery();
|
|
5735
5845
|
const { colorTheme } = useBetterCoreContext8();
|
|
5736
5846
|
const filterModalRef = useRef6(null);
|
|
@@ -5794,7 +5904,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
5794
5904
|
}
|
|
5795
5905
|
case "image": {
|
|
5796
5906
|
const imageProps = (typeof column.getImageProps === "function" ? column.getImageProps?.(item, itemIndex) : column.getImageProps) ?? {};
|
|
5797
|
-
return /* @__PURE__ */ jsx23(Image_default, { width: "100%", borderRadius:
|
|
5907
|
+
return /* @__PURE__ */ jsx23(Image_default, { width: "100%", borderRadius: theme2.styles.borderRadius / 2, ...imageProps });
|
|
5798
5908
|
}
|
|
5799
5909
|
case "checkbox": {
|
|
5800
5910
|
const { onChange, ...toggleInputProps } = (typeof column.getToggleInputProps === "function" ? column.getToggleInputProps?.(item, itemIndex) : column.getToggleInputProps) ?? {};
|
|
@@ -5825,7 +5935,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
5825
5935
|
{
|
|
5826
5936
|
name: "chevronDown",
|
|
5827
5937
|
transform: `rotate(${expandedRows[itemIndex] ? 180 : 0}deg)`,
|
|
5828
|
-
transition:
|
|
5938
|
+
transition: theme2.styles.transition
|
|
5829
5939
|
}
|
|
5830
5940
|
) });
|
|
5831
5941
|
}
|
|
@@ -5834,7 +5944,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
5834
5944
|
}
|
|
5835
5945
|
}
|
|
5836
5946
|
},
|
|
5837
|
-
[
|
|
5947
|
+
[theme2, checkedItems, expandedRows]
|
|
5838
5948
|
);
|
|
5839
5949
|
const onClickRowElement = useCallback14(
|
|
5840
5950
|
(item, index) => {
|
|
@@ -6053,13 +6163,13 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6053
6163
|
[possibleFilterListValues]
|
|
6054
6164
|
);
|
|
6055
6165
|
const onClickDeselectAllFilterListItems = useCallback14(() => setFilterListSelectedItems([]), []);
|
|
6056
|
-
|
|
6166
|
+
useEffect12(() => {
|
|
6057
6167
|
onChangePage?.(currentPage);
|
|
6058
6168
|
}, [onChangePage, currentPage]);
|
|
6059
|
-
|
|
6169
|
+
useEffect12(() => {
|
|
6060
6170
|
onChangeFilter?.(filterData);
|
|
6061
6171
|
}, [onChangeFilter, filterData]);
|
|
6062
|
-
|
|
6172
|
+
useEffect12(() => {
|
|
6063
6173
|
if (!memoizeFilters) return;
|
|
6064
6174
|
if (!name) return;
|
|
6065
6175
|
localStorage.setItem(
|
|
@@ -6070,7 +6180,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6070
6180
|
})
|
|
6071
6181
|
);
|
|
6072
6182
|
}, [memoizeFilters, name, filterData]);
|
|
6073
|
-
|
|
6183
|
+
useEffect12(() => {
|
|
6074
6184
|
onChangeFilterDataValue?.(dataAfterFilter);
|
|
6075
6185
|
}, [onChangeFilterDataValue, dataAfterFilter]);
|
|
6076
6186
|
useImperativeHandle2(
|
|
@@ -6091,8 +6201,8 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6091
6201
|
/* @__PURE__ */ jsx23(
|
|
6092
6202
|
Div_default,
|
|
6093
6203
|
{
|
|
6094
|
-
border: `1px solid ${
|
|
6095
|
-
borderRadius:
|
|
6204
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
6205
|
+
borderRadius: theme2.styles.borderRadius * 2,
|
|
6096
6206
|
overflow: !containsOverflowComponents ? "auto" : void 0,
|
|
6097
6207
|
...props,
|
|
6098
6208
|
ref: wrapperComponentRef,
|
|
@@ -6103,7 +6213,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6103
6213
|
withHover: onClickRow !== void 0 || expandColumn !== void 0,
|
|
6104
6214
|
withStickyHeader,
|
|
6105
6215
|
colorTheme,
|
|
6106
|
-
theme,
|
|
6216
|
+
theme: theme2,
|
|
6107
6217
|
containsOverflowComponents,
|
|
6108
6218
|
withFooter,
|
|
6109
6219
|
children: [
|
|
@@ -6120,7 +6230,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6120
6230
|
width: "100%",
|
|
6121
6231
|
alignItems: "center",
|
|
6122
6232
|
justifyContent: column.filter ? "space-between" : column.align === "center" ? "center" : column.align === "right" ? "flex-end" : "flex-start",
|
|
6123
|
-
gap:
|
|
6233
|
+
gap: theme2.styles.gap,
|
|
6124
6234
|
children: [
|
|
6125
6235
|
column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ jsx23(
|
|
6126
6236
|
ToggleInput_default.checkbox,
|
|
@@ -6134,7 +6244,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6134
6244
|
Button_default.icon,
|
|
6135
6245
|
{
|
|
6136
6246
|
icon: "filter",
|
|
6137
|
-
color: filterData[index] ?
|
|
6247
|
+
color: filterData[index] ? theme2.colors.primary : theme2.colors.textSecondary,
|
|
6138
6248
|
value: index,
|
|
6139
6249
|
onClickWithValue: onClickFilterButton
|
|
6140
6250
|
}
|
|
@@ -6177,14 +6287,14 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6177
6287
|
width: "100%",
|
|
6178
6288
|
justifyContent: "center",
|
|
6179
6289
|
flexReverse: true,
|
|
6180
|
-
gap:
|
|
6290
|
+
gap: theme2.styles.gap / 2,
|
|
6181
6291
|
children: [
|
|
6182
6292
|
/* @__PURE__ */ jsxs19(
|
|
6183
6293
|
Text_default,
|
|
6184
6294
|
{
|
|
6185
6295
|
position: mobileFooterBreakingPoint ? "relative" : "absolute",
|
|
6186
6296
|
top: !mobileFooterBreakingPoint ? "50%" : void 0,
|
|
6187
|
-
color:
|
|
6297
|
+
color: theme2.colors.textSecondary,
|
|
6188
6298
|
transform: !mobileFooterBreakingPoint ? "translateY(-50%)" : void 0,
|
|
6189
6299
|
userSelect: "none",
|
|
6190
6300
|
children: [
|
|
@@ -6236,7 +6346,7 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6236
6346
|
Form_default,
|
|
6237
6347
|
{
|
|
6238
6348
|
form: filterForm,
|
|
6239
|
-
gap:
|
|
6349
|
+
gap: theme2.styles.gap,
|
|
6240
6350
|
submitButtonText: "Filter",
|
|
6241
6351
|
cancelButtonText: "Clear",
|
|
6242
6352
|
onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
|
|
@@ -6248,9 +6358,9 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6248
6358
|
/* @__PURE__ */ jsx23(InputField_default.dateTime, { label: "Min", ...filterForm.getInputFieldProps("min") }),
|
|
6249
6359
|
/* @__PURE__ */ jsx23(InputField_default.dateTime, { label: "Max", ...filterForm.getInputFieldProps("max") })
|
|
6250
6360
|
] }) }),
|
|
6251
|
-
openedFilterColumn.presets && /* @__PURE__ */ jsxs19(Div_default.column, { gap:
|
|
6361
|
+
openedFilterColumn.presets && /* @__PURE__ */ jsxs19(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
6252
6362
|
/* @__PURE__ */ jsx23(Label_default, { text: "Presets" }),
|
|
6253
|
-
/* @__PURE__ */ jsx23(Div_default.row, { alignItems: "center", flexWrap: "wrap", gap:
|
|
6363
|
+
/* @__PURE__ */ jsx23(Div_default.row, { alignItems: "center", flexWrap: "wrap", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => /* @__PURE__ */ jsx23(
|
|
6254
6364
|
Button_default.secondary,
|
|
6255
6365
|
{
|
|
6256
6366
|
text: filterPresetsText[preset],
|
|
@@ -6266,10 +6376,10 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6266
6376
|
) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ jsxs19(
|
|
6267
6377
|
Form_default,
|
|
6268
6378
|
{
|
|
6269
|
-
gap:
|
|
6379
|
+
gap: theme2.styles.space,
|
|
6270
6380
|
submitButtonText: "Filter",
|
|
6271
6381
|
cancelButtonText: "Clear",
|
|
6272
|
-
renderActionButtons: /* @__PURE__ */ jsxs19(Div_default.row, { marginRight: "auto", alignItems: "center", gap:
|
|
6382
|
+
renderActionButtons: /* @__PURE__ */ jsxs19(Div_default.row, { marginRight: "auto", alignItems: "center", gap: theme2.styles.gap, children: [
|
|
6273
6383
|
/* @__PURE__ */ jsx23(
|
|
6274
6384
|
Button_default.secondary,
|
|
6275
6385
|
{
|
|
@@ -6300,9 +6410,9 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6300
6410
|
...filterForm.getInputFieldProps("search")
|
|
6301
6411
|
}
|
|
6302
6412
|
) }),
|
|
6303
|
-
/* @__PURE__ */ jsxs19(Div_default.column, { gap:
|
|
6413
|
+
/* @__PURE__ */ jsxs19(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
6304
6414
|
/* @__PURE__ */ jsx23(Label_default, { text: "Possible values" }),
|
|
6305
|
-
/* @__PURE__ */ jsx23(Div_default.row, { flexWrap: "wrap", gap:
|
|
6415
|
+
/* @__PURE__ */ jsx23(Div_default.row, { flexWrap: "wrap", gap: theme2.styles.gap, children: possibleFilterListValues.length > 0 ? possibleFilterListValues.map((value) => {
|
|
6306
6416
|
const isActive = filterListSelectedItems?.includes(value.value);
|
|
6307
6417
|
return /* @__PURE__ */ jsx23(
|
|
6308
6418
|
Div_default.box,
|
|
@@ -6310,13 +6420,13 @@ var TableComponent = forwardRef15(function Table({
|
|
|
6310
6420
|
isActive,
|
|
6311
6421
|
value: value.value,
|
|
6312
6422
|
onClickWithValue: onClickFilterListItem,
|
|
6313
|
-
children: /* @__PURE__ */ jsxs19(Div_default.row, { alignItems: "center", gap:
|
|
6423
|
+
children: /* @__PURE__ */ jsxs19(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
6314
6424
|
/* @__PURE__ */ jsx23(Text_default, { children: value.label || value.value }),
|
|
6315
6425
|
openedFilterColumn.withTotalNumber && /* @__PURE__ */ jsxs19(
|
|
6316
6426
|
Text_default,
|
|
6317
6427
|
{
|
|
6318
6428
|
fontSize: 14,
|
|
6319
|
-
color: isActive ?
|
|
6429
|
+
color: isActive ? theme2.colors.base + "c0" : theme2.colors.textSecondary,
|
|
6320
6430
|
children: [
|
|
6321
6431
|
"(",
|
|
6322
6432
|
value.count,
|
|
@@ -6342,7 +6452,7 @@ var Table2 = memo23(TableComponent);
|
|
|
6342
6452
|
var Table_default = Table2;
|
|
6343
6453
|
|
|
6344
6454
|
// src/components/Tooltip.tsx
|
|
6345
|
-
import { memo as memo24, useCallback as useCallback15, useRef as useRef7, useState as useState12, useEffect as
|
|
6455
|
+
import { memo as memo24, useCallback as useCallback15, useRef as useRef7, useState as useState12, useEffect as useEffect13, forwardRef as forwardRef16, useImperativeHandle as useImperativeHandle3, useMemo as useMemo10 } from "react";
|
|
6346
6456
|
import { useTheme as useTheme26 } from "react-better-core";
|
|
6347
6457
|
import styled13, { css as css3 } from "styled-components";
|
|
6348
6458
|
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
@@ -6448,14 +6558,14 @@ var arrowStyle = (props, borderWidth) => ({
|
|
|
6448
6558
|
}
|
|
6449
6559
|
});
|
|
6450
6560
|
var Arrow = memo24(function Arrow2(props) {
|
|
6451
|
-
const
|
|
6561
|
+
const theme2 = useTheme26();
|
|
6452
6562
|
const { position, size } = props;
|
|
6453
6563
|
const outerProps = useMemo10(
|
|
6454
6564
|
() => ({
|
|
6455
6565
|
...props,
|
|
6456
|
-
color:
|
|
6566
|
+
color: theme2.colors.border
|
|
6457
6567
|
}),
|
|
6458
|
-
[props,
|
|
6568
|
+
[props, theme2]
|
|
6459
6569
|
);
|
|
6460
6570
|
const borderWidth = 1;
|
|
6461
6571
|
return /* @__PURE__ */ jsx24(
|
|
@@ -6499,16 +6609,16 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
6499
6609
|
onClose,
|
|
6500
6610
|
children
|
|
6501
6611
|
}, ref) {
|
|
6502
|
-
const
|
|
6612
|
+
const theme2 = useTheme26();
|
|
6503
6613
|
const triggerHolderRef = useRef7(null);
|
|
6504
6614
|
const contentRef = useRef7(null);
|
|
6505
6615
|
const tooltipContainerRef = useRef7(null);
|
|
6506
6616
|
const closeTimerRef = useRef7(void 0);
|
|
6507
6617
|
const [isOpen, setIsOpen] = useState12(false);
|
|
6508
6618
|
const [isOpenLate, setIsOpenLate] = useState12(false);
|
|
6509
|
-
const arrowSize = withArrow ?
|
|
6510
|
-
const gap =
|
|
6511
|
-
const outsideScreenGap =
|
|
6619
|
+
const arrowSize = withArrow ? theme2.styles.gap : 0;
|
|
6620
|
+
const gap = theme2.styles.gap / 2;
|
|
6621
|
+
const outsideScreenGap = theme2.styles.gap / 2;
|
|
6512
6622
|
const totalGap = arrowSize + gap;
|
|
6513
6623
|
const openTooltip = useCallback15(() => {
|
|
6514
6624
|
if (disabled) return;
|
|
@@ -6565,7 +6675,7 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
6565
6675
|
},
|
|
6566
6676
|
[trigger, isOpen, closeTooltip]
|
|
6567
6677
|
);
|
|
6568
|
-
|
|
6678
|
+
useEffect13(() => {
|
|
6569
6679
|
if (trigger === "click") {
|
|
6570
6680
|
document.addEventListener("mousedown", onClickOutside);
|
|
6571
6681
|
return () => {
|
|
@@ -6573,7 +6683,7 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
6573
6683
|
};
|
|
6574
6684
|
}
|
|
6575
6685
|
}, [trigger, onClickOutside]);
|
|
6576
|
-
|
|
6686
|
+
useEffect13(() => {
|
|
6577
6687
|
if (!disabled) return;
|
|
6578
6688
|
closeTooltip();
|
|
6579
6689
|
}, [disabled]);
|
|
@@ -6611,7 +6721,7 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
6611
6721
|
/* @__PURE__ */ jsx24(
|
|
6612
6722
|
TooltipContainer,
|
|
6613
6723
|
{
|
|
6614
|
-
theme,
|
|
6724
|
+
theme: theme2,
|
|
6615
6725
|
position,
|
|
6616
6726
|
align,
|
|
6617
6727
|
pointerEvents: contentPointerEvents,
|
|
@@ -6628,10 +6738,10 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
6628
6738
|
position: "relative",
|
|
6629
6739
|
width: contentWidth,
|
|
6630
6740
|
minWidth: contentMinWidth,
|
|
6631
|
-
backgroundColor: backgroundColor ??
|
|
6741
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundContent,
|
|
6632
6742
|
boxShadow: "0px 10px 20px #00000020",
|
|
6633
|
-
paddingBlock: isSmall ?
|
|
6634
|
-
paddingInline: asContextMenu ? 0 : isSmall ?
|
|
6743
|
+
paddingBlock: isSmall ? theme2.styles.gap / 2 : theme2.styles.gap,
|
|
6744
|
+
paddingInline: asContextMenu ? 0 : isSmall ? theme2.styles.space / 2 : theme2.styles.space,
|
|
6635
6745
|
overflow: asContextMenu ? "hidden" : void 0,
|
|
6636
6746
|
children: content
|
|
6637
6747
|
}
|
|
@@ -6655,9 +6765,9 @@ var TooltipComponent = forwardRef16(function Tooltip({
|
|
|
6655
6765
|
{
|
|
6656
6766
|
position,
|
|
6657
6767
|
align,
|
|
6658
|
-
sideSpace:
|
|
6768
|
+
sideSpace: theme2.styles.borderRadius,
|
|
6659
6769
|
size: arrowSize,
|
|
6660
|
-
color: backgroundColor ??
|
|
6770
|
+
color: backgroundColor ?? theme2.colors.backgroundContent,
|
|
6661
6771
|
isOpen
|
|
6662
6772
|
}
|
|
6663
6773
|
)
|
|
@@ -6681,16 +6791,16 @@ TooltipComponent.item = forwardRef16(function Item({
|
|
|
6681
6791
|
onClick,
|
|
6682
6792
|
onClickWithValue
|
|
6683
6793
|
}, ref) {
|
|
6684
|
-
const
|
|
6794
|
+
const theme2 = useTheme26();
|
|
6685
6795
|
return /* @__PURE__ */ jsxs20(
|
|
6686
6796
|
Div_default.row,
|
|
6687
6797
|
{
|
|
6688
6798
|
alignItems: "center",
|
|
6689
|
-
gap:
|
|
6690
|
-
backgroundColor:
|
|
6799
|
+
gap: theme2.styles.space,
|
|
6800
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
6691
6801
|
filterHover: !disabled ? "brightness(0.9)" : "brightness(0.94)",
|
|
6692
|
-
paddingBlock:
|
|
6693
|
-
paddingInline:
|
|
6802
|
+
paddingBlock: theme2.styles.gap,
|
|
6803
|
+
paddingInline: theme2.styles.space,
|
|
6694
6804
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
6695
6805
|
isTabAccessed: true,
|
|
6696
6806
|
id,
|
|
@@ -6700,29 +6810,29 @@ TooltipComponent.item = forwardRef16(function Item({
|
|
|
6700
6810
|
onClickWithValue: !disabled ? onClickWithValue : void 0,
|
|
6701
6811
|
ref,
|
|
6702
6812
|
children: [
|
|
6703
|
-
icon && /* @__PURE__ */ jsx24(Icon_default, { name: icon, color: iconColor ?? (!isActive ?
|
|
6704
|
-
/* @__PURE__ */ jsxs20(Div_default.column, { flex: 1, gap:
|
|
6705
|
-
/* @__PURE__ */ jsx24(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ??
|
|
6706
|
-
description && /* @__PURE__ */ jsx24(Text_default, { fontSize: 14, color:
|
|
6813
|
+
icon && /* @__PURE__ */ jsx24(Icon_default, { name: icon, color: iconColor ?? (!isActive ? theme2.colors.textSecondary : void 0) }),
|
|
6814
|
+
/* @__PURE__ */ jsxs20(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
|
|
6815
|
+
/* @__PURE__ */ jsx24(Text_default, { fontWeight: isActive ? 700 : void 0, color: textColor ?? theme2.colors.textPrimary, children: text }),
|
|
6816
|
+
description && /* @__PURE__ */ jsx24(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: description })
|
|
6707
6817
|
] })
|
|
6708
6818
|
]
|
|
6709
6819
|
}
|
|
6710
6820
|
);
|
|
6711
6821
|
});
|
|
6712
6822
|
TooltipComponent.divider = forwardRef16(function DividerComponent(props, ref) {
|
|
6713
|
-
const
|
|
6714
|
-
return /* @__PURE__ */ jsx24(Divider_default.horizontal, { marginBlock:
|
|
6823
|
+
const theme2 = useTheme26();
|
|
6824
|
+
return /* @__PURE__ */ jsx24(Divider_default.horizontal, { marginBlock: theme2.styles.gap, ...props, ref });
|
|
6715
6825
|
});
|
|
6716
6826
|
TooltipComponent.sectionTitle = forwardRef16(function SectionTitle({ text, ...props }, ref) {
|
|
6717
|
-
const
|
|
6827
|
+
const theme2 = useTheme26();
|
|
6718
6828
|
return /* @__PURE__ */ jsx24(
|
|
6719
6829
|
Text_default,
|
|
6720
6830
|
{
|
|
6721
6831
|
fontSize: 12,
|
|
6722
6832
|
fontWeight: 700,
|
|
6723
6833
|
textTransform: "uppercase",
|
|
6724
|
-
marginBlock:
|
|
6725
|
-
marginInline:
|
|
6834
|
+
marginBlock: theme2.styles.gap / 2,
|
|
6835
|
+
marginInline: theme2.styles.space,
|
|
6726
6836
|
...props,
|
|
6727
6837
|
ref,
|
|
6728
6838
|
children: text
|
|
@@ -6736,7 +6846,7 @@ Tooltip2.sectionTitle = TooltipComponent.sectionTitle;
|
|
|
6736
6846
|
var Tooltip_default = Tooltip2;
|
|
6737
6847
|
|
|
6738
6848
|
// src/components/Tabs.tsx
|
|
6739
|
-
import { forwardRef as forwardRef17, memo as memo25, useCallback as useCallback16, useEffect as
|
|
6849
|
+
import { forwardRef as forwardRef17, memo as memo25, useCallback as useCallback16, useEffect as useEffect14, useImperativeHandle as useImperativeHandle4, useMemo as useMemo11, useRef as useRef8, useState as useState13 } from "react";
|
|
6740
6850
|
import { useBetterCoreContext as useBetterCoreContext9, useTheme as useTheme27 } from "react-better-core";
|
|
6741
6851
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6742
6852
|
var tabBottomLineWidth = 2;
|
|
@@ -6744,7 +6854,7 @@ var tabDotSize = 6;
|
|
|
6744
6854
|
var defaultTabName = "tab";
|
|
6745
6855
|
var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style = "default", onChange, children, ...props }, ref) {
|
|
6746
6856
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
6747
|
-
const
|
|
6857
|
+
const theme2 = useTheme27();
|
|
6748
6858
|
const urlQuery = reactRouterDomPlugin2 ? useUrlQuery() : void 0;
|
|
6749
6859
|
const { componentsState } = useBetterHtmlContextInternal();
|
|
6750
6860
|
const { colorTheme } = useBetterCoreContext9();
|
|
@@ -6760,7 +6870,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6760
6870
|
return selectedTabValue;
|
|
6761
6871
|
});
|
|
6762
6872
|
const [rerenderState, setRerenderState] = useState13(0);
|
|
6763
|
-
const tabsGap = style === "box" ?
|
|
6873
|
+
const tabsGap = style === "box" ? theme2.styles.gap / 2 : 0;
|
|
6764
6874
|
const onClickTab = useCallback16(
|
|
6765
6875
|
(tab) => {
|
|
6766
6876
|
setSelectedTab(tab);
|
|
@@ -6785,7 +6895,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6785
6895
|
});
|
|
6786
6896
|
return spacing;
|
|
6787
6897
|
}, [selectedTab, tabs, tabsGap]);
|
|
6788
|
-
|
|
6898
|
+
useEffect14(() => {
|
|
6789
6899
|
const timeout = setTimeout(() => {
|
|
6790
6900
|
setRerenderState(Math.random());
|
|
6791
6901
|
firstRenderPassedRef.current = true;
|
|
@@ -6794,7 +6904,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6794
6904
|
clearTimeout(timeout);
|
|
6795
6905
|
};
|
|
6796
6906
|
}, []);
|
|
6797
|
-
|
|
6907
|
+
useEffect14(() => {
|
|
6798
6908
|
componentsState.tabs.setTabGroups((oldValue) => {
|
|
6799
6909
|
const thisTabGroup = oldValue.find((item) => item.name === (name ?? defaultTabName));
|
|
6800
6910
|
if (thisTabGroup) {
|
|
@@ -6815,13 +6925,13 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6815
6925
|
}
|
|
6816
6926
|
});
|
|
6817
6927
|
}, [selectedTab, name]);
|
|
6818
|
-
|
|
6928
|
+
useEffect14(() => {
|
|
6819
6929
|
tabsRef.current[selectedTab]?.scrollIntoView({
|
|
6820
6930
|
behavior: firstRenderPassedRef.current ? "smooth" : void 0,
|
|
6821
6931
|
block: "nearest"
|
|
6822
6932
|
});
|
|
6823
6933
|
}, [selectedTab]);
|
|
6824
|
-
|
|
6934
|
+
useEffect14(() => {
|
|
6825
6935
|
return () => {
|
|
6826
6936
|
componentsState.tabs.setTabGroups(
|
|
6827
6937
|
(oldValue) => oldValue.filter((item) => item.name !== (name ?? defaultTabName))
|
|
@@ -6838,7 +6948,7 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6838
6948
|
},
|
|
6839
6949
|
[selectedTab, onClickTab]
|
|
6840
6950
|
);
|
|
6841
|
-
return /* @__PURE__ */ jsxs21(Div_default.column, { width: "100%", gap:
|
|
6951
|
+
return /* @__PURE__ */ jsxs21(Div_default.column, { width: "100%", gap: theme2.styles.space, ...props, children: [
|
|
6842
6952
|
/* @__PURE__ */ jsxs21(Div_default, { position: "relative", className: "react-better-html-no-scrollbar", overflowY: "auto", children: [
|
|
6843
6953
|
/* @__PURE__ */ jsx25(Div_default.row, { position: "relative", width: "fit-content", gap: tabsGap, userSelect: "none", children: tabs.map((tab) => {
|
|
6844
6954
|
const selected = tab === selectedTab;
|
|
@@ -6847,14 +6957,14 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6847
6957
|
{
|
|
6848
6958
|
position: "relative",
|
|
6849
6959
|
width: "fit-content",
|
|
6850
|
-
backgroundColor: style === "box" ? selected ?
|
|
6851
|
-
borderRadius: style === "box" ?
|
|
6852
|
-
borderTopLeftRadius: style === "borderRadiusTop" ?
|
|
6853
|
-
borderTopRightRadius: style === "borderRadiusTop" ?
|
|
6854
|
-
border: style === "box" ? `1px solid ${selected ? "transparent" :
|
|
6960
|
+
backgroundColor: style === "box" ? selected ? theme2.colors.primary : theme2.colors.backgroundContent : theme2.colors.backgroundBase,
|
|
6961
|
+
borderRadius: style === "box" ? theme2.styles.borderRadius : void 0,
|
|
6962
|
+
borderTopLeftRadius: style === "borderRadiusTop" ? theme2.styles.borderRadius : void 0,
|
|
6963
|
+
borderTopRightRadius: style === "borderRadiusTop" ? theme2.styles.borderRadius : void 0,
|
|
6964
|
+
border: style === "box" ? `1px solid ${selected ? "transparent" : theme2.colors.border}` : void 0,
|
|
6855
6965
|
filterHover: colorTheme === "dark" ? style === "box" ? "brightness(1.2)" : "brightness(2)" : "brightness(0.9)",
|
|
6856
|
-
paddingInline:
|
|
6857
|
-
paddingBlock:
|
|
6966
|
+
paddingInline: theme2.styles.space,
|
|
6967
|
+
paddingBlock: theme2.styles.gap,
|
|
6858
6968
|
value: tab,
|
|
6859
6969
|
cursor: "pointer",
|
|
6860
6970
|
isTabAccessed: true,
|
|
@@ -6867,21 +6977,21 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6867
6977
|
Div_default,
|
|
6868
6978
|
{
|
|
6869
6979
|
position: "absolute",
|
|
6870
|
-
top: (
|
|
6871
|
-
right: (
|
|
6980
|
+
top: (theme2.styles.space - tabDotSize) / 2,
|
|
6981
|
+
right: (theme2.styles.space - tabDotSize) / 2,
|
|
6872
6982
|
width: tabDotSize,
|
|
6873
6983
|
height: tabDotSize,
|
|
6874
|
-
backgroundColor: style === "box" && selected ?
|
|
6984
|
+
backgroundColor: style === "box" && selected ? theme2.colors.base : theme2.colors.primary,
|
|
6875
6985
|
borderRadius: 999,
|
|
6876
|
-
transition:
|
|
6986
|
+
transition: theme2.styles.transition
|
|
6877
6987
|
}
|
|
6878
6988
|
),
|
|
6879
6989
|
/* @__PURE__ */ jsx25(
|
|
6880
6990
|
Text_default,
|
|
6881
6991
|
{
|
|
6882
6992
|
fontWeight: 700,
|
|
6883
|
-
color: !selected ?
|
|
6884
|
-
transition:
|
|
6993
|
+
color: !selected ? theme2.colors.textSecondary : style === "box" ? theme2.colors.base : void 0,
|
|
6994
|
+
transition: theme2.styles.transition,
|
|
6885
6995
|
whiteSpace: "nowrap",
|
|
6886
6996
|
children: tab
|
|
6887
6997
|
}
|
|
@@ -6899,8 +7009,8 @@ var TabsComponent = forwardRef17(function Tabs({ tabs, name, accentColor, style
|
|
|
6899
7009
|
height: tabBottomLineWidth,
|
|
6900
7010
|
bottom: 0,
|
|
6901
7011
|
left: leftSpacing,
|
|
6902
|
-
backgroundColor: accentColor ??
|
|
6903
|
-
transition: firstRenderPassedRef.current ?
|
|
7012
|
+
backgroundColor: accentColor ?? theme2.colors.primary,
|
|
7013
|
+
transition: firstRenderPassedRef.current ? theme2.styles.transition : "none"
|
|
6904
7014
|
}
|
|
6905
7015
|
)
|
|
6906
7016
|
] }),
|
|
@@ -6913,7 +7023,7 @@ TabsComponent.content = function Content({ tab, tabWithDot, tabsGroupName, isIni
|
|
|
6913
7023
|
() => componentsState.tabs.tabGroups.find((item) => item.name === (tabsGroupName ?? defaultTabName)),
|
|
6914
7024
|
[componentsState.tabs, tabsGroupName]
|
|
6915
7025
|
);
|
|
6916
|
-
|
|
7026
|
+
useEffect14(() => {
|
|
6917
7027
|
if (tabWithDot) {
|
|
6918
7028
|
componentsState.tabs.setTabsWithDots?.((oldValue) => oldValue.includes(tab) ? oldValue : [...oldValue, tab]);
|
|
6919
7029
|
} else {
|
|
@@ -6929,8 +7039,8 @@ Tabs2.content = TabsComponent.content;
|
|
|
6929
7039
|
var Tabs_default = Tabs2;
|
|
6930
7040
|
|
|
6931
7041
|
// src/components/Foldable.tsx
|
|
6932
|
-
import { forwardRef as forwardRef18, memo as memo26, useCallback as useCallback17, useEffect as
|
|
6933
|
-
import { useBooleanState as
|
|
7042
|
+
import { forwardRef as forwardRef18, memo as memo26, useCallback as useCallback17, useEffect as useEffect15, useImperativeHandle as useImperativeHandle5, useRef as useRef9, useState as useState14 } from "react";
|
|
7043
|
+
import { useBooleanState as useBooleanState7, useTheme as useTheme28 } from "react-better-core";
|
|
6934
7044
|
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6935
7045
|
var animationDurationClose = 0.15;
|
|
6936
7046
|
var animationDurationOpen = animationDurationClose * 2;
|
|
@@ -6953,9 +7063,9 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
6953
7063
|
children,
|
|
6954
7064
|
...props
|
|
6955
7065
|
}, ref) {
|
|
6956
|
-
const
|
|
7066
|
+
const theme2 = useTheme28();
|
|
6957
7067
|
const bodyRef = useRef9(null);
|
|
6958
|
-
const [internalIsOpen, setInternalIsOpen] =
|
|
7068
|
+
const [internalIsOpen, setInternalIsOpen] = useBooleanState7(defaultOpen);
|
|
6959
7069
|
const [bodyVirtualHeight, setBodyVirtualHeight] = useState14();
|
|
6960
7070
|
const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
|
|
6961
7071
|
const open = useCallback17(() => {
|
|
@@ -6970,7 +7080,7 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
6970
7080
|
if (controlledIsOpen === void 0) setInternalIsOpen.toggle();
|
|
6971
7081
|
onOpenChange?.(!isOpen);
|
|
6972
7082
|
}, [controlledIsOpen, isOpen, onOpenChange]);
|
|
6973
|
-
|
|
7083
|
+
useEffect15(() => {
|
|
6974
7084
|
if (!bodyRef.current) return;
|
|
6975
7085
|
const body = bodyRef.current;
|
|
6976
7086
|
setBodyVirtualHeight(body.scrollHeight * 2);
|
|
@@ -6981,7 +7091,7 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
6981
7091
|
clearTimeout(timeout);
|
|
6982
7092
|
};
|
|
6983
7093
|
}, [isOpen]);
|
|
6984
|
-
|
|
7094
|
+
useEffect15(() => {
|
|
6985
7095
|
if (!isOpen) return;
|
|
6986
7096
|
if (!bodyRef.current) return;
|
|
6987
7097
|
const observer = new ResizeObserver(() => {
|
|
@@ -7011,31 +7121,31 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
7011
7121
|
{
|
|
7012
7122
|
width: "100%",
|
|
7013
7123
|
alignItems: "center",
|
|
7014
|
-
gap:
|
|
7015
|
-
paddingBlock: headerPaddingBlock ??
|
|
7124
|
+
gap: theme2.styles.space,
|
|
7125
|
+
paddingBlock: headerPaddingBlock ?? theme2.styles.gap,
|
|
7016
7126
|
paddingInline: headerPaddingInline,
|
|
7017
7127
|
cursor: "pointer",
|
|
7018
7128
|
onClick: toggleOpen,
|
|
7019
7129
|
userSelect: "none",
|
|
7020
7130
|
children: [
|
|
7021
|
-
/* @__PURE__ */ jsxs22(Div_default.row, { flex: 1, alignItems: "center", gap:
|
|
7131
|
+
/* @__PURE__ */ jsxs22(Div_default.row, { flex: 1, alignItems: "center", gap: theme2.styles.space, children: [
|
|
7022
7132
|
icon && /* @__PURE__ */ jsx26(Icon_default, { name: icon, size: 20, flexShrink: 0 }),
|
|
7023
7133
|
image && /* @__PURE__ */ jsx26(Image_default.profileImage, { name: image, size: 24, flexShrink: 0 }),
|
|
7024
|
-
/* @__PURE__ */ jsxs22(Div_default.column, { gap:
|
|
7025
|
-
title && /* @__PURE__ */ jsxs22(Div_default.row, { alignItems: "center", gap:
|
|
7134
|
+
/* @__PURE__ */ jsxs22(Div_default.column, { gap: theme2.styles.gap / 2, children: [
|
|
7135
|
+
title && /* @__PURE__ */ jsxs22(Div_default.row, { alignItems: "center", gap: theme2.styles.space, children: [
|
|
7026
7136
|
/* @__PURE__ */ jsx26(
|
|
7027
7137
|
Text_default,
|
|
7028
7138
|
{
|
|
7029
7139
|
as: titleAs,
|
|
7030
7140
|
fontWeight: 700,
|
|
7031
7141
|
lineHeight: "20px",
|
|
7032
|
-
color: titleColor ??
|
|
7142
|
+
color: titleColor ?? theme2.colors.textPrimary,
|
|
7033
7143
|
children: title
|
|
7034
7144
|
}
|
|
7035
7145
|
),
|
|
7036
7146
|
titleRightElement
|
|
7037
7147
|
] }),
|
|
7038
|
-
description && /* @__PURE__ */ jsx26(Text_default, { color: descriptionColor ??
|
|
7148
|
+
description && /* @__PURE__ */ jsx26(Text_default, { color: descriptionColor ?? theme2.colors.textSecondary, children: description })
|
|
7039
7149
|
] })
|
|
7040
7150
|
] }),
|
|
7041
7151
|
rightElement,
|
|
@@ -7044,37 +7154,37 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
7044
7154
|
{
|
|
7045
7155
|
name: "chevronDown",
|
|
7046
7156
|
transform: `rotate(${isOpen ? 180 : 0}deg)`,
|
|
7047
|
-
transition:
|
|
7157
|
+
transition: theme2.styles.transition
|
|
7048
7158
|
}
|
|
7049
7159
|
)
|
|
7050
7160
|
]
|
|
7051
7161
|
}
|
|
7052
7162
|
),
|
|
7053
|
-
/* @__PURE__ */ jsx26(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition:
|
|
7163
|
+
/* @__PURE__ */ jsx26(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ jsx26(Divider_default.horizontal, {}) }),
|
|
7054
7164
|
/* @__PURE__ */ jsx26(
|
|
7055
7165
|
Div_default,
|
|
7056
7166
|
{
|
|
7057
7167
|
maxHeight: isOpen ? bodyVirtualHeight : 0,
|
|
7058
7168
|
opacity: !isOpen ? 0 : void 0,
|
|
7059
|
-
transition: `max-height ${isOpen ? animationDurationOpen : animationDurationClose}s ease, opacity ${
|
|
7169
|
+
transition: `max-height ${isOpen ? animationDurationOpen : animationDurationClose}s ease, opacity ${theme2.styles.transition}`,
|
|
7060
7170
|
overflow: !isOpen ? "hidden" : void 0,
|
|
7061
7171
|
pointerEvents: !isOpen ? "none" : void 0,
|
|
7062
7172
|
ref: bodyRef,
|
|
7063
|
-
children: /* @__PURE__ */ jsx26(Div_default, { paddingBlock:
|
|
7173
|
+
children: /* @__PURE__ */ jsx26(Div_default, { paddingBlock: theme2.styles.gap, paddingInline: headerPaddingInline, children })
|
|
7064
7174
|
}
|
|
7065
7175
|
)
|
|
7066
7176
|
] });
|
|
7067
7177
|
});
|
|
7068
7178
|
FoldableComponent.box = forwardRef18(function Box3({ ...props }, ref) {
|
|
7069
|
-
const
|
|
7179
|
+
const theme2 = useTheme28();
|
|
7070
7180
|
return /* @__PURE__ */ jsx26(
|
|
7071
7181
|
FoldableComponent,
|
|
7072
7182
|
{
|
|
7073
|
-
backgroundColor:
|
|
7074
|
-
border: `1px solid ${
|
|
7075
|
-
borderRadius:
|
|
7076
|
-
headerPaddingBlock: (
|
|
7077
|
-
headerPaddingInline:
|
|
7183
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
7184
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
7185
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7186
|
+
headerPaddingBlock: (theme2.styles.gap + theme2.styles.space) / 2,
|
|
7187
|
+
headerPaddingInline: theme2.styles.space,
|
|
7078
7188
|
...props,
|
|
7079
7189
|
ref
|
|
7080
7190
|
}
|
|
@@ -7085,11 +7195,11 @@ Foldable2.box = FoldableComponent.box;
|
|
|
7085
7195
|
var Foldable_default = Foldable2;
|
|
7086
7196
|
|
|
7087
7197
|
// src/components/SideMenu.tsx
|
|
7088
|
-
import { createContext as createContext2, memo as memo27, useCallback as useCallback18, useContext as useContext2, useEffect as
|
|
7198
|
+
import { createContext as createContext2, memo as memo27, useCallback as useCallback18, useContext as useContext2, useEffect as useEffect16, useMemo as useMemo12, useState as useState15 } from "react";
|
|
7089
7199
|
import {
|
|
7090
7200
|
lightenColor as lightenColor3,
|
|
7091
7201
|
useBetterCoreContext as useBetterCoreContext10,
|
|
7092
|
-
useBooleanState as
|
|
7202
|
+
useBooleanState as useBooleanState8,
|
|
7093
7203
|
useTheme as useTheme29
|
|
7094
7204
|
} from "react-better-core";
|
|
7095
7205
|
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
@@ -7110,13 +7220,13 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7110
7220
|
);
|
|
7111
7221
|
}
|
|
7112
7222
|
const reactRouterDomPluginConfig = reactRouterDomPlugin2.getConfig();
|
|
7113
|
-
const
|
|
7223
|
+
const theme2 = useTheme29();
|
|
7114
7224
|
const mediaQuery = useMediaQuery();
|
|
7115
7225
|
const location = reactRouterDomPluginConfig.useLocation();
|
|
7116
7226
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
7117
7227
|
const { colorTheme } = useBetterCoreContext10();
|
|
7118
7228
|
const { activeItem, setActiveItem } = useSideMenuContext();
|
|
7119
|
-
const [isOpened, setIsOpened] =
|
|
7229
|
+
const [isOpened, setIsOpened] = useBooleanState8();
|
|
7120
7230
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
7121
7231
|
const onClickElement = useCallback18(() => {
|
|
7122
7232
|
if (item.disabled) return;
|
|
@@ -7131,20 +7241,20 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7131
7241
|
}
|
|
7132
7242
|
}, [onClick, item, isCollapsed]);
|
|
7133
7243
|
const isActive = activeItem && item.href && activeItem.href === item.href;
|
|
7134
|
-
const readyBackgroundColor = backgroundColor ??
|
|
7244
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
7135
7245
|
const iconSize = 16;
|
|
7136
|
-
const paddingBlock =
|
|
7137
|
-
const paddingLeft =
|
|
7138
|
-
const iconGap =
|
|
7246
|
+
const paddingBlock = theme2.styles.gap;
|
|
7247
|
+
const paddingLeft = theme2.styles.gap + 2;
|
|
7248
|
+
const iconGap = theme2.styles.gap;
|
|
7139
7249
|
const lineHeight = 20;
|
|
7140
7250
|
const lineWidth = 2;
|
|
7141
7251
|
const lineEndRadius = iconSize / 2 + iconGap * 2;
|
|
7142
7252
|
const content = /* @__PURE__ */ jsx27(
|
|
7143
7253
|
Tooltip_default,
|
|
7144
7254
|
{
|
|
7145
|
-
content: /* @__PURE__ */ jsxs23(Div_default.row, { alignItems: "center", gap:
|
|
7255
|
+
content: /* @__PURE__ */ jsxs23(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
7146
7256
|
/* @__PURE__ */ jsx27(Text_default, { whiteSpace: "nowrap", children: item.text }),
|
|
7147
|
-
item.children && /* @__PURE__ */ jsx27(Icon_default, { name: "chevronDown", color:
|
|
7257
|
+
item.children && /* @__PURE__ */ jsx27(Icon_default, { name: "chevronDown", color: theme2.colors.textSecondary, size: 14 })
|
|
7148
7258
|
] }),
|
|
7149
7259
|
contentPointerEvents: "none",
|
|
7150
7260
|
withArrow: true,
|
|
@@ -7157,26 +7267,26 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7157
7267
|
alignItems: "center",
|
|
7158
7268
|
gap: iconGap,
|
|
7159
7269
|
whiteSpace: "nowrap",
|
|
7160
|
-
backgroundColor: isActive ? colorTheme === "dark" ? lightenColor3(
|
|
7161
|
-
borderRadius:
|
|
7270
|
+
backgroundColor: isActive ? colorTheme === "dark" ? lightenColor3(theme2.colors.primary, 0.7) : lightenColor3(theme2.colors.primary, 0.85) : readyBackgroundColor,
|
|
7271
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7162
7272
|
paddingBlock,
|
|
7163
|
-
paddingLeft: isCollapsed ?
|
|
7164
|
-
paddingRight:
|
|
7273
|
+
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
7274
|
+
paddingRight: theme2.styles.space,
|
|
7165
7275
|
filterHover: `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})`,
|
|
7166
7276
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
7167
7277
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
7168
7278
|
opacity: item.disabled ? 0.6 : void 0,
|
|
7169
7279
|
onClick: onClickElement,
|
|
7170
7280
|
children: [
|
|
7171
|
-
/* @__PURE__ */ jsx27(Icon_default, { name: item.iconName, color:
|
|
7281
|
+
/* @__PURE__ */ jsx27(Icon_default, { name: item.iconName, color: theme2.colors.primary, size: iconSize, flexShrink: 0 }),
|
|
7172
7282
|
/* @__PURE__ */ jsx27(
|
|
7173
7283
|
Text_default,
|
|
7174
7284
|
{
|
|
7175
7285
|
flex: 1,
|
|
7176
7286
|
lineHeight: `${lineHeight}px`,
|
|
7177
|
-
color: isActive ?
|
|
7287
|
+
color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
|
|
7178
7288
|
opacity: isCollapsed ? 0 : void 0,
|
|
7179
|
-
transition:
|
|
7289
|
+
transition: theme2.styles.transition,
|
|
7180
7290
|
children: item.text
|
|
7181
7291
|
}
|
|
7182
7292
|
),
|
|
@@ -7184,10 +7294,10 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7184
7294
|
Icon_default,
|
|
7185
7295
|
{
|
|
7186
7296
|
name: "chevronDown",
|
|
7187
|
-
color:
|
|
7297
|
+
color: theme2.colors.textSecondary,
|
|
7188
7298
|
size: 14,
|
|
7189
7299
|
transform: isOpened ? "rotate(180deg)" : void 0,
|
|
7190
|
-
transition:
|
|
7300
|
+
transition: theme2.styles.transition
|
|
7191
7301
|
}
|
|
7192
7302
|
)
|
|
7193
7303
|
]
|
|
@@ -7195,7 +7305,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7195
7305
|
)
|
|
7196
7306
|
}
|
|
7197
7307
|
);
|
|
7198
|
-
|
|
7308
|
+
useEffect16(() => {
|
|
7199
7309
|
if (!item.href) return;
|
|
7200
7310
|
const isActive2 = location.pathname === "/" ? location.pathname === item.href : location.pathname.startsWith(item.href) && item.href !== "/";
|
|
7201
7311
|
if (!isActive2) return;
|
|
@@ -7206,14 +7316,14 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7206
7316
|
} : void 0
|
|
7207
7317
|
);
|
|
7208
7318
|
}, [location.pathname]);
|
|
7209
|
-
|
|
7319
|
+
useEffect16(() => {
|
|
7210
7320
|
if (!item.children) return;
|
|
7211
7321
|
const toBeOpened = item.children.some(
|
|
7212
7322
|
(child) => child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false
|
|
7213
7323
|
);
|
|
7214
7324
|
setIsOpened.setState(toBeOpened);
|
|
7215
7325
|
}, [item]);
|
|
7216
|
-
|
|
7326
|
+
useEffect16(() => {
|
|
7217
7327
|
if (!isCollapsed) return;
|
|
7218
7328
|
setIsOpened.setFalse();
|
|
7219
7329
|
}, [isCollapsed]);
|
|
@@ -7225,11 +7335,11 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7225
7335
|
{
|
|
7226
7336
|
position: "relative",
|
|
7227
7337
|
maxHeight: isOpened ? 1e3 : 0,
|
|
7228
|
-
gap:
|
|
7229
|
-
marginTop: isOpened ?
|
|
7338
|
+
gap: theme2.styles.gap / 2,
|
|
7339
|
+
marginTop: isOpened ? theme2.styles.gap / 2 : void 0,
|
|
7230
7340
|
paddingLeft: paddingLeft + iconSize + iconGap,
|
|
7231
7341
|
overflow: "hidden",
|
|
7232
|
-
transition: `max-height ${
|
|
7342
|
+
transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
|
|
7233
7343
|
children: [
|
|
7234
7344
|
item.children.map((child) => /* @__PURE__ */ jsx27(
|
|
7235
7345
|
MenuItemComponent2,
|
|
@@ -7255,7 +7365,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7255
7365
|
position: "relative",
|
|
7256
7366
|
width: lineWidth,
|
|
7257
7367
|
height: "100%",
|
|
7258
|
-
backgroundColor:
|
|
7368
|
+
backgroundColor: theme2.colors.border,
|
|
7259
7369
|
zIndex: 1
|
|
7260
7370
|
}
|
|
7261
7371
|
),
|
|
@@ -7267,7 +7377,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7267
7377
|
height: lineEndRadius,
|
|
7268
7378
|
top: `calc(100% - ${lineEndRadius / 2}px)`,
|
|
7269
7379
|
left: 0,
|
|
7270
|
-
border: `${lineWidth}px solid ${
|
|
7380
|
+
border: `${lineWidth}px solid ${theme2.colors.border}`,
|
|
7271
7381
|
borderRadius: 999,
|
|
7272
7382
|
borderTopColor: readyBackgroundColor,
|
|
7273
7383
|
borderLeftColor: readyBackgroundColor,
|
|
@@ -7300,7 +7410,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7300
7410
|
backgroundColor,
|
|
7301
7411
|
paddingTop
|
|
7302
7412
|
}) {
|
|
7303
|
-
const
|
|
7413
|
+
const theme2 = useTheme29();
|
|
7304
7414
|
const mediaQuery = useMediaQuery();
|
|
7305
7415
|
const { components, sideMenuIsCollapsed, setSideMenuIsCollapsed, sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
7306
7416
|
const [activeItem, setActiveItem] = useState15();
|
|
@@ -7320,9 +7430,9 @@ var SideMenuComponent = function SideMenu({
|
|
|
7320
7430
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
7321
7431
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
7322
7432
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
7323
|
-
const sideMenuCollapsedWidth =
|
|
7324
|
-
const readyBackgroundColor = backgroundColor ??
|
|
7325
|
-
const logoSize = sideMenuCollapsedWidth -
|
|
7433
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
7434
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
7435
|
+
const logoSize = sideMenuCollapsedWidth - theme2.styles.space * 2;
|
|
7326
7436
|
return /* @__PURE__ */ jsx27(SideMenuContextProvider, { value: contextValue, children: /* @__PURE__ */ jsxs23(
|
|
7327
7437
|
Div_default.column,
|
|
7328
7438
|
{
|
|
@@ -7332,15 +7442,15 @@ var SideMenuComponent = function SideMenu({
|
|
|
7332
7442
|
top: topSpace,
|
|
7333
7443
|
left: 0,
|
|
7334
7444
|
backgroundColor: readyBackgroundColor,
|
|
7335
|
-
borderRight: `solid 1px ${
|
|
7445
|
+
borderRight: `solid 1px ${theme2.colors.border}`,
|
|
7336
7446
|
transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
|
|
7337
|
-
paddingTop: paddingTop ?? (logoAssetName || logoUrl ?
|
|
7338
|
-
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${
|
|
7447
|
+
paddingTop: paddingTop ?? (logoAssetName || logoUrl ? theme2.styles.gap : theme2.styles.space),
|
|
7448
|
+
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${theme2.styles.transition}` : "none" : theme2.styles.transition,
|
|
7339
7449
|
userSelect: "none",
|
|
7340
7450
|
zIndex: 10,
|
|
7341
7451
|
children: [
|
|
7342
|
-
/* @__PURE__ */ jsxs23(Div_default.column, { width: "100%", height: "100%", gap:
|
|
7343
|
-
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ jsxs23(Div_default.row, { alignItems: "center", paddingInline:
|
|
7452
|
+
/* @__PURE__ */ jsxs23(Div_default.column, { width: "100%", height: "100%", gap: theme2.styles.space, children: [
|
|
7453
|
+
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ jsxs23(Div_default.row, { alignItems: "center", paddingInline: theme2.styles.space, children: [
|
|
7344
7454
|
(logoAssetName || logoUrl) && /* @__PURE__ */ jsx27(LinkComponentTag, { to: "/", href: "/", onClick: onClickXButton, children: /* @__PURE__ */ jsxs23(
|
|
7345
7455
|
Div_default.row,
|
|
7346
7456
|
{
|
|
@@ -7348,7 +7458,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7348
7458
|
width: sideMenuCollapsedWidth ? logoSize : void 0,
|
|
7349
7459
|
height: logoSize,
|
|
7350
7460
|
whiteSpace: "nowrap",
|
|
7351
|
-
gap:
|
|
7461
|
+
gap: theme2.styles.gap,
|
|
7352
7462
|
children: [
|
|
7353
7463
|
/* @__PURE__ */ jsx27(
|
|
7354
7464
|
Image_default,
|
|
@@ -7367,7 +7477,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
7367
7477
|
fontSize: 22,
|
|
7368
7478
|
fontWeight: 800,
|
|
7369
7479
|
opacity: !isCollapsed ? 1 : 0,
|
|
7370
|
-
transition:
|
|
7480
|
+
transition: theme2.styles.transition,
|
|
7371
7481
|
userSelect: "none",
|
|
7372
7482
|
children: logoText
|
|
7373
7483
|
}
|
|
@@ -7384,9 +7494,9 @@ var SideMenuComponent = function SideMenu({
|
|
|
7384
7494
|
width: "100%",
|
|
7385
7495
|
height: "100%",
|
|
7386
7496
|
overflowY: !isCollapsed ? "auto" : void 0,
|
|
7387
|
-
paddingInline:
|
|
7388
|
-
paddingBottom: !isCollapsable && !readyBottomItems ?
|
|
7389
|
-
children: /* @__PURE__ */ jsx27(Div_default.column, { gap:
|
|
7497
|
+
paddingInline: theme2.styles.space,
|
|
7498
|
+
paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
|
|
7499
|
+
children: /* @__PURE__ */ jsx27(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ jsx27(
|
|
7390
7500
|
MenuItemComponent,
|
|
7391
7501
|
{
|
|
7392
7502
|
item,
|
|
@@ -7400,12 +7510,12 @@ var SideMenuComponent = function SideMenu({
|
|
|
7400
7510
|
readyBottomItems && /* @__PURE__ */ jsx27(
|
|
7401
7511
|
Div_default.column,
|
|
7402
7512
|
{
|
|
7403
|
-
borderTop: mediaQuery.size1000 ? `solid 1px ${
|
|
7404
|
-
gap:
|
|
7513
|
+
borderTop: mediaQuery.size1000 ? `solid 1px ${theme2.colors.border}` : void 0,
|
|
7514
|
+
gap: theme2.styles.gap / 2,
|
|
7405
7515
|
marginTop: "auto",
|
|
7406
|
-
paddingTop: mediaQuery.size1000 ?
|
|
7407
|
-
paddingInline:
|
|
7408
|
-
paddingBottom: !isCollapsable ?
|
|
7516
|
+
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
7517
|
+
paddingInline: theme2.styles.space,
|
|
7518
|
+
paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
|
|
7409
7519
|
children: readyBottomItems.map((item) => /* @__PURE__ */ jsx27(
|
|
7410
7520
|
MenuItemComponent,
|
|
7411
7521
|
{
|
|
@@ -7422,30 +7532,30 @@ var SideMenuComponent = function SideMenu({
|
|
|
7422
7532
|
isCollapsable && /* @__PURE__ */ jsx27(
|
|
7423
7533
|
Div_default,
|
|
7424
7534
|
{
|
|
7425
|
-
borderTop: `solid 1px ${
|
|
7535
|
+
borderTop: `solid 1px ${theme2.colors.border}`,
|
|
7426
7536
|
marginTop: !readyBottomItems ? "auto" : void 0,
|
|
7427
|
-
paddingInline:
|
|
7428
|
-
paddingBlock:
|
|
7537
|
+
paddingInline: theme2.styles.space,
|
|
7538
|
+
paddingBlock: theme2.styles.space,
|
|
7429
7539
|
children: /* @__PURE__ */ jsx27(
|
|
7430
7540
|
Div_default.row,
|
|
7431
7541
|
{
|
|
7432
7542
|
alignItems: "center",
|
|
7433
7543
|
justifyContent: "center",
|
|
7434
7544
|
backgroundColor: readyBackgroundColor,
|
|
7435
|
-
borderRadius:
|
|
7545
|
+
borderRadius: theme2.styles.borderRadius,
|
|
7436
7546
|
cursor: "pointer",
|
|
7437
7547
|
filterHover: filterHover().z1,
|
|
7438
7548
|
isTabAccessed: true,
|
|
7439
|
-
paddingBlock:
|
|
7549
|
+
paddingBlock: theme2.styles.gap,
|
|
7440
7550
|
onClick: setSideMenuIsCollapsed.toggle,
|
|
7441
7551
|
children: /* @__PURE__ */ jsx27(
|
|
7442
7552
|
Icon_default,
|
|
7443
7553
|
{
|
|
7444
7554
|
name: "chevronRight",
|
|
7445
7555
|
size: 20,
|
|
7446
|
-
color:
|
|
7556
|
+
color: theme2.colors.textSecondary,
|
|
7447
7557
|
transform: `rotate(${isCollapsed ? 0 : 180}deg)`,
|
|
7448
|
-
transition:
|
|
7558
|
+
transition: theme2.styles.transition
|
|
7449
7559
|
}
|
|
7450
7560
|
)
|
|
7451
7561
|
}
|
|
@@ -7457,30 +7567,30 @@ var SideMenuComponent = function SideMenu({
|
|
|
7457
7567
|
Div_default.row,
|
|
7458
7568
|
{
|
|
7459
7569
|
position: "absolute",
|
|
7460
|
-
top:
|
|
7570
|
+
top: theme2.styles.space,
|
|
7461
7571
|
left: "100%",
|
|
7462
7572
|
backgroundColor: readyBackgroundColor,
|
|
7463
|
-
border: `solid 1px ${
|
|
7573
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
7464
7574
|
borderLeft: "none",
|
|
7465
|
-
borderTopRightRadius:
|
|
7466
|
-
borderBottomRightRadius:
|
|
7575
|
+
borderTopRightRadius: theme2.styles.borderRadius,
|
|
7576
|
+
borderBottomRightRadius: theme2.styles.borderRadius,
|
|
7467
7577
|
alignItems: "center",
|
|
7468
7578
|
cursor: "pointer",
|
|
7469
7579
|
opacity: !mediaQuery.size1000 ? 0 : void 0,
|
|
7470
7580
|
pointerEvents: !mediaQuery.size1000 ? "none" : void 0,
|
|
7471
|
-
padding:
|
|
7472
|
-
paddingRight: (
|
|
7581
|
+
padding: theme2.styles.gap,
|
|
7582
|
+
paddingRight: (theme2.styles.space + theme2.styles.gap) / 2,
|
|
7473
7583
|
transform: !mediaQuery.size1000 ? "translateX(-100%)" : void 0,
|
|
7474
|
-
transition:
|
|
7584
|
+
transition: theme2.styles.transition,
|
|
7475
7585
|
onClick: setSideMenuIsOpenMobile.toggle,
|
|
7476
7586
|
children: /* @__PURE__ */ jsx27(
|
|
7477
7587
|
Icon_default,
|
|
7478
7588
|
{
|
|
7479
7589
|
name: "chevronRight",
|
|
7480
7590
|
size: 20,
|
|
7481
|
-
color:
|
|
7591
|
+
color: theme2.colors.textSecondary,
|
|
7482
7592
|
transform: sideMenuIsOpenMobile ? "rotate(180deg)" : void 0,
|
|
7483
|
-
transition:
|
|
7593
|
+
transition: theme2.styles.transition
|
|
7484
7594
|
}
|
|
7485
7595
|
)
|
|
7486
7596
|
}
|
|
@@ -7491,18 +7601,18 @@ var SideMenuComponent = function SideMenu({
|
|
|
7491
7601
|
) });
|
|
7492
7602
|
};
|
|
7493
7603
|
SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, ...props }) {
|
|
7494
|
-
const
|
|
7604
|
+
const theme2 = useTheme29();
|
|
7495
7605
|
const mediaQuery = useMediaQuery();
|
|
7496
7606
|
const { components, sideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
7497
7607
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
7498
|
-
const sideMenuCollapsedWidth =
|
|
7608
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
7499
7609
|
return /* @__PURE__ */ jsxs23(
|
|
7500
7610
|
Div_default,
|
|
7501
7611
|
{
|
|
7502
7612
|
position: "relative",
|
|
7503
7613
|
width: "100%",
|
|
7504
7614
|
paddingLeft: !mediaQuery.size1000 ? !sideMenuIsCollapsed ? sideMenuWidth : sideMenuCollapsedWidth : void 0,
|
|
7505
|
-
transition:
|
|
7615
|
+
transition: theme2.styles.transition,
|
|
7506
7616
|
children: [
|
|
7507
7617
|
outsideComponent,
|
|
7508
7618
|
/* @__PURE__ */ jsx27(PageHolder_default, { ...props })
|
|
@@ -7511,9 +7621,9 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
|
|
|
7511
7621
|
);
|
|
7512
7622
|
};
|
|
7513
7623
|
SideMenuComponent.burgerButton = function BurgerButton() {
|
|
7514
|
-
const
|
|
7624
|
+
const theme2 = useTheme29();
|
|
7515
7625
|
const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
|
|
7516
|
-
const [isHovered, setIsHovered] =
|
|
7626
|
+
const [isHovered, setIsHovered] = useBooleanState8();
|
|
7517
7627
|
const width = 2;
|
|
7518
7628
|
return /* @__PURE__ */ jsxs23(
|
|
7519
7629
|
Div_default,
|
|
@@ -7535,10 +7645,10 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7535
7645
|
height: width,
|
|
7536
7646
|
top: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
|
|
7537
7647
|
left: 0,
|
|
7538
|
-
backgroundColor:
|
|
7648
|
+
backgroundColor: theme2.colors.border,
|
|
7539
7649
|
borderRadius: 999,
|
|
7540
7650
|
transform: sideMenuIsOpenMobile ? "rotate(45deg)" : void 0,
|
|
7541
|
-
transition:
|
|
7651
|
+
transition: theme2.styles.transition
|
|
7542
7652
|
}
|
|
7543
7653
|
),
|
|
7544
7654
|
/* @__PURE__ */ jsx27(
|
|
@@ -7549,11 +7659,11 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7549
7659
|
height: width,
|
|
7550
7660
|
top: "50%",
|
|
7551
7661
|
left: 0,
|
|
7552
|
-
backgroundColor:
|
|
7662
|
+
backgroundColor: theme2.colors.border,
|
|
7553
7663
|
borderRadius: 999,
|
|
7554
7664
|
transform: "translateY(-50%)",
|
|
7555
7665
|
opacity: sideMenuIsOpenMobile ? 0 : void 0,
|
|
7556
|
-
transition:
|
|
7666
|
+
transition: theme2.styles.transition
|
|
7557
7667
|
}
|
|
7558
7668
|
),
|
|
7559
7669
|
/* @__PURE__ */ jsx27(
|
|
@@ -7564,10 +7674,10 @@ SideMenuComponent.burgerButton = function BurgerButton() {
|
|
|
7564
7674
|
height: width,
|
|
7565
7675
|
bottom: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
|
|
7566
7676
|
left: 0,
|
|
7567
|
-
backgroundColor:
|
|
7677
|
+
backgroundColor: theme2.colors.border,
|
|
7568
7678
|
borderRadius: 999,
|
|
7569
7679
|
transform: sideMenuIsOpenMobile ? "rotate(-45deg)" : void 0,
|
|
7570
|
-
transition:
|
|
7680
|
+
transition: theme2.styles.transition
|
|
7571
7681
|
}
|
|
7572
7682
|
)
|
|
7573
7683
|
]
|
|
@@ -7632,7 +7742,7 @@ export {
|
|
|
7632
7742
|
sideMenuControls,
|
|
7633
7743
|
useAlertControls,
|
|
7634
7744
|
useBetterHtmlContext,
|
|
7635
|
-
|
|
7745
|
+
useBooleanState9 as useBooleanState,
|
|
7636
7746
|
useDebounceState3 as useDebounceState,
|
|
7637
7747
|
useForm,
|
|
7638
7748
|
useLoader2 as useLoader,
|