@sarunyu/system-one 4.3.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
@@ -420,26 +425,57 @@ All tabs in one group must share the same size.
420
425
 
421
426
  ### Card
422
427
 
423
- Event/content card. Self-contained — don't wrap in another card.
428
+ Self-contained surface — don't wrap in another card.
429
+
430
+ **Default variant is `"default"`.** Start every Card as `variant="default"` (an empty shell with padding, radius, shadow, and `bg-card`) and pass your content via `children`. Only switch to a specialized variant when the page is specifically rendering that content type.
431
+
432
+ | Variant | Use for | Requires |
433
+ |---|---|---|
434
+ | `"default"` (default) | Any custom card surface | `children` |
435
+ | `"event"` | Event/session card | `title`, `date`, `time`, `location`, `count`, `tagStatus` |
436
+ | `"news"` | News/article card | `title`, `category`, `date`, optional `image` |
437
+ | `"social"` | Social/article summary with colored tag chips | `title`, `tags`, `source`, `date` |
438
+ | `"live"` | Live stream / video card with duration overlay | `title`, `source`, `date`, `duration` |
424
439
 
425
440
  ```tsx
441
+ // Default — custom content (preferred starting point)
442
+ <Card size="desktop" className="w-[308px]">
443
+ <h4>Custom title</h4>
444
+ <p className="text-sm text-muted-foreground">Any layout you want inside.</p>
445
+ </Card>
446
+
447
+ // Event
426
448
  <Card
427
- variant="desktop"
449
+ variant="event"
450
+ size="desktop"
451
+ image="/banner.jpg"
428
452
  title="Annual Conference 2024"
429
- date="Jun 23, 2024"
430
- time="08:30 12:00"
453
+ date="23 มิ.ย. 2567"
454
+ time="08.30 - 12.00"
431
455
  location="Main Hall, Floor 7"
432
456
  count="150/200"
433
457
  tagStatus="registered"
434
- image="/banner.jpg"
458
+ />
459
+
460
+ // News
461
+ <Card
462
+ variant="news"
463
+ size="desktop"
464
+ image="/cover.jpg"
465
+ category="Market"
466
+ title="Great design begins with understanding user needs"
467
+ date="01 มกราคม 2025"
468
+ bookmarked={bm}
469
+ onBookmarkToggle={toggle}
435
470
  />
436
471
  ```
437
472
 
438
- Variants set width: `desktop` (308px) · `tablet` (224px) · `mobile` (163px).
439
- Pick based on viewport breakpoint, not aesthetic.
473
+ **Size presets set width:** `desktop` (308px) · `tablet` (224px) · `mobile` (163px). Pick based on viewport breakpoint, not aesthetic. The `"default"` variant uses `size` only for its internal padding / radius — set width yourself via `className`.
440
474
 
441
475
  `tagStatus`: `"not-registered"` | `"registered"` | `"full"`.
442
476
 
477
+ When no `image` is provided on `event` / `news` / `social` / `live`, the banner area renders a neutral placeholder (no broken-image icon).
478
+
443
479
  ### Table
444
480
 
445
481
  Data tables. Compose with TableRow + TableHeaderCell + TableCell.
@@ -603,6 +639,121 @@ Raw option rows. Use when you need a custom dropdown or a sidebar menu — other
603
639
 
604
640
  ---
605
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
+
606
757
  ### Modal
607
758
 
608
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.3.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": [