ngx-com 0.0.19 → 0.0.21
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-alert.mjs +346 -0
- package/fesm2022/ngx-com-components-alert.mjs.map +1 -0
- package/fesm2022/ngx-com-components-button.mjs +1 -1
- package/fesm2022/ngx-com-components-button.mjs.map +1 -1
- package/fesm2022/ngx-com-components-calendar.mjs +29 -36
- package/fesm2022/ngx-com-components-calendar.mjs.map +1 -1
- package/fesm2022/ngx-com-components-card.mjs +1 -1
- package/fesm2022/ngx-com-components-card.mjs.map +1 -1
- package/fesm2022/ngx-com-components-carousel.mjs +708 -0
- package/fesm2022/ngx-com-components-carousel.mjs.map +1 -0
- package/fesm2022/ngx-com-components-checkbox.mjs +17 -8
- package/fesm2022/ngx-com-components-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-com-components-code-block.mjs +158 -0
- package/fesm2022/ngx-com-components-code-block.mjs.map +1 -0
- package/fesm2022/ngx-com-components-collapsible.mjs +1 -1
- package/fesm2022/ngx-com-components-collapsible.mjs.map +1 -1
- package/fesm2022/ngx-com-components-confirm.mjs +3 -3
- package/fesm2022/ngx-com-components-confirm.mjs.map +1 -1
- package/fesm2022/ngx-com-components-dialog.mjs +703 -0
- package/fesm2022/ngx-com-components-dialog.mjs.map +1 -0
- package/fesm2022/ngx-com-components-dropdown.mjs +36 -31
- package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-com-components-form-field.mjs +48 -8
- package/fesm2022/ngx-com-components-form-field.mjs.map +1 -1
- package/fesm2022/ngx-com-components-item.mjs +1 -1
- package/fesm2022/ngx-com-components-item.mjs.map +1 -1
- package/fesm2022/ngx-com-components-paginator.mjs +3 -3
- package/fesm2022/ngx-com-components-paginator.mjs.map +1 -1
- package/fesm2022/ngx-com-components-radio.mjs +16 -9
- package/fesm2022/ngx-com-components-radio.mjs.map +1 -1
- package/fesm2022/ngx-com-components-segmented-control.mjs +1 -1
- package/fesm2022/ngx-com-components-segmented-control.mjs.map +1 -1
- package/fesm2022/ngx-com-components-separator.mjs +102 -0
- package/fesm2022/ngx-com-components-separator.mjs.map +1 -0
- package/fesm2022/ngx-com-components-switch.mjs +258 -0
- package/fesm2022/ngx-com-components-switch.mjs.map +1 -0
- package/fesm2022/ngx-com-components-table.mjs +631 -0
- package/fesm2022/ngx-com-components-table.mjs.map +1 -0
- package/fesm2022/ngx-com-components-tabs.mjs +2 -2
- package/fesm2022/ngx-com-components-tabs.mjs.map +1 -1
- package/fesm2022/ngx-com-components-toast.mjs +783 -0
- package/fesm2022/ngx-com-components-toast.mjs.map +1 -0
- package/package.json +33 -1
- package/types/ngx-com-components-alert.d.ts +166 -0
- package/types/ngx-com-components-carousel.d.ts +281 -0
- package/types/ngx-com-components-checkbox.d.ts +7 -2
- package/types/ngx-com-components-code-block.d.ts +66 -0
- package/types/ngx-com-components-confirm.d.ts +2 -2
- package/types/ngx-com-components-dialog.d.ts +264 -0
- package/types/ngx-com-components-dropdown.d.ts +8 -5
- package/types/ngx-com-components-form-field.d.ts +19 -3
- package/types/ngx-com-components-radio.d.ts +5 -3
- package/types/ngx-com-components-separator.d.ts +75 -0
- package/types/ngx-com-components-switch.d.ts +110 -0
- package/types/ngx-com-components-table.d.ts +377 -0
- package/types/ngx-com-components-toast.d.ts +217 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { TemplateRef, InjectionToken, Provider } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Toast notification type.
|
|
7
|
+
*/
|
|
8
|
+
type ComToastType = 'success' | 'warn' | 'error' | 'info';
|
|
9
|
+
/**
|
|
10
|
+
* Toast container position on screen.
|
|
11
|
+
*/
|
|
12
|
+
type ComToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
13
|
+
/**
|
|
14
|
+
* Reason a toast was dismissed.
|
|
15
|
+
*/
|
|
16
|
+
type ComToastDismissReason = 'auto' | 'manual' | 'action' | 'limit';
|
|
17
|
+
/**
|
|
18
|
+
* Event emitted when a toast is dismissed.
|
|
19
|
+
*/
|
|
20
|
+
interface ComToastDismissEvent {
|
|
21
|
+
/** The reason the toast was dismissed. */
|
|
22
|
+
reason: ComToastDismissReason;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Global toast configuration. Provide via `provideComToastConfig()`.
|
|
26
|
+
*/
|
|
27
|
+
interface ComToastConfig {
|
|
28
|
+
/** Screen position of the toast container. Default: `'bottom-right'` */
|
|
29
|
+
position?: ComToastPosition;
|
|
30
|
+
/** Auto-dismiss duration in milliseconds. `0` = no auto-dismiss. Default: `5000` */
|
|
31
|
+
duration?: number;
|
|
32
|
+
/** Maximum visible toasts. Default: `5` */
|
|
33
|
+
maxVisible?: number;
|
|
34
|
+
/** Pause auto-dismiss timer on hover. Default: `true` */
|
|
35
|
+
pauseOnHover?: boolean;
|
|
36
|
+
/** Show progress bar for auto-dismissing toasts. Default: `true` */
|
|
37
|
+
showProgress?: boolean;
|
|
38
|
+
/** Show close button. Default: `true` */
|
|
39
|
+
showClose?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Data for an individual toast notification.
|
|
43
|
+
*/
|
|
44
|
+
interface ComToastData {
|
|
45
|
+
/** Toast type. Default: `'info'` */
|
|
46
|
+
type?: ComToastType;
|
|
47
|
+
/** Optional title displayed above the message. */
|
|
48
|
+
title?: string;
|
|
49
|
+
/** The toast message. */
|
|
50
|
+
message: string;
|
|
51
|
+
/** Optional action button. */
|
|
52
|
+
action?: {
|
|
53
|
+
label: string;
|
|
54
|
+
};
|
|
55
|
+
/** Lucide icon name override. */
|
|
56
|
+
icon?: string;
|
|
57
|
+
/** Per-toast auto-dismiss duration override (ms). */
|
|
58
|
+
duration?: number;
|
|
59
|
+
/** Per-toast progress bar visibility override. */
|
|
60
|
+
showProgress?: boolean;
|
|
61
|
+
/** Per-toast close button visibility override. */
|
|
62
|
+
showClose?: boolean;
|
|
63
|
+
/** Custom template for the toast content. */
|
|
64
|
+
customTemplate?: TemplateRef<ComToastTemplateContext>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Context provided to custom toast templates.
|
|
68
|
+
*/
|
|
69
|
+
interface ComToastTemplateContext {
|
|
70
|
+
/** The toast data. */
|
|
71
|
+
$implicit: ComToastData;
|
|
72
|
+
/** Function to dismiss the toast. */
|
|
73
|
+
dismiss: () => void;
|
|
74
|
+
/** Function to trigger the action. */
|
|
75
|
+
action: () => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Reference to an active toast notification.
|
|
80
|
+
* Returned by `ComToastService` methods for programmatic control.
|
|
81
|
+
*/
|
|
82
|
+
declare class ComToastRef {
|
|
83
|
+
private readonly dismissSubject;
|
|
84
|
+
private readonly actionSubject;
|
|
85
|
+
private readonly dismissFn;
|
|
86
|
+
private dismissed;
|
|
87
|
+
constructor(dismissFn: () => void);
|
|
88
|
+
/** Programmatically dismiss the toast. */
|
|
89
|
+
dismiss(): void;
|
|
90
|
+
/** Emits once when the toast is dismissed (for any reason). */
|
|
91
|
+
afterDismissed(): Observable<ComToastDismissEvent>;
|
|
92
|
+
/** Emits when the action button is clicked. */
|
|
93
|
+
afterAction(): Observable<void>;
|
|
94
|
+
/** @internal */
|
|
95
|
+
_notifyDismissed(event: ComToastDismissEvent): void;
|
|
96
|
+
/** @internal */
|
|
97
|
+
_notifyAction(): void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Service for creating toast notifications imperatively.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const toast = inject(ComToastService);
|
|
106
|
+
* toast.success('File uploaded successfully.');
|
|
107
|
+
* toast.error('Failed to save.', 'Error');
|
|
108
|
+
*
|
|
109
|
+
* const ref = toast.show({ type: 'info', message: 'Item deleted.', action: { label: 'Undo' } });
|
|
110
|
+
* ref.afterAction().subscribe(() => undoDelete());
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
declare class ComToastService {
|
|
114
|
+
private readonly overlay;
|
|
115
|
+
private readonly injector;
|
|
116
|
+
private readonly destroyRef;
|
|
117
|
+
private readonly platformId;
|
|
118
|
+
private readonly document;
|
|
119
|
+
private readonly globalConfig;
|
|
120
|
+
private overlayRef;
|
|
121
|
+
private readonly toasts;
|
|
122
|
+
private readonly position;
|
|
123
|
+
private readonly timers;
|
|
124
|
+
private readonly refs;
|
|
125
|
+
private readonly animationFallbacks;
|
|
126
|
+
private readonly dismissReasons;
|
|
127
|
+
private rafHandle;
|
|
128
|
+
private readonly config;
|
|
129
|
+
constructor();
|
|
130
|
+
/**
|
|
131
|
+
* Show a toast notification with full configuration.
|
|
132
|
+
*/
|
|
133
|
+
show(data: ComToastData): ComToastRef;
|
|
134
|
+
/** Show a success toast. */
|
|
135
|
+
success(message: string, title?: string): ComToastRef;
|
|
136
|
+
/** Show a warning toast. */
|
|
137
|
+
warn(message: string, title?: string): ComToastRef;
|
|
138
|
+
/** Show an error toast. */
|
|
139
|
+
error(message: string, title?: string): ComToastRef;
|
|
140
|
+
/** Show an info toast. */
|
|
141
|
+
info(message: string, title?: string): ComToastRef;
|
|
142
|
+
/** Dismiss all active toasts. */
|
|
143
|
+
dismissAll(): void;
|
|
144
|
+
private showByType;
|
|
145
|
+
private ensureContainer;
|
|
146
|
+
private buildPositionStrategy;
|
|
147
|
+
private dismiss;
|
|
148
|
+
private removeToast;
|
|
149
|
+
private handleAction;
|
|
150
|
+
private dismissLatest;
|
|
151
|
+
private enforceMaxVisible;
|
|
152
|
+
private startTimer;
|
|
153
|
+
private ensureRafLoop;
|
|
154
|
+
private pauseTimer;
|
|
155
|
+
private resumeTimer;
|
|
156
|
+
private clearTimer;
|
|
157
|
+
private now;
|
|
158
|
+
private updateToast;
|
|
159
|
+
private disposeOverlay;
|
|
160
|
+
private dispose;
|
|
161
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ComToastService, never>;
|
|
162
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ComToastService>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Injection token for global toast configuration.
|
|
167
|
+
*/
|
|
168
|
+
declare const COM_TOAST_CONFIG: InjectionToken<ComToastConfig>;
|
|
169
|
+
/**
|
|
170
|
+
* Provides global toast configuration.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* bootstrapApplication(AppComponent, {
|
|
175
|
+
* providers: [
|
|
176
|
+
* provideComToastConfig({ position: 'top-center', duration: 3000 }),
|
|
177
|
+
* ],
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
declare function provideComToastConfig(config: ComToastConfig): Provider;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* CVA variants for an individual toast card.
|
|
185
|
+
*
|
|
186
|
+
* @tokens `--color-success`, `--color-success-foreground`,
|
|
187
|
+
* `--color-warn`, `--color-warn-foreground`,
|
|
188
|
+
* `--color-warn-subtle`, `--color-warn-subtle-foreground`,
|
|
189
|
+
* `--color-primary-subtle`, `--color-primary-subtle-foreground`,
|
|
190
|
+
* `--color-border`, `--shadow-lg`, `--radius-card`
|
|
191
|
+
*/
|
|
192
|
+
declare const toastVariants: (props?: {
|
|
193
|
+
type?: ComToastType;
|
|
194
|
+
}) => string;
|
|
195
|
+
/**
|
|
196
|
+
* CVA variants for the toast container positioning.
|
|
197
|
+
*/
|
|
198
|
+
declare const toastContainerVariants: (props?: {
|
|
199
|
+
position?: ComToastPosition;
|
|
200
|
+
}) => string;
|
|
201
|
+
/**
|
|
202
|
+
* CVA variants for the toast progress bar.
|
|
203
|
+
*/
|
|
204
|
+
declare const toastProgressVariants: (props?: {
|
|
205
|
+
type?: ComToastType;
|
|
206
|
+
}) => string;
|
|
207
|
+
/**
|
|
208
|
+
* CVA variants for the toast close button.
|
|
209
|
+
*
|
|
210
|
+
* @tokens `--color-ring`, `--radius-card`
|
|
211
|
+
*/
|
|
212
|
+
declare const toastCloseButtonVariants: (props?: {
|
|
213
|
+
type?: ComToastType;
|
|
214
|
+
}) => string;
|
|
215
|
+
|
|
216
|
+
export { COM_TOAST_CONFIG, ComToastRef, ComToastService, provideComToastConfig, toastCloseButtonVariants, toastContainerVariants, toastProgressVariants, toastVariants };
|
|
217
|
+
export type { ComToastConfig, ComToastData, ComToastDismissEvent, ComToastDismissReason, ComToastPosition, ComToastTemplateContext, ComToastType };
|