@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.cjs
CHANGED
|
@@ -29431,32 +29431,26 @@ function isNavItemActive(pathname, item) {
|
|
|
29431
29431
|
}
|
|
29432
29432
|
return pathname === item.to || pathname.startsWith(`${item.to}/`);
|
|
29433
29433
|
}
|
|
29434
|
-
function isModifiedClick(event) {
|
|
29435
|
-
return event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0;
|
|
29436
|
-
}
|
|
29437
29434
|
function SidebarNavItem({ item, isOpen, isActive, onNavigate }) {
|
|
29438
29435
|
if (item.hidden) {
|
|
29439
29436
|
return null;
|
|
29440
29437
|
}
|
|
29441
29438
|
const handleClick = (event) => {
|
|
29439
|
+
event.preventDefault();
|
|
29442
29440
|
if (item.disabled) {
|
|
29443
|
-
event.preventDefault();
|
|
29444
|
-
return;
|
|
29445
|
-
}
|
|
29446
|
-
if (event.defaultPrevented || isModifiedClick(event)) {
|
|
29447
29441
|
return;
|
|
29448
29442
|
}
|
|
29449
|
-
event.preventDefault();
|
|
29450
29443
|
item.onClick?.();
|
|
29451
29444
|
onNavigate?.(item);
|
|
29452
29445
|
};
|
|
29453
29446
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29454
|
-
"
|
|
29447
|
+
"button",
|
|
29455
29448
|
{
|
|
29456
|
-
|
|
29449
|
+
type: "button",
|
|
29457
29450
|
onClick: handleClick,
|
|
29458
29451
|
"aria-current": isActive ? "page" : void 0,
|
|
29459
29452
|
"aria-disabled": item.disabled,
|
|
29453
|
+
disabled: item.disabled,
|
|
29460
29454
|
tabIndex: item.disabled ? -1 : void 0,
|
|
29461
29455
|
className: cn(
|
|
29462
29456
|
"relative flex items-center rounded-xl px-4 py-3 transition-[background-color,color,gap,padding] duration-300 ease-in-out",
|
|
@@ -29845,7 +29839,7 @@ function TableSortIcon({ direction = null, className }) {
|
|
|
29845
29839
|
fill: "none",
|
|
29846
29840
|
xmlns: "http://www.w3.org/2000/svg",
|
|
29847
29841
|
"aria-hidden": true,
|
|
29848
|
-
className
|
|
29842
|
+
className,
|
|
29849
29843
|
children: [
|
|
29850
29844
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
29851
29845
|
"path",
|
|
@@ -31176,10 +31170,34 @@ function Modal({
|
|
|
31176
31170
|
return typeof document !== "undefined" ? (0, import_react_dom2.createPortal)(modal, document.body) : modal;
|
|
31177
31171
|
}
|
|
31178
31172
|
var DRAWER_TRANSITION_MS = 300;
|
|
31173
|
+
var bodyScrollLockCount = 0;
|
|
31174
|
+
var previousBodyOverflow = "";
|
|
31175
|
+
function lockBodyScroll() {
|
|
31176
|
+
if (typeof document === "undefined") {
|
|
31177
|
+
return;
|
|
31178
|
+
}
|
|
31179
|
+
if (bodyScrollLockCount === 0) {
|
|
31180
|
+
previousBodyOverflow = document.body.style.overflow;
|
|
31181
|
+
document.body.style.overflow = "hidden";
|
|
31182
|
+
}
|
|
31183
|
+
bodyScrollLockCount += 1;
|
|
31184
|
+
}
|
|
31185
|
+
function unlockBodyScroll() {
|
|
31186
|
+
if (typeof document === "undefined") {
|
|
31187
|
+
return;
|
|
31188
|
+
}
|
|
31189
|
+
bodyScrollLockCount = Math.max(0, bodyScrollLockCount - 1);
|
|
31190
|
+
if (bodyScrollLockCount === 0) {
|
|
31191
|
+
document.body.style.overflow = previousBodyOverflow;
|
|
31192
|
+
previousBodyOverflow = "";
|
|
31193
|
+
}
|
|
31194
|
+
}
|
|
31179
31195
|
function Drawer({
|
|
31180
31196
|
open,
|
|
31181
31197
|
title,
|
|
31182
31198
|
subtitle,
|
|
31199
|
+
subtitleClassName,
|
|
31200
|
+
headerBottom,
|
|
31183
31201
|
children,
|
|
31184
31202
|
footer,
|
|
31185
31203
|
onClose,
|
|
@@ -31216,8 +31234,7 @@ function Drawer({
|
|
|
31216
31234
|
if (!isPresent) {
|
|
31217
31235
|
return;
|
|
31218
31236
|
}
|
|
31219
|
-
|
|
31220
|
-
document.body.style.overflow = "hidden";
|
|
31237
|
+
lockBodyScroll();
|
|
31221
31238
|
const handleKeyDown = (event) => {
|
|
31222
31239
|
if (event.key === "Escape") {
|
|
31223
31240
|
onClose();
|
|
@@ -31225,7 +31242,7 @@ function Drawer({
|
|
|
31225
31242
|
};
|
|
31226
31243
|
window.addEventListener("keydown", handleKeyDown);
|
|
31227
31244
|
return () => {
|
|
31228
|
-
|
|
31245
|
+
unlockBodyScroll();
|
|
31229
31246
|
window.removeEventListener("keydown", handleKeyDown);
|
|
31230
31247
|
};
|
|
31231
31248
|
}, [isPresent, onClose]);
|
|
@@ -31267,39 +31284,42 @@ function Drawer({
|
|
|
31267
31284
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
31268
31285
|
"header",
|
|
31269
31286
|
{
|
|
31270
|
-
className: cn(
|
|
31271
|
-
"flex h-[87px] shrink-0 items-start justify-between border-b border-storm-gray-50 pt-6 pr-6 pb-4 pl-6",
|
|
31272
|
-
headerClassName
|
|
31273
|
-
),
|
|
31287
|
+
className: cn("shrink-0 border-b border-storm-gray-50", headerClassName),
|
|
31274
31288
|
children: [
|
|
31275
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "
|
|
31289
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between pt-6 pr-6 pb-4 pl-6", children: [
|
|
31290
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex flex-col gap-1", children: [
|
|
31291
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31292
|
+
"h2",
|
|
31293
|
+
{
|
|
31294
|
+
id: "homepad-drawer-title",
|
|
31295
|
+
className: "typography-title-sm tracking-normal text-black",
|
|
31296
|
+
children: title
|
|
31297
|
+
}
|
|
31298
|
+
),
|
|
31299
|
+
subtitle ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31300
|
+
"p",
|
|
31301
|
+
{
|
|
31302
|
+
id: "homepad-drawer-subtitle",
|
|
31303
|
+
className: cn(
|
|
31304
|
+
"typography-body tracking-normal text-storm-gray-400",
|
|
31305
|
+
subtitleClassName
|
|
31306
|
+
),
|
|
31307
|
+
children: subtitle
|
|
31308
|
+
}
|
|
31309
|
+
) : null
|
|
31310
|
+
] }),
|
|
31276
31311
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31277
|
-
"
|
|
31312
|
+
"button",
|
|
31278
31313
|
{
|
|
31279
|
-
|
|
31280
|
-
|
|
31281
|
-
|
|
31314
|
+
type: "button",
|
|
31315
|
+
"aria-label": closeAriaLabel,
|
|
31316
|
+
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",
|
|
31317
|
+
onClick: onClose,
|
|
31318
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-5", strokeWidth: 1.75 })
|
|
31282
31319
|
}
|
|
31283
|
-
)
|
|
31284
|
-
subtitle ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31285
|
-
"p",
|
|
31286
|
-
{
|
|
31287
|
-
id: "homepad-drawer-subtitle",
|
|
31288
|
-
className: "typography-body tracking-normal text-storm-gray-400",
|
|
31289
|
-
children: subtitle
|
|
31290
|
-
}
|
|
31291
|
-
) : null
|
|
31320
|
+
)
|
|
31292
31321
|
] }),
|
|
31293
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
31294
|
-
"button",
|
|
31295
|
-
{
|
|
31296
|
-
type: "button",
|
|
31297
|
-
"aria-label": closeAriaLabel,
|
|
31298
|
-
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",
|
|
31299
|
-
onClick: onClose,
|
|
31300
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-5", strokeWidth: 1.75 })
|
|
31301
|
-
}
|
|
31302
|
-
)
|
|
31322
|
+
headerBottom ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-storm-gray-50 px-6", children: headerBottom }) : null
|
|
31303
31323
|
]
|
|
31304
31324
|
}
|
|
31305
31325
|
),
|