@sarunyu/system-one 4.9.13 → 4.9.22
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/dist/index.cjs +28 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -14
- package/dist/index.js.map +1 -1
- package/dist/src/components/alert.d.ts +1 -0
- package/dist/src/components/alert.d.ts.map +1 -1
- package/dist/src/components/toast.d.ts.map +1 -1
- package/dist/style.css +2 -1
- package/llms.txt +26 -19
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -149,7 +149,7 @@ import {
|
|
|
149
149
|
Table, TableRow, TableHeaderCell, TableCell,
|
|
150
150
|
// Feedback
|
|
151
151
|
Alert,
|
|
152
|
-
Toast,
|
|
152
|
+
Toast, Toaster,
|
|
153
153
|
Notification,
|
|
154
154
|
Badge,
|
|
155
155
|
// Overlay
|
|
@@ -751,36 +751,42 @@ type AlertStatus = "normal" | "information" | "success" | "warning" | "critical"
|
|
|
751
751
|
<Alert status="warning" message="Incomplete profile — some features are limited." />
|
|
752
752
|
<Alert status="critical" message="Authentication failed. Please try again." />
|
|
753
753
|
<Alert status="warning" message="A longer message that wraps to a second line." multiline />
|
|
754
|
+
|
|
755
|
+
// With title — for notices, disclaimers, info boxes with a heading
|
|
756
|
+
<Alert status="normal" title="คำเตือนความเสี่ยง" message="การลงทุนมีความเสี่ยง ผู้ลงทุนควรศึกษาข้อมูลก่อนตัดสินใจลงทุน" multiline />
|
|
757
|
+
<Alert status="warning" title="ข้อมูลสำคัญ" message="บัญชีของคุณจะถูกระงับหากไม่ยืนยันภายใน 7 วัน" />
|
|
754
758
|
```
|
|
755
759
|
|
|
756
|
-
Props: `status?` (default `"normal"`), `message` (required), `multiline?` (default `false` — `false` truncates to one line, `true` clamps to 2 lines), `className`.
|
|
760
|
+
Props: `status?` (default `"normal"`), `title?` (bold header line above message), `message` (required), `multiline?` (default `false` — `false` truncates to one line, `true` clamps to 2 lines), `className`.
|
|
757
761
|
|
|
758
762
|
---
|
|
759
763
|
|
|
760
|
-
### Toast /
|
|
764
|
+
### Toast / Toaster
|
|
761
765
|
|
|
762
|
-
Transient floating feedback
|
|
766
|
+
Transient floating feedback. **Always use `Toaster` for queued toasts — it handles fixed positioning (top-right desktop, top-center mobile) and auto-dismiss automatically.**
|
|
763
767
|
|
|
764
768
|
```tsx
|
|
765
769
|
type ToastVariant = "default" | "broadcast";
|
|
766
770
|
type ToastStatus = "information" | "success" | "warning" | "critical";
|
|
767
771
|
|
|
768
|
-
//
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
<
|
|
772
|
+
// ✅ Correct — place Toaster once at app root (App.tsx or layout)
|
|
773
|
+
const [toasts, setToasts] = useState<Array<ToastProps & { id: string }>>([]);
|
|
774
|
+
const remove = (id: string) => setToasts(t => t.filter(x => x.id !== id));
|
|
775
|
+
const add = (t: Omit<ToastProps, "onClose"> & { id: string }) =>
|
|
776
|
+
setToasts(p => [...p, t]);
|
|
772
777
|
|
|
773
|
-
|
|
774
|
-
<Toast variant="broadcast" status="information" message="Maintenance window: Saturday 02:00–04:00." />
|
|
778
|
+
<Toaster items={toasts} onRemove={remove} /> // fixed-positioned, auto-dismisses after 4s
|
|
775
779
|
|
|
776
|
-
//
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
+
// Trigger a toast from anywhere:
|
|
781
|
+
add({ id: crypto.randomUUID(), status: "success", message: "Saved." });
|
|
782
|
+
add({ id: crypto.randomUUID(), status: "warning", message: "Low storage.", actionLabel: "Free up", onActionClick: open });
|
|
783
|
+
|
|
784
|
+
// Broadcast — system-wide banner (no close button, no auto-dismiss)
|
|
785
|
+
<Toast variant="broadcast" status="information" message="Maintenance window: Saturday 02:00–04:00." />
|
|
780
786
|
```
|
|
781
787
|
|
|
788
|
+
Props (Toaster): `items`, `onRemove?`, `duration?` (ms, default 4000 — set 0 to disable auto-dismiss), `renderItem?`, `className`.
|
|
782
789
|
Props (Toast): `variant?` (default `"default"`), `status?` (default `"information"`), `message`, `multiline?`, `actionLabel?`, `onActionClick?`, `onClose?`, `className`.
|
|
783
|
-
Props (ToastStack): `items: (ToastProps & { id: string })[]`, `className`, `renderItem?`.
|
|
784
790
|
|
|
785
791
|
---
|
|
786
792
|
|
|
@@ -1368,8 +1374,9 @@ defaults live in `tokens/color.json` (P1 blue). Replace with your own values.
|
|
|
1368
1374
|
--primary-action: #7c3aed; /* your brand 600 */
|
|
1369
1375
|
--primary-action-hover: #6d28d9; /* your brand 700 */
|
|
1370
1376
|
--primary-action-active: #5b21b6; /* your brand 800 */
|
|
1371
|
-
/*
|
|
1372
|
-
|
|
1377
|
+
/* Use rgb(r g b / alpha%) — NOT color-mix() which is unsupported in some renderers */
|
|
1378
|
+
--primary-action-light: rgb(124 58 237 / 6%);
|
|
1379
|
+
--primary-action-muted: rgb(124 58 237 / 10%);
|
|
1373
1380
|
|
|
1374
1381
|
--font-sans: "Inter", sans-serif; /* replace default Noto Sans Thai */
|
|
1375
1382
|
}
|
|
@@ -1380,8 +1387,8 @@ defaults live in `tokens/color.json` (P1 blue). Replace with your own values.
|
|
|
1380
1387
|
--primary-action: #a78bfa; /* your brand 400 */
|
|
1381
1388
|
--primary-action-hover: #c4b5fd; /* your brand 300 */
|
|
1382
1389
|
--primary-action-active: #8b5cf6; /* your brand 500 */
|
|
1383
|
-
--primary-action-light:
|
|
1384
|
-
--primary-action-muted:
|
|
1390
|
+
--primary-action-light: rgb(167 139 250 / 10%);
|
|
1391
|
+
--primary-action-muted: rgb(167 139 250 / 15%);
|
|
1385
1392
|
}
|
|
1386
1393
|
```
|
|
1387
1394
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarunyu/system-one",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.22",
|
|
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": [
|