@agentero/design-system 0.5.0 → 0.6.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.
@@ -576,13 +576,13 @@
576
576
  <header>
577
577
  <div class="wrap">
578
578
  <h1>Manifest Debugger</h1>
579
- <div class="summary"><a class="filter-pill all" data-k="all" href="#filter-all">All</a><span class="filter-pill ok" aria-disabled="true">6 components ok</span><span class="filter-pill ok" aria-disabled="true">79 stories ok</span></div>
579
+ <div class="summary"><a class="filter-pill all" data-k="all" href="#filter-all">All</a><span class="filter-pill ok" aria-disabled="true">7 components ok</span><span class="filter-pill ok" aria-disabled="true">90 stories ok</span></div>
580
580
  </div>
581
581
  </header>
582
582
  <main>
583
583
  <div class="wrap">
584
584
  <div class="note ok" style="margin-bottom: 16px;">
585
- Using <code>react-docgen-typescript</code>. Generation took <strong>2.3s</strong>.
585
+ Using <code>react-docgen-typescript</code>. Generation took <strong>2.0s</strong>.
586
586
  </div>
587
587
  <h2 class="section-title">Components</h2>
588
588
  <div class="grid" role="list">
@@ -2497,6 +2497,432 @@ size?: &quot;sm&quot; | &quot;md&quot; | &quot;lg&quot;</code></pre>
2497
2497
  </div>
2498
2498
  </div>
2499
2499
 
