@caratlogic/design-system 0.1.31 → 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 (29) 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/Modal/Modal.d.ts +1 -1
  12. package/dist/components/molecules/Modal/Modal.d.ts.map +1 -1
  13. package/dist/components/molecules/Modal/Modal.types.d.ts +9 -3
  14. package/dist/components/molecules/Modal/Modal.types.d.ts.map +1 -1
  15. package/dist/components/organisms/FileUploader/ImageCropModal.d.ts.map +1 -1
  16. package/dist/components/ui/button.d.ts.map +1 -1
  17. package/dist/components/ui/dialog.d.ts +23 -2
  18. package/dist/components/ui/dialog.d.ts.map +1 -1
  19. package/dist/index.cjs.js +231 -174
  20. package/dist/index.cjs.js.map +1 -1
  21. package/dist/index.esm.js +232 -175
  22. package/dist/index.esm.js.map +1 -1
  23. package/dist/ui.cjs.js +60 -14
  24. package/dist/ui.cjs.js.map +1 -1
  25. package/dist/ui.esm.js +59 -15
  26. package/dist/ui.esm.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.hooks.d.ts +0 -3
  29. package/dist/components/molecules/ConfirmDialog/ConfirmDialog.hooks.d.ts.map +0 -1
package/dist/ui.cjs.js CHANGED
@@ -2895,7 +2895,7 @@ const buttonVariants = cva("inline-flex items-center justify-center gap-2 whites
2895
2895
  });
2896
2896
  function Button({ className, variant, size, asChild = false, ...props }) {
2897
2897
  const Comp = asChild ? reactSlot.Slot : 'button';
2898
- return (jsxRuntime.jsx(Comp, { "data-slot": "button", className: cn(buttonVariants({ variant, size, className })), ...props }));
2898
+ return (jsxRuntime.jsx(Comp, { "data-slot": "button", "data-variant": variant ?? 'default', className: cn(buttonVariants({ variant, size, className })), ...props }));
2899
2899
  }
2900
2900
 
2901
2901
  function Card({ className, ...props }) {
@@ -3020,30 +3020,74 @@ const DialogOverlay = t__namespace.forwardRef(({ className, ...props }, ref) =>
3020
3020
  'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ' +
3021
3021
  'fixed inset-0 z-50 bg-black/50', className), ...props })));
3022
3022
  DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
3023
- const DialogContent = t__namespace.forwardRef(({ className, children, hideCloseButton, ...props }, ref) => (jsxRuntime.jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsxRuntime.jsx(DialogOverlay, {}), jsxRuntime.jsxs(DialogPrimitive__namespace.Content, { ref: ref, "data-slot": "dialog-content", className: cn('bg-background fixed top-[50%] left-[50%] z-50 grid ' +
3024
- 'w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] ' +
3025
- 'gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg ' +
3023
+ const DIALOG_WIDTH = {
3024
+ default: '32rem',
3025
+ wide: '50rem',
3026
+ };
3027
+ /** Every dialog stops growing here; taller content scrolls inside it. */
3028
+ const DIALOG_MAX_HEIGHT = 'min(85vh, 45rem)';
3029
+ const DialogContent = t__namespace.forwardRef(({ className, children, hideCloseButton, size = 'default', style, ...props }, ref) => (jsxRuntime.jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsxRuntime.jsx(DialogOverlay, {}), jsxRuntime.jsxs(DialogPrimitive__namespace.Content, { ref: ref, "data-slot": "dialog-content", className: cn('bg-card fixed top-[50%] left-[50%] z-50 grid ' +
3030
+ 'translate-x-[-50%] translate-y-[-50%] ' +
3031
+ 'gap-4 overflow-y-auto overscroll-contain rounded-2xl border border-border p-6 shadow-xl duration-200 ' +
3032
+ // A footer closes the panel itself; sticky can't sit in the padding a negative margin would bleed into.
3033
+ 'has-[[data-slot=dialog-footer]]:pb-0 ' +
3026
3034
  'data-[state=open]:animate-in data-[state=closed]:animate-out ' +
3027
3035
  'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 ' +
3028
- 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', className), ...props, children: [children, !hideCloseButton && (jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: cn('absolute top-4 right-4 rounded-xs opacity-70 transition-opacity ' +
3029
- 'hover:opacity-100 focus:outline-hidden focus:ring-2 focus:ring-ring ' +
3030
- 'focus:ring-offset-2 ring-offset-background disabled:pointer-events-none ' +
3031
- '[&_svg]:pointer-events-none [&_svg]:shrink-0 ' +
3036
+ 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', className), style: {
3037
+ ...style,
3038
+ width: 'calc(100vw - 2rem)',
3039
+ maxWidth: DIALOG_WIDTH[size],
3040
+ maxHeight: DIALOG_MAX_HEIGHT,
3041
+ }, ...props, children: [children, !hideCloseButton && (jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: cn('absolute top-5 right-5 inline-flex size-7 items-center justify-center rounded-md ' +
3042
+ 'text-muted-foreground transition-colors hover:bg-muted hover:text-foreground ' +
3043
+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ' +
3044
+ 'disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 ' +
3032
3045
  "[&_svg:not([class*='size-'])]:size-4"), children: [jsxRuntime.jsx(X$1, {}), jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })] }))] })] })));
3033
3046
  DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
