react-better-html 1.1.236 → 1.1.238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +122 -61
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +123 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
darkenColor as darkenColor4,
|
|
9
9
|
saturateColor,
|
|
10
10
|
desaturateColor,
|
|
11
|
+
calculateColorContrast as calculateColorContrast2,
|
|
11
12
|
generateRandomString,
|
|
12
13
|
formatPhoneNumber,
|
|
13
14
|
eventPreventDefault,
|
|
@@ -3293,6 +3294,7 @@ var PageHolderComponent = forwardRef8(function PageHolder({ noMaxContentWidth, c
|
|
|
3293
3294
|
);
|
|
3294
3295
|
});
|
|
3295
3296
|
PageHolderComponent.center = forwardRef8(function Center({
|
|
3297
|
+
height,
|
|
3296
3298
|
pageBackgroundColor,
|
|
3297
3299
|
pageBackgroundImage,
|
|
3298
3300
|
contentMaxWidth,
|
|
@@ -3335,18 +3337,29 @@ PageHolderComponent.center = forwardRef8(function Center({
|
|
|
3335
3337
|
}
|
|
3336
3338
|
),
|
|
3337
3339
|
sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ jsx13(Div_default, { width: "50%" }),
|
|
3338
|
-
/* @__PURE__ */ jsx13(
|
|
3339
|
-
|
|
3340
|
+
/* @__PURE__ */ jsx13(
|
|
3341
|
+
Div_default.column,
|
|
3340
3342
|
{
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3343
|
+
position: "relative",
|
|
3344
|
+
width: `${withSideComponent ? 50 : 100}%`,
|
|
3345
|
+
height,
|
|
3346
|
+
alignItems: "center",
|
|
3347
|
+
zIndex: 2,
|
|
3348
|
+
children: /* @__PURE__ */ jsx13(
|
|
3349
|
+
ContentTag,
|
|
3350
|
+
{
|
|
3351
|
+
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3352
|
+
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3353
|
+
height,
|
|
3354
|
+
marginInline: theme2.styles.space,
|
|
3355
|
+
marginBlock: theme2.styles.space,
|
|
3356
|
+
...props,
|
|
3357
|
+
ref,
|
|
3358
|
+
children
|
|
3359
|
+
}
|
|
3360
|
+
)
|
|
3348
3361
|
}
|
|
3349
|
-
)
|
|
3362
|
+
),
|
|
3350
3363
|
sideComponentPosition === "right" && withSideComponent && /* @__PURE__ */ jsx13(Div_default, { width: "50%" }),
|
|
3351
3364
|
withSideComponent && /* @__PURE__ */ jsx13(
|
|
3352
3365
|
Div_default,
|
|
@@ -5514,7 +5527,12 @@ var FormComponent = forwardRef13(function Form({
|
|
|
5514
5527
|
return /* @__PURE__ */ jsx19(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ jsxs16("form", { name, onSubmit: onSubmit ?? form?.onSubmit, ref, children: [
|
|
5515
5528
|
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__ */ jsxs16(Fragment5, { children: [
|
|
5516
5529
|
child,
|
|
5517
|
-
index < Children.toArray(children).length - 1 && /* @__PURE__ */ jsx19(
|
|
5530
|
+
index < Children.toArray(children).length - 1 && /* @__PURE__ */ jsx19(
|
|
5531
|
+
Divider_default.horizontal,
|
|
5532
|
+
{
|
|
5533
|
+
width: theme2.styles.borderWidth === 0 ? 1 : theme2.styles.borderWidth
|
|
5534
|
+
}
|
|
5535
|
+
)
|
|
5518
5536
|
] }, index)) : children }) : children,
|
|
5519
5537
|
submitButtonText && /* @__PURE__ */ jsxs16(
|
|
5520
5538
|
Div_default.row,
|
|
@@ -6967,7 +6985,15 @@ TooltipComponent.item = forwardRef16(function Item({
|
|
|
6967
6985
|
});
|
|
6968
6986
|
TooltipComponent.divider = forwardRef16(function DividerComponent(props, ref) {
|
|
6969
6987
|
const theme2 = useTheme26();
|
|
6970
|
-
return /* @__PURE__ */ jsx24(
|
|
6988
|
+
return /* @__PURE__ */ jsx24(
|
|
6989
|
+
Divider_default.horizontal,
|
|
6990
|
+
{
|
|
6991
|
+
width: theme2.styles.borderWidth === 0 ? 1 : theme2.styles.borderWidth,
|
|
6992
|
+
marginBlock: theme2.styles.gap,
|
|
6993
|
+
...props,
|
|
6994
|
+
ref
|
|
6995
|
+
}
|
|
6996
|
+
);
|
|
6971
6997
|
});
|
|
6972
6998
|
TooltipComponent.sectionTitle = forwardRef16(function SectionTitle({ text, ...props }, ref) {
|
|
6973
6999
|
const theme2 = useTheme26();
|
|
@@ -7298,7 +7324,7 @@ var FoldableComponent = forwardRef18(function Foldable({
|
|
|
7298
7324
|
]
|
|
7299
7325
|
}
|
|
7300
7326
|
),
|
|
7301
|
-
/* @__PURE__ */ jsx26(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ jsx26(Divider_default.horizontal, { width: theme2.styles.borderWidth }) }),
|
|
7327
|
+
/* @__PURE__ */ jsx26(Div_default, { height: isOpen ? 1 : 0, opacity: isOpen ? 1 : 0, transition: theme2.styles.transition, children: /* @__PURE__ */ jsx26(Divider_default.horizontal, { width: theme2.styles.borderWidth === 0 ? 1 : theme2.styles.borderWidth }) }),
|
|
7302
7328
|
/* @__PURE__ */ jsx26(
|
|
7303
7329
|
Div_default,
|
|
7304
7330
|
{
|
|
@@ -7335,6 +7361,7 @@ var Foldable_default = Foldable2;
|
|
|
7335
7361
|
// src/components/SideMenu.tsx
|
|
7336
7362
|
import { createContext as createContext2, memo as memo27, useCallback as useCallback18, useContext as useContext2, useEffect as useEffect16, useMemo as useMemo12, useState as useState15 } from "react";
|
|
7337
7363
|
import {
|
|
7364
|
+
calculateColorContrast,
|
|
7338
7365
|
lightenColor as lightenColor3,
|
|
7339
7366
|
useBetterCoreContext as useBetterCoreContext10,
|
|
7340
7367
|
useBooleanState as useBooleanState8,
|
|
@@ -7351,7 +7378,13 @@ var useSideMenuContext = () => {
|
|
|
7351
7378
|
}
|
|
7352
7379
|
return context;
|
|
7353
7380
|
};
|
|
7354
|
-
var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
7381
|
+
var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
7382
|
+
item,
|
|
7383
|
+
backgroundColor,
|
|
7384
|
+
activeItemColor,
|
|
7385
|
+
hoverItemColor,
|
|
7386
|
+
onClick
|
|
7387
|
+
}) {
|
|
7355
7388
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
7356
7389
|
if (!reactRouterDomPlugin2) {
|
|
7357
7390
|
throw new Error(
|
|
@@ -7392,6 +7425,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7392
7425
|
const lineHeight = 20;
|
|
7393
7426
|
const lineWidth = 2;
|
|
7394
7427
|
const lineEndRadius = iconSize / 2 + iconGap * 2;
|
|
7428
|
+
const backgroundColorContrast = activeItemColor ? calculateColorContrast(activeItemColor, theme2.colors.primary) : 21;
|
|
7395
7429
|
const content = /* @__PURE__ */ jsx27(
|
|
7396
7430
|
Tooltip_default,
|
|
7397
7431
|
{
|
|
@@ -7410,24 +7444,33 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7410
7444
|
alignItems: "center",
|
|
7411
7445
|
gap: iconGap,
|
|
7412
7446
|
whiteSpace: "nowrap",
|
|
7413
|
-
backgroundColor: isActive ? colorTheme === "dark" ? lightenColor3(theme2.colors.primary, 0.7) : lightenColor3(theme2.colors.primary, 0.85) : readyBackgroundColor,
|
|
7447
|
+
backgroundColor: isActive ? activeItemColor ?? (colorTheme === "dark" ? lightenColor3(theme2.colors.primary, 0.7) : lightenColor3(theme2.colors.primary, 0.85)) : readyBackgroundColor,
|
|
7448
|
+
backgroundColorHover: hoverItemColor,
|
|
7414
7449
|
borderRadius: theme2.styles.borderRadius,
|
|
7415
7450
|
paddingBlock,
|
|
7416
7451
|
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
7417
7452
|
paddingRight: theme2.styles.space,
|
|
7418
|
-
filterHover: `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})
|
|
7453
|
+
filterHover: !hoverItemColor ? `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})` : void 0,
|
|
7419
7454
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
7420
7455
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
7421
7456
|
opacity: item.disabled ? 0.6 : void 0,
|
|
7422
7457
|
onClick: onClickElement,
|
|
7423
7458
|
children: [
|
|
7424
|
-
/* @__PURE__ */ jsx27(
|
|
7459
|
+
/* @__PURE__ */ jsx27(
|
|
7460
|
+
Icon_default,
|
|
7461
|
+
{
|
|
7462
|
+
name: item.iconName,
|
|
7463
|
+
color: isActive && backgroundColorContrast < 7 ? theme2.colors.base : theme2.colors.primary,
|
|
7464
|
+
size: iconSize,
|
|
7465
|
+
flexShrink: 0
|
|
7466
|
+
}
|
|
7467
|
+
),
|
|
7425
7468
|
/* @__PURE__ */ jsx27(
|
|
7426
7469
|
Text_default,
|
|
7427
7470
|
{
|
|
7428
7471
|
flex: 1,
|
|
7429
7472
|
lineHeight: `${lineHeight}px`,
|
|
7430
|
-
color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
|
|
7473
|
+
color: isActive ? backgroundColorContrast < 7 ? theme2.colors.base : theme2.colors.primary : theme2.colors.textPrimary,
|
|
7431
7474
|
opacity: isCollapsed ? 0 : void 0,
|
|
7432
7475
|
transition: theme2.styles.transition,
|
|
7433
7476
|
children: item.text
|
|
@@ -7562,10 +7605,18 @@ var SideMenuComponent = function SideMenu({
|
|
|
7562
7605
|
withCloseButton,
|
|
7563
7606
|
widthMobileHandle,
|
|
7564
7607
|
absoluteComponent,
|
|
7565
|
-
|
|
7608
|
+
itemsAdditionalComponent,
|
|
7609
|
+
betweenItemsAdditionalComponent,
|
|
7610
|
+
bottomItemsAdditionalComponent,
|
|
7566
7611
|
isLoading,
|
|
7567
7612
|
backgroundColor,
|
|
7568
|
-
|
|
7613
|
+
activeItemColor,
|
|
7614
|
+
hoverItemColor,
|
|
7615
|
+
gap,
|
|
7616
|
+
paddingTop,
|
|
7617
|
+
paddingBottom,
|
|
7618
|
+
renderItemsHolder,
|
|
7619
|
+
renderBottomItemsHolder
|
|
7569
7620
|
}) {
|
|
7570
7621
|
const theme2 = useTheme29();
|
|
7571
7622
|
const mediaQuery = useMediaQuery();
|
|
@@ -7590,9 +7641,53 @@ var SideMenuComponent = function SideMenu({
|
|
|
7590
7641
|
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
7591
7642
|
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
7592
7643
|
const logoSize = sideMenuCollapsedWidth - theme2.styles.space * 2;
|
|
7644
|
+
const itemsComponent = /* @__PURE__ */ jsx27(
|
|
7645
|
+
Div_default.column,
|
|
7646
|
+
{
|
|
7647
|
+
width: "100%",
|
|
7648
|
+
height: "100%",
|
|
7649
|
+
overflowY: !isCollapsed ? "auto" : void 0,
|
|
7650
|
+
paddingInline: !renderItemsHolder ? theme2.styles.space : void 0,
|
|
7651
|
+
paddingBottom: !renderItemsHolder ? !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0 : void 0,
|
|
7652
|
+
children: /* @__PURE__ */ jsx27(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ jsx27(
|
|
7653
|
+
MenuItemComponent,
|
|
7654
|
+
{
|
|
7655
|
+
item,
|
|
7656
|
+
backgroundColor: readyBackgroundColor,
|
|
7657
|
+
activeItemColor,
|
|
7658
|
+
hoverItemColor,
|
|
7659
|
+
onClick: onClickXButton
|
|
7660
|
+
},
|
|
7661
|
+
item.text
|
|
7662
|
+
)) })
|
|
7663
|
+
}
|
|
7664
|
+
);
|
|
7665
|
+
const bottomItemsComponent = /* @__PURE__ */ jsx27(
|
|
7666
|
+
Div_default.column,
|
|
7667
|
+
{
|
|
7668
|
+
borderTop: mediaQuery.size1000 ? `solid ${theme2.styles.borderWidth}px ${theme2.colors.border}` : void 0,
|
|
7669
|
+
gap: theme2.styles.gap / 2,
|
|
7670
|
+
marginTop: "auto",
|
|
7671
|
+
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
7672
|
+
paddingInline: !renderItemsHolder ? theme2.styles.space : void 0,
|
|
7673
|
+
paddingBottom: !renderItemsHolder ? !isCollapsable ? theme2.styles.space : void 0 : void 0,
|
|
7674
|
+
children: readyBottomItems?.map((item) => /* @__PURE__ */ jsx27(
|
|
7675
|
+
MenuItemComponent,
|
|
7676
|
+
{
|
|
7677
|
+
item,
|
|
7678
|
+
backgroundColor: readyBackgroundColor,
|
|
7679
|
+
activeItemColor,
|
|
7680
|
+
hoverItemColor,
|
|
7681
|
+
onClick: onClickXButton
|
|
7682
|
+
},
|
|
7683
|
+
item.text
|
|
7684
|
+
))
|
|
7685
|
+
}
|
|
7686
|
+
);
|
|
7593
7687
|
return /* @__PURE__ */ jsx27(SideMenuContextProvider, { value: contextValue, children: /* @__PURE__ */ jsxs24(
|
|
7594
7688
|
Div_default.column,
|
|
7595
7689
|
{
|
|
7690
|
+
as: "aside",
|
|
7596
7691
|
position: "fixed",
|
|
7597
7692
|
width: mediaQuery.size1000 ? "100%" : isCollapsed ? sideMenuCollapsedWidth : sideMenuWidth,
|
|
7598
7693
|
height: `calc(100svh - ${topSpace}px)`,
|
|
@@ -7602,11 +7697,12 @@ var SideMenuComponent = function SideMenu({
|
|
|
7602
7697
|
borderRight: `solid ${theme2.styles.borderWidth}px ${theme2.colors.border}`,
|
|
7603
7698
|
transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
|
|
7604
7699
|
paddingTop: paddingTop ?? (logoAssetName || logoUrl ? theme2.styles.gap : theme2.styles.space),
|
|
7700
|
+
paddingBottom,
|
|
7605
7701
|
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${theme2.styles.transition}` : "none" : theme2.styles.transition,
|
|
7606
7702
|
userSelect: "none",
|
|
7607
7703
|
zIndex: 10,
|
|
7608
7704
|
children: [
|
|
7609
|
-
/* @__PURE__ */ jsxs24(Div_default.column, { width: "100%", height: "100%", gap: theme2.styles.space, children: [
|
|
7705
|
+
/* @__PURE__ */ jsxs24(Div_default.column, { width: "100%", height: "100%", gap: gap ?? theme2.styles.space, children: [
|
|
7610
7706
|
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ jsxs24(Div_default.row, { alignItems: "center", paddingInline: theme2.styles.space, children: [
|
|
7611
7707
|
(logoAssetName || logoUrl) && /* @__PURE__ */ jsx27(LinkComponentTag, { to: "/", href: "/", onClick: onClickXButton, children: /* @__PURE__ */ jsxs24(
|
|
7612
7708
|
Div_default.row,
|
|
@@ -7644,48 +7740,13 @@ var SideMenuComponent = function SideMenu({
|
|
|
7644
7740
|
) }),
|
|
7645
7741
|
withCloseButton && mediaQuery.size1000 && /* @__PURE__ */ jsx27(Button_default.icon, { icon: "XMark", marginLeft: "auto", onClick: onClickXButton })
|
|
7646
7742
|
] }),
|
|
7743
|
+
itemsAdditionalComponent,
|
|
7647
7744
|
!isLoading ? /* @__PURE__ */ jsxs24(Fragment8, { children: [
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
width: "100%",
|
|
7652
|
-
height: "100%",
|
|
7653
|
-
overflowY: !isCollapsed ? "auto" : void 0,
|
|
7654
|
-
paddingInline: theme2.styles.space,
|
|
7655
|
-
paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
|
|
7656
|
-
children: /* @__PURE__ */ jsx27(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ jsx27(
|
|
7657
|
-
MenuItemComponent,
|
|
7658
|
-
{
|
|
7659
|
-
item,
|
|
7660
|
-
backgroundColor: readyBackgroundColor,
|
|
7661
|
-
onClick: onClickXButton
|
|
7662
|
-
},
|
|
7663
|
-
item.text
|
|
7664
|
-
)) })
|
|
7665
|
-
}
|
|
7666
|
-
),
|
|
7667
|
-
readyBottomItems && /* @__PURE__ */ jsx27(
|
|
7668
|
-
Div_default.column,
|
|
7669
|
-
{
|
|
7670
|
-
borderTop: mediaQuery.size1000 ? `solid ${theme2.styles.borderWidth}px ${theme2.colors.border}` : void 0,
|
|
7671
|
-
gap: theme2.styles.gap / 2,
|
|
7672
|
-
marginTop: "auto",
|
|
7673
|
-
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
7674
|
-
paddingInline: theme2.styles.space,
|
|
7675
|
-
paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
|
|
7676
|
-
children: readyBottomItems.map((item) => /* @__PURE__ */ jsx27(
|
|
7677
|
-
MenuItemComponent,
|
|
7678
|
-
{
|
|
7679
|
-
item,
|
|
7680
|
-
backgroundColor: readyBackgroundColor,
|
|
7681
|
-
onClick: onClickXButton
|
|
7682
|
-
},
|
|
7683
|
-
item.text
|
|
7684
|
-
))
|
|
7685
|
-
}
|
|
7686
|
-
)
|
|
7745
|
+
renderItemsHolder ? renderItemsHolder(itemsComponent) : itemsComponent,
|
|
7746
|
+
betweenItemsAdditionalComponent,
|
|
7747
|
+
readyBottomItems && /* @__PURE__ */ jsx27(Fragment8, { children: renderBottomItemsHolder ? renderBottomItemsHolder(bottomItemsComponent) : bottomItemsComponent })
|
|
7687
7748
|
] }) : /* @__PURE__ */ jsx27(Div_default, { flex: 1, children: /* @__PURE__ */ jsx27(Loader_default.box, { text: isCollapsed ? "" : void 0 }) }),
|
|
7688
|
-
|
|
7749
|
+
bottomItemsAdditionalComponent,
|
|
7689
7750
|
isCollapsable && /* @__PURE__ */ jsx27(
|
|
7690
7751
|
Div_default,
|
|
7691
7752
|
{
|
|
@@ -7873,6 +7934,7 @@ export {
|
|
|
7873
7934
|
Tooltip_default as Tooltip,
|
|
7874
7935
|
alertControls,
|
|
7875
7936
|
alertsPlugin,
|
|
7937
|
+
calculateColorContrast2 as calculateColorContrast,
|
|
7876
7938
|
colorThemeControls2 as colorThemeControls,
|
|
7877
7939
|
countries3 as countries,
|
|
7878
7940
|
darkenColor4 as darkenColor,
|