@fanvue/ui 3.49.0 → 3.50.0

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 (53) hide show
  1. package/README.md +1 -1
  2. package/dist/animated-icons.d.ts +4 -1
  3. package/dist/charts.d.ts +11 -13
  4. package/dist/cjs/components/Alert/Alert.cjs +45 -36
  5. package/dist/cjs/components/Alert/Alert.cjs.map +1 -1
  6. package/dist/cjs/components/Autocomplete/Autocomplete.cjs +1 -1
  7. package/dist/cjs/components/Autocomplete/Autocomplete.cjs.map +1 -1
  8. package/dist/cjs/components/Autocomplete/AutocompleteDropdownContent.cjs +1 -1
  9. package/dist/cjs/components/Autocomplete/AutocompleteDropdownContent.cjs.map +1 -1
  10. package/dist/cjs/components/Button/Button.cjs +1 -1
  11. package/dist/cjs/components/Button/Button.cjs.map +1 -1
  12. package/dist/cjs/components/Chart/ChartGrid.cjs +19 -10
  13. package/dist/cjs/components/Chart/ChartGrid.cjs.map +1 -1
  14. package/dist/cjs/components/Dialog/Dialog.cjs +29 -23
  15. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  16. package/dist/cjs/components/IconButton/IconButton.cjs +6 -1
  17. package/dist/cjs/components/IconButton/IconButton.cjs.map +1 -1
  18. package/dist/cjs/components/Icons/BaseIcon.cjs +3 -2
  19. package/dist/cjs/components/Icons/BaseIcon.cjs.map +1 -1
  20. package/dist/cjs/components/Icons/SpinnerIcon.cjs +4 -2
  21. package/dist/cjs/components/Icons/SpinnerIcon.cjs.map +1 -1
  22. package/dist/cjs/components/Icons/iconSpinClass.cjs +6 -0
  23. package/dist/cjs/components/Icons/iconSpinClass.cjs.map +1 -0
  24. package/dist/cjs/components/Loader/Loader.cjs +1 -1
  25. package/dist/cjs/components/Loader/Loader.cjs.map +1 -1
  26. package/dist/cjs/components/Skeleton/Skeleton.cjs +17 -1
  27. package/dist/cjs/components/Skeleton/Skeleton.cjs.map +1 -1
  28. package/dist/components/Alert/Alert.mjs +45 -36
  29. package/dist/components/Alert/Alert.mjs.map +1 -1
  30. package/dist/components/Autocomplete/Autocomplete.mjs +1 -1
  31. package/dist/components/Autocomplete/Autocomplete.mjs.map +1 -1
  32. package/dist/components/Autocomplete/AutocompleteDropdownContent.mjs +1 -1
  33. package/dist/components/Autocomplete/AutocompleteDropdownContent.mjs.map +1 -1
  34. package/dist/components/Button/Button.mjs +1 -1
  35. package/dist/components/Button/Button.mjs.map +1 -1
  36. package/dist/components/Chart/ChartGrid.mjs +20 -11
  37. package/dist/components/Chart/ChartGrid.mjs.map +1 -1
  38. package/dist/components/Dialog/Dialog.mjs +29 -23
  39. package/dist/components/Dialog/Dialog.mjs.map +1 -1
  40. package/dist/components/IconButton/IconButton.mjs +6 -1
  41. package/dist/components/IconButton/IconButton.mjs.map +1 -1
  42. package/dist/components/Icons/BaseIcon.mjs +3 -2
  43. package/dist/components/Icons/BaseIcon.mjs.map +1 -1
  44. package/dist/components/Icons/SpinnerIcon.mjs +4 -2
  45. package/dist/components/Icons/SpinnerIcon.mjs.map +1 -1
  46. package/dist/components/Icons/iconSpinClass.mjs +6 -0
  47. package/dist/components/Icons/iconSpinClass.mjs.map +1 -0
  48. package/dist/components/Loader/Loader.mjs +1 -1
  49. package/dist/components/Loader/Loader.mjs.map +1 -1
  50. package/dist/components/Skeleton/Skeleton.mjs +17 -1
  51. package/dist/components/Skeleton/Skeleton.mjs.map +1 -1
  52. package/dist/index.d.ts +57 -9
  53. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.mjs","sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useDragToDismiss } from \"../../utils/useDragToDismiss\";\nimport { useSuppressClickAfterDrag } from \"../../utils/useSuppressClickAfterDrag\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Props for the {@link Dialog} root component. */\nexport interface DialogProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> {\n /** Controlled open state. When provided, you must also supply `onOpenChange`. */\n open?: boolean;\n /** Called when the open state changes. Required when `open` is controlled. */\n onOpenChange?: (open: boolean) => void;\n /** The open state of the dialog when it is initially rendered (uncontrolled). */\n defaultOpen?: boolean;\n}\n\n/** Root component that manages open/close state for a dialog. */\nexport const Dialog = DialogPrimitive.Root;\n\n/** Props for the {@link DialogTrigger} component. */\nexport type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\n/**\n * The element that opens the dialog when clicked.\n *\n * On touch / pen, a press-and-release that crosses a small movement threshold\n * is treated as a drag and the resulting synthetic click is suppressed —\n * defends against Android Chrome opening the dialog on a scroll-drag-end.\n */\nexport const DialogTrigger = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Trigger>,\n DialogTriggerProps\n>((props, ref) => <DialogPrimitive.Trigger ref={ref} {...useSuppressClickAfterDrag(props)} />);\nDialogTrigger.displayName = \"DialogTrigger\";\n\n/** Convenience alias for Radix `Dialog.Close`. Closes the dialog when clicked. */\nexport const DialogClose = DialogPrimitive.Close;\n\n/** Props for the {@link DialogClose} component. */\nexport type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\n\nexport interface DialogOverlayProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {}\n\n/**\n * Semi-transparent backdrop rendered behind the dialog content.\n * Rendered by {@link DialogContent}; portaled to `document.body` when {@link DialogContent} `portal` is true.\n */\nexport const DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n DialogOverlayProps\n>(({ className, style, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 bg-background-overlay-default data-[state=closed]:animate-out data-[state=open]:animate-in\",\n className,\n )}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n {...props}\n />\n));\nDialogOverlay.displayName = \"DialogOverlay\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Width preset for the dialog.\n * - `\"sm\"` — 400px max-width (confirmations, simple forms)\n * - `\"md\"` — 440px max-width (default, standard dialogs)\n * - `\"lg\"` — 600px max-width (complex content, tables)\n *\n * @default \"md\"\n */\n size?: \"sm\" | \"md\" | \"lg\";\n /** When true, renders overlay automatically. @default true */\n overlay?: boolean;\n /**\n * When true, teleports overlay and panel to `document.body`.\n * When false, renders inline in the React tree (useful inside theme providers or scoped containers).\n * @default true\n */\n portal?: boolean;\n /** Show the v2 mobile sheet pull handle. Only rendered when `mobilePresentation` is `\"sheet\"`. @default true */\n showMobileHandle?: boolean;\n /**\n * How the dialog presents below the `sm` breakpoint.\n * - `\"sheet\"` — bottom sheet pinned to the viewport bottom edge (default)\n * - `\"card\"` — centered floating card per the v2-modal confirmation spec:\n * 16px side margins, 24px padding, 32px radius on all corners, no pull handle\n *\n * @default \"sheet\"\n */\n mobilePresentation?: \"sheet\" | \"card\";\n /** Props forwarded to the default {@link DialogOverlay} when `overlay` is `true`. */\n overlayProps?: DialogOverlayProps;\n}\n\nconst SIZE_CLASSES: Record<NonNullable<DialogContentProps[\"size\"]>, string> = {\n sm: \"sm:max-w-[400px]\",\n md: \"sm:max-w-[440px]\",\n lg: \"sm:max-w-[600px]\",\n};\n\n/**\n * The dialog panel. Includes the overlay by default and portals to `document.body` by default.\n *\n * Set `portal={false}` to keep overlay and content in the DOM subtree of the parent `Dialog`.\n * `fixed` positioning still applies; ancestors with `transform` or `overflow` may affect layout.\n *\n * On mobile viewports (<640px), the dialog slides up from the bottom as a sheet\n * with top-only border radius by default; pass `mobilePresentation=\"card\"` to\n * render a centered floating card instead (used for small confirmation dialogs).\n * On larger viewports it renders centered with full border radius.\n *\n * It animates in and out. While the closing animation plays the panel stays\n * mounted but ignores pointer input, so a second click can't act on it.\n *\n * @example\n * ```tsx\n * <Dialog>\n * <DialogTrigger asChild>\n * <Button>Open</Button>\n * </DialogTrigger>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Title</DialogTitle>\n * </DialogHeader>\n * <DialogBody>Content here</DialogBody>\n * <DialogFooter>\n * <DialogClose asChild>\n * <Button variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button>Accept</Button>\n * </DialogFooter>\n * </DialogContent>\n * </Dialog>\n * ```\n */\nexport const DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size = \"md\",\n overlay = true,\n portal = true,\n showMobileHandle = true,\n mobilePresentation = \"sheet\",\n overlayProps,\n style,\n onOpenAutoFocus,\n ...props\n },\n ref,\n ) => {\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const contentProps = useDragToDismiss(\n {\n enabled: mobilePresentation === \"sheet\",\n media: \"(max-width: 639.98px)\",\n onDismiss: () => closeRef.current?.click(),\n },\n props,\n );\n const content = (\n <DialogPrimitive.Content\n ref={ref}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n onOpenAutoFocus={(e) => {\n if (onOpenAutoFocus) {\n onOpenAutoFocus(e);\n return;\n }\n e.preventDefault();\n (e.currentTarget as HTMLElement).focus();\n }}\n className={cn(\n \"fixed flex flex-col overflow-hidden border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px] focus:outline-none\",\n \"data-[state=open]:fade-in-0 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out\",\n \"data-[state=closed]:pointer-events-none!\",\n mobilePresentation === \"card\"\n ? // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius\n cn(\n \"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6\",\n \"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"sm:inset-x-auto\",\n )\n : // Bottom sheet pinned to the viewport bottom edge\n cn(\n \"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3\",\n \"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]\",\n \"data-[state=open]:slide-in-from-bottom-full\",\n \"data-[state=closed]:slide-out-to-bottom-full\",\n \"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95\",\n \"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95\",\n ),\n \"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6\",\n \"duration-200\",\n SIZE_CLASSES[size],\n className,\n )}\n {...contentProps}\n >\n <DialogPrimitive.Close ref={closeRef} hidden tabIndex={-1} aria-hidden=\"true\" />\n {showMobileHandle && mobilePresentation === \"sheet\" && (\n <div\n aria-hidden=\"true\"\n className=\"mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden\"\n />\n )}\n {children}\n </DialogPrimitive.Content>\n );\n const overlayElement = overlay ? <DialogOverlay {...overlayProps} /> : null;\n\n if (!portal) {\n return (\n <>\n {overlayElement}\n {content}\n </>\n );\n }\n return (\n <DialogPrimitive.Portal>\n {overlayElement}\n {content}\n </DialogPrimitive.Portal>\n );\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Show the close (X) button in the header. @default true */\n showClose?: boolean;\n /** Show a back arrow button on the left side. Defaults to `true` when `onBack` is provided. */\n showBack?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible label for the back button. @default \"Go back\" */\n backLabel?: string;\n /** Accessible label for the close button. @default \"Close\" */\n closeLabel?: string;\n}\n\n/**\n * Header bar for the dialog. Renders the title with an optional back arrow\n * and close button.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n *\n * <DialogHeader showBack onBack={() => setStep(0)}>\n * <DialogTitle>Step 2</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport const DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n (\n {\n className,\n children,\n showClose = true,\n showBack,\n onBack,\n backLabel = \"Go back\",\n closeLabel = \"Close\",\n ...props\n },\n ref,\n ) => {\n const shouldShowBack = showBack ?? !!onBack;\n\n return (\n <div\n ref={ref}\n // items-start (not items-center) so the back/close buttons align to the\n // title's first line; otherwise they float to the vertical center of a\n // multi-line title + description column.\n className={cn(\"flex shrink-0 items-start justify-end gap-4\", className)}\n {...props}\n >\n {shouldShowBack && (\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<ArrowLeftIcon size={16} />}\n onClick={onBack}\n disabled={!onBack}\n aria-label={backLabel}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<CloseIcon size={16} />}\n aria-label={closeLabel}\n />\n </DialogPrimitive.Close>\n )}\n </div>\n );\n },\n);\nDialogHeader.displayName = \"DialogHeader\";\n\n/** Props for the {@link DialogTitle} component. */\nexport type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\n\n/**\n * Accessible title for the dialog. Must be rendered inside {@link DialogHeader}\n * or directly within {@link DialogContent}.\n */\nexport const DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n DialogTitleProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"typography-header-heading-xs text-content-primary\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = \"DialogTitle\";\n\n/** Props for the {@link DialogDescription} component. */\nexport type DialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Description\n>;\n\n/** Accessible description for the dialog. Rendered as secondary text. */\nexport const DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"typography-body-default-16px-regular text-content-secondary\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Scrollable content area (slot) between the header and footer.\n * Grows to fill available space and scrolls when content overflows.\n */\nexport const DialogBody = React.forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex-1 overflow-y-auto py-4\", className)} {...props} />\n ),\n);\nDialogBody.displayName = \"DialogBody\";\n\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Footer bar for the dialog. Typically contains action buttons.\n * Children are laid out in a horizontal row with equal flex-basis.\n */\nexport const DialogFooter = React.forwardRef<HTMLDivElement, DialogFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex shrink-0 items-center gap-2\", \"[&>*]:min-w-0 [&>*]:flex-1\", className)}\n {...props}\n />\n ),\n);\nDialogFooter.displayName = \"DialogFooter\";\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,MAAM,SAAS,gBAAgB;AAY/B,MAAM,gBAAgB,MAAM,WAGjC,CAAC,OAAO,QAAQ,oBAAC,gBAAgB,SAAhB,EAAwB,KAAW,GAAG,0BAA0B,KAAK,GAAG,CAAE;AAC7F,cAAc,cAAc;AAGrB,MAAM,cAAc,gBAAgB;AAYpC,MAAM,gBAAgB,MAAM,WAGjC,CAAC,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAA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,gBAAgB,OAAhB,EAAsB,SAAO,MAC5B,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,MAAM,oBAAC,WAAA,EAAU,MAAM,GAAA,CAAI;AAAA,cAC3B,cAAY;AAAA,YAAA;AAAA,UAAA,EACd,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AACA,aAAa,cAAc;AASpB,MAAM,cAAc,MAAM,WAG/B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,qDAAqD,SAAS;AAAA,IAC3E,GAAG;AAAA,EAAA;AACN,CACD;AACD,YAAY,cAAc;AAQnB,MAAM,oBAAoB,MAAM,WAGrC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,+DAA+D,SAAS;AAAA,IACrF,GAAG;AAAA,EAAA;AACN,CACD;AACD,kBAAkB,cAAc;AAQzB,MAAM,aAAa,MAAM;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB,oBAAC,OAAA,EAAI,KAAU,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,MAAA,CAAO;AAEvF;AACA,WAAW,cAAc;AAQlB,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,oCAAoC,8BAA8B,SAAS;AAAA,MACxF,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AACA,aAAa,cAAc;"}