2500
+ </div>
2501
+ </article>
2502
+ <article
2503
+ class="card
2504
+ no-error
2505
+ no-info
2506
+ no-story-error
2507
+ no-doc-error"
2508
+ role="listitem"
2509
+ aria-label="Toast">
2510
+ <div class="head">
2511
+ <div class="title">
2512
+ <h2><span class="status-dot dot-ok"></span> Toast</h2>
2513
+ <div class="badges">
2514
+ <label for="c-6-components-toast-props" class="badge ok as-toggle">11 prop types</label>
2515
+
2516
+ <label for="c-6-components-toast-stories" class="badge ok as-toggle">11 stories</label>
2517
+
2518
+ </div>
2519
+ </div>
2520
+ <div class="meta" title="./src/toast/toast.stories.tsx">components-toast · ./src/toast/toast.stories.tsx</div>
2521
+
2522
+ <div class="hint">Toast renders transient feedback about an outcome — saved, failed, warning, info — without interrupting the user&#39;s flow. Mount `&lt;Toast /&gt;` once near the app root to register the provider, then call the imperative `toast()` API from anywhere in the tree. Five semantic types (`neutral`, `success`, `error`, `warning`, `info`) × two layouts (`inline`, `expanded`) cover the common feedback patterns.</div>
2523
+
2524
+ </div>
2525
+
2526
+ <!-- ⬇️ Hidden toggles must be siblings BEFORE .panels -->
2527
+
2528
+
2529
+ <input id="c-6-components-toast-stories" class="tg tg-stories" type="checkbox" hidden />
2530
+
2531
+ <input id="c-6-components-toast-props" class="tg tg-props" type="checkbox" hidden />
2532
+
2533
+ <div class="panels">
2534
+
2535
+
2536
+
2537
+ <div class="panel panel-props">
2538
+ <div class="note ok">
2539
+ <div class="row">
2540
+ <span class="ex-name">Prop types <small>(react-docgen-typescript)</small></span>
2541
+ <span class="badge ok">11 prop types</span>
2542
+ </div>
2543
+ <pre><code>Component: src/toast/toast.tsx::Toast</code></pre>
2544
+ <pre><code>Props:</code></pre>
2545
+ <pre><code>/**
2546
+ * Additional className merged onto the sonner `&lt;Toaster&gt;` root.
2547
+ */
2548
+ className?: string
2549
+
2550
+ /**
2551
+ * Text direction. Sonner forwards this to the rendered toaster root.
2552
+ */
2553
+ dir?: &quot;auto&quot; | &quot;ltr&quot; | &quot;rtl&quot;
2554
+
2555
+ /**
2556
+ * Default auto-dismiss duration in ms for toasts fired against this provider. Defaults to `5000`.
2557
+ */
2558
+ duration?: number = 5000
2559
+
2560
+ /**
2561
+ * When `true`, stack expands on hover instead of auto-collapsing.
2562
+ */
2563
+ expand?: boolean
2564
+
2565
+ /**
2566
+ * Gap between stacked toasts, in pixels.
2567
+ */
2568
+ gap?: number
2569
+
2570
+ /**
2571
+ * Keyboard shortcut used to focus the toaster.
2572
+ */
2573
+ hotkey?: string[]
2574
+
2575
+ /**
2576
+ * When `true`, flips light/dark theme on the toaster root.
2577
+ */
2578
+ invert?: boolean
2579
+
2580
+ /**
2581
+ * Offset from the screen edge, in pixels or as a CSS length.
2582
+ */
2583
+ offset?: string | number
2584
+
2585
+ /**
2586
+ * Placement of the toaster on the screen. Defaults to `&#39;bottom-right&#39;`.
2587
+ */
2588
+ position?: ToastPosition = bottom-right
2589
+
2590
+ /**
2591
+ * When `true`, sonner paints colored backgrounds per type (DS uses its own icon tokens by default).
2592
+ */
2593
+ richColors?: boolean
2594
+
2595
+ /**
2596
+ * Maximum number of toasts rendered at once before earlier ones dismiss.
2597
+ */
2598
+ visibleToasts?: number</code></pre>
2599
+ </div>
2600
+ </div>
2601
+
2602
+ <div class="panel panel-stories">
2603
+
2604
+
2605
+
2606
+ <div class="note ok">
2607
+ <div class="row">
2608
+ <span class="ex-name">Imports</span>
2609
+ </div>
2610
+ <pre><code>import { Button, Toast } from "@agentero/design-system";</code></pre>
2611
+ </div>
2612
+
2613
+
2614
+ <div class="note ok">
2615
+ <div class="row">
2616
+ <span class="ex-name">Default</span>
2617
+ <span class="badge ok">story ok</span>
2618
+ </div>
2619
+ <div>Default playground for the Toast provider</div>
2620
+ <div class="hint">Args-controlled playground. Click the button to fire a neutral toast; tweak `position` and `duration` from the Controls panel to preview the provider defaults.</div>
2621
+ <pre><code>const Default = () =&gt; (
2622
+ &lt;div style={{ minHeight: &#39;240px&#39; }}&gt;
2623
+ &lt;Button variant=&quot;secondary&quot; onClick={() =&gt; toast(&#39;Hello from Toast&#39;)}&gt;
2624
+ Show toast
2625
+ &lt;/Button&gt;
2626
+ &lt;/div&gt;
2627
+ );</code></pre>
2628
+ </div>
2629
+ <div class="note ok">
2630
+ <div class="row">
2631
+ <span class="ex-name">Inline</span>
2632
+ <span class="badge ok">story ok</span>
2633
+ </div>
2634
+ <div>Inline layout across all five semantic types</div>
2635
+ <div class="hint">Inline layout (default). Compact treatment — title with an optional description stacked directly below it. The `type` drives the icon color. Use for short acknowledgments that don&#39;t need a colored rail.</div>
2636
+ <pre><code>const Inline = () =&gt; (
2637
+ &lt;div style={{ display: &#39;flex&#39;, flexWrap: &#39;wrap&#39;, gap: &#39;0.5rem&#39; }}&gt;
2638
+ &lt;Button
2639
+ variant=&quot;secondary&quot;
2640
+ onClick={() =&gt; toast(&#39;Something happened&#39;, { description: &#39;Additional context.&#39; })}&gt;
2641
+ Neutral
2642
+ &lt;/Button&gt;
2643
+ &lt;Button
2644
+ variant=&quot;secondary&quot;
2645
+ onClick={() =&gt; toast.success(&#39;Policy saved&#39;, { description: &#39;Your edits are live.&#39; })}&gt;
2646
+ Success
2647
+ &lt;/Button&gt;
2648
+ &lt;Button
2649
+ variant=&quot;secondary&quot;
2650
+ onClick={() =&gt;
2651
+ toast.error(&#39;Failed to save&#39;, { description: &#39;The file could not be processed.&#39; })
2652
+ }&gt;
2653
+ Error
2654
+ &lt;/Button&gt;
2655
+ &lt;Button
2656
+ variant=&quot;secondary&quot;
2657
+ onClick={() =&gt;
2658
+ toast.warning(&#39;License expiring soon&#39;, { description: &#39;Renew before end of month.&#39; })
2659
+ }&gt;
2660
+ Warning
2661
+ &lt;/Button&gt;
2662
+ &lt;Button
2663
+ variant=&quot;secondary&quot;
2664
+ onClick={() =&gt;
2665
+ toast.info(&#39;Sync in progress&#39;, { description: &#39;Please wait while we sync your data.&#39; })
2666
+ }&gt;
2667
+ Info
2668
+ &lt;/Button&gt;
2669
+ &lt;/div&gt;
2670
+ );</code></pre>
2671
+ </div>
2672
+ <div class="note ok">
2673
+ <div class="row">
2674
+ <span class="ex-name">Expanded</span>
2675
+ <span class="badge ok">story ok</span>
2676
+ </div>
2677
+ <div>Expanded layout across all five semantic types</div>
2678
+ <div class="hint">Expanded layout. Multi-line treatment with a 0.375rem colored left rail that tracks the toast&#39;s `type`. Use for feedback that benefits from a description on its own line or a trailing action button.</div>
2679
+ <pre><code>const Expanded = () =&gt; (
2680
+ &lt;div style={{ display: &#39;flex&#39;, flexWrap: &#39;wrap&#39;, gap: &#39;0.5rem&#39; }}&gt;
2681
+ &lt;Button
2682
+ variant=&quot;secondary&quot;
2683
+ onClick={() =&gt;
2684
+ toast(&#39;Something happened&#39;, {
2685
+ variant: &#39;expanded&#39;,
2686
+ description: &#39;Additional context for the user.&#39;
2687
+ })
2688
+ }&gt;
2689
+ Neutral
2690
+ &lt;/Button&gt;
2691
+ &lt;Button
2692
+ variant=&quot;secondary&quot;
2693
+ onClick={() =&gt;
2694
+ toast.success(&#39;Policy saved&#39;, {
2695
+ variant: &#39;expanded&#39;,
2696
+ description: &#39;Your changes have been saved successfully.&#39;
2697
+ })
2698
+ }&gt;
2699
+ Success
2700
+ &lt;/Button&gt;
2701
+ &lt;Button
2702
+ variant=&quot;secondary&quot;
2703
+ onClick={() =&gt;
2704
+ toast.error(&#39;Failed to save&#39;, {
2705
+ variant: &#39;expanded&#39;,
2706
+ description: &#39;The file could not be processed.&#39;
2707
+ })
2708
+ }&gt;
2709
+ Error
2710
+ &lt;/Button&gt;
2711
+ &lt;Button
2712
+ variant=&quot;secondary&quot;
2713
+ onClick={() =&gt;
2714
+ toast.warning(&#39;License expiring soon&#39;, {
2715
+ variant: &#39;expanded&#39;,
2716
+ description: &#39;Renew before the end of the month to avoid interruption.&#39;
2717
+ })
2718
+ }&gt;
2719
+ Warning
2720
+ &lt;/Button&gt;
2721
+ &lt;Button
2722
+ variant=&quot;secondary&quot;
2723
+ onClick={() =&gt;
2724
+ toast.info(&#39;Sync in progress&#39;, {
2725
+ variant: &#39;expanded&#39;,
2726
+ description: &#39;Please wait while we sync your data.&#39;
2727
+ })
2728
+ }&gt;
2729
+ Info
2730
+ &lt;/Button&gt;
2731
+ &lt;/div&gt;
2732
+ );</code></pre>
2733
+ </div>
2734
+ <div class="note ok">
2735
+ <div class="row">
2736
+ <span class="ex-name">With Action Object</span>
2737
+ <span class="badge ok">story ok</span>
2738
+ </div>
2739
+ <div>Toast with a structured action button</div>
2740
+ <div class="hint">Toast with a structured `action` object. Passing `{ label, onClick }` renders the built-in secondary Button; the handler runs and the toast auto-dismisses afterward.</div>
2741
+ <pre><code>const WithActionObject = () =&gt; (
2742
+ &lt;Button
2743
+ variant=&quot;secondary&quot;
2744
+ onClick={() =&gt;
2745
+ toast.error(&#39;Upload failed&#39;, {
2746
+ variant: &#39;expanded&#39;,
2747
+ description: &#39;The file could not be processed.&#39;,
2748
+ action: { label: &#39;Retry&#39;, onClick: () =&gt; {} }
2749
+ })
2750
+ }&gt;
2751
+ Show toast with action
2752
+ &lt;/Button&gt;
2753
+ );</code></pre>
2754
+ </div>
2755
+ <div class="note ok">
2756
+ <div class="row">
2757
+ <span class="ex-name">With Action Node</span>
2758
+ <span class="badge ok">story ok</span>
2759
+ </div>
2760
+ <div>Toast with a custom ReactNode action</div>
2761
+ <div class="hint">Toast with a raw-ReactNode `action`. Pass any JSX to render a custom trailing control — a link, a pair of buttons, etc. — when the default secondary Button doesn&#39;t fit.</div>
2762
+ <pre><code>const WithActionNode = () =&gt; (
2763
+ &lt;Button
2764
+ variant=&quot;secondary&quot;
2765
+ onClick={() =&gt;
2766
+ toast(&#39;File uploaded&#39;, {
2767
+ description: &#39;document.pdf is ready.&#39;,
2768
+ action: (
2769
+ &lt;Button variant=&quot;link&quot; onClick={() =&gt; {}}&gt;
2770
+ View file
2771
+ &lt;/Button&gt;
2772
+ )
2773
+ })
2774
+ }&gt;
2775
+ Show toast with link action
2776
+ &lt;/Button&gt;
2777
+ );</code></pre>
2778
+ </div>
2779
+ <div class="note ok">
2780
+ <div class="row">
2781
+ <span class="ex-name">With Action And Cancel</span>
2782
+ <span class="badge ok">story ok</span>
2783
+ </div>
2784
+ <div>Toast with an action and a cancel control</div>
2785
+ <div class="hint">Toast with both `action` and `cancel`. Cancel renders as a ghost Button next to the action; its handler runs and the toast auto-dismisses.</div>
2786
+ <pre><code>const WithActionAndCancel = () =&gt; (
2787
+ &lt;Button
2788
+ variant=&quot;secondary&quot;
2789
+ onClick={() =&gt;
2790
+ toast.success(&#39;Record archived&#39;, {
2791
+ variant: &#39;expanded&#39;,
2792
+ description: &#39;The record is hidden from the default view.&#39;,
2793
+ action: { label: &#39;Undo&#39;, onClick: () =&gt; {} },
2794
+ cancel: { label: &#39;Dismiss&#39;, onClick: () =&gt; {} }
2795
+ })
2796
+ }&gt;
2797
+ Show toast with action + cancel
2798
+ &lt;/Button&gt;
2799
+ );</code></pre>
2800
+ </div>
2801
+ <div class="note ok">
2802
+ <div class="row">
2803
+ <span class="ex-name">Non Dismissible</span>
2804
+ <span class="badge ok">story ok</span>
2805
+ </div>
2806
+ <div>Non-dismissible toast (no close button)</div>
2807
+ <div class="hint">Non-dismissible toast. Setting `dismissible: false` hides the close button; the toast still auto-dismisses when its `duration` elapses, or programmatically via `toast.dismiss(id)`.</div>
2808
+ <pre><code>const NonDismissible = () =&gt; (
2809
+ &lt;Button
2810
+ variant=&quot;secondary&quot;
2811
+ onClick={() =&gt;
2812
+ toast.info(&#39;Sync in progress&#39;, {
2813
+ dismissible: false,
2814
+ description: &#39;Please wait while we sync your data.&#39;
2815
+ })
2816
+ }&gt;
2817
+ Show non-dismissible toast
2818
+ &lt;/Button&gt;
2819
+ );</code></pre>
2820
+ </div>
2821
+ <div class="note ok">
2822
+ <div class="row">
2823
+ <span class="ex-name">Long Duration</span>
2824
+ <span class="badge ok">story ok</span>
2825
+ </div>
2826
+ <div>Toast with a custom `duration`</div>
2827
+ <div class="hint">Long-duration toast. `duration` (in ms) overrides the provider default so long-running operations stay visible until they&#39;re relevant.</div>
2828
+ <pre><code>const LongDuration = () =&gt; (
2829
+ &lt;Button
2830
+ variant=&quot;secondary&quot;
2831
+ onClick={() =&gt;
2832
+ toast.info(&#39;Uploading documents&#39;, {
2833
+ description: &#39;This may take a moment.&#39;,
2834
+ duration: 10_000
2835
+ })
2836
+ }&gt;
2837
+ Show 10s toast
2838
+ &lt;/Button&gt;
2839
+ );</code></pre>
2840
+ </div>
2841
+ <div class="note ok">
2842
+ <div class="row">
2843
+ <span class="ex-name">Programmatic Dismiss</span>
2844
+ <span class="badge ok">story ok</span>
2845
+ </div>
2846
+ <div>Dismiss a toast programmatically via its id</div>
2847
+ <div class="hint">Programmatic dismissal. `toast()` returns the toast id, which you can pass to `toast.dismiss(id)` to clear it before its duration elapses.</div>
2848
+ <pre><code>const ProgrammaticDismiss = () =&gt; {
2849
+ let toastId: string | number | undefined;
2850
+ return (
2851
+ &lt;div style={{ display: &#39;flex&#39;, gap: &#39;0.5rem&#39; }}&gt;
2852
+ &lt;Button
2853
+ variant=&quot;secondary&quot;
2854
+ onClick={() =&gt; {
2855
+ toastId = toast.info(&#39;Uploading...&#39;, { duration: 60_000 });
2856
+ }}&gt;
2857
+ Start
2858
+ &lt;/Button&gt;
2859
+ &lt;Button
2860
+ variant=&quot;ghost&quot;
2861
+ onClick={() =&gt; {
2862
+ if (toastId !== undefined) toast.dismiss(toastId);
2863
+ }}&gt;
2864
+ Dismiss
2865
+ &lt;/Button&gt;
2866
+ &lt;/div&gt;
2867
+ );
2868
+ };</code></pre>
2869
+ </div>
2870
+ <div class="note ok">
2871
+ <div class="row">
2872
+ <span class="ex-name">With Promise</span>
2873
+ <span class="badge ok">story ok</span>
2874
+ </div>
2875
+ <div>Wire a toast to an async operation via `toast.promise`</div>
2876
+ <div class="hint">`toast.promise` wires a toast to an async operation — loading while the promise is pending, success or error when it settles. Useful for save/submit flows where the outcome feeds back into the same toast.</div>
2877
+ <pre><code>const WithPromise = () =&gt; {
2878
+ const fakeFetch = () =&gt;
2879
+ new Promise&lt;string&gt;((resolve, reject) =&gt; {
2880
+ window.setTimeout(
2881
+ () =&gt; (Math.random() &gt; 0.5 ? resolve(&#39;ok&#39;) : reject(new globalThis.Error(&#39;nope&#39;))),
2882
+ 1500
2883
+ );
2884
+ });
2885
+ return (
2886
+ &lt;Button
2887
+ variant=&quot;secondary&quot;
2888
+ onClick={() =&gt;
2889
+ toast.promise(fakeFetch(), {
2890
+ loading: &#39;Saving document…&#39;,
2891
+ success: &#39;Document saved&#39;,
2892
+ error: &#39;Save failed&#39;
2893
+ })
2894
+ }&gt;
2895
+ Run promise
2896
+ &lt;/Button&gt;
2897
+ );
2898
+ };</code></pre>
2899
+ </div>
2900
+ <div class="note ok">
2901
+ <div class="row">
2902
+ <span class="ex-name">Custom Icon</span>
2903
+ <span class="badge ok">story ok</span>
2904
+ </div>
2905
+ <div>Override the default type-based icon</div>
2906
+ <div class="hint">Custom `icon` override. Pass any ReactNode as `icon` to replace the type-based default — helpful when the toast reflects a domain-specific action (e.g., a sync icon for a sync-in-progress toast).</div>
2907
+ <pre><code>const CustomIcon = () =&gt; (
2908
+ &lt;Button
2909
+ variant=&quot;secondary&quot;
2910
+ onClick={() =&gt;
2911
+ toast.success(&#39;Sync started&#39;, {
2912
+ description: &#39;Data sync is in progress.&#39;,
2913
+ icon: (
2914
+ &lt;svg viewBox=&quot;0 0 24 24&quot; width=&quot;24&quot; height=&quot;24&quot; fill=&quot;currentColor&quot; aria-hidden&gt;
2915
+ &lt;path d=&quot;M12 4V1L8 5l4 4V6c3.3 0 6 2.7 6 6 0 1-.3 2-.7 2.8l1.5 1.5C19.5 15 20 13.6 20 12c0-4.4-3.6-8-8-8zm0 14c-3.3 0-6-2.7-6-6 0-1 .3-2 .7-2.8L5.2 7.7C4.5 9 4 10.4 4 12c0 4.4 3.6 8 8 8v3l4-4-4-4v3z&quot; /&gt;
2916
+ &lt;/svg&gt;
2917
+ )
2918
+ })
2919
+ }&gt;
2920
+ Show toast with custom icon
2921
+ &lt;/Button&gt;
2922
+ );</code></pre>
2923
+ </div>
2924
+ </div>
2925
+
2500
2926
  </div>
2501
2927
  </article>
2502
2928
  </div>