ngx-com 0.1.9 → 0.1.11
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-card.mjs +56 -29
- package/fesm2022/ngx-com-components-card.mjs.map +1 -1
- package/fesm2022/ngx-com-components-dialog.mjs +58 -15
- package/fesm2022/ngx-com-components-dialog.mjs.map +1 -1
- package/fesm2022/ngx-com-components-dropdown.mjs +6 -6
- package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-com-components-card.d.ts +30 -13
- package/types/ngx-com-components-dialog.d.ts +49 -9
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InputSignal, InputSignalWithTransform, Signal } from '@angular/core';
|
|
2
|
+
import { InputSignal, InputSignalWithTransform, OutputEmitterRef, Signal } from '@angular/core';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
type CardVariant = 'elevated' | 'outlined' | 'filled' | 'ghost';
|
|
@@ -76,8 +76,8 @@ type CardBadgeVariants = VariantProps<typeof cardBadgeVariants>;
|
|
|
76
76
|
* The card is a pure container with no imposed structure.
|
|
77
77
|
* Use card directives (comCardHeader, comCardContent, etc.) to compose layouts.
|
|
78
78
|
*
|
|
79
|
-
* @tokens `--color-
|
|
80
|
-
* `--color-
|
|
79
|
+
* @tokens `--color-card`, `--color-card-foreground`, `--color-muted`, `--color-muted-foreground`,
|
|
80
|
+
* `--color-muted-hover`, `--color-border`, `--color-primary`, `--color-ring`, `--shadow-card`
|
|
81
81
|
*
|
|
82
82
|
* @example Basic card
|
|
83
83
|
* ```html
|
|
@@ -111,25 +111,32 @@ declare class ComCard {
|
|
|
111
111
|
readonly interactive: InputSignalWithTransform<boolean, unknown>;
|
|
112
112
|
/** Consumer CSS classes - merged with variant classes. */
|
|
113
113
|
readonly userClass: InputSignal<string>;
|
|
114
|
+
/** Emitted when an interactive card is activated via keyboard (Enter or Space). */
|
|
115
|
+
readonly cardActivated: OutputEmitterRef<void>;
|
|
114
116
|
protected readonly computedClass: Signal<string>;
|
|
117
|
+
protected onKeyActivate(event: Event): void;
|
|
115
118
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComCard, never>;
|
|
116
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ComCard, "com-card", ["comCard"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "radius": { "alias": "radius"; "required": false; "isSignal": true; }; "interactive": { "alias": "interactive"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
119
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ComCard, "com-card", ["comCard"], { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "padding": { "alias": "padding"; "required": false; "isSignal": true; }; "radius": { "alias": "radius"; "required": false; "isSignal": true; }; "interactive": { "alias": "interactive"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, { "cardActivated": "cardActivated"; }, never, ["*"], true, never>;
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
/**
|
|
120
123
|
* Card header directive - top section for title and actions.
|
|
121
124
|
*
|
|
122
|
-
* Uses justify-between so it naturally supports a title group
|
|
123
|
-
* and an action element (icon button, menu trigger) on the right.
|
|
125
|
+
* Uses `flex` with `justify-between` so it naturally supports a title group
|
|
126
|
+
* on the left and an action element (icon button, menu trigger) on the right.
|
|
124
127
|
*
|
|
125
|
-
*
|
|
128
|
+
* **Important:** When using both `comCardTitle` and `comCardSubtitle`,
|
|
129
|
+
* wrap them in a container `<div>` so they stack vertically as a single
|
|
130
|
+
* flex child. Without the wrapper, `justify-between` will push them apart.
|
|
131
|
+
*
|
|
132
|
+
* @example Header with title only
|
|
126
133
|
* ```html
|
|
127
134
|
* <div comCardHeader>
|
|
128
135
|
* <h3 comCardTitle>Card Title</h3>
|
|
129
136
|
* </div>
|
|
130
137
|
* ```
|
|
131
138
|
*
|
|
132
|
-
* @example Header with title and action
|
|
139
|
+
* @example Header with title, subtitle, and action
|
|
133
140
|
* ```html
|
|
134
141
|
* <div comCardHeader>
|
|
135
142
|
* <div>
|
|
@@ -212,9 +219,11 @@ declare class ComCardContent {
|
|
|
212
219
|
declare class ComCardFooter {
|
|
213
220
|
/** Horizontal alignment of footer content. */
|
|
214
221
|
readonly align: InputSignal<CardAlign>;
|
|
222
|
+
/** Consumer CSS classes - merged with variant classes. */
|
|
223
|
+
readonly userClass: InputSignal<string>;
|
|
215
224
|
protected readonly computedClass: Signal<string>;
|
|
216
225
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComCardFooter, never>;
|
|
217
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardFooter, "[comCardFooter]", ["comCardFooter"], { "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
226
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardFooter, "[comCardFooter]", ["comCardFooter"], { "align": { "alias": "align"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
218
227
|
}
|
|
219
228
|
|
|
220
229
|
/**
|
|
@@ -245,9 +254,11 @@ declare class ComCardActions {
|
|
|
245
254
|
readonly align: InputSignal<CardAlign>;
|
|
246
255
|
/** Layout direction - row or column. */
|
|
247
256
|
readonly direction: InputSignal<CardActionsDirection>;
|
|
257
|
+
/** Consumer CSS classes - merged with variant classes. */
|
|
258
|
+
readonly userClass: InputSignal<string>;
|
|
248
259
|
protected readonly computedClass: Signal<string>;
|
|
249
260
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComCardActions, never>;
|
|
250
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardActions, "[comCardActions]", ["comCardActions"], { "align": { "alias": "align"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
261
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardActions, "[comCardActions]", ["comCardActions"], { "align": { "alias": "align"; "required": false; "isSignal": true; }; "direction": { "alias": "direction"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
251
262
|
}
|
|
252
263
|
|
|
253
264
|
/**
|
|
@@ -270,9 +281,11 @@ declare class ComCardActions {
|
|
|
270
281
|
declare class ComCardMedia {
|
|
271
282
|
/** Media positioning within the card. */
|
|
272
283
|
readonly position: InputSignal<CardMediaPosition>;
|
|
284
|
+
/** Consumer CSS classes - merged with variant classes. */
|
|
285
|
+
readonly userClass: InputSignal<string>;
|
|
273
286
|
protected readonly computedClass: Signal<string>;
|
|
274
287
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComCardMedia, never>;
|
|
275
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardMedia, "[comCardMedia]", ["comCardMedia"], { "position": { "alias": "position"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
288
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardMedia, "[comCardMedia]", ["comCardMedia"], { "position": { "alias": "position"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
276
289
|
}
|
|
277
290
|
|
|
278
291
|
/**
|
|
@@ -329,9 +342,11 @@ declare class ComCardAccent {
|
|
|
329
342
|
readonly color: InputSignal<CardAccentColor>;
|
|
330
343
|
/** Position of the accent strip. */
|
|
331
344
|
readonly position: InputSignal<CardAccentPosition>;
|
|
345
|
+
/** Consumer CSS classes - merged with variant classes. */
|
|
346
|
+
readonly userClass: InputSignal<string>;
|
|
332
347
|
protected readonly computedClass: Signal<string>;
|
|
333
348
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComCardAccent, never>;
|
|
334
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardAccent, "[comCardAccent]", ["comCardAccent"], { "color": { "alias": "color"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
349
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardAccent, "[comCardAccent]", ["comCardAccent"], { "color": { "alias": "color"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
335
350
|
}
|
|
336
351
|
|
|
337
352
|
/**
|
|
@@ -364,9 +379,11 @@ declare class ComCardBadge {
|
|
|
364
379
|
readonly position: InputSignal<CardBadgePosition>;
|
|
365
380
|
/** Badge color. */
|
|
366
381
|
readonly color: InputSignal<CardBadgeColor>;
|
|
382
|
+
/** Consumer CSS classes - merged with variant classes. */
|
|
383
|
+
readonly userClass: InputSignal<string>;
|
|
367
384
|
protected readonly computedClass: Signal<string>;
|
|
368
385
|
static ɵfac: i0.ɵɵFactoryDeclaration<ComCardBadge, never>;
|
|
369
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardBadge, "[comCardBadge]", ["comCardBadge"], { "position": { "alias": "position"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
386
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ComCardBadge, "[comCardBadge]", ["comCardBadge"], { "position": { "alias": "position"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "userClass": { "alias": "class"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
370
387
|
}
|
|
371
388
|
|
|
372
389
|
export { ComCard, ComCardAccent, ComCardActions, ComCardBadge, ComCardContent, ComCardDivider, ComCardFooter, ComCardHeader, ComCardMedia, ComCardSubtitle, ComCardTitle, cardAccentVariants, cardActionsVariants, cardBadgeVariants, cardFooterVariants, cardMediaVariants, cardVariants };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { OverlayRef } from '@angular/cdk/overlay';
|
|
2
|
+
import { OverlayRef, PositionStrategy, ScrollStrategy } from '@angular/cdk/overlay';
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { TemplateRef, OnInit, WritableSignal, InputSignal, InjectionToken, Provider } from '@angular/core';
|
|
4
|
+
import { Injector, ViewContainerRef, StaticProvider, TemplateRef, OnInit, WritableSignal, InputSignal, InjectionToken, Provider } from '@angular/core';
|
|
5
5
|
import { ComponentType } from '@angular/cdk/portal';
|
|
6
6
|
import { VariantProps } from 'class-variance-authority';
|
|
7
7
|
|
|
@@ -41,6 +41,10 @@ declare class ComDialogRef<R = unknown> {
|
|
|
41
41
|
|
|
42
42
|
/** Available dialog size variants. */
|
|
43
43
|
type ComDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
44
|
+
/** ARIA role for the dialog panel. */
|
|
45
|
+
type ComDialogRole = 'dialog' | 'alertdialog';
|
|
46
|
+
/** Where to restore focus after the dialog closes. */
|
|
47
|
+
type ComRestoreFocusTarget = boolean | string | HTMLElement;
|
|
44
48
|
/** Configuration for opening a dialog. */
|
|
45
49
|
interface ComDialogConfig<D = unknown> {
|
|
46
50
|
/** Data to inject via COM_DIALOG_DATA. */
|
|
@@ -51,16 +55,52 @@ interface ComDialogConfig<D = unknown> {
|
|
|
51
55
|
disableClose?: boolean;
|
|
52
56
|
/** Show backdrop overlay. */
|
|
53
57
|
hasBackdrop?: boolean;
|
|
54
|
-
/** Additional CSS class on the backdrop. */
|
|
55
|
-
backdropClass?: string;
|
|
56
|
-
/** Additional CSS class on the container panel. */
|
|
57
|
-
panelClass?: string;
|
|
58
|
+
/** Additional CSS class(es) on the backdrop. */
|
|
59
|
+
backdropClass?: string | string[];
|
|
60
|
+
/** Additional CSS class(es) on the container panel. */
|
|
61
|
+
panelClass?: string | string[];
|
|
58
62
|
/** Where to send focus on open. */
|
|
59
63
|
autoFocus?: 'first-tabbable' | 'dialog' | false;
|
|
60
|
-
/**
|
|
61
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Controls focus restoration after the dialog closes.
|
|
66
|
+
* - `true`: restore focus to the previously focused element (default).
|
|
67
|
+
* - `false`: do not restore focus.
|
|
68
|
+
* - `string`: CSS selector — the first matching element receives focus.
|
|
69
|
+
* - `HTMLElement`: the specific element receives focus.
|
|
70
|
+
*/
|
|
71
|
+
restoreFocus?: ComRestoreFocusTarget;
|
|
62
72
|
/** Fallback aria-label if no comDialogTitle is projected. */
|
|
63
73
|
ariaLabel?: string;
|
|
74
|
+
/** ARIA role on the dialog panel. Use `'alertdialog'` for confirmations/destructive actions. */
|
|
75
|
+
role?: ComDialogRole;
|
|
76
|
+
/**
|
|
77
|
+
* Custom parent injector for dialog content.
|
|
78
|
+
* Takes precedence over `viewContainerRef` injector.
|
|
79
|
+
*/
|
|
80
|
+
injector?: Injector;
|
|
81
|
+
/**
|
|
82
|
+
* Determines logical Angular tree placement for DI resolution.
|
|
83
|
+
* Its injector is used as parent when `injector` is not set.
|
|
84
|
+
*/
|
|
85
|
+
viewContainerRef?: ViewContainerRef;
|
|
86
|
+
/** Additional providers injected into the dialog content's injector. */
|
|
87
|
+
providers?: StaticProvider[];
|
|
88
|
+
/** Custom CDK position strategy. Defaults to globally centered. */
|
|
89
|
+
positionStrategy?: PositionStrategy;
|
|
90
|
+
/** Custom CDK scroll strategy. Defaults to block scroll. */
|
|
91
|
+
scrollStrategy?: ScrollStrategy;
|
|
92
|
+
/** Explicit CSS width on the panel (e.g. `'600px'`, `'80vw'`). Overrides size variant width. */
|
|
93
|
+
width?: string;
|
|
94
|
+
/** Explicit CSS height on the panel. */
|
|
95
|
+
height?: string;
|
|
96
|
+
/** CSS min-width on the panel. Numbers are treated as pixels. */
|
|
97
|
+
minWidth?: string | number;
|
|
98
|
+
/** CSS min-height on the panel. Numbers are treated as pixels. */
|
|
99
|
+
minHeight?: string | number;
|
|
100
|
+
/** CSS max-width on the panel. Numbers are treated as pixels. Overrides size variant max-width. */
|
|
101
|
+
maxWidth?: string | number;
|
|
102
|
+
/** CSS max-height on the panel. Numbers are treated as pixels. Overrides size variant max-height. */
|
|
103
|
+
maxHeight?: string | number;
|
|
64
104
|
}
|
|
65
105
|
/** Content that can be opened in a dialog. */
|
|
66
106
|
type ComDialogContent$1<T = unknown> = ComponentType<T> | TemplateRef<T>;
|
|
@@ -264,4 +304,4 @@ declare const dialogContentVariants: () => string;
|
|
|
264
304
|
declare const dialogActionsVariants: () => string;
|
|
265
305
|
|
|
266
306
|
export { COM_DIALOG_CONFIG, COM_DIALOG_DATA, ComDialog, ComDialogActions, ComDialogClose, ComDialogContent, ComDialogRef, ComDialogTitle, dialogActionsVariants, dialogBackdropVariants, dialogContentVariants, dialogPanelVariants, dialogTitleVariants, provideComDialogConfig };
|
|
267
|
-
export type { ComDialogConfig, ComDialogSize, ComDialogTemplateContext, DialogPanelVariantProps };
|
|
307
|
+
export type { ComDialogConfig, ComDialogRole, ComDialogSize, ComDialogTemplateContext, ComRestoreFocusTarget, DialogPanelVariantProps };
|