react-better-html 1.1.190 → 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 CHANGED
@@ -672,6 +672,7 @@ type FormRowComponentType = {
672
672
  titleFontSize?: React.CSSProperties["fontSize"];
673
673
  description?: string;
674
674
  descriptionFontSize?: React.CSSProperties["fontSize"];
675
+ required?: boolean;
675
676
  alignChildren?: React.CSSProperties["justifyContent"];
676
677
  isLoading?: boolean;
677
678
  withActions?: boolean;
@@ -955,6 +956,8 @@ type SideMenuProps = {
955
956
  collapsable?: boolean;
956
957
  withCloseButton?: boolean;
957
958
  widthMobileHandle?: boolean;
959
+ /** @default backgroundContent */
960
+ backgroundColor?: React.CSSProperties["backgroundColor"];
958
961
  };
959
962
  type SideMenuComponentType = {
960
963
  (props: SideMenuProps): React.ReactElement;
package/dist/index.d.ts CHANGED
@@ -672,6 +672,7 @@ type FormRowComponentType = {
672
672
  titleFontSize?: React.CSSProperties["fontSize"];
673
673
  description?: string;
674
674
  descriptionFontSize?: React.CSSProperties["fontSize"];
675
+ required?: boolean;
675
676
  alignChildren?: React.CSSProperties["justifyContent"];
676
677
  isLoading?: boolean;
677
678
  withActions?: boolean;
@@ -955,6 +956,8 @@ type SideMenuProps = {
955
956
  collapsable?: boolean;
956
957
  withCloseButton?: boolean;
957
958
  widthMobileHandle?: boolean;
959
+ /** @default backgroundContent */
960
+ backgroundColor?: React.CSSProperties["backgroundColor"];
958
961
  };
959
962
  type SideMenuComponentType = {
960
963
  (props: SideMenuProps): React.ReactElement;
package/dist/index.js CHANGED
@@ -7680,6 +7680,7 @@ FormRowComponent.withTitle = (0, import_react23.forwardRef)(function WithTitle({
7680
7680
  titleFontSize,
7681
7681
  description,
7682
7682
  descriptionFontSize,
7683
+ required,
7683
7684
  alignChildren = "flex-start",
7684
7685
  isLoading,
7685
7686
  withActions,
@@ -7697,7 +7698,13 @@ FormRowComponent.withTitle = (0, import_react23.forwardRef)(function WithTitle({
7697
7698
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: titleGap, children: [
7698
7699
  icon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon_default, { name: icon }),
7699
7700
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { flex: 1, gap: theme2.styles.gap / 2, children: [
7700
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { as: titleAs, fontSize: titleFontSize, children: title }),
7701
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: titleAs, fontSize: titleFontSize, children: [
7702
+ title,
7703
+ required && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { as: "span", fontSize: 16, color: theme2.colors.error, children: [
7704
+ " ",
7705
+ "*"
7706
+ ] })
7707
+ ] }),
7701
7708
  description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { fontSize: descriptionFontSize, color: theme2.colors.textSecondary, children: description })
7702
7709
  ] }),
7703
7710
  isLoading && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default, { width: 26 - titleGap })
@@ -9378,7 +9385,7 @@ var Foldable_default = Foldable2;
9378
9385
  // src/components/SideMenu.tsx
9379
9386
  var import_react29 = require("react");
9380
9387
  var import_jsx_runtime27 = require("react/jsx-runtime");
9381
- var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ item, onClick }) {
9388
+ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ item, backgroundColor, onClick }) {
9382
9389
  const reactRouterDomPlugin2 = usePlugin("react-router-dom");
9383
9390
  if (!reactRouterDomPlugin2) {
9384
9391
  throw new Error(
@@ -9398,6 +9405,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
9398
9405
  }, [onClick, item]);
9399
9406
  const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
9400
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;
9401
9409
  const iconSize = 16;
9402
9410
  const paddingBlock = theme2.styles.gap;
9403
9411
  const paddingLeft = theme2.styles.gap + 2;
@@ -9411,7 +9419,7 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
9411
9419
  alignItems: "center",
9412
9420
  gap: iconGap,
9413
9421
  whiteSpace: "nowrap",
9414
- backgroundColor: isActive ? colorTheme === "dark" ? lightenColor(theme2.colors.primary, 0.7) : lightenColor(theme2.colors.primary, 0.85) : theme2.colors.backgroundContent,
9422
+ backgroundColor: isActive ? colorTheme === "dark" ? lightenColor(theme2.colors.primary, 0.7) : lightenColor(theme2.colors.primary, 0.85) : readyBackgroundColor,
9415
9423
  borderRadius: theme2.styles.borderRadius,
9416
9424
  paddingBlock,
9417
9425
  paddingLeft: isCollapsed ? theme2.styles.space : paddingLeft,
@@ -9468,7 +9476,15 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
9468
9476
  overflow: "hidden",
9469
9477
  transition: `max-height ${theme2.styles.transition}, margin-top ${theme2.styles.transition}`,
9470
9478
  children: [
9471
- item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MenuItemComponent2, { item: child, onClick }, child.text)),
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
+ )),
9472
9488
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
9473
9489
  Div_default,
9474
9490
  {
@@ -9498,9 +9514,9 @@ var MenuItemComponent = (0, import_react29.memo)(function MenuItemComponent2({ i
9498
9514
  left: 0,
9499
9515
  border: `${lineWidth}px solid ${theme2.colors.border}`,
9500
9516
  borderRadius: 999,
9501
- borderTopColor: theme2.colors.backgroundContent,
9502
- borderLeftColor: theme2.colors.backgroundContent,
9503
- borderRightColor: theme2.colors.backgroundContent,
9517
+ borderTopColor: readyBackgroundColor,
9518
+ borderLeftColor: readyBackgroundColor,
9519
+ borderRightColor: readyBackgroundColor,
9504
9520
  transform: "rotate(45deg)"
9505
9521
  }
9506
9522
  )
@@ -9522,7 +9538,8 @@ var SideMenuComponent = function SideMenu({
9522
9538
  logoFontFamily,
9523
9539
  collapsable,
9524
9540
  withCloseButton,
9525
- widthMobileHandle
9541
+ widthMobileHandle,
9542
+ backgroundColor
9526
9543
  }) {
9527
9544
  const theme2 = useTheme();
9528
9545
  const mediaQuery = useMediaQuery();
@@ -9536,7 +9553,8 @@ var SideMenuComponent = function SideMenu({
9536
9553
  const isCollapsed = sideMenuIsCollapsed && !mediaQuery.size1000;
9537
9554
  const LinkComponentTag = components.button?.tagReplacement?.linkComponent ?? "a";
9538
9555
  const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
9539
- const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + 1 + theme2.styles.space;
9556
+ const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
9557
+ const readyBackgroundColor = backgroundColor ?? theme2.colors.backgroundContent;
9540
9558
  const logoSize = sideMenuCollapsedWidth - theme2.styles.space * 2;
9541
9559
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
9542
9560
  Div_default.column,
@@ -9546,7 +9564,7 @@ var SideMenuComponent = function SideMenu({
9546
9564
  height: `calc(100svh - ${topSpace}px)`,
9547
9565
  top: topSpace,
9548
9566
  left: 0,
9549
- backgroundColor: theme2.colors.backgroundContent,
9567
+ backgroundColor: readyBackgroundColor,
9550
9568
  borderRight: `solid 1px ${theme2.colors.border}`,
9551
9569
  transform: !mediaQuery.size1000 || sideMenuIsOpenMobile ? "translateX(0)" : "translateX(-100%)",
9552
9570
  paddingTop: logoAssetName || logoUrl ? theme2.styles.gap : theme2.styles.space,
@@ -9600,7 +9618,15 @@ var SideMenuComponent = function SideMenu({
9600
9618
  overflowY: "auto",
9601
9619
  paddingInline: theme2.styles.space,
9602
9620
  paddingBottom: !isCollapsable && !readyBottomItems ? theme2.styles.space : void 0,
9603
- 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)) })
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
+ )) })
9604
9630
  }
9605
9631
  ),
9606
9632
  readyBottomItems && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
@@ -9612,7 +9638,15 @@ var SideMenuComponent = function SideMenu({
9612
9638
  paddingTop: mediaQuery.size1000 ? theme2.styles.space : void 0,
9613
9639
  paddingInline: theme2.styles.space,
9614
9640
  paddingBottom: !isCollapsable ? theme2.styles.space : void 0,
9615
- children: readyBottomItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(MenuItemComponent, { item, onClick: onClickXButton }, item.text))
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
+ ))
9616
9650
  }
9617
9651
  ),
9618
9652
  isCollapsable && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
@@ -9627,7 +9661,7 @@ var SideMenuComponent = function SideMenu({
9627
9661
  {
9628
9662
  alignItems: "center",
9629
9663
  justifyContent: "center",
9630
- backgroundColor: theme2.colors.backgroundContent,
9664
+ backgroundColor: readyBackgroundColor,
9631
9665
  borderRadius: theme2.styles.borderRadius,
9632
9666
  cursor: "pointer",
9633
9667
  filterHover: filterHover().z1,
@@ -9655,7 +9689,7 @@ var SideMenuComponent = function SideMenu({
9655
9689
  position: "absolute",
9656
9690
  top: theme2.styles.space,
9657
9691
  left: "100%",
9658
- backgroundColor: theme2.colors.backgroundContent,
9692
+ backgroundColor: readyBackgroundColor,
9659
9693
  border: `solid 1px ${theme2.colors.border}`,
9660
9694
  borderLeft: "none",
9661
9695
  borderTopRightRadius: theme2.styles.borderRadius,
@@ -9690,7 +9724,7 @@ SideMenuComponent.pageHolder = function SideMenuPageHolder({ outsideComponent, .
9690
9724
  const mediaQuery = useMediaQuery();
9691
9725
  const { components, sideMenuIsCollapsed } = useBetterHtmlContextInternal();
9692
9726
  const sideMenuWidth = components.sideMenu?.width ?? defaultSideMenuWidth;
9693
- const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + 1 + theme2.styles.space;
9727
+ const sideMenuCollapsedWidth = theme2.styles.space + theme2.styles.space * 2 + 16 + theme2.styles.space;
9694
9728
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
9695
9729
  Div_default,
9696
9730
  {