react-better-html 1.1.184 → 1.1.185

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
@@ -953,6 +953,7 @@ type SideMenuProps = {
953
953
  type SideMenuComponentType = {
954
954
  (props: SideMenuProps): React.ReactElement;
955
955
  pageHolder: (props: SideMenuPageHolderProps) => React.ReactElement;
956
+ burgerButton: () => React.ReactElement;
956
957
  };
957
958
  declare const SideMenuComponent: SideMenuComponentType;
958
959
  type SideMenuPageHolderProps = PageHolderProps & {
@@ -960,6 +961,7 @@ type SideMenuPageHolderProps = PageHolderProps & {
960
961
  };
961
962
  declare const SideMenu: typeof SideMenuComponent & {
962
963
  pageHolder: typeof SideMenuComponent.pageHolder;
964
+ burgerButton: typeof SideMenuComponent.burgerButton;
963
965
  };
964
966
 
965
967
  type AppConfig = {
@@ -1059,8 +1061,10 @@ declare const alertControls: {
1059
1061
  declare const sideMenuControls: {
1060
1062
  expand: () => void;
1061
1063
  collapse: () => void;
1064
+ toggleExpanded: () => void;
1062
1065
  open: () => void;
1063
1066
  close: () => void;
1067
+ toggleOpened: () => void;
1064
1068
  };
1065
1069
  declare const colorThemeControls: {
1066
1070
  toggleTheme: (theme?: ColorTheme) => void;
package/dist/index.d.ts CHANGED
@@ -953,6 +953,7 @@ type SideMenuProps = {
953
953
  type SideMenuComponentType = {
954
954
  (props: SideMenuProps): React.ReactElement;
955
955
  pageHolder: (props: SideMenuPageHolderProps) => React.ReactElement;
956
+ burgerButton: () => React.ReactElement;
956
957
  };
957
958
  declare const SideMenuComponent: SideMenuComponentType;
958
959
  type SideMenuPageHolderProps = PageHolderProps & {
@@ -960,6 +961,7 @@ type SideMenuPageHolderProps = PageHolderProps & {
960
961
  };
961
962
  declare const SideMenu: typeof SideMenuComponent & {
962
963
  pageHolder: typeof SideMenuComponent.pageHolder;
964
+ burgerButton: typeof SideMenuComponent.burgerButton;
963
965
  };
964
966
 
965
967
  type AppConfig = {
@@ -1059,8 +1061,10 @@ declare const alertControls: {
1059
1061
  declare const sideMenuControls: {
1060
1062
  expand: () => void;
1061
1063
  collapse: () => void;
1064
+ toggleExpanded: () => void;
1062
1065
  open: () => void;
1063
1066
  close: () => void;
1067
+ toggleOpened: () => void;
1064
1068
  };
1065
1069
  declare const colorThemeControls: {
1066
1070
  toggleTheme: (theme?: ColorTheme) => void;
package/dist/index.js CHANGED
@@ -5605,6 +5605,10 @@ var sideMenuControls = {
5605
5605
  if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.collapse")) return;
5606
5606
  externalBetterHtmlContextValue.setSideMenuIsCollapsed.setTrue();
5607
5607
  },
5608
+ toggleExpanded: () => {
5609
+ if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.toggleExpanded")) return;
5610
+ externalBetterHtmlContextValue.setSideMenuIsCollapsed.toggle();
5611
+ },
5608
5612
  open: () => {
5609
5613
  if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.open")) return;
5610
5614
  externalBetterHtmlContextValue.setSideMenuIsOpenMobile.setTrue();
@@ -5612,6 +5616,10 @@ var sideMenuControls = {
5612
5616
  close: () => {
5613
5617
  if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.close")) return;
5614
5618
  externalBetterHtmlContextValue.setSideMenuIsOpenMobile.setFalse();
5619
+ },
5620
+ toggleOpened: () => {
5621
+ if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.toggleOpened")) return;
5622
+ externalBetterHtmlContextValue.setSideMenuIsOpenMobile.toggle();
5615
5623
  }
5616
5624
  };
5617
5625
  var colorThemeControls = {
@@ -9401,7 +9409,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
9401
9409
  alignItems: "center",
9402
9410
  gap: iconGap,
9403
9411
  whiteSpace: "nowrap",
9404
- backgroundColor: isActive ? `${theme2.colors.primary}20` : theme2.colors.backgroundBase,
9412
+ backgroundColor: isActive ? colorTheme === "dark" ? lightenColor(theme2.colors.primary, 0.7) : lightenColor(theme2.colors.primary, 0.85) : theme2.colors.backgroundContent,
9405
9413
  borderRadius: theme2.styles.borderRadius,
9406
9414
  paddingBlock,
9407
9415
  paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
@@ -9488,9 +9496,9 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
9488
9496
  left: 0,
9489
9497
  border: `${lineWidth}px solid ${theme2.colors.border}`,
9490
9498
  borderRadius: 999,
9491
- borderTopColor: theme2.colors.backgroundBase,
9492
- borderLeftColor: theme2.colors.backgroundBase,
9493
- borderRightColor: theme2.colors.backgroundBase,
9499
+ borderTopColor: theme2.colors.backgroundContent,
9500
+ borderLeftColor: theme2.colors.backgroundContent,
9501
+ borderRightColor: theme2.colors.backgroundContent,
9494
9502
  transform: "rotate(45deg)"
9495
9503
  }
9496
9504
  )
@@ -9532,7 +9540,7 @@ var SideMenuComponent = function SideMenu({
9532
9540
  height: `calc(100svh - ${topSpace}px)`,
9533
9541
  top: topSpace,
9534
9542
  left: 0,
9535
- backgroundColor: theme2.colors.backgroundBase,
9543
+ backgroundColor: theme2.colors.backgroundContent,
9536
9544
  borderRight: `solid 1px ${theme2.colors.border}`,
9537
9545
  transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
9538
9546
  paddingInline: theme2.styles.space,
@@ -9586,7 +9594,7 @@ var SideMenuComponent = function SideMenu({
9586
9594
  {
9587
9595
  alignItems: "center",
9588
9596
  justifyContent: "center",
9589
- backgroundColor: theme2.colors.backgroundBase,
9597
+ backgroundColor: theme2.colors.backgroundContent,
9590
9598
  borderRadius: theme2.styles.borderRadius,
9591
9599
  marginTop: "auto",
9592
9600
  cursor: "pointer",
@@ -9613,7 +9621,7 @@ var SideMenuComponent = function SideMenu({
9613
9621
  position: "absolute",
9614
9622
  top: theme2.styles.space,
9615
9623
  left: "100%",
9616
- backgroundColor: theme2.colors.backgroundBase,
9624
+ backgroundColor: theme2.colors.backgroundContent,
9617
9625
  border: `solid 1px ${theme2.colors.border}`,
9618
9626
  borderLeft: "none",
9619
9627
  borderTopRightRadius: theme2.styles.borderRadius,
@@ -9663,8 +9671,73 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
9663
9671
  }
9664
9672
  );
9665
9673
  };
9674
+ SideMenuComponent.burgerButton = function BurgerButton() {
9675
+ const theme2 = useTheme();
9676
+ const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
9677
+ const [isHovered, setIsHovered] = useBooleanState();
9678
+ const width = 2;
9679
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
9680
+ Div_default,
9681
+ {
9682
+ position: "relative",
9683
+ width: 32,
9684
+ height: 20,
9685
+ cursor: "pointer",
9686
+ onMouseOver: setIsHovered.setTrue,
9687
+ onMouseLeave: setIsHovered.setFalse,
9688
+ onMouseOut: setIsHovered.setFalse,
9689
+ onClick: setSideMenuIsOpenMobile.toggle,
9690
+ children: [
9691
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9692
+ Div_default,
9693
+ {
9694
+ position: "absolute",
9695
+ width: isHovered || sideMenuIsOpenMobile ? "100%" : "50%",
9696
+ height: width,
9697
+ top: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
9698
+ left: 0,
9699
+ backgroundColor: theme2.colors.border,
9700
+ borderRadius: 999,
9701
+ transform: sideMenuIsOpenMobile ? "rotate(45deg)" : void 0,
9702
+ transition: theme2.styles.transition
9703
+ }
9704
+ ),
9705
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9706
+ Div_default,
9707
+ {
9708
+ position: "absolute",
9709
+ width: isHovered ? "100%" : "100%",
9710
+ height: width,
9711
+ top: "50%",
9712
+ left: 0,
9713
+ backgroundColor: theme2.colors.border,
9714
+ borderRadius: 999,
9715
+ transform: "translateY(-50%)",
9716
+ opacity: sideMenuIsOpenMobile ? 0 : void 0,
9717
+ transition: theme2.styles.transition
9718
+ }
9719
+ ),
9720
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9721
+ Div_default,
9722
+ {
9723
+ position: "absolute",
9724
+ width: isHovered || sideMenuIsOpenMobile ? "100%" : "75%",
9725
+ height: width,
9726
+ bottom: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
9727
+ left: 0,
9728
+ backgroundColor: theme2.colors.border,
9729
+ borderRadius: 999,
9730
+ transform: sideMenuIsOpenMobile ? "rotate(-45deg)" : void 0,
9731
+ transition: theme2.styles.transition
9732
+ }
9733
+ )
9734
+ ]
9735
+ }
9736
+ );
9737
+ };
9666
9738
  var SideMenu2 = (0, import_react29.memo)(SideMenuComponent);
9667
9739
  SideMenu2.pageHolder = SideMenuComponent.pageHolder;
9740
+ SideMenu2.burgerButton = SideMenuComponent.burgerButton;
9668
9741
  var SideMenu_default = SideMenu2;
9669
9742
 
9670
9743
  // src/utils/localStorage.ts