@scripso-homepad/ui 0.4.16 → 0.4.18
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/web/index.cjs +62 -42
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +3 -1
- package/dist/web/index.d.ts +3 -1
- package/dist/web/index.js +62 -42
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/web/components/Drawer.tsx +67 -29
- package/src/web/icons/TableSortIcon.tsx +1 -3
- package/src/web/layout/SidebarNavItem.tsx +7 -16
package/dist/web/index.d.cts
CHANGED
|
@@ -459,6 +459,8 @@ type DrawerProps = {
|
|
|
459
459
|
open: boolean;
|
|
460
460
|
title: string;
|
|
461
461
|
subtitle?: string;
|
|
462
|
+
subtitleClassName?: string;
|
|
463
|
+
headerBottom?: ReactNode;
|
|
462
464
|
children: ReactNode;
|
|
463
465
|
footer?: ReactNode;
|
|
464
466
|
onClose: () => void;
|
|
@@ -469,7 +471,7 @@ type DrawerProps = {
|
|
|
469
471
|
contentClassName?: string;
|
|
470
472
|
footerClassName?: string;
|
|
471
473
|
};
|
|
472
|
-
declare function Drawer({ open, title, subtitle, children, footer, onClose, closeAriaLabel, widthClassName, className, headerClassName, contentClassName, footerClassName, }: DrawerProps): react.JSX.Element | null;
|
|
474
|
+
declare function Drawer({ open, title, subtitle, subtitleClassName, headerBottom, children, footer, onClose, closeAriaLabel, widthClassName, className, headerClassName, contentClassName, footerClassName, }: DrawerProps): react.JSX.Element | null;
|
|
473
475
|
|
|
474
476
|
type HistoryTimelineItem = {
|
|
475
477
|
id: string;
|
package/dist/web/index.d.ts
CHANGED
|
@@ -459,6 +459,8 @@ type DrawerProps = {
|
|
|
459
459
|
open: boolean;
|
|
460
460
|
title: string;
|
|
461
461
|
subtitle?: string;
|
|
462
|
+
subtitleClassName?: string;
|
|
463
|
+
headerBottom?: ReactNode;
|
|
462
464
|
children: ReactNode;
|
|
463
465
|
footer?: ReactNode;
|
|
464
466
|
onClose: () => void;
|
|
@@ -469,7 +471,7 @@ type DrawerProps = {
|
|
|
469
471
|
contentClassName?: string;
|
|
470
472
|
footerClassName?: string;
|
|
471
473
|
};
|
|
472
|
-
declare function Drawer({ open, title, subtitle, children, footer, onClose, closeAriaLabel, widthClassName, className, headerClassName, contentClassName, footerClassName, }: DrawerProps): react.JSX.Element | null;
|
|
474
|
+
declare function Drawer({ open, title, subtitle, subtitleClassName, headerBottom, children, footer, onClose, closeAriaLabel, widthClassName, className, headerClassName, contentClassName, footerClassName, }: DrawerProps): react.JSX.Element | null;
|
|
473
475
|
|
|
474
476
|
type HistoryTimelineItem = {
|
|
475
477
|
id: string;
|
package/dist/web/index.js
CHANGED
|
@@ -28882,32 +28882,26 @@ function isNavItemActive(pathname, item) {
|
|
|
28882
28882
|
}
|
|
28883
28883
|
return pathname === item.to || pathname.startsWith(`${item.to}/`);
|
|
28884
28884
|
}
|
|
28885
|
-
function isModifiedClick(event) {
|
|
28886
|
-
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0;
|
|
28887
|
-
}
|
|
28888
28885
|
function SidebarNavItem({ item, isOpen, isActive, onNavigate }) {
|
|
28889
28886
|
if (item.hidden) {
|
|
28890
28887
|
return null;
|
|
28891
28888
|
}
|
|
28892
28889
|
const handleClick = (event) => {
|
|
28890
|
+
event.preventDefault();
|
|
28893
28891
|
if (item.disabled) {
|
|
28894
|
-
event.preventDefault();
|
|
28895
|
-
return;
|
|
28896
|
-
}
|
|
28897
|
-
if (event.defaultPrevented || isModifiedClick(event)) {
|
|
28898
28892
|
return;
|
|
28899
28893
|
}
|
|
28900
|
-
event.preventDefault();
|
|
28901
28894
|
item.onClick?.();
|
|
28902
28895
|
onNavigate?.(item);
|
|
28903
28896
|
};
|
|
28904
28897
|
return /* @__PURE__ */ jsxs(
|
|
28905
|
-
"
|
|
28898
|
+
"button",
|
|
28906
28899
|
{
|
|
28907
|
-
|
|
28900
|
+
type: "button",
|
|
28908
28901
|
onClick: handleClick,
|
|
28909
28902
|
"aria-current": isActive ? "page" : void 0,
|
|
28910
28903
|
"aria-disabled": item.disabled,
|
|
28904
|
+
disabled: item.disabled,
|
|
28911
28905
|
tabIndex: item.disabled ? -1 : void 0,
|
|
28912
28906
|
className: cn(
|
|
28913
28907
|
"relative flex items-center rounded-xl px-4 py-3 transition-[background-color,color,gap,padding] duration-300 ease-in-out",
|
|
@@ -29296,7 +29290,7 @@ function TableSortIcon({ direction = null, className }) {
|
|
|
29296
29290
|
fill: "none",
|
|
29297
29291
|
xmlns: "http://www.w3.org/2000/svg",
|
|
29298
29292
|
"aria-hidden": true,
|
|
29299
|
-
className
|
|
29293
|
+
className,
|
|
29300
29294
|
children: [
|
|
29301
29295
|
/* @__PURE__ */ jsx(
|
|
29302
29296
|
"path",
|
|
@@ -30433,10 +30427,34 @@ function Modal({
|
|
|
30433
30427
|
return typeof document !== "undefined" ? (0, import_react_dom2.createPortal)(modal, document.body) : modal;
|
|
30434
30428
|
}
|
|
30435
30429
|
var DRAWER_TRANSITION_MS = 300;
|
|
30430
|
+
var bodyScrollLockCount = 0;
|
|
30431
|
+
var previousBodyOverflow = "";
|
|
30432
|
+
function lockBodyScroll() {
|
|
30433
|
+
if (typeof document === "undefined") {
|
|
30434
|
+
return;
|
|
30435
|
+
}
|
|
30436
|
+
if (bodyScrollLockCount === 0) {
|
|
30437
|
+
previousBodyOverflow = document.body.style.overflow;
|
|
30438
|
+
document.body.style.overflow = "hidden";
|
|
30439
|
+
}
|
|
30440
|
+
bodyScrollLockCount += 1;
|
|
30441
|
+
}
|
|
30442
|
+
function unlockBodyScroll() {
|
|
30443
|
+
if (typeof document === "undefined") {
|
|
30444
|
+
return;
|
|
30445
|
+
}
|
|
30446
|
+
bodyScrollLockCount = Math.max(0, bodyScrollLockCount - 1);
|
|
30447
|
+
if (bodyScrollLockCount === 0) {
|
|
30448
|
+
document.body.style.overflow = previousBodyOverflow;
|
|
30449
|
+
previousBodyOverflow = "";
|
|
30450
|
+
}
|
|
30451
|
+
}
|
|
30436
30452
|
function Drawer({
|
|
30437
30453
|
open,
|
|
30438
30454
|
title,
|
|
30439
30455
|
subtitle,
|
|
30456
|
+
subtitleClassName,
|
|
30457
|
+
headerBottom,
|
|
30440
30458
|
children,
|
|
30441
30459
|
footer,
|
|
30442
30460
|
onClose,
|
|
@@ -30473,8 +30491,7 @@ function Drawer({
|
|
|
30473
30491
|
if (!isPresent) {
|
|
30474
30492
|
return;
|
|
30475
30493
|
}
|
|
30476
|
-
|
|
30477
|
-
document.body.style.overflow = "hidden";
|
|
30494
|
+
lockBodyScroll();
|
|
30478
30495
|
const handleKeyDown = (event) => {
|
|
30479
30496
|
if (event.key === "Escape") {
|
|
30480
30497
|
onClose();
|
|
@@ -30482,7 +30499,7 @@ function Drawer({
|
|
|
30482
30499
|
};
|
|
30483
30500
|
window.addEventListener("keydown", handleKeyDown);
|
|
30484
30501
|
return () => {
|
|
30485
|
-
|
|
30502
|
+
unlockBodyScroll();
|
|
30486
30503
|
window.removeEventListener("keydown", handleKeyDown);
|
|
30487
30504
|
};
|
|
30488
30505
|
}, [isPresent, onClose]);
|
|
@@ -30524,39 +30541,42 @@ function Drawer({
|
|
|
30524
30541
|
/* @__PURE__ */ jsxs(
|
|
30525
30542
|
"header",
|
|
30526
30543
|
{
|
|
30527
|
-
className: cn(
|
|
30528
|
-
"flex h-[87px] shrink-0 items-start justify-between border-b border-storm-gray-50 pt-6 pr-6 pb-4 pl-6",
|
|
30529
|
-
headerClassName
|
|
30530
|
-
),
|
|
30544
|
+
className: cn("shrink-0 border-b border-storm-gray-50", headerClassName),
|
|
30531
30545
|
children: [
|
|
30532
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
30546
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between pt-6 pr-6 pb-4 pl-6", children: [
|
|
30547
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
|
|
30548
|
+
/* @__PURE__ */ jsx(
|
|
30549
|
+
"h2",
|
|
30550
|
+
{
|
|
30551
|
+
id: "homepad-drawer-title",
|
|
30552
|
+
className: "typography-title-sm tracking-normal text-black",
|
|
30553
|
+
children: title
|
|
30554
|
+
}
|
|
30555
|
+
),
|
|
30556
|
+
subtitle ? /* @__PURE__ */ jsx(
|
|
30557
|
+
"p",
|
|
30558
|
+
{
|
|
30559
|
+
id: "homepad-drawer-subtitle",
|
|
30560
|
+
className: cn(
|
|
30561
|
+
"typography-body tracking-normal text-storm-gray-400",
|
|
30562
|
+
subtitleClassName
|
|
30563
|
+
),
|
|
30564
|
+
children: subtitle
|
|
30565
|
+
}
|
|
30566
|
+
) : null
|
|
30567
|
+
] }),
|
|
30533
30568
|
/* @__PURE__ */ jsx(
|
|
30534
|
-
"
|
|
30569
|
+
"button",
|
|
30535
30570
|
{
|
|
30536
|
-
|
|
30537
|
-
|
|
30538
|
-
|
|
30571
|
+
type: "button",
|
|
30572
|
+
"aria-label": closeAriaLabel,
|
|
30573
|
+
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",
|
|
30574
|
+
onClick: onClose,
|
|
30575
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-5", strokeWidth: 1.75 })
|
|
30539
30576
|
}
|
|
30540
|
-
)
|
|
30541
|
-
subtitle ? /* @__PURE__ */ jsx(
|
|
30542
|
-
"p",
|
|
30543
|
-
{
|
|
30544
|
-
id: "homepad-drawer-subtitle",
|
|
30545
|
-
className: "typography-body tracking-normal text-storm-gray-400",
|
|
30546
|
-
children: subtitle
|
|
30547
|
-
}
|
|
30548
|
-
) : null
|
|
30577
|
+
)
|
|
30549
30578
|
] }),
|
|
30550
|
-
/* @__PURE__ */ jsx(
|
|
30551
|
-
"button",
|
|
30552
|
-
{
|
|
30553
|
-
type: "button",
|
|
30554
|
-
"aria-label": closeAriaLabel,
|
|
30555
|
-
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",
|
|
30556
|
-
onClick: onClose,
|
|
30557
|
-
children: /* @__PURE__ */ jsx(X, { className: "size-5", strokeWidth: 1.75 })
|
|
30558
|
-
}
|
|
30559
|
-
)
|
|
30579
|
+
headerBottom ? /* @__PURE__ */ jsx("div", { className: "border-t border-storm-gray-50 px-6", children: headerBottom }) : null
|
|
30560
30580
|
]
|
|
30561
30581
|
}
|
|
30562
30582
|
),
|