jattac.libs.web.zest-button 1.2.6 → 1.2.8

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/api.md CHANGED
@@ -1,9 +1,26 @@
1
+ ---
2
+ [⬅️ Previous: Features Showcase](./features.md)
3
+
1
4
  # API Reference: The Technical Blueprint
2
5
 
3
6
  This document provides an exhaustive reference for all `ZestButton` props and type definitions.
4
7
 
5
8
  ---
6
9
 
10
+ ## Table of Contents
11
+
12
+ - [ZestButtonProps](#zestbuttonprops)
13
+ - [Type Definitions](#type-definitions)
14
+ - [ZestCustomProps](#zestcustomprops)
15
+ - [ZestGlobalConfig](#zestglobalconfig)
16
+ - [VisualOptions](#visualoptions)
17
+ - [BusyOptions](#busyoptions)
18
+ - [SuccessOptions](#successoptions)
19
+ - [ConfirmOptions](#confirmoptions)
20
+ - [SemanticType](#semantictype)
21
+
22
+ ---
23
+
7
24
  ### `ZestButtonProps`
8
25
 
9
26
  The `ZestButton` component accepts all standard HTML `<button>` attributes (e.g., `disabled`, `type`, `name`, `className`) in addition to its own custom configuration prop, `zest`.
@@ -38,7 +55,7 @@ This is the main configuration object passed to the `zest` prop.
38
55
 
39
56
  #### `ZestGlobalConfig`
40
57
 
41
- This is the configuration object passed to the `config` prop of the `ZestProvider`.
58
+ This is the configuration object passed to the `config` prop of the `ZestButtonConfigProvider`.
42
59
 
43
60
  | Prop Name | Type | Default | Description |
44
61
  | :--- | :--- | :--- | :--- |
@@ -117,3 +134,7 @@ declare module 'jattac.libs.web.zest-button' {
117
134
  }
118
135
  ```
119
136
  After augmentation, `'archive'` and `'publish'` would be valid `SemanticType` values, available for autocompletion and type-checking.
137
+
138
+ ---
139
+
140
+ [⬅️ Previous: Features Showcase](./features.md) | [Next: Configuration Guide ➡️](./configuration.md)
@@ -1,9 +1,60 @@
1
+ ---
2
+ [⬅️ Previous: Development Guide](./development.md)
3
+
1
4
  # Breaking Changes: The Upgrade Path
2
5
 
3
6
  This document lists significant changes between versions that might require modifications to your existing codebase.
4
7
 
5
8
  ---
6
9
 
10
+ ## Table of Contents
11
+
12
+ - [Version 1.2.7](#version-127)
13
+ - [Version 1.2.6](#version-126)
14
+ - [Version 1.2.0](#version-120)
15
+
16
+ ---
17
+
18
+ ## Version 1.2.7
19
+
20
+ ### Renamed `ZestProvider` to `ZestButtonConfigProvider`
21
+
22
+ To provide more explicit naming and better context within the API, the `ZestProvider` component has been renamed to `ZestButtonConfigProvider`. Additionally, its associated context is now `ZestButtonConfigContext`, and the consumption hook is `useZestButtonConfig`.
23
+
24
+ This is a breaking change that requires updating all imports and usages of the provider, context, and hook in your application.
25
+
26
+ **Before:**
27
+
28
+ ```tsx
29
+ import { ZestProvider, useZest } from 'jattac.libs.web.zest-button';
30
+
31
+ const App = () => (
32
+ <ZestProvider config={myConfig}>...</ZestProvider>
33
+ );
34
+
35
+ const MyComponent = () => {
36
+ const config = useZest();
37
+ // ...
38
+ }
39
+ ```
40
+
41
+ **After:**
42
+
43
+ ```tsx
44
+ import { ZestButtonConfigProvider, useZestButtonConfig } from 'jattac.libs.web.zest-button';
45
+
46
+ const App = () => (
47
+ <ZestButtonConfigProvider config={myConfig}>...</ZestButtonConfigProvider>
48
+ );
49
+
50
+ const MyComponent = () => {
51
+ const config = useZestButtonConfig();
52
+ // ...
53
+ }
54
+ ```
55
+
56
+ ---
57
+
7
58
  ## Version 1.2.6
8
59
 
9
60
  ### Renamed `fullWidth` prop to `stretch`
@@ -86,3 +137,7 @@ This change allows for better organization of configuration options (e.g., `visu
86
137
  My Button
87
138
  </ZestButton>
88
139
  ```
140
+
141
+ ---
142
+
143
+ [⬅️ Previous: Development Guide](./development.md) | [Next: README ➡️](../README.md)
@@ -1,9 +1,27 @@
1
+ ---
2
+ [⬅️ Previous: API Reference](./api.md)
3
+
1
4
  # Configuration: The Control Panel
2
5
 
3
6
  This document explains how to configure `ZestButton` on a component and global level.
4
7
 
5
8
  ---
6
9
 
10
+ ## Table of Contents
11
+
12
+ - [Overview](#overview)
13
+ - [Theme Configuration](#theme-configuration)
14
+ - [Order of Precedence](#order-of-precedence)
15
+ - [Example: Forcing a Theme](#example-forcing-a-theme)
16
+ - [Global Configuration with ZestButtonConfigProvider](#global-configuration-with-zestbuttonconfigprovider)
17
+ - [Usage](#usage)
18
+ - [Precedence with the ZestButtonConfigProvider](#precedence-with-the-zestbuttonconfigprovider)
19
+ - [Advanced: Customizing Semantic Defaults](#advanced-customizing-semantic-defaults)
20
+ - [Example: Defining a Custom 'archive' Type](#example-defining-a-custom-archive-type)
21
+ - [Example: Overriding a Built-in 'delete' Default](#example-overriding-a-built-in-delete-default)
22
+
23
+ ---
24
+
7
25
  ### Overview
8
26
 
9
27
  Currently, `ZestButton` is primarily configured on a per-component basis via the `zest` prop. This provides the most explicit and direct control over each button's behavior and appearance.
@@ -48,18 +66,18 @@ const PinnedFooter = () => (
48
66
 
49
67
  ---
50
68
 
51
- ### Global Configuration with `ZestProvider`
69
+ ### Global Configuration with `ZestButtonConfigProvider`
52
70
 
53
- The `ZestProvider` component is now implemented, allowing you to streamline `ZestButton` configuration across your entire application. You can define a set of default `zest` properties that all `ZestButton` instances within its scope will inherit.
71
+ The `ZestButtonConfigProvider` component is now implemented, allowing you to streamline `ZestButton` configuration across your entire application. You can define a set of default `zest` properties that all `ZestButton` instances within its scope will inherit.
54
72
 
55
73
  #### Usage
56
74
 
57
- Wrap your application (or specific sections) with the `ZestProvider` and pass a configuration object to its `config` prop. The `config` prop expects an object of type `ZestGlobalConfig`, which contains a `defaultProps` field of type `ZestCustomProps`.
75
+ Wrap your application (or specific sections) with the `ZestButtonConfigProvider` and pass a configuration object to its `config` prop. The `config` prop expects an object of type `ZestGlobalConfig`, which contains a `defaultProps` field of type `ZestCustomProps`.
58
76
 
59
77
  ```tsx
60
78
  // In your main App.tsx file
61
79
 
62
- import { ZestProvider } from 'jattac.libs.web.zest-button';
80
+ import { ZestButtonConfigProvider } from 'jattac.libs.web.zest-button';
63
81
  import MyRoutes from './MyRoutes';
64
82
 
65
83
  const appZestConfig = {
@@ -74,28 +92,28 @@ const appZestConfig = {
74
92
  };
75
93
 
76
94
  const App = () => (
77
- <ZestProvider config={appZestConfig}>
95
+ <ZestButtonConfigProvider config={appZestConfig}>
78
96
  <MyRoutes />
79
- </ZestProvider>
97
+ </ZestButtonConfigProvider>
80
98
  );
81
99
  ```
82
100
 
83
- #### Precedence with the `ZestProvider`
101
+ #### Precedence with the `ZestButtonConfigProvider`
84
102
 
85
103
  Property configurations are merged in a "deep merge" fashion with the following order of precedence (where the last one wins):
86
104
 
87
- 1. **Global `defaultProps`**: Props defined in the `ZestProvider`'s `config.defaultProps` object. This is the base layer of styling.
105
+ 1. **Global `defaultProps`**: Props defined in the `ZestButtonConfigProvider`'s `config.defaultProps` object. This is the base layer of styling.
88
106
  2. **Built-in Semantic Defaults**: The library's own defaults for a given `semanticType` (e.g., the `success` variant for `save`).
89
- 3. **Custom Semantic Defaults**: **(New!)** Defaults for a `semanticType` that you provide in the `ZestProvider`'s `config.semanticTypeDefaults` object. This allows you to override the library's defaults or create new ones.
107
+ 3. **Custom Semantic Defaults**: **(New!)** Defaults for a `semanticType` that you provide in the `ZestButtonConfigProvider`'s `config.semanticTypeDefaults` object. This allows you to override the library's defaults or create new ones.
90
108
  4. **Local `zest` Props**: The props passed directly to a specific `<ZestButton>` instance. This gives you the ultimate granular control.
91
109
 
92
110
  ---
93
111
 
94
112
  ### Advanced: Customizing Semantic Defaults
95
113
 
96
- This is one of the most powerful features of the `ZestProvider`. You can define application-wide styles and behaviors for any `semanticType`. This is perfect for creating a consistent design system.
114
+ This is one of the most powerful features of the `ZestButtonConfigProvider`. You can define application-wide styles and behaviors for any `semanticType`. This is perfect for creating a consistent design system.
97
115
 
98
- The `ZestProvider`'s `config` prop accepts a `semanticTypeDefaults` object. You can use this to **override** built-in defaults or **define** defaults for your own custom types.
116
+ The `ZestButtonConfigProvider`'s `config` prop accepts a `semanticTypeDefaults` object. You can use this to **override** built-in defaults or **define** defaults for your own custom types.
99
117
 
100
118
  #### Example: Defining a Custom 'archive' Type
101
119
 
@@ -112,11 +130,11 @@ declare module 'jattac.libs.web.zest-button' {
112
130
  }
113
131
  ```
114
132
 
115
- Now, configure the defaults in your `ZestProvider`:
133
+ Now, configure the defaults in your `ZestButtonConfigProvider`:
116
134
 
117
135
  ```tsx
118
136
  // In your main App.tsx file
119
- import { ZestProvider } from 'jattac.libs.web.zest-button';
137
+ import { ZestButtonConfigProvider } from 'jattac.libs.web.zest-button';
120
138
  import { FaArchive } from 'react-icons/fa';
121
139
  import MyRoutes from './MyRoutes';
122
140
 
@@ -138,9 +156,9 @@ const appZestConfig = {
138
156
  };
139
157
 
140
158
  const App = () => (
141
- <ZestProvider config={appZestConfig}>
159
+ <ZestButtonConfigProvider config={appZestConfig}>
142
160
  <MyRoutes />
143
- </ZestProvider>
161
+ </ZestButtonConfigProvider>
144
162
  );
145
163
 
146
164
  // --- Later, in some other component ---
@@ -157,7 +175,7 @@ Let's say you like the built-in `delete` type, but for your application, you wan
157
175
 
158
176
  ```tsx
159
177
  // In your main App.tsx file
160
- import { ZestProvider } from 'jattac.libs.web.zest-button';
178
+ import { ZestButtonConfigProvider } from 'jattac.libs.web.zest-button';
161
179
  import MyRoutes from './MyRoutes';
162
180
 
163
181
  const appZestConfig = {
@@ -177,9 +195,9 @@ const appZestConfig = {
177
195
  };
178
196
 
179
197
  const App = () => (
180
- <ZestProvider config={appZestConfig}>
198
+ <ZestButtonConfigProvider config={appZestConfig}>
181
199
  <MyRoutes />
182
- </ZestProvider>
200
+ </ZestButtonConfigProvider>
183
201
  );
184
202
 
185
203
  // --- Later, in some other component ---
@@ -190,3 +208,7 @@ const App = () => (
190
208
  </ZestButton>
191
209
  ```
192
210
 
211
+ ---
212
+
213
+ [⬅️ Previous: API Reference](./api.md) | [Next: Development Guide ➡️](./development.md)
214
+
@@ -1,9 +1,21 @@
1
+ ---
2
+ [⬅️ Previous: Configuration Guide](./configuration.md)
3
+
1
4
  # Development: The Contributor's Guide
2
5
 
3
6
  This guide provides an overview of the project's internal structure and instructions for setting up your development environment.
4
7
 
5
8
  ---
6
9
 
10
+ ## Table of Contents
11
+
12
+ - [Internal Architecture](#internal-architecture)
13
+ - [Setup Instructions](#setup-instructions)
14
+ - [Scripts](#scripts)
15
+ - [Extending Semantic Types](#extending-semantic-types)
16
+
17
+ ---
18
+
7
19
  ### Internal Architecture
8
20
 
9
21
  The `jattac.libs.web.zest-button` project is structured to be a self-contained React component library.
@@ -75,3 +87,7 @@ declare module 'jattac.libs.web.zest-button' {
75
87
  Once augmented, these new semantic types (`'archive'`, `'publish'`) will be available for autocompletion and type-checking when using the `semanticType` prop on your `ZestButton` instances.
76
88
 
77
89
  *(Note: Currently, there are no dedicated test scripts defined in `package.json`. Testing is typically done manually in a consuming project during development, or through dedicated test runners that would be added in the future.)*
90
+
91
+ ---
92
+
93
+ [⬅️ Previous: Configuration Guide](./configuration.md) | [Next: Breaking Changes ➡️](./breaking-changes.md)
package/docs/examples.md CHANGED
@@ -4,6 +4,15 @@ Welcome to the ZestButton Cookbook! This is the core learning path for mastering
4
4
 
5
5
  ---
6
6
 
7
+ ## Table of Contents
8
+
9
+ - [Recipe 1: Your First Async Button](#recipe-1-your-first-async-button)
10
+ - [Recipe 2: The Safe "Delete" Button](#recipe-2-the-safe-delete-button)
11
+ - [Recipe 3: Standardizing Your Buttons with a Global Config](#recipe-3-standardizing-your-buttons-with-a-global-config)
12
+ - [Recipe 4: Creating a Custom "Archive" Button](#recipe-4-creating-a-custom-archive-button)
13
+
14
+ ---
15
+
7
16
  ### Recipe 1: Your First Async Button
8
17
 
9
18
  **Goal:** Create a button that automatically shows a loading spinner during an operation and gives feedback when it's done.
@@ -108,7 +117,7 @@ const DeleteButton = () => {
108
117
  ```tsx
109
118
  // In your main App.tsx
110
119
  import React from 'react';
111
- import { ZestProvider, ZestButton } from 'jattac.libs.web.zest-button';
120
+ import { ZestButtonConfigProvider, ZestButton } from 'jattac.libs.web.zest-button';
112
121
 
113
122
  const appZestConfig = {
114
123
  defaultProps: {
@@ -120,7 +129,7 @@ const appZestConfig = {
120
129
  };
121
130
 
122
131
  const App = () => (
123
- <ZestProvider config={appZestConfig}>
132
+ <ZestButtonConfigProvider config={appZestConfig}>
124
133
  <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
125
134
  <ZestButton>I'm a small outline button</ZestButton>
126
135
  <ZestButton>So am I</ZestButton>
@@ -128,7 +137,7 @@ const App = () => (
128
137
  I'm a large solid button! (Local override)
129
138
  </ZestButton>
130
139
  </div>
131
- </ZestProvider>
140
+ </ZestButtonConfigProvider>
132
141
  );
133
142
  ```
134
143
  *For a full list of provider settings, see the [`ZestGlobalConfig`](./api.md#zestglobalconfig) documentation. To understand the precedence rules, see the [Configuration Guide](./configuration.md).*
@@ -141,7 +150,7 @@ const App = () => (
141
150
 
142
151
  **Problem:** You have a common action in your app, like "Archive," that should always look and feel the same. You want to avoid configuring it manually each time and just be able to write `zest={{ semanticType: 'archive' }}`.
143
152
 
144
- **Solution:** This is a two-step process that combines **TypeScript Module Augmentation** with the **`ZestProvider`**.
153
+ **Solution:** This is a two-step process that combines **TypeScript Module Augmentation** with the **`ZestButtonConfigProvider`**.
145
154
 
146
155
  **Step 1: Define the new type**
147
156
  In your project's type declarations file (e.g., `src/zest.d.ts`), augment the `CustomZestSemanticTypes` interface.
@@ -161,12 +170,12 @@ declare module 'jattac.libs.web.zest-button' {
161
170
  *(For more on this, see the [Contributor's Guide](./development.md#extending-semantic-types).)*
162
171
 
163
172
  **Step 2: Provide the default configuration**
164
- In your `App.tsx`, use the `semanticTypeDefaults` property in the `ZestProvider` to define the default props for your new `'archive'` type.
173
+ In your `App.tsx`, use the `semanticTypeDefaults` property in the `ZestButtonConfigProvider` to define the default props for your new `'archive'` type.
165
174
 
166
175
  ```tsx
167
176
  // In your main App.tsx
168
177
  import React from 'react';
169
- import { ZestProvider, ZestButton } from 'jattac.libs.web.zest-button';
178
+ import { ZestButtonConfigProvider, ZestButton } from 'jattac.libs.web.zest-button';
170
179
  import { FaArchive } from 'react-icons/fa';
171
180
 
172
181
  const appZestConfig = {
@@ -191,7 +200,7 @@ const appZestConfig = {
191
200
  };
192
201
 
193
202
  const App = () => (
194
- <ZestProvider config={appZestConfig}>
203
+ <ZestButtonConfigProvider config={appZestConfig}>
195
204
  <div style={{ display: 'flex', gap: '1rem' }}>
196
205
  {/* 3. Now just use it! */}
197
206
  <ZestButton
@@ -208,8 +217,11 @@ const App = () => (
208
217
  Delete
209
218
  </ZestButton>
210
219
  </div>
211
- </ZestProvider>
220
+ </ZestButtonConfigProvider>
212
221
  );
213
222
  ```
214
- This powerful pattern allows you to build a complete, consistent design system for all button actions in your application. For more details on configuration, see the [Configuration Guide](./configuration.md).
223
+ This powerful pattern allows you to build a complete, consistent design system for all button actions in your application. For more details on configuration, see the [Configuration Guide](./configuration.md).*
224
+
225
+ ---
215
226
 
227
+ [⬅️ Previous: README](../README.md) | [Next: Features Showcase ➡️](./features.md)
package/docs/features.md CHANGED
@@ -4,6 +4,16 @@ This document provides a high-level showcase of what's possible with `ZestButton
4
4
 
5
5
  ---
6
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
+
7
17
  ### Asynchronous Operations & Feedback
8
18
 
9
19
  **What it does:** Automatically handles loading states and provides clear success/failure feedback for any action that returns a Promise.
@@ -81,9 +91,9 @@ const appZestConfig = {
81
91
  };
82
92
 
83
93
  const App = () => (
84
- <ZestProvider config={appZestConfig}>
94
+ <ZestButtonConfigProvider config={appZestConfig}>
85
95
  {/* All buttons inside will be small and outline by default */}
86
- </ZestProvider>
96
+ </ZestButtonConfigProvider>
87
97
  );
88
98
  ```
89
99
  *__Learn more in the [Standardizing Your Buttons recipe](./examples.md#recipe-3-standardizing-your-buttons-with-a-global-config).__*
@@ -100,7 +110,7 @@ const MyComponent = () => (
100
110
  <ZestButton zest={{ visualOptions: { variant: 'success', size: 'sm' } }}>
101
111
  Small Success
102
112
  </ZestButton>
103
- <ZestButton zest={{ buttonStyle: 'outline', size: 'md' } }}>
113
+ <ZestButton zest={{ buttonStyle: 'outline', size: 'md' }}>
104
114
  Medium Outline
105
115
  </ZestButton>
106
116
  <ZestButton zest={{ visualOptions: { variant: 'danger', size: 'lg' } }}>
@@ -111,3 +121,6 @@ const MyComponent = () => (
111
121
  ```
112
122
  *Explore all the recipes in the **[Cookbook](./examples.md)** to see these options in action.*
113
123
 
124
+ ---
125
+
126
+ [⬅️ Previous: The Cookbook (Examples)](./examples.md) | [Next: API Reference ➡️](./api.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jattac.libs.web.zest-button",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "A highly customizable and production-ready React button component featuring robust asynchronous handling, rich visual feedback, and built-in confirmation flows for enhanced user experience",
5
5
  "homepage": "https://github.com/nyingimaina/jattac.libs.web.zest-button#readme",
6
6
  "repository": {