@choice-ui/react 1.7.3 → 1.7.4

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.
@@ -105,6 +105,13 @@ interface ToastData {
105
105
  onClose?: () => void;
106
106
  onAutoClose?: () => void;
107
107
  dismissible?: boolean;
108
+ /**
109
+ * Show progress bar for this toast. Overrides Toaster's showProgress setting.
110
+ * - `true`: Always show progress bar
111
+ * - `false`: Never show progress bar
112
+ * - `undefined`: Use Toaster's showProgress setting
113
+ */
114
+ progress?: boolean;
108
115
  createdAt: number;
109
116
  height?: number;
110
117
  removing?: boolean;
@@ -133,6 +140,13 @@ interface ToastOptions {
133
140
  onClose?: () => void;
134
141
  onAutoClose?: () => void;
135
142
  dismissible?: boolean;
143
+ /**
144
+ * Show progress bar for this toast. Overrides Toaster's showProgress setting.
145
+ * - `true`: Always show progress bar
146
+ * - `false`: Never show progress bar
147
+ * - `undefined`: Use Toaster's showProgress setting
148
+ */
149
+ progress?: boolean;
136
150
  }
137
151
  interface PromiseOptions<T> {
138
152
  loading: string | (ToastOptions & {
@@ -72,7 +72,8 @@ const ToasterItem = memo(
72
72
  const [swipeDirection, setSwipeDirection] = useState(null);
73
73
  const swipeStartRef = useRef(null);
74
74
  const toastDuration = toast.duration ?? defaultDuration;
75
- const shouldShowProgress = showProgress && toastDuration > 0 && Number.isFinite(toastDuration) && toast.type !== "loading";
75
+ const effectiveShowProgress = toast.progress ?? showProgress;
76
+ const shouldShowProgress = effectiveShowProgress && toastDuration > 0 && Number.isFinite(toastDuration) && toast.type !== "loading";
76
77
  const offsetY = useMemo(() => {
77
78
  if (expanded) {
78
79
  let offset = 0;
@@ -30,6 +30,13 @@ export interface ToastData {
30
30
  onClose?: () => void;
31
31
  onAutoClose?: () => void;
32
32
  dismissible?: boolean;
33
+ /**
34
+ * Show progress bar for this toast. Overrides Toaster's showProgress setting.
35
+ * - `true`: Always show progress bar
36
+ * - `false`: Never show progress bar
37
+ * - `undefined`: Use Toaster's showProgress setting
38
+ */
39
+ progress?: boolean;
33
40
  createdAt: number;
34
41
  height?: number;
35
42
  removing?: boolean;
@@ -58,6 +65,13 @@ export interface ToastOptions {
58
65
  onClose?: () => void;
59
66
  onAutoClose?: () => void;
60
67
  dismissible?: boolean;
68
+ /**
69
+ * Show progress bar for this toast. Overrides Toaster's showProgress setting.
70
+ * - `true`: Always show progress bar
71
+ * - `false`: Never show progress bar
72
+ * - `undefined`: Use Toaster's showProgress setting
73
+ */
74
+ progress?: boolean;
61
75
  }
62
76
  export interface ToasterState {
63
77
  toasts: ToastData[];
@@ -81,6 +81,7 @@ function addToast(title, type, options = {}, toasterId = DEFAULT_TOASTER_ID) {
81
81
  onClose: options.onClose,
82
82
  onAutoClose: options.onAutoClose,
83
83
  dismissible: options.dismissible ?? true,
84
+ progress: options.progress,
84
85
  createdAt: Date.now()
85
86
  };
86
87
  let newToasts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choice-ui/react",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "A desktop-first React UI component library built for professional desktop applications with comprehensive documentation",
5
5
  "sideEffects": false,
6
6
  "type": "module",