@sarunyu/system-one 4.4.1 → 4.5.0

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
@@ -1,6 +1,6 @@
1
1
  # @sarunyu/system-one — AI usage guide
2
2
 
3
- React component library. Tailwind CSS v4 + CSS custom properties. 20 components.
3
+ React component library. Tailwind CSS v4 + CSS custom properties. 24 components.
4
4
  Built for AI-powered UI generation (v0, Lovable, Figma Make, Cursor).
5
5
 
6
6
  **This file is the contract.** Read it top-to-bottom before generating any screen
@@ -12,7 +12,7 @@ that uses this library. The rules are non-negotiable.
12
12
 
13
13
  1. **Use library components for every element it provides.** Never recreate
14
14
  Button, Input, Tag, Dropdown, Card, Tab, Checkbox, Toggle, Radio, DateInput, TimeInput,
15
- Table, SearchInput, TextArea, Chip, Modal, BottomSheet as raw HTML.
15
+ Table, SearchInput, TextArea, Chip, Modal, BottomSheet, Alert, Toast, Notification, Badge as raw HTML.
16
16
  2. **Use design-token classes for color and typography.** Never `text-blue-600`,
17
17
  `bg-gray-100`, `text-[#3b82f6]`. The token table below is exhaustive — if a
18
18
  color you need is not in it, use `text-foreground` / `bg-card`.
