@fanvue/ui 3.33.1 → 3.34.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.
@@ -6,11 +6,12 @@ const reactSlot = require("@radix-ui/react-slot");
6
6
  const React = require("react");
7
7
  const cn = require("../../utils/cn.cjs");
8
8
  const Button = require("../Button/Button.cjs");
9
- const CheckCircleIcon = require("../Icons/CheckCircleIcon.cjs");
10
- const CrossIcon = require("../Icons/CrossIcon.cjs");
11
- const ErrorCircleIcon = require("../Icons/ErrorCircleIcon.cjs");
12
- const InfoCircleIcon = require("../Icons/InfoCircleIcon.cjs");
13
- const WarningTriangleIcon = require("../Icons/WarningTriangleIcon.cjs");
9
+ const IconButton = require("../IconButton/IconButton.cjs");
10
+ const AlertIcon = require("../Icons/AlertIcon.cjs");
11
+ const CloseIcon = require("../Icons/CloseIcon.cjs");
12
+ const InfoIcon = require("../Icons/InfoIcon.cjs");
13
+ const TickCircleIcon = require("../Icons/TickCircleIcon.cjs");
14
+ const WarningIcon = require("../Icons/WarningIcon.cjs");
14
15
  function _interopNamespaceDefault(e) {
15
16
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
16
17
  if (e) {
@@ -29,26 +30,67 @@ function _interopNamespaceDefault(e) {
29
30
  }
30
31
  const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
31
32
  const DEFAULT_ICONS = {
32
- info: /* @__PURE__ */ jsxRuntime.jsx(InfoCircleIcon.InfoCircleIcon, {}),
33
- success: /* @__PURE__ */ jsxRuntime.jsx(CheckCircleIcon.CheckCircleIcon, {}),
34
- warning: /* @__PURE__ */ jsxRuntime.jsx(WarningTriangleIcon.WarningTriangleIcon, {}),
35
- error: /* @__PURE__ */ jsxRuntime.jsx(ErrorCircleIcon.ErrorCircleIcon, {}),
36
- neutral: /* @__PURE__ */ jsxRuntime.jsx(InfoCircleIcon.InfoCircleIcon, {})
33
+ info: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon.InfoIcon, { size: 16, filled: true }),
34
+ success: /* @__PURE__ */ jsxRuntime.jsx(TickCircleIcon.TickCircleIcon, { size: 16, filled: true }),
35
+ warning: /* @__PURE__ */ jsxRuntime.jsx(AlertIcon.AlertIcon, { size: 16, filled: true }),
36
+ error: /* @__PURE__ */ jsxRuntime.jsx(WarningIcon.WarningIcon, { size: 16, filled: true }),
37
+ neutral: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon.InfoIcon, { size: 16, filled: true })
37
38
  };
38
- const CLOSE_BUTTON_CLASSES = {
39
- info: "hover:bg-info-content/10 active:bg-info-content/20 text-info-content motion-safe:transition-colors motion-safe:duration-150",
40
- success: "hover:bg-success-content/10 active:bg-success-content/20 text-success-content motion-safe:transition-colors motion-safe:duration-150",
41
- warning: "hover:bg-warning-content/10 active:bg-warning-content/20 text-warning-content motion-safe:transition-colors motion-safe:duration-150",
42
- error: "hover:bg-error-content/10 active:bg-error-content/20 text-error-content motion-safe:transition-colors motion-safe:duration-150",
43
- neutral: "hover:bg-content-secondary/10 active:bg-content-secondary/20 text-content-secondary motion-safe:transition-colors motion-safe:duration-150"
44
- };
45
- const LINK_CLASSES = {
39
+ const MESSAGE_CLASSES = {
46
40
  info: "text-alerts-info-prompt-content-info",
47
41
  success: "text-alerts-info-prompt-content-success",
48
42
  warning: "text-alerts-info-prompt-content-warning",
49
43
  error: "text-alerts-info-prompt-content-error",
50
44
  neutral: "text-content-secondary"
51
45
  };
46
+ const SURFACE_CLASSES = {
47
+ info: "bg-alerts-info-prompt-background-info text-alerts-info-prompt-icon-info",
48
+ success: "bg-alerts-info-prompt-background-success text-alerts-info-prompt-icon-success",
49
+ warning: "bg-alerts-info-prompt-background-warning text-alerts-info-prompt-icon-warning",
50
+ error: "bg-alerts-info-prompt-background-error text-alerts-info-prompt-icon-error",
51
+ neutral: "bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral"
52
+ };
53
+ const LINK_CLASSES = "text-buttons-link-primary-default hover:text-buttons-link-primary-hover";
54
+ function AlertCta({
55
+ action,
56
+ ctaLabel,
57
+ ctaProps,
58
+ isTrailing
59
+ }) {
60
+ if (action) {
61
+ return /* @__PURE__ */ jsxRuntime.jsx(
62
+ reactSlot.Slot,
63
+ {
64
+ className: cn.cn(
65
+ "typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2",
66
+ isTrailing && "shrink-0",
67
+ LINK_CLASSES
68
+ ),
69
+ children: action
70
+ }
71
+ );
72
+ }
73
+ if (ctaLabel === void 0 || ctaLabel === null || ctaLabel === false) {
74
+ return null;
75
+ }
76
+ return /* @__PURE__ */ jsxRuntime.jsx(
77
+ Button.Button,
78
+ {
79
+ variant: "secondary",
80
+ size: "32",
81
+ ...ctaProps,
82
+ className: cn.cn(
83
+ // Stacked, the CTA sits in a flex column, which would otherwise stretch
84
+ // it across the whole alert. Fill on mobile, where a full-width button
85
+ // is the easier target, and hug from `sm` (850px) up. Inline, it always
86
+ // hugs so the message keeps the remaining width.
87
+ isTrailing ? "shrink-0" : "w-full sm:w-fit",
88
+ ctaProps?.className
89
+ ),
90
+ children: ctaLabel
91
+ }
92
+ );
93
+ }
52
94
  const Alert = React__namespace.forwardRef(
53
95
  ({
54
96
  className,
@@ -59,57 +101,74 @@ const Alert = React__namespace.forwardRef(
59
101
  onClose,
60
102
  closeLabel = "Close alert",
61
103
  action,
104
+ layout = "under",
105
+ ctaLabel,
106
+ ctaProps,
62
107
  children,
63
108
  ...props
64
109
  }, ref) => {
65
110
  const resolvedIcon = icon === null ? null : icon ?? DEFAULT_ICONS[variant];
111
+ const isTrailing = layout === "trailing";
66
112
  return /* @__PURE__ */ jsxRuntime.jsxs(
67
113
  "div",
68
114
  {
69
115
  ref,
70
116
  "data-testid": "alert",
71
117
  className: cn.cn(
72
- "grid gap-x-3 rounded-xs p-4 text-sm leading-[18px]",
73
- resolvedIcon && closable && "grid-cols-[auto_1fr_auto]",
74
- resolvedIcon && !closable && "grid-cols-[auto_1fr]",
75
- !resolvedIcon && closable && "grid-cols-[1fr_auto]",
76
- !resolvedIcon && !closable && "grid-cols-[1fr]",
77
- title && children ? "items-start" : "items-center",
78
- variant === "info" && "bg-info-surface text-info-content",
79
- variant === "success" && "bg-success-surface text-success-content",
80
- variant === "warning" && "bg-warning-surface text-warning-content",
81
- variant === "error" && "bg-error-surface text-error-content",
82
- variant === "neutral" && "bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral",
118
+ // Mirrors the Figma frame: 12px inset with a 16px left inset, 24px
119
+ // from the content row to the close button, `rounded-md` radius.
120
+ "flex items-start gap-6 rounded-md p-3 pl-4 text-sm leading-[18px]",
121
+ SURFACE_CLASSES[variant],
83
122
  className
84
123
  ),
85
124
  ...props,
86
125
  children: [
87
- resolvedIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex h-full shrink-0 items-start", "aria-hidden": "true", children: resolvedIcon }),
88
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [
89
- /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "alert", className: "flex flex-col gap-2", children: [
90
- title && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "typography-body-small-14px-semibold text-content-primary", children: title }),
91
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "typography-body-small-14px-regular text-content-primary", children })
92
- ] }),
93
- action && /* @__PURE__ */ jsxRuntime.jsx(
94
- reactSlot.Slot,
126
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-1 items-start gap-3 py-1 pr-1", children: [
127
+ resolvedIcon && // The design's icon slot is 16px, but the default variant icons
128
+ // (InfoCircleIcon and friends) ship at `size-5`, so constrain the
129
+ // glyph here — the same way IconButton sizes its own icon. The 1px
130
+ // top nudge then lands it optically centred on the first 18px line,
131
+ // as in the design's icon-wrapper.
132
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex shrink-0 items-start pt-px [&>svg]:size-4", "aria-hidden": "true", children: resolvedIcon }),
133
+ /* @__PURE__ */ jsxRuntime.jsxs(
134
+ "div",
95
135
  {
96
136
  className: cn.cn(
97
- "typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2",
98
- LINK_CLASSES[variant]
137
+ "flex min-w-0 flex-1",
138
+ isTrailing ? "items-center gap-6" : "flex-col gap-3"
99
139
  ),
100
- children: action
140
+ children: [
141
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "alert", className: cn.cn("flex flex-col gap-1", isTrailing && "min-w-0 flex-1"), children: [
142
+ title && /* @__PURE__ */ jsxRuntime.jsx(
143
+ "div",
144
+ {
145
+ className: cn.cn("typography-body-small-14px-semibold", MESSAGE_CLASSES[variant]),
146
+ children: title
147
+ }
148
+ ),
149
+ children ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn.cn("typography-body-small-14px-regular", MESSAGE_CLASSES[variant]), children }) : null
150
+ ] }),
151
+ /* @__PURE__ */ jsxRuntime.jsx(
152
+ AlertCta,
153
+ {
154
+ action,
155
+ ctaLabel,
156
+ ctaProps,
157
+ isTrailing
158
+ }
159
+ )
160
+ ]
101
161
  }
