@sarunyu/system-one 4.9.12 → 4.9.18

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/llms.txt CHANGED
@@ -149,7 +149,7 @@ import {
149
149
  Table, TableRow, TableHeaderCell, TableCell,
150
150
  // Feedback
151
151
  Alert,
152
- Toast, ToastStack,
152
+ Toast, Toaster,
153
153
  Notification,
154
154
  Badge,
155
155
  // Overlay
@@ -757,30 +757,32 @@ Props: `status?` (default `"normal"`), `message` (required), `multiline?` (defau
757
757
 
758
758
  ---
759
759
 
760
- ### Toast / ToastStack
760
+ ### Toast / Toaster
761
761
 
762
- Transient floating feedback appears at screen edges, dismissed manually or auto-closes. Place in a `fixed` portal; use `ToastStack` for a queued list.
762
+ Transient floating feedback. **Always use `Toaster` for queued toasts it handles fixed positioning (top-right desktop, top-center mobile) and auto-dismiss automatically.**
763
763
 
764
764
  ```tsx
765
765
  type ToastVariant = "default" | "broadcast";
766
766
  type ToastStatus = "information" | "success" | "warning" | "critical";
767
767
 
768
- // Default toast
769
- <Toast status="success" message="File uploaded." onClose={dismiss} />
770
- <Toast status="warning" message="Low storage 100 MB remaining." actionLabel="Free up space" onActionClick={open} onClose={dismiss} />
771
- <Toast status="critical" message="Connection lost. Retrying…" multiline onClose={dismiss} />
768
+ // Correct — place Toaster once at app root (App.tsx or layout)
769
+ const [toasts, setToasts] = useState<Array<ToastProps & { id: string }>>([]);
770
+ const remove = (id: string) => setToasts(t => t.filter(x => x.id !== id));
771
+ const add = (t: Omit<ToastProps, "onClose"> & { id: string }) =>
772
+ setToasts(p => [...p, t]);
772
773
 
773
- // Broadcast system announcement banner (no close button)
774
- <Toast variant="broadcast" status="information" message="Maintenance window: Saturday 02:00–04:00." />
774
+ <Toaster items={toasts} onRemove={remove} /> // fixed-positioned, auto-dismisses after 4s
775
775
 
776
- // Stack multiple toasts at once
777
- <div className="fixed bottom-4 right-4 z-50 w-[343px]">
778
- <ToastStack items={toasts} />
779
- </div>
776
+ // Trigger a toast from anywhere:
777
+ add({ id: crypto.randomUUID(), status: "success", message: "Saved." });
778
+ add({ id: crypto.randomUUID(), status: "warning", message: "Low storage.", actionLabel: "Free up", onActionClick: open });
779
+
780
+ // Broadcast — system-wide banner (no close button, no auto-dismiss)
781
+ <Toast variant="broadcast" status="information" message="Maintenance window: Saturday 02:00–04:00." />
780
782
  ```
781
783
 
784
+ Props (Toaster): `items`, `onRemove?`, `duration?` (ms, default 4000 — set 0 to disable auto-dismiss), `renderItem?`, `className`.
782
785
  Props (Toast): `variant?` (default `"default"`), `status?` (default `"information"`), `message`, `multiline?`, `actionLabel?`, `onActionClick?`, `onClose?`, `className`.
783
- Props (ToastStack): `items: (ToastProps & { id: string })[]`, `className`, `renderItem?`.
784
786
 
785
787
  ---
786
788
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarunyu/system-one",
3
- "version": "4.9.12",
3
+ "version": "4.9.18",
4
4
  "type": "module",
5
5
  "description": "A production-ready React design system built for AI-powered web generation tools (Figma Make, Lovable, V0). Tailwind CSS v4 + CSS custom properties for full theming support.",
6
6
  "keywords": [