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.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Color, BetterCoreProviderConfig, DeepPartialRecord, OmitProps, BetterCoreConfig, IconName, AnyOtherString, PartialRecord, AssetName, LoaderName, PickValue, Country } from 'react-better-core';
2
- export { API, APIConfigItem, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
2
+ export { API, APIConfigItem, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, calculateColorContrast, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
3
3
  import * as react from 'react';
4
4
  import { ComponentProps, ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -582,6 +582,7 @@ type PageHolderProps = {
582
582
  type PageHolderComponentType = {
583
583
  (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps>): React.ReactElement;
584
584
  center: (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps & {
585
+ height?: React.CSSProperties["height"];
585
586
  pageBackgroundColor?: React.CSSProperties["backgroundColor"];
586
587
  pageBackgroundImage?: React.CSSProperties["backgroundImage"];
587
588
  contentMaxWidth?: React.CSSProperties["maxWidth"];
@@ -591,7 +592,7 @@ type PageHolderComponentType = {
591
592
  sideComponent?: React.ReactNode;
592
593
  /** @default "right" */
593
594
  sideComponentPosition?: "left" | "right";
594
- }>) => React.ReactElement;
595
+ } & ComponentMarginProps>) => React.ReactElement;
595
596
  };
596
597
  declare const PageHolderComponent: PageHolderComponentType;
597
598
  declare const PageHolder: typeof PageHolderComponent & {
@@ -1036,6 +1037,9 @@ type SideMenuProps = {
1036
1037
  isLoading?: boolean;
1037
1038
  /** @default backgroundContent */
1038
1039
  backgroundColor?: React.CSSProperties["backgroundColor"];
1040
+ /** @default primary */
1041
+ activeItemColor?: string;
1042
+ hoverItemColor?: string;
1039
1043
  gap?: React.CSSProperties["gap"];
1040
1044
  paddingTop?: React.CSSProperties["paddingTop"];
1041
1045
  paddingBottom?: React.CSSProperties["paddingBottom"];
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Color, BetterCoreProviderConfig, DeepPartialRecord, OmitProps, BetterCoreConfig, IconName, AnyOtherString, PartialRecord, AssetName, LoaderName, PickValue, Country } from 'react-better-core';
2
- export { API, APIConfigItem, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
2
+ export { API, APIConfigItem, APIError, APIResponse, AnyOtherString, AssetName, AssetsConfig, Color, ColorName, ColorTheme, Colors, Country, DeepPartialRecord, ExcludeOptions, HttpHeaders as HttpHeader, HttpMethod, IconName, IconsConfig, LoaderConfig, LoaderName, OmitProps, PartialRecord, PickAllRequired, PickValue, Styles, Theme, ThemeConfig, Unsubscribe, UrlQuery, calculateColorContrast, colorThemeControls, countries, darkenColor, desaturateColor, eventPreventDefault, eventPreventStop, eventStopPropagation, formatPhoneNumber, generateApi, generateEventEmitter, generateRandomString, getPluralWord, isApiError, lightenColor, loaderControls, log, saturateColor, useBooleanState, useDebounceState, useLoader, useLoaderControls, useTheme } from 'react-better-core';
3
3
  import * as react from 'react';
4
4
  import { ComponentProps, ReactNode } from 'react';
5
5
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -582,6 +582,7 @@ type PageHolderProps = {
582
582
  type PageHolderComponentType = {
583
583
  (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps>): React.ReactElement;
584
584
  center: (props: ComponentPropWithRef<HTMLDivElement, PageHolderProps & {
585
+ height?: React.CSSProperties["height"];
585
586
  pageBackgroundColor?: React.CSSProperties["backgroundColor"];
586
587
  pageBackgroundImage?: React.CSSProperties["backgroundImage"];
587
588
  contentMaxWidth?: React.CSSProperties["maxWidth"];
@@ -591,7 +592,7 @@ type PageHolderComponentType = {
591
592
  sideComponent?: React.ReactNode;
592
593
  /** @default "right" */
593
594
  sideComponentPosition?: "left" | "right";
594
- }>) => React.ReactElement;
595
+ } & ComponentMarginProps>) => React.ReactElement;
595
596
  };
596
597
  declare const PageHolderComponent: PageHolderComponentType;
597
598
  declare const PageHolder: typeof PageHolderComponent & {
@@ -1036,6 +1037,9 @@ type SideMenuProps = {
1036
1037
  isLoading?: boolean;
1037
1038
  /** @default backgroundContent */
1038
1039
  backgroundColor?: React.CSSProperties["backgroundColor"];
1040
+ /** @default primary */
1041
+ activeItemColor?: string;
1042
+ hoverItemColor?: string;
1039
1043
  gap?: React.CSSProperties["gap"];
1040
1044
  paddingTop?: React.CSSProperties["paddingTop"];
1041
1045
  paddingBottom?: React.CSSProperties["paddingBottom"];
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ __export(index_exports, {
57
57
  Tooltip: () => Tooltip_default,
58
58
  alertControls: () => alertControls,
59
59
  alertsPlugin: () => alertsPlugin,
60
+ calculateColorContrast: () => import_react_better_core30.calculateColorContrast,
60
61
  colorThemeControls: () => import_react_better_core30.colorThemeControls,
61
62
  countries: () => import_react_better_core30.countries,
62
63
  darkenColor: () => import_react_better_core30.darkenColor,
@@ -3356,6 +3357,7 @@ var PageHolderComponent = (0, import_react15.forwardRef)(function PageHolder({ n
3356
3357
  );
3357
3358
  });
3358
3359
  PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
3360
+ height,
3359
3361
  pageBackgroundColor,
3360
3362
  pageBackgroundImage,
3361
3363
  contentMaxWidth,
@@ -3398,18 +3400,29 @@ PageHolderComponent.center = (0, import_react15.forwardRef)(function Center({
3398
3400
  }
3399
3401
  ),
3400
3402
  sideComponentPosition === "left" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Div_default, { width: "50%" }),
3401
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Div_default.column, { position: "relative", width: `${withSideComponent ? 50 : 100}%`, alignItems: "center", zIndex: 2, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3402
- ContentTag,
3403
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3404
+ Div_default.column,
3403
3405
  {
3404
- width: `calc(100% - ${theme2.styles.space * 2}px)`,
3405
- maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
3406
- marginInline: theme2.styles.space,
3407
- marginBlock: theme2.styles.space,
3408
- ...props,
3409
- ref,
3410
- children
3406
+ position: "relative",
3407
+ width: `${withSideComponent ? 50 : 100}%`,
3408
+ height,
3409
+ alignItems: "center",
3410
+ zIndex: 2,
3411
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3412
+ ContentTag,
3413
+ {
3414
+ width: `calc(100% - ${theme2.styles.space * 2}px)`,
3415
+ maxWidth: !noMaxContentWidth ? contentMaxWidth ?? app.contentMaxWidth / 2 : void 0,
3416
+ height,
3417
+ marginInline: theme2.styles.space,
3418
+ marginBlock: theme2.styles.space,
3419
+ ...props,
3420
+ ref,
3421
+ children
3422
+ }
3423
+ )
3411
3424
  }
3412
- ) }),
3425
+ ),
3413
3426
  sideComponentPosition === "right" && withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Div_default, { width: "50%" }),
3414
3427
  withSideComponent && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
3415
3428
  Div_default,
@@ -7398,7 +7411,13 @@ var useSideMenuContext = () => {
7398
7411
  }
7399
7412
  return context;
7400
7413
  };
7401
- var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ item, backgroundColor, onClick }) {
7414
+ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
7415
+ item,
7416
+ backgroundColor,
7417
+ activeItemColor,
7418
+ hoverItemColor,
7419
+ onClick
7420
+ }) {
7402
7421
  const reactRouterDomPlugin2 = usePlugin("react-router-dom");
7403
7422
  if (!reactRouterDomPlugin2) {
7404
7423
  throw new Error(
@@ -7439,6 +7458,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
7439
7458
  const lineHeight = 20;
7440
7459
  const lineWidth = 2;
7441
7460
  const lineEndRadius = iconSize / 2 + iconGap * 2;
7461
+ const backgroundColorContrast = activeItemColor ? (0, import_react_better_core29.calculateColorContrast)(activeItemColor, theme2.colors.primary) : 21;
7442
7462
  const content = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7443
7463
  Tooltip_default,
7444
7464
  {
@@ -7457,24 +7477,33 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ i
7457
7477
  alignItems: "center",
7458
7478
  gap: iconGap,
7459
7479
  whiteSpace: "nowrap",
7460
- backgroundColor: isActive ? colorTheme === "dark" ? (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.7) : (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.85) : readyBackgroundColor,
7480
+ backgroundColor: isActive ? activeItemColor ?? (colorTheme === "dark" ? (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.7) : (0, import_react_better_core29.lightenColor)(theme2.colors.primary, 0.85)) : readyBackgroundColor,
7481
+ backgroundColorHover: hoverItemColor,
7461
7482
  borderRadius: theme2.styles.borderRadius,
7462
7483
  paddingBlock,
7463
7484
  paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
7464
7485
  paddingRight: theme2.styles.space,
7465
- filterHover: `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})`,
7486
+ filterHover: !hoverItemColor ? `brightness(${colorTheme === "dark" ? isActive ? 0.8 : 1.3 : isActive ? 0.8 : 0.95})` : void 0,
7466
7487
  overflow: isCollapsed ? "hidden" : void 0,
7467
7488
  cursor: item.disabled ? "not-allowed" : "pointer",
7468
7489
  opacity: item.disabled ? 0.6 : void 0,
7469
7490
  onClick: onClickElement,
7470
7491
  children: [
7471
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon_default, { name: item.iconName, color: theme2.colors.primary, size: iconSize, flexShrink: 0 }),
7492
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7493
+ Icon_default,
7494
+ {
7495
+ name: item.iconName,
7496
+ color: isActive && backgroundColorContrast < 7 ? theme2.colors.base : theme2.colors.primary,
7497
+ size: iconSize,
7498
+ flexShrink: 0
7499
+ }
7500
+ ),
7472
7501
  /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
7473
7502
  Text_default,
7474
7503
  {
7475
7504
  flex: 1,
7476
7505
  lineHeight: `${lineHeight}px`,
7477
- color: isActive ? theme2.colors.primary : theme2.colors.textPrimary,
7506
+ color: isActive ? backgroundColorContrast < 7 ? theme2.colors.base : theme2.colors.primary : theme2.colors.textPrimary,
7478
7507
  opacity: isCollapsed ? 0 : void 0,
7479
7508
  transition: theme2.styles.transition,
7480
7509
  children: item.text
@@ -7614,6 +7643,8 @@ var SideMenuComponent = function SideMenu({
7614
7643
  bottomItemsAdditionalComponent,
7615
7644
  isLoading,
7616
7645
  backgroundColor,
7646
+ activeItemColor,
7647
+ hoverItemColor,
7617
7648
  gap,
7618
7649
  paddingTop,
7619
7650
  paddingBottom,
@@ -7656,6 +7687,8 @@ var SideMenuComponent = function SideMenu({
7656
7687
  {
7657
7688
  item,
7658
7689
  backgroundColor: readyBackgroundColor,
7690
+ activeItemColor,
7691
+ hoverItemColor,
7659
7692
  onClick: onClickXButton
7660
7693
  },
7661
7694
  item.text
@@ -7676,6 +7709,8 @@ var SideMenuComponent = function SideMenu({
7676
7709
  {
7677
7710
  item,
7678
7711
  backgroundColor: readyBackgroundColor,
7712
+ activeItemColor,
7713
+ hoverItemColor,
7679
7714
  onClick: onClickXButton
7680
7715
  },
7681
7716
  item.text
@@ -7933,6 +7968,7 @@ var SideMenu_default = SideMenu2;
7933
7968
  Tooltip,
7934
7969
  alertControls,
7935
7970
  alertsPlugin,
7971
+ calculateColorContrast,
7936
7972
  colorThemeControls,
7937
7973
  countries,
7938
7974
  darkenColor,