ngx-com 0.0.3 → 0.0.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/fesm2022/ngx-com-components-avatar.mjs +772 -0
- package/fesm2022/ngx-com-components-avatar.mjs.map +1 -0
- package/fesm2022/ngx-com-components-confirm.mjs +562 -0
- package/fesm2022/ngx-com-components-confirm.mjs.map +1 -0
- package/fesm2022/ngx-com-components-dropdown.mjs +119 -25
- package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-com-components-empty-state.mjs +382 -0
- package/fesm2022/ngx-com-components-empty-state.mjs.map +1 -0
- package/fesm2022/ngx-com-components-form-field.mjs +16 -15
- package/fesm2022/ngx-com-components-form-field.mjs.map +1 -1
- package/fesm2022/ngx-com-components-item.mjs +578 -0
- package/fesm2022/ngx-com-components-item.mjs.map +1 -0
- package/fesm2022/ngx-com-components-paginator.mjs +823 -0
- package/fesm2022/ngx-com-components-paginator.mjs.map +1 -0
- package/fesm2022/ngx-com-components-segmented-control.mjs +538 -0
- package/fesm2022/ngx-com-components-segmented-control.mjs.map +1 -0
- package/fesm2022/ngx-com-components-spinner.mjs +189 -0
- package/fesm2022/ngx-com-components-spinner.mjs.map +1 -0
- package/fesm2022/ngx-com-components-tooltip.mjs +625 -0
- package/fesm2022/ngx-com-components-tooltip.mjs.map +1 -0
- package/package.json +33 -1
- package/types/ngx-com-components-avatar.d.ts +409 -0
- package/types/ngx-com-components-confirm.d.ts +160 -0
- package/types/ngx-com-components-dropdown.d.ts +52 -28
- package/types/ngx-com-components-empty-state.d.ts +269 -0
- package/types/ngx-com-components-item.d.ts +336 -0
- package/types/ngx-com-components-paginator.d.ts +265 -0
- package/types/ngx-com-components-segmented-control.d.ts +274 -0
- package/types/ngx-com-components-spinner.d.ts +120 -0
- package/types/ngx-com-components-tooltip.d.ts +200 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, computed, ViewEncapsulation, ChangeDetectionStrategy, Component, inject, Directive } from '@angular/core';
|
|
3
|
+
import { mergeClasses } from 'ngx-com/utils';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* CVA variants for the empty state container.
|
|
8
|
+
*
|
|
9
|
+
* @tokens `--color-foreground`, `--color-muted`, `--color-muted-foreground`
|
|
10
|
+
*/
|
|
11
|
+
const emptyStateVariants = cva('flex', {
|
|
12
|
+
variants: {
|
|
13
|
+
orientation: {
|
|
14
|
+
vertical: 'flex-col',
|
|
15
|
+
horizontal: 'flex-row',
|
|
16
|
+
},
|
|
17
|
+
align: {
|
|
18
|
+
center: 'items-center text-center',
|
|
19
|
+
start: 'items-start text-left',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
sm: 'gap-2 py-4',
|
|
23
|
+
md: 'gap-3 py-6',
|
|
24
|
+
lg: 'gap-4 py-10',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
compoundVariants: [
|
|
28
|
+
{ orientation: 'horizontal', align: 'center', class: 'justify-center' },
|
|
29
|
+
{ orientation: 'horizontal', align: 'start', class: 'justify-start' },
|
|
30
|
+
],
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
size: 'md',
|
|
33
|
+
align: 'center',
|
|
34
|
+
orientation: 'vertical',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* CVA variants for the empty state icon container.
|
|
39
|
+
*
|
|
40
|
+
* @tokens `--color-muted`, `--color-muted-foreground`
|
|
41
|
+
*/
|
|
42
|
+
const emptyStateIconVariants = cva('flex items-center justify-center shrink-0 bg-muted text-muted-foreground', {
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
sm: 'size-10 rounded-lg',
|
|
46
|
+
md: 'size-14 rounded-xl',
|
|
47
|
+
lg: 'size-20 rounded-2xl',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
size: 'md',
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* CVA variants for the empty state title.
|
|
56
|
+
*
|
|
57
|
+
* @tokens `--color-foreground`
|
|
58
|
+
*/
|
|
59
|
+
const emptyStateTitleVariants = cva('font-heading tracking-tight text-foreground', {
|
|
60
|
+
variants: {
|
|
61
|
+
size: {
|
|
62
|
+
sm: 'text-sm font-medium',
|
|
63
|
+
md: 'text-base font-semibold',
|
|
64
|
+
lg: 'text-lg font-semibold',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
size: 'md',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* CVA variants for the empty state description.
|
|
73
|
+
*
|
|
74
|
+
* @tokens `--color-muted-foreground`
|
|
75
|
+
*/
|
|
76
|
+
const emptyStateDescriptionVariants = cva('text-muted-foreground', {
|
|
77
|
+
variants: {
|
|
78
|
+
size: {
|
|
79
|
+
sm: 'text-xs max-w-[200px]',
|
|
80
|
+
md: 'text-sm max-w-xs',
|
|
81
|
+
lg: 'text-base max-w-sm',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
size: 'md',
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
/**
|
|
89
|
+
* CVA variants for the empty state actions container.
|
|
90
|
+
*/
|
|
91
|
+
const emptyStateActionsVariants = cva('flex flex-wrap items-center justify-center', {
|
|
92
|
+
variants: {
|
|
93
|
+
size: {
|
|
94
|
+
sm: 'gap-2 pt-1',
|
|
95
|
+
md: 'gap-2.5 pt-2',
|
|
96
|
+
lg: 'gap-3 pt-3',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
defaultVariants: {
|
|
100
|
+
size: 'md',
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Empty state component - a placeholder surface for when there is no data to display.
|
|
106
|
+
*
|
|
107
|
+
* Common use cases include:
|
|
108
|
+
* - Empty lists or tables ("No results found")
|
|
109
|
+
* - Initial states before user action ("Create your first project")
|
|
110
|
+
* - Search results with no matches ("No items match your search")
|
|
111
|
+
* - Error recovery states ("Something went wrong. Try again.")
|
|
112
|
+
*
|
|
113
|
+
* The component is a pure layout container that accepts projected content through attribute directives.
|
|
114
|
+
*
|
|
115
|
+
* @tokens `--color-muted`, `--color-muted-foreground`, `--color-foreground`
|
|
116
|
+
*
|
|
117
|
+
* @example Minimal empty state
|
|
118
|
+
* ```html
|
|
119
|
+
* <com-empty-state>
|
|
120
|
+
* <div comEmptyStateIcon>
|
|
121
|
+
* <com-icon name="inbox" size="xl" />
|
|
122
|
+
* </div>
|
|
123
|
+
* <h3 comEmptyStateTitle>No messages</h3>
|
|
124
|
+
* </com-empty-state>
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @example Full empty state with description and action
|
|
128
|
+
* ```html
|
|
129
|
+
* <com-empty-state>
|
|
130
|
+
* <div comEmptyStateIcon>
|
|
131
|
+
* <com-icon name="folder-open" size="xl" />
|
|
132
|
+
* </div>
|
|
133
|
+
* <h3 comEmptyStateTitle>No projects yet</h3>
|
|
134
|
+
* <p comEmptyStateDescription>
|
|
135
|
+
* Create your first project to get started organizing your work.
|
|
136
|
+
* </p>
|
|
137
|
+
* <div comEmptyStateActions>
|
|
138
|
+
* <button comButton>Create Project</button>
|
|
139
|
+
* </div>
|
|
140
|
+
* </com-empty-state>
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @example Search empty state with secondary action
|
|
144
|
+
* ```html
|
|
145
|
+
* <com-empty-state>
|
|
146
|
+
* <div comEmptyStateIcon>
|
|
147
|
+
* <com-icon name="search-x" size="xl" />
|
|
148
|
+
* </div>
|
|
149
|
+
* <h3 comEmptyStateTitle>No results found</h3>
|
|
150
|
+
* <p comEmptyStateDescription>
|
|
151
|
+
* Try adjusting your search terms or filters.
|
|
152
|
+
* </p>
|
|
153
|
+
* <div comEmptyStateActions>
|
|
154
|
+
* <button comButton variant="outline">Clear Filters</button>
|
|
155
|
+
* <button comButton>New Search</button>
|
|
156
|
+
* </div>
|
|
157
|
+
* </com-empty-state>
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @example Small size for inline contexts
|
|
161
|
+
* ```html
|
|
162
|
+
* <com-empty-state size="sm">
|
|
163
|
+
* <div comEmptyStateIcon>
|
|
164
|
+
* <com-icon name="list" size="lg" />
|
|
165
|
+
* </div>
|
|
166
|
+
* <h4 comEmptyStateTitle>No items</h4>
|
|
167
|
+
* </com-empty-state>
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @example Large size for full-page empty states
|
|
171
|
+
* ```html
|
|
172
|
+
* <com-empty-state size="lg">
|
|
173
|
+
* <div comEmptyStateIcon>
|
|
174
|
+
* <com-icon name="rocket" size="2xl" />
|
|
175
|
+
* </div>
|
|
176
|
+
* <h2 comEmptyStateTitle>Welcome to Acme</h2>
|
|
177
|
+
* <p comEmptyStateDescription>
|
|
178
|
+
* Your dashboard is ready. Start by creating your first resource.
|
|
179
|
+
* </p>
|
|
180
|
+
* <div comEmptyStateActions>
|
|
181
|
+
* <button comButton size="lg">Get Started</button>
|
|
182
|
+
* </div>
|
|
183
|
+
* </com-empty-state>
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @example Horizontal orientation
|
|
187
|
+
* ```html
|
|
188
|
+
* <com-empty-state orientation="horizontal" align="start">
|
|
189
|
+
* <div comEmptyStateIcon>
|
|
190
|
+
* <com-icon name="alert-circle" size="lg" />
|
|
191
|
+
* </div>
|
|
192
|
+
* <h4 comEmptyStateTitle>No notifications</h4>
|
|
193
|
+
* <p comEmptyStateDescription>You're all caught up!</p>
|
|
194
|
+
* </com-empty-state>
|
|
195
|
+
* ```
|
|
196
|
+
*
|
|
197
|
+
* @example Left-aligned for sidebar contexts
|
|
198
|
+
* ```html
|
|
199
|
+
* <com-empty-state align="start">
|
|
200
|
+
* <div comEmptyStateIcon>
|
|
201
|
+
* <com-icon name="users" size="lg" />
|
|
202
|
+
* </div>
|
|
203
|
+
* <h4 comEmptyStateTitle>No team members</h4>
|
|
204
|
+
* <p comEmptyStateDescription>Invite people to collaborate.</p>
|
|
205
|
+
* <div comEmptyStateActions>
|
|
206
|
+
* <button comButton size="sm">Invite</button>
|
|
207
|
+
* </div>
|
|
208
|
+
* </com-empty-state>
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
class ComEmptyState {
|
|
212
|
+
/** Controls overall scale: icon container size, text sizes, spacing. */
|
|
213
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
214
|
+
/** Horizontal alignment of content. */
|
|
215
|
+
align = input('center', ...(ngDevMode ? [{ debugName: "align" }] : []));
|
|
216
|
+
/** Layout direction: vertical stacks content, horizontal places icon beside text. */
|
|
217
|
+
orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : []));
|
|
218
|
+
/** Consumer CSS classes - merged with variant classes. */
|
|
219
|
+
userClass = input('', { ...(ngDevMode ? { debugName: "userClass" } : {}), alias: 'class' });
|
|
220
|
+
computedClass = computed(() => mergeClasses(emptyStateVariants({
|
|
221
|
+
size: this.size(),
|
|
222
|
+
align: this.align(),
|
|
223
|
+
orientation: this.orientation(),
|
|
224
|
+
}), this.userClass()), ...(ngDevMode ? [{ debugName: "computedClass" }] : []));
|
|
225
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyState, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
226
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.0", type: ComEmptyState, isStandalone: true, selector: "com-empty-state", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "computedClass()" } }, exportAs: ["comEmptyState"], ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
227
|
+
}
|
|
228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyState, decorators: [{
|
|
229
|
+
type: Component,
|
|
230
|
+
args: [{
|
|
231
|
+
selector: 'com-empty-state',
|
|
232
|
+
exportAs: 'comEmptyState',
|
|
233
|
+
template: `<ng-content />`,
|
|
234
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
235
|
+
encapsulation: ViewEncapsulation.None,
|
|
236
|
+
host: {
|
|
237
|
+
'[class]': 'computedClass()',
|
|
238
|
+
},
|
|
239
|
+
}]
|
|
240
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Empty state icon container directive - styled circular background for icon/illustration.
|
|
244
|
+
*
|
|
245
|
+
* Apply to a container element. Place any content inside (typically `com-icon`).
|
|
246
|
+
* Styling automatically adapts to the parent's `size` input.
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```html
|
|
250
|
+
* <div comEmptyStateIcon>
|
|
251
|
+
* <com-icon name="inbox" size="xl" />
|
|
252
|
+
* </div>
|
|
253
|
+
* ```
|
|
254
|
+
*
|
|
255
|
+
* @example With custom illustration
|
|
256
|
+
* ```html
|
|
257
|
+
* <div comEmptyStateIcon>
|
|
258
|
+
* <img src="/assets/empty-mailbox.svg" alt="" class="size-8" />
|
|
259
|
+
* </div>
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
262
|
+
* @tokens `--color-muted`, `--color-muted-foreground`
|
|
263
|
+
*/
|
|
264
|
+
class ComEmptyStateIcon {
|
|
265
|
+
emptyState = inject(ComEmptyState);
|
|
266
|
+
computedClass = computed(() => emptyStateIconVariants({ size: this.emptyState.size() }), ...(ngDevMode ? [{ debugName: "computedClass" }] : []));
|
|
267
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateIcon, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
268
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: ComEmptyStateIcon, isStandalone: true, selector: "[comEmptyStateIcon]", host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
269
|
+
}
|
|
270
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateIcon, decorators: [{
|
|
271
|
+
type: Directive,
|
|
272
|
+
args: [{
|
|
273
|
+
selector: '[comEmptyStateIcon]',
|
|
274
|
+
host: {
|
|
275
|
+
'[class]': 'computedClass()',
|
|
276
|
+
},
|
|
277
|
+
}]
|
|
278
|
+
}] });
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Empty state title directive - styled heading text.
|
|
282
|
+
*
|
|
283
|
+
* Apply to any heading element. Consumer picks the semantic level (h2, h3, etc.).
|
|
284
|
+
* Styling automatically adapts to the parent's `size` input.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```html
|
|
288
|
+
* <h3 comEmptyStateTitle>No projects yet</h3>
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* @tokens `--color-foreground`
|
|
292
|
+
*/
|
|
293
|
+
class ComEmptyStateTitle {
|
|
294
|
+
emptyState = inject(ComEmptyState);
|
|
295
|
+
computedClass = computed(() => emptyStateTitleVariants({ size: this.emptyState.size() }), ...(ngDevMode ? [{ debugName: "computedClass" }] : []));
|
|
296
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
297
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: ComEmptyStateTitle, isStandalone: true, selector: "[comEmptyStateTitle]", host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
298
|
+
}
|
|
299
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateTitle, decorators: [{
|
|
300
|
+
type: Directive,
|
|
301
|
+
args: [{
|
|
302
|
+
selector: '[comEmptyStateTitle]',
|
|
303
|
+
host: {
|
|
304
|
+
'[class]': 'computedClass()',
|
|
305
|
+
},
|
|
306
|
+
}]
|
|
307
|
+
}] });
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Empty state description directive - supporting text.
|
|
311
|
+
*
|
|
312
|
+
* Apply to a paragraph or text element.
|
|
313
|
+
* Styling automatically adapts to the parent's `size` input.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```html
|
|
317
|
+
* <p comEmptyStateDescription>
|
|
318
|
+
* Create your first project to get started organizing your work.
|
|
319
|
+
* </p>
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* @tokens `--color-muted-foreground`
|
|
323
|
+
*/
|
|
324
|
+
class ComEmptyStateDescription {
|
|
325
|
+
emptyState = inject(ComEmptyState);
|
|
326
|
+
computedClass = computed(() => emptyStateDescriptionVariants({ size: this.emptyState.size() }), ...(ngDevMode ? [{ debugName: "computedClass" }] : []));
|
|
327
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
328
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: ComEmptyStateDescription, isStandalone: true, selector: "[comEmptyStateDescription]", host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
329
|
+
}
|
|
330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateDescription, decorators: [{
|
|
331
|
+
type: Directive,
|
|
332
|
+
args: [{
|
|
333
|
+
selector: '[comEmptyStateDescription]',
|
|
334
|
+
host: {
|
|
335
|
+
'[class]': 'computedClass()',
|
|
336
|
+
},
|
|
337
|
+
}]
|
|
338
|
+
}] });
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Empty state actions directive - container for action buttons.
|
|
342
|
+
*
|
|
343
|
+
* Apply to a container element. Place buttons inside.
|
|
344
|
+
* Styling automatically adapts to the parent's `size` input.
|
|
345
|
+
*
|
|
346
|
+
* @example Single action
|
|
347
|
+
* ```html
|
|
348
|
+
* <div comEmptyStateActions>
|
|
349
|
+
* <button comButton>Create Project</button>
|
|
350
|
+
* </div>
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* @example Multiple actions
|
|
354
|
+
* ```html
|
|
355
|
+
* <div comEmptyStateActions>
|
|
356
|
+
* <button comButton variant="outline">Clear Filters</button>
|
|
357
|
+
* <button comButton>New Search</button>
|
|
358
|
+
* </div>
|
|
359
|
+
* ```
|
|
360
|
+
*/
|
|
361
|
+
class ComEmptyStateActions {
|
|
362
|
+
emptyState = inject(ComEmptyState);
|
|
363
|
+
computedClass = computed(() => emptyStateActionsVariants({ size: this.emptyState.size() }), ...(ngDevMode ? [{ debugName: "computedClass" }] : []));
|
|
364
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateActions, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
365
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.0", type: ComEmptyStateActions, isStandalone: true, selector: "[comEmptyStateActions]", host: { properties: { "class": "computedClass()" } }, ngImport: i0 });
|
|
366
|
+
}
|
|
367
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComEmptyStateActions, decorators: [{
|
|
368
|
+
type: Directive,
|
|
369
|
+
args: [{
|
|
370
|
+
selector: '[comEmptyStateActions]',
|
|
371
|
+
host: {
|
|
372
|
+
'[class]': 'computedClass()',
|
|
373
|
+
},
|
|
374
|
+
}]
|
|
375
|
+
}] });
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Generated bundle index. Do not edit.
|
|
379
|
+
*/
|
|
380
|
+
|
|
381
|
+
export { ComEmptyState, ComEmptyStateActions, ComEmptyStateDescription, ComEmptyStateIcon, ComEmptyStateTitle, emptyStateActionsVariants, emptyStateDescriptionVariants, emptyStateIconVariants, emptyStateTitleVariants, emptyStateVariants };
|
|
382
|
+
//# sourceMappingURL=ngx-com-components-empty-state.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-com-components-empty-state.mjs","sources":["../../../projects/com/components/empty-state/empty-state.variants.ts","../../../projects/com/components/empty-state/empty-state.component.ts","../../../projects/com/components/empty-state/empty-state-icon.directive.ts","../../../projects/com/components/empty-state/empty-state-title.directive.ts","../../../projects/com/components/empty-state/empty-state-description.directive.ts","../../../projects/com/components/empty-state/empty-state-actions.directive.ts","../../../projects/com/components/empty-state/ngx-com-components-empty-state.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport type EmptyStateSize = 'sm' | 'md' | 'lg';\nexport type EmptyStateAlign = 'start' | 'center';\nexport type EmptyStateOrientation = 'vertical' | 'horizontal';\n\n/**\n * CVA variants for the empty state container.\n *\n * @tokens `--color-foreground`, `--color-muted`, `--color-muted-foreground`\n */\nexport const emptyStateVariants: (props?: {\n size?: EmptyStateSize;\n align?: EmptyStateAlign;\n orientation?: EmptyStateOrientation;\n}) => string = cva('flex', {\n variants: {\n orientation: {\n vertical: 'flex-col',\n horizontal: 'flex-row',\n },\n align: {\n center: 'items-center text-center',\n start: 'items-start text-left',\n },\n size: {\n sm: 'gap-2 py-4',\n md: 'gap-3 py-6',\n lg: 'gap-4 py-10',\n },\n },\n compoundVariants: [\n { orientation: 'horizontal', align: 'center', class: 'justify-center' },\n { orientation: 'horizontal', align: 'start', class: 'justify-start' },\n ],\n defaultVariants: {\n size: 'md',\n align: 'center',\n orientation: 'vertical',\n },\n});\n\n/**\n * CVA variants for the empty state icon container.\n *\n * @tokens `--color-muted`, `--color-muted-foreground`\n */\nexport const emptyStateIconVariants: (props?: { size?: EmptyStateSize }) => string = cva(\n 'flex items-center justify-center shrink-0 bg-muted text-muted-foreground',\n {\n variants: {\n size: {\n sm: 'size-10 rounded-lg',\n md: 'size-14 rounded-xl',\n lg: 'size-20 rounded-2xl',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\n/**\n * CVA variants for the empty state title.\n *\n * @tokens `--color-foreground`\n */\nexport const emptyStateTitleVariants: (props?: { size?: EmptyStateSize }) => string = cva(\n 'font-heading tracking-tight text-foreground',\n {\n variants: {\n size: {\n sm: 'text-sm font-medium',\n md: 'text-base font-semibold',\n lg: 'text-lg font-semibold',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\n/**\n * CVA variants for the empty state description.\n *\n * @tokens `--color-muted-foreground`\n */\nexport const emptyStateDescriptionVariants: (props?: { size?: EmptyStateSize }) => string = cva(\n 'text-muted-foreground',\n {\n variants: {\n size: {\n sm: 'text-xs max-w-[200px]',\n md: 'text-sm max-w-xs',\n lg: 'text-base max-w-sm',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n\n/**\n * CVA variants for the empty state actions container.\n */\nexport const emptyStateActionsVariants: (props?: { size?: EmptyStateSize }) => string = cva(\n 'flex flex-wrap items-center justify-center',\n {\n variants: {\n size: {\n sm: 'gap-2 pt-1',\n md: 'gap-2.5 pt-2',\n lg: 'gap-3 pt-3',\n },\n },\n defaultVariants: {\n size: 'md',\n },\n }\n);\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n ViewEncapsulation,\n} from '@angular/core';\nimport type { InputSignal, Signal } from '@angular/core';\nimport { mergeClasses } from 'ngx-com/utils';\nimport { emptyStateVariants } from './empty-state.variants';\nimport type { EmptyStateSize, EmptyStateAlign, EmptyStateOrientation } from './empty-state.variants';\n\n/**\n * Empty state component - a placeholder surface for when there is no data to display.\n *\n * Common use cases include:\n * - Empty lists or tables (\"No results found\")\n * - Initial states before user action (\"Create your first project\")\n * - Search results with no matches (\"No items match your search\")\n * - Error recovery states (\"Something went wrong. Try again.\")\n *\n * The component is a pure layout container that accepts projected content through attribute directives.\n *\n * @tokens `--color-muted`, `--color-muted-foreground`, `--color-foreground`\n *\n * @example Minimal empty state\n * ```html\n * <com-empty-state>\n * <div comEmptyStateIcon>\n * <com-icon name=\"inbox\" size=\"xl\" />\n * </div>\n * <h3 comEmptyStateTitle>No messages</h3>\n * </com-empty-state>\n * ```\n *\n * @example Full empty state with description and action\n * ```html\n * <com-empty-state>\n * <div comEmptyStateIcon>\n * <com-icon name=\"folder-open\" size=\"xl\" />\n * </div>\n * <h3 comEmptyStateTitle>No projects yet</h3>\n * <p comEmptyStateDescription>\n * Create your first project to get started organizing your work.\n * </p>\n * <div comEmptyStateActions>\n * <button comButton>Create Project</button>\n * </div>\n * </com-empty-state>\n * ```\n *\n * @example Search empty state with secondary action\n * ```html\n * <com-empty-state>\n * <div comEmptyStateIcon>\n * <com-icon name=\"search-x\" size=\"xl\" />\n * </div>\n * <h3 comEmptyStateTitle>No results found</h3>\n * <p comEmptyStateDescription>\n * Try adjusting your search terms or filters.\n * </p>\n * <div comEmptyStateActions>\n * <button comButton variant=\"outline\">Clear Filters</button>\n * <button comButton>New Search</button>\n * </div>\n * </com-empty-state>\n * ```\n *\n * @example Small size for inline contexts\n * ```html\n * <com-empty-state size=\"sm\">\n * <div comEmptyStateIcon>\n * <com-icon name=\"list\" size=\"lg\" />\n * </div>\n * <h4 comEmptyStateTitle>No items</h4>\n * </com-empty-state>\n * ```\n *\n * @example Large size for full-page empty states\n * ```html\n * <com-empty-state size=\"lg\">\n * <div comEmptyStateIcon>\n * <com-icon name=\"rocket\" size=\"2xl\" />\n * </div>\n * <h2 comEmptyStateTitle>Welcome to Acme</h2>\n * <p comEmptyStateDescription>\n * Your dashboard is ready. Start by creating your first resource.\n * </p>\n * <div comEmptyStateActions>\n * <button comButton size=\"lg\">Get Started</button>\n * </div>\n * </com-empty-state>\n * ```\n *\n * @example Horizontal orientation\n * ```html\n * <com-empty-state orientation=\"horizontal\" align=\"start\">\n * <div comEmptyStateIcon>\n * <com-icon name=\"alert-circle\" size=\"lg\" />\n * </div>\n * <h4 comEmptyStateTitle>No notifications</h4>\n * <p comEmptyStateDescription>You're all caught up!</p>\n * </com-empty-state>\n * ```\n *\n * @example Left-aligned for sidebar contexts\n * ```html\n * <com-empty-state align=\"start\">\n * <div comEmptyStateIcon>\n * <com-icon name=\"users\" size=\"lg\" />\n * </div>\n * <h4 comEmptyStateTitle>No team members</h4>\n * <p comEmptyStateDescription>Invite people to collaborate.</p>\n * <div comEmptyStateActions>\n * <button comButton size=\"sm\">Invite</button>\n * </div>\n * </com-empty-state>\n * ```\n */\n@Component({\n selector: 'com-empty-state',\n exportAs: 'comEmptyState',\n template: `<ng-content />`,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'computedClass()',\n },\n})\nexport class ComEmptyState {\n /** Controls overall scale: icon container size, text sizes, spacing. */\n readonly size: InputSignal<EmptyStateSize> = input<EmptyStateSize>('md');\n\n /** Horizontal alignment of content. */\n readonly align: InputSignal<EmptyStateAlign> = input<EmptyStateAlign>('center');\n\n /** Layout direction: vertical stacks content, horizontal places icon beside text. */\n readonly orientation: InputSignal<EmptyStateOrientation> = input<EmptyStateOrientation>('vertical');\n\n /** Consumer CSS classes - merged with variant classes. */\n readonly userClass: InputSignal<string> = input<string>('', { alias: 'class' });\n\n protected readonly computedClass: Signal<string> = computed(() =>\n mergeClasses(\n emptyStateVariants({\n size: this.size(),\n align: this.align(),\n orientation: this.orientation(),\n }),\n this.userClass()\n )\n );\n}\n","import { computed, Directive, inject, type Signal } from '@angular/core';\nimport { ComEmptyState } from './empty-state.component';\nimport { emptyStateIconVariants } from './empty-state.variants';\n\n/**\n * Empty state icon container directive - styled circular background for icon/illustration.\n *\n * Apply to a container element. Place any content inside (typically `com-icon`).\n * Styling automatically adapts to the parent's `size` input.\n *\n * @example\n * ```html\n * <div comEmptyStateIcon>\n * <com-icon name=\"inbox\" size=\"xl\" />\n * </div>\n * ```\n *\n * @example With custom illustration\n * ```html\n * <div comEmptyStateIcon>\n * <img src=\"/assets/empty-mailbox.svg\" alt=\"\" class=\"size-8\" />\n * </div>\n * ```\n *\n * @tokens `--color-muted`, `--color-muted-foreground`\n */\n@Directive({\n selector: '[comEmptyStateIcon]',\n host: {\n '[class]': 'computedClass()',\n },\n})\nexport class ComEmptyStateIcon {\n private readonly emptyState = inject(ComEmptyState);\n\n protected readonly computedClass: Signal<string> = computed(() =>\n emptyStateIconVariants({ size: this.emptyState.size() })\n );\n}\n","import { computed, Directive, inject, type Signal } from '@angular/core';\nimport { ComEmptyState } from './empty-state.component';\nimport { emptyStateTitleVariants } from './empty-state.variants';\n\n/**\n * Empty state title directive - styled heading text.\n *\n * Apply to any heading element. Consumer picks the semantic level (h2, h3, etc.).\n * Styling automatically adapts to the parent's `size` input.\n *\n * @example\n * ```html\n * <h3 comEmptyStateTitle>No projects yet</h3>\n * ```\n *\n * @tokens `--color-foreground`\n */\n@Directive({\n selector: '[comEmptyStateTitle]',\n host: {\n '[class]': 'computedClass()',\n },\n})\nexport class ComEmptyStateTitle {\n private readonly emptyState = inject(ComEmptyState);\n\n protected readonly computedClass: Signal<string> = computed(() =>\n emptyStateTitleVariants({ size: this.emptyState.size() })\n );\n}\n","import { computed, Directive, inject, type Signal } from '@angular/core';\nimport { ComEmptyState } from './empty-state.component';\nimport { emptyStateDescriptionVariants } from './empty-state.variants';\n\n/**\n * Empty state description directive - supporting text.\n *\n * Apply to a paragraph or text element.\n * Styling automatically adapts to the parent's `size` input.\n *\n * @example\n * ```html\n * <p comEmptyStateDescription>\n * Create your first project to get started organizing your work.\n * </p>\n * ```\n *\n * @tokens `--color-muted-foreground`\n */\n@Directive({\n selector: '[comEmptyStateDescription]',\n host: {\n '[class]': 'computedClass()',\n },\n})\nexport class ComEmptyStateDescription {\n private readonly emptyState = inject(ComEmptyState);\n\n protected readonly computedClass: Signal<string> = computed(() =>\n emptyStateDescriptionVariants({ size: this.emptyState.size() })\n );\n}\n","import { computed, Directive, inject, type Signal } from '@angular/core';\nimport { ComEmptyState } from './empty-state.component';\nimport { emptyStateActionsVariants } from './empty-state.variants';\n\n/**\n * Empty state actions directive - container for action buttons.\n *\n * Apply to a container element. Place buttons inside.\n * Styling automatically adapts to the parent's `size` input.\n *\n * @example Single action\n * ```html\n * <div comEmptyStateActions>\n * <button comButton>Create Project</button>\n * </div>\n * ```\n *\n * @example Multiple actions\n * ```html\n * <div comEmptyStateActions>\n * <button comButton variant=\"outline\">Clear Filters</button>\n * <button comButton>New Search</button>\n * </div>\n * ```\n */\n@Directive({\n selector: '[comEmptyStateActions]',\n host: {\n '[class]': 'computedClass()',\n },\n})\nexport class ComEmptyStateActions {\n private readonly emptyState = inject(ComEmptyState);\n\n protected readonly computedClass: Signal<string> = computed(() =>\n emptyStateActionsVariants({ size: this.emptyState.size() })\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAMA;;;;AAIG;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AAwB;AAClC,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,iBAAiB;AAC7B,qBAAA;AACF,iBAAA;;;AC9BD;;AAEG;;;;"}
|
|
@@ -165,9 +165,9 @@ const formFieldLabelVariants = cva([
|
|
|
165
165
|
fill: '',
|
|
166
166
|
},
|
|
167
167
|
floating: {
|
|
168
|
-
// Floating: absolute positioning
|
|
168
|
+
// Floating: absolute positioning at container border
|
|
169
169
|
true: 'absolute',
|
|
170
|
-
// Not floating:
|
|
170
|
+
// Not floating: relative positioning in flex flow (after prefix)
|
|
171
171
|
false: 'relative flex-shrink-0 pl-3',
|
|
172
172
|
},
|
|
173
173
|
color: {
|
|
@@ -189,7 +189,7 @@ const formFieldLabelVariants = cva([
|
|
|
189
189
|
},
|
|
190
190
|
},
|
|
191
191
|
compoundVariants: [
|
|
192
|
-
// Outline floating (label above border)
|
|
192
|
+
// Outline floating (label above border with notch effect)
|
|
193
193
|
{
|
|
194
194
|
appearance: 'outline',
|
|
195
195
|
floating: true,
|
|
@@ -807,27 +807,28 @@ class ComFormField {
|
|
|
807
807
|
});
|
|
808
808
|
// Wire up aria-describedby on the control
|
|
809
809
|
effect(() => {
|
|
810
|
-
const
|
|
811
|
-
if (!
|
|
810
|
+
const ctrl = this.control();
|
|
811
|
+
if (!ctrl || !('setDescribedByIds' in ctrl))
|
|
812
812
|
return;
|
|
813
813
|
const ids = this.showErrors()
|
|
814
814
|
? this.errorChildren().filter((e) => e.shouldShow()).map((e) => e.id)
|
|
815
815
|
: this.hintChildren().map((h) => h.id);
|
|
816
|
-
|
|
816
|
+
ctrl.setDescribedByIds(ids.join(' '));
|
|
817
817
|
});
|
|
818
|
-
// Wire up appearance to
|
|
818
|
+
// Wire up appearance to control for proper styling
|
|
819
819
|
effect(() => {
|
|
820
|
-
const
|
|
821
|
-
if (
|
|
822
|
-
|
|
820
|
+
const ctrl = this.control();
|
|
821
|
+
if (ctrl && 'setAppearance' in ctrl) {
|
|
822
|
+
ctrl.setAppearance(this.appearance());
|
|
823
823
|
}
|
|
824
824
|
});
|
|
825
825
|
// Wire up control reference to error directives (re-runs on error state change)
|
|
826
826
|
effect(() => {
|
|
827
827
|
// Read hasError to trigger re-evaluation when validation state changes
|
|
828
828
|
this.hasError();
|
|
829
|
-
const
|
|
830
|
-
|
|
829
|
+
const ctrl = this.control();
|
|
830
|
+
const ngControl = ctrl?.ngControl?.control ?? null;
|
|
831
|
+
this.errorChildren().forEach((error) => error.setControl(ngControl));
|
|
831
832
|
});
|
|
832
833
|
}
|
|
833
834
|
onContainerClick(event) {
|
|
@@ -866,7 +867,7 @@ class ComFormField {
|
|
|
866
867
|
<ng-content select="[comHint][align='end']" />
|
|
867
868
|
</div>
|
|
868
869
|
</div>
|
|
869
|
-
`, isInline: true, styles: ["com-form-field.com-form-field--has-label:not(.com-form-field--floating) input::placeholder,com-form-field.com-form-field--has-label:not(.com-form-field--floating) textarea::placeholder{color:transparent}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
870
|
+
`, isInline: true, styles: ["com-form-field.com-form-field--has-label:not(.com-form-field--floating) input::placeholder,com-form-field.com-form-field--has-label:not(.com-form-field--floating) textarea::placeholder{color:transparent}com-form-field.com-form-field--has-label:not(.com-form-field--floating) com-dropdown .text-placeholder{display:none}com-form-field com-dropdown{display:block;width:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
870
871
|
}
|
|
871
872
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComFormField, decorators: [{
|
|
872
873
|
type: Component,
|
|
@@ -902,14 +903,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
902
903
|
<ng-content select="[comHint][align='end']" />
|
|
903
904
|
</div>
|
|
904
905
|
</div>
|
|
905
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None,
|
|
906
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
906
907
|
'[class]': 'hostClasses()',
|
|
907
908
|
'[class.com-form-field--focused]': 'isFocused()',
|
|
908
909
|
'[class.com-form-field--disabled]': 'isDisabled()',
|
|
909
910
|
'[class.com-form-field--error]': 'hasError()',
|
|
910
911
|
'[class.com-form-field--floating]': 'shouldLabelFloat()',
|
|
911
912
|
'[class.com-form-field--has-label]': '!!labelChild()',
|
|
912
|
-
}, styles: ["com-form-field.com-form-field--has-label:not(.com-form-field--floating) input::placeholder,com-form-field.com-form-field--has-label:not(.com-form-field--floating) textarea::placeholder{color:transparent}\n"] }]
|
|
913
|
+
}, styles: ["com-form-field.com-form-field--has-label:not(.com-form-field--floating) input::placeholder,com-form-field.com-form-field--has-label:not(.com-form-field--floating) textarea::placeholder{color:transparent}com-form-field.com-form-field--has-label:not(.com-form-field--floating) com-dropdown .text-placeholder{display:none}com-form-field com-dropdown{display:block;width:100%}\n"] }]
|
|
913
914
|
}], ctorParameters: () => [], propDecorators: { control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => FormFieldControl), { isSignal: true }] }], inputDirective: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ComInput), { isSignal: true }] }], labelChild: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ComLabel), { isSignal: true }] }], hintChildren: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ComHint), { isSignal: true }] }], errorChildren: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ComError), { isSignal: true }] }], prefixChild: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ComPrefix), { isSignal: true }] }], suffixChild: [{ type: i0.ContentChild, args: [i0.forwardRef(() => ComSuffix), { isSignal: true }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], floatLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatLabel", required: false }] }], hideRequiredMarker: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideRequiredMarker", required: false }] }], subscriptSizing: [{ type: i0.Input, args: [{ isSignal: true, alias: "subscriptSizing", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
914
915
|
|
|
915
916
|
// Public API for the form-field component
|