1
+ {"version":3,"file":"Dialog.mjs","sources":["../../../src/components/Dialog/Dialog.tsx"],"sourcesContent":["import * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { useDragToDismiss } from \"../../utils/useDragToDismiss\";\nimport { useSuppressClickAfterDrag } from \"../../utils/useSuppressClickAfterDrag\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { ArrowLeftIcon } from \"../Icons/ArrowLeftIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\n\n/** Props for the {@link Dialog} root component. */\nexport interface DialogProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Root> {\n /** Controlled open state. When provided, you must also supply `onOpenChange`. */\n open?: boolean;\n /** Called when the open state changes. Required when `open` is controlled. */\n onOpenChange?: (open: boolean) => void;\n /** The open state of the dialog when it is initially rendered (uncontrolled). */\n defaultOpen?: boolean;\n}\n\n/** Root component that manages open/close state for a dialog. */\nexport const Dialog = DialogPrimitive.Root;\n\n/** Props for the {@link DialogTrigger} component. */\nexport type DialogTriggerProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Trigger>;\n\n/**\n * The element that opens the dialog when clicked.\n *\n * On touch / pen, a press-and-release that crosses a small movement threshold\n * is treated as a drag and the resulting synthetic click is suppressed —\n * defends against Android Chrome opening the dialog on a scroll-drag-end.\n */\nexport const DialogTrigger = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Trigger>,\n DialogTriggerProps\n>((props, ref) => <DialogPrimitive.Trigger ref={ref} {...useSuppressClickAfterDrag(props)} />);\nDialogTrigger.displayName = \"DialogTrigger\";\n\n/** Convenience alias for Radix `Dialog.Close`. Closes the dialog when clicked. */\nexport const DialogClose = DialogPrimitive.Close;\n\n/** Props for the {@link DialogClose} component. */\nexport type DialogCloseProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>;\n\nexport interface DialogOverlayProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> {}\n\n/**\n * Semi-transparent backdrop rendered behind the dialog content.\n * Rendered by {@link DialogContent}; portaled to `document.body` when {@link DialogContent} `portal` is true.\n */\nexport const DialogOverlay = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Overlay>,\n DialogOverlayProps\n>(({ className, style, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n \"data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0 fixed inset-0 bg-background-overlay-default data-[state=closed]:animate-out data-[state=open]:animate-in\",\n className,\n )}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n {...props}\n />\n));\nDialogOverlay.displayName = \"DialogOverlay\";\n\n/** Size preset of {@link DialogContent}. */\nexport type DialogContentSize = \"sm\" | \"md\" | \"lg\" | \"full\";\n\nexport interface DialogContentProps\n extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {\n /**\n * Size preset for the dialog.\n * - `\"sm\"` — 400px max-width (confirmations, simple forms)\n * - `\"md\"` — 440px max-width (default, standard dialogs)\n * - `\"lg\"` — 600px max-width (complex content, tables)\n * - `\"full\"` — edge to edge with no border, radius, padding or pull handle, on the\n * theme's `bg-background-primary` surface, for media viewers. A viewer that wants a\n * black stage passes its own surface through `className`. Its height follows\n * `--visual-viewport-h` when the page sets it (to track the on-screen keyboard)\n * and falls back to `100dvh`.\n *\n * @default \"md\"\n */\n size?: DialogContentSize;\n /** When true, renders overlay automatically. @default true */\n overlay?: boolean;\n /**\n * When true, teleports overlay and panel to `document.body`.\n * When false, renders inline in the React tree (useful inside theme providers or scoped containers).\n * @default true\n */\n portal?: boolean;\n /** Show the v2 mobile sheet pull handle. Only rendered when `mobilePresentation` is `\"sheet\"`. @default true */\n showMobileHandle?: boolean;\n /**\n * How the dialog presents below the `sm` breakpoint.\n * - `\"sheet\"` — bottom sheet pinned to the viewport bottom edge (default)\n * - `\"card\"` — centered floating card per the v2-modal confirmation spec:\n * 16px side margins, 24px padding, 32px radius on all corners, no pull handle\n *\n * @default \"sheet\"\n */\n mobilePresentation?: \"sheet\" | \"card\";\n /** Props forwarded to the default {@link DialogOverlay} when `overlay` is `true`. */\n overlayProps?: DialogOverlayProps;\n}\n\nconst SIZE_CLASSES: Record<Exclude<DialogContentSize, \"full\">, string> = {\n sm: \"sm:max-w-[400px]\",\n md: \"sm:max-w-[440px]\",\n lg: \"sm:max-w-[600px]\",\n};\n\nconst FULL_CLASSES =\n \"inset-x-0 top-[var(--visual-viewport-top,0px)] h-[var(--visual-viewport-h,100dvh)] w-screen bg-background-primary\";\n\n/**\n * The dialog panel. Includes the overlay by default and portals to `document.body` by default.\n *\n * Set `portal={false}` to keep overlay and content in the DOM subtree of the parent `Dialog`.\n * `fixed` positioning still applies; ancestors with `transform` or `overflow` may affect layout.\n *\n * On mobile viewports (<640px), the dialog slides up from the bottom as a sheet\n * with top-only border radius by default; pass `mobilePresentation=\"card\"` to\n * render a centered floating card instead (used for small confirmation dialogs).\n * On larger viewports it renders centered with full border radius.\n * `size=\"full\"` skips both and fills the viewport with no chrome.\n *\n * It animates in and out. While the closing animation plays the panel stays\n * mounted but ignores pointer input, so a second click can't act on it.\n *\n * @example\n * ```tsx\n * <Dialog>\n * <DialogTrigger asChild>\n * <Button>Open</Button>\n * </DialogTrigger>\n * <DialogContent>\n * <DialogHeader>\n * <DialogTitle>Title</DialogTitle>\n * </DialogHeader>\n * <DialogBody>Content here</DialogBody>\n * <DialogFooter>\n * <DialogClose asChild>\n * <Button variant=\"secondary\">Cancel</Button>\n * </DialogClose>\n * <Button>Accept</Button>\n * </DialogFooter>\n * </DialogContent>\n * </Dialog>\n * ```\n */\nexport const DialogContent = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(\n (\n {\n className,\n children,\n size = \"md\",\n overlay = true,\n portal = true,\n showMobileHandle = true,\n mobilePresentation = \"sheet\",\n overlayProps,\n style,\n onOpenAutoFocus,\n ...props\n },\n ref,\n ) => {\n const closeRef = React.useRef<HTMLButtonElement>(null);\n const isFull = size === \"full\";\n const contentProps = useDragToDismiss(\n {\n enabled: !isFull && mobilePresentation === \"sheet\",\n media: \"(max-width: 639.98px)\",\n onDismiss: () => closeRef.current?.click(),\n },\n props,\n );\n const content = (\n <DialogPrimitive.Content\n ref={ref}\n style={{ zIndex: \"var(--fanvue-ui-portal-z-index, 50)\", ...style }}\n onOpenAutoFocus={(e) => {\n if (onOpenAutoFocus) {\n onOpenAutoFocus(e);\n return;\n }\n e.preventDefault();\n (e.currentTarget as HTMLElement).focus();\n }}\n className={cn(\n \"fixed flex flex-col overflow-hidden focus:outline-none\",\n \"data-[state=open]:fade-in-0 data-[state=open]:animate-in\",\n \"data-[state=closed]:fade-out-0 data-[state=closed]:animate-out\",\n \"data-[state=closed]:pointer-events-none!\",\n \"duration-200\",\n isFull\n ? FULL_CLASSES\n : cn(\n \"border border-modal-stroke bg-modal-background shadow-blur-menu backdrop-blur-[4px]\",\n mobilePresentation === \"card\"\n ? // Floating confirmation card (v2-modal): 16px side margins, vertically centered, 32px radius\n cn(\n \"dialog-max-h-dynamic inset-x-4 top-1/2 -translate-y-1/2 rounded-xl p-6\",\n \"data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95\",\n \"sm:inset-x-auto\",\n )\n : // Bottom sheet pinned to the viewport bottom edge\n cn(\n \"dialog-max-h-dynamic inset-x-0 bottom-0 w-full rounded-t-xl p-4 pt-3\",\n \"pb-[calc(1rem+env(safe-area-inset-bottom,0px))]\",\n \"data-[state=open]:slide-in-from-bottom-full\",\n \"data-[state=closed]:slide-out-to-bottom-full\",\n \"sm:data-[state=open]:slide-in-from-bottom-0 sm:data-[state=open]:zoom-in-95\",\n \"sm:data-[state=closed]:slide-out-to-bottom-0 sm:data-[state=closed]:zoom-out-95\",\n ),\n \"sm:dialog-max-h-dynamic sm:inset-auto sm:top-1/2 sm:left-1/2 sm:w-full sm:-translate-x-1/2 sm:-translate-y-1/2 sm:rounded-lg sm:p-6\",\n SIZE_CLASSES[size],\n ),\n className,\n )}\n {...contentProps}\n >\n <DialogPrimitive.Close ref={closeRef} hidden tabIndex={-1} aria-hidden=\"true\" />\n {!isFull && showMobileHandle && mobilePresentation === \"sheet\" && (\n <div\n aria-hidden=\"true\"\n data-slot=\"dialog-handle\"\n className=\"mb-3 h-1 w-8 shrink-0 self-center rounded-full bg-icons-tertiary sm:hidden\"\n />\n )}\n {children}\n </DialogPrimitive.Content>\n );\n const overlayElement = overlay ? <DialogOverlay {...overlayProps} /> : null;\n\n if (!portal) {\n return (\n <>\n {overlayElement}\n {content}\n </>\n );\n }\n return (\n <DialogPrimitive.Portal>\n {overlayElement}\n {content}\n </DialogPrimitive.Portal>\n );\n },\n);\nDialogContent.displayName = \"DialogContent\";\n\nexport interface DialogHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Show the close (X) button in the header. @default true */\n showClose?: boolean;\n /** Show a back arrow button on the left side. Defaults to `true` when `onBack` is provided. */\n showBack?: boolean;\n /** Called when the back button is clicked. */\n onBack?: () => void;\n /** Accessible label for the back button. @default \"Go back\" */\n backLabel?: string;\n /** Accessible label for the close button. @default \"Close\" */\n closeLabel?: string;\n}\n\n/**\n * Header bar for the dialog. Renders the title with an optional back arrow\n * and close button.\n *\n * @example\n * ```tsx\n * <DialogHeader>\n * <DialogTitle>Settings</DialogTitle>\n * </DialogHeader>\n *\n * <DialogHeader showBack onBack={() => setStep(0)}>\n * <DialogTitle>Step 2</DialogTitle>\n * </DialogHeader>\n * ```\n */\nexport const DialogHeader = React.forwardRef<HTMLDivElement, DialogHeaderProps>(\n (\n {\n className,\n children,\n showClose = true,\n showBack,\n onBack,\n backLabel = \"Go back\",\n closeLabel = \"Close\",\n ...props\n },\n ref,\n ) => {\n const shouldShowBack = showBack ?? !!onBack;\n\n return (\n <div\n ref={ref}\n // items-start (not items-center) so the back/close buttons align to the\n // title's first line; otherwise they float to the vertical center of a\n // multi-line title + description column.\n className={cn(\"flex shrink-0 items-start justify-end gap-4\", className)}\n {...props}\n >\n {shouldShowBack && (\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<ArrowLeftIcon size={16} />}\n onClick={onBack}\n disabled={!onBack}\n aria-label={backLabel}\n />\n )}\n <div className=\"flex min-w-0 flex-1 flex-col gap-1.5\">{children}</div>\n {showClose && (\n <DialogPrimitive.Close asChild>\n <IconButton\n variant=\"secondary\"\n size=\"32\"\n icon={<CloseIcon size={16} />}\n aria-label={closeLabel}\n />\n </DialogPrimitive.Close>\n )}\n </div>\n );\n },\n);\nDialogHeader.displayName = \"DialogHeader\";\n\n/** Props for the {@link DialogTitle} component. */\nexport type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;\n\n/**\n * Accessible title for the dialog. Must be rendered inside {@link DialogHeader}\n * or directly within {@link DialogContent}.\n */\nexport const DialogTitle = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Title>,\n DialogTitleProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\"typography-header-heading-xs text-content-primary\", className)}\n {...props}\n />\n));\nDialogTitle.displayName = \"DialogTitle\";\n\n/** Props for the {@link DialogDescription} component. */\nexport type DialogDescriptionProps = React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Description\n>;\n\n/** Accessible description for the dialog. Rendered as secondary text. */\nexport const DialogDescription = React.forwardRef<\n React.ComponentRef<typeof DialogPrimitive.Description>,\n DialogDescriptionProps\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn(\"typography-body-default-16px-regular text-content-secondary\", className)}\n {...props}\n />\n));\nDialogDescription.displayName = \"DialogDescription\";\n\nexport interface DialogBodyProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Scrollable content area (slot) between the header and footer.\n * Grows to fill available space and scrolls when content overflows.\n */\nexport const DialogBody = React.forwardRef<HTMLDivElement, DialogBodyProps>(\n ({ className, ...props }, ref) => (\n <div ref={ref} className={cn(\"flex-1 overflow-y-auto py-4\", className)} {...props} />\n ),\n);\nDialogBody.displayName = \"DialogBody\";\n\nexport interface DialogFooterProps extends React.HTMLAttributes<HTMLDivElement> {}\n\n/**\n * Footer bar for the dialog. Typically contains action buttons.\n * Children are laid out in a horizontal row with equal flex-basis.\n */\nexport const DialogFooter = React.forwardRef<HTMLDivElement, DialogFooterProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"flex shrink-0 items-center gap-2\", \"[&>*]:min-w-0 [&>*]:flex-1\", className)}\n {...props}\n />\n ),\n);\nDialogFooter.displayName = \"DialogFooter\";\n"],"names":[],"mappings":";;;;;;;;;;AAoBO,MAAM,SAAS,gBAAgB;AAY/B,MAAM,gBAAgB,MAAM,WAGjC,CAAC,OAAO,QAAQ,oBAAC,gBAAgB,SAAhB,EAAwB,KAAW,GAAG,0BAA0B,KAAK,GAAG,CAAE;AAC7F,cAAc,cAAc;AAGrB,MAAM,cAAc,gBAAgB;AAYpC,MAAM,gBAAgB,MAAM,WAGjC,CAAC,EAAE,WAAW,OAAO,GAAG,SAAS,QACjC;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,OAAO,EAAE,QAAQ,uCAAuC,GAAG,MAAA;AAAA,IAC1D,GAAG;AAAA,EAAA;AACN,CACD;AACD,cAAc,cAAc;AA4C5B,MAAM,eAAmE;AAAA,EACvE,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eACJ;AAsCK,MAAM,gBAAgB,MAAM;AAAA,EAIjC,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,UAAU;AAAA,IACV,SAAS;AAAA,IACT,mBAAmB;AAAA,IACnB,qBAAqB;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,WAAW,MAAM,OAA0B,IAAI;AACrD,UAAM,SAAS,SAAS;AACxB,UAAM,eAAe;AAAA,MACnB;AAAA,QACE,SAAS,CAAC,UAAU,uBA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CACD;AACD,YAAY,cAAc;AAQnB,MAAM,oBAAoB,MAAM,WAGrC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QAC1B;AAAA,EAAC,gBAAgB;AAAA,EAAhB;AAAA,IACC;AAAA,IACA,WAAW,GAAG,+DAA+D,SAAS;AAAA,IACrF,GAAG;AAAA,EAAA;AACN,CACD;AACD,kBAAkB,cAAc;AAQzB,MAAM,aAAa,MAAM;AAAA,EAC9B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB,oBAAC,OAAA,EAAI,KAAU,WAAW,GAAG,+BAA+B,SAAS,GAAI,GAAG,MAAA,CAAO;AAEvF;AACA,WAAW,cAAc;AAQlB,MAAM,eAAe,MAAM;AAAA,EAChC,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,oCAAoC,8BAA8B,SAAS;AAAA,MACxF,GAAG;AAAA,IAAA;AAAA,EAAA;AAGV;AACA,aAAa,cAAc;"}
@@ -35,7 +35,8 @@ const SIZE_DRIVEN_SHAPE_VARIANTS = /* @__PURE__ */ new Set([
35
35
  "outline",
36
36
  "error",
37
37
  "white",
38
- "black"
38
+ "black",
39
+ "overlay"
39
40
  ]);
