react-better-html 1.1.184 → 1.1.186

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
@@ -5509,6 +5509,10 @@ var sideMenuControls = {
5509
5509
  if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.collapse")) return;
5510
5510
  externalBetterHtmlContextValue.setSideMenuIsCollapsed.setTrue();
5511
5511
  },
5512
+ toggleExpanded: () => {
5513
+ if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.toggleExpanded")) return;
5514
+ externalBetterHtmlContextValue.setSideMenuIsCollapsed.toggle();
5515
+ },
5512
5516
  open: () => {
5513
5517
  if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.open")) return;
5514
5518
  externalBetterHtmlContextValue.setSideMenuIsOpenMobile.setTrue();
@@ -5516,6 +5520,10 @@ var sideMenuControls = {
5516
5520
  close: () => {
5517
5521
  if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.close")) return;
5518
5522
  externalBetterHtmlContextValue.setSideMenuIsOpenMobile.setFalse();
5523
+ },
5524
+ toggleOpened: () => {
5525
+ if (!checkBetterHtmlContextValue(externalBetterHtmlContextValue, "sideMenuControls.toggleOpened")) return;
5526
+ externalBetterHtmlContextValue.setSideMenuIsOpenMobile.toggle();
5519
5527
  }
5520
5528
  };
5521
5529
  var colorThemeControls = {
@@ -9315,7 +9323,7 @@ var MenuItemComponent = memo26(function MenuItemComponent2({ item, onClick }) {
9315
9323
  alignItems: "center",
9316
9324
  gap: iconGap,
9317
9325
  whiteSpace: "nowrap",
9318
- backgroundColor: isActive ? `${theme2.colors.primary}20` : theme2.colors.backgroundBase,
9326
+ backgroundColor: isActive ? colorTheme === "dark" ? lightenColor(theme2.colors.primary, 0.7) : lightenColor(theme2.colors.primary, 0.85) : theme2.colors.backgroundContent,
9319
9327
  borderRadius: theme2.styles.borderRadius,
9320
9328
  paddingBlock,
9321
9329
  paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
@@ -9402,9 +9410,9 @@ var MenuItemComponent = memo26(function MenuItemComponent2({ item, onClick }) {
9402
9410
  left: 0,
9403
9411
  border: `${lineWidth}px solid ${theme2.colors.border}`,
9404
9412
  borderRadius: 999,
9405
- borderTopColor: theme2.colors.backgroundBase,
9406
- borderLeftColor: theme2.colors.backgroundBase,
9407
- borderRightColor: theme2.colors.backgroundBase,
9413
+ borderTopColor: theme2.colors.backgroundContent,
9414
+ borderLeftColor: theme2.colors.backgroundContent,
9415
+ borderRightColor: theme2.colors.backgroundContent,
9408
9416
  transform: "rotate(45deg)"
9409
9417
  }
9410
9418
  )
@@ -9424,6 +9432,7 @@ var SideMenuComponent = function SideMenu({
9424
9432
  logoText,
9425
9433
  logoFontFamily,
9426
9434
  collapsable,
9435
+ withCloseButton,
9427
9436
  widthMobileHandle
9428
9437
  }) {
9429
9438
  const theme2 = useTheme();
@@ -9446,7 +9455,7 @@ var SideMenuComponent = function SideMenu({
9446
9455
  height: `calc(100svh - ${topSpace}px)`,
9447
9456
  top: topSpace,
9448
9457
  left: 0,
9449
- backgroundColor: theme2.colors.backgroundBase,
9458
+ backgroundColor: theme2.colors.backgroundContent,
9450
9459
  borderRight: `solid 1px ${theme2.colors.border}`,
9451
9460
  transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
9452
9461
  paddingInline: theme2.styles.space,
@@ -9457,7 +9466,7 @@ var SideMenuComponent = function SideMenu({
9457
9466
  zIndex: 11,
9458
9467
  children: [
9459
9468
  /* @__PURE__ */ jsxs22(Div_default.column, { width: "100%", height: "100%", gap: theme2.styles.space, children: [
9460
- (logoAssetName || logoUrl || mediaQuery.size1000) && /* @__PURE__ */ jsxs22(Div_default.row, { alignItems: "center", children: [
9469
+ (logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ jsxs22(Div_default.row, { alignItems: "center", children: [
9461
9470
  (logoAssetName || logoUrl) && /* @__PURE__ */ jsx26(LinkComponentTag, { to: "/", href: "/", onClick: onClickXButton, children: /* @__PURE__ */ jsxs22(
9462
9471
  Div_default.row,
9463
9472
  {
@@ -9492,7 +9501,7 @@ var SideMenuComponent = function SideMenu({
9492
9501
  ]
9493
9502
  }
9494
9503
  ) }),
9495
- mediaQuery.size1000 && /* @__PURE__ */ jsx26(Button_default.icon, { icon: "XMark", marginLeft: "auto", onClick: onClickXButton })
9504
+ withCloseButton && mediaQuery.size1000 && /* @__PURE__ */ jsx26(Button_default.icon, { icon: "XMark", marginLeft: "auto", onClick: onClickXButton })
9496
9505
  ] }),
9497
9506
  /* @__PURE__ */ jsx26(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ jsx26(MenuItemComponent, { item, onClick: onClickXButton }, item.text)) }),
9498
9507
  collapsable && !mediaQuery.size1000 && /* @__PURE__ */ jsx26(
@@ -9500,7 +9509,7 @@ var SideMenuComponent = function SideMenu({
9500
9509
  {
9501
9510
  alignItems: "center",
9502
9511
  justifyContent: "center",
9503
- backgroundColor: theme2.colors.backgroundBase,
9512
+ backgroundColor: theme2.colors.backgroundContent,
9504
9513
  borderRadius: theme2.styles.borderRadius,
9505
9514
  marginTop: "auto",
9506
9515
  cursor: "pointer",
@@ -9527,7 +9536,7 @@ var SideMenuComponent = function SideMenu({
9527
9536
  position: "absolute",
9528
9537
  top: theme2.styles.space,
9529
9538
  left: "100%",
9530
- backgroundColor: theme2.colors.backgroundBase,
9539
+ backgroundColor: theme2.colors.backgroundContent,
9531
9540
  border: `solid 1px ${theme2.colors.border}`,
9532
9541
  borderLeft: "none",
9533
9542
  borderTopRightRadius: theme2.styles.borderRadius,
@@ -9577,8 +9586,73 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
9577
9586
  }
9578
9587
  );
9579
9588
  };
9589
+ SideMenuComponent.burgerButton = function BurgerButton() {
9590
+ const theme2 = useTheme();
9591
+ const { sideMenuIsOpenMobile, setSideMenuIsOpenMobile } = useBetterHtmlContextInternal();
9592
+ const [isHovered, setIsHovered] = useBooleanState();
9593
+ const width = 2;
9594
+ return /* @__PURE__ */ jsxs22(
9595
+ Div_default,
9596
+ {
9597
+ position: "relative",
9598
+ width: 32,
9599
+ height: 20,
9600
+ cursor: "pointer",
9601
+ onMouseOver: setIsHovered.setTrue,
9602
+ onMouseLeave: setIsHovered.setFalse,
9603
+ onMouseOut: setIsHovered.setFalse,
9604
+ onClick: setSideMenuIsOpenMobile.toggle,
9605
+ children: [
9606
+ /* @__PURE__ */ jsx26(
9607
+ Div_default,
9608
+ {
9609
+ position: "absolute",
9610
+ width: isHovered || sideMenuIsOpenMobile ? "100%" : "50%",
9611
+ height: width,
9612
+ top: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
9613
+ left: 0,
9614
+ backgroundColor: theme2.colors.border,
9615
+ borderRadius: 999,
9616
+ transform: sideMenuIsOpenMobile ? "rotate(45deg)" : void 0,
9617
+ transition: theme2.styles.transition
9618
+ }
9619
+ ),
9620
+ /* @__PURE__ */ jsx26(
9621
+ Div_default,
9622
+ {
9623
+ position: "absolute",
9624
+ width: isHovered ? "100%" : "100%",
9625
+ height: width,
9626
+ top: "50%",
9627
+ left: 0,
9628
+ backgroundColor: theme2.colors.border,
9629
+ borderRadius: 999,
9630
+ transform: "translateY(-50%)",
9631
+ opacity: sideMenuIsOpenMobile ? 0 : void 0,
9632
+ transition: theme2.styles.transition
9633
+ }
9634
+ ),
9635
+ /* @__PURE__ */ jsx26(
9636
+ Div_default,
9637
+ {
9638
+ position: "absolute",
9639
+ width: isHovered || sideMenuIsOpenMobile ? "100%" : "75%",
9640
+ height: width,
9641
+ bottom: sideMenuIsOpenMobile ? `calc(50% - ${width / 2}px)` : 0,
9642
+ left: 0,
9643
+ backgroundColor: theme2.colors.border,
9644
+ borderRadius: 999,
9645
+ transform: sideMenuIsOpenMobile ? "rotate(-45deg)" : void 0,
9646
+ transition: theme2.styles.transition
9647
+ }
9648
+ )
9649
+ ]
9650
+ }
9651
+ );
9652
+ };
9580
9653
  var SideMenu2 = memo26(SideMenuComponent);
9581
9654
  SideMenu2.pageHolder = SideMenuComponent.pageHolder;
9655
+ SideMenu2.burgerButton = SideMenuComponent.burgerButton;
9582
9656
  var SideMenu_default = SideMenu2;
9583
9657
 
9584
9658
  // src/utils/localStorage.ts