@olwiba/cn 0.1.35 → 0.1.37

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.d.ts CHANGED
@@ -399,8 +399,28 @@ declare const DialogPortal: React$1.FC<DialogPrimitive.DialogPortalProps>;
399
399
  declare const DialogClose: React$1.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React$1.RefAttributes<HTMLButtonElement>>;
400
400
  declare const DialogOverlay: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
401
401
  type DialogMode = "playful" | "smooth" | "glass";
402
+ type DialogPresentation = "default" | "form";
403
+ type DialogContentProps = React$1.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {
404
+ mode?: DialogMode;
405
+ /**
406
+ * Geometry for the interaction being presented.
407
+ *
408
+ * `form` keeps substantial content inset, top-aligned, viewport-constrained,
409
+ * and internally scrollable on compact screens. It returns to the standard
410
+ * centred dialog geometry from `sm` upward.
411
+ */
412
+ presentation?: DialogPresentation;
413
+ };
402
414
  declare const DialogContent: React$1.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & {
403
415
  mode?: DialogMode;
416
+ /**
417
+ * Geometry for the interaction being presented.
418
+ *
419
+ * `form` keeps substantial content inset, top-aligned, viewport-constrained,
420
+ * and internally scrollable on compact screens. It returns to the standard
421
+ * centred dialog geometry from `sm` upward.
422
+ */
423
+ presentation?: DialogPresentation;
404
424
  } & React$1.RefAttributes<HTMLDivElement>>;
