react-better-html 1.1.237 → 1.1.239
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 +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +33 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -7
- 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,
|
|
@@ -3316,7 +3318,7 @@ PageHolderComponent.center = forwardRef8(function Center({
|
|
|
3316
3318
|
position: "relative",
|
|
3317
3319
|
width: "100%",
|
|
3318
3320
|
minHeight: "100svh",
|
|
3319
|
-
alignItems: "center",
|
|
3321
|
+
alignItems: height !== "100%" ? "center" : void 0,
|
|
3320
3322
|
justifyContent: "center",
|
|
3321
3323
|
backgroundColor: pageBackgroundColor,
|
|
3322
3324
|
backgroundImage: pageBackgroundImage,
|
|
@@ -3338,8 +3340,9 @@ PageHolderComponent.center = forwardRef8(function Center({
|
|
|
3338
3340
|
/* @__PURE__ */ jsx13(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ jsx13(
|
|
3339
3341
|
ContentTag,
|
|
3340
3342
|
{
|
|
3341
|
-
width: `calc(100% - ${theme2.styles.space * 2}px)`,
|
|
3343
|
+
width: `calc(100% - ${((props.margin ?? props.marginInline) !== void 0 ? parseFloat((props.margin ?? props.marginInline)?.toString() ?? "") : theme2.styles.space) * 2}px)`,
|
|
3342
3344
|
maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
|
|
3345
|
+
height,
|
|
3343
3346
|
marginInline: theme2.styles.space,
|
|
3344
3347
|
marginBlock: theme2.styles.space,
|
|
3345
3348
|
...props,
|
|
@@ -7348,6 +7351,7 @@ var Foldable_default = Foldable2;
|
|
|
7348
7351
|
// src/components/SideMenu.tsx
|
|
7349
7352
|
import { createContext as createContext2, memo as memo27, useCallback as useCallback18, useContext as useContext2, useEffect as useEffect16, useMemo as useMemo12, useState as useState15 } from "react";
|
|
7350
7353
|
import {
|
|
7354
|
+
calculateColorContrast,
|
|
7351
7355
|
lightenColor as lightenColor3,
|
|
7352
7356
|
useBetterCoreContext as useBetterCoreContext10,
|
|
7353
7357
|
useBooleanState as useBooleanState8,
|
|
@@ -7364,7 +7368,13 @@ var useSideMenuContext = () => {
|
|
|
7364
7368
|
}
|
|
7365
7369
|
return context;
|
|
7366
7370
|
};
|
|
7367
|
-
var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
7371
|
+
var MenuItemComponent = memo27(function MenuItemComponent2({
|
|
7372
|
+
item,
|
|
7373
|
+
backgroundColor,
|
|
7374
|
+
activeItemColor,
|
|
7375
|
+
hoverItemColor,
|
|
7376
|
+
onClick
|
|
7377
|
+
}) {
|
|
7368
7378
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
7369
7379
|
if (!reactRouterDomPlugin2) {
|
|
7370
7380
|
throw new Error(
|
|
@@ -7405,6 +7415,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7405
7415
|
const lineHeight = 20;
|
|
7406
7416
|
const lineWidth = 2;
|
|
7407
7417
|
const lineEndRadius = iconSize / 2 + iconGap * 2;
|
|
7418
|
+
const backgroundColorContrast = activeItemColor ? calculateColorContrast(activeItemColor, theme2.colors.primary) : 21;
|
|
7408
7419
|
const content = /* @__PURE__ */ jsx27(
|
|
7409
7420
|
Tooltip_default,
|
|
7410
7421
|
{
|
|
@@ -7423,24 +7434,33 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
|
|
|
7423
7434
|
alignItems: "center",
|
|
7424
7435
|
gap: iconGap,
|
|
7425
7436
|
whiteSpace: "nowrap",
|
|
7426
|
-
backgroundColor: isActive ? colorTheme === "dark" ? lightenColor3(theme2.colors.primary, 0.7) : lightenColor3(theme2.colors.primary, 0.85) : readyBackgroundColor,
|
|
7437
|
+
backgroundColor: isActive ? activeItemColor ?? (colorTheme === "dark" ? lightenColor3(theme2.colors.primary, 0.7) : lightenColor3(theme2.colors.primary, 0.85)) : readyBackgroundColor,
|
|
7438
|
+
backgroundColorHover: isActive && activeItemColor ? void 0 : hoverItemColor,
|
|
7427
7439
|
borderRadius: theme2.styles.borderRadius,
|
|
7428
7440
|
paddingBlock,
|
|
7429
7441
|
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
7430
7442
|
paddingRight: theme2.styles.space,
|
|
7431
|
-
filterHover: `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})
|
|
7443
|
+
filterHover: !hoverItemColor || isActive ? `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})` : void 0,
|
|
7432
7444
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
7433
7445
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
7434
7446
|
opacity: item.disabled ? 0.6 : void 0,
|
|
7435
7447
|
onClick: onClickElement,
|
|
7436
7448
|
children: [
|
|
7437
|
-
/* @__PURE__ */ jsx27(
|
|
7449
|
+
/* @__PURE__ */ jsx27(
|
|
7450
|
+
Icon_default,
|
|
7451
|
+
{
|
|
7452
|
+
name: item.iconName,
|
|
7453
|
+
color: isActive && backgroundColorContrast < 7 ? theme2.colors.base : theme2.colors.primary,
|
|
7454
|
+
size: iconSize,
|
|
7455
|
+
flexShrink: 0
|
|
7456
|
+
}
|
|
7457
|
+
),
|
|
7438
7458
|
/* @__PURE__ */ jsx27(
|
|
7439
7459
|
Text_default,
|
|
7440
7460
|
{
|
|
7441
7461
|
flex: 1,
|
|
7442
7462
|
lineHeight: `${lineHeight}px`,
|
|
7443
|
-
color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
|
|
7463
|
+
color: isActive ? backgroundColorContrast < 7 ? theme2.colors.base : theme2.colors.primary : theme2.colors.textPrimary,
|
|
7444
7464
|
opacity: isCollapsed ? 0 : void 0,
|
|
7445
7465
|
transition: theme2.styles.transition,
|
|
7446
7466
|
children: item.text
|
|
@@ -7580,6 +7600,8 @@ var SideMenuComponent = function SideMenu({
|
|
|
7580
7600
|
bottomItemsAdditionalComponent,
|
|
7581
7601
|
isLoading,
|
|
7582
7602
|
backgroundColor,
|
|
7603
|
+
activeItemColor,
|
|
7604
|
+
hoverItemColor,
|
|
7583
7605
|
gap,
|
|
7584
7606
|
paddingTop,
|
|
7585
7607
|
paddingBottom,
|
|
@@ -7622,6 +7644,8 @@ var SideMenuComponent = function SideMenu({
|
|
|
7622
7644
|
{
|
|
7623
7645
|
item,
|
|
7624
7646
|
backgroundColor: readyBackgroundColor,
|
|
7647
|
+
activeItemColor,
|
|
7648
|
+
hoverItemColor,
|
|
7625
7649
|
onClick: onClickXButton
|
|
7626
7650
|
},
|
|
7627
7651
|
item.text
|
|
@@ -7642,6 +7666,8 @@ var SideMenuComponent = function SideMenu({
|
|
|
7642
7666
|
{
|
|
7643
7667
|
item,
|
|
7644
7668
|
backgroundColor: readyBackgroundColor,
|
|
7669
|
+
activeItemColor,
|
|
7670
|
+
hoverItemColor,
|
|
7645
7671
|
onClick: onClickXButton
|
|
7646
7672
|
},
|
|
7647
7673
|
item.text
|
|
@@ -7898,6 +7924,7 @@ export {
|
|
|
7898
7924
|
Tooltip_default as Tooltip,
|
|
7899
7925
|
alertControls,
|
|
7900
7926
|
alertsPlugin,
|
|
7927
|
+
calculateColorContrast2 as calculateColorContrast,
|
|
7901
7928
|
colorThemeControls2 as colorThemeControls,
|
|
7902
7929
|
countries3 as countries,
|
|
7903
7930
|
darkenColor4 as darkenColor,
|