102
162
  )
103
163
  ] }),
104
164
  closable && /* @__PURE__ */ jsxRuntime.jsx(
105
- Button.Button,
165
+ IconButton.IconButton,
106
166
  {
107
- variant: "tertiary",
167
+ variant: "secondary",
108
168
  size: "24",
109
169
  onClick: onClose,
110
- className: cn.cn("self-start px-0", CLOSE_BUTTON_CLASSES[variant]),
111
170
  "aria-label": closeLabel,
112
- children: /* @__PURE__ */ jsxRuntime.jsx(CrossIcon.CrossIcon, {})
171
+ icon: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon.CloseIcon, { size: 16 })
113
172
  }
114
173
  )
115
174
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.cjs","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../Button/Button\";\nimport { CheckCircleIcon } from \"../Icons/CheckCircleIcon\";\nimport { CrossIcon } from \"../Icons/CrossIcon\";\nimport { ErrorCircleIcon } from \"../Icons/ErrorCircleIcon\";\nimport { InfoCircleIcon } from \"../Icons/InfoCircleIcon\";\nimport { WarningTriangleIcon } from \"../Icons/WarningTriangleIcon\";\n\n/** Visual style variant of the alert. */\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\";\n\nconst DEFAULT_ICONS: Record<AlertVariant, React.ReactNode> = {\n info: <InfoCircleIcon />,\n success: <CheckCircleIcon />,\n warning: <WarningTriangleIcon />,\n error: <ErrorCircleIcon />,\n neutral: <InfoCircleIcon />,\n};\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Visual style variant of the alert. @default \"info\" */\n variant?: AlertVariant;\n /** Optional title text displayed in bold above the description. */\n title?: string;\n /** Custom icon override. Pass `null` to hide the icon entirely. Each variant shows a default icon when left `undefined`. */\n icon?: React.ReactNode | null;\n /** Whether to show the close button. @default false */\n closable?: boolean;\n /** Callback fired when the close button is clicked. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close alert\" */\n closeLabel?: string;\n /**\n * Composable action slot rendered beneath the description, outside the\n * `role=\"alert\"` live region. Pass your own element (an `<a>`, a `next/link`\n * `<Link>`, or a `<Button>`) and it receives the variant-appropriate link\n * styling via the Radix `Slot` pattern while remaining a real link/button.\n */\n action?: React.ReactNode;\n}\n\nconst CLOSE_BUTTON_CLASSES: Record<AlertVariant, string> = {\n info: \"hover:bg-info-content/10 active:bg-info-content/20 text-info-content motion-safe:transition-colors motion-safe:duration-150\",\n success:\n \"hover:bg-success-content/10 active:bg-success-content/20 text-success-content motion-safe:transition-colors motion-safe:duration-150\",\n warning:\n \"hover:bg-warning-content/10 active:bg-warning-content/20 text-warning-content motion-safe:transition-colors motion-safe:duration-150\",\n error:\n \"hover:bg-error-content/10 active:bg-error-content/20 text-error-content motion-safe:transition-colors motion-safe:duration-150\",\n neutral:\n \"hover:bg-content-secondary/10 active:bg-content-secondary/20 text-content-secondary motion-safe:transition-colors motion-safe:duration-150\",\n};\n\nconst LINK_CLASSES: Record<AlertVariant, string> = {\n info: \"text-alerts-info-prompt-content-info\",\n success: \"text-alerts-info-prompt-content-success\",\n warning: \"text-alerts-info-prompt-content-warning\",\n error: \"text-alerts-info-prompt-content-error\",\n neutral: \"text-content-secondary\",\n};\n\n/**\n * Displays a contextual feedback message to the user.\n *\n * Supports `info`, `success`, `warning`, `error`, and `neutral` variants with a\n * default icon per variant, optional title, description, dismiss button, and an\n * optional composable `action` slot.\n *\n * Each variant renders a default icon automatically. Pass a custom `icon` to\n * override, or `icon={null}` to hide the icon entirely.\n *\n * Only the title and description live inside the `role=\"alert\"` live region.\n * The icon, `action`, and close button are rendered outside it so interactive\n * controls are announced and navigated consistently by screen readers.\n *\n * @example\n * ```tsx\n * <Alert variant=\"success\" title=\"Saved\" closable onClose={handleClose}>\n * Your changes have been saved.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * <Alert variant=\"neutral\" title=\"Heads up\" action={<a href=\"/docs\">Learn more</a>}>\n * A general notice with no specific sentiment.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * import Link from \"next/link\";\n *\n * <Alert variant=\"info\" title=\"Update available\" action={<Link href=\"/changelog\">See what's new</Link>}>\n * A new version is ready to install.\n * </Alert>\n * ```\n */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n (\n {\n className,\n variant = \"info\",\n title,\n icon,\n closable = false,\n onClose,\n closeLabel = \"Close alert\",\n action,\n children,\n ...props\n },\n ref,\n ) => {\n const resolvedIcon = icon === null ? null : (icon ?? DEFAULT_ICONS[variant]);\n\n return (\n <div\n ref={ref}\n data-testid=\"alert\"\n className={cn(\n \"grid gap-x-3 rounded-xs p-4 text-sm leading-[18px]\",\n resolvedIcon && closable && \"grid-cols-[auto_1fr_auto]\",\n resolvedIcon && !closable && \"grid-cols-[auto_1fr]\",\n !resolvedIcon && closable && \"grid-cols-[1fr_auto]\",\n !resolvedIcon && !closable && \"grid-cols-[1fr]\",\n title && children ? \"items-start\" : \"items-center\",\n variant === \"info\" && \"bg-info-surface text-info-content\",\n variant === \"success\" && \"bg-success-surface text-success-content\",\n variant === \"warning\" && \"bg-warning-surface text-warning-content\",\n variant === \"error\" && \"bg-error-surface text-error-content\",\n variant === \"neutral\" &&\n \"bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral\",\n className,\n )}\n {...props}\n >\n {resolvedIcon && (\n <span className=\"flex h-full shrink-0 items-start\" aria-hidden=\"true\">\n {resolvedIcon}\n </span>\n )}\n\n <div className=\"flex min-w-0 flex-col gap-2\">\n <div role=\"alert\" className=\"flex flex-col gap-2\">\n {title && (\n <div className=\"typography-body-small-14px-semibold text-content-primary\">\n {title}\n </div>\n )}\n <div className=\"typography-body-small-14px-regular text-content-primary\">\n {children}\n </div>\n </div>\n {action && (\n <Slot\n className={cn(\n \"typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2\",\n LINK_CLASSES[variant],\n )}\n >\n {action}\n </Slot>\n )}\n </div>\n\n {closable && (\n <Button\n variant=\"tertiary\"\n size=\"24\"\n onClick={onClose}\n className={cn(\"self-start px-0\", CLOSE_BUTTON_CLASSES[variant])}\n aria-label={closeLabel}\n >\n <CrossIcon />\n </Button>\n )}\n </div>\n );\n },\n);\n\nAlert.displayName = \"Alert\";\n"],"names":["InfoCircleIcon","CheckCircleIcon","WarningTriangleIcon","ErrorCircleIcon","React","jsxs","cn","jsx","Slot","Button","CrossIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,gBAAuD;AAAA,EAC3D,qCAAOA,eAAAA,gBAAA,EAAe;AAAA,EACtB,wCAAUC,gBAAAA,iBAAA,EAAgB;AAAA,EAC1B,wCAAUC,oBAAAA,qBAAA,EAAoB;AAAA,EAC9B,sCAAQC,gBAAAA,iBAAA,EAAgB;AAAA,EACx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AA,OACH;AAAA,cAEFA,2BAAAA,IAAC,OAAA,EAAI,WAAU,2DACZ,SAAA,CACH;AAAA,YAAA,GACF;AAAA,YACC,UACCA,2BAAAA;AAAAA,cAACC,UAAAA;AAAAA,cAAA;AAAA,gBACC,WAAWF,GAAAA;AAAAA,kBACT;AAAA,kBACA,aAAa,OAAO;AAAA,gBAAA;AAAA,gBAGrB,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,UAEC,YACCC,2BAAAA;AAAAA,YAACE,OAAAA;AAAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS;AAAA,cACT,WAAWH,GAAAA,GAAG,mBAAmB,qBAAqB,OAAO,CAAC;AAAA,cAC9D,cAAY;AAAA,cAEZ,yCAACI,UAAAA,WAAA,CAAA,CAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACb;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,MAAM,cAAc;;"}
1
+ {"version":3,"file":"Alert.cjs","sources":["../../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button, type ButtonProps } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { AlertIcon } from \"../Icons/AlertIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\nimport { InfoIcon } from \"../Icons/InfoIcon\";\nimport { TickCircleIcon } from \"../Icons/TickCircleIcon\";\nimport { WarningIcon } from \"../Icons/WarningIcon\";\n\n/** Visual style variant of the alert. */\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\";\n\n/**\n * Placement of the call-to-action relative to the message.\n *\n * - `\"under\"` stacks the action beneath the description. Use it when the CTA\n * label is long or the alert is narrow.\n * - `\"trailing\"` keeps the action inline with the message, which keeps the\n * alert compact and works best with short labels.\n */\nexport type AlertLayout = \"under\" | \"trailing\";\n\n/**\n * Per-variant default icon, mapped to the Iconography components the design\n * uses at `Size=16, Fill=Yes`. Note the design's naming: its Error variant\n * takes `Iconography / Warning` and its Warning variant takes\n * `Iconography / Alert`, which reads backwards but is what the node specifies.\n *\n * These carry dedicated 16px geometry, unlike the `*CircleIcon` set they\n * replace, whose 20px art had to be scaled down.\n */\nconst DEFAULT_ICONS: Record<AlertVariant, React.ReactNode> = {\n info: <InfoIcon size={16} filled />,\n success: <TickCircleIcon size={16} filled />,\n warning: <AlertIcon size={16} filled />,\n error: <WarningIcon size={16} filled />,\n neutral: <InfoIcon size={16} filled />,\n};\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Visual style variant of the alert. @default \"info\" */\n variant?: AlertVariant;\n /** Optional title text displayed in bold above the description. */\n title?: string;\n /** Custom icon override. Pass `null` to hide the icon entirely. Each variant shows a default icon when left `undefined`. */\n icon?: React.ReactNode | null;\n /** Whether to show the close button. @default false */\n closable?: boolean;\n /** Callback fired when the close button is clicked. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close alert\" */\n closeLabel?: string;\n /**\n * Composable action slot rendered beneath the description, outside the\n * `role=\"alert\"` live region. Pass your own element (an `<a>`, a `next/link`\n * `<Link>`, or a `<Button>`) and it receives the variant-appropriate link\n * styling via the Radix `Slot` pattern while remaining a real link/button.\n */\n action?: React.ReactNode;\n /** Placement of the call-to-action relative to the message. @default \"under\" */\n layout?: AlertLayout;\n /**\n * Label for a built-in call-to-action button, the button form of the CTA.\n * Use it when the alert asks the user to do something specific — activating a\n * feature, or completing setup — rather than pointing at more detail. Ignored\n * when `action` is set.\n */\n ctaLabel?: React.ReactNode;\n /**\n * Props forwarded to the built-in call-to-action button (e.g. `onClick`).\n * `variant` and `size` default to `secondary`/`32` and can be overridden.\n *\n * The stacked CTA is `w-full sm:w-fit`. To override the width, match the\n * modifier chain — a bare `w-auto` replaces `w-full` but leaves `sm:w-fit`\n * in place, so pass `sm:` variants too.\n */\n ctaProps?: Omit<ButtonProps, \"children\" | \"asChild\">;\n}\n\n/**\n * Title and description colour. The design binds both to\n * `Color/Alerts/Info Prompt/Content/<variant>`, and Neutral to\n * `Color/Content/Secondary` — not to `content-primary`, which reads as plain\n * black on the tinted surface.\n */\nconst MESSAGE_CLASSES: Record<AlertVariant, string> = {\n info: \"text-alerts-info-prompt-content-info\",\n success: \"text-alerts-info-prompt-content-success\",\n warning: \"text-alerts-info-prompt-content-warning\",\n error: \"text-alerts-info-prompt-content-error\",\n neutral: \"text-content-secondary\",\n};\n\n/**\n * Surface fill and icon colour, both read from the component's own design\n * variables: `Color/Alerts/Info Prompt/Background/<variant>` and\n * `Color/Alerts/Info Prompt/Icon/<variant>`.\n *\n * The `text-*` here is inherited by the icon only — the message sets its own\n * colour via {@link MESSAGE_CLASSES}. It matters that this reads the dedicated\n * icon tokens rather than the generic `*-content` ones: those agree only for\n * info, and they carry no dark-mode inversion, where the alert tokens step\n * from `*-600` in light to `*-400` in dark as the design specifies.\n */\nconst SURFACE_CLASSES: Record<AlertVariant, string> = {\n info: \"bg-alerts-info-prompt-background-info text-alerts-info-prompt-icon-info\",\n success: \"bg-alerts-info-prompt-background-success text-alerts-info-prompt-icon-success\",\n warning: \"bg-alerts-info-prompt-background-warning text-alerts-info-prompt-icon-warning\",\n error: \"bg-alerts-info-prompt-background-error text-alerts-info-prompt-icon-error\",\n neutral: \"bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral\",\n};\n\n/**\n * CTA link treatment. The node's CTA is a `V2 Link` instance whose text binds\n * `Color/Buttons/Link/Primary/Default`, with no per-variant override on any of\n * the five — so the link takes the standard link colour rather than the alert's\n * own content tint. These are the same tokens the {@link Link} component\n * applies, including the hover step.\n */\nconst LINK_CLASSES = \"text-buttons-link-primary-default hover:text-buttons-link-primary-hover\";\n\n/**\n * The alert's call-to-action. `action` is the link form: any element passed\n * through receives the variant-appropriate link styling via Radix `Slot` while\n * staying a real link or button. `ctaLabel` is the button form. `action` wins\n * when both are set.\n */\nfunction AlertCta({\n action,\n ctaLabel,\n ctaProps,\n isTrailing,\n}: {\n action: React.ReactNode;\n ctaLabel: React.ReactNode;\n ctaProps?: AlertProps[\"ctaProps\"];\n isTrailing: boolean;\n}) {\n if (action) {\n return (\n <Slot\n className={cn(\n \"typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2\",\n isTrailing && \"shrink-0\",\n LINK_CLASSES,\n )}\n >\n {action}\n </Slot>\n );\n }\n\n if (ctaLabel === undefined || ctaLabel === null || ctaLabel === false) {\n return null;\n }\n\n return (\n <Button\n variant=\"secondary\"\n size=\"32\"\n {...ctaProps}\n className={cn(\n // Stacked, the CTA sits in a flex column, which would otherwise stretch\n // it across the whole alert. Fill on mobile, where a full-width button\n // is the easier target, and hug from `sm` (850px) up. Inline, it always\n // hugs so the message keeps the remaining width.\n isTrailing ? \"shrink-0\" : \"w-full sm:w-fit\",\n ctaProps?.className,\n )}\n >\n {ctaLabel}\n </Button>\n );\n}\n\n/**\n * Displays a contextual feedback message to the user.\n *\n * Supports `info`, `success`, `warning`, `error`, and `neutral` variants with a\n * default icon per variant, optional title, description, dismiss button, and an\n * optional composable `action` slot.\n *\n * Each variant renders a default icon automatically. Pass a custom `icon` to\n * override, or `icon={null}` to hide the icon entirely.\n *\n * Only the title and description live inside the `role=\"alert\"` live region.\n * The icon, `action`, and close button are rendered outside it so interactive\n * controls are announced and navigated consistently by screen readers.\n *\n * @example\n * ```tsx\n * <Alert variant=\"success\" title=\"Saved\" closable onClose={handleClose}>\n * Your changes have been saved.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * <Alert variant=\"neutral\" title=\"Heads up\" action={<a href=\"/docs\">Learn more</a>}>\n * A general notice with no specific sentiment.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * import Link from \"next/link\";\n *\n * <Alert variant=\"info\" title=\"Update available\" action={<Link href=\"/changelog\">See what's new</Link>}>\n * A new version is ready to install.\n * </Alert>\n * ```\n *\n * @example\n * The CTA sits under the description by default. `layout=\"trailing\"` keeps it\n * inline with the message, which suits short labels and keeps the alert compact.\n * ```tsx\n * <Alert variant=\"info\" layout=\"trailing\" action={<a href=\"/docs\">Learn more</a>}>\n * Scheduled posts now publish in your local timezone.\n * </Alert>\n * ```\n *\n * @example\n * `ctaLabel` renders the button form of the CTA instead of a link — use it when\n * the alert asks the user to do something specific.\n * ```tsx\n * <Alert variant=\"warning\" title=\"Finish setup\" layout=\"trailing\" ctaLabel=\"Verify now\" ctaProps={{ onClick: verify }}>\n * Verify your identity to start receiving payouts.\n * </Alert>\n * ```\n */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n (\n {\n className,\n variant = \"info\",\n title,\n icon,\n closable = false,\n onClose,\n closeLabel = \"Close alert\",\n action,\n layout = \"under\",\n ctaLabel,\n ctaProps,\n children,\n ...props\n },\n ref,\n ) => {\n const resolvedIcon = icon === null ? null : (icon ?? DEFAULT_ICONS[variant]);\n const isTrailing = layout === \"trailing\";\n\n return (\n <div\n ref={ref}\n data-testid=\"alert\"\n className={cn(\n // Mirrors the Figma frame: 12px inset with a 16px left inset, 24px\n // from the content row to the close button, `rounded-md` radius.\n \"flex items-start gap-6 rounded-md p-3 pl-4 text-sm leading-[18px]\",\n SURFACE_CLASSES[variant],\n className,\n )}\n {...props}\n >\n {/*\n Content row. Its 4px inset is what takes the container's 12px up to the\n 16px the design specifies around the message, while leaving the close\n button on the container's own 12px. It also puts 28px between the\n message and the close button (this 4px plus the container's 24px gap).\n */}\n <div className=\"flex min-w-0 flex-1 items-start gap-3 py-1 pr-1\">\n {resolvedIcon && (\n // The design's icon slot is 16px, but the default variant icons\n // (InfoCircleIcon and friends) ship at `size-5`, so constrain the\n // glyph here — the same way IconButton sizes its own icon. The 1px\n // top nudge then lands it optically centred on the first 18px line,\n // as in the design's icon-wrapper.\n <span className=\"flex shrink-0 items-start pt-px [&>svg]:size-4\" aria-hidden=\"true\">\n {resolvedIcon}\n </span>\n )}\n\n <div\n className={cn(\n \"flex min-w-0 flex-1\",\n isTrailing ? \"items-center gap-6\" : \"flex-col gap-3\",\n )}\n >\n <div role=\"alert\" className={cn(\"flex flex-col gap-1\", isTrailing && \"min-w-0 flex-1\")}>\n {title && (\n <div\n className={cn(\"typography-body-small-14px-semibold\", MESSAGE_CLASSES[variant])}\n >\n {title}\n </div>\n )}\n {children ? (\n <div className={cn(\"typography-body-small-14px-regular\", MESSAGE_CLASSES[variant])}>\n {children}\n </div>\n ) : null}\n </div>\n <AlertCta\n action={action}\n ctaLabel={ctaLabel}\n ctaProps={ctaProps}\n isTrailing={isTrailing}\n />\n </div>\n </div>\n\n {closable && (\n <IconButton\n variant=\"secondary\"\n size=\"24\"\n onClick={onClose}\n aria-label={closeLabel}\n icon={<CloseIcon size={16} />}\n />\n )}\n </div>\n );\n },\n);\n\nAlert.displayName = \"Alert\";\n"],"names":["jsx","InfoIcon","TickCircleIcon","AlertIcon","WarningIcon","Slot","cn","Button","React","jsxs","IconButton","CloseIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,gBAAuD;AAAA,EAC3D,MAAMA,2BAAAA,IAACC,mBAAA,EAAS,MAAM,IAAI,QAAM,MAAC;AAAA,EACjC,SAASD,2BAAAA,IAACE,+BAAA,EAAe,MAAM,IAAI,QAAM,MAAC;AAAA,EAC1C,SAASF,2BAAAA,IAACG,qBAAA,EAAU,MAAM,IAAI,QAAM,MAAC;AAAA,EACrC,OAAOH,2BAAAA,IAACI,yBAAA,EAAY,MAAM,IAAI,QAAM,MAAC;AAAA,EACrC,SAASJ,2BAAAA,IAACC,mBAAA,EAAS,MAAM,IAAI,QAAM,KAAA,CAAC;AACtC;AAgDA,MAAM,kBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACX;AAaA,MAAM,kBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,SAAS;AAAA,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";
5
5
  import { cn } from "../../utils/cn.mjs";
6
6
  import { Button } from "../Button/Button.mjs";
7
- import { CheckCircleIcon } from "../Icons/CheckCircleIcon.mjs";
8
- import { CrossIcon } from "../Icons/CrossIcon.mjs";
9
- import { ErrorCircleIcon } from "../Icons/ErrorCircleIcon.mjs";
10
- import { InfoCircleIcon } from "../Icons/InfoCircleIcon.mjs";
11
- import { WarningTriangleIcon } from "../Icons/WarningTriangleIcon.mjs";
7
+ import { IconButton } from "../IconButton/IconButton.mjs";
8
+ import { AlertIcon } from "../Icons/AlertIcon.mjs";
9
+ import { CloseIcon } from "../Icons/CloseIcon.mjs";
10
+ import { InfoIcon } from "../Icons/InfoIcon.mjs";
11
+ import { TickCircleIcon } from "../Icons/TickCircleIcon.mjs";
12
+ import { WarningIcon } from "../Icons/WarningIcon.mjs";
12
13
  const DEFAULT_ICONS = {
13
- info: /* @__PURE__ */ jsx(InfoCircleIcon, {}),
14
- success: /* @__PURE__ */ jsx(CheckCircleIcon, {}),
15
- warning: /* @__PURE__ */ jsx(WarningTriangleIcon, {}),
16
- error: /* @__PURE__ */ jsx(ErrorCircleIcon, {}),
17
- neutral: /* @__PURE__ */ jsx(InfoCircleIcon, {})
14
+ info: /* @__PURE__ */ jsx(InfoIcon, { size: 16, filled: true }),
15
+ success: /* @__PURE__ */ jsx(TickCircleIcon, { size: 16, filled: true }),
16
+ warning: /* @__PURE__ */ jsx(AlertIcon, { size: 16, filled: true }),
17
+ error: /* @__PURE__ */ jsx(WarningIcon, { size: 16, filled: true }),
18
+ neutral: /* @__PURE__ */ jsx(InfoIcon, { size: 16, filled: true })
18
19
  };
19
- const CLOSE_BUTTON_CLASSES = {
20
- info: "hover:bg-info-content/10 active:bg-info-content/20 text-info-content motion-safe:transition-colors motion-safe:duration-150",
21
- success: "hover:bg-success-content/10 active:bg-success-content/20 text-success-content motion-safe:transition-colors motion-safe:duration-150",
22
- warning: "hover:bg-warning-content/10 active:bg-warning-content/20 text-warning-content motion-safe:transition-colors motion-safe:duration-150",
23
- error: "hover:bg-error-content/10 active:bg-error-content/20 text-error-content motion-safe:transition-colors motion-safe:duration-150",
24
- neutral: "hover:bg-content-secondary/10 active:bg-content-secondary/20 text-content-secondary motion-safe:transition-colors motion-safe:duration-150"
25
- };
26
- const LINK_CLASSES = {
20
+ const MESSAGE_CLASSES = {
27
21
  info: "text-alerts-info-prompt-content-info",
28
22
  success: "text-alerts-info-prompt-content-success",
29
23
  warning: "text-alerts-info-prompt-content-warning",
30
24
  error: "text-alerts-info-prompt-content-error",
31
25
  neutral: "text-content-secondary"
32
26
  };
27
+ const SURFACE_CLASSES = {
28
+ info: "bg-alerts-info-prompt-background-info text-alerts-info-prompt-icon-info",
29
+ success: "bg-alerts-info-prompt-background-success text-alerts-info-prompt-icon-success",
30
+ warning: "bg-alerts-info-prompt-background-warning text-alerts-info-prompt-icon-warning",
31
+ error: "bg-alerts-info-prompt-background-error text-alerts-info-prompt-icon-error",
32
+ neutral: "bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral"
33
+ };
34
+ const LINK_CLASSES = "text-buttons-link-primary-default hover:text-buttons-link-primary-hover";
35
+ function AlertCta({
36
+ action,
37
+ ctaLabel,
38
+ ctaProps,
39
+ isTrailing
40
+ }) {
41
+ if (action) {
42
+ return /* @__PURE__ */ jsx(
43
+ Slot,
44
+ {
45
+ className: cn(
46
+ "typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2",
47
+ isTrailing && "shrink-0",
48
+ LINK_CLASSES
49
+ ),
50
+ children: action
51
+ }
52
+ );
53
+ }
54
+ if (ctaLabel === void 0 || ctaLabel === null || ctaLabel === false) {
55
+ return null;
56
+ }
57
+ return /* @__PURE__ */ jsx(
58
+ Button,
59
+ {
60
+ variant: "secondary",
61
+ size: "32",
62
+ ...ctaProps,
63
+ className: cn(
64
+ // Stacked, the CTA sits in a flex column, which would otherwise stretch
65
+ // it across the whole alert. Fill on mobile, where a full-width button
66
+ // is the easier target, and hug from `sm` (850px) up. Inline, it always
67
+ // hugs so the message keeps the remaining width.
68
+ isTrailing ? "shrink-0" : "w-full sm:w-fit",
69
+ ctaProps?.className
70
+ ),
71
+ children: ctaLabel
72
+ }
73
+ );
74
+ }
33
75
  const Alert = React.forwardRef(
34
76
  ({
35
77
  className,
@@ -40,57 +82,74 @@ const Alert = React.forwardRef(
40
82
  onClose,
41
83
  closeLabel = "Close alert",
42
84
  action,
85
+ layout = "under",
86
+ ctaLabel,
87
+ ctaProps,
43
88
  children,
44
89
  ...props
45
90
  }, ref) => {
46
91
  const resolvedIcon = icon === null ? null : icon ?? DEFAULT_ICONS[variant];
92
+ const isTrailing = layout === "trailing";
47
93
  return /* @__PURE__ */ jsxs(
48
94
  "div",
49
95
  {
50
96
  ref,
51
97
  "data-testid": "alert",
52
98
  className: cn(
53
- "grid gap-x-3 rounded-xs p-4 text-sm leading-[18px]",
54
- resolvedIcon && closable && "grid-cols-[auto_1fr_auto]",
55
- resolvedIcon && !closable && "grid-cols-[auto_1fr]",
56
- !resolvedIcon && closable && "grid-cols-[1fr_auto]",
57
- !resolvedIcon && !closable && "grid-cols-[1fr]",
58
- title && children ? "items-start" : "items-center",
59
- variant === "info" && "bg-info-surface text-info-content",
60
- variant === "success" && "bg-success-surface text-success-content",
61
- variant === "warning" && "bg-warning-surface text-warning-content",
62
- variant === "error" && "bg-error-surface text-error-content",
63
- variant === "neutral" && "bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral",
99
+ // Mirrors the Figma frame: 12px inset with a 16px left inset, 24px
100
+ // from the content row to the close button, `rounded-md` radius.
101
+ "flex items-start gap-6 rounded-md p-3 pl-4 text-sm leading-[18px]",
102
+ SURFACE_CLASSES[variant],
64
103
  className
65
104
  ),
66
105
  ...props,
67
106
  children: [
68
- resolvedIcon && /* @__PURE__ */ jsx("span", { className: "flex h-full shrink-0 items-start", "aria-hidden": "true", children: resolvedIcon }),
69
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [
70
- /* @__PURE__ */ jsxs("div", { role: "alert", className: "flex flex-col gap-2", children: [
71
- title && /* @__PURE__ */ jsx("div", { className: "typography-body-small-14px-semibold text-content-primary", children: title }),
72
- /* @__PURE__ */ jsx("div", { className: "typography-body-small-14px-regular text-content-primary", children })
73
- ] }),
74
- action && /* @__PURE__ */ jsx(
75
- Slot,
107
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-start gap-3 py-1 pr-1", children: [
108
+ resolvedIcon && // The design's icon slot is 16px, but the default variant icons
109
+ // (InfoCircleIcon and friends) ship at `size-5`, so constrain the
110
+ // glyph here — the same way IconButton sizes its own icon. The 1px
111
+ // top nudge then lands it optically centred on the first 18px line,
112
+ // as in the design's icon-wrapper.
113
+ /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-start pt-px [&>svg]:size-4", "aria-hidden": "true", children: resolvedIcon }),
114
+ /* @__PURE__ */ jsxs(
115
+ "div",
76
116
  {
77
117
  className: cn(
78
- "typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2",
79
- LINK_CLASSES[variant]
118
+ "flex min-w-0 flex-1",
119
+ isTrailing ? "items-center gap-6" : "flex-col gap-3"
80
120
  ),
81
- children: action
121
+ children: [
122
+ /* @__PURE__ */ jsxs("div", { role: "alert", className: cn("flex flex-col gap-1", isTrailing && "min-w-0 flex-1"), children: [
123
+ title && /* @__PURE__ */ jsx(
124
+ "div",
125
+ {
126
+ className: cn("typography-body-small-14px-semibold", MESSAGE_CLASSES[variant]),
127
+ children: title
128
+ }
129
+ ),
130
+ children ? /* @__PURE__ */ jsx("div", { className: cn("typography-body-small-14px-regular", MESSAGE_CLASSES[variant]), children }) : null
131
+ ] }),
132
+ /* @__PURE__ */ jsx(
133
+ AlertCta,
134
+ {
135
+ action,
136
+ ctaLabel,
137
+ ctaProps,
138
+ isTrailing
139
+ }
140
+ )
141
+ ]
82
142
  }
83
143
  )
84
144
  ] }),
85
145
  closable && /* @__PURE__ */ jsx(
86
- Button,
146
+ IconButton,
87
147
  {
88
- variant: "tertiary",
148
+ variant: "secondary",
89
149
  size: "24",
90
150
  onClick: onClose,
91
- className: cn("self-start px-0", CLOSE_BUTTON_CLASSES[variant]),
92
151
  "aria-label": closeLabel,
93
- children: /* @__PURE__ */ jsx(CrossIcon, {})
152
+ icon: /* @__PURE__ */ jsx(CloseIcon, { size: 16 })
94
153
  }
95
154
  )
96
155
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.mjs","sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button } from \"../Button/Button\";\nimport { CheckCircleIcon } from \"../Icons/CheckCircleIcon\";\nimport { CrossIcon } from \"../Icons/CrossIcon\";\nimport { ErrorCircleIcon } from \"../Icons/ErrorCircleIcon\";\nimport { InfoCircleIcon } from \"../Icons/InfoCircleIcon\";\nimport { WarningTriangleIcon } from \"../Icons/WarningTriangleIcon\";\n\n/** Visual style variant of the alert. */\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\";\n\nconst DEFAULT_ICONS: Record<AlertVariant, React.ReactNode> = {\n info: <InfoCircleIcon />,\n success: <CheckCircleIcon />,\n warning: <WarningTriangleIcon />,\n error: <ErrorCircleIcon />,\n neutral: <InfoCircleIcon />,\n};\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Visual style variant of the alert. @default \"info\" */\n variant?: AlertVariant;\n /** Optional title text displayed in bold above the description. */\n title?: string;\n /** Custom icon override. Pass `null` to hide the icon entirely. Each variant shows a default icon when left `undefined`. */\n icon?: React.ReactNode | null;\n /** Whether to show the close button. @default false */\n closable?: boolean;\n /** Callback fired when the close button is clicked. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close alert\" */\n closeLabel?: string;\n /**\n * Composable action slot rendered beneath the description, outside the\n * `role=\"alert\"` live region. Pass your own element (an `<a>`, a `next/link`\n * `<Link>`, or a `<Button>`) and it receives the variant-appropriate link\n * styling via the Radix `Slot` pattern while remaining a real link/button.\n */\n action?: React.ReactNode;\n}\n\nconst CLOSE_BUTTON_CLASSES: Record<AlertVariant, string> = {\n info: \"hover:bg-info-content/10 active:bg-info-content/20 text-info-content motion-safe:transition-colors motion-safe:duration-150\",\n success:\n \"hover:bg-success-content/10 active:bg-success-content/20 text-success-content motion-safe:transition-colors motion-safe:duration-150\",\n warning:\n \"hover:bg-warning-content/10 active:bg-warning-content/20 text-warning-content motion-safe:transition-colors motion-safe:duration-150\",\n error:\n \"hover:bg-error-content/10 active:bg-error-content/20 text-error-content motion-safe:transition-colors motion-safe:duration-150\",\n neutral:\n \"hover:bg-content-secondary/10 active:bg-content-secondary/20 text-content-secondary motion-safe:transition-colors motion-safe:duration-150\",\n};\n\nconst LINK_CLASSES: Record<AlertVariant, string> = {\n info: \"text-alerts-info-prompt-content-info\",\n success: \"text-alerts-info-prompt-content-success\",\n warning: \"text-alerts-info-prompt-content-warning\",\n error: \"text-alerts-info-prompt-content-error\",\n neutral: \"text-content-secondary\",\n};\n\n/**\n * Displays a contextual feedback message to the user.\n *\n * Supports `info`, `success`, `warning`, `error`, and `neutral` variants with a\n * default icon per variant, optional title, description, dismiss button, and an\n * optional composable `action` slot.\n *\n * Each variant renders a default icon automatically. Pass a custom `icon` to\n * override, or `icon={null}` to hide the icon entirely.\n *\n * Only the title and description live inside the `role=\"alert\"` live region.\n * The icon, `action`, and close button are rendered outside it so interactive\n * controls are announced and navigated consistently by screen readers.\n *\n * @example\n * ```tsx\n * <Alert variant=\"success\" title=\"Saved\" closable onClose={handleClose}>\n * Your changes have been saved.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * <Alert variant=\"neutral\" title=\"Heads up\" action={<a href=\"/docs\">Learn more</a>}>\n * A general notice with no specific sentiment.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * import Link from \"next/link\";\n *\n * <Alert variant=\"info\" title=\"Update available\" action={<Link href=\"/changelog\">See what's new</Link>}>\n * A new version is ready to install.\n * </Alert>\n * ```\n */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n (\n {\n className,\n variant = \"info\",\n title,\n icon,\n closable = false,\n onClose,\n closeLabel = \"Close alert\",\n action,\n children,\n ...props\n },\n ref,\n ) => {\n const resolvedIcon = icon === null ? null : (icon ?? DEFAULT_ICONS[variant]);\n\n return (\n <div\n ref={ref}\n data-testid=\"alert\"\n className={cn(\n \"grid gap-x-3 rounded-xs p-4 text-sm leading-[18px]\",\n resolvedIcon && closable && \"grid-cols-[auto_1fr_auto]\",\n resolvedIcon && !closable && \"grid-cols-[auto_1fr]\",\n !resolvedIcon && closable && \"grid-cols-[1fr_auto]\",\n !resolvedIcon && !closable && \"grid-cols-[1fr]\",\n title && children ? \"items-start\" : \"items-center\",\n variant === \"info\" && \"bg-info-surface text-info-content\",\n variant === \"success\" && \"bg-success-surface text-success-content\",\n variant === \"warning\" && \"bg-warning-surface text-warning-content\",\n variant === \"error\" && \"bg-error-surface text-error-content\",\n variant === \"neutral\" &&\n \"bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral\",\n className,\n )}\n {...props}\n >\n {resolvedIcon && (\n <span className=\"flex h-full shrink-0 items-start\" aria-hidden=\"true\">\n {resolvedIcon}\n </span>\n )}\n\n <div className=\"flex min-w-0 flex-col gap-2\">\n <div role=\"alert\" className=\"flex flex-col gap-2\">\n {title && (\n <div className=\"typography-body-small-14px-semibold text-content-primary\">\n {title}\n </div>\n )}\n <div className=\"typography-body-small-14px-regular text-content-primary\">\n {children}\n </div>\n </div>\n {action && (\n <Slot\n className={cn(\n \"typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2\",\n LINK_CLASSES[variant],\n )}\n >\n {action}\n </Slot>\n )}\n </div>\n\n {closable && (\n <Button\n variant=\"tertiary\"\n size=\"24\"\n onClick={onClose}\n className={cn(\"self-start px-0\", CLOSE_BUTTON_CLASSES[variant])}\n aria-label={closeLabel}\n >\n <CrossIcon />\n </Button>\n )}\n </div>\n );\n },\n);\n\nAlert.displayName = \"Alert\";\n"],"names":[],"mappings":";;;;;;;;;;;AAaA,MAAM,gBAAuD;AAAA,EAC3D,0BAAO,gBAAA,EAAe;AAAA,EACtB,6BAAU,iBAAA,EAAgB;AAAA,EAC1B,6BAAU,qBAAA,EAAoB;AAAA,EAC9B,2BAAQ,iBAAA,EAAgB;AAAA,EACxB,6BAAU,gBAAA,CAAA,CAAe;AAC3B;AAwBA,MAAM,uBAAqD;AAAA,EACzD,MAAM;AAAA,EACN,SACE;AAAA,EACF,SACE;AAAA,EACF,OACE;AAAA,EACF,SACE;AACJ;AAEA,MAAM,eAA6C;AAAA,EACjD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACX;AAuCO,MAAM,QAAQ,MAAM;AAAA,EACzB,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,UAAM,eAAe,SAAS,OAAO,OAAQ,QAAQ,cAAc,OAAO;AAE1E,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,eAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA,gBAAgB,YAAY;AAAA,UAC5B,gBAAgB,CAAC,YAAY;AAAA,UAC7B,CAAC,gBAAgB,YAAY;AAAA,UAC7B,CAAC,gBAAgB,CAAC,YAAY;AAAA,UAC9B,SAAS,WAAW,gBAAgB;AAAA,UACpC,YAAY,UAAU;AAAA,UACtB,YAAY,aAAa;AAAA,UACzB,YAAY,aAAa;AAAA,UACzB,YAAY,WAAW;AAAA,UACvB,YAAY,aACV;AAAA,UACF;AAAA,QAAA;AAAA,QAED,GAAG;AAAA,QAEH,UAAA;AAAA,UAAA,oCACE,QAAA,EAAK,WAAU,oCAAmC,eAAY,QAC5D,UAAA,cACH;AAAA,UAGF,qBAAC,OAAA,EAAI,WAAU,+BACb,UAAA;AAAA,YAAA,qBAAC,OAAA,EAAI,MAAK,SAAQ,WAAU,uBACzB,UAAA;AAAA,cAAA,SACC,oBAAC,OAAA,EAAI,WAAU,4DACZ,UAAA,OACH;AAAA,cAEF,oBAAC,OAAA,EAAI,WAAU,2DACZ,SAAA,CACH;AAAA,YAAA,GACF;AAAA,YACC,UACC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,aAAa,OAAO;AAAA,gBAAA;AAAA,gBAGrB,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,GAEJ;AAAA,UAEC,YACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS;AAAA,cACT,WAAW,GAAG,mBAAmB,qBAAqB,OAAO,CAAC;AAAA,cAC9D,cAAY;AAAA,cAEZ,8BAAC,WAAA,CAAA,CAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACb;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,MAAM,cAAc;"}
1
+ {"version":3,"file":"Alert.mjs","sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Button, type ButtonProps } from \"../Button/Button\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { AlertIcon } from \"../Icons/AlertIcon\";\nimport { CloseIcon } from \"../Icons/CloseIcon\";\nimport { InfoIcon } from \"../Icons/InfoIcon\";\nimport { TickCircleIcon } from \"../Icons/TickCircleIcon\";\nimport { WarningIcon } from \"../Icons/WarningIcon\";\n\n/** Visual style variant of the alert. */\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\" | \"neutral\";\n\n/**\n * Placement of the call-to-action relative to the message.\n *\n * - `\"under\"` stacks the action beneath the description. Use it when the CTA\n * label is long or the alert is narrow.\n * - `\"trailing\"` keeps the action inline with the message, which keeps the\n * alert compact and works best with short labels.\n */\nexport type AlertLayout = \"under\" | \"trailing\";\n\n/**\n * Per-variant default icon, mapped to the Iconography components the design\n * uses at `Size=16, Fill=Yes`. Note the design's naming: its Error variant\n * takes `Iconography / Warning` and its Warning variant takes\n * `Iconography / Alert`, which reads backwards but is what the node specifies.\n *\n * These carry dedicated 16px geometry, unlike the `*CircleIcon` set they\n * replace, whose 20px art had to be scaled down.\n */\nconst DEFAULT_ICONS: Record<AlertVariant, React.ReactNode> = {\n info: <InfoIcon size={16} filled />,\n success: <TickCircleIcon size={16} filled />,\n warning: <AlertIcon size={16} filled />,\n error: <WarningIcon size={16} filled />,\n neutral: <InfoIcon size={16} filled />,\n};\n\nexport interface AlertProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Visual style variant of the alert. @default \"info\" */\n variant?: AlertVariant;\n /** Optional title text displayed in bold above the description. */\n title?: string;\n /** Custom icon override. Pass `null` to hide the icon entirely. Each variant shows a default icon when left `undefined`. */\n icon?: React.ReactNode | null;\n /** Whether to show the close button. @default false */\n closable?: boolean;\n /** Callback fired when the close button is clicked. */\n onClose?: () => void;\n /** Accessible label for the close button. @default \"Close alert\" */\n closeLabel?: string;\n /**\n * Composable action slot rendered beneath the description, outside the\n * `role=\"alert\"` live region. Pass your own element (an `<a>`, a `next/link`\n * `<Link>`, or a `<Button>`) and it receives the variant-appropriate link\n * styling via the Radix `Slot` pattern while remaining a real link/button.\n */\n action?: React.ReactNode;\n /** Placement of the call-to-action relative to the message. @default \"under\" */\n layout?: AlertLayout;\n /**\n * Label for a built-in call-to-action button, the button form of the CTA.\n * Use it when the alert asks the user to do something specific — activating a\n * feature, or completing setup — rather than pointing at more detail. Ignored\n * when `action` is set.\n */\n ctaLabel?: React.ReactNode;\n /**\n * Props forwarded to the built-in call-to-action button (e.g. `onClick`).\n * `variant` and `size` default to `secondary`/`32` and can be overridden.\n *\n * The stacked CTA is `w-full sm:w-fit`. To override the width, match the\n * modifier chain — a bare `w-auto` replaces `w-full` but leaves `sm:w-fit`\n * in place, so pass `sm:` variants too.\n */\n ctaProps?: Omit<ButtonProps, \"children\" | \"asChild\">;\n}\n\n/**\n * Title and description colour. The design binds both to\n * `Color/Alerts/Info Prompt/Content/<variant>`, and Neutral to\n * `Color/Content/Secondary` — not to `content-primary`, which reads as plain\n * black on the tinted surface.\n */\nconst MESSAGE_CLASSES: Record<AlertVariant, string> = {\n info: \"text-alerts-info-prompt-content-info\",\n success: \"text-alerts-info-prompt-content-success\",\n warning: \"text-alerts-info-prompt-content-warning\",\n error: \"text-alerts-info-prompt-content-error\",\n neutral: \"text-content-secondary\",\n};\n\n/**\n * Surface fill and icon colour, both read from the component's own design\n * variables: `Color/Alerts/Info Prompt/Background/<variant>` and\n * `Color/Alerts/Info Prompt/Icon/<variant>`.\n *\n * The `text-*` here is inherited by the icon only — the message sets its own\n * colour via {@link MESSAGE_CLASSES}. It matters that this reads the dedicated\n * icon tokens rather than the generic `*-content` ones: those agree only for\n * info, and they carry no dark-mode inversion, where the alert tokens step\n * from `*-600` in light to `*-400` in dark as the design specifies.\n */\nconst SURFACE_CLASSES: Record<AlertVariant, string> = {\n info: \"bg-alerts-info-prompt-background-info text-alerts-info-prompt-icon-info\",\n success: \"bg-alerts-info-prompt-background-success text-alerts-info-prompt-icon-success\",\n warning: \"bg-alerts-info-prompt-background-warning text-alerts-info-prompt-icon-warning\",\n error: \"bg-alerts-info-prompt-background-error text-alerts-info-prompt-icon-error\",\n neutral: \"bg-alerts-info-prompt-background-neutral text-alerts-info-prompt-icon-neutral\",\n};\n\n/**\n * CTA link treatment. The node's CTA is a `V2 Link` instance whose text binds\n * `Color/Buttons/Link/Primary/Default`, with no per-variant override on any of\n * the five — so the link takes the standard link colour rather than the alert's\n * own content tint. These are the same tokens the {@link Link} component\n * applies, including the hover step.\n */\nconst LINK_CLASSES = \"text-buttons-link-primary-default hover:text-buttons-link-primary-hover\";\n\n/**\n * The alert's call-to-action. `action` is the link form: any element passed\n * through receives the variant-appropriate link styling via Radix `Slot` while\n * staying a real link or button. `ctaLabel` is the button form. `action` wins\n * when both are set.\n */\nfunction AlertCta({\n action,\n ctaLabel,\n ctaProps,\n isTrailing,\n}: {\n action: React.ReactNode;\n ctaLabel: React.ReactNode;\n ctaProps?: AlertProps[\"ctaProps\"];\n isTrailing: boolean;\n}) {\n if (action) {\n return (\n <Slot\n className={cn(\n \"typography-body-small-14px-semibold w-fit cursor-pointer underline underline-offset-2\",\n isTrailing && \"shrink-0\",\n LINK_CLASSES,\n )}\n >\n {action}\n </Slot>\n );\n }\n\n if (ctaLabel === undefined || ctaLabel === null || ctaLabel === false) {\n return null;\n }\n\n return (\n <Button\n variant=\"secondary\"\n size=\"32\"\n {...ctaProps}\n className={cn(\n // Stacked, the CTA sits in a flex column, which would otherwise stretch\n // it across the whole alert. Fill on mobile, where a full-width button\n // is the easier target, and hug from `sm` (850px) up. Inline, it always\n // hugs so the message keeps the remaining width.\n isTrailing ? \"shrink-0\" : \"w-full sm:w-fit\",\n ctaProps?.className,\n )}\n >\n {ctaLabel}\n </Button>\n );\n}\n\n/**\n * Displays a contextual feedback message to the user.\n *\n * Supports `info`, `success`, `warning`, `error`, and `neutral` variants with a\n * default icon per variant, optional title, description, dismiss button, and an\n * optional composable `action` slot.\n *\n * Each variant renders a default icon automatically. Pass a custom `icon` to\n * override, or `icon={null}` to hide the icon entirely.\n *\n * Only the title and description live inside the `role=\"alert\"` live region.\n * The icon, `action`, and close button are rendered outside it so interactive\n * controls are announced and navigated consistently by screen readers.\n *\n * @example\n * ```tsx\n * <Alert variant=\"success\" title=\"Saved\" closable onClose={handleClose}>\n * Your changes have been saved.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * <Alert variant=\"neutral\" title=\"Heads up\" action={<a href=\"/docs\">Learn more</a>}>\n * A general notice with no specific sentiment.\n * </Alert>\n * ```\n *\n * @example\n * ```tsx\n * import Link from \"next/link\";\n *\n * <Alert variant=\"info\" title=\"Update available\" action={<Link href=\"/changelog\">See what's new</Link>}>\n * A new version is ready to install.\n * </Alert>\n * ```\n *\n * @example\n * The CTA sits under the description by default. `layout=\"trailing\"` keeps it\n * inline with the message, which suits short labels and keeps the alert compact.\n * ```tsx\n * <Alert variant=\"info\" layout=\"trailing\" action={<a href=\"/docs\">Learn more</a>}>\n * Scheduled posts now publish in your local timezone.\n * </Alert>\n * ```\n *\n * @example\n * `ctaLabel` renders the button form of the CTA instead of a link — use it when\n * the alert asks the user to do something specific.\n * ```tsx\n * <Alert variant=\"warning\" title=\"Finish setup\" layout=\"trailing\" ctaLabel=\"Verify now\" ctaProps={{ onClick: verify }}>\n * Verify your identity to start receiving payouts.\n * </Alert>\n * ```\n */\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n (\n {\n className,\n variant = \"info\",\n title,\n icon,\n closable = false,\n onClose,\n closeLabel = \"Close alert\",\n action,\n layout = \"under\",\n ctaLabel,\n ctaProps,\n children,\n ...props\n },\n ref,\n ) => {\n const resolvedIcon = icon === null ? null : (icon ?? DEFAULT_ICONS[variant]);\n const isTrailing = layout === \"trailing\";\n\n return (\n <div\n ref={ref}\n data-testid=\"alert\"\n className={cn(\n // Mirrors the Figma frame: 12px inset with a 16px left inset, 24px\n // from the content row to the close button, `rounded-md` radius.\n \"flex items-start gap-6 rounded-md p-3 pl-4 text-sm leading-[18px]\",\n SURFACE_CLASSES[variant],\n className,\n )}\n {...props}\n >\n {/*\n Content row. Its 4px inset is what takes the container's 12px up to the\n 16px the design specifies around the message, while leaving the close\n button on the container's own 12px. It also puts 28px between the\n message and the close button (this 4px plus the container's 24px gap).\n */}\n <div className=\"flex min-w-0 flex-1 items-start gap-3 py-1 pr-1\">\n {resolvedIcon && (\n // The design's icon slot is 16px, but the default variant icons\n // (InfoCircleIcon and friends) ship at `size-5`, so constrain the\n // glyph here — the same way IconButton sizes its own icon. The 1px\n // top nudge then lands it optically centred on the first 18px line,\n // as in the design's icon-wrapper.\n <span className=\"flex shrink-0 items-start pt-px [&>svg]:size-4\" aria-hidden=\"true\">\n {resolvedIcon}\n </span>\n )}\n\n <div\n className={cn(\n \"flex min-w-0 flex-1\",\n isTrailing ? \"items-center gap-6\" : \"flex-col gap-3\",\n )}\n >\n <div role=\"alert\" className={cn(\"flex flex-col gap-1\", isTrailing && \"min-w-0 flex-1\")}>\n {title && (\n <div\n className={cn(\"typography-body-small-14px-semibold\", MESSAGE_CLASSES[variant])}\n >\n {title}\n </div>\n )}\n {children ? (\n <div className={cn(\"typography-body-small-14px-regular\", MESSAGE_CLASSES[variant])}>\n {children}\n </div>\n ) : null}\n </div>\n <AlertCta\n action={action}\n ctaLabel={ctaLabel}\n ctaProps={ctaProps}\n isTrailing={isTrailing}\n />\n </div>\n </div>\n\n {closable && (\n <IconButton\n variant=\"secondary\"\n size=\"24\"\n onClick={onClose}\n aria-label={closeLabel}\n icon={<CloseIcon size={16} />}\n />\n )}\n </div>\n );\n },\n);\n\nAlert.displayName = \"Alert\";\n"],"names":[],"mappings":";;;;;;;;;;;;AAiCA,MAAM,gBAAuD;AAAA,EAC3D,MAAM,oBAAC,UAAA,EAAS,MAAM,IAAI,QAAM,MAAC;AAAA,EACjC,SAAS,oBAAC,gBAAA,EAAe,MAAM,IAAI,QAAM,MAAC;AAAA,EAC1C,SAAS,oBAAC,WAAA,EAAU,MAAM,IAAI,QAAM,MAAC;AAAA,EACrC,OAAO,oBAAC,aAAA,EAAY,MAAM,IAAI,QAAM,MAAC;AAAA,EACrC,SAAS,oBAAC,UAAA,EAAS,MAAM,IAAI,QAAM,KAAA,CAAC;AACtC;AAgDA,MAAM,kBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AAAA,EACP,SAAS;AACX;AAaA,MAAM,kBAAgD;AAAA,EACpD,MAAM;AAAA,EACN,S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gCAME,QAAA,EAAK,WAAU,kDAAiD,eAAY,QAC1E,UAAA,cACH;AAAA,YAGF;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAW;AAAA,kBACT;AAAA,kBACA,aAAa,uBAAuB;AAAA,gBAAA;AAAA,gBAGtC,UAAA;AAAA,kBAAA,qBAAC,OAAA,EAAI,MAAK,SAAQ,WAAW,GAAG,uBAAuB,cAAc,gBAAgB,GAClF,UAAA;AAAA,oBAAA,SACC;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,WAAW,GAAG,uCAAuC,gBAAgB,OAAO,CAAC;AAAA,wBAE5E,UAAA;AAAA,sBAAA;AAAA,oBAAA;AAAA,oBAGJ,WACC,oBAAC,OAAA,EAAI,WAAW,GAAG,sCAAsC,gBAAgB,OAAO,CAAC,GAC9E,SAAA,CACH,IACE;AAAA,kBAAA,GACN;AAAA,kBACA;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC;AAAA,sBACA;AAAA,sBACA;AAAA,sBACA;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,cAAA;AAAA,YAAA;AAAA,UACF,GACF;AAAA,UAEC,YACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAQ;AAAA,cACR,MAAK;AAAA,cACL,SAAS;AAAA,cACT,cAAY;AAAA,cACZ,MAAM,oBAAC,WAAA,EAAU,MAAM,GAAA,CAAI;AAAA,YAAA;AAAA,UAAA;AAAA,QAC7B;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEA,MAAM,cAAc;"}
package/dist/index.d.ts CHANGED
@@ -334,6 +334,24 @@ export declare type AISettingsIconProps = BaseIconProps;
334
334
  * A new version is ready to install.
335
335
  * </Alert>
336
336
  * ```
337
+ *
338
+ * @example
339
+ * The CTA sits under the description by default. `layout="trailing"` keeps it
340
+ * inline with the message, which suits short labels and keeps the alert compact.
341
+ * ```tsx
342
+ * <Alert variant="info" layout="trailing" action={<a href="/docs">Learn more</a>}>
343
+ * Scheduled posts now publish in your local timezone.
344
+ * </Alert>
345
+ * ```
346
+ *
347
+ * @example
348
+ * `ctaLabel` renders the button form of the CTA instead of a link — use it when
349
+ * the alert asks the user to do something specific.
350
+ * ```tsx
351
+ * <Alert variant="warning" title="Finish setup" layout="trailing" ctaLabel="Verify now" ctaProps={{ onClick: verify }}>
352
+ * Verify your identity to start receiving payouts.
353
+ * </Alert>
354
+ * ```
337
355
  */
338
356
  export declare const Alert: React_2.ForwardRefExoticComponent<AlertProps & React_2.RefAttributes<HTMLDivElement>>;
339
357
 
@@ -350,6 +368,16 @@ export declare const AlertIcon: React_2.ForwardRefExoticComponent<BaseIconProps
350
368
  /** Props for {@link AlertIcon}. See {@link BaseIconProps} for the shared shape. */
351
369
  export declare type AlertIconProps = BaseIconProps;
352
370
 
371
+ /**
372
+ * Placement of the call-to-action relative to the message.
373
+ *
374
+ * - `"under"` stacks the action beneath the description. Use it when the CTA
375
+ * label is long or the alert is narrow.
376
+ * - `"trailing"` keeps the action inline with the message, which keeps the
377
+ * alert compact and works best with short labels.
378
+ */
379
+ export declare type AlertLayout = "under" | "trailing";
380
+
353
381
  export declare interface AlertProps extends React_2.HTMLAttributes<HTMLDivElement> {
354
382
  /** Visual style variant of the alert. @default "info" */
355
383
  variant?: AlertVariant;
@@ -370,6 +398,24 @@ export declare interface AlertProps extends React_2.HTMLAttributes<HTMLDivElemen
370
398
  * styling via the Radix `Slot` pattern while remaining a real link/button.
371
399
  */
372
400
  action?: React_2.ReactNode;
401
+ /** Placement of the call-to-action relative to the message. @default "under" */
402
+ layout?: AlertLayout;
403
+ /**
404
+ * Label for a built-in call-to-action button, the button form of the CTA.
405
+ * Use it when the alert asks the user to do something specific — activating a
406
+ * feature, or completing setup — rather than pointing at more detail. Ignored
407
+ * when `action` is set.
408
+ */
409
+ ctaLabel?: React_2.ReactNode;
410
+ /**
411
+ * Props forwarded to the built-in call-to-action button (e.g. `onClick`).
412
+ * `variant` and `size` default to `secondary`/`32` and can be overridden.
413
+ *
414
+ * The stacked CTA is `w-full sm:w-fit`. To override the width, match the
415
+ * modifier chain — a bare `w-auto` replaces `w-full` but leaves `sm:w-fit`
416
+ * in place, so pass `sm:` variants too.
417
+ */
418
+ ctaProps?: Omit<ButtonProps, "children" | "asChild">;
373
419
  }
374
420
 
375
421
  /** Visual style variant of the alert. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanvue/ui",
3
- "version": "3.33.1",
3
+ "version": "3.34.0",
4
4
  "description": "React component library built with Tailwind CSS for Fanvue ecosystem",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",