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

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.
@@ -4,6 +4,46 @@ This document lists significant changes between versions that might require modi
4
4
 
5
5
  ---
6
6
 
7
+ ## Version 1.2.7
8
+
9
+ ### Renamed `ZestProvider` to `ZestButtonConfigProvider`
10
+
11
+ 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`.
12
+
13
+ This is a breaking change that requires updating all imports and usages of the provider, context, and hook in your application.
14
+
15
+ **Before:**
16
+
17
+ ```tsx
18
+ import { ZestProvider, useZest } from 'jattac.libs.web.zest-button';
19
+
20
+ const App = () => (
21
+ <ZestProvider config={myConfig}>...</ZestProvider>
22
+ );
23
+
24
+ const MyComponent = () => {
25
+ const config = useZest();
26
+ // ...
27
+ }
28
+ ```
29
+
30
+ **After:**
31
+
32
+ ```tsx
33
+ import { ZestButtonConfigProvider, useZestButtonConfig } from 'jattac.libs.web.zest-button';
34
+
35
+ const App = () => (
36
+ <ZestButtonConfigProvider config={myConfig}>...</ZestButtonConfigProvider>
37
+ );
38
+
39
+ const MyComponent = () => {
40
+ const config = useZestButtonConfig();
41
+ // ...
42
+ }
43
+ ```
44
+
45
+ ---
46
+
7
47
  ## Version 1.2.6
8
48
 
9
49
  ### Renamed `fullWidth` prop to `stretch`
@@ -48,18 +48,18 @@ const PinnedFooter = () => (
48
48
 
49
49
  ---
50
50
 
51
- ### Global Configuration with `ZestProvider`
51
+ ### Global Configuration with `ZestButtonConfigProvider`
52
52
 
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.
53
+ 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
54
 
55
55
  #### Usage
56
56
 
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`.
57
+ 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
58
 
59
59
  ```tsx
60
60
  // In your main App.tsx file
61
61
 
62
- import { ZestProvider } from 'jattac.libs.web.zest-button';
62
+ import { ZestButtonConfigProvider } from 'jattac.libs.web.zest-button';
63
63
  import MyRoutes from './MyRoutes';
64
64
 
65
65
  const appZestConfig = {
@@ -74,28 +74,28 @@ const appZestConfig = {
74
74
  };
75
75
 
76
76
  const App = () => (
77
- <ZestProvider config={appZestConfig}>
77
+ <ZestButtonConfigProvider config={appZestConfig}>
78
78
  <MyRoutes />
79
- </ZestProvider>
79
+ </ZestButtonConfigProvider>
80
80
  );
81
81
  ```
82
82
 
83
- #### Precedence with the `ZestProvider`
83
+ #### Precedence with the `ZestButtonConfigProvider`
84
84
 
85
85
  Property configurations are merged in a "deep merge" fashion with the following order of precedence (where the last one wins):
86
86
 
87
- 1. **Global `defaultProps`**: Props defined in the `ZestProvider`'s `config.defaultProps` object. This is the base layer of styling.
87
+ 1. **Global `defaultProps`**: Props defined in the `ZestButtonConfigProvider`'s `config.defaultProps` object. This is the base layer of styling.
88
88
  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.
89
+ 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
90
  4. **Local `zest` Props**: The props passed directly to a specific `<ZestButton>` instance. This gives you the ultimate granular control.
91
91
 
92
92
  ---
93
93
 
94
94
  ### Advanced: Customizing Semantic Defaults
95
95
 
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.
96
+ 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
97
 
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.
98
+ 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
99
 
100
100
  #### Example: Defining a Custom 'archive' Type
101
101
 
@@ -112,11 +112,11 @@ declare module 'jattac.libs.web.zest-button' {
112
112
  }
113
113
  ```
114
114
 
115
- Now, configure the defaults in your `ZestProvider`:
115
+ Now, configure the defaults in your `ZestButtonConfigProvider`:
116
116
 
117
117
  ```tsx
118
118
  // In your main App.tsx file
119
- import { ZestProvider } from 'jattac.libs.web.zest-button';
119
+ import { ZestButtonConfigProvider } from 'jattac.libs.web.zest-button';
120
120
  import { FaArchive } from 'react-icons/fa';
121
121
  import MyRoutes from './MyRoutes';
122
122
 
@@ -138,9 +138,9 @@ const appZestConfig = {
138
138
  };
139
139
 
140
140
  const App = () => (
141
- <ZestProvider config={appZestConfig}>
141
+ <ZestButtonConfigProvider config={appZestConfig}>
142
142
  <MyRoutes />
143
- </ZestProvider>
143
+ </ZestButtonConfigProvider>
144
144
  );
145
145
 
146
146
  // --- Later, in some other component ---
