react-better-html 1.1.237 → 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.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(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ jsx13(
3339
- ContentTag,
3340
+ /* @__PURE__ */ jsx13(
3341
+ Div_default.column,
3340
3342
  {
3341
- width: `calc(100% - ${theme2.styles.space * 2}px)`,
3342
- maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
3343
- marginInline: theme2.styles.space,
3344
- marginBlock: theme2.styles.space,
3345
- ...props,
3346
- ref,
3347
- children
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,
@@ -7348,6 +7361,7 @@ var Foldable_default = Foldable2;
7348
7361
  // src/components/SideMenu.tsx
7349
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";
7350
7363
  import {
7364
+ calculateColorContrast,
7351
7365
  lightenColor as lightenColor3,
7352
7366
  useBetterCoreContext as useBetterCoreContext10,
7353
7367
  useBooleanState as useBooleanState8,
@@ -7364,7 +7378,13 @@ var useSideMenuContext = () => {
7364
7378
  }
7365
7379
  return context;
7366
7380
  };
7367
- var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundColor, onClick }) {
7381
+ var MenuItemComponent = memo27(function MenuItemComponent2({
7382
+ item,
7383
+ backgroundColor,
7384
+ activeItemColor,
7385
+ hoverItemColor,
7386
+ onClick
7387
+ }) {
7368
7388
  const reactRouterDomPlugin2 = usePlugin("react-router-dom");
7369
7389
  if (!reactRouterDomPlugin2) {
7370
7390
  throw new Error(
@@ -7405,6 +7425,7 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
7405
7425
  const lineHeight = 20;
7406
7426
  const lineWidth = 2;
7407
7427
  const lineEndRadius = iconSize / 2 + iconGap * 2;
7428
+ const backgroundColorContrast = activeItemColor ? calculateColorContrast(activeItemColor, theme2.colors.primary) : 21;
7408
7429
  const content = /* @__PURE__ */ jsx27(
7409
7430
  Tooltip_default,
7410
7431
  {
@@ -7423,24 +7444,33 @@ var MenuItemComponent = memo27(function MenuItemComponent2({ item, backgroundCol
7423
7444
  alignItems: "center",
7424
7445
  gap: iconGap,
7425
7446
  whiteSpace: "nowrap",
7426
- 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,
7427
7449
  borderRadius: theme2.styles.borderRadius,
7428
7450
  paddingBlock,
7429
7451
  paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
7430
7452
  paddingRight: theme2.styles.space,
7431
- 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,
7432
7454
  overflow: isCollapsed ? "hidden" : void 0,
7433
7455
  cursor: item.disabled ? "not-allowed" : "pointer",
7434
7456
  opacity: item.disabled ? 0.6 : void 0,
7435
7457
  onClick: onClickElement,
7436
7458
  children: [
7437
- /* @__PURE__ */ jsx27(Icon_default, { name: item.iconName, color: theme2.colors.primary, size: iconSize, flexShrink: 0 }),
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
+ ),
7438
7468
  /* @__PURE__ */ jsx27(
7439
7469
  Text_default,
7440
7470
  {
7441
7471
  flex: 1,
7442
7472
  lineHeight: `${lineHeight}px`,
7443
- color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
7473
+ color: isActive ? backgroundColorContrast < 7 ? theme2.colors.base : theme2.colors.primary : theme2.colors.textPrimary,
7444
7474
  opacity: isCollapsed ? 0 : void 0,
7445
7475
  transition: theme2.styles.transition,
7446
7476
  children: item.text
@@ -7580,6 +7610,8 @@ var SideMenuComponent = function SideMenu({
7580
7610
  bottomItemsAdditionalComponent,
7581
7611
  isLoading,
7582
7612
  backgroundColor,
7613
+ activeItemColor,
7614
+ hoverItemColor,
7583
7615
  gap,
7584
7616
  paddingTop,
7585
7617
  paddingBottom,
@@ -7622,6 +7654,8 @@ var SideMenuComponent = function SideMenu({
7622
7654
  {
7623
7655
  item,
7624
7656
  backgroundColor: readyBackgroundColor,
7657
+ activeItemColor,
7658
+ hoverItemColor,
7625
7659
  onClick: onClickXButton
7626
7660
  },
7627
7661
  item.text
@@ -7642,6 +7676,8 @@ var SideMenuComponent = function SideMenu({
7642
7676
  {
7643
7677
  item,
7644
7678
  backgroundColor: readyBackgroundColor,
7679
+ activeItemColor,
7680
+ hoverItemColor,
7645
7681
  onClick: onClickXButton
7646
7682
  },
7647
7683
  item.text
@@ -7898,6 +7934,7 @@ export {
7898
7934
  Tooltip_default as Tooltip,
7899
7935
  alertControls,
7900
7936
  alertsPlugin,
7937
+ calculateColorContrast2 as calculateColorContrast,
7901
7938
  colorThemeControls2 as colorThemeControls,
7902
7939
  countries3 as countries,
7903
7940
  darkenColor4 as darkenColor,