@scripso-homepad/ui 0.4.37 → 0.4.39
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.cjs +16 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -7
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +30 -13
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +13 -2
- package/dist/web/index.d.ts +13 -2
- package/dist/web/index.js +30 -14
- package/dist/web/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Select.tsx +1 -0
- package/src/theme/select.ts +9 -1
- package/src/web/components/ConfirmModal.tsx +5 -4
- package/src/web/components/Drawer.tsx +4 -1
- package/src/web/components/Modal.tsx +5 -12
- package/src/web/hooks/useBackdropDismiss.ts +44 -0
- package/src/web/index.ts +1 -0
package/dist/web/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, TdHTMLAttributes, HTMLAttributes, ThHTMLAttributes, ButtonHTMLAttributes, RefObject } from 'react';
|
|
2
|
+
import { ReactNode, TdHTMLAttributes, HTMLAttributes, ThHTMLAttributes, ButtonHTMLAttributes, RefObject, PointerEvent, MouseEvent } from 'react';
|
|
3
3
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
import { ToasterProps } from 'sonner';
|
|
5
5
|
export { toast } from 'sonner';
|
|
@@ -551,6 +551,17 @@ declare function useMediaQuery(query: string): boolean;
|
|
|
551
551
|
type OutsideTarget<T extends HTMLElement> = RefObject<T | null> | Array<RefObject<T | null>>;
|
|
552
552
|
declare function useOnClickOutside<T extends HTMLElement>(ref: OutsideTarget<T>, handler: () => void, enabled?: boolean): void;
|
|
553
553
|
|
|
554
|
+
type BackdropDismissHandlers = {
|
|
555
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
556
|
+
onClick: (event: MouseEvent<HTMLElement>) => void;
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* Dismiss only on a true outside click: pointer must both press and release
|
|
560
|
+
* on the backdrop. Dragging from inside the dialog and releasing outside
|
|
561
|
+
* must not close.
|
|
562
|
+
*/
|
|
563
|
+
declare function useBackdropDismiss(onDismiss: () => void, enabled?: boolean): BackdropDismissHandlers;
|
|
564
|
+
|
|
554
565
|
declare function cn(...inputs: ClassValue[]): string;
|
|
555
566
|
|
|
556
|
-
export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarCollapseIcon, SidebarExpandIcon, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
|
|
567
|
+
export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarCollapseIcon, SidebarExpandIcon, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useBackdropDismiss, useMediaQuery, useOnClickOutside };
|
package/dist/web/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode, TdHTMLAttributes, HTMLAttributes, ThHTMLAttributes, ButtonHTMLAttributes, RefObject } from 'react';
|
|
2
|
+
import { ReactNode, TdHTMLAttributes, HTMLAttributes, ThHTMLAttributes, ButtonHTMLAttributes, RefObject, PointerEvent, MouseEvent } from 'react';
|
|
3
3
|
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
4
|
import { ToasterProps } from 'sonner';
|
|
5
5
|
export { toast } from 'sonner';
|
|
@@ -551,6 +551,17 @@ declare function useMediaQuery(query: string): boolean;
|
|
|
551
551
|
type OutsideTarget<T extends HTMLElement> = RefObject<T | null> | Array<RefObject<T | null>>;
|
|
552
552
|
declare function useOnClickOutside<T extends HTMLElement>(ref: OutsideTarget<T>, handler: () => void, enabled?: boolean): void;
|
|
553
553
|
|
|
554
|
+
type BackdropDismissHandlers = {
|
|
555
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
556
|
+
onClick: (event: MouseEvent<HTMLElement>) => void;
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* Dismiss only on a true outside click: pointer must both press and release
|
|
560
|
+
* on the backdrop. Dragging from inside the dialog and releasing outside
|
|
561
|
+
* must not close.
|
|
562
|
+
*/
|
|
563
|
+
declare function useBackdropDismiss(onDismiss: () => void, enabled?: boolean): BackdropDismissHandlers;
|
|
564
|
+
|
|
554
565
|
declare function cn(...inputs: ClassValue[]): string;
|
|
555
566
|
|
|
556
|
-
export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarCollapseIcon, SidebarExpandIcon, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
|
|
567
|
+
export { type AdminBuildingOption, type AdminHeaderLabels, type AdminLayoutLabels, type AdminNavItem, type AdminSidebarBranding, type AdminSidebarLabels, type AdminSidebarUser, AppHeader, type AppHeaderProps, Badge, type BadgeProps, type BadgeVariant, BellIcon, BuildingIcon, BuildingSelect, type BuildingSelectProps, ConfirmModal, type ConfirmModalProps, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, type DashboardLayoutProps, DataTable, type DataTableClassNames, type DataTableProps, Drawer, type DrawerProps, HistoryTimeline, type HistoryTimelineItem, type HistoryTimelineProps, type HomepadToasterProps, Modal, type ModalFooterAlign, type ModalFooterLayout, type ModalProps, type MutationToastMessages, type MutationToastResult, Pagination, type PaginationLabels, type PaginationProps, type PaginationVariant, type RunMutationWithToastOptions, Sidebar, SidebarCollapseIcon, SidebarExpandIcon, SidebarMobileHeader, type SidebarMobileHeaderProps, SidebarNavItem, type SidebarNavItemProps, type SidebarProps, SidebarUserCard, type SidebarUserCardProps, StatusBadge, type StatusBadgeProps, type StatusBadgeTone, Table, TableActionButton, type TableActionButtonProps, type TableActionButtonVariant, TableActionsCell, type TableActionsCellProps, TableActionsMenu, type TableActionsMenuItem, type TableActionsMenuItemTone, type TableActionsMenuProps, TableBody, type TableBodyProps, TableCell, type TableCellProps, type TableCellVariant, TableHead, type TableHeadProps, TableHeader, type TableHeaderProps, TableIconText, type TableIconTextProps, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, type TableProps, TableRow, type TableRowActionsConfig, type TableRowProps, TableRowStatusActions, type TableRowStatusActionsProps, TableScrollArea, type TableScrollAreaProps, type TableSortDirection, TableSortIcon, TableStatusActionsCell, type TableStatusActionsCellProps, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useBackdropDismiss, useMediaQuery, useOnClickOutside };
|
package/dist/web/index.js
CHANGED
|
@@ -30394,6 +30394,26 @@ function TableIconText({ icon, children, className }) {
|
|
|
30394
30394
|
|
|
30395
30395
|
// src/web/components/Modal.tsx
|
|
30396
30396
|
var import_react_dom2 = __toESM(require_react_dom(), 1);
|
|
30397
|
+
function useBackdropDismiss(onDismiss, enabled = true) {
|
|
30398
|
+
const pointerDownOnBackdropRef = useRef(false);
|
|
30399
|
+
const onPointerDown = useCallback(
|
|
30400
|
+
(event) => {
|
|
30401
|
+
pointerDownOnBackdropRef.current = enabled && event.target === event.currentTarget;
|
|
30402
|
+
},
|
|
30403
|
+
[enabled]
|
|
30404
|
+
);
|
|
30405
|
+
const onClick = useCallback(
|
|
30406
|
+
(event) => {
|
|
30407
|
+
const shouldDismiss = enabled && pointerDownOnBackdropRef.current && event.target === event.currentTarget;
|
|
30408
|
+
pointerDownOnBackdropRef.current = false;
|
|
30409
|
+
if (shouldDismiss) {
|
|
30410
|
+
onDismiss();
|
|
30411
|
+
}
|
|
30412
|
+
},
|
|
30413
|
+
[enabled, onDismiss]
|
|
30414
|
+
);
|
|
30415
|
+
return { onPointerDown, onClick };
|
|
30416
|
+
}
|
|
30397
30417
|
var footerAlignClasses = {
|
|
30398
30418
|
left: "justify-start",
|
|
30399
30419
|
center: "justify-center",
|
|
@@ -30422,6 +30442,7 @@ function Modal({
|
|
|
30422
30442
|
contentClassName,
|
|
30423
30443
|
buttonClassName
|
|
30424
30444
|
}) {
|
|
30445
|
+
const backdropDismiss = useBackdropDismiss(onCancel, closeOnBackdrop);
|
|
30425
30446
|
useEffect(() => {
|
|
30426
30447
|
if (!open) {
|
|
30427
30448
|
return;
|
|
@@ -30450,11 +30471,8 @@ function Modal({
|
|
|
30450
30471
|
"div",
|
|
30451
30472
|
{
|
|
30452
30473
|
className: "fixed inset-0 z-[100] flex items-center justify-center p-4 backdrop-blur-[12px] bg-storm-gray-850/40",
|
|
30453
|
-
|
|
30454
|
-
|
|
30455
|
-
onCancel();
|
|
30456
|
-
}
|
|
30457
|
-
} : void 0,
|
|
30474
|
+
onPointerDown: backdropDismiss.onPointerDown,
|
|
30475
|
+
onClick: backdropDismiss.onClick,
|
|
30458
30476
|
role: "presentation",
|
|
30459
30477
|
children: /* @__PURE__ */ jsxs(
|
|
30460
30478
|
"div",
|
|
@@ -30467,9 +30485,6 @@ function Modal({
|
|
|
30467
30485
|
"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",
|
|
30468
30486
|
containerClassName
|
|
30469
30487
|
),
|
|
30470
|
-
onClick: (event) => {
|
|
30471
|
-
event.stopPropagation();
|
|
30472
|
-
},
|
|
30473
30488
|
children: [
|
|
30474
30489
|
/* @__PURE__ */ jsxs("header", { className: cn("flex shrink-0", icon ? "items-center gap-2.5" : void 0), children: [
|
|
30475
30490
|
icon ? /* @__PURE__ */ jsx(
|
|
@@ -30589,6 +30604,7 @@ function Drawer({
|
|
|
30589
30604
|
const [isPresent, setIsPresent] = useState(open);
|
|
30590
30605
|
const [isAnimatedIn, setIsAnimatedIn] = useState(false);
|
|
30591
30606
|
const [isTransformSettled, setIsTransformSettled] = useState(open);
|
|
30607
|
+
const backdropDismiss = useBackdropDismiss(onClose);
|
|
30592
30608
|
useEffect(() => {
|
|
30593
30609
|
if (open) {
|
|
30594
30610
|
setIsPresent(true);
|
|
@@ -30655,7 +30671,8 @@ function Drawer({
|
|
|
30655
30671
|
"absolute inset-0 z-0 cursor-pointer bg-storm-gray-850/40 backdrop-blur-[12px] transition-opacity duration-300 ease-in-out",
|
|
30656
30672
|
isAnimatedIn ? "opacity-100" : "opacity-0"
|
|
30657
30673
|
),
|
|
30658
|
-
|
|
30674
|
+
onPointerDown: backdropDismiss.onPointerDown,
|
|
30675
|
+
onClick: backdropDismiss.onClick
|
|
30659
30676
|
}
|
|
30660
30677
|
),
|
|
30661
30678
|
/* @__PURE__ */ jsxs(
|
|
@@ -30991,6 +31008,7 @@ function ConfirmModal({
|
|
|
30991
31008
|
containerClassName,
|
|
30992
31009
|
buttonClassName
|
|
30993
31010
|
}) {
|
|
31011
|
+
const backdropDismiss = useBackdropDismiss(onCancel, closeOnBackdrop);
|
|
30994
31012
|
useEffect(() => {
|
|
30995
31013
|
if (!open) {
|
|
30996
31014
|
return;
|
|
@@ -31016,7 +31034,8 @@ function ConfirmModal({
|
|
|
31016
31034
|
"div",
|
|
31017
31035
|
{
|
|
31018
31036
|
className: "fixed inset-0 z-50 flex items-center justify-center p-4 backdrop-blur-md bg-storm-gray-850/40",
|
|
31019
|
-
|
|
31037
|
+
onPointerDown: backdropDismiss.onPointerDown,
|
|
31038
|
+
onClick: backdropDismiss.onClick,
|
|
31020
31039
|
role: "presentation",
|
|
31021
31040
|
children: /* @__PURE__ */ jsxs(
|
|
31022
31041
|
"div",
|
|
@@ -31029,9 +31048,6 @@ function ConfirmModal({
|
|
|
31029
31048
|
"flex w-full max-w-md flex-col gap-8 rounded-3xl bg-white p-6 opacity-100 md:p-8",
|
|
31030
31049
|
containerClassName
|
|
31031
31050
|
),
|
|
31032
|
-
onClick: (event) => {
|
|
31033
|
-
event.stopPropagation();
|
|
31034
|
-
},
|
|
31035
31051
|
children: [
|
|
31036
31052
|
/* @__PURE__ */ jsxs("header", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
31037
31053
|
icon ? /* @__PURE__ */ jsx("div", { className: "flex size-14 items-center justify-center rounded-2xl bg-storm-gray-50 text-storm-gray-500", children: icon }) : null,
|
|
@@ -31144,6 +31160,6 @@ react-dom/cjs/react-dom.development.js:
|
|
|
31144
31160
|
*)
|
|
31145
31161
|
*/
|
|
31146
31162
|
|
|
31147
|
-
export { AppHeader, Badge, BellIcon, BuildingIcon, BuildingSelect, ConfirmModal, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, DataTable, Drawer, HistoryTimeline, Modal, Pagination, Sidebar, SidebarCollapseIcon, SidebarExpandIcon, SidebarMobileHeader, SidebarNavItem, SidebarUserCard, StatusBadge, Table, TableActionButton, TableActionsCell, TableActionsMenu, TableBody, TableCell, TableHead, TableHeader, TableIconText, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, TableRow, TableRowStatusActions, TableScrollArea, TableSortIcon, TableStatusActionsCell, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useMediaQuery, useOnClickOutside };
|
|
31163
|
+
export { AppHeader, Badge, BellIcon, BuildingIcon, BuildingSelect, ConfirmModal, DEFAULT_TABLE_BODY_MIN_HEIGHT, DashboardLayout, DataTable, Drawer, HistoryTimeline, Modal, Pagination, Sidebar, SidebarCollapseIcon, SidebarExpandIcon, SidebarMobileHeader, SidebarNavItem, SidebarUserCard, StatusBadge, Table, TableActionButton, TableActionsCell, TableActionsMenu, TableBody, TableCell, TableHead, TableHeader, TableIconText, TableMenuActivateIcon, TableMenuCheckIcon, TableMenuCloseIcon, TableMenuEditIcon, TableMenuInfoIcon, TableMenuRefreshIcon, TableMenuSuspendIcon, TableMenuTrashIcon, TableMoreIcon, TableRow, TableRowStatusActions, TableScrollArea, TableSortIcon, TableStatusActionsCell, Toaster, ToasterProvider, cn, getPaginationRange, getTotalPages, getVisiblePageNumbers, isNavItemActive, runMutationWithToast, tableRowDisabledCellClassName, useBackdropDismiss, useMediaQuery, useOnClickOutside };
|
|
31148
31164
|
//# sourceMappingURL=index.js.map
|
|
31149
31165
|
//# sourceMappingURL=index.js.map
|