hazo_ui 2.6.2 → 2.6.4
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 +151 -53
- package/dist/index.cjs +278 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -4
- package/dist/index.d.ts +81 -4
- package/dist/index.js +276 -39
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,104 @@ Tailwind v4 uses JIT compilation and only generates CSS for classes found in sca
|
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
68
|
+
## Color Configuration
|
|
69
|
+
|
|
70
|
+
hazo_ui provides a centralized configuration system for customizing button and header colors across all components. You can set colors globally using `set_hazo_ui_config()` or override them per-component using props.
|
|
71
|
+
|
|
72
|
+
### Global Configuration
|
|
73
|
+
|
|
74
|
+
Set default colors for all components in your app:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { set_hazo_ui_config } from 'hazo_ui';
|
|
78
|
+
|
|
79
|
+
// Set custom colors globally (typically in your app's entry point)
|
|
80
|
+
set_hazo_ui_config({
|
|
81
|
+
// Dialog headers
|
|
82
|
+
header_background_color: '#1e3a8a',
|
|
83
|
+
header_text_color: '#ffffff',
|
|
84
|
+
|
|
85
|
+
// Submit/Apply buttons
|
|
86
|
+
submit_button_background_color: '#10b981',
|
|
87
|
+
submit_button_text_color: '#ffffff',
|
|
88
|
+
|
|
89
|
+
// Cancel buttons
|
|
90
|
+
cancel_button_border_color: '#6b7280',
|
|
91
|
+
cancel_button_text_color: '#374151',
|
|
92
|
+
|
|
93
|
+
// Clear/Delete buttons
|
|
94
|
+
clear_button_border_color: '#ef4444',
|
|
95
|
+
clear_button_text_color: '#ef4444',
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Per-Component Override
|
|
100
|
+
|
|
101
|
+
Override colors for individual component instances using props:
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<HazoUiMultiFilterDialog
|
|
105
|
+
availableFields={fields}
|
|
106
|
+
onFilterChange={handleFilterChange}
|
|
107
|
+
// Color overrides (these take precedence over global config)
|
|
108
|
+
headerBackgroundColor="#7c3aed"
|
|
109
|
+
headerTextColor="#ffffff"
|
|
110
|
+
submitButtonBackgroundColor="#f59e0b"
|
|
111
|
+
submitButtonTextColor="#ffffff"
|
|
112
|
+
cancelButtonBorderColor="#ec4899"
|
|
113
|
+
cancelButtonTextColor="#ec4899"
|
|
114
|
+
/>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Available Color Properties
|
|
118
|
+
|
|
119
|
+
**HazoUiConfig Interface:**
|
|
120
|
+
```tsx
|
|
121
|
+
interface HazoUiConfig {
|
|
122
|
+
// Dialog Header Colors
|
|
123
|
+
header_background_color?: string;
|
|
124
|
+
header_text_color?: string;
|
|
125
|
+
|
|
126
|
+
// Submit/Action Button Colors
|
|
127
|
+
submit_button_background_color?: string;
|
|
128
|
+
submit_button_text_color?: string;
|
|
129
|
+
submit_button_hover_color?: string;
|
|
130
|
+
|
|
131
|
+
// Cancel Button Colors
|
|
132
|
+
cancel_button_background_color?: string;
|
|
133
|
+
cancel_button_text_color?: string;
|
|
134
|
+
cancel_button_border_color?: string;
|
|
135
|
+
cancel_button_hover_color?: string;
|
|
136
|
+
|
|
137
|
+
// Clear/Delete Button Colors
|
|
138
|
+
clear_button_background_color?: string;
|
|
139
|
+
clear_button_text_color?: string;
|
|
140
|
+
clear_button_border_color?: string;
|
|
141
|
+
clear_button_hover_color?: string;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Configuration Functions
|
|
146
|
+
|
|
147
|
+
**`set_hazo_ui_config(config: Partial<HazoUiConfig>)`**
|
|
148
|
+
- Merges provided config with existing global config
|
|
149
|
+
- Accepts partial config (you can set only the colors you want to customize)
|
|
150
|
+
|
|
151
|
+
**`get_hazo_ui_config(): Readonly<HazoUiConfig>`**
|
|
152
|
+
- Returns the current global configuration (read-only)
|
|
153
|
+
|
|
154
|
+
**`reset_hazo_ui_config()`**
|
|
155
|
+
- Resets all colors to default (undefined, using theme defaults)
|
|
156
|
+
|
|
157
|
+
### Components Supporting Color Configuration
|
|
158
|
+
|
|
159
|
+
The following components support both global config and prop-level color overrides:
|
|
160
|
+
- `HazoUiDialog` - via `headerBackgroundColor`, `headerTextColor`, `accentColor` props
|
|
161
|
+
- `HazoUiMultiFilterDialog` - via header/submit/cancel/clear color props
|
|
162
|
+
- `HazoUiMultiSortDialog` - via header/submit/cancel/clear color props
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
68
166
|
## Components
|
|
69
167
|
|
|
70
168
|
### Component Overview
|
|
@@ -1780,8 +1878,13 @@ interface HazoUiDialogProps {
|
|
|
1780
1878
|
openAnimation?: AnimationPreset | string; // default: "zoom"
|
|
1781
1879
|
closeAnimation?: AnimationPreset | string; // default: "zoom"
|
|
1782
1880
|
|
|
1783
|
-
//
|
|
1881
|
+
// Variant (preset color theme)
|
|
1882
|
+
variant?: DialogVariant; // default: "default"
|
|
1883
|
+
splitHeader?: boolean; // default: true - When true, title/description get separate bg rows; false = single bg, italic description
|
|
1884
|
+
|
|
1885
|
+
// Color Customization (overrides variant preset if both provided)
|
|
1784
1886
|
headerBackgroundColor?: string;
|
|
1887
|
+
descriptionBackgroundColor?: string;
|
|
1785
1888
|
headerTextColor?: string;
|
|
1786
1889
|
bodyBackgroundColor?: string;
|
|
1787
1890
|
footerBackgroundColor?: string;
|
|
@@ -1801,6 +1904,7 @@ interface HazoUiDialogProps {
|
|
|
1801
1904
|
showCloseButton?: boolean; // default: true
|
|
1802
1905
|
}
|
|
1803
1906
|
|
|
1907
|
+
type DialogVariant = 'default' | 'info' | 'success' | 'warning' | 'danger';
|
|
1804
1908
|
type AnimationPreset = 'zoom' | 'slide' | 'fade' | 'bounce' | 'scale-up' | 'flip' | 'slide-left' | 'slide-right' | 'slide-top' | 'none';
|
|
1805
1909
|
type ButtonVariant = "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
1806
1910
|
```
|
|
@@ -2333,75 +2437,69 @@ function ProgressDialog() {
|
|
|
2333
2437
|
/>
|
|
2334
2438
|
```
|
|
2335
2439
|
|
|
2336
|
-
#### Themed Dialogs
|
|
2440
|
+
#### Themed Dialogs (Variant Prop)
|
|
2441
|
+
|
|
2442
|
+
Use the `variant` prop to apply preset color themes with a single prop instead of specifying individual colors. Available variants: `info`, `success`, `warning`, `danger`.
|
|
2443
|
+
|
|
2444
|
+
Each variant auto-applies: header background tint, header text color, border color, accent color, tinted overlay, and (for `danger`) destructive button variant.
|
|
2445
|
+
|
|
2446
|
+
**Override chain:** Individual prop > Variant preset > Global config. You can use a variant and still override specific colors via props.
|
|
2337
2447
|
|
|
2338
|
-
**Success Theme**
|
|
2339
2448
|
```tsx
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
description="Operation completed successfully"
|
|
2343
|
-
actionButtonText="Done"
|
|
2344
|
-
showCancelButton={false}
|
|
2345
|
-
borderColor="rgb(34, 197, 94)"
|
|
2346
|
-
headerBackgroundColor="rgb(220, 252, 231)"
|
|
2347
|
-
headerTextColor="rgb(22, 101, 52)"
|
|
2348
|
-
accentColor="rgb(34, 197, 94)"
|
|
2349
|
-
overlayClassName="bg-green-950/50"
|
|
2350
|
-
{...props}
|
|
2351
|
-
>
|
|
2449
|
+
// Success variant
|
|
2450
|
+
<HazoUiDialog variant="success" title="✓ Success" actionButtonText="Done" showCancelButton={false} {...props}>
|
|
2352
2451
|
<p>Your changes have been saved.</p>
|
|
2353
2452
|
</HazoUiDialog>
|
|
2354
|
-
```
|
|
2355
2453
|
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
<HazoUiDialog
|
|
2359
|
-
title="⚠ Warning"
|
|
2360
|
-
description="Please review before proceeding"
|
|
2361
|
-
actionButtonText="I Understand"
|
|
2362
|
-
borderColor="rgb(234, 179, 8)"
|
|
2363
|
-
headerBackgroundColor="rgb(254, 249, 195)"
|
|
2364
|
-
headerTextColor="rgb(113, 63, 18)"
|
|
2365
|
-
accentColor="rgb(234, 179, 8)"
|
|
2366
|
-
overlayClassName="bg-yellow-950/50"
|
|
2367
|
-
{...props}
|
|
2368
|
-
>
|
|
2454
|
+
// Warning variant
|
|
2455
|
+
<HazoUiDialog variant="warning" title="⚠ Warning" actionButtonText="I Understand" {...props}>
|
|
2369
2456
|
<p>You have unsaved changes that will be lost.</p>
|
|
2370
2457
|
</HazoUiDialog>
|
|
2458
|
+
|
|
2459
|
+
// Danger variant (auto-sets destructive button)
|
|
2460
|
+
<HazoUiDialog variant="danger" title="⛔ Delete" actionButtonText="Delete Permanently" {...props}>
|
|
2461
|
+
<p>All data will be permanently deleted.</p>
|
|
2462
|
+
</HazoUiDialog>
|
|
2463
|
+
|
|
2464
|
+
// Info variant
|
|
2465
|
+
<HazoUiDialog variant="info" title="ℹ Information" actionButtonText="Got It" showCancelButton={false} {...props}>
|
|
2466
|
+
<p>New features are now available.</p>
|
|
2467
|
+
</HazoUiDialog>
|
|
2371
2468
|
```
|
|
2372
2469
|
|
|
2373
|
-
|
|
2470
|
+
##### Split Header vs Merged Header
|
|
2471
|
+
|
|
2472
|
+
By default (`splitHeader={true}`), variant dialogs render the title and description as two separate rows with different background intensities. Set `splitHeader={false}` for a single header background with the description as italic subtext.
|
|
2473
|
+
|
|
2374
2474
|
```tsx
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
description
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
overlayClassName="bg-red-950/50"
|
|
2384
|
-
{...props}
|
|
2385
|
-
>
|
|
2386
|
-
<p>All data will be permanently deleted.</p>
|
|
2475
|
+
// Split header (default) - two background rows
|
|
2476
|
+
<HazoUiDialog variant="info" splitHeader={true} title="Title" description="Description" {...props}>
|
|
2477
|
+
<p>Title row has stronger blue, description row has lighter blue.</p>
|
|
2478
|
+
</HazoUiDialog>
|
|
2479
|
+
|
|
2480
|
+
// Merged header - single background, italic description
|
|
2481
|
+
<HazoUiDialog variant="danger" splitHeader={false} title="Delete" description="This is permanent." {...props}>
|
|
2482
|
+
<p>One red header background with italic description text.</p>
|
|
2387
2483
|
</HazoUiDialog>
|
|
2388
2484
|
```
|
|
2389
2485
|
|
|
2390
|
-
|
|
2486
|
+
##### Overriding Variant Colors
|
|
2487
|
+
|
|
2391
2488
|
```tsx
|
|
2489
|
+
// Use info variant but override header to purple
|
|
2392
2490
|
<HazoUiDialog
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
borderColor="rgb(59, 130, 246)"
|
|
2398
|
-
headerBackgroundColor="rgb(219, 234, 254)"
|
|
2399
|
-
headerTextColor="rgb(30, 58, 138)"
|
|
2400
|
-
accentColor="rgb(59, 130, 246)"
|
|
2401
|
-
overlayClassName="bg-blue-950/50"
|
|
2491
|
+
variant="info"
|
|
2492
|
+
headerBackgroundColor="rgb(243, 232, 255)"
|
|
2493
|
+
headerTextColor="rgb(88, 28, 135)"
|
|
2494
|
+
title="Custom Header"
|
|
2402
2495
|
{...props}
|
|
2403
2496
|
>
|
|
2404
|
-
<p>
|
|
2497
|
+
<p>Blue border/accent from variant, purple header from props.</p>
|
|
2498
|
+
</HazoUiDialog>
|
|
2499
|
+
|
|
2500
|
+
// Danger variant with non-destructive button override
|
|
2501
|
+
<HazoUiDialog variant="danger" actionButtonVariant="default" title="Acknowledge" {...props}>
|
|
2502
|
+
<p>Red colors from variant, default button from prop override.</p>
|
|
2405
2503
|
</HazoUiDialog>
|
|
2406
2504
|
```
|
|
2407
2505
|
|