40
41
  const NEGATIVE_AWARE_VARIANTS = /* @__PURE__ */ new Set([
41
42
  "primary",
@@ -112,6 +113,10 @@ const VARIANT_CLASSES = {
112
113
  default: "bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black",
113
114
  disabled: DISABLED_OPACITY
114
115
  },
116
+ overlay: {
117
+ default: "bg-buttons-overlay-default text-content-always-white backdrop-blur-sm not-disabled:hover:bg-buttons-overlay-hover not-disabled:active:bg-buttons-overlay-hover",
118
+ disabled: DISABLED_OPACITY
119
+ },
115
120
  // Carries the input surface rather than a button one, so an icon-only action can
116
121
  // sit flush in a row of fields (Figma draws these as a `V2 Input Fields` instance
117
122
  // with only an icon inside). Border and hover match the Select trigger it lines up
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.mjs","sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Count, type CountSize } from \"../Count/Count\";\nimport { IconDefaultsContext, NO_ICON_DEFAULTS } from \"../Icons/IconDefaults\";\n\n/**\n * Visual style variant of the icon button.\n *\n * `primary`, `secondary`, `tertiary`, `outline`, `error`, `white` and `black`\n * use the shared button colour tokens and a size-driven shape (squared at the\n * `24` size, circular otherwise). Of these, `primary`, `secondary`, `tertiary`\n * and `outline` also honour the {@link IconButtonProps.negative} prop.\n *\n * `brand`, `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop` and\n * `microphone` are bespoke variants that stay circular at every size.\n */\nexport type IconButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"outline\"\n | \"error\"\n | \"white\"\n | \"black\"\n | \"brand\"\n | \"contrast\"\n | \"messaging\"\n | \"navTray\"\n | \"tertiaryDestructive\"\n | \"stop\"\n | \"microphone\"\n | \"field\";\n\n/** Icon button size in pixels. */\nexport type IconButtonSize = \"24\" | \"32\" | \"40\" | \"48\" | \"52\" | \"72\";\n\nconst iconSizeVariants: Record<IconButtonSize, string> = {\n 24: \"[&>svg]:size-4\",\n 32: \"[&>svg]:size-4\",\n 40: \"[&>svg]:size-4\",\n 48: \"[&>svg]:size-6\",\n 52: \"[&>svg]:size-7\",\n 72: \"[&>svg]:size-8\",\n};\n\nconst sizeVariants: Record<IconButtonSize, string> = {\n 24: \"size-6 p-1\",\n 32: \"size-8 p-1.5\",\n 40: \"size-10 p-[10px]\",\n 48: \"size-12 p-3\",\n 52: \"size-[52px] p-2\",\n 72: \"size-[72px] p-4\",\n};\n\nconst countSizeMap: Record<IconButtonSize, CountSize> = {\n 24: \"16\",\n 32: \"24\",\n 40: \"32\",\n 48: \"32\",\n 52: \"32\",\n 72: \"32\",\n};\n\n/**\n * Variants whose corner radius is size-driven (see {@link IconButton}): the `24`\n * size is squared (`rounded-xs`), every larger size stays circular. All other\n * variants are circular at every size.\n */\nconst SIZE_DRIVEN_SHAPE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n \"error\",\n \"white\",\n \"black\",\n]);\n\n/** Variants that honour the `negative` (dark-surface) treatment. */\nconst NEGATIVE_AWARE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n]);\n\nconst DISABLED_FILL = \"disabled:bg-buttons-disabled-default disabled:text-content-disabled\";\nconst DISABLED_FILL_NEGATIVE =\n \"disabled:bg-buttons-disabled-negative disabled:text-content-disabled\";\nconst DISABLED_TRANSPARENT = \"disabled:text-content-disabled\";\nconst DISABLED_OPACITY = \"disabled:opacity-50\";\n\ntype VariantClasses = {\n default: string;\n disabled: string;\n negative?: string;\n negativeDisabled?: string;\n};\n\n/**\n * Icon button styling for every variant. The disabled treatment is expressed\n * with the CSS `disabled:` variant (not the `disabled` prop) so an ancestor\n * `<fieldset disabled>` is styled too; hover is guarded with `not-disabled:` so\n * it never fights the disabled state.\n */\nconst VARIANT_CLASSES: Record<IconButtonVariant, VariantClasses> = {\n primary: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted not-disabled:hover:bg-buttons-primary-hover not-disabled:active:bg-buttons-primary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-primary-negative-default text-content-primary not-disabled:hover:bg-buttons-primary-negative-hover not-disabled:active:bg-buttons-primary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n secondary: {\n default:\n \"bg-buttons-secondary-default text-content-primary not-disabled:hover:bg-buttons-secondary-hover not-disabled:active:bg-buttons-secondary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-secondary-negative-default text-content-primary-inverted not-disabled:hover:bg-buttons-secondary-negative-hover not-disabled:active:bg-buttons-secondary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n tertiary: {\n default:\n \"bg-transparent text-content-primary not-disabled:hover:bg-buttons-tertiary-hover not-disabled:active:bg-buttons-tertiary-hover\",\n disabled: DISABLED_TRANSPARENT,\n negative:\n \"bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-tertiary-negative-hover not-disabled:active:bg-buttons-tertiary-negative-hover\",\n negativeDisabled: DISABLED_TRANSPARENT,\n },\n outline: {\n default:\n \"border border-buttons-outline-default bg-transparent text-content-primary not-disabled:hover:bg-buttons-outline-hover not-disabled:active:bg-buttons-outline-hover\",\n disabled: \"disabled:border-buttons-disabled-default disabled:text-content-disabled\",\n negative:\n \"border border-buttons-outline-negative-default bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-outline-negative-hover not-disabled:active:bg-buttons-outline-negative-hover\",\n negativeDisabled: \"disabled:border-buttons-disabled-negative disabled:text-content-disabled\",\n },\n error: {\n default:\n \"bg-buttons-error-default text-content-always-white not-disabled:hover:bg-buttons-error-hover not-disabled:active:bg-buttons-error-hover\",\n disabled: DISABLED_FILL,\n },\n white: {\n default:\n \"bg-buttons-always-white-default text-content-always-black not-disabled:hover:bg-buttons-always-white-hover not-disabled:active:bg-buttons-always-white-hover\",\n disabled: DISABLED_FILL,\n },\n black: {\n default:\n \"bg-buttons-always-black-default text-content-always-white not-disabled:hover:bg-buttons-always-black-hover not-disabled:active:bg-buttons-always-black-hover\",\n disabled: DISABLED_FILL,\n },\n brand: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n contrast: {\n default:\n \"bg-transparent text-content-always-white hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n messaging: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n navTray: {\n default:\n \"bg-transparent text-content-primary hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n tertiaryDestructive: {\n default:\n \"bg-transparent text-error-content hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n stop: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n microphone: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n // Carries the input surface rather than a button one, so an icon-only action can\n // sit flush in a row of fields (Figma draws these as a `V2 Input Fields` instance\n // with only an icon inside). Border and hover match the Select trigger it lines up\n // with, so the row reads as one control group.\n field: {\n default:\n \"border border-border-primary bg-inputs-inputs-primary text-content-primary not-disabled:hover:border-neutral-alphas-400\",\n disabled: DISABLED_TRANSPARENT,\n },\n};\n\nfunction getVariantClasses(variant: IconButtonVariant, negative: boolean): string {\n const classes = VARIANT_CLASSES[variant];\n const isNegative = NEGATIVE_AWARE_VARIANTS.has(variant) && negative;\n const base = (isNegative && classes.negative) || classes.default;\n const disabledClasses = (isNegative && classes.negativeDisabled) || classes.disabled;\n return cn(base, disabledClasses);\n}\n\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual style variant of the icon button. @default \"primary\" */\n variant?: IconButtonVariant;\n /** Size of the button in pixels. @default \"40\" */\n size?: IconButtonSize;\n /** Icon element to render inside the button. */\n icon: React.ReactNode;\n /**\n * Forces the dark-surface treatment regardless of theme. Only honoured on the\n * `primary`, `secondary`, `tertiary`, and `outline` variants. @default false\n */\n negative?: boolean;\n /** When provided, displays a {@link Count} badge at the top-right corner. */\n counterValue?: number;\n}\n\n/**\n * A button containing only an icon. Use when an action can be represented by an\n * icon alone (e.g. close, send). Always pair with an `aria-label` for\n * accessibility.\n *\n * Shape is size-driven for the standard variants: the `24` size is squared\n * (`rounded-xs`), every larger size is circular. Bespoke variants (`brand`,\n * `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop`,\n * `microphone`) stay circular at all sizes. `field` is the exception that is\n * never circular — it takes the inputs' `rounded-sm` so it matches the fields it\n * sits beside. Use it at `32`, `40` or `48`: those are the sizes `Select` offers,\n * and the variant only earns its surface when it lines up with one.\n *\n * @example\n * ```tsx\n * <IconButton icon={<CloseIcon />} aria-label=\"Close\" variant=\"tertiary\" />\n * ```\n */\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n variant = \"primary\",\n size = \"40\",\n icon,\n counterValue,\n negative = false,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n if (process.env.NODE_ENV !== \"production\") {\n if (!props[\"aria-label\"] && !props[\"aria-labelledby\"] && !props.title) {\n console.warn(\n \"IconButton: No accessible name provided. Add an `aria-label`, `aria-labelledby`, or `title` prop so screen readers can announce this button.\",\n );\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-testid=\"icon-button\"\n disabled={disabled}\n className={cn(\n \"relative inline-flex shrink-0 items-center justify-center focus-visible:outline-none\",\n \"cursor-pointer transition-all duration-150 ease-in-out disabled:cursor-default\",\n \"focus-visible:shadow-focus-ring\",\n // `field` takes the inputs' radius at every size so it lines up with the\n // fields around it; everything else keeps the existing size-driven shape.\n variant === \"field\"\n ? \"rounded-sm\"\n : SIZE_DRIVEN_SHAPE_VARIANTS.has(variant) && size === \"24\"\n ? \"rounded-xs\"\n : \"rounded-full\",\n sizeVariants[size],\n getVariantClasses(variant, negative),\n className,\n )}\n {...props}\n >\n <span\n className={cn(\"flex shrink-0 items-center justify-center\", iconSizeVariants[size])}\n aria-hidden=\"true\"\n >\n {/* A button sizes its own icon, so a menu row's icon defaults stop here. */}\n <IconDefaultsContext.Provider value={NO_ICON_DEFAULTS}>\n {icon}\n </IconDefaultsContext.Provider>\n </span>\n\n {counterValue !== undefined && (\n <Count\n value={counterValue}\n variant=\"alert\"\n size={countSizeMap[size]}\n className=\"absolute -top-0.5 -right-0.5\"\n />\n )}\n </button>\n );\n },\n);\n\nIconButton.displayName = \"IconButton\";\n"],"names":[],"mappings":";;;;;;AAoCA,MAAM,mBAAmD;AAAA,EACvD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAA+C;AAAA,EACnD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAAkD;AAAA,EACtD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAOA,MAAM,iDAAiC,IAAuB;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,MAAM,8CAA8B,IAAuB;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,MAAM,gBAAgB;AACtB,MAAM,yBACJ;AACF,MAAM,uBAAuB;AAC7B,MAAM,mBAAmB;AAezB,MAAM,kBAA6D;AAAA,EACjE,SAAS;AAAA,IACP,SACE;AAAA,IACF,UAAU;AAAA,IACV,UACE;AAAA,IACF,kBAAkB;AAAA,EAAA;AAAA,EAEpB,WAAW;AAAA,IACT,SACE;AAAA,IACF,UAAU;AAAA,IACV,UACE;AAAA,IACF,kB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9B,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,WAAW;AAAA,IACX,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,UAAI,CAAC,MAAM,YAAY,KAAK,CAAC,MAAM,iBAAiB,KAAK,CAAC,MAAM,OAAO;AACrE,gBAAQ;AAAA,UACN;AAAA,QAAA;AAAA,MAEJ;AAAA,IACF;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,MAAK;AAAA,QACL,eAAY;AAAA,QACZ;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA;AAAA;AAAA,UAGA,YAAY,UACR,eACA,2BAA2B,IAAI,OAAO,KAAK,SAAS,OAClD,eACA;AAAA,UACN,aAAa,IAAI;AAAA,UACjB,kBAAkB,SAAS,QAAQ;AAAA,UACnC;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW,GAAG,6CAA6C,iBAAiB,IAAI,CAAC;AAAA,cACjF,eAAY;AAAA,cAGZ,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,kBAClC,UAAA,KAAA,CACH;AAAA,YAAA;AAAA,UAAA;AAAA,UAGD,iBAAiB,UAChB;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,OAAO;AAAA,cACP,SAAQ;AAAA,cACR,MAAM,aAAa,IAAI;AAAA,cACvB,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACZ;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,WAAW,cAAc;"}
1
+ {"version":3,"file":"IconButton.mjs","sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Count, type CountSize } from \"../Count/Count\";\nimport { IconDefaultsContext, NO_ICON_DEFAULTS } from \"../Icons/IconDefaults\";\n\n/**\n * Visual style variant of the icon button.\n *\n * `primary`, `secondary`, `tertiary`, `outline`, `error`, `white` and `black`\n * use the shared button colour tokens and a size-driven shape (squared at the\n * `24` size, circular otherwise). Of these, `primary`, `secondary`, `tertiary`\n * and `outline` also honour the {@link IconButtonProps.negative} prop.\n *\n * `overlay` is a translucent dark fill with a backdrop blur, for buttons that sit\n * on photos or video. Its fill and icon look the same in light and dark themes, while\n * the keyboard focus ring still follows the theme. It takes the same size-driven\n * shape as the standard variants.\n *\n * `brand`, `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop` and\n * `microphone` are bespoke variants that stay circular at every size.\n */\nexport type IconButtonVariant =\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"outline\"\n | \"error\"\n | \"white\"\n | \"black\"\n | \"brand\"\n | \"contrast\"\n | \"messaging\"\n | \"navTray\"\n | \"tertiaryDestructive\"\n | \"stop\"\n | \"microphone\"\n | \"overlay\"\n | \"field\";\n\n/** Icon button size in pixels. */\nexport type IconButtonSize = \"24\" | \"32\" | \"40\" | \"48\" | \"52\" | \"72\";\n\nconst iconSizeVariants: Record<IconButtonSize, string> = {\n 24: \"[&>svg]:size-4\",\n 32: \"[&>svg]:size-4\",\n 40: \"[&>svg]:size-4\",\n 48: \"[&>svg]:size-6\",\n 52: \"[&>svg]:size-7\",\n 72: \"[&>svg]:size-8\",\n};\n\nconst sizeVariants: Record<IconButtonSize, string> = {\n 24: \"size-6 p-1\",\n 32: \"size-8 p-1.5\",\n 40: \"size-10 p-[10px]\",\n 48: \"size-12 p-3\",\n 52: \"size-[52px] p-2\",\n 72: \"size-[72px] p-4\",\n};\n\nconst countSizeMap: Record<IconButtonSize, CountSize> = {\n 24: \"16\",\n 32: \"24\",\n 40: \"32\",\n 48: \"32\",\n 52: \"32\",\n 72: \"32\",\n};\n\n/**\n * Variants whose corner radius is size-driven (see {@link IconButton}): the `24`\n * size is squared (`rounded-xs`), every larger size stays circular. All other\n * variants are circular at every size.\n */\nconst SIZE_DRIVEN_SHAPE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n \"error\",\n \"white\",\n \"black\",\n \"overlay\",\n]);\n\n/** Variants that honour the `negative` (dark-surface) treatment. */\nconst NEGATIVE_AWARE_VARIANTS = new Set<IconButtonVariant>([\n \"primary\",\n \"secondary\",\n \"tertiary\",\n \"outline\",\n]);\n\nconst DISABLED_FILL = \"disabled:bg-buttons-disabled-default disabled:text-content-disabled\";\nconst DISABLED_FILL_NEGATIVE =\n \"disabled:bg-buttons-disabled-negative disabled:text-content-disabled\";\nconst DISABLED_TRANSPARENT = \"disabled:text-content-disabled\";\nconst DISABLED_OPACITY = \"disabled:opacity-50\";\n\ntype VariantClasses = {\n default: string;\n disabled: string;\n negative?: string;\n negativeDisabled?: string;\n};\n\n/**\n * Icon button styling for every variant. The disabled treatment is expressed\n * with the CSS `disabled:` variant (not the `disabled` prop) so an ancestor\n * `<fieldset disabled>` is styled too; hover is guarded with `not-disabled:` so\n * it never fights the disabled state.\n */\nconst VARIANT_CLASSES: Record<IconButtonVariant, VariantClasses> = {\n primary: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted not-disabled:hover:bg-buttons-primary-hover not-disabled:active:bg-buttons-primary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-primary-negative-default text-content-primary not-disabled:hover:bg-buttons-primary-negative-hover not-disabled:active:bg-buttons-primary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n secondary: {\n default:\n \"bg-buttons-secondary-default text-content-primary not-disabled:hover:bg-buttons-secondary-hover not-disabled:active:bg-buttons-secondary-hover\",\n disabled: DISABLED_FILL,\n negative:\n \"bg-buttons-secondary-negative-default text-content-primary-inverted not-disabled:hover:bg-buttons-secondary-negative-hover not-disabled:active:bg-buttons-secondary-negative-hover\",\n negativeDisabled: DISABLED_FILL_NEGATIVE,\n },\n tertiary: {\n default:\n \"bg-transparent text-content-primary not-disabled:hover:bg-buttons-tertiary-hover not-disabled:active:bg-buttons-tertiary-hover\",\n disabled: DISABLED_TRANSPARENT,\n negative:\n \"bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-tertiary-negative-hover not-disabled:active:bg-buttons-tertiary-negative-hover\",\n negativeDisabled: DISABLED_TRANSPARENT,\n },\n outline: {\n default:\n \"border border-buttons-outline-default bg-transparent text-content-primary not-disabled:hover:bg-buttons-outline-hover not-disabled:active:bg-buttons-outline-hover\",\n disabled: \"disabled:border-buttons-disabled-default disabled:text-content-disabled\",\n negative:\n \"border border-buttons-outline-negative-default bg-transparent text-content-primary-inverted not-disabled:hover:bg-buttons-outline-negative-hover not-disabled:active:bg-buttons-outline-negative-hover\",\n negativeDisabled: \"disabled:border-buttons-disabled-negative disabled:text-content-disabled\",\n },\n error: {\n default:\n \"bg-buttons-error-default text-content-always-white not-disabled:hover:bg-buttons-error-hover not-disabled:active:bg-buttons-error-hover\",\n disabled: DISABLED_FILL,\n },\n white: {\n default:\n \"bg-buttons-always-white-default text-content-always-black not-disabled:hover:bg-buttons-always-white-hover not-disabled:active:bg-buttons-always-white-hover\",\n disabled: DISABLED_FILL,\n },\n black: {\n default:\n \"bg-buttons-always-black-default text-content-always-white not-disabled:hover:bg-buttons-always-black-hover not-disabled:active:bg-buttons-always-black-hover\",\n disabled: DISABLED_FILL,\n },\n brand: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n contrast: {\n default:\n \"bg-transparent text-content-always-white hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n messaging: {\n default:\n \"bg-content-always-black text-brand-primary-default hover:bg-brand-primary-default hover:text-content-always-black not-disabled:active:bg-brand-primary-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n navTray: {\n default:\n \"bg-transparent text-content-primary hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n tertiaryDestructive: {\n default:\n \"bg-transparent text-error-content hover:bg-brand-primary-muted not-disabled:active:bg-brand-primary-muted\",\n disabled: DISABLED_OPACITY,\n },\n stop: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n microphone: {\n default:\n \"bg-buttons-primary-default text-content-primary-inverted hover:bg-buttons-brand-default hover:text-content-always-black not-disabled:active:bg-buttons-brand-default not-disabled:active:text-content-always-black\",\n disabled: DISABLED_OPACITY,\n },\n overlay: {\n default:\n \"bg-buttons-overlay-default text-content-always-white backdrop-blur-sm not-disabled:hover:bg-buttons-overlay-hover not-disabled:active:bg-buttons-overlay-hover\",\n disabled: DISABLED_OPACITY,\n },\n // Carries the input surface rather than a button one, so an icon-only action can\n // sit flush in a row of fields (Figma draws these as a `V2 Input Fields` instance\n // with only an icon inside). Border and hover match the Select trigger it lines up\n // with, so the row reads as one control group.\n field: {\n default:\n \"border border-border-primary bg-inputs-inputs-primary text-content-primary not-disabled:hover:border-neutral-alphas-400\",\n disabled: DISABLED_TRANSPARENT,\n },\n};\n\nfunction getVariantClasses(variant: IconButtonVariant, negative: boolean): string {\n const classes = VARIANT_CLASSES[variant];\n const isNegative = NEGATIVE_AWARE_VARIANTS.has(variant) && negative;\n const base = (isNegative && classes.negative) || classes.default;\n const disabledClasses = (isNegative && classes.negativeDisabled) || classes.disabled;\n return cn(base, disabledClasses);\n}\n\nexport interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Visual style variant of the icon button. @default \"primary\" */\n variant?: IconButtonVariant;\n /** Size of the button in pixels. @default \"40\" */\n size?: IconButtonSize;\n /** Icon element to render inside the button. */\n icon: React.ReactNode;\n /**\n * Forces the dark-surface treatment regardless of theme. Only honoured on the\n * `primary`, `secondary`, `tertiary`, and `outline` variants. @default false\n */\n negative?: boolean;\n /** When provided, displays a {@link Count} badge at the top-right corner. */\n counterValue?: number;\n}\n\n/**\n * A button containing only an icon. Use when an action can be represented by an\n * icon alone (e.g. close, send). Always pair with an `aria-label` for\n * accessibility.\n *\n * Shape is size-driven for the standard variants and `overlay`: the `24` size is\n * squared (`rounded-xs`), every larger size is circular. Bespoke variants (`brand`,\n * `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop`,\n * `microphone`) stay circular at all sizes. `field` is the exception that is\n * never circular — it takes the inputs' `rounded-sm` so it matches the fields it\n * sits beside. Use it at `32`, `40` or `48`: those are the sizes `Select` offers,\n * and the variant only earns its surface when it lines up with one.\n *\n * @example\n * ```tsx\n * <IconButton icon={<CloseIcon />} aria-label=\"Close\" variant=\"tertiary\" />\n * ```\n */\nexport const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n variant = \"primary\",\n size = \"40\",\n icon,\n counterValue,\n negative = false,\n disabled = false,\n ...props\n },\n ref,\n ) => {\n if (process.env.NODE_ENV !== \"production\") {\n if (!props[\"aria-label\"] && !props[\"aria-labelledby\"] && !props.title) {\n console.warn(\n \"IconButton: No accessible name provided. Add an `aria-label`, `aria-labelledby`, or `title` prop so screen readers can announce this button.\",\n );\n }\n }\n\n return (\n <button\n ref={ref}\n type=\"button\"\n data-testid=\"icon-button\"\n disabled={disabled}\n className={cn(\n \"relative inline-flex shrink-0 items-center justify-center focus-visible:outline-none\",\n \"cursor-pointer transition-all duration-150 ease-in-out disabled:cursor-default\",\n \"focus-visible:shadow-focus-ring\",\n // `field` takes the inputs' radius at every size so it lines up with the\n // fields around it; everything else keeps the existing size-driven shape.\n variant === \"field\"\n ? \"rounded-sm\"\n : SIZE_DRIVEN_SHAPE_VARIANTS.has(variant) && size === \"24\"\n ? \"rounded-xs\"\n : \"rounded-full\",\n sizeVariants[size],\n getVariantClasses(variant, negative),\n className,\n )}\n {...props}\n >\n <span\n className={cn(\"flex shrink-0 items-center justify-center\", iconSizeVariants[size])}\n aria-hidden=\"true\"\n >\n {/* A button sizes its own icon, so a menu row's icon defaults stop here. */}\n <IconDefaultsContext.Provider value={NO_ICON_DEFAULTS}>\n {icon}\n </IconDefaultsContext.Provider>\n </span>\n\n {counterValue !== undefined && (\n <Count\n value={counterValue}\n variant=\"alert\"\n size={countSizeMap[size]}\n className=\"absolute -top-0.5 -right-0.5\"\n />\n )}\n </button>\n );\n },\n);\n\nIconButton.displayName = \"IconButton\";\n"],"names":[],"mappings":";;;;;;AA0CA,MAAM,mBAAmD;AAAA,EACvD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAA+C;AAAA,EACnD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,eAAkD;AAAA,EACtD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAOA,MAAM,iDAAiC,IAAuB;AAAA,EAC5D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,MAAM,8CAA8B,IAAuB;AAAA,EACzD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,MAAM,gBAAgB;AACtB,MAAM,yBACJ;AACF,MAAM,uBAAuB;AAC7B,MAAM,mBAAmB;AAezB,MAAM,kBAA6D;AAAA,EACjE,SAAS;AAAA,IACP,SACE;AAAA,IACF,UAAU;AAAA,IACV,UACE;AAAA,IACF,kBAAkB;A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;AAEA,WAAW,cAAc;"}
@@ -4,6 +4,7 @@ import * as React from "react";
4
4
  import { cn } from "../../utils/cn.mjs";
