react-better-html 1.1.191 → 1.1.192
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +41 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +41 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -956,6 +956,8 @@ type SideMenuProps = {
|
|
|
956
956
|
collapsable?: boolean;
|
|
957
957
|
withCloseButton?: boolean;
|
|
958
958
|
widthMobileHandle?: boolean;
|
|
959
|
+
/** @default backgroundContent */
|
|
960
|
+
backgroundColor?: React.CSSProperties["backgroundColor"];
|
|
959
961
|
};
|
|
960
962
|
type SideMenuComponentType = {
|
|
961
963
|
(props: SideMenuProps): React.ReactElement;
|
package/dist/index.d.ts
CHANGED
|
@@ -956,6 +956,8 @@ type SideMenuProps = {
|
|
|
956
956
|
collapsable?: boolean;
|
|
957
957
|
withCloseButton?: boolean;
|
|
958
958
|
widthMobileHandle?: boolean;
|
|
959
|
+
/** @default backgroundContent */
|
|
960
|
+
backgroundColor?: React.CSSProperties["backgroundColor"];
|
|
959
961
|
};
|
|
960
962
|
type SideMenuComponentType = {
|
|
961
963
|
(props: SideMenuProps): React.ReactElement;
|
package/dist/index.js
CHANGED
|
@@ -9385,7 +9385,7 @@ var Foldable_default = Foldable2;
|
|
|
9385
9385
|
// src/components/SideMenu.tsx
|
|
9386
9386
|
var import_react29 = require("react");
|
|
9387
9387
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
9388
|
-
var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ item, onClick }) {
|
|
9388
|
+
var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ item, backgroundColor, onClick }) {
|
|
9389
9389
|
const reactRouterDomPlugin2 = usePlugin("react-router-dom");
|
|
9390
9390
|
if (!reactRouterDomPlugin2) {
|
|
9391
9391
|
throw new Error(
|
|
@@ -9405,6 +9405,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
|
|
|
9405
9405
|
}, [onClick, item]);
|
|
9406
9406
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
9407
9407
|
const isActive = item.href ? location.pathname === "/" ? location.pathname === item.href : location.pathname.startsWith(item.href) && item.href !== "/" : false;
|
|
9408
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
9408
9409
|
const iconSize = 16;
|
|
9409
9410
|
const paddingBlock = theme2.styles.gap;
|
|
9410
9411
|
const paddingLeft = theme2.styles.gap + 2;
|
|
@@ -9418,7 +9419,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
|
|
|
9418
9419
|
alignItems: "center",
|
|
9419
9420
|
gap: iconGap,
|
|
9420
9421
|
whiteSpace: "nowrap",
|
|
9421
|
-
backgroundColor: isActive ? colorTheme === "dark" ? lightenColor(theme2.colors.primary, 0.7) : lightenColor(theme2.colors.primary, 0.85) :
|
|
9422
|
+
backgroundColor: isActive ? colorTheme === "dark" ? lightenColor(theme2.colors.primary, 0.7) : lightenColor(theme2.colors.primary, 0.85) : readyBackgroundColor,
|
|
9422
9423
|
borderRadius: theme2.styles.borderRadius,
|
|
9423
9424
|
paddingBlock,
|
|
9424
9425
|
paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
|
|
@@ -9475,7 +9476,15 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
|
|
|
9475
9476
|
overflow: "hidden",
|
|
9476
9477
|
transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
|
|
9477
9478
|
children: [
|
|
9478
|
-
item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9479
|
+
item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9480
|
+
MenuItemComponent2,
|
|
9481
|
+
{
|
|
9482
|
+
item: child,
|
|
9483
|
+
backgroundColor: readyBackgroundColor,
|
|
9484
|
+
onClick
|
|
9485
|
+
},
|
|
9486
|
+
child.text
|
|
9487
|
+
)),
|
|
9479
9488
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
9480
9489
|
Div_default,
|
|
9481
9490
|
{
|
|
@@ -9505,9 +9514,9 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
|
|
|
9505
9514
|
left: 0,
|
|
9506
9515
|
border: `${lineWidth}px solid ${theme2.colors.border}`,
|
|
9507
9516
|
borderRadius: 999,
|
|
9508
|
-
borderTopColor:
|
|
9509
|
-
borderLeftColor:
|
|
9510
|
-
borderRightColor:
|
|
9517
|
+
borderTopColor: readyBackgroundColor,
|
|
9518
|
+
borderLeftColor: readyBackgroundColor,
|
|
9519
|
+
borderRightColor: readyBackgroundColor,
|
|
9511
9520
|
transform: "rotate(45deg)"
|
|
9512
9521
|
}
|
|
9513
9522
|
)
|
|
@@ -9529,7 +9538,8 @@ var SideMenuComponent = function SideMenu({
|
|
|
9529
9538
|
logoFontFamily,
|
|
9530
9539
|
collapsable,
|
|
9531
9540
|
withCloseButton,
|
|
9532
|
-
widthMobileHandle
|
|
9541
|
+
widthMobileHandle,
|
|
9542
|
+
backgroundColor
|
|
9533
9543
|
}) {
|
|
9534
9544
|
const theme2 = useTheme();
|
|
9535
9545
|
const mediaQuery = useMediaQuery();
|
|
@@ -9543,7 +9553,8 @@ var SideMenuComponent = function SideMenu({
|
|
|
9543
9553
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
9544
9554
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
9545
9555
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
9546
|
-
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 +
|
|
9556
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
9557
|
+
const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
|
|
9547
9558
|
const logoSize = sideMenuCollapsedWidth - theme2.styles.space * 2;
|
|
9548
9559
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
9549
9560
|
Div_default.column,
|
|
@@ -9553,7 +9564,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
9553
9564
|
height: `calc(100svh - ${topSpace}px)`,
|
|
9554
9565
|
top: topSpace,
|
|
9555
9566
|
left: 0,
|
|
9556
|
-
backgroundColor:
|
|
9567
|
+
backgroundColor: readyBackgroundColor,
|
|
9557
9568
|
borderRight: `solid 1px ${theme2.colors.border}`,
|
|
9558
9569
|
transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
|
|
9559
9570
|
paddingTop: logoAssetName || logoUrl ? theme2.styles.gap : theme2.styles.space,
|
|
@@ -9607,7 +9618,15 @@ var SideMenuComponent = function SideMenu({
|
|
|
9607
9618
|
overflowY: "auto",
|
|
9608
9619
|
paddingInline: theme2.styles.space,
|
|
9609
9620
|
paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
|
|
9610
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9621
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Div_default.column, { gap: theme2.styles.gap / 2, children: readyItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9622
|
+
MenuItemComponent,
|
|
9623
|
+
{
|
|
9624
|
+
item,
|
|
9625
|
+
backgroundColor: readyBackgroundColor,
|
|
9626
|
+
onClick: onClickXButton
|
|
9627
|
+
},
|
|
9628
|
+
item.text
|
|
9629
|
+
)) })
|
|
9611
9630
|
}
|
|
9612
9631
|
),
|
|
9613
9632
|
readyBottomItems && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -9619,7 +9638,15 @@ var SideMenuComponent = function SideMenu({
|
|
|
9619
9638
|
paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
|
|
9620
9639
|
paddingInline: theme2.styles.space,
|
|
9621
9640
|
paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
|
|
9622
|
-
children: readyBottomItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9641
|
+
children: readyBottomItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9642
|
+
MenuItemComponent,
|
|
9643
|
+
{
|
|
9644
|
+
item,
|
|
9645
|
+
backgroundColor: readyBackgroundColor,
|
|
9646
|
+
onClick: onClickXButton
|
|
9647
|
+
},
|
|
9648
|
+
item.text
|
|
9649
|
+
))
|
|
9623
9650
|
}
|
|
9624
9651
|
),
|
|
9625
9652
|
isCollapsable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -9634,7 +9661,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
9634
9661
|
{
|
|
9635
9662
|
alignItems: "center",
|
|
9636
9663
|
justifyContent: "center",
|
|
9637
|
-
backgroundColor:
|
|
9664
|
+
backgroundColor: readyBackgroundColor,
|
|
9638
9665
|
borderRadius: theme2.styles.borderRadius,
|
|
9639
9666
|
cursor: "pointer",
|
|
9640
9667
|
filterHover: filterHover().z1,
|
|
@@ -9662,7 +9689,7 @@ var SideMenuComponent = function SideMenu({
|
|
|
9662
9689
|
position: "absolute",
|
|
9663
9690
|
top: theme2.styles.space,
|
|
9664
9691
|
left: "100%",
|
|
9665
|
-
backgroundColor:
|
|
9692
|
+
backgroundColor: readyBackgroundColor,
|
|
9666
9693
|
border: `solid 1px ${theme2.colors.border}`,
|
|
9667
9694
|
borderLeft: "none",
|
|
9668
9695
|
borderTopRightRadius: theme2.styles.borderRadius,
|
|
@@ -9697,7 +9724,7 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
|
|
|
9697
9724
|
const mediaQuery = useMediaQuery();
|
|
9698
9725
|
const { components, sideMenuIsCollapsed } = useBetterHtmlContextInternal();
|
|
9699
9726
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
9700
|
-
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 +
|
|
9727
|
+
const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
|
|
9701
9728
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
9702
9729
|
Div_default,
|
|
9703
9730
|
{
|