@caratlogic/design-system 0.1.30 → 0.1.32

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.
Files changed (39) hide show
  1. package/dist/components/atoms/NumberInput/NumberInput.d.ts.map +1 -1
  2. package/dist/components/atoms/NumberInput/NumberInput.types.d.ts +4 -0
  3. package/dist/components/atoms/NumberInput/NumberInput.types.d.ts.map +1 -1
  4. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
  5. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.parts.d.ts +1 -0
  6. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.parts.d.ts.map +1 -1
  7. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.types.d.ts +5 -11
  8. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.types.d.ts.map +1 -1
  9. package/dist/components/molecules/DocumentDeleteDialog/DocumentDeleteDialog.d.ts +1 -1
  10. package/dist/components/molecules/DocumentDeleteDialog/DocumentDeleteDialog.d.ts.map +1 -1
  11. package/dist/components/molecules/DocumentHero/DocumentHero.d.ts +4 -4
  12. package/dist/components/molecules/DocumentHero/DocumentHero.d.ts.map +1 -1
  13. package/dist/components/molecules/DocumentHero/DocumentHero.types.d.ts +48 -41
  14. package/dist/components/molecules/DocumentHero/DocumentHero.types.d.ts.map +1 -1
  15. package/dist/components/molecules/DocumentHero/DocumentHero.utils.d.ts +7 -16
  16. package/dist/components/molecules/DocumentHero/DocumentHero.utils.d.ts.map +1 -1
  17. package/dist/components/molecules/DocumentHero/index.d.ts +1 -1
  18. package/dist/components/molecules/DocumentHero/index.d.ts.map +1 -1
  19. package/dist/components/molecules/Modal/Modal.d.ts +1 -1
  20. package/dist/components/molecules/Modal/Modal.d.ts.map +1 -1
  21. package/dist/components/molecules/Modal/Modal.types.d.ts +9 -3
  22. package/dist/components/molecules/Modal/Modal.types.d.ts.map +1 -1
  23. package/dist/components/molecules/Skeletons/Skeletons.d.ts +1 -1
  24. package/dist/components/molecules/Skeletons/Skeletons.d.ts.map +1 -1
  25. package/dist/components/organisms/FileUploader/ImageCropModal.d.ts.map +1 -1
  26. package/dist/components/ui/button.d.ts.map +1 -1
  27. package/dist/components/ui/dialog.d.ts +23 -2
  28. package/dist/components/ui/dialog.d.ts.map +1 -1
  29. package/dist/index.cjs.js +310 -251
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.esm.js +311 -252
  32. package/dist/index.esm.js.map +1 -1
  33. package/dist/ui.cjs.js +60 -14
  34. package/dist/ui.cjs.js.map +1 -1
  35. package/dist/ui.esm.js +59 -15
  36. package/dist/ui.esm.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.hooks.d.ts +0 -3
  39. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.hooks.d.ts.map +0 -1
package/dist/ui.esm.js CHANGED
@@ -2868,7 +2868,7 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
2868
2868
  });
2869
2869
  function Button({ className, variant, size, asChild = false, ...props }) {
2870
2870
  const Comp = asChild ? Slot : 'button';
2871
- return (jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
2871
+ return (jsx(Comp, { "data-slot": "button", "data-variant": variant ?? 'default', className: cn(buttonVariants({ variant, size, className })), ...props }));
2872
2872
  }
2873
2873
 
2874
2874
  function Card({ className, ...props }) {
@@ -2993,30 +2993,74 @@ const DialogOverlay = t.forwardRef(({ className, ...props }, ref) => (jsx(Dialog
2993
2993
  'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ' +
2994
2994
  'fixed inset-0 z-50 bg-black/50', className), ...props })));
