react-better-html 1.1.268 → 1.1.269

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
@@ -164,7 +164,7 @@ declare const InputField: typeof InputFieldComponent & {
164
164
  color: typeof InputFieldComponent.color;
165
165
  };
166
166
 
167
- type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label";
167
+ type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label" | "li";
168
168
  type TextProps<As extends TextAs = "p"> = {
169
169
  /** @default "p" */
170
170
  as?: As;
@@ -1076,16 +1076,20 @@ declare const Foldable: typeof FoldableComponent & {
1076
1076
 
1077
1077
  type SideMenuItem = {
1078
1078
  text: string;
1079
+ hidden?: boolean;
1080
+ } & ({
1081
+ type: "item";
1079
1082
  iconName: IconName | AnyOtherString;
1080
1083
  href?: string;
1081
1084
  disabled?: boolean;
1082
- hidden?: boolean;
1083
1085
  withDot?: boolean;
1084
1086
  children?: SideMenuItem[];
1085
1087
  /** @default true */
1086
1088
  onClickCloseSideMenu?: boolean;
1087
1089
  onClick?: (item: SideMenuItem) => void;
1088
- };
1090
+ } | {
1091
+ type: "divider";
1092
+ });
1089
1093
  type SideMenuProps = {
1090
1094
  items: SideMenuItem[];
1091
1095
  bottomItems?: SideMenuItem[];
package/dist/index.d.ts CHANGED
@@ -164,7 +164,7 @@ declare const InputField: typeof InputFieldComponent & {
164
164
  color: typeof InputFieldComponent.color;
165
165
  };
166
166
 
167
- type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label";
167
+ type TextAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "p" | "span" | "label" | "li";
168
168
  type TextProps<As extends TextAs = "p"> = {
169
169
  /** @default "p" */
170
170
  as?: As;
@@ -1076,16 +1076,20 @@ declare const Foldable: typeof FoldableComponent & {
1076
1076
 
1077
1077
  type SideMenuItem = {
1078
1078
  text: string;
1079
+ hidden?: boolean;
1080
+ } & ({
1081
+ type: "item";
1079
1082
  iconName: IconName | AnyOtherString;
1080
1083
  href?: string;
1081
1084
  disabled?: boolean;
1082
- hidden?: boolean;
1083
1085
  withDot?: boolean;
1084
1086
  children?: SideMenuItem[];
1085
1087
  /** @default true */
1086
1088
  onClickCloseSideMenu?: boolean;
1087
1089
  onClick?: (item: SideMenuItem) => void;
1088
- };
1090
+ } | {
1091
+ type: "divider";
1092
+ });
1089
1093
  type SideMenuProps = {
1090
1094
  items: SideMenuItem[];
1091
1095
  bottomItems?: SideMenuItem[];
package/dist/index.js CHANGED
@@ -7877,7 +7877,7 @@ var useSideMenuContext = () => {
7877
7877
  }
7878
7878
  return context;
7879
7879
  };
7880
- var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
7880
+ var MenuItemTypeItem = (0, import_react31.memo)(function MenuItemTypeItem2({
7881
7881
  item,
7882
7882
  backgroundColor,
7883
7883
  activeItemColor,
@@ -7905,8 +7905,8 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
7905
7905
  }
7906
7906
  }, [onClick, item, isCollapsed]);
7907
7907
  const childrenHaveDot = (0, import_react31.useMemo)(
7908
- () => item.children?.some((child) => child.withDot) ?? false,
7909
- [item.children]
7908
+ () => item.children?.some((child) => child.type === "item" && child.withDot) ?? false,
7909
+ [item]
7910
7910
  );
7911
7911
  const isActive = activeItem && item.href && activeItem.href === item.href;
7912
7912
  const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
@@ -8011,7 +8011,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
8011
8011
  (0, import_react31.useEffect)(() => {
8012
8012
  if (!item.children) return;
8013
8013
  const toBeOpened = item.children.some(
8014
- (child) => child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false
8014
+ (child) => child.type === "item" ? child.href ? location.pathname === "/" ? location.pathname === child.href : location.pathname.startsWith(child.href) && child.href !== "/" : false : false
8015
8015
  );
8016
8016
  if (!isCollapsed) setIsOpened.setState(toBeOpened);
8017
8017
  }, [item, isCollapsed]);
@@ -8020,7 +8020,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
8020
8020
  setIsOpened.setFalse();
8021
8021
  }, [isCollapsed]);
8022
8022
  const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
8023
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Div_default, { width: "100%", children: [
8023
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
8024
8024
  item.href ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LinkComponentTag, { to: item.href, href: item.href, onClick: onClickElement, children: content }) : content,
8025
8025
  item.children && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
8026
8026
  Div_default.column,
@@ -8034,7 +8034,7 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
8034
8034
  transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
8035
8035
  children: [
8036
8036
  item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
8037
- MenuItemComponent2,
8037
+ MenuItemComponent,
8038
8038
  {
8039
8039
  item: child,
8040
8040
  backgroundColor: readyBackgroundColor,
@@ -8086,6 +8086,13 @@ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({
8086
8086
  )
8087
8087
  ] });
8088
8088
  });
8089
+ var MenuItemTypeDivider = (0, import_react31.memo)(function MenuItemTypeDivider2({ item }) {
8090
+ const theme2 = (0, import_react_better_core29.useTheme)();
8091
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default.row, { paddingTop: theme2.styles.space, paddingInline: theme2.styles.gap, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text_default, { fontSize: 12, fontWeight: 700, textTransform: "uppercase", color: theme2.colors.textSecondary, children: item.text }) });
8092
+ });
8093
+ var MenuItemComponent = (0, import_react31.memo)(function MenuItemComponent2({ item, ...props }) {
8094
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Div_default, { width: "100%", children: item.type === "item" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MenuItemTypeItem, { item, ...props }) : item.type === "divider" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(MenuItemTypeDivider, { item }) : void 0 });
8095
+ });
8089
8096
  var SideMenuComponent = function SideMenu({
8090
8097
  items,
8091
8098
  bottomItems,