3034
- // Header
3035
- function DialogHeader({ className, ...props }) {
3036
- return (jsxRuntime.jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
3047
+ const DIALOG_ICON_TONE = {
3048
+ primary: 'bg-primary/10 text-primary dark:bg-primary/20',
3049
+ neutral: 'bg-muted text-muted-foreground',
3050
+ warning: 'bg-badge-amber-bg text-badge-amber-text',
3051
+ destructive: 'bg-badge-destructive-bg text-destructive',
3052
+ };
3053
+ /** The tinted tile that names a dialog's action; shared by every dialog header. */
3054
+ function DialogIcon({ tone = 'primary', className, children, }) {
3055
+ return (jsxRuntime.jsx("span", { "aria-hidden": true, className: cn(
3056
+ // 44px = the title's 24px line + the subtitle's 20px line, so the tile spans both.
3057
+ 'flex size-11 shrink-0 items-center justify-center rounded-lg [&_svg]:size-5', DIALOG_ICON_TONE[tone], className), children: children }));
3058
+ }
3059
+ function DialogHeader({ className, icon, iconTone, children, ...props }) {
3060
+ if (icon) {
3061
+ return (jsxRuntime.jsxs("div", { "data-slot": "dialog-header",
3062
+ // A lone title centres on the icon; with a subtitle the pair starts at the icon's top.
3063
+ className: cn('flex flex-row items-center gap-3.5 pr-8 text-left has-[[data-slot=dialog-description]]:items-start', className), ...props, children: [jsxRuntime.jsx(DialogIcon, { tone: iconTone, children: icon }), jsxRuntime.jsx("div", { className: "flex min-w-0 flex-1 flex-col", children: children })] }));
3064
+ }
3065
+ return (jsxRuntime.jsx("div", { "data-slot": "dialog-header", className: cn('flex flex-col pr-8 text-left', className), ...props, children: children }));
3037
3066
  }
3038
3067
  // Footer
3068
+ /** Neutral footer buttons get the card surface so they stand out from the tinted footer band. */
3069
+ const DIALOG_FOOTER_BUTTONS = '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:border ' +
3070
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:border-border ' +
3071
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:bg-card ' +
3072
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:shadow-xs ' +
3073
+ '[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:hover:bg-muted ' +
3074
+ // The outline variant forces its own dark fill; keep every footer secondary button on the same card surface.
3075
+ 'dark:[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:!bg-card ' +
3076
+ 'dark:[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:!border-border ' +
3077
+ 'dark:[&_[data-slot=button]:is([data-variant=outline],[data-variant=ghost],[data-variant=secondary])]:hover:!bg-muted';
3039
3078
  function DialogFooter({ className, ...props }) {
3040
- return (jsxRuntime.jsx("div", { "data-slot": "dialog-footer", className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props }));
3079
+ return (jsxRuntime.jsx("div", { "data-slot": "dialog-footer",
3080
+ // Bleeds to the dialog's side edges as a tinted band; dialogs that drop the default p-6 reset the margins.
3081
+ className: cn(
3082
+ // Sticky so the actions stay in view while a long body scrolls.
3083
+ '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 ' +
3084
+ 'sm:flex-row sm:items-center sm:justify-end', DIALOG_FOOTER_BUTTONS, className), ...props }));
3041
3085
  }
3042
3086
  // Title
3043
- const DialogTitle = t__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DialogPrimitive__namespace.Title, { ref: ref, "data-slot": "dialog-title", className: cn('text-lg font-semibold leading-none', className), ...props })));
3087
+ const DialogTitle = t__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DialogPrimitive__namespace.Title, { ref: ref, "data-slot": "dialog-title", className: cn('text-lg font-semibold leading-6 text-foreground', className), ...props })));
3044
3088
  DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
3045
3089
  // Description
3046
- const DialogDescription = t__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref: ref, "data-slot": "dialog-description", className: cn('text-sm text-muted-foreground', className), ...props })));
3090
+ const DialogDescription = t__namespace.forwardRef(({ className, ...props }, ref) => (jsxRuntime.jsx(DialogPrimitive__namespace.Description, { ref: ref, "data-slot": "dialog-description", className: cn('text-sm leading-5 text-muted-foreground', className), ...props })));
3047
3091
  DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
3048
3092
 
3049
3093
  // ---------- Command Wrapper ----------
@@ -3482,12 +3526,14 @@ exports.CommandItem = CommandItem;
3482
3526
  exports.CommandList = CommandList;
3483
3527
  exports.CommandSeparator = CommandSeparator;
3484
3528
  exports.CommandShortcut = CommandShortcut;
3529
+ exports.DIALOG_FOOTER_BUTTONS = DIALOG_FOOTER_BUTTONS;
3485
3530
  exports.Dialog = Dialog;
3486
3531
  exports.DialogClose = DialogClose;
3487
3532
  exports.DialogContent = DialogContent;
3488
3533
  exports.DialogDescription = DialogDescription;
3489
3534
  exports.DialogFooter = DialogFooter;
3490
3535
  exports.DialogHeader = DialogHeader;
3536
+ exports.DialogIcon = DialogIcon;
3491
3537
  exports.DialogOverlay = DialogOverlay;
3492
3538
  exports.DialogPortal = DialogPortal;
3493
3539
  exports.DialogTitle = DialogTitle;