reactaform 1.4.3 → 1.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/README.md CHANGED
@@ -193,29 +193,89 @@ interface ReactaDefinition {
193
193
 
194
194
  ## 🎨 Theming
195
195
 
196
+ ReactaForm includes **20 pre-built themes** that you can import individually for optimal bundle size.
197
+
198
+ ### Quick Start
199
+
200
+ ```tsx
201
+ // Import a theme
202
+ import 'reactaform/themes/material.css';
203
+ import { ReactaForm } from 'reactaform';
204
+
205
+ function App() {
206
+ return <ReactaForm theme="material" definitionData={...} />;
207
+ }
208
+ ```
209
+
210
+ ### Available Themes
211
+
212
+ **Light Themes:**
213
+ - `material`, `ant-design`, `blueprint`, `fluent`, `shadcn`, `tailwind`
214
+ - `modern-light`, `macos-native`, `ios-mobile`, `soft-pastel`
215
+ - `glass-morphism`, `high-contrast-accessible`
216
+
217
+ **Dark Themes:**
218
+ - `material-dark`, `ant-design-dark`, `blueprint-dark`, `tailwind-dark`
219
+ - `midnight-dark`, `neon-cyber-dark`
220
+
221
+ **Variants:**
222
+ - `compact-variant`, `spacious-variant` (size adjustments)
223
+
224
+ ### Theme Switching
225
+
226
+ ```tsx
227
+ import 'reactaform/themes/material.css';
228
+ import 'reactaform/themes/material-dark.css';
229
+ import { ReactaForm } from 'reactaform';
230
+ import { useState } from 'react';
231
+
232
+ function App() {
233
+ const [isDark, setIsDark] = useState(false);
234
+
235
+ return (
236
+ <>
237
+ <button onClick={() => setIsDark(!isDark)}>Toggle Theme</button>
238
+ <ReactaForm
239
+ theme={isDark ? 'material-dark' : 'material'}
240
+ definitionData={...}
241
+ />
242
+ </>
243
+ );
244
+ }
245
+ ```
246
+
247
+ ### Custom Theme
248
+
196
249
  Customize with CSS variables:
197
250
 
198
251
  ```css
199
- :root {
200
- --reactaform-color-primary: #2563eb;
201
- --reactaform-color-error: #ef4444;
202
- --reactaform-font-size: 1rem;
203
- --reactaform-input-bg: #ffffff;
252
+ [data-reactaform-theme="my-custom"] {
253
+ --reactaform-primary-bg: #ffffff;
254
+ --reactaform-secondary-bg: #f9f9f9;
255
+ --reactaform-text-color: #000000;
256
+ --reactaform-border-color: #cccccc;
257
+ --reactaform-border-radius: 8px;
258
+ /* ... see theme files for all variables */
204
259
  }
260
+ ```
205
261
 
206
- /* Dark */
207
- [data-reactaform-theme="dark"] {
208
- --reactaform-bg-primary: #1a1a1a;
209
- --reactaform-text-color: #ededed;
210
- }
262
+ ```tsx
263
+ <ReactaForm theme="my-custom" definitionData={...} />
211
264
  ```
212
265
 
213
- **Enable Dark Mode:**
266
+ **Dark Theme Convention:** Include "dark" in your theme name (e.g., `my-custom-dark`) for automatic dark mode detection.
267
+
268
+ ### Detect Dark Themes
214
269
 
215
270
  ```tsx
216
- <ReactaForm darkMode={true} ... />
271
+ import { isDarkTheme } from 'reactaform';
272
+
273
+ isDarkTheme('material-dark'); // true
274
+ isDarkTheme('material'); // false
217
275
  ```
218
276
 
277
+ 📖 **Full theme documentation:** [docs/theme-integration.md](docs/theme-integration.md)
278
+
219
279
  ## 🌍 Internationalization (i18n)
220
280
 
221
281
  ```tsx
package/dist/index.d.ts CHANGED
@@ -20,4 +20,5 @@ export { registerFieldValidationHandler, registerFormValidationHandler, } from '
20
20
  export type { DebouncedCallback } from './hooks/useDebouncedCallback';
21
21
  export { useDebouncedCallback } from './hooks/useDebouncedCallback';
22
22
  export * as Units from './utils/unitValueMapper';
23
+ export { isDarkTheme } from './utils/themeUtils';
23
24
  export { serializeInstance, deserializeInstance, serializeDefinition, deserializeDefinition } from './utils/definitionSerializers';