@@ -157,7 +157,7 @@ Let's say you like the built-in `delete` type, but for your application, you wan
157
157
 
158
158
  ```tsx
159
159
  // In your main App.tsx file
160
- import { ZestProvider } from 'jattac.libs.web.zest-button';
160
+ import { ZestButtonConfigProvider } from 'jattac.libs.web.zest-button';
161
161
  import MyRoutes from './MyRoutes';
162
162
 
163
163
  const appZestConfig = {
@@ -177,9 +177,9 @@ const appZestConfig = {
177
177
  };
178
178
 
179
179
  const App = () => (
180
- <ZestProvider config={appZestConfig}>
180
+ <ZestButtonConfigProvider config={appZestConfig}>
181
181
  <MyRoutes />
182
- </ZestProvider>
182
+ </ZestButtonConfigProvider>
183
183
  );
184
184
 
185
185
  // --- Later, in some other component ---
package/docs/examples.md CHANGED
@@ -108,7 +108,7 @@ const DeleteButton = () => {
108
108
  ```tsx
109
109
  // In your main App.tsx
110
110
  import React from 'react';
111
- import { ZestProvider, ZestButton } from 'jattac.libs.web.zest-button';
111
+ import { ZestButtonConfigProvider, ZestButton } from 'jattac.libs.web.zest-button';
112
112
 
113
113
  const appZestConfig = {
114
114
  defaultProps: {
@@ -120,7 +120,7 @@ const appZestConfig = {
120
120
  };
121
121
 
122
122
  const App = () => (
123
- <ZestProvider config={appZestConfig}>
123
+ <ZestButtonConfigProvider config={appZestConfig}>
124
124
  <div style={{ display: 'flex', gap: '1rem', alignItems: 'center' }}>
125
125
  <ZestButton>I'm a small outline button</ZestButton>
126
126
  <ZestButton>So am I</ZestButton>
@@ -128,7 +128,7 @@ const App = () => (
128
128
  I'm a large solid button! (Local override)
129
129
  </ZestButton>
130
130
  </div>
131
- </ZestProvider>
131
+ </ZestButtonConfigProvider>
132
132
  );
133
133
  ```
134
134
  *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 +141,7 @@ const App = () => (
141
141
 
142
142
  **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
143
 
144
- **Solution:** This is a two-step process that combines **TypeScript Module Augmentation** with the **`ZestProvider`**.
144
+ **Solution:** This is a two-step process that combines **TypeScript Module Augmentation** with the **`ZestButtonConfigProvider`**.
145
145
 
146
146
  **Step 1: Define the new type**
147
147
  In your project's type declarations file (e.g., `src/zest.d.ts`), augment the `CustomZestSemanticTypes` interface.
@@ -161,12 +161,12 @@ declare module 'jattac.libs.web.zest-button' {
161
161
  *(For more on this, see the [Contributor's Guide](./development.md#extending-semantic-types).)*
162
162
 
163
163
  **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.
164
+ In your `App.tsx`, use the `semanticTypeDefaults` property in the `ZestButtonConfigProvider` to define the default props for your new `'archive'` type.
165
165
 
166
166
  ```tsx
167
167
  // In your main App.tsx
168
168
  import React from 'react';
169
- import { ZestProvider, ZestButton } from 'jattac.libs.web.zest-button';
169
+ import { ZestButtonConfigProvider, ZestButton } from 'jattac.libs.web.zest-button';
170
170
  import { FaArchive } from 'react-icons/fa';
171
171
 
172
172
  const appZestConfig = {
@@ -191,7 +191,7 @@ const appZestConfig = {
191
191
  };
192
192
 
193
193
  const App = () => (
194
- <ZestProvider config={appZestConfig}>
194
+ <ZestButtonConfigProvider config={appZestConfig}>
195
195
  <div style={{ display: 'flex', gap: '1rem' }}>
196
196
  {/* 3. Now just use it! */}
197
197
  <ZestButton
@@ -208,7 +208,7 @@ const App = () => (
208
208
  Delete
209
209
  </ZestButton>
210
210
  </div>
211
- </ZestProvider>
211
+ </ZestButtonConfigProvider>
212
212
  );
213
213
  ```
214
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).
package/docs/features.md CHANGED
@@ -81,9 +81,9 @@ const appZestConfig = {
81
81
  };
82
82
 
83
83
  const App = () => (
84
- <ZestProvider config={appZestConfig}>
84
+ <ZestButtonConfigProvider config={appZestConfig}>
85
85
  {/* All buttons inside will be small and outline by default */}
86
- </ZestProvider>
86
+ </ZestButtonConfigProvider>
87
87
  );
88
88
  ```
89
89
  *__Learn more in the [Standardizing Your Buttons recipe](./examples.md#recipe-3-standardizing-your-buttons-with-a-global-config).__*
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.7",
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": {