jattac.libs.web.zest-button 1.2.9 → 1.4.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/docs/features.md DELETED
@@ -1,126 +0,0 @@
1
- # Features: A Guided Tour
2
-
3
- This document provides a high-level showcase of what's possible with `ZestButton`. For detailed, practical implementation guides, please see our **[Cookbook](./examples.md)**.
4
-
5
- ---
6
-
7
- ## Table of Contents
8
-
9
- - [Asynchronous Operations & Feedback](#asynchronous-operations--feedback)
10
- - [Confirmation Flow](#confirmation-flow)
11
- - [Semantic Types](#semantic-types)
12
- - [Global Configuration](#global-configuration)
13
- - [Rich Styling](#rich-styling)
14
-
15
- ---
16
-
17
- ### Asynchronous Operations & Feedback
18
-
19
- **What it does:** Automatically handles loading states and provides clear success/failure feedback for any action that returns a Promise.
20
-
21
- ```tsx
22
- const MyComponent = () => {
23
- const handleAsyncClick = async () => {
24
- // Simulate an API call that takes 2 seconds
25
- await new Promise(resolve => setTimeout(resolve, 2000));
26
- };
27
-
28
- return (
29
- <ZestButton onClick={handleAsyncClick}>
30
- Perform Async Action
31
- </ZestButton>
32
- );
33
- };
34
- ```
35
- *__Learn more in the [Your First Async Button recipe](./examples.md#recipe-1-your-first-async-button).__*
36
-
37
- ---
38
-
39
- ### Confirmation Flow
40
-
41
- **What it does:** Protects users from accidentally performing critical actions by requiring a second click to confirm.
42
-
43
- ```tsx
44
- const MyComponent = () => {
45
- const handleDelete = () => alert('The item has been deleted!');
46
-
47
- return (
48
- <ZestButton
49
- onClick={handleDelete}
50
- zest={{
51
- confirmOptions: { displayLabel: 'Confirm?', timeoutSecs: 5 },
52
- visualOptions: { variant: 'danger' }
53
- }}
54
- >
55
- Delete Item
56
- </ZestButton>
57
- );
58
- };
59
- ```
60
- *__Learn more in the [Safe "Delete" Button recipe](./examples.md#recipe-2-the-safe-delete-button).__*
61
-
62
- ---
63
-
64
- ### Semantic Types
65
-
66
- **What it does:** Streamlines development by allowing you to declare button intent (e.g., `'save'`, `'delete'`). The button automatically gets appropriate icons, colors, and behaviors.
67
-
68
- ```tsx
69
- const MyComponent = () => (
70
- <div style={{ display: 'flex', gap: '1rem' }}>
71
- <ZestButton zest={{ semanticType: 'save' }}>Save</ZestButton>
72
- <ZestButton zest={{ semanticType: 'cancel' }}>Cancel</ZestButton>
73
- </div>
74
- );
75
- ```
76
- *__Learn how to create your own in the [Creating a Custom "Archive" Button recipe](./examples.md#recipe-4-creating-a-custom-archive-button).__*
77
-
78
- ---
79
-
80
- ### Global Configuration
81
-
82
- **What it does:** Allows you to define a consistent style (like size or button style) for all buttons across your entire application.
83
-
84
- ```tsx
85
- // In your App.tsx
86
- const appZestConfig = {
87
- defaultProps: {
88
- visualOptions: { size: 'sm' },
89
- buttonStyle: 'outline',
90
- },
91
- };
92
-
93
- const App = () => (
94
- <ZestButtonConfigProvider config={appZestConfig}>
95
- {/* All buttons inside will be small and outline by default */}
96
- </ZestButtonConfigProvider>
97
- );
98
- ```
99
- *__Learn more in the [Standardizing Your Buttons recipe](./examples.md#recipe-3-standardizing-your-buttons-with-a-global-config).__*
100
-
101
- ---
102
-
103
- ### Rich Styling
104
-
105
- **What it does:** Provides multiple variants, sizes, and styles (`solid`, `outline`, `text`, `dashed`) to fit any UI context. It also automatically adapts to light and dark themes.
106
-
107
- ```tsx
108
- const MyComponent = () => (
109
- <div style={{ display: 'flex', alignItems: 'center', gap: '1rem' }}>
110
- <ZestButton zest={{ visualOptions: { variant: 'success', size: 'sm' } }}>
111
- Small Success
112
- </ZestButton>
113
- <ZestButton zest={{ buttonStyle: 'outline', size: 'md' }}>
114
- Medium Outline
115
- </ZestButton>
116
- <ZestButton zest={{ visualOptions: { variant: 'danger', size: 'lg' } }}>
117
- Large Danger
118
- </ZestButton>
119
- </div>
120
- );
121
- ```
122
- *Explore all the recipes in the **[Cookbook](./examples.md)** to see these options in action.*
123
-
124
- ---
125
-
126
- [⬅️ Previous: The Cookbook (Examples)](./examples.md) | [Next: API Reference ➡️](./api.md)