@wallarm-org/design-system 1.18.0 → 1.18.1-rc-fix-toast-description-layout.1

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.
@@ -14,6 +14,19 @@ export interface ToastData {
14
14
  export interface ToastProps {
15
15
  toast: ToastData;
16
16
  }
17
+ /**
18
+ * Which layout a toast ends up in.
19
+ *
20
+ * `simple` is a single row and renders the title ALONE, so a `description`
21
+ * handed to it would be dropped without a trace — and the description is
22
+ * usually the actionable half (an error's reason, what happens next). Losing
23
+ * the caller's text is never the better reading of the pair, so a description
24
+ * decides the layout whenever there is one; `variant` decides it otherwise.
25
+ *
26
+ * Shared with the toaster, which sizes the auto-dismiss timer off the same
27
+ * answer: text nobody has time to read is the other way to lose it.
28
+ */
29
+ export declare const resolveToastVariant: (variant: unknown, description: unknown) => NonNullable<ToastData['variant']>;
17
30
  export declare function Toast({ toast }: ToastProps): import("react").JSX.Element;
18
31
  export declare namespace Toast {
19
32
  var displayName: string;
@@ -19,7 +19,7 @@ const toastVariants = cva('group relative flex min-w-[256px] max-w-[560px] items
19
19
  }
20
20
  },
21
21
  defaultVariants: {
22
- variant: 'extended'
22
+ variant: 'simple'
23
23
  }
24
24
  });
25
25
  const toastIconMap = {
@@ -42,8 +42,9 @@ const toastIconMap = {
42
42
  };
43
43
  const SIMPLE_TOAST_DURATION_MS = 5000;
44
44
  const EXTENDED_TOAST_DURATION_MS = 10000;
45
+ const resolveToastVariant = (variant, description)=>description || 'extended' === variant ? 'extended' : 'simple';
45
46
  const Toast_Toast = ({ toast })=>{
46
- const toastVariant = toast.variant || 'simple';
47
+ const toastVariant = resolveToastVariant(toast.variant, toast.description);
47
48
  const isSimple = 'simple' === toastVariant;
48
49
  const closable = false !== toast.closable;
49
50
  const getToastIcon = ()=>{
@@ -122,4 +123,4 @@ const Toast_Toast = ({ toast })=>{
122
123
  }, toast.id);
123
124
  };
124
125
  Toast_Toast.displayName = 'Toast';
125
- export { Toast_Toast as Toast };
126
+ export { Toast_Toast as Toast, resolveToastVariant };
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Portal } from "@ark-ui/react/portal";
3
3
  import { Toaster, createToaster } from "@ark-ui/react/toast";
4
4
  import { cn } from "../../utils/cn.js";
5
- import { Toast } from "./Toast.js";
5
+ import { Toast, resolveToastVariant } from "./Toast.js";
6
6
  const SIMPLE_TOAST_DURATION_MS = 5000;
7
7
  const EXTENDED_TOAST_DURATION_MS = 10000;
8
8
  const DEFAULT_TOAST_PRIORITY = {
@@ -18,7 +18,7 @@ const toaster = {
18
18
  __arkToaster: arkToaster,
19
19
  create: (options)=>arkToaster.create({
20
20
  ...options,
21
- duration: options.duration ?? ('extended' === options.variant ? EXTENDED_TOAST_DURATION_MS : SIMPLE_TOAST_DURATION_MS),
21
+ duration: options.duration ?? ('extended' === resolveToastVariant(options.variant, options.description) ? EXTENDED_TOAST_DURATION_MS : SIMPLE_TOAST_DURATION_MS),
22
22
  priority: options.priority ?? ('default' === options.type ? options.actions ? DEFAULT_TOAST_PRIORITY.actionable : DEFAULT_TOAST_PRIORITY.nonActionable : void 0)
23
23
  }),
24
24
  update: (id, options)=>{
@@ -1,6 +1,6 @@
1
1
  {
2
- "version": "1.17.0",
3
- "generatedAt": "2026-09-08T11:38:56.199Z",
2
+ "version": "1.18.0",
3
+ "generatedAt": "2026-09-08T12:47:00.336Z",
4
4
  "components": [
5
5
  {
6
6
  "name": "Accordion",
@@ -89946,6 +89946,7 @@
89946
89946
  },
89947
89947
  {
89948
89948
  "name": "Toast",
89949
+ "description": "Which layout a toast ends up in.\n\n`simple` is a single row and renders the title ALONE, so a `description`\nhanded to it would be dropped without a trace — and the description is\nusually the actionable half (an error's reason, what happens next). Losing\nthe caller's text is never the better reading of the pair, so a description\ndecides the layout whenever there is one; `variant` decides it otherwise.\n\nShared with the toaster, which sizes the auto-dismiss timer off the same\nanswer: text nobody has time to read is the other way to lose it.",
89949
89950
  "importPath": "@wallarm-org/design-system/Toast",
89950
89951
  "props": [],
89951
89952
  "variants": [
@@ -89955,7 +89956,7 @@
89955
89956
  "extended",
89956
89957
  "simple"
89957
89958
  ],
89958
- "defaultValue": "extended"
89959
+ "defaultValue": "simple"
89959
89960
  }
89960
89961
  ],
89961
89962
  "subComponents": [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wallarm-org/design-system",
3
- "version": "1.18.0",
3
+ "version": "1.18.1-rc-fix-toast-description-layout.1",
4
4
  "description": "Core design system library with React components and Storybook documentation",
5
5
  "publishConfig": {
6
6
  "access": "public",