@hakistack/ng-daisyui 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +376 -2
- package/fesm2022/hakistack-ng-daisyui-document_wasm_glue-BusZZ32t.mjs +327 -0
- package/fesm2022/hakistack-ng-daisyui-document_wasm_glue-BusZZ32t.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui-document_wasm_inline-HI02T61_.mjs +6 -0
- package/fesm2022/hakistack-ng-daisyui-document_wasm_inline-HI02T61_.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui-engine_wasm_glue-ClEcb6yJ.mjs +1328 -0
- package/fesm2022/hakistack-ng-daisyui-engine_wasm_glue-ClEcb6yJ.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui-engine_wasm_inline-DkzGyhGY.mjs +6 -0
- package/fesm2022/hakistack-ng-daisyui-engine_wasm_inline-DkzGyhGY.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui-image_wasm_glue-cLIBHdUJ.mjs +251 -0
- package/fesm2022/hakistack-ng-daisyui-image_wasm_glue-cLIBHdUJ.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui-image_wasm_inline-dOzXsoNb.mjs +6 -0
- package/fesm2022/hakistack-ng-daisyui-image_wasm_inline-dOzXsoNb.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui-pdfium_worker_inline-BdPitrud.mjs +7 -0
- package/fesm2022/hakistack-ng-daisyui-pdfium_worker_inline-BdPitrud.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui-phone-lib-BZ7gmnrv.mjs +9 -0
- package/fesm2022/hakistack-ng-daisyui-phone-lib-BZ7gmnrv.mjs.map +1 -0
- package/fesm2022/hakistack-ng-daisyui.mjs +51168 -0
- package/fesm2022/hakistack-ng-daisyui.mjs.map +1 -0
- package/package.json +149 -4
- package/plugin.cjs +279 -0
- package/plugin.mjs +279 -0
- package/schematics/collection.json +15 -0
- package/schematics/migrate-table-columns/index.js +70 -0
- package/schematics/migrate-table-columns/index.js.map +1 -0
- package/schematics/migrate-table-columns/migrate-source.js +0 -0
- package/schematics/migrate-table-columns/migrate-source.js.map +1 -0
- package/schematics/migrate-table-columns/schema.js +3 -0
- package/schematics/migrate-table-columns/schema.js.map +1 -0
- package/schematics/migrate-table-columns/schema.json +13 -0
- package/schematics/ng-add/index.js +273 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.js +3 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/ng-add/schema.json +38 -0
- package/styles-v4.css +6967 -0
- package/styles.css +400 -0
- package/themes/daisyui-v4.css +80 -0
- package/themes/daisyui-v5.css +62 -0
- package/themes/kaizen-light.css +63 -0
- package/themes/kaizen.css +63 -0
- package/types/hakistack-ng-daisyui.d.ts +15988 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hakistack
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,377 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @hakistack/ng-daisyui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Reusable Angular UI components built with DaisyUI v5 and Tailwind CSS v4.
|
|
4
|
+
|
|
5
|
+
> **Note:** Primary support is **Tailwind v4 + DaisyUI v5**. A legacy **Tailwind v3 + DaisyUI v4** path ships a precompiled stylesheet, `@hakistack/ng-daisyui/styles-v4.css`, that contains every class the library uses. `ng add` will prompt you to pick.
|
|
6
|
+
>
|
|
7
|
+
> **Requirements:** Angular 21 (`@angular/core`, `common`, `forms`, `router`, `cdk`, `aria` — all `^21`), RxJS 7.8, Tailwind CSS 4 + daisyUI 5.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### Recommended: `ng add`
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ng add @hakistack/ng-daisyui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
You'll be prompted to pick a toolchain:
|
|
18
|
+
|
|
19
|
+
**Tailwind v4 + DaisyUI v5 (recommended)** — `--target v5`
|
|
20
|
+
- Adds `@angular/cdk` + `@angular/aria` to `dependencies`
|
|
21
|
+
- Adds `tailwindcss` + `@tailwindcss/postcss` + `daisyui` to `devDependencies`
|
|
22
|
+
- Ensures `styles.css` contains (in order):
|
|
23
|
+
```css
|
|
24
|
+
@import "tailwindcss";
|
|
25
|
+
@plugin "daisyui";
|
|
26
|
+
@import "@hakistack/ng-daisyui";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Tailwind v3 + DaisyUI v4 (legacy)** — `--target v4-legacy`
|
|
30
|
+
- Adds `@angular/cdk` + `@angular/aria` to `dependencies`
|
|
31
|
+
- Adds `tailwindcss@^3`, `daisyui@^4`, `postcss`, `autoprefixer` to `devDependencies`
|
|
32
|
+
- Scaffolds a plain `tailwind.config.js` (daisyUI plugin, your `src/**` as content) and `postcss.config.js`
|
|
33
|
+
- Ensures `styles.css` contains `@import "@hakistack/ng-daisyui/styles-v4.css"` plus the classic `@tailwind base/components/utilities` directives
|
|
34
|
+
- Note: the package's peer ranges target Tailwind 4 / daisyUI 5, so npm reports a peer warning (or ERESOLVE with strict peer deps) on the legacy path
|
|
35
|
+
|
|
36
|
+
Flags: `--target <v5|v4-legacy>`, `--skip-install`, `--skip-style-import`, `--project <name>`.
|
|
37
|
+
|
|
38
|
+
### Manual install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install @hakistack/ng-daisyui
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Tailwind and DaisyUI are set up at the consumer level; `@angular/cdk` and `@angular/aria` share Angular's injector and must be installed alongside the library:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install tailwindcss@^4.0.0 daisyui@^5.0.0 @angular/cdk @angular/aria
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Runtime deps used internally (`@lucide/angular`, `fuse.js`, `motion`, `libphonenumber-js`) are installed automatically with the library.
|
|
51
|
+
|
|
52
|
+
### Configure Tailwind CSS
|
|
53
|
+
|
|
54
|
+
Add the library import to your `styles.css`:
|
|
55
|
+
|
|
56
|
+
```css
|
|
57
|
+
@import 'tailwindcss';
|
|
58
|
+
@plugin 'daisyui';
|
|
59
|
+
@import "@hakistack/ng-daisyui";
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This single import provides all required CSS class safelists and component styles.
|
|
63
|
+
|
|
64
|
+
## Components
|
|
65
|
+
|
|
66
|
+
### DynamicFormComponent
|
|
67
|
+
|
|
68
|
+
Dynamic form builder with wizard/stepper support, auto-save, and conditional logic.
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { DynamicFormComponent, createForm, field } from '@hakistack/ng-daisyui';
|
|
72
|
+
|
|
73
|
+
@Component({
|
|
74
|
+
imports: [DynamicFormComponent],
|
|
75
|
+
template: `
|
|
76
|
+
<hk-dynamic-form [config]="form.config()" />
|
|
77
|
+
<button (click)="form.submit()" class="btn btn-primary">Submit</button>
|
|
78
|
+
<button (click)="form.reset()" class="btn">Reset</button>
|
|
79
|
+
`
|
|
80
|
+
})
|
|
81
|
+
export class MyComponent {
|
|
82
|
+
readonly form = createForm({
|
|
83
|
+
title: 'User Registration',
|
|
84
|
+
fields: [
|
|
85
|
+
field.text('firstName', 'First Name', { required: true }),
|
|
86
|
+
field.email('email', 'Email', { required: true }),
|
|
87
|
+
field.password('password', 'Password', { minLength: 8 }),
|
|
88
|
+
field.select('country', 'Country', { choices: ['USA', 'Canada', 'Mexico'] }),
|
|
89
|
+
],
|
|
90
|
+
onSubmit: (data) => this.handleSubmit(data),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Layout Options
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// Vertical (default) - fields stacked
|
|
99
|
+
createForm({
|
|
100
|
+
layout: 'vertical',
|
|
101
|
+
gap: 'md', // 'sm' | 'md' | 'lg'
|
|
102
|
+
fields: [...]
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Horizontal - label beside input
|
|
106
|
+
createForm({
|
|
107
|
+
layout: 'horizontal',
|
|
108
|
+
labelWidth: 'md', // 'sm' | 'md' | 'lg' | 'xl'
|
|
109
|
+
fields: [...]
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Grid - responsive columns
|
|
113
|
+
createForm({
|
|
114
|
+
layout: 'grid',
|
|
115
|
+
gridColumns: 3,
|
|
116
|
+
fields: [
|
|
117
|
+
field.text('name', 'Name', { colSpan: 2 }), // Span 2 columns
|
|
118
|
+
field.text('code', 'Code'), // Span 1 column
|
|
119
|
+
// Responsive colSpan
|
|
120
|
+
field.text('address', 'Address', { colSpan: { default: 12, md: 6, lg: 4 } }),
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Field widths for non-grid layouts
|
|
125
|
+
createForm({
|
|
126
|
+
layout: 'vertical',
|
|
127
|
+
fields: [
|
|
128
|
+
field.text('name', 'Name', { width: 'full' }),
|
|
129
|
+
field.text('city', 'City', { width: '1/2' }),
|
|
130
|
+
field.text('state', 'State', { width: '1/4' }),
|
|
131
|
+
field.text('zip', 'ZIP', { width: '1/4' }),
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### TableComponent
|
|
137
|
+
|
|
138
|
+
Advanced data table with sorting, filtering, pagination, and column visibility.
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { TableComponent, createTable } from '@hakistack/ng-daisyui';
|
|
142
|
+
|
|
143
|
+
@Component({
|
|
144
|
+
imports: [TableComponent],
|
|
145
|
+
template: `<hk-table [data]="users()" [config]="tableConfig" />`
|
|
146
|
+
})
|
|
147
|
+
export class MyComponent {
|
|
148
|
+
readonly tableConfig = createTable<User>({
|
|
149
|
+
visible: ['name', 'email', 'role'],
|
|
150
|
+
formatters: {
|
|
151
|
+
createdAt: ['date', { format: 'short' }],
|
|
152
|
+
},
|
|
153
|
+
hasActions: true,
|
|
154
|
+
actions: [
|
|
155
|
+
{ type: 'edit', label: 'Edit', action: (row) => this.edit(row) },
|
|
156
|
+
{ type: 'delete', label: 'Delete', action: (row) => this.delete(row) },
|
|
157
|
+
],
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### SelectComponent
|
|
163
|
+
|
|
164
|
+
Enhanced select dropdown with search and virtual scrolling.
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
import { SelectComponent } from '@hakistack/ng-daisyui';
|
|
168
|
+
|
|
169
|
+
@Component({
|
|
170
|
+
imports: [SelectComponent],
|
|
171
|
+
template: `
|
|
172
|
+
<hk-select
|
|
173
|
+
[options]="countries"
|
|
174
|
+
[enableSearch]="true"
|
|
175
|
+
placeholder="Select country"
|
|
176
|
+
(selectionChange)="onSelect($event)"
|
|
177
|
+
/>
|
|
178
|
+
`
|
|
179
|
+
})
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### DatepickerComponent
|
|
183
|
+
|
|
184
|
+
Date and date range picker with keyboard navigation.
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { DatepickerComponent } from '@hakistack/ng-daisyui';
|
|
188
|
+
|
|
189
|
+
@Component({
|
|
190
|
+
imports: [DatepickerComponent],
|
|
191
|
+
template: `
|
|
192
|
+
<hk-datepicker
|
|
193
|
+
[range]="true"
|
|
194
|
+
placeholder="Select dates"
|
|
195
|
+
(selectionChange)="onDateChange($event)"
|
|
196
|
+
/>
|
|
197
|
+
`
|
|
198
|
+
})
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### StepperComponent
|
|
202
|
+
|
|
203
|
+
Multi-step wizard navigation (extends CDK Stepper).
|
|
204
|
+
|
|
205
|
+
### TabGroupComponent / TabPanelComponent
|
|
206
|
+
|
|
207
|
+
Accessible tab navigation with icons.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { TabGroupComponent, TabPanelComponent } from '@hakistack/ng-daisyui';
|
|
211
|
+
|
|
212
|
+
@Component({
|
|
213
|
+
imports: [TabGroupComponent, TabPanelComponent],
|
|
214
|
+
template: `
|
|
215
|
+
<hk-tab-group [(selectedTab)]="activeTab">
|
|
216
|
+
<hk-tab-panel value="details" label="Details" icon="FileText">
|
|
217
|
+
<ng-template>Details content</ng-template>
|
|
218
|
+
</hk-tab-panel>
|
|
219
|
+
<hk-tab-panel value="settings" label="Settings" icon="Settings">
|
|
220
|
+
<ng-template>Settings content</ng-template>
|
|
221
|
+
</hk-tab-panel>
|
|
222
|
+
</hk-tab-group>
|
|
223
|
+
`
|
|
224
|
+
})
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### ToastService
|
|
228
|
+
|
|
229
|
+
Toast notifications with stacking and progress bars.
|
|
230
|
+
|
|
231
|
+
**Setup** - Add `provideToast()` to your app config:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
// app.config.ts
|
|
235
|
+
import { provideToast } from '@hakistack/ng-daisyui';
|
|
236
|
+
|
|
237
|
+
export const appConfig: ApplicationConfig = {
|
|
238
|
+
providers: [
|
|
239
|
+
provideToast(),
|
|
240
|
+
// or with custom config:
|
|
241
|
+
provideToast({ position: 'top-end', maxToasts: 3 }),
|
|
242
|
+
],
|
|
243
|
+
};
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**Usage:**
|
|
247
|
+
|
|
248
|
+
```typescript
|
|
249
|
+
import { ToastService } from '@hakistack/ng-daisyui';
|
|
250
|
+
|
|
251
|
+
@Component({...})
|
|
252
|
+
export class MyComponent {
|
|
253
|
+
private toastService = inject(ToastService);
|
|
254
|
+
|
|
255
|
+
showSuccess() {
|
|
256
|
+
this.toastService.success('Saved!', 'Your changes have been saved.');
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
showError() {
|
|
260
|
+
this.toastService.error('Error', 'Something went wrong.');
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### DialogService
|
|
266
|
+
|
|
267
|
+
CDK-based modal dialogs with DaisyUI styling and animations.
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
import { DialogService } from '@hakistack/ng-daisyui';
|
|
271
|
+
|
|
272
|
+
@Component({...})
|
|
273
|
+
export class MyComponent {
|
|
274
|
+
private dialogService = inject(DialogService);
|
|
275
|
+
|
|
276
|
+
openDialog() {
|
|
277
|
+
// Open with wrapper (card + animation)
|
|
278
|
+
const ref = this.dialogService.open(MyDialogComponent, {
|
|
279
|
+
data: { userId: 123 },
|
|
280
|
+
disableClose: true,
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
ref.closed.subscribe(result => {
|
|
284
|
+
console.log('Dialog closed with:', result);
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
openRawDialog() {
|
|
289
|
+
// Open without wrapper (full control)
|
|
290
|
+
const ref = this.dialogService.openRaw(MyCustomComponent, {
|
|
291
|
+
data: { mode: 'edit' },
|
|
292
|
+
width: '600px',
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**In your dialog component:**
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
|
|
302
|
+
|
|
303
|
+
@Component({...})
|
|
304
|
+
export class MyDialogComponent {
|
|
305
|
+
private data = inject(DIALOG_DATA);
|
|
306
|
+
private dialogRef = inject(DialogRef);
|
|
307
|
+
|
|
308
|
+
close(result?: any) {
|
|
309
|
+
this.dialogRef.close(result);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Lucide Icons
|
|
315
|
+
|
|
316
|
+
Uses `@lucide/angular` v1.7+ directly. Import per-icon directives for static usage, or `LucideDynamicIcon` for runtime icon selection.
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
import { LucideUser, LucideSettings, LucideDynamicIcon } from '@lucide/angular';
|
|
320
|
+
|
|
321
|
+
@Component({
|
|
322
|
+
imports: [LucideUser, LucideSettings, LucideDynamicIcon],
|
|
323
|
+
template: `
|
|
324
|
+
<svg lucideUser [size]="24"></svg>
|
|
325
|
+
<svg lucideSettings color="red"></svg>
|
|
326
|
+
<svg [lucideIcon]="iconName()" [size]="20"></svg>
|
|
327
|
+
`,
|
|
328
|
+
})
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
For string-name lookup, register icons in your app config:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
import { provideLucideIcons, provideLucideConfig, LucideUser } from '@lucide/angular';
|
|
335
|
+
|
|
336
|
+
export const appConfig: ApplicationConfig = {
|
|
337
|
+
providers: [
|
|
338
|
+
provideLucideIcons(LucideUser /* , ... */),
|
|
339
|
+
provideLucideConfig({ size: 20, strokeWidth: 1.75 }),
|
|
340
|
+
],
|
|
341
|
+
};
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Services
|
|
345
|
+
|
|
346
|
+
- **FormStateService** - Auto-save form state management
|
|
347
|
+
- **PipeRegistryService** - Custom pipe registry for table formatters
|
|
348
|
+
- **DialogService** - CDK-based modal dialogs
|
|
349
|
+
- **ToastService** - Toast notifications
|
|
350
|
+
|
|
351
|
+
## Directives
|
|
352
|
+
|
|
353
|
+
- **AutoFocusDirective** - Auto-focus input elements
|
|
354
|
+
- **MotionAnimateDirective** - Motion.js animation wrapper
|
|
355
|
+
- **MotionHoverDirective** - Hover animations
|
|
356
|
+
- **MotionScrollDirective** - Scroll-triggered animations
|
|
357
|
+
|
|
358
|
+
## Building
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
npm run build
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Local development (npm link)
|
|
365
|
+
|
|
366
|
+
```bash
|
|
367
|
+
# In the library workspace
|
|
368
|
+
npm run build
|
|
369
|
+
npm run link:ui
|
|
370
|
+
|
|
371
|
+
# In your consuming project
|
|
372
|
+
npm link @hakistack/ng-daisyui
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## License
|
|
376
|
+
|
|
377
|
+
MIT — see [LICENSE](./LICENSE).
|