5
5
  import { IconDefaultsContext } from "./IconDefaults.mjs";
6
6
  import { ICON_SIZE_CLASS } from "./iconSizeClass.mjs";
7
+ import { ICON_SPIN_CLASS } from "./iconSpinClass.mjs";
7
8
  const LAYER_TRANSITION = "motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out";
8
9
  const renderPath = (p) => p.sw !== void 0 ? /* @__PURE__ */ jsx(
9
10
  "path",
@@ -26,7 +27,7 @@ const renderPath = (p) => p.sw !== void 0 ? /* @__PURE__ */ jsx(
26
27
  p.d
27
28
  );
28
29
  const BaseIcon = React.forwardRef(
29
- ({ variants, size: sizeProp, filled: filledProp, className, ...props }, ref) => {
30
+ ({ variants, size: sizeProp, filled: filledProp, spin = false, className, ...props }, ref) => {
30
31
  const defaults = React.useContext(IconDefaultsContext);
31
32
  const size = sizeProp ?? (defaults.size !== void 0 && variants[defaults.size] ? defaults.size : 24);
32
33
  const filled = filledProp ?? (defaults.filled && variants[size]?.filled ? true : void 0);
@@ -46,7 +47,7 @@ const BaseIcon = React.forwardRef(
46
47
  viewBox: `0 0 ${size} ${size}`,
47
48
  fill: "none",
48
49
  "aria-hidden": "true",
49
- className: cn(ICON_SIZE_CLASS[size], className),
50
+ className: cn(ICON_SIZE_CLASS[size], spin && ICON_SPIN_CLASS, className),
50
51
  ...props,
51
52
  children: [
52
53
  /* @__PURE__ */ jsx("g", { className: cn(LAYER_TRANSITION, showFilled ? "opacity-0" : "opacity-100"), children: outlined.map(renderPath) }),
@@ -1 +1 @@
1
- {"version":3,"file":"BaseIcon.mjs","sources":["../../../src/components/Icons/BaseIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { IconDefaultsContext } from \"./IconDefaults\";\nimport { ICON_SIZE_CLASS } from \"./iconSizeClass\";\nimport type { BaseIconProps, IconPath, IconVariants } from \"./types\";\n\nconst LAYER_TRANSITION =\n \"motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out\";\n\ninterface InternalBaseIconProps extends BaseIconProps {\n variants: IconVariants;\n}\n\nconst renderPath = (p: IconPath) =>\n p.sw !== undefined ? (\n <path\n key={p.d}\n d={p.d}\n stroke=\"currentColor\"\n strokeWidth={p.sw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n ) : (\n <path\n key={p.d}\n d={p.d}\n fill=\"currentColor\"\n fillRule={p.eo ? \"evenodd\" : undefined}\n clipRule={p.eo ? \"evenodd\" : undefined}\n />\n );\n\n/**\n * Internal renderer for prop-based icons. Each public icon (e.g. `HeartIcon`)\n * is a thin wrapper that supplies its own `variants` table and re-exports\n * {@link BaseIconProps} as `*IconProps`. Not exported from the package.\n *\n * When a `filled` variant exists, both layers are rendered simultaneously and\n * the `filled` prop crossfades between them. The same `<svg>` and `<g>` nodes\n * persist across toggles so the transition is visible rather than an instant\n * remount.\n */\nexport const BaseIcon = React.forwardRef<SVGSVGElement, InternalBaseIconProps>(\n ({ variants, size: sizeProp, filled: filledProp, className, ...props }, ref) => {\n const defaults = React.useContext(IconDefaultsContext);\n // A container default only applies when the icon has artwork for it, so an\n // icon drawn at 24/32 only, or without a filled 16, keeps its own look.\n const size =\n sizeProp ?? (defaults.size !== undefined && variants[defaults.size] ? defaults.size : 24);\n const filled = filledProp ?? (defaults.filled && variants[size]?.filled ? true : undefined);\n const v = variants[size];\n const outlined = v?.outlined ?? [];\n const filledPaths = v?.filled;\n const showFilled = !!(filled && filledPaths);\n\n if (filled && !filledPaths && v && process.env.NODE_ENV !== \"production\") {\n console.warn(\n `[fanvue/ui] Icon at size=${size} has no 'filled' variant; falling back to outlined.`,\n );\n }\n\n return (\n <svg\n ref={ref}\n viewBox={`0 0 ${size} ${size}`}\n fill=\"none\"\n aria-hidden=\"true\"\n className={cn(ICON_SIZE_CLASS[size], className)}\n {...props}\n >\n <g className={cn(LAYER_TRANSITION, showFilled ? \"opacity-0\" : \"opacity-100\")}>\n {outlined.map(renderPath)}\n </g>\n {filledPaths && (\n <g className={cn(LAYER_TRANSITION, showFilled ? \"opacity-100\" : \"opacity-0\")}>\n {filledPaths.map(renderPath)}\n </g>\n )}\n </svg>\n );\n },\n);\n\nBaseIcon.displayName = \"BaseIcon\";\n"],"names":[],"mappings":";;;;;;AAMA,MAAM,mBACJ;AAMF,MAAM,aAAa,CAAC,MAClB,EAAE,OAAO,SACP;AAAA,EAAC;AAAA,EAAA;AAAA,IAEC,GAAG,EAAE;AAAA,IACL,QAAO;AAAA,IACP,aAAa,EAAE;AAAA,IACf,eAAc;AAAA,IACd,gBAAe;AAAA,EAAA;AAAA,EALV,EAAE;AAMT,IAEA;AAAA,EAAC;AAAA,EAAA;AAAA,IAEC,GAAG,EAAE;AAAA,IACL,MAAK;AAAA,IACL,UAAU,EAAE,KAAK,YAAY;AAAA,IAC7B,UAAU,EAAE,KAAK,YAAY;AAAA,EAAA;AAAA,EAJxB,EAAE;AAKT;AAaG,MAAM,WAAW,MAAM;AAAA,EAC5B,CAAC,EAAE,UAAU,MAAM,UAAU,QAAQ,YAAY,WAAW,GAAG,MAAA,GAAS,QAAQ;AAC9E,UAAM,WAAW,MAAM,WAAW,mBAAmB;AAGrD,UAAM,OACJ,aAAa,SAAS,SAAS,UAAa,SAAS,SAAS,IAAI,IAAI,SAAS,OAAO;AACxF,UAAM,SAAS,eAAe,SAAS,UAAU,SAAS,IAAI,GAAG,SAAS,OAAO;AACjF,UAAM,IAAI,SAAS,IAAI;AACvB,UAAM,WAAW,GAAG,YAAY,CAAA;AAChC,UAAM,cAAc,GAAG;AACvB,UAAM,aAAa,CAAC,EAAE,UAAU;AAEhC,QAAI,UAAU,CAAC,eAAe,KAAK,QAAQ,IAAI,aAAa,cAAc;AACxE,cAAQ;AAAA,QACN,4BAA4B,IAAI;AAAA,MAAA;AAAA,IAEpC;AAEA,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,SAAS,OAAO,IAAI,IAAI,IAAI;AAAA,QAC5B,MAAK;AAAA,QACL,eAAY;AAAA,QACZ,WAAW,GAAG,gBAAgB,IAAI,GAAG,SAAS;AAAA,QAC7C,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAA,oBAAC,KAAA,EAAE,WAAW,GAAG,kBAAkB,aAAa,cAAc,aAAa,GACxE,UAAA,SAAS,IAAI,UAAU,EAAA,CAC1B;AAAA,UACC,eACC,oBAAC,KAAA,EAAE,WAAW,GAAG,kBAAkB,aAAa,gBAAgB,WAAW,GACxE,UAAA,YAAY,IAAI,UAAU,EAAA,CAC7B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,SAAS,cAAc;"}
1
+ {"version":3,"file":"BaseIcon.mjs","sources":["../../../src/components/Icons/BaseIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { IconDefaultsContext } from \"./IconDefaults\";\nimport { ICON_SIZE_CLASS } from \"./iconSizeClass\";\nimport { ICON_SPIN_CLASS } from \"./iconSpinClass\";\nimport type { BaseIconProps, IconPath, IconVariants } from \"./types\";\n\nconst LAYER_TRANSITION =\n \"motion-safe:transition-opacity motion-safe:duration-150 motion-safe:ease-in-out\";\n\ninterface InternalBaseIconProps extends BaseIconProps {\n variants: IconVariants;\n}\n\nconst renderPath = (p: IconPath) =>\n p.sw !== undefined ? (\n <path\n key={p.d}\n d={p.d}\n stroke=\"currentColor\"\n strokeWidth={p.sw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n ) : (\n <path\n key={p.d}\n d={p.d}\n fill=\"currentColor\"\n fillRule={p.eo ? \"evenodd\" : undefined}\n clipRule={p.eo ? \"evenodd\" : undefined}\n />\n );\n\n/**\n * Internal renderer for prop-based icons. Each public icon (e.g. `HeartIcon`)\n * is a thin wrapper that supplies its own `variants` table and re-exports\n * {@link BaseIconProps} as `*IconProps`. Not exported from the package.\n *\n * When a `filled` variant exists, both layers are rendered simultaneously and\n * the `filled` prop crossfades between them. The same `<svg>` and `<g>` nodes\n * persist across toggles so the transition is visible rather than an instant\n * remount.\n */\nexport const BaseIcon = React.forwardRef<SVGSVGElement, InternalBaseIconProps>(\n ({ variants, size: sizeProp, filled: filledProp, spin = false, className, ...props }, ref) => {\n const defaults = React.useContext(IconDefaultsContext);\n // A container default only applies when the icon has artwork for it, so an\n // icon drawn at 24/32 only, or without a filled 16, keeps its own look.\n const size =\n sizeProp ?? (defaults.size !== undefined && variants[defaults.size] ? defaults.size : 24);\n const filled = filledProp ?? (defaults.filled && variants[size]?.filled ? true : undefined);\n const v = variants[size];\n const outlined = v?.outlined ?? [];\n const filledPaths = v?.filled;\n const showFilled = !!(filled && filledPaths);\n\n if (filled && !filledPaths && v && process.env.NODE_ENV !== \"production\") {\n console.warn(\n `[fanvue/ui] Icon at size=${size} has no 'filled' variant; falling back to outlined.`,\n );\n }\n\n return (\n <svg\n ref={ref}\n viewBox={`0 0 ${size} ${size}`}\n fill=\"none\"\n aria-hidden=\"true\"\n className={cn(ICON_SIZE_CLASS[size], spin && ICON_SPIN_CLASS, className)}\n {...props}\n >\n <g className={cn(LAYER_TRANSITION, showFilled ? \"opacity-0\" : \"opacity-100\")}>\n {outlined.map(renderPath)}\n </g>\n {filledPaths && (\n <g className={cn(LAYER_TRANSITION, showFilled ? \"opacity-100\" : \"opacity-0\")}>\n {filledPaths.map(renderPath)}\n </g>\n )}\n </svg>\n );\n },\n);\n\nBaseIcon.displayName = \"BaseIcon\";\n"],"names":[],"mappings":";;;;;;;AAOA,MAAM,mBACJ;AAMF,MAAM,aAAa,CAAC,MAClB,EAAE,OAAO,SACP;AAAA,EAAC;AAAA,EAAA;AAAA,IAEC,GAAG,EAAE;AAAA,IACL,QAAO;AAAA,IACP,aAAa,EAAE;AAAA,IACf,eAAc;AAAA,IACd,gBAAe;AAAA,EAAA;AAAA,EALV,EAAE;AAMT,IAEA;AAAA,EAAC;AAAA,EA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,SAAS,cAAc;"}
@@ -2,15 +2,17 @@
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { cn } from "../../utils/cn.mjs";
5
+ import { ICON_SIZE_CLASS } from "./iconSizeClass.mjs";
6
+ import { ICON_SPIN_CLASS } from "./iconSpinClass.mjs";
5
7
  const SpinnerIcon = React.forwardRef(
6
- ({ className, ...props }, ref) => /* @__PURE__ */ jsxs(
8
+ ({ className, size, spin = false, ...props }, ref) => /* @__PURE__ */ jsxs(
7
9
  "svg",
8
10
  {
9
11
  ref,
10
12
  viewBox: "0 0 20 20",
11
13
  fill: "none",
12
14
  "aria-hidden": "true",
13
- className: cn("size-5", className),
15
+ className: cn(size ? ICON_SIZE_CLASS[size] : "size-5", spin && ICON_SPIN_CLASS, className),
14
16
  ...props,
15
17
  children: [
16
18
  /* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeOpacity: ".25", strokeWidth: "2" }),
@@ -1 +1 @@
1
- {"version":3,"file":"SpinnerIcon.mjs","sources":["../../../src/components/Icons/SpinnerIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport type { IconProps } from \"./types\";\n\n/** A circular spinner icon for loading states (20 × 20). Pair with a CSS `animate-spin` class or use the `Loader` component. */\nexport const SpinnerIcon = React.forwardRef<SVGSVGElement, IconProps>(\n ({ className, ...props }, ref) => (\n <svg\n ref={ref}\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n aria-hidden=\"true\"\n className={cn(\"size-5\", className)}\n {...props}\n >\n <circle cx=\"10\" cy=\"10\" r=\"8\" stroke=\"currentColor\" strokeOpacity=\".25\" strokeWidth=\"2\" />\n <path d=\"M10 2a8 8 0 0 1 8 8\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n </svg>\n ),\n);\n\nSpinnerIcon.displayName = \"SpinnerIcon\";\n"],"names":[],"mappings":";;;;AAKO,MAAM,cAAc,MAAM;AAAA,EAC/B,CAAC,EAAE,WAAW,GAAG,MAAA,GAAS,QACxB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,WAAW,GAAG,UAAU,SAAS;AAAA,MAChC,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA,oBAAC,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KAAI,QAAO,gBAAe,eAAc,OAAM,aAAY,KAAI;AAAA,QACxF,oBAAC,UAAK,GAAE,uBAAsB,QAAO,gBAAe,aAAY,KAAI,eAAc,QAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhG;AAEA,YAAY,cAAc;"}
1
+ {"version":3,"file":"SpinnerIcon.mjs","sources":["../../../src/components/Icons/SpinnerIcon.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { ICON_SIZE_CLASS } from \"./iconSizeClass\";\nimport { ICON_SPIN_CLASS } from \"./iconSpinClass\";\nimport type { BaseIconProps, IconProps, IconSize } from \"./types\";\n\n/** Props for {@link SpinnerIcon}. */\nexport interface SpinnerIconProps extends Omit<IconProps, \"size\">, Pick<BaseIconProps, \"spin\"> {\n /** Pixel size of the spinner. Defaults to 20px when omitted. */\n size?: IconSize;\n}\n\n/**\n * A circular spinner glyph for loading states. It is a plain icon: pass `spin`\n * to turn it, as with any other prop-based icon. Prefer `spin`: a raw `animate-spin`\n * class keeps rotating under reduced motion. Combining the two never doubles the\n * speed. For a full-area loading state use the `Loader` component.\n *\n * @example\n * ```tsx\n * <SpinnerIcon size={16} spin />\n * ```\n */\nexport const SpinnerIcon = React.forwardRef<SVGSVGElement, SpinnerIconProps>(\n ({ className, size, spin = false, ...props }, ref) => (\n <svg\n ref={ref}\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n aria-hidden=\"true\"\n className={cn(size ? ICON_SIZE_CLASS[size] : \"size-5\", spin && ICON_SPIN_CLASS, className)}\n {...props}\n >\n <circle cx=\"10\" cy=\"10\" r=\"8\" stroke=\"currentColor\" strokeOpacity=\".25\" strokeWidth=\"2\" />\n <path d=\"M10 2a8 8 0 0 1 8 8\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" />\n </svg>\n ),\n);\n\nSpinnerIcon.displayName = \"SpinnerIcon\";\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,cAAc,MAAM;AAAA,EAC/B,CAAC,EAAE,WAAW,MAAM,OAAO,OAAO,GAAG,MAAA,GAAS,QAC5C;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,eAAY;AAAA,MACZ,WAAW,GAAG,OAAO,gBAAgB,IAAI,IAAI,UAAU,QAAQ,iBAAiB,SAAS;AAAA,MACxF,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAA,oBAAC,UAAA,EAAO,IAAG,MAAK,IAAG,MAAK,GAAE,KAAI,QAAO,gBAAe,eAAc,OAAM,aAAY,KAAI;AAAA,QACxF,oBAAC,UAAK,GAAE,uBAAsB,QAAO,gBAAe,aAAY,KAAI,eAAc,QAAA,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGhG;AAEA,YAAY,cAAc;"}
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ const ICON_SPIN_CLASS = "motion-safe:animate-spin motion-reduce:animate-pulse";
3
+ export {
4
+ ICON_SPIN_CLASS
5
+ };
6
+ //# sourceMappingURL=iconSpinClass.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconSpinClass.mjs","sources":["../../../src/components/Icons/iconSpinClass.ts"],"sourcesContent":["/**\n * Classes behind the icon `spin` prop: a full turn per second when motion is\n * allowed, a pulse in place under `prefers-reduced-motion`. Uses the same\n * `spin` keyframes as Tailwind's `animate-spin`, so an icon that also carries\n * that class still turns at one speed.\n *\n * Internal — not exported from the package.\n */\nexport const ICON_SPIN_CLASS = \"motion-safe:animate-spin motion-reduce:animate-pulse\";\n"],"names":[],"mappings":";AAQO,MAAM,kBAAkB;"}
@@ -28,7 +28,7 @@ const Loader = React.forwardRef(
28
28
  shouldCenterY && "top-1/2 -translate-y-1/2"
29
29
  ),
30
30
  "aria-label": ariaLabel ?? "loading",
31
- children: /* @__PURE__ */ jsx(SpinnerIcon, { className: "size-9 animate-spin text-content-secondary" })
31
+ children: /* @__PURE__ */ jsx(SpinnerIcon, { spin: true, className: "size-9 text-content-secondary" })
32
32
  }
33
33
  )
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Loader.mjs","sources":["../../../src/components/Loader/Loader.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { SpinnerIcon } from \"../Icons/SpinnerIcon\";\n\nexport interface LoaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Whether the loader is visible. When `false`, renders nothing. @default true */\n show?: boolean;\n /** Accessible label for the loading indicator. @default \"loading\" */\n ariaLabel?: string;\n /** Minimum height of the container. Numbers are treated as pixels. @default \"100%\" */\n minHeight?: number | string;\n /** Center the spinner horizontally. @default false */\n center?: boolean;\n /** Center the spinner horizontally. @default false */\n centerX?: boolean;\n /** Center the spinner vertically. @default false */\n centerY?: boolean;\n}\n\n/**\n * A layout-aware loading indicator that renders a centered `SpinnerIcon` inside\n * a relatively-positioned container. Drop-in replacement for the Olympus `Loader`.\n *\n * @example\n * ```tsx\n * <Loader show center />\n * <Loader show centerX minHeight={200} />\n * ```\n */\nexport const Loader = React.forwardRef<HTMLDivElement, LoaderProps>(\n (\n { show = true, ariaLabel, minHeight = \"100%\", center, centerX, centerY, className, ...props },\n ref,\n ) => {\n if (!show) {\n return null;\n }\n\n const shouldCenterX = center || centerX;\n const shouldCenterY = center || centerY;\n\n return (\n <div\n ref={ref}\n className={cn(\"relative\", className)}\n style={{\n minHeight: typeof minHeight === \"number\" ? `${minHeight}px` : minHeight,\n }}\n {...props}\n >\n <output\n className={cn(\n \"absolute flex size-[60px] items-center justify-center\",\n shouldCenterX && \"left-1/2 -translate-x-1/2\",\n shouldCenterY && \"top-1/2 -translate-y-1/2\",\n )}\n aria-label={ariaLabel ?? \"loading\"}\n >\n <SpinnerIcon className=\"size-9 animate-spin text-content-secondary\" />\n </output>\n </div>\n );\n },\n);\n\nLoader.displayName = \"Loader\";\n"],"names":[],"mappings":";;;;;AA6BO,MAAM,SAAS,MAAM;AAAA,EAC1B,CACE,EAAE,OAAO,MAAM,WAAW,YAAY,QAAQ,QAAQ,SAAS,SAAS,WAAW,GAAG,MAAA,GACtF,QACG;AACH,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,IACT;AAEA,UAAM,gBAAgB,UAAU;AAChC,UAAM,gBAAgB,UAAU;AAEhC,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,YAAY,SAAS;AAAA,QACnC,OAAO;AAAA,UACL,WAAW,OAAO,cAAc,WAAW,GAAG,SAAS,OAAO;AAAA,QAAA;AAAA,QAE/D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,iBAAiB;AAAA,cACjB,iBAAiB;AAAA,YAAA;AAAA,YAEnB,cAAY,aAAa;AAAA,YAEzB,UAAA,oBAAC,aAAA,EAAY,WAAU,6CAAA,CAA6C;AAAA,UAAA;AAAA,QAAA;AAAA,MACtE;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,OAAO,cAAc;"}
1
+ {"version":3,"file":"Loader.mjs","sources":["../../../src/components/Loader/Loader.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { SpinnerIcon } from \"../Icons/SpinnerIcon\";\n\nexport interface LoaderProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Whether the loader is visible. When `false`, renders nothing. @default true */\n show?: boolean;\n /** Accessible label for the loading indicator. @default \"loading\" */\n ariaLabel?: string;\n /** Minimum height of the container. Numbers are treated as pixels. @default \"100%\" */\n minHeight?: number | string;\n /** Center the spinner horizontally. @default false */\n center?: boolean;\n /** Center the spinner horizontally. @default false */\n centerX?: boolean;\n /** Center the spinner vertically. @default false */\n centerY?: boolean;\n}\n\n/**\n * A layout-aware loading indicator that renders a centered `SpinnerIcon` inside\n * a relatively-positioned container. Drop-in replacement for the Olympus `Loader`.\n *\n * @example\n * ```tsx\n * <Loader show center />\n * <Loader show centerX minHeight={200} />\n * ```\n */\nexport const Loader = React.forwardRef<HTMLDivElement, LoaderProps>(\n (\n { show = true, ariaLabel, minHeight = \"100%\", center, centerX, centerY, className, ...props },\n ref,\n ) => {\n if (!show) {\n return null;\n }\n\n const shouldCenterX = center || centerX;\n const shouldCenterY = center || centerY;\n\n return (\n <div\n ref={ref}\n className={cn(\"relative\", className)}\n style={{\n minHeight: typeof minHeight === \"number\" ? `${minHeight}px` : minHeight,\n }}\n {...props}\n >\n <output\n className={cn(\n \"absolute flex size-[60px] items-center justify-center\",\n shouldCenterX && \"left-1/2 -translate-x-1/2\",\n shouldCenterY && \"top-1/2 -translate-y-1/2\",\n )}\n aria-label={ariaLabel ?? \"loading\"}\n >\n <SpinnerIcon spin className=\"size-9 text-content-secondary\" />\n </output>\n </div>\n );\n },\n);\n\nLoader.displayName = \"Loader\";\n"],"names":[],"mappings":";;;;;AA6BO,MAAM,SAAS,MAAM;AAAA,EAC1B,CACE,EAAE,OAAO,MAAM,WAAW,YAAY,QAAQ,QAAQ,SAAS,SAAS,WAAW,GAAG,MAAA,GACtF,QACG;AACH,QAAI,CAAC,MAAM;AACT,aAAO;AAAA,IACT;AAEA,UAAM,gBAAgB,UAAU;AAChC,UAAM,gBAAgB,UAAU;AAEhC,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,WAAW,GAAG,YAAY,SAAS;AAAA,QACnC,OAAO;AAAA,UACL,WAAW,OAAO,cAAc,WAAW,GAAG,SAAS,OAAO;AAAA,QAAA;AAAA,QAE/D,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW;AAAA,cACT;AAAA,cACA,iBAAiB;AAAA,cACjB,iBAAiB;AAAA,YAAA;AAAA,YAEnB,cAAY,aAAa;AAAA,YAEzB,UAAA,oBAAC,aAAA,EAAY,MAAI,MAAC,WAAU,gCAAA,CAAgC;AAAA,UAAA;AAAA,QAAA;AAAA,MAC9D;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,OAAO,cAAc;"}
@@ -8,8 +8,23 @@ const VARIANT_CLASSES = {
8
8
  rectangular: "",
9
9
  rounded: "rounded-xs"
10
10
  };
11
+ const RADIUS_CLASSES = {
12
+ sm: "rounded-sm",
13
+ md: "rounded-md",
14
+ lg: "rounded-lg"
15
+ };
11
16
  const Skeleton = React.forwardRef(
12
- ({ className, variant = "text", animation = "pulse", width, height, style, children, ...props }, ref) => {
17
+ ({
18
+ className,
19
+ variant = "text",
20
+ radius,
21
+ animation = "pulse",
22
+ width,
23
+ height,
24
+ style,
25
+ children,
26
+ ...props
27
+ }, ref) => {
13
28
  const hasChildren = React.Children.count(children) > 0;
14
29
  const sizeStyle = {
15
30
  ...style,
@@ -28,6 +43,7 @@ const Skeleton = React.forwardRef(
28
43
  className: cn(
29
44
  "block bg-[color-mix(in_srgb,var(--color-content-primary)_11%,var(--color-background-primary))]",
30
45
  VARIANT_CLASSES[variant],
46
+ radius && RADIUS_CLASSES[radius],
31
47
  variant === "text" && !height && !hasChildren && "h-[1em]",
32
48
  animation === "pulse" && "animate-pulse",
33
49
  animation === "wave" && "fv-skeleton-wave",
@@ -1 +1 @@
1
- {"version":3,"file":"Skeleton.mjs","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Shape variant of the skeleton placeholder. */\nexport type SkeletonVariant = \"text\" | \"circular\" | \"rectangular\" | \"rounded\";\n\n/** Animation style of the skeleton. `false` disables animation. */\nexport type SkeletonAnimation = \"pulse\" | \"wave\" | false;\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Shape variant of the skeleton.\n *\n * - `text` – a single line of text with slight vertical margin and rounded ends\n * - `circular` – a circle (width and height should match)\n * - `rectangular` – a sharp-cornered rectangle\n * - `rounded` – a rectangle with rounded corners\n *\n * @default \"text\"\n */\n variant?: SkeletonVariant;\n /** Animation style. Set to `false` to disable animation. @default \"pulse\" */\n animation?: SkeletonAnimation;\n /** Width of the skeleton. Accepts a CSS value (number is treated as `px`). */\n width?: number | string;\n /** Height of the skeleton. Accepts a CSS value (number is treated as `px`). */\n height?: number | string;\n}\n\nconst VARIANT_CLASSES: Record<SkeletonVariant, string> = {\n text: \"rounded my-0.5\",\n circular: \"rounded-full\",\n rectangular: \"\",\n rounded: \"rounded-xs\",\n};\n\n/**\n * A placeholder preview of content before data is loaded, reducing perceived\n * load time. Mirrors common MUI Skeleton props for easy migration.\n *\n * When used as a loading state, wrap the skeleton region with `aria-busy=\"true\"`\n * and provide an accessible label so screen readers can convey the loading state.\n *\n * @example\n * ```tsx\n * <Skeleton variant=\"text\" width={200} />\n * <Skeleton variant=\"circular\" width={40} height={40} />\n * <Skeleton variant=\"rectangular\" width=\"100%\" height={120} />\n * ```\n */\nexport const Skeleton = React.forwardRef<HTMLSpanElement, SkeletonProps>(\n (\n { className, variant = \"text\", animation = \"pulse\", width, height, style, children, ...props },\n ref,\n ) => {\n const hasChildren = React.Children.count(children) > 0;\n const sizeStyle: React.CSSProperties = {\n ...style,\n ...(width !== undefined && {\n width: typeof width === \"number\" ? `${width}px` : width,\n }),\n ...(height !== undefined && {\n height: typeof height === \"number\" ? `${height}px` : height,\n }),\n };\n\n return (\n <span\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n \"block bg-[color-mix(in_srgb,var(--color-content-primary)_11%,var(--color-background-primary))]\",\n VARIANT_CLASSES[variant],\n variant === \"text\" && !height && !hasChildren && \"h-[1em]\",\n animation === \"pulse\" && \"animate-pulse\",\n animation === \"wave\" && \"fv-skeleton-wave\",\n hasChildren && \"relative overflow-hidden [&>*]:invisible\",\n className,\n )}\n style={sizeStyle}\n {...props}\n >\n {children}\n </span>\n );\n },\n);\n\nSkeleton.displayName = \"Skeleton\";\n"],"names":[],"mappings":";;;;AA4BA,MAAM,kBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,SAAS;AACX;AAgBO,MAAM,WAAW,MAAM;AAAA,EAC5B,CACE,EAAE,WAAW,UAAU,QAAQ,YAAY,SAAS,OAAO,QAAQ,OAAO,UAAU,GAAG,MAAA,GACvF,QACG;AACH,UAAM,cAAc,MAAM,SAAS,MAAM,QAAQ,IAAI;AACrD,UAAM,YAAiC;AAAA,MACrC,GAAG;AAAA,MACH,GAAI,UAAU,UAAa;AAAA,QACzB,OAAO,OAAO,UAAU,WAAW,GAAG,KAAK,OAAO;AAAA,MAAA;AAAA,MAEpD,GAAI,WAAW,UAAa;AAAA,QAC1B,QAAQ,OAAO,WAAW,WAAW,GAAG,MAAM,OAAO;AAAA,MAAA;AAAA,IACvD;AAGF,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA,gBAAgB,OAAO;AAAA,UACvB,YAAY,UAAU,CAAC,UAAU,CAAC,eAAe;AAAA,UACjD,cAAc,WAAW;AAAA,UACzB,cAAc,UAAU;AAAA,UACxB,eAAe;AAAA,UACf;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,SAAS,cAAc;"}
1
+ {"version":3,"file":"Skeleton.mjs","sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\n\n/** Shape variant of the skeleton placeholder. */\nexport type SkeletonVariant = \"text\" | \"circular\" | \"rectangular\" | \"rounded\";\n\n/** Corner radius of the skeleton, on the kit radius scale. */\nexport type SkeletonRadius = \"sm\" | \"md\" | \"lg\";\n\n/** Animation style of the skeleton. `false` disables animation. */\nexport type SkeletonAnimation = \"pulse\" | \"wave\" | false;\n\nexport interface SkeletonProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Shape variant of the skeleton.\n *\n * - `text` – a single line of text with slight vertical margin and rounded ends\n * - `circular` – a circle (width and height should match)\n * - `rectangular` – a sharp-cornered rectangle\n * - `rounded` – a rectangle with rounded corners\n *\n * @default \"text\"\n */\n variant?: SkeletonVariant;\n /**\n * Corner radius on the kit scale, so a skeleton can match the corners of the\n * surface it stands in for. Overrides the radius the `variant` sets.\n *\n * - `sm` – `--radius-sm` (12px)\n * - `md` – `--radius-md` (16px)\n * - `lg` – `--radius-lg` (24px)\n *\n * Leave unset to keep the variant's own radius.\n */\n radius?: SkeletonRadius;\n /** Animation style. Set to `false` to disable animation. @default \"pulse\" */\n animation?: SkeletonAnimation;\n /** Width of the skeleton. Accepts a CSS value (number is treated as `px`). */\n width?: number | string;\n /** Height of the skeleton. Accepts a CSS value (number is treated as `px`). */\n height?: number | string;\n}\n\nconst VARIANT_CLASSES: Record<SkeletonVariant, string> = {\n text: \"rounded my-0.5\",\n circular: \"rounded-full\",\n rectangular: \"\",\n rounded: \"rounded-xs\",\n};\n\nconst RADIUS_CLASSES: Record<SkeletonRadius, string> = {\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-lg\",\n};\n\n/**\n * A placeholder preview of content before data is loaded, reducing perceived\n * load time. Mirrors common MUI Skeleton props for easy migration.\n *\n * When used as a loading state, wrap the skeleton region with `aria-busy=\"true\"`\n * and provide an accessible label so screen readers can convey the loading state.\n *\n * @example\n * ```tsx\n * <Skeleton variant=\"text\" width={200} />\n * <Skeleton variant=\"circular\" width={40} height={40} />\n * <Skeleton variant=\"rectangular\" width=\"100%\" height={120} />\n * <Skeleton variant=\"rectangular\" radius=\"lg\" width=\"100%\" height={240} />\n * ```\n */\nexport const Skeleton = React.forwardRef<HTMLSpanElement, SkeletonProps>(\n (\n {\n className,\n variant = \"text\",\n radius,\n animation = \"pulse\",\n width,\n height,\n style,\n children,\n ...props\n },\n ref,\n ) => {\n const hasChildren = React.Children.count(children) > 0;\n const sizeStyle: React.CSSProperties = {\n ...style,\n ...(width !== undefined && {\n width: typeof width === \"number\" ? `${width}px` : width,\n }),\n ...(height !== undefined && {\n height: typeof height === \"number\" ? `${height}px` : height,\n }),\n };\n\n return (\n <span\n ref={ref}\n aria-hidden=\"true\"\n className={cn(\n \"block bg-[color-mix(in_srgb,var(--color-content-primary)_11%,var(--color-background-primary))]\",\n VARIANT_CLASSES[variant],\n radius && RADIUS_CLASSES[radius],\n variant === \"text\" && !height && !hasChildren && \"h-[1em]\",\n animation === \"pulse\" && \"animate-pulse\",\n animation === \"wave\" && \"fv-skeleton-wave\",\n hasChildren && \"relative overflow-hidden [&>*]:invisible\",\n className,\n )}\n style={sizeStyle}\n {...props}\n >\n {children}\n </span>\n );\n },\n);\n\nSkeleton.displayName = \"Skeleton\";\n"],"names":[],"mappings":";;;;AA0CA,MAAM,kBAAmD;AAAA,EACvD,MAAM;AAAA,EACN,UAAU;AAAA,EACV,aAAa;AAAA,EACb,SAAS;AACX;AAEA,MAAM,iBAAiD;AAAA,EACrD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AAiBO,MAAM,WAAW,MAAM;AAAA,EAC5B,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,cAAc,MAAM,SAAS,MAAM,QAAQ,IAAI;AACrD,UAAM,YAAiC;AAAA,MACrC,GAAG;AAAA,MACH,GAAI,UAAU,UAAa;AAAA,QACzB,OAAO,OAAO,UAAU,WAAW,GAAG,KAAK,OAAO;AAAA,MAAA;AAAA,MAEpD,GAAI,WAAW,UAAa;AAAA,QAC1B,QAAQ,OAAO,WAAW,WAAW,GAAG,MAAM,OAAO;AAAA,MAAA;AAAA,IACvD;AAGF,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA,gBAAgB,OAAO;AAAA,UACvB,UAAU,eAAe,MAAM;AAAA,UAC/B,YAAY,UAAU,CAAC,UAAU,CAAC,eAAe;AAAA,UACjD,cAAc,WAAW;AAAA,UACzB,cAAc,UAAU;AAAA,UACxB,eAAe;AAAA,UACf;AAAA,QAAA;AAAA,QAEF,OAAO;AAAA,QACN,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEA,SAAS,cAAc;"}
package/dist/index.d.ts CHANGED
@@ -1021,6 +1021,11 @@ export declare interface BaseIconProps extends Omit<React_2.SVGAttributes<SVGSVG
1021
1021
  size?: IconSize;
1022
1022
  /** Render the filled variant when available; falls back to outlined. @default false */
1023
1023
  filled?: boolean;
1024
+ /**
1025
+ * Rotate the icon continuously, for loading and busy states. Under
1026
+ * `prefers-reduced-motion` it pulses in place instead. @default false
1027
+ */
1028
+ spin?: boolean;
1024
1029
  }
1025
1030
 
1026
1031
  /**
@@ -2597,6 +2602,7 @@ export declare type DialogCloseProps = React_2.ComponentPropsWithoutRef<typeof D
2597
2602
  * with top-only border radius by default; pass `mobilePresentation="card"` to
2598
2603
  * render a centered floating card instead (used for small confirmation dialogs).
2599
2604
  * On larger viewports it renders centered with full border radius.
2605
+ * `size="full"` skips both and fills the viewport with no chrome.
2600
2606
  *
2601
2607
  * It animates in and out. While the closing animation plays the panel stays
2602
2608
  * mounted but ignores pointer input, so a second click can't act on it.
@@ -2626,14 +2632,19 @@ export declare const DialogContent: React_2.ForwardRefExoticComponent<DialogCont
2626
2632
 
2627
2633
  export declare interface DialogContentProps extends React_2.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
2628
2634
  /**
2629
- * Width preset for the dialog.
2635
+ * Size preset for the dialog.
2630
2636
  * - `"sm"` — 400px max-width (confirmations, simple forms)
2631
2637
  * - `"md"` — 440px max-width (default, standard dialogs)
2632
2638
  * - `"lg"` — 600px max-width (complex content, tables)
2639
+ * - `"full"` — edge to edge with no border, radius, padding or pull handle, on the
2640
+ * theme's `bg-background-primary` surface, for media viewers. A viewer that wants a
2641
+ * black stage passes its own surface through `className`. Its height follows
2642
+ * `--visual-viewport-h` when the page sets it (to track the on-screen keyboard)
2643
+ * and falls back to `100dvh`.
2633
2644
  *
2634
2645
  * @default "md"
2635
2646
  */
2636
- size?: "sm" | "md" | "lg";
2647
+ size?: DialogContentSize;
2637
2648
  /** When true, renders overlay automatically. @default true */
2638
2649
  overlay?: boolean;
2639
2650
  /**
@@ -2657,6 +2668,9 @@ export declare interface DialogContentProps extends React_2.ComponentPropsWithou
2657
2668
  overlayProps?: DialogOverlayProps;
2658
2669
  }
2659
2670
 
2671
+ /** Size preset of {@link DialogContent}. */
2672
+ export declare type DialogContentSize = "sm" | "md" | "lg" | "full";
2673
+
2660
2674
  /** Accessible description for the dialog. Rendered as secondary text. */
2661
2675
  export declare const DialogDescription: React_2.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React_2.RefAttributes<HTMLParagraphElement>, "ref"> & React_2.RefAttributes<HTMLParagraphElement>>;
2662
2676
 
@@ -3869,8 +3883,8 @@ export declare type HourglassIconProps = BaseIconProps;
3869
3883
  * icon alone (e.g. close, send). Always pair with an `aria-label` for
3870
3884
  * accessibility.
3871
3885
  *
3872
- * Shape is size-driven for the standard variants: the `24` size is squared
3873
- * (`rounded-xs`), every larger size is circular. Bespoke variants (`brand`,
3886
+ * Shape is size-driven for the standard variants and `overlay`: the `24` size is
3887
+ * squared (`rounded-xs`), every larger size is circular. Bespoke variants (`brand`,
3874
3888
  * `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop`,
3875
3889
  * `microphone`) stay circular at all sizes. `field` is the exception that is
3876
3890
  * never circular — it takes the inputs' `rounded-sm` so it matches the fields it
@@ -3911,10 +3925,15 @@ export declare type IconButtonSize = "24" | "32" | "40" | "48" | "52" | "72";
3911
3925
  * `24` size, circular otherwise). Of these, `primary`, `secondary`, `tertiary`
3912
3926
  * and `outline` also honour the {@link IconButtonProps.negative} prop.
3913
3927
  *
3928
+ * `overlay` is a translucent dark fill with a backdrop blur, for buttons that sit
3929
+ * on photos or video. Its fill and icon look the same in light and dark themes, while
3930
+ * the keyboard focus ring still follows the theme. It takes the same size-driven
3931
+ * shape as the standard variants.
3932
+ *
3914
3933
  * `brand`, `contrast`, `messaging`, `navTray`, `tertiaryDestructive`, `stop` and
3915
3934
  * `microphone` are bespoke variants that stay circular at every size.
3916
3935
  */
3917
- export declare type IconButtonVariant = "primary" | "secondary" | "tertiary" | "outline" | "error" | "white" | "black" | "brand" | "contrast" | "messaging" | "navTray" | "tertiaryDestructive" | "stop" | "microphone" | "field";
3936
+ export declare type IconButtonVariant = "primary" | "secondary" | "tertiary" | "outline" | "error" | "white" | "black" | "brand" | "contrast" | "messaging" | "navTray" | "tertiaryDestructive" | "stop" | "microphone" | "overlay" | "field";
3918
3937
 
3919
3938
  /** A single drawable path within an icon variant. */
3920
3939
  export declare type IconPath = {
@@ -5765,6 +5784,7 @@ export declare type ShareIconProps = BaseIconProps;
5765
5784
  * <Skeleton variant="text" width={200} />
5766
5785
  * <Skeleton variant="circular" width={40} height={40} />
5767
5786
  * <Skeleton variant="rectangular" width="100%" height={120} />
5787
+ * <Skeleton variant="rectangular" radius="lg" width="100%" height={240} />
5768
5788
  * ```
5769
5789
  */
5770
5790
  export declare const Skeleton: React_2.ForwardRefExoticComponent<SkeletonProps & React_2.RefAttributes<HTMLSpanElement>>;
@@ -5783,6 +5803,17 @@ export declare interface SkeletonProps extends React_2.HTMLAttributes<HTMLSpanEl
5783
5803
  * @default "text"
5784
5804
  */
5785
5805
  variant?: SkeletonVariant;
5806
+ /**
5807
+ * Corner radius on the kit scale, so a skeleton can match the corners of the
5808
+ * surface it stands in for. Overrides the radius the `variant` sets.
5809
+ *
5810
+ * - `sm` – `--radius-sm` (12px)
5811
+ * - `md` – `--radius-md` (16px)
5812
+ * - `lg` – `--radius-lg` (24px)
5813
+ *
5814
+ * Leave unset to keep the variant's own radius.
5815
+ */
5816
+ radius?: SkeletonRadius;
5786
5817
  /** Animation style. Set to `false` to disable animation. @default "pulse" */
5787
5818
  animation?: SkeletonAnimation;
5788
5819
  /** Width of the skeleton. Accepts a CSS value (number is treated as `px`). */
@@ -5791,6 +5822,9 @@ export declare interface SkeletonProps extends React_2.HTMLAttributes<HTMLSpanEl
5791
5822
  height?: number | string;
5792
5823
  }
5793
5824
 
5825
+ /** Corner radius of the skeleton, on the kit radius scale. */
5826
+ export declare type SkeletonRadius = "sm" | "md" | "lg";
5827
+
5794
5828
  /** Shape variant of the skeleton placeholder. */
5795
5829
  export declare type SkeletonVariant = "text" | "circular" | "rectangular" | "rounded";
5796
5830
 
@@ -5902,10 +5936,24 @@ export declare const SoundIcon: React_2.ForwardRefExoticComponent<BaseIconProps
5902
5936
  /** Props for {@link SoundIcon}. See {@link BaseIconProps} for the shared shape. */
5903
5937
  export declare type SoundIconProps = BaseIconProps;
5904
5938
 
5905
- /** A circular spinner icon for loading states (20 × 20). Pair with a CSS `animate-spin` class or use the `Loader` component. */
5906
- export declare const SpinnerIcon: React_2.ForwardRefExoticComponent<React_2.SVGAttributes<SVGSVGElement> & {
5907
- className?: string;
5908
- } & React_2.RefAttributes<SVGSVGElement>>;
5939
+ /**
5940
+ * A circular spinner glyph for loading states. It is a plain icon: pass `spin`
5941
+ * to turn it, as with any other prop-based icon. Prefer `spin`: a raw `animate-spin`
5942
+ * class keeps rotating under reduced motion. Combining the two never doubles the
5943
+ * speed. For a full-area loading state use the `Loader` component.
5944
+ *
5945
+ * @example
5946
+ * ```tsx
5947
+ * <SpinnerIcon size={16} spin />
5948
+ * ```
5949
+ */
5950
+ export declare const SpinnerIcon: React_2.ForwardRefExoticComponent<SpinnerIconProps & React_2.RefAttributes<SVGSVGElement>>;
5951
+
5952
+ /** Props for {@link SpinnerIcon}. */
5953
+ export declare interface SpinnerIconProps extends Omit<IconProps, "size">, Pick<BaseIconProps, "spin"> {
5954
+ /** Pixel size of the spinner. Defaults to 20px when omitted. */
5955
+ size?: IconSize;
5956
+ }
5909
5957
 
5910
5958
  /**
5911
5959
  * Star icon. Renders at sizes 16, 24, or 32 px with outlined and filled variants.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanvue/ui",
3
- "version": "3.49.0",
3
+ "version": "3.50.0",
4
4
  "description": "React component library built with Tailwind CSS for Fanvue ecosystem",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",