@crystallize/design-system 1.24.15 → 1.24.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @crystallize/design-system
2
2
 
3
+ ## 1.24.16
4
+
5
+ ### Patch Changes
6
+
7
+ - 50b5602: Add `id` prop to toast component so we can update the toast message without closing it
8
+
3
9
  ## 1.24.15
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -450,12 +450,13 @@ type ToastType = 'info' | 'error' | 'success' | 'warning';
450
450
  type ToastStylesProps = VariantProps<typeof toastStyles>;
451
451
  type ToastProps = Omit<React.ComponentProps<'div'>, 'title'> & Omit<ToastStylesProps, 'type'> & {
452
452
  title: React.ReactNode;
453
- type?: ToastType;
454
453
  message?: React.ReactNode;
454
+ type?: ToastType;
455
+ id?: string;
455
456
  timeout?: number;
456
457
  };
457
458
  declare const toast: {
458
- ({ title, message, type, timeout }: ToastProps): string;
459
+ ({ title, message, id, type, timeout }: ToastProps): string;
459
460
  dismiss: (id?: string | number | undefined) => string | number;
460
461
  };
461
462
 
package/dist/index.js CHANGED
@@ -40486,12 +40486,12 @@ var iconMap = {
40486
40486
  success: Icon.CheckWithCircle,
40487
40487
  warning: Icon.Warning
40488
40488
  };
40489
- var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
40489
+ var toast = ({ title, message, id, type = "success", timeout = 6e3 }) => {
40490
40490
  const ToastIcon = iconMap[type];
40491
40491
  const withMessage = !!message;
40492
- const toastId = Date.now().toString();
40492
+ const toastId = id ?? Date.now().toString();
40493
40493
  import_sonner.toast.custom(
40494
- (id) => /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("div", {
40494
+ (id2) => /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("div", {
40495
40495
  "data-testid": `toast-${type}`,
40496
40496
  className: (0, import_class_variance_authority23.cx)(toastStyles({ type }), withMessage ? "c-toast-with-message" : "c-toast-title-only"),
40497
40497
  children: [
@@ -40516,7 +40516,7 @@ var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
40516
40516
  /* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", {
40517
40517
  className: "c-toast-close",
40518
40518
  children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(IconButton, {
40519
- onClick: () => import_sonner.toast.dismiss(id),
40519
+ onClick: () => import_sonner.toast.dismiss(id2),
40520
40520
  size: "xs",
40521
40521
  children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(Icon.Cancel, {
40522
40522
  width: 12,
package/dist/index.mjs CHANGED
@@ -516,12 +516,12 @@ var iconMap = {
516
516
  success: Icon.CheckWithCircle,
517
517
  warning: Icon.Warning
518
518
  };
519
- var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
519
+ var toast = ({ title, message, id, type = "success", timeout = 6e3 }) => {
520
520
  const ToastIcon = iconMap[type];
521
521
  const withMessage = !!message;
522
- const toastId = Date.now().toString();
522
+ const toastId = id ?? Date.now().toString();
523
523
  sonnerToast.custom(
524
- (id) => /* @__PURE__ */ jsxs9("div", {
524
+ (id2) => /* @__PURE__ */ jsxs9("div", {
525
525
  "data-testid": `toast-${type}`,
526
526
  className: cx8(toastStyles({ type }), withMessage ? "c-toast-with-message" : "c-toast-title-only"),
527
527
  children: [
@@ -546,7 +546,7 @@ var toast = ({ title, message, type = "success", timeout = 6e3 }) => {
546
546
  /* @__PURE__ */ jsx16("div", {
547
547
  className: "c-toast-close",
548
548
  children: /* @__PURE__ */ jsx16(IconButton, {
549
- onClick: () => sonnerToast.dismiss(id),
549
+ onClick: () => sonnerToast.dismiss(id2),
550
550
  size: "xs",
551
551
  children: /* @__PURE__ */ jsx16(Icon.Cancel, {
552
552
  width: 12,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystallize/design-system",
3
- "version": "1.24.15",
3
+ "version": "1.24.16",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -24,8 +24,9 @@ type ToastStylesProps = VariantProps<typeof toastStyles>;
24
24
  export type ToastProps = Omit<React.ComponentProps<'div'>, 'title'> &
25
25
  Omit<ToastStylesProps, 'type'> & {
26
26
  title: React.ReactNode;
27
- type?: ToastType;
28
27
  message?: React.ReactNode;
28
+ type?: ToastType;
29
+ id?: string;
29
30
  timeout?: number;
30
31
  };
31
32
 
@@ -36,10 +37,10 @@ const iconMap = {
36
37
  warning: Icon.Warning,
37
38
  };
38
39
 
39
- export const toast = ({ title, message, type = 'success', timeout = 6000 }: ToastProps) => {
40
+ export const toast = ({ title, message, id, type = 'success', timeout = 6000 }: ToastProps) => {
40
41
  const ToastIcon = iconMap[type];
41
42
  const withMessage = !!message;
42
- const toastId = Date.now().toString();
43
+ const toastId = id ?? Date.now().toString();
43
44
 
44
45
  sonnerToast.custom(
45
46
  id => (