react-better-html 1.1.186 → 1.1.188
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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +55 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -935,13 +935,16 @@ type SideMenuItem = {
|
|
|
935
935
|
text: string;
|
|
936
936
|
iconName: IconName | AnyOtherString;
|
|
937
937
|
href?: string;
|
|
938
|
-
onClick?: (item: SideMenuItem) => void;
|
|
939
938
|
disabled?: boolean;
|
|
940
939
|
hidden?: boolean;
|
|
941
940
|
children?: SideMenuItem[];
|
|
941
|
+
/** @default true */
|
|
942
|
+
onClickCloseSideMenu?: boolean;
|
|
943
|
+
onClick?: (item: SideMenuItem) => void;
|
|
942
944
|
};
|
|
943
945
|
type SideMenuProps = {
|
|
944
946
|
items: SideMenuItem[];
|
|
947
|
+
bottomItems?: SideMenuItem[];
|
|
945
948
|
topSpace?: number;
|
|
946
949
|
logoAssetName?: AssetName | AnyOtherString;
|
|
947
950
|
logoUrl?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -935,13 +935,16 @@ type SideMenuItem = {
|
|
|
935
935
|
text: string;
|
|
936
936
|
iconName: IconName | AnyOtherString;
|
|
937
937
|
href?: string;
|
|
938
|
-
onClick?: (item: SideMenuItem) => void;
|
|
939
938
|
disabled?: boolean;
|
|
940
939
|
hidden?: boolean;
|
|
941
940
|
children?: SideMenuItem[];
|
|
941
|
+
/** @default true */
|
|
942
|
+
onClickCloseSideMenu?: boolean;
|
|
943
|
+
onClick?: (item: SideMenuItem) => void;
|
|
942
944
|
};
|
|
943
945
|
type SideMenuProps = {
|
|
944
946
|
items: SideMenuItem[];
|
|
947
|
+
bottomItems?: SideMenuItem[];
|
|
945
948
|
topSpace?: number;
|
|
946
949
|
logoAssetName?: AssetName | AnyOtherString;
|
|
947
950
|
logoUrl?: string;
|
package/dist/index.js
CHANGED
|
@@ -9391,7 +9391,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
|
|
|
9391
9391
|
const [isOpened, setIsOpened] = useBooleanState();
|
|
9392
9392
|
const onClickElement = (0, import_react29.useCallback)(() => {
|
|
9393
9393
|
if (item.disabled) return;
|
|
9394
|
-
onClick?.();
|
|
9394
|
+
if (item.onClickCloseSideMenu !== false) onClick?.();
|
|
9395
9395
|
item.onClick?.(item);
|
|
9396
9396
|
}, [onClick, item]);
|
|
9397
9397
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
@@ -9418,7 +9418,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
|
|
|
9418
9418
|
overflow: isCollapsed ? "hidden" : void 0,
|
|
9419
9419
|
cursor: item.disabled ? "not-allowed" : "pointer",
|
|
9420
9420
|
opacity: item.disabled ? 0.6 : void 0,
|
|
9421
|
-
onClick: item.children ? setIsOpened.toggle :
|
|
9421
|
+
onClick: item.children ? setIsOpened.toggle : onClickElement,
|
|
9422
9422
|
children: [
|
|
9423
9423
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Icon_default, { name: item.iconName, color: theme2.colors.primary, size: iconSize, flexShrink: 0 }),
|
|
9424
9424
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
@@ -9512,6 +9512,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
|
|
|
9512
9512
|
});
|
|
9513
9513
|
var SideMenuComponent = function SideMenu({
|
|
9514
9514
|
items,
|
|
9515
|
+
bottomItems,
|
|
9515
9516
|
topSpace = 0,
|
|
9516
9517
|
logoAssetName,
|
|
9517
9518
|
logoUrl,
|
|
@@ -9528,6 +9529,8 @@ var SideMenuComponent = function SideMenu({
|
|
|
9528
9529
|
setSideMenuIsOpenMobile.setFalse();
|
|
9529
9530
|
}, []);
|
|
9530
9531
|
const readyItems = (0, import_react29.useMemo)(() => items.filter((item) => !item.hidden), [items]);
|
|
9532
|
+
const readyBottomItems = (0, import_react29.useMemo)(() => bottomItems?.filter((item) => !item.hidden), [bottomItems]);
|
|
9533
|
+
const isCollapsable = collapsable && !mediaQuery.size1000;
|
|
9531
9534
|
const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
|
|
9532
9535
|
const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
|
|
9533
9536
|
const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
|
|
@@ -9544,15 +9547,13 @@ var SideMenuComponent = function SideMenu({
|
|
|
9544
9547
|
backgroundColor: theme2.colors.backgroundContent,
|
|
9545
9548
|
borderRight: `solid 1px ${theme2.colors.border}`,
|
|
9546
9549
|
transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
|
|
9547
|
-
paddingInline: theme2.styles.space,
|
|
9548
9550
|
paddingTop: logoAssetName || logoUrl ? theme2.styles.gap : theme2.styles.space,
|
|
9549
|
-
paddingBottom: theme2.styles.space,
|
|
9550
9551
|
transition: mediaQuery.size1000 ? !isCollapsed ? `transform ${theme2.styles.transition}` : "none" : theme2.styles.transition,
|
|
9551
9552
|
userSelect: "none",
|
|
9552
|
-
zIndex:
|
|
9553
|
+
zIndex: 10,
|
|
9553
9554
|
children: [
|
|
9554
9555
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.column, { width: "100%", height: "100%", gap: theme2.styles.space, children: [
|
|
9555
|
-
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { alignItems: "center", children: [
|
|
9556
|
+
(logoAssetName || logoUrl || withCloseButton && mediaQuery.size1000) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Div_default.row, { alignItems: "center", paddingInline: theme2.styles.space, children: [
|
|
9556
9557
|
(logoAssetName || logoUrl) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LinkComponentTag, { to: "/", href: "/", onClick: onClickXButton, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
9557
9558
|
Div_default.row,
|
|
9558
9559
|
{
|
|
@@ -9589,28 +9590,58 @@ var SideMenuComponent = function SideMenu({
|
|
|
9589
9590
|
) }),
|
|
9590
9591
|
withCloseButton && mediaQuery.size1000 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button_default.icon, { icon: "XMark", marginLeft: "auto", onClick: onClickXButton })
|
|
9591
9592
|
] }),
|
|
9592
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9593
|
-
|
|
9594
|
-
Div_default.row,
|
|
9593
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9594
|
+
Div_default.column,
|
|
9595
9595
|
{
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9596
|
+
width: "100%",
|
|
9597
|
+
height: "100%",
|
|
9598
|
+
overflowY: "auto",
|
|
9599
|
+
paddingInline: theme2.styles.space,
|
|
9600
|
+
paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
|
|
9601
|
+
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)(MenuItemComponent, { item, onClick: onClickXButton }, item.text)) })
|
|
9602
|
+
}
|
|
9603
|
+
),
|
|
9604
|
+
readyBottomItems && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9605
|
+
Div_default.column,
|
|
9606
|
+
{
|
|
9607
|
+
borderTop: `solid 1px ${theme2.colors.border}`,
|
|
9608
|
+
gap: theme2.styles.gap / 2,
|
|
9600
9609
|
marginTop: "auto",
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9610
|
+
paddingTop: theme2.styles.space,
|
|
9611
|
+
paddingInline: theme2.styles.space,
|
|
9612
|
+
paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
|
|
9613
|
+
children: readyBottomItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MenuItemComponent, { item, onClick: onClickXButton }, item.text))
|
|
9614
|
+
}
|
|
9615
|
+
),
|
|
9616
|
+
isCollapsable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9617
|
+
Div_default,
|
|
9618
|
+
{
|
|
9619
|
+
borderTop: `solid 1px ${theme2.colors.border}`,
|
|
9620
|
+
marginTop: !readyBottomItems ? "auto" : void 0,
|
|
9621
|
+
paddingInline: theme2.styles.space,
|
|
9622
|
+
paddingBlock: theme2.styles.space,
|
|
9606
9623
|
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9607
|
-
|
|
9624
|
+
Div_default.row,
|
|
9608
9625
|
{
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9626
|
+
alignItems: "center",
|
|
9627
|
+
justifyContent: "center",
|
|
9628
|
+
backgroundColor: theme2.colors.backgroundContent,
|
|
9629
|
+
borderRadius: theme2.styles.borderRadius,
|
|
9630
|
+
cursor: "pointer",
|
|
9631
|
+
filterHover: filterHover().z1,
|
|
9632
|
+
isTabAccessed: true,
|
|
9633
|
+
paddingBlock: theme2.styles.gap,
|
|
9634
|
+
onClick: setSideMenuIsCollapsed.toggle,
|
|
9635
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
9636
|
+
Icon_default,
|
|
9637
|
+
{
|
|
9638
|
+
name: "chevronRight",
|
|
9639
|
+
size: 20,
|
|
9640
|
+
color: theme2.colors.textSecondary,
|
|
9641
|
+
transform: `rotate(${isCollapsed ? 0 : 180}deg)`,
|
|
9642
|
+
transition: theme2.styles.transition
|
|
9643
|
+
}
|
|
9644
|
+
)
|
|
9614
9645
|
}
|
|
9615
9646
|
)
|
|
9616
9647
|
}
|