2995
2995
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
2996
- const DialogContent = t.forwardRef(({ className, children, hideCloseButton, ...props }, ref) => (jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, { ref: ref, "data-slot": "dialog-content", className: cn('bg-background fixed top-[50%] left-[50%] z-50 grid ' +
2997
- 'w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] ' +
2998
- 'gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg ' +
2996
+ const DIALOG_WIDTH = {
2997
+ default: '32rem',
2998
+ wide: '50rem',
2999
+ };
3000
+ /** Every dialog stops growing here; taller content scrolls inside it. */
3001
+ const DIALOG_MAX_HEIGHT = 'min(85vh, 45rem)';
3002
+ const DialogContent = t.forwardRef(({ className, children, hideCloseButton, size = 'default', style, ...props }, ref) => (jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, { ref: ref, "data-slot": "dialog-content", className: cn('bg-card fixed top-[50%] left-[50%] z-50 grid ' +
3003
+ 'translate-x-[-50%] translate-y-[-50%] ' +
3004
+ 'gap-4 overflow-y-auto overscroll-contain rounded-2xl border border-border p-6 shadow-xl duration-200 ' +
3005
+ // A footer closes the panel itself; sticky can't sit in the padding a negative margin would bleed into.
3006
+ 'has-[[data-slot=dialog-footer]]:pb-0 ' +
2999
3007
  'data-[state=open]:animate-in data-[state=closed]:animate-out ' +
3000
3008
  'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ' +
3001
- 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', className), ...props, children: [children, !hideCloseButton && (jsxs(DialogPrimitive.Close, { className: cn('absolute top-4 right-4 rounded-xs opacity-70 transition-opacity ' +
3002
- 'hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring ' +
3003
- 'focus:ring-offset-2 ring-offset-background disabled:pointer-events-none ' +
3004
- '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +
3009
+ 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', className), style: {
3010
+ ...style,
3011
+ width: 'calc(100vw - 2rem)',
3012
+ maxWidth: DIALOG_WIDTH[size],
3013
+ maxHeight: DIALOG_MAX_HEIGHT,
3014
+ }, ...props, children: [children, !hideCloseButton && (jsxs(DialogPrimitive.Close, { className: cn('absolute top-5 right-5 inline-flex size-7 items-center justify-center rounded-md ' +
3015
+ 'text-muted-foreground transition-colors hover:bg-muted hover:text-foreground ' +
3016
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ' +
3017
+ 'disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 ' +
3005
3018
  "[&_svg:not([class*='size-'])]:size-4"), children: [jsx(X$1, {}), jsx("span", { className: "sr-only", children: "Close" })] }))] })] })));
3006
3019
  DialogContent.displayName = DialogPrimitive.Content.displayName;