405
425
  declare const DialogHeader: {
406
426
  ({ className, ...props }: React$1.HTMLAttributes<HTMLDivElement>): react_jsx_runtime.JSX.Element;
@@ -924,7 +944,7 @@ declare const Slider: React$1.ForwardRefExoticComponent<SliderProps & React$1.Re
924
944
 
925
945
  type ToasterProps = React$1.ComponentProps<typeof Toaster$1>;
926
946
  type ToasterMode = "playful" | "smooth";
927
- declare const Toaster: ({ mode: modeProp, className, style, ...props }: ToasterProps & {
947
+ declare const Toaster: ({ mode: modeProp, className, style, duration, ...props }: ToasterProps & {
928
948
  mode?: ToasterMode;
929
949
  }) => react_jsx_runtime.JSX.Element;
930
950
 
@@ -1056,4 +1076,4 @@ interface EnchantedProps extends React$1.HTMLAttributes<HTMLDivElement> {
1056
1076
  }
1057
1077
  declare function Enchanted({ children, className, hoverOnly, glintClassName, ...props }: EnchantedProps): react_jsx_runtime.JSX.Element;
1058
1078
 
1059
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AsciiText, type AsciiTextProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, type ButtonProps, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, type ConfettiOptions, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Enchanted, type EnchantedProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, type InputOTPProps, InputOTPSeparator, InputOTPSlot, type InputProps, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, type KbdProps, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NumberInput, type NumberInputProps, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, type ProgressProps, RadioGroup, RadioGroupItem, type RadioGroupItemProps, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SliderProps, Spinner, StatusIndicator, type StatusIndicatorProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, ThemeScript, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UIVariant, UIVariantProvider, badgeVariants, buttonGroupVariants, buttonVariants, cn, fireConfetti, inputBase, inputPlayfulBacking, navigationMenuTriggerStyle, statusIndicatorDotVariants, toggleVariants, useCopyToClipboard, useFormField, useIsMobile, useSidebar, useUIVariant };
1079
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AsciiText, type AsciiTextProps, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, type ButtonProps, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, type CheckboxProps, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, type ConfettiOptions, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, Dialog, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, type DialogPresentation, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, Enchanted, type EnchantedProps, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, type InputOTPProps, InputOTPSeparator, InputOTPSlot, type InputProps, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, type KbdProps, Label, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NumberInput, type NumberInputProps, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, type ProgressProps, RadioGroup, RadioGroupItem, type RadioGroupItemProps, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, type SliderProps, Spinner, StatusIndicator, type StatusIndicatorProps, Switch, type SwitchProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type TextareaProps, ThemeScript, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UIVariant, UIVariantProvider, badgeVariants, buttonGroupVariants, buttonVariants, cn, fireConfetti, inputBase, inputPlayfulBacking, navigationMenuTriggerStyle, statusIndicatorDotVariants, toggleVariants, useCopyToClipboard, useFormField, useIsMobile, useSidebar, useUIVariant };
package/dist/index.js CHANGED
@@ -1551,7 +1551,7 @@ var DialogOverlay = React38.forwardRef(({ className, ...props }, ref) => /* @__P
1551
1551
  }
1552
1552
  ));
1553
1553
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
1554
- var DialogContent = React38.forwardRef(({ className, mode: modeProp, children, ...props }, ref) => {
1554
+ var DialogContent = React38.forwardRef(({ className, mode: modeProp, presentation = "default", children, ...props }, ref) => {
1555
1555
  const mode = modeProp ?? useUIVariant();
1556
1556
  return /* @__PURE__ */ jsxs(DialogPortal, { children: [
1557
1557
  /* @__PURE__ */ jsx(DialogOverlay, { className: mode === "glass" ? "bg-black/40" : void 0 }),
@@ -1560,7 +1560,9 @@ var DialogContent = React38.forwardRef(({ className, mode: modeProp, children, .
1560
1560
  {
1561
1561
  ref,
1562
1562
  className: cn(
1563
- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full",
1563
+ "fixed left-[50%] z-50 grid translate-x-[-50%] gap-4 border bg-background duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full",
1564
+ presentation === "default" && "top-[50%] w-full max-w-lg translate-y-[-50%] p-6",
1565
+ presentation === "form" && "top-4 max-h-[calc(100dvh-2rem)] w-[calc(100vw-1rem)] max-w-lg translate-y-0 overflow-y-auto rounded-lg p-4 pb-6 sm:top-[50%] sm:max-h-[85dvh] sm:w-full sm:translate-y-[-50%] sm:p-6",
1564
1566
  !mode && "shadow-lg sm:rounded-lg",
1565
1567
  mode === "smooth" && "rounded-2xl shadow-xl",
1566
1568
  mode === "playful" && "rounded-xl border-2 shadow-lg shadow-primary/10",
@@ -5132,7 +5134,14 @@ function useDocumentTheme() {
5132
5134
  }, []);
5133
5135
  return theme;
5134
5136
  }
5135
- var Toaster = ({ mode: modeProp, className, style, ...props }) => {
5137
+ var DEFAULT_TOAST_DURATION = 6e3;
5138
+ var Toaster = ({
5139
+ mode: modeProp,
5140
+ className,
5141
+ style,
5142
+ duration = DEFAULT_TOAST_DURATION,
5143
+ ...props
5144
+ }) => {
5136
5145
  const theme = useDocumentTheme();
5137
5146
  const ctxVariant = useUIVariant();
5138
5147
  const mode = modeProp ?? ctxVariant;
@@ -5162,6 +5171,46 @@ var Toaster = ({ mode: modeProp, className, style, ...props }) => {
5162
5171
  height: 0.75rem;
5163
5172
  width: 0.75rem;
5164
5173
  }
5174
+ /* Reserve the corner the close button now occupies.
5175
+ sonner's own button straddles the toast's edge (a -35%/-35%
5176
+ transform), so it can never touch the content. Moving it inside gave
5177
+ it a neater home and took that guarantee away with it: on a toast
5178
+ whose title runs the width of the card, the cross landed on the
5179
+ text. Padding is the other half of that decision. */
5180
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true']:has([data-close-button]) {
5181
+ padding-right: 2rem;
5182
+ }
5183
+ /* Type scale. sonner renders title and description at the same weight
5184
+ and size, so a one-line toast reads as a sentence rather than a
5185
+ result \u2014 which is most of why these looked unfinished next to the
5186
+ richer notify() ones. */
5187
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-title] {
5188
+ font-weight: 500;
5189
+ line-height: 1.35;
5190
+ }
5191
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-description] {
5192
+ margin-top: 0.185rem;
5193
+ font-size: 0.8125rem;
5194
+ line-height: 1.45;
5195
+ opacity: 0.75;
5196
+ }
5197
+ /* Buttons inherit the toast's own colour rather than the global
5198
+ primary, so an action on a richColors error still reads against red
5199
+ instead of disappearing into it. */
5200
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-button] {
5201
+ height: 1.75rem;
5202
+ border-radius: var(--radius-sm);
5203
+ font-size: 0.75rem;
5204
+ font-weight: 500;
5205
+ }
5206
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-action] {
5207
+ background: color-mix(in oklab, currentColor 90%, transparent);
5208
+ color: var(--normal-bg);
5209
+ }
5210
+ [data-sonner-toaster] [data-sonner-toast][data-styled='true'] [data-cancel] {
5211
+ background: color-mix(in oklab, currentColor 10%, transparent);
5212
+ color: inherit;
5213
+ }
5165
5214
  [data-sonner-toaster] [data-sonner-toast][data-styled='true']:hover [data-close-button]:hover {
5166
5215
  background: color-mix(in oklab, currentColor 12%, transparent);
5167
5216
  border-color: transparent;
@@ -5183,6 +5232,7 @@ var Toaster = ({ mode: modeProp, className, style, ...props }) => {
5183
5232
  Toaster$1,
5184
5233
  {
5185
5234
  theme,
5235
+ duration,
5186
5236
  className: cn("toaster group", mode && `toaster-${mode}`, className),
5187
5237
  style: { zIndex: 9999999, ...style },
5188
5238
  icons: {