@caratlogic/design-system 0.1.6 → 0.1.8
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/layouts/AppShell/DashboardShell.d.ts.map +1 -1
- package/dist/components/molecules/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/molecules/Modal/Modal.d.ts.map +1 -1
- package/dist/components/molecules/Sidebar/Sidebar.parts.d.ts.map +1 -1
- package/dist/index.cjs.js +97 -6
- 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 +97 -7
- 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":"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CAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yCAAyC,CAAC;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`,
|
|
@@ -57408,7 +57449,11 @@ const SidebarInset = React.forwardRef(({ className, ...props }, ref) => (jsx("ma
|
|
|
57408
57449
|
SidebarInset.displayName = 'SidebarInset';
|
|
57409
57450
|
const SidebarInput = React.forwardRef(({ className, ...props }, ref) => (jsx("input", { ref: ref, "data-sidebar": "input", className: cn('h-8 w-full bg-background text-sm shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring', className), ...props })));
|
|
57410
57451
|
SidebarInput.displayName = 'SidebarInput';
|
|
57411
|
-
const SidebarHeader = React.forwardRef(({ className, ...props }, ref) => (jsx("div", { ref: ref, "data-sidebar": "header",
|
|
57452
|
+
const SidebarHeader = React.forwardRef(({ className, ...props }, ref) => (jsx("div", { ref: ref, "data-sidebar": "header",
|
|
57453
|
+
/* Icon mode drops the asymmetric pl-4/pr-1 (which is there for the expanded
|
|
57454
|
+
brand + collapse button row) so a centred brand lands on the same axis as
|
|
57455
|
+
the nav icons below it. */
|
|
57456
|
+
className: cn('flex flex-col gap-2 pr-1 pt-3 pb-4 pl-4 group-data-[collapsible=icon]:px-0', className), ...props })));
|
|
57412
57457
|
SidebarHeader.displayName = 'SidebarHeader';
|
|
57413
57458
|
const SidebarFooter = React.forwardRef(({ className, ...props }, ref) => (jsx("div", { ref: ref, "data-sidebar": "footer", className: cn('flex flex-col gap-2 pr-1 py-4 pl-4', className), ...props })));
|
|
57414
57459
|
SidebarFooter.displayName = 'SidebarFooter';
|
|
@@ -57434,6 +57479,21 @@ const SidebarMenu = React.forwardRef(({ className, ...props }, ref) => (jsx("ul"
|
|
|
57434
57479
|
SidebarMenu.displayName = 'SidebarMenu';
|
|
57435
57480
|
const SidebarMenuItem = React.forwardRef(({ className, ...props }, ref) => (jsx("li", { ref: ref, "data-sidebar": "menu-item", className: cn('group/menu-item relative', className), ...props })));
|
|
57436
57481
|
SidebarMenuItem.displayName = 'SidebarMenuItem';
|
|
57482
|
+
/**
|
|
57483
|
+
* Owns a nav tooltip's open state so every tooltip closes when the sidebar
|
|
57484
|
+
* expands or collapses. The width transition slides buttons out from under a
|
|
57485
|
+
* stationary pointer without firing `pointerleave`, so Radix otherwise keeps
|
|
57486
|
+
* each tooltip it opened on the way in — they surface together the moment the
|
|
57487
|
+
* rail renders them, and only a fresh hover dismisses them one by one.
|
|
57488
|
+
*/
|
|
57489
|
+
const useSidebarTooltipOpen = () => {
|
|
57490
|
+
const { state } = useSidebar();
|
|
57491
|
+
const [open, setOpen] = React.useState(false);
|
|
57492
|
+
React.useEffect(() => {
|
|
57493
|
+
setOpen(false);
|
|
57494
|
+
}, [state]);
|
|
57495
|
+
return { open, setOpen };
|
|
57496
|
+
};
|
|
57437
57497
|
const sidebarMenuButtonVariants = cva('peer/menu-button relative flex h-9 w-full cursor-pointer items-center gap-2 overflow-hidden rounded-sm px-2.5 py-1.5 text-left text-sm text-sidebar-foreground outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-active-bg data-[active=true]:text-sidebar-foreground data-[state=open]:hover:bg-sidebar-active-bg data-[state=open]:hover:text-sidebar-foreground group-data-[collapsible=icon]:!size-9 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:[&>span]:hidden [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0', {
|
|
57438
57498
|
variants: {
|
|
57439
57499
|
variant: {
|
|
@@ -57456,13 +57516,15 @@ const SidebarMenuButton = React.forwardRef(({ asChild = false, isActive = false,
|
|
|
57456
57516
|
const { state } = useSidebar();
|
|
57457
57517
|
const [innerRef, setRef] = useForwardedRef(ref);
|
|
57458
57518
|
const truncatedText = useTruncatedText(innerRef);
|
|
57519
|
+
const { open: tooltipOpen, setOpen: setTooltipOpen } = useSidebarTooltipOpen();
|
|
57459
57520
|
const button = (jsx(Comp, { ref: setRef, "data-sidebar": "menu-button", "data-size": size, "data-active": isActive, className: cn(sidebarMenuButtonVariants({ variant, size }), className), ...props }));
|
|
57460
57521
|
// Tooltip when collapsed (icon-only) OR when the expanded label is clipped.
|
|
57461
57522
|
// The Tooltip structure stays mounted and only the content is conditional,
|
|
57462
57523
|
// so toggling it never remounts the button.
|
|
57463
57524
|
const collapsed = !!tooltip && state === 'collapsed';
|
|
57464
57525
|
const collapsedProps = typeof tooltip === 'string' ? { children: tooltip } : tooltip;
|
|
57465
|
-
|
|
57526
|
+
const tooltipContent = collapsed ? (jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, ...collapsedProps })) : truncatedText ? (jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText })) : null;
|
|
57527
|
+
return (jsxs(Tooltip, { open: !!tooltipContent && tooltipOpen, onOpenChange: setTooltipOpen, children: [jsx(TooltipTrigger, { asChild: true, children: button }), tooltipContent] }));
|
|
57466
57528
|
});
|
|
57467
57529
|
SidebarMenuButton.displayName = 'SidebarMenuButton';
|
|
57468
57530
|
const SidebarMenuAction = React.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
@@ -57486,9 +57548,10 @@ const SidebarMenuSubButton = React.forwardRef(({ asChild = false, size = 'md', i
|
|
|
57486
57548
|
const Comp = asChild ? Slot : 'a';
|
|
57487
57549
|
const [innerRef, setRef] = useForwardedRef(ref);
|
|
57488
57550
|
const truncatedText = useTruncatedText(innerRef);
|
|
57551
|
+
const { open: tooltipOpen, setOpen: setTooltipOpen } = useSidebarTooltipOpen();
|
|
57489
57552
|
const button = (jsx(Comp, { ref: setRef, "data-sidebar": "menu-sub-button", "data-size": size, "data-active": isActive, className: cn('relative flex h-9 w-full min-w-0 cursor-pointer items-center gap-2 overflow-hidden rounded-sm pl-3 pr-1 py-1.5 text-left text-sidebar-foreground/80 outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span]:truncate [&>svg]:size-4 [&>svg]:shrink-0', 'data-[active=true]:bg-sidebar-primary data-[active=true]:text-sidebar-primary-foreground', size === 'sm' && 'text-xs', size === 'md' && 'text-sm', 'group-data-[collapsible=icon]:hidden', className), ...props }));
|
|
57490
57553
|
// Keep the Tooltip mounted; render the content only when the label is clipped.
|
|
57491
|
-
return (jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: button }), truncatedText && (jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText }))] }));
|
|
57554
|
+
return (jsxs(Tooltip, { open: !!truncatedText && tooltipOpen, onOpenChange: setTooltipOpen, children: [jsx(TooltipTrigger, { asChild: true, children: button }), truncatedText && (jsx(TooltipContent, { side: "right", align: "center", className: TRUNCATION_TOOLTIP_CLASS, children: truncatedText }))] }));
|
|
57492
57555
|
});
|
|
57493
57556
|
SidebarMenuSubButton.displayName = 'SidebarMenuSubButton';
|
|
57494
57557
|
const Collapsible = CollapsiblePrimitive.Root;
|
|
@@ -65758,6 +65821,15 @@ const DEFAULT_SIDEBAR_WIDTH = '248px';
|
|
|
65758
65821
|
/** Green pill marking the active top-level item. Rendered in-flow as the row's
|
|
65759
65822
|
* first flex child (hidden when the sidebar collapses to icons). */
|
|
65760
65823
|
const ActiveRail = () => (jsx("span", { "aria-hidden": "true", className: "pointer-events-none h-9 w-[4px] shrink-0 rounded-full bg-sidebar-primary group-data-[collapsible=icon]:hidden" }));
|
|
65824
|
+
/** Collapsed, the rail is also the way back into the menu: clicking any nav
|
|
65825
|
+
* item opens the sidebar, not just the brand. */
|
|
65826
|
+
const useCollapsedSidebar = () => {
|
|
65827
|
+
const { state, isMobile, setOpen } = useSidebar();
|
|
65828
|
+
return {
|
|
65829
|
+
collapsed: !isMobile && state === 'collapsed',
|
|
65830
|
+
expandSidebar: () => setOpen(true),
|
|
65831
|
+
};
|
|
65832
|
+
};
|
|
65761
65833
|
const BrandHeader = ({ brand }) => {
|
|
65762
65834
|
const { state, isMobile, openMobile, toggleSidebar } = useSidebar();
|
|
65763
65835
|
const expanded = state === 'expanded' || (isMobile && openMobile);
|
|
@@ -65769,13 +65841,31 @@ const BrandHeader = ({ brand }) => {
|
|
|
65769
65841
|
const NavLeaf = ({ item, currentPath, onNavigate }) => {
|
|
65770
65842
|
const Icon = item.icon;
|
|
65771
65843
|
const active = isPathActive(currentPath, item.path);
|
|
65772
|
-
|
|
65844
|
+
const { collapsed, expandSidebar } = useCollapsedSidebar();
|
|
65845
|
+
return (jsxs(SidebarMenuItem, { className: cn(active && 'flex items-center gap-1.5 group-data-[collapsible=icon]:block'), children: [active && jsx(ActiveRail, {}), jsxs(SidebarMenuButton, { isActive: active, tooltip: item.label, onClick: () => {
|
|
65846
|
+
if (collapsed)
|
|
65847
|
+
expandSidebar();
|
|
65848
|
+
if (item.path)
|
|
65849
|
+
onNavigate(item.path);
|
|
65850
|
+
}, className: cn(active && 'min-w-0 flex-1 group-data-[collapsible=icon]:flex-none'), children: [Icon && jsx(Icon, {}), jsx("span", { children: item.label })] }), item.badge != null && (jsx(SidebarMenuBadge, { className: "h-5 w-5 min-w-5 rounded-full border border-primary bg-primary/10 p-0 text-primary", children: item.badge }))] }));
|
|
65773
65851
|
};
|
|
65774
65852
|
const NavParent = ({ item, currentPath, onNavigate }) => {
|
|
65775
65853
|
const Icon = item.icon;
|
|
65776
65854
|
const children = (item.children ?? []).filter((s) => s.visible !== false);
|
|
65777
65855
|
const parentActive = children.some((s) => isPathActive(currentPath, s.path));
|
|
65778
|
-
|
|
65856
|
+
const { collapsed, expandSidebar } = useCollapsedSidebar();
|
|
65857
|
+
const [open, setOpen] = useState(parentActive);
|
|
65858
|
+
// Collapsed, the sub-menu is hidden, so a click opens the sidebar and this
|
|
65859
|
+
// group instead of silently toggling something the user cannot see.
|
|
65860
|
+
const handleOpenChange = (next) => {
|
|
65861
|
+
if (!collapsed) {
|
|
65862
|
+
setOpen(next);
|
|
65863
|
+
return;
|
|
65864
|
+
}
|
|
65865
|
+
expandSidebar();
|
|
65866
|
+
setOpen(true);
|
|
65867
|
+
};
|
|
65868
|
+
return (jsx(Collapsible, { asChild: true, open: open, onOpenChange: handleOpenChange, children: jsxs(SidebarMenuItem, { className: "group/collapsible", children: [jsxs("div", { className: cn(parentActive &&
|
|
65779
65869
|
'flex items-center gap-1.5 group-data-[collapsible=icon]:block'), children: [parentActive && jsx(ActiveRail, {}), jsx(CollapsibleTrigger, { asChild: true, children: jsxs(SidebarMenuButton, { isActive: parentActive, tooltip: item.label, className: cn(parentActive &&
|
|
65780
65870
|
'min-w-0 flex-1 group-data-[collapsible=icon]:flex-none'), children: [Icon && jsx(Icon, {}), jsx("span", { children: item.label }), jsx(ChevronRight, { className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90 group-data-[collapsible=icon]:hidden" })] }) })] }), jsx(CollapsibleContent, { children: jsx(SidebarMenuSub, { children: children.map((sub) => {
|
|
65781
65871
|
const SubIcon = sub.icon;
|
|
@@ -67812,5 +67902,5 @@ var RichTextAreaImpl = /*#__PURE__*/Object.freeze({
|
|
|
67812
67902
|
RichTextarea: RichTextarea
|
|
67813
67903
|
});
|
|
67814
67904
|
|
|
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 };
|
|
67905
|
+
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
67906
|
//# sourceMappingURL=index.esm.js.map
|