@@ -68,6 +68,11 @@ import {
68
68
  Tab, TabGroup,
69
69
  Card,
70
70
  Table, TableRow, TableHeaderCell, TableCell,
71
+ // Feedback
72
+ Alert,
73
+ Toast, ToastStack,
74
+ Notification,
75
+ Badge,
71
76
  // Overlay
72
77
  Modal, BottomSheet,
73
78
  // Utility
@@ -634,6 +639,121 @@ Raw option rows. Use when you need a custom dropdown or a sidebar menu — other
634
639
 
635
640
  ---
636
641
 
642
+ ### Alert
643
+
644
+ Inline, persistent status banner — anchored inside the page or form layout. Never use as a floating notification; use `Toast` for transient messages.
645
+
646
+ ```tsx
647
+ type AlertStatus = "normal" | "information" | "success" | "warning" | "critical";
648
+
649
+ <Alert status="normal" message="This field is required." />
650
+ <Alert status="information" message="Your session expires in 10 minutes." />
651
+ <Alert status="success" message="Payment confirmed." />
652
+ <Alert status="warning" message="Incomplete profile — some features are limited." />
653
+ <Alert status="critical" message="Authentication failed. Please try again." />
654
+ <Alert status="warning" message="A longer message that wraps to a second line." multiline />
655
+ ```
656
+
657
+ Props: `status?` (default `"normal"`), `message` (required), `multiline?` (default `false` — `false` truncates to one line, `true` clamps to 2 lines), `className`.
658
+
659
+ ---
660
+
661
+ ### Toast / ToastStack
662
+
663
+ Transient floating feedback — appears at screen edges, dismissed manually or auto-closes. Place in a `fixed` portal; use `ToastStack` for a queued list.
664
+
665
+ ```tsx
666
+ type ToastVariant = "default" | "broadcast";
667
+ type ToastStatus = "information" | "success" | "warning" | "critical";
668
+
669
+ // Default toast
670
+ <Toast status="success" message="File uploaded." onClose={dismiss} />
671
+ <Toast status="warning" message="Low storage — 100 MB remaining." actionLabel="Free up space" onActionClick={open} onClose={dismiss} />
672
+ <Toast status="critical" message="Connection lost. Retrying…" multiline onClose={dismiss} />
673
+
674
+ // Broadcast — system announcement banner (no close button)
675
+ <Toast variant="broadcast" status="information" message="Maintenance window: Saturday 02:00–04:00." />
676
+
677
+ // Stack — multiple toasts at once
678
+ <div className="fixed bottom-4 right-4 z-50 w-[343px]">
679
+ <ToastStack items={toasts} />
680
+ </div>
681
+ ```
682
+
683
+ Props (Toast): `variant?` (default `"default"`), `status?` (default `"information"`), `message`, `multiline?`, `actionLabel?`, `onActionClick?`, `onClose?`, `className`.
684
+ Props (ToastStack): `items: (ToastProps & { id: string })[]`, `className`, `renderItem?`.
685
+
686
+ ---
687
+
688
+ ### Badge
689
+
690
+ Button with a count indicator. Two variants:
691
+
692
+ - `"button"` (default) — filter/action button (funnel icon) that shows a count badge when active. Use in toolbars and filter bars.
693
+ - `"notification"` — bell icon button; typically used as the trigger inside `<Notification>` rather than standalone.
694
+
695
+ ```tsx
696
+ // Filter button — inactive and active states
697
+ <Badge label="Filter" count={0} onClick={openFilter} />
698
+ <Badge label="Filter" count={3} onClick={openFilter} />
699
+ <Badge iconOnly count={2} onClick={openFilter} />
700
+
701
+ // Notification bell (standalone)
702
+ <Badge variant="notification" count={5} />
703
+ ```
704
+
705
+ Props: `variant?` (`"button"` | `"notification"`, default `"button"`), `count?`, `maxCount?` (default 99), `label?` (button variant, default `"Filter"`), `iconOnly?`, `icon?` (custom icon), `notificationState?` (`"default"` | `"active"` | `"noti"`), plus native `<button>` props.
706
+
707
+ ---
708
+
709
+ ### Notification
710
+
711
+ Bell-icon trigger + popover panel showing grouped notification rows. Handles badge count, auto-clear on open, and keyboard navigation. Uses `<Badge variant="notification">` internally.
712
+
713
+ ```tsx
714
+ const groups: NotificationGroup[] = [
715
+ {
716
+ label: "25 ก.ค. 2567",
717
+ items: [
718
+ {
719
+ id: "1",
720
+ title: "ยืนยันการชำระเงิน",
721
+ description: "รายการ TXN-00234 ได้รับการยืนยันแล้ว",
722
+ time: "10:45",
723
+ unread: true,
724
+ type: "icon",
725
+ },
726
+ {
727
+ id: "2",
728
+ title: "อัปเดตระบบ",
729
+ description: "เวอร์ชัน 4.4 พร้อมใช้งานแล้ว",
730
+ time: "08:30",
731
+ type: "image",
732
+ imageSrc: "/img/system.png",
733
+ actionLabel: "อัปเดต",
734
+ onActionClick: handleUpdate,
735
+ },
736
+ ],
737
+ },
738
+ ];
739
+
740
+ <Notification groups={groups} onItemClick={handleClick} />
741
+ <Notification groups={groups} badgeCount={12} clearBadgeOnOpen />
742
+ <Notification groups={[]} emptyText="ไม่มีการแจ้งเตือน" />
743
+ ```
744
+
745
+ Props: `groups`, `badgeCount?` (overrides computed unread count), `panelWidth?` (default 375), `emptyText?`, `clearBadgeOnOpen?` (default `true`), `open?`, `defaultOpen?`, `onOpenChange?`, `onBadgeCleared?`, `onItemClick?`, `className`, `panelClassName`.
746
+
747
+ **When to use which:**
748
+
749
+ | Component | Pattern | Lifetime |
750
+ |---|---|---|
751
+ | `Alert` | Inline, anchored to related content (form, section) | Persistent |
752
+ | `Toast` | Floating, screen edge (top/bottom) | Transient — auto or manual dismiss |
753
+ | `Notification` | Bell icon → popover history panel | On-demand |
754
+
755
+ ---
756
+
637
757
  ### Modal
638
758
 
639
759
  Centered overlay surface for confirmations, richer content, or status alerts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sarunyu/system-one",
3
- "version": "4.4.1",
3
+ "version": "4.5.0",
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": [