3007
- // Header
3008
- function DialogHeader({ className, ...props }) {
3009
- return (jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
3020
+ const DIALOG_ICON_TONE = {
3021
+ primary: 'bg-primary/10 text-primary dark:bg-primary/20',
3022
+ neutral: 'bg-muted text-muted-foreground',
3023
+ warning: 'bg-badge-amber-bg text-badge-amber-text',
3024
+ destructive: 'bg-badge-destructive-bg text-destructive',
3025
+ };
3026
+ /** The tinted tile that names a dialog's action; shared by every dialog header. */
3027
+ function DialogIcon({ tone = 'primary', className, children, }) {
3028
+ return (jsx("span", { "aria-hidden": true, className: cn(
3029
+ // 44px = the title's 24px line + the subtitle's 20px line, so the tile spans both.
3030
+ 'flex size-11 shrink-0 items-center justify-center rounded-lg [&_svg]:size-5', DIALOG_ICON_TONE[tone], className), children: children }));
3031
+ }
3032
+ function DialogHeader({ className, icon, iconTone, children, ...props }) {
3033
+ if (icon) {
3034
+ return (jsxs("div", { "data-slot": "dialog-header",
3035
+ // A lone title centres on the icon; with a subtitle the pair starts at the icon's top.
3036
+ className: cn('flex flex-row items-center gap-3.5 pr-8 text-left has-[[data-slot=dialog-description]]:items-start', className), ...props, children: [jsx(DialogIcon, { tone: iconTone, children: icon }), jsx("div", { className: "flex min-w-0 flex-1 flex-col", children: children })] }));
3037
+ }
3038
+ return (jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col pr-8 text-left', className), ...props, children: children }));
3010
3039
  }
3011
3040
  // Footer
3041
+ /** Neutral footer buttons get the card surface so they stand out from the tinted footer band. */
3042
+ const DIALOG_FOOTER_BUTTONS = '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:border ' +
3043
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:border-border ' +
3044
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:bg-card ' +
3045
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:shadow-xs ' +
3046
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:hover:bg-muted ' +
3047
+ // The outline variant forces its own dark fill; keep every footer secondary button on the same card surface.
3048
+ 'dark:[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:!bg-card ' +
3049
+ 'dark:[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:!border-border ' +
3050
+ 'dark:[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:hover:!bg-muted';
3012
3051
  function DialogFooter({ className, ...props }) {
3013
- return (jsx("div", { "data-slot": "dialog-footer", className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props }));
3052
+ return (jsx("div", { "data-slot": "dialog-footer",
3053
+ // Bleeds to the dialog's side edges as a tinted band; dialogs that drop the default p-6 reset the margins.
3054
+ className: cn(
3055
+ // Sticky so the actions stay in view while a long body scrolls.
3056
+ 'sticky bottom-0 z-10 -mx-6 mt-1 flex shrink-0 flex-col-reverse gap-2 border-t border-border bg-[color-mix(in_srgb,var(--muted)_40%,var(--card))] px-6 py-4 ' +
3057
+ 'sm:flex-row sm:items-center sm:justify-end', DIALOG_FOOTER_BUTTONS, className), ...props }));
3014
3058
  }
3015
3059
  // Title
3016
- const DialogTitle = t.forwardRef(({ className, ...props }, ref) => (jsx(DialogPrimitive.Title, { ref: ref, "data-slot": "dialog-title", className: cn('text-lg font-semibold leading-none', className), ...props })));
3060
+ const DialogTitle = t.forwardRef(({ className, ...props }, ref) => (jsx(DialogPrimitive.Title, { ref: ref, "data-slot": "dialog-title", className: cn('text-lg font-semibold leading-6 text-foreground', className), ...props })));
3017
3061
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
3018
3062
  // Description
3019
- const DialogDescription = t.forwardRef(({ className, ...props }, ref) => (jsx(DialogPrimitive.Description, { ref: ref, "data-slot": "dialog-description", className: cn('text-sm text-muted-foreground', className), ...props })));
3063
+ const DialogDescription = t.forwardRef(({ className, ...props }, ref) => (jsx(DialogPrimitive.Description, { ref: ref, "data-slot": "dialog-description", className: cn('text-sm leading-5 text-muted-foreground', className), ...props })));
3020
3064
  DialogDescription.displayName = DialogPrimitive.Description.displayName;
3021
3065
 
3022
3066
  // ---------- Command Wrapper ----------
@@ -3422,5 +3466,5 @@ collisionPadding = 8, ...props }, ref) {
3422
3466
  animate-in fade-in-0 zoom-in-95 ${className || ''}`, ...props }) }));
3423
3467
  });
3424
3468
 
3425
- export { Alert, AlertDescription, AlertRoot, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, Label, MultiSelect, MultiSelectContent, MultiSelectGroup, MultiSelectItem, MultiSelectSeparator, MultiSelectTrigger, MultiSelectValue, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants };
3469
+ export { Alert, AlertDescription, AlertRoot, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DIALOG_FOOTER_BUTTONS, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogIcon, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, Label, MultiSelect, MultiSelectContent, MultiSelectGroup, MultiSelectItem, MultiSelectSeparator, MultiSelectTrigger, MultiSelectValue, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Textarea, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buttonVariants };
3426
3470
  //# sourceMappingURL=ui.esm.js.map