@caratlogic/design-system 0.1.6 → 0.1.7
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/components/molecules/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/molecules/Modal/Modal.d.ts.map +1 -1
- package/dist/index.cjs.js +43 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +43 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/overlayBodyLock.d.ts +11 -0
- package/dist/lib/overlayBodyLock.d.ts.map +1 -1
- package/dist/ui.cjs.js +7 -11
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +7 -11
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { cn } from './lib/utils';
|
|
2
2
|
export * from './lib/badge';
|
|
3
3
|
export * from './lib/notify';
|
|
4
|
-
export { releaseStaleOverlayBodyLock } from './lib/overlayBodyLock';
|
|
4
|
+
export { releaseStaleOverlayBodyLock, watchOverlayBodyLock, } from './lib/overlayBodyLock';
|
|
5
5
|
export * from './components/atoms/ActionButtonWithTooltip';
|
|
6
6
|
export * from './components/atoms/Alert';
|
|
7
7
|
export * from './components/atoms/Badge';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,cAAc,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AAC;AAGxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAGhD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AAGxD,cAAc,8BAA8B,CAAC;AAG7C,cAAc,6BAA6B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -4345,13 +4345,19 @@ const notify = {
|
|
|
4345
4345
|
promise: toast.promise.bind(toast),
|
|
4346
4346
|
};
|
|
4347
4347
|
|
|
4348
|
+
/**
|
|
4349
|
+
* Only overlays that actually lock `<body>` count. `[data-radix-popper-content-wrapper]`
|
|
4350
|
+
* is deliberately absent: a tooltip renders into one, so including it made an
|
|
4351
|
+
* open tooltip — say, on the Edit button you just clicked — look like a live
|
|
4352
|
+
* modal and suppress the release, leaving the page unclickable. Modal poppers
|
|
4353
|
+
* (menus, selects) still match through their roles.
|
|
4354
|
+
*/
|
|
4348
4355
|
const OVERLAY_CONTENT_SELECTOR = [
|
|
4349
4356
|
'[data-slot="dialog-content"]',
|
|
4350
4357
|
'[role="dialog"]',
|
|
4351
4358
|
'[role="alertdialog"]',
|
|
4352
4359
|
'[role="menu"]',
|
|
4353
4360
|
'[role="listbox"]',
|
|
4354
|
-
'[data-radix-popper-content-wrapper]',
|
|
4355
4361
|
].join(',');
|
|
4356
4362
|
/**
|
|
4357
4363
|
* `@radix-ui/react-dismissable-layer` keeps the value it must restore to
|
|
@@ -4363,6 +4369,36 @@ const OVERLAY_CONTENT_SELECTOR = [
|
|
|
4363
4369
|
* Clearing is only safe once nothing is on screen, so this is a no-op while any
|
|
4364
4370
|
* overlay content is still mounted.
|
|
4365
4371
|
*/
|
|
4372
|
+
/**
|
|
4373
|
+
* Watches `<body>` and clears a lock that outlives every overlay.
|
|
4374
|
+
*
|
|
4375
|
+
* The per-overlay hooks handle the normal close path; this is the backstop for
|
|
4376
|
+
* the ones they cannot see — an overlay unmounted by a route change, a layer
|
|
4377
|
+
* combination nobody anticipated, a third-party popup. Returns a disposer.
|
|
4378
|
+
*
|
|
4379
|
+
* Cheap: an attribute-scoped MutationObserver that only reacts when something
|
|
4380
|
+
* actually writes `style` or `data-scroll-locked` on `<body>`.
|
|
4381
|
+
*/
|
|
4382
|
+
function watchOverlayBodyLock() {
|
|
4383
|
+
if (typeof document === 'undefined')
|
|
4384
|
+
return () => { };
|
|
4385
|
+
let timer;
|
|
4386
|
+
const check = () => {
|
|
4387
|
+
window.clearTimeout(timer);
|
|
4388
|
+
// Outlive the exit animation, so a legitimately-open overlay is still
|
|
4389
|
+
// mounted when `releaseStaleOverlayBodyLock` looks for it.
|
|
4390
|
+
timer = window.setTimeout(() => releaseStaleOverlayBodyLock(), 500);
|
|
4391
|
+
};
|
|
4392
|
+
const observer = new MutationObserver(check);
|
|
4393
|
+
observer.observe(document.body, {
|
|
4394
|
+
attributes: true,
|
|
4395
|
+
attributeFilter: ['style', 'data-scroll-locked'],
|
|
4396
|
+
});
|
|
4397
|
+
return () => {
|
|
4398
|
+
window.clearTimeout(timer);
|
|
4399
|
+
observer.disconnect();
|
|
4400
|
+
};
|
|
4401
|
+
}
|
|
4366
4402
|
function releaseStaleOverlayBodyLock() {
|
|
4367
4403
|
if (typeof document === 'undefined')
|
|
4368
4404
|
return;
|
|
@@ -12093,6 +12129,9 @@ function useRefundToWallet(open) {
|
|
|
12093
12129
|
|
|
12094
12130
|
const ConfirmDialog = ({ open, onOpenChange, title, description, info, confirmLabel = 'Yes', cancelLabel = 'Cancel', confirmVariant = 'default', icon: Icon = Trash2, disabled = false, onConfirm, onCancel, }) => {
|
|
12095
12131
|
const { refundToWallet, setRefundToWallet } = useRefundToWallet(open);
|
|
12132
|
+
// Opened from a modal menu row, two dismissable layers overlap and Radix
|
|
12133
|
+
// restores `pointer-events: none` to <body> on close, freezing the page.
|
|
12134
|
+
useOverlayBodyLockRelease(open);
|
|
12096
12135
|
return (jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxs(DialogContent, { className: "gap-3 p-5", children: [jsxs(DialogHeader, { className: "gap-1.5", children: [jsxs(DialogTitle, { className: "flex items-center gap-2", children: [confirmVariant === 'destructive' && (jsx("span", { className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-destructive/10", children: jsx(Icon, { className: "h-3.5 w-3.5 text-destructive" }) })), jsx("span", { children: title })] }), description && jsx(DialogDescription, { children: description }), info && (jsx(InfoCard, { info: info, title: title, refundToWallet: refundToWallet, onRefundChange: setRefundToWallet }))] }), jsxs(DialogFooter, { className: "mt-1", children: [jsx(Button$1, { variant: "outline", onClick: () => {
|
|
12097
12136
|
onCancel?.();
|
|
12098
12137
|
onOpenChange(false);
|
|
@@ -28576,6 +28615,8 @@ const SIZE_WIDTH = {
|
|
|
28576
28615
|
*/
|
|
28577
28616
|
function Modal({ open, onClose, title, icon, children, footer, size = 'md', hideCloseButton = false, className, bodyClassName, }) {
|
|
28578
28617
|
const maxWidth = SIZE_WIDTH[size];
|
|
28618
|
+
// See ConfirmDialog: overlapping dismissable layers leak the <body> lock.
|
|
28619
|
+
useOverlayBodyLockRelease(open);
|
|
28579
28620
|
return (jsx(Dialog, { open: open, onOpenChange: (o) => !o && onClose(), children: jsxs(DialogContent, { hideCloseButton: true, style: {
|
|
28580
28621
|
width: `min(${maxWidth}px, calc(100vw - 2rem))`,
|
|
28581
28622
|
maxWidth: `${maxWidth}px`,
|
|
@@ -67812,5 +67853,5 @@ var RichTextAreaImpl = /*#__PURE__*/Object.freeze({
|
|
|
67812
67853
|
RichTextarea: RichTextarea
|
|
67813
67854
|
});
|
|
67814
67855
|
|
|
67815
|
-
export { ActionBadge, ActionButtonWithTooltip, AdvancedSearchDrawer, Alert, ApiComboBox, AppSidebar, AuditEntryCard, AuditHistoryPanel, AuditTimeline, AuditTimelineShimmer, Badge, BadgeType, BusinessContactStatusFilter, Button, CUSTOMER_AUDIT_CONFIG, CertificateRowList, ChangePill, Collapsible, CollapsibleCard, CollapsibleContent, CollapsibleTrigger, ConfirmDialog, ContactTypeFilter, CopyButton, CreateFormPageHeader, CreateFormPageShell, CurrencyDisplayTabs, CurrencyInput, CurrencyToggle, CustomCombobox, CustomTable, CustomizeColumnsDrawer, DIAMOND_AUDIT_CONFIG, DashboardShell, DataEditableTable, DataTable, DateInput, DetailChip, DetailPageLayout, DetailPageSkeleton, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EntityHeader, Field, FieldSkeleton, FileUploader, FilterMultiSelect, FilterSelect, FormSectionCard, FormSectionCardSkeleton, GEM_AUDIT_CONFIG, HistoryEntryCard, HistoryTimeline, HistoryTimelineShimmer, INVOICE_AUDIT_CONFIG, IconButton, IdHyperlinkText, InfoBanner, InventoryComboBox, InventoryItemCard, InventoryItemRow, InvoiceComboBox, KYCStatusFilter, KeyValueGrid, LAYOUT_AUDIT_CONFIG, LabeledToggle, MEMO_IN_AUDIT_CONFIG, MEMO_OUT_AUDIT_CONFIG, MediaGallery, MemoInComboBox, MetricCard, MetricRow, MetricTile, Modal, MoreInfoPanel, MoreInfoTrigger, Navbar, NavbarActions, NavbarAvatar, NavbarIconButton, NavbarSearch, NavbarTitle, NumberInput, NumberedStepCard, OtpInput, OwnershipFilter, OwnershipSplitCard, PROFORMA_AUDIT_CONFIG, PageHeader, PageTabs, Pagination, PaginationSelect, PartnerShareCard, PriceInput, Protected, PurchaseOrderComboBox, QUOTATION_AUDIT_CONFIG, RadioCardGroup, ReadMoreText, RefreshButton, RichTextarea$1 as RichTextarea, SEARCHABLE_SELECT_PAGE_SIZE, SafeImage, SearchBox, SearchInput, SearchableSelect, SectionCard, SectionIcon, SegmentedControl, ShareDialog, ShareMenu, ShimmerTable, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SlideOut, SlideOutClose, SlideOutContent, SlideOutDescription, SlideOutHeader, SlideOutOverlay, SlideOutPortal, SlideOutTitle, SlideOutTrigger, Slider, SpecList, Spinner, SquareSkeleton, StatusBadge$1 as StatusBadge, StatusFilter, Stepper, StockTypeFilter, TablePagination, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, TextHyperlink, TimePicker, ToggleSwitch, TruncateTooltip, WarehouseComboBox, WarehouseFilter, ZoomSplitViewer, badgeVariants, buildBulkShareTitle, buildInventoryPublicUrl, buildInventoryRowProps, buildInventoryShareTitle, buildWhatsappUrl, buttonVariants, cn, createVideoMediaItem, dropdownMenuItemDestructiveClass, formatFileSize, generateActionDescription, generateTitle, getBadgeTypeForStatus, getChangePills, getInitials, iconButtonVariants, isPathActive, notify, releaseStaleOverlayBodyLock, renderBadge, useAuditShowMore, useBadge, useButton, useDropdownMenu, useNavbar, useSidebar, videoThumbnailSrc };
|
|
67856
|
+
export { ActionBadge, ActionButtonWithTooltip, AdvancedSearchDrawer, Alert, ApiComboBox, AppSidebar, AuditEntryCard, AuditHistoryPanel, AuditTimeline, AuditTimelineShimmer, Badge, BadgeType, BusinessContactStatusFilter, Button, CUSTOMER_AUDIT_CONFIG, CertificateRowList, ChangePill, Collapsible, CollapsibleCard, CollapsibleContent, CollapsibleTrigger, ConfirmDialog, ContactTypeFilter, CopyButton, CreateFormPageHeader, CreateFormPageShell, CurrencyDisplayTabs, CurrencyInput, CurrencyToggle, CustomCombobox, CustomTable, CustomizeColumnsDrawer, DIAMOND_AUDIT_CONFIG, DashboardShell, DataEditableTable, DataTable, DateInput, DetailChip, DetailPageLayout, DetailPageSkeleton, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EntityHeader, Field, FieldSkeleton, FileUploader, FilterMultiSelect, FilterSelect, FormSectionCard, FormSectionCardSkeleton, GEM_AUDIT_CONFIG, HistoryEntryCard, HistoryTimeline, HistoryTimelineShimmer, INVOICE_AUDIT_CONFIG, IconButton, IdHyperlinkText, InfoBanner, InventoryComboBox, InventoryItemCard, InventoryItemRow, InvoiceComboBox, KYCStatusFilter, KeyValueGrid, LAYOUT_AUDIT_CONFIG, LabeledToggle, MEMO_IN_AUDIT_CONFIG, MEMO_OUT_AUDIT_CONFIG, MediaGallery, MemoInComboBox, MetricCard, MetricRow, MetricTile, Modal, MoreInfoPanel, MoreInfoTrigger, Navbar, NavbarActions, NavbarAvatar, NavbarIconButton, NavbarSearch, NavbarTitle, NumberInput, NumberedStepCard, OtpInput, OwnershipFilter, OwnershipSplitCard, PROFORMA_AUDIT_CONFIG, PageHeader, PageTabs, Pagination, PaginationSelect, PartnerShareCard, PriceInput, Protected, PurchaseOrderComboBox, QUOTATION_AUDIT_CONFIG, RadioCardGroup, ReadMoreText, RefreshButton, RichTextarea$1 as RichTextarea, SEARCHABLE_SELECT_PAGE_SIZE, SafeImage, SearchBox, SearchInput, SearchableSelect, SectionCard, SectionIcon, SegmentedControl, ShareDialog, ShareMenu, ShimmerTable, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SlideOut, SlideOutClose, SlideOutContent, SlideOutDescription, SlideOutHeader, SlideOutOverlay, SlideOutPortal, SlideOutTitle, SlideOutTrigger, Slider, SpecList, Spinner, SquareSkeleton, StatusBadge$1 as StatusBadge, StatusFilter, Stepper, StockTypeFilter, TablePagination, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, TextHyperlink, TimePicker, ToggleSwitch, TruncateTooltip, WarehouseComboBox, WarehouseFilter, ZoomSplitViewer, badgeVariants, buildBulkShareTitle, buildInventoryPublicUrl, buildInventoryRowProps, buildInventoryShareTitle, buildWhatsappUrl, buttonVariants, cn, createVideoMediaItem, dropdownMenuItemDestructiveClass, formatFileSize, generateActionDescription, generateTitle, getBadgeTypeForStatus, getChangePills, getInitials, iconButtonVariants, isPathActive, notify, releaseStaleOverlayBodyLock, renderBadge, useAuditShowMore, useBadge, useButton, useDropdownMenu, useNavbar, useSidebar, videoThumbnailSrc, watchOverlayBodyLock };
|
|
67816
67857
|
//# sourceMappingURL=index.esm.js.map
|