@scripso-homepad/ui 0.4.41 → 0.4.42

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.
@@ -29580,7 +29580,12 @@ function isNavItemActive(pathname, item) {
29580
29580
  }
29581
29581
  return pathname === item.to || pathname.startsWith(`${item.to}/`);
29582
29582
  }
29583
- function SidebarNavItem({ item, isOpen, isActive, onNavigate }) {
29583
+ function SidebarNavItem({
29584
+ item,
29585
+ isOpen,
29586
+ isActive,
29587
+ onNavigate
29588
+ }) {
29584
29589
  if (item.hidden) {
29585
29590
  return null;
29586
29591
  }
@@ -29598,6 +29603,7 @@ function SidebarNavItem({ item, isOpen, isActive, onNavigate }) {
29598
29603
  type: "button",
29599
29604
  onClick: handleClick,
29600
29605
  "aria-current": isActive ? "page" : void 0,
29606
+ "data-onboarding": item.onboardingId,
29601
29607
  "aria-disabled": item.disabled,
29602
29608
  disabled: item.disabled,
29603
29609
  tabIndex: item.disabled ? -1 : void 0,
@@ -30689,7 +30695,10 @@ function clampMenuLeft(left, menuWidth) {
30689
30695
  return left;
30690
30696
  }
30691
30697
  const minLeft = MENU_VIEWPORT_MARGIN_PX;
30692
- const maxLeft = Math.max(minLeft, window.innerWidth - menuWidth - MENU_VIEWPORT_MARGIN_PX);
30698
+ const maxLeft = Math.max(
30699
+ minLeft,
30700
+ window.innerWidth - menuWidth - MENU_VIEWPORT_MARGIN_PX
30701
+ );
30693
30702
  return Math.min(Math.max(left, minLeft), maxLeft);
30694
30703
  }
30695
30704
  function resolveMenuItemIcon(item) {
@@ -30712,7 +30721,9 @@ function TableActionsMenu({
30712
30721
  menuClassName,
30713
30722
  triggerIcon,
30714
30723
  menuWidth = MENU_WIDTH_PX,
30715
- menuFitContent = true
30724
+ menuFitContent = true,
30725
+ forceOpen,
30726
+ menuOnboardingId
30716
30727
  }) {
30717
30728
  const [open, setOpen] = react.useState(false);
30718
30729
  const [menuPosition, setMenuPosition] = react.useState(null);
@@ -30721,8 +30732,17 @@ function TableActionsMenu({
30721
30732
  const triggerRef = react.useRef(null);
30722
30733
  const menuId = react.useId();
30723
30734
  const closeMenu = react.useCallback(() => {
30735
+ if (forceOpen) {
30736
+ return;
30737
+ }
30724
30738
  setOpen(false);
30725
- }, []);
30739
+ }, [forceOpen]);
30740
+ react.useEffect(() => {
30741
+ if (forceOpen === void 0) {
30742
+ return;
30743
+ }
30744
+ setOpen(forceOpen);
30745
+ }, [forceOpen]);
30726
30746
  const updateMenuPosition = react.useCallback(() => {
30727
30747
  const trigger = triggerRef.current;
30728
30748
  const menuEl = menuRef.current;
@@ -30732,7 +30752,10 @@ function TableActionsMenu({
30732
30752
  const rect = trigger.getBoundingClientRect();
30733
30753
  const viewportMaxWidth = typeof window === "undefined" ? menuWidth : Math.max(menuWidth, window.innerWidth - MENU_VIEWPORT_MARGIN_PX * 2);
30734
30754
  const measuredWidth = menuFitContent ? menuEl?.offsetWidth || menuEl?.getBoundingClientRect().width || menuWidth : menuWidth;
30735
- const resolvedMenuWidth = Math.min(Math.max(measuredWidth, 1), viewportMaxWidth);
30755
+ const resolvedMenuWidth = Math.min(
30756
+ Math.max(measuredWidth, 1),
30757
+ viewportMaxWidth
30758
+ );
30736
30759
  setMenuPosition({
30737
30760
  top: rect.bottom + MENU_OFFSET_PX,
30738
30761
  left: clampMenuLeft(rect.right - resolvedMenuWidth, resolvedMenuWidth)
@@ -30751,6 +30774,9 @@ function TableActionsMenu({
30751
30774
  return;
30752
30775
  }
30753
30776
  const closeOnScroll = () => {
30777
+ if (forceOpen) {
30778
+ return;
30779
+ }
30754
30780
  closeMenu();
30755
30781
  };
30756
30782
  window.addEventListener("resize", updateMenuPosition);
@@ -30767,7 +30793,7 @@ function TableActionsMenu({
30767
30793
  window.removeEventListener("scroll", closeOnScroll, true);
30768
30794
  document.removeEventListener("keydown", closeOnEscape);
30769
30795
  };
30770
- }, [closeMenu, open, updateMenuPosition]);
30796
+ }, [closeMenu, forceOpen, open, updateMenuPosition]);
30771
30797
  if (items.length === 0) {
30772
30798
  return null;
30773
30799
  }
@@ -30787,6 +30813,7 @@ function TableActionsMenu({
30787
30813
  visibility: menuPosition != null ? "visible" : "hidden",
30788
30814
  pointerEvents: menuPosition != null ? "auto" : "none"
30789
30815
  },
30816
+ ...menuOnboardingId ? { "data-onboarding": menuOnboardingId } : {},
30790
30817
  className: cn(
30791
30818
  "z-50 overflow-hidden rounded-2xl border border-storm-gray-50 bg-white shadow-[0_4px_20px_0_rgba(0,0,0,0.05)]",
30792
30819
  menuClassName
@@ -31265,6 +31292,7 @@ function Modal({
31265
31292
  closeOnBackdrop = true,
31266
31293
  closeOnEscape = true,
31267
31294
  containerClassName,
31295
+ containerDataOnboarding,
31268
31296
  contentClassName,
31269
31297
  buttonClassName
31270
31298
  }) {
@@ -31289,14 +31317,11 @@ function Modal({
31289
31317
  if (!open) {
31290
31318
  return null;
31291
31319
  }
31292
- const sharedButtonClassName = cn(
31293
- "btn h-13 w-full! min-w-0! justify-center!",
31294
- buttonClassName
31295
- );
31320
+ const sharedButtonClassName = cn("btn h-13 w-full! min-w-0! justify-center!", buttonClassName);
31296
31321
  const modal = /* @__PURE__ */ jsxRuntime.jsx(
31297
31322
  "div",
31298
31323
  {
31299
- className: "fixed inset-0 z-[100] flex items-center justify-center p-4 backdrop-blur-[12px] bg-storm-gray-850/40",
31324
+ className: "homepad-modal-in fixed inset-0 z-[100] flex items-center justify-center bg-storm-gray-850/40 p-4 backdrop-blur-[12px]",
31300
31325
  onPointerDown: backdropDismiss.onPointerDown,
31301
31326
  onClick: backdropDismiss.onClick,
31302
31327
  role: "presentation",
@@ -31307,6 +31332,7 @@ function Modal({
31307
31332
  "aria-modal": "true",
31308
31333
  "aria-labelledby": "homepad-modal-title",
31309
31334
  ...subtitle ? { "aria-describedby": "homepad-modal-subtitle" } : {},
31335
+ ...containerDataOnboarding ? { "data-onboarding": containerDataOnboarding } : {},
31310
31336
  className: cn(
31311
31337
  "flex max-h-[min(90dvh,calc(100dvh-2rem))] w-full max-w-2xl flex-col gap-6 rounded-2xl bg-white p-4 opacity-100 md:p-6",
31312
31338
  containerClassName
@@ -31345,7 +31371,16 @@ function Modal({
31345
31371
  ) : null
31346
31372
  ] })
31347
31373
  ] }),
31348
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("drawer-scroll-area min-h-0 min-w-0 flex-1 overflow-y-auto", contentClassName), children }),
31374
+ /* @__PURE__ */ jsxRuntime.jsx(
31375
+ "div",
31376
+ {
31377
+ className: cn(
31378
+ "drawer-scroll-area min-h-0 min-w-0 flex-1 overflow-y-auto",
31379
+ contentClassName
31380
+ ),
31381
+ children
31382
+ }
31383
+ ),
31349
31384
  /* @__PURE__ */ jsxRuntime.jsxs(
31350
31385
  "footer",
31351
31386
  {
@@ -31487,7 +31522,7 @@ function Drawer({
31487
31522
  window.removeEventListener("keydown", handleKeyDown);
31488
31523
  };
31489
31524
  }, [isPresent, onClose]);
31490
- if (!isPresent) {
31525
+ if (!open && !isPresent) {
31491
31526
  return null;
31492
31527
  }
31493
31528
  const drawer = /* @__PURE__ */ jsxRuntime.jsxs(
@@ -31525,48 +31560,48 @@ function Drawer({
31525
31560
  className
31526
31561
  ),
31527
31562
  children: [
31528
- /* @__PURE__ */ jsxRuntime.jsxs(
31529
- "header",
31530
- {
31531
- className: cn("shrink-0 border-b border-storm-gray-50", headerClassName),
31532
- children: [
31533
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between pt-6 pr-6 pb-4 pl-6", children: [
31534
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
31535
- /* @__PURE__ */ jsxRuntime.jsx(
31536
- "h2",
31537
- {
31538
- id: "homepad-drawer-title",
31539
- className: "typography-title-sm tracking-normal text-black",
31540
- children: title
31541
- }
31563
+ /* @__PURE__ */ jsxRuntime.jsxs("header", { className: cn("shrink-0 border-b border-storm-gray-50", headerClassName), children: [
31564
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between pt-6 pr-6 pb-4 pl-6", children: [
31565
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
31566
+ /* @__PURE__ */ jsxRuntime.jsx(
31567
+ "h2",
31568
+ {
31569
+ id: "homepad-drawer-title",
31570
+ className: "typography-title-sm tracking-normal text-black",
31571
+ children: title
31572
+ }
31573
+ ),
31574
+ subtitle ? /* @__PURE__ */ jsxRuntime.jsx(
31575
+ "p",
31576
+ {
31577
+ id: "homepad-drawer-subtitle",
31578
+ className: cn(
31579
+ "typography-body tracking-normal text-storm-gray-400",
31580
+ subtitleClassName
31542
31581
  ),
31543
- subtitle ? /* @__PURE__ */ jsxRuntime.jsx(
31544
- "p",
31545
- {
31546
- id: "homepad-drawer-subtitle",
31547
- className: cn(
31548
- "typography-body tracking-normal text-storm-gray-400",
31549
- subtitleClassName
31550
- ),
31551
- children: subtitle
31552
- }
31553
- ) : null
31554
- ] }),
31555
- /* @__PURE__ */ jsxRuntime.jsx(
31556
- "button",
31582
+ children: subtitle
31583
+ }
31584
+ ) : null
31585
+ ] }),
31586
+ /* @__PURE__ */ jsxRuntime.jsx(
31587
+ "button",
31588
+ {
31589
+ type: "button",
31590
+ "aria-label": closeAriaLabel,
31591
+ className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-storm-gray-400 transition-colors hover:bg-storm-gray-50 hover:text-storm-gray-600",
31592
+ onClick: onClose,
31593
+ children: /* @__PURE__ */ jsxRuntime.jsx(
31594
+ lucideReact.X,
31557
31595
  {
31558
- type: "button",
31559
- "aria-label": closeAriaLabel,
31560
- className: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-storm-gray-400 transition-colors hover:bg-storm-gray-50 hover:text-storm-gray-600",
31561
- onClick: onClose,
31562
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-5", strokeWidth: 1.75 })
31596
+ className: "size-5",
31597
+ strokeWidth: 1.75
31563
31598
  }
31564
31599
  )
31565
- ] }),
31566
- headerBottom ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-storm-gray-50 px-6", children: headerBottom }) : null
31567
- ]
31568
- }
31569
- ),
31600
+ }
31601
+ )
31602
+ ] }),
31603
+ headerBottom ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-storm-gray-50 px-6", children: headerBottom }) : null
31604
+ ] }),
31570
31605
  /* @__PURE__ */ jsxRuntime.jsx(
31571
31606
  "div",
31572
31607
  {