@ngflux/ngflux 3.2.3 → 3.2.5

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.
@@ -0,0 +1,55 @@
1
+ :host {
2
+ display: block;
3
+ position: absolute;
4
+ width: calc(100% - (2 * var(--ngf-toast-x)));
5
+ transition: opacity .5s ease-in-out;
6
+ max-width: 300px;
7
+
8
+ --flex-direction: column;
9
+
10
+ &.topLeft {
11
+ inset: var(--ngf-toast-y) auto auto var(--ngf-toast-x);
12
+ }
13
+
14
+ &.topCenter {
15
+ inset: var(--ngf-toast-y) auto auto 50%;
16
+ transform: translateX(-50%);
17
+ }
18
+
19
+ &.topRight {
20
+ inset: var(--ngf-toast-y) var(--ngf-toast-x) auto auto;
21
+ }
22
+
23
+ &.bottomLeft {
24
+ inset: auto auto var(--ngf-toast-y) var(--ngf-toast-x);
25
+
26
+ --flex-direction: column-reverse;
27
+ }
28
+
29
+ &.bottomCenter {
30
+ inset: auto auto var(--ngf-toast-y) 50%;
31
+ transform: translateX(-50%);
32
+
33
+ --flex-direction: column-reverse;
34
+ }
35
+
36
+ &.bottomRight {
37
+ inset: auto var(--ngf-toast-x) var(--ngf-toast-y) auto;
38
+
39
+ --flex-direction: column-reverse;
40
+ }
41
+
42
+ .wrapper {
43
+ display: flex;
44
+ flex-direction: var(--flex-direction) !important;
45
+ gap: 10px;
46
+
47
+ .fade-in {
48
+ opacity: 1;
49
+ }
50
+
51
+ .fade-out {
52
+ opacity: 0;
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,17 @@
1
+ :host {
2
+ display: block;
3
+ visibility: hidden;
4
+ height: 0px !important;
5
+
6
+ .wrapper {
7
+ display: block;
8
+ position: fixed;
9
+ visibility: hidden;
10
+ z-index: var(--ngf-toast-z-index) !important;
11
+ inset: 0px;
12
+
13
+ .fade-out {
14
+ opacity: 0;
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,28 @@
1
+ :host {
2
+ display: block;
3
+ box-shadow: 0px 0px 3px rgba(0, 0, 0, .7);
4
+ visibility: visible !important;
5
+ padding: 5px 10px;
6
+ font-size: .8rem;
7
+ transition: opacity .5s ease-in-out;
8
+ opacity: 0;
9
+
10
+ .wrapper {
11
+ display: flex;
12
+ flex-direction: row;
13
+ align-items: center;
14
+ gap: 10px;
15
+
16
+ > .content {
17
+ display: block;
18
+ flex: 1 0 0;
19
+ font-weight: 500;
20
+ }
21
+
22
+ > .close-btn {
23
+ display: block;
24
+ cursor: pointer;
25
+ padding: 5px;
26
+ }
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngflux/ngflux",
3
- "version": "3.2.3",
3
+ "version": "3.2.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/NgFlux/ngflux.git"
@@ -93,3 +93,9 @@ $dialog-background-color: #FFF !default;
93
93
  $dialog-box-shadow: 0px 0px 5px rgba(0, 0, 0, .4) !default;
94
94
  $dialog-border: 1px solid #DDD !default;
95
95
  // END: Dialog Variables
96
+
97
+ // BEGIN: Toast Variables
98
+ $toast-x: 20px !default;
99
+ $toast-y: 20px !default;
100
+ $toast-z-index: 2000 !default;
101
+ // END: Toast Variables
@@ -2,4 +2,6 @@
2
2
  @use './icons.scss';
3
3
  @use './loading.scss';
4
4
  @use './dialog.scss';
5
+ @use './toast.scss';
6
+ @use './theme.scss';
5
7
  @use './tab.scss';
@@ -0,0 +1,51 @@
1
+ .ngf-theme {
2
+ &-default {
3
+ background-color: var(--ngf-default) !important;
4
+ color: var(--ngf-default-fg) !important;
5
+ }
6
+
7
+ &-primary {
8
+ background-color: var(--ngf-primary) !important;
9
+ color: var(--ngf-primary-fg) !important;
10
+ }
11
+
12
+ &-secondary {
13
+ background-color: var(--ngf-secondary) !important;
14
+ color: var(--ngf-secondary-fg) !important;
15
+ }
16
+
17
+ &-error {
18
+ background-color: var(--ngf-error) !important;
19
+ color: var(--ngf-error-fg) !important;
20
+ }
21
+
22
+ &-danger {
23
+ background-color: var(--ngf-danger) !important;
24
+ color: var(--ngf-danger-fg) !important;
25
+ }
26
+
27
+ &-success {
28
+ background-color: var(--ngf-success) !important;
29
+ color: var(--ngf-success-fg) !important;
30
+ }
31
+
32
+ &-warning {
33
+ background-color: var(--ngf-warning) !important;
34
+ color: var(--ngf-warning-fg) !important;
35
+ }
36
+
37
+ &-info {
38
+ background-color: var(--ngf-info) !important;
39
+ color: var(--ngf-info-fg) !important;
40
+ }
41
+
42
+ &-light {
43
+ background-color: var(--ngf-light) !important;
44
+ color: var(--ngf-light-fg) !important;
45
+ }
46
+
47
+ &-dark {
48
+ background-color: var(--ngf-dark) !important;
49
+ color: var(--ngf-dark-fg) !important;
50
+ }
51
+ }
@@ -0,0 +1,23 @@
1
+ @use '../system' as ngf;
2
+
3
+ :root {
4
+ // --ngf-dialog-z-index: #{ngf.$dialog-z-index};
5
+ // --ngf-dialog-backdrop-color: #{ngf.$dialog-backdrop-color};
6
+
7
+ // --ngf-dialog-closebtn-color: #{ngf.$dialog-closebtn-color};
8
+ // --ngf-dialog-closebtn-opacity: #{ngf.$dialog-closebtn-opacity};
9
+
10
+ // --ngf-dialog-text-color: #{ngf.$dialog-text-color};
11
+ // --ngf-dialog-header-text-color: #{ngf.$dialog-header-text-color};
12
+ // --ngf-dialog-footer-text-color: #{ngf.$dialog-footer-text-color};
13
+
14
+ // --ngf-dialog-padding: #{ngf.$dialog-padding};
15
+ // --ngf-dialog-background-color: #{ngf.$dialog-background-color};
16
+ // --ngf-dialog-box-shadow: #{ngf.$dialog-box-shadow};
17
+ // --ngf-dialog-border: #{ngf.$dialog-border};
18
+
19
+ --ngf-toast-x: #{ngf.$toast-x};
20
+ --ngf-toast-y: #{ngf.$toast-y};
21
+
22
+ --ngf-toast-z-index: #{ngf.$toast-z-index};
23
+ }
@@ -7,8 +7,10 @@ import * as rxjs from 'rxjs';
7
7
  import { Observable } from 'rxjs';
8
8
  import { FormValueControl, FieldTree, FormSubmitOptions, Field, FieldState } from '@angular/forms/signals';
9
9
 
10
+ type NgFluxTheme = 'default' | 'primary' | 'secondary' | 'error' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark';
11
+
10
12
  type ButtonDirection = 'normal' | 'reversed';
11
- type ButtonTheme = 'default' | 'primary' | 'secondary' | 'error' | 'danger' | 'success' | 'warning' | 'info' | 'light' | 'dark';
13
+ type ButtonTheme = NgFluxTheme;
12
14
  type ButtonType = 'submit' | 'button' | 'reset' | 'menu';
13
15
  type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
14
16
  type ButtonOptions = {
@@ -46,44 +48,77 @@ type PaginationInfo = {
46
48
  page: number;
47
49
  };
48
50
 
51
+ type ToastPlacement = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
52
+ type ToastOptions = {
53
+ /**
54
+ * Content of the toast
55
+ */
56
+ content: string;
57
+ /**
58
+ * Placement of the toast
59
+ * The default placement is `topRight`
60
+ */
61
+ placement?: ToastPlacement;
62
+ /**
63
+ * Whether to show the close button.
64
+ * The default value is `true`
65
+ */
66
+ showCloseButton?: boolean;
67
+ /**
68
+ * Timeout in milliseconds.
69
+ * The default timeout is `5000` (5 seconds).
70
+ */
71
+ timeout?: number;
72
+ /**
73
+ * Theme for the Toast
74
+ * The default theme is `info`
75
+ */
76
+ theme?: NgFluxTheme;
77
+ };
78
+ type ToastOptionsWithoutTheme = Omit<ToastOptions, 'theme'>;
79
+
49
80
  type NgFluxConfig = {
50
- loading?: LoadingOptions;
51
- dialog?: DialogOptions;
52
- pagination?: PaginationOptions;
53
- title?: RouterTitleOptions;
81
+ loading?: LoadingConfiguration;
82
+ dialog?: DialogConfiguration;
83
+ pagination?: PaginationConfiguration;
84
+ title?: RouterTitleConfiguration;
85
+ toast?: ToastConfiguration;
54
86
  };
55
87
  declare const NGF_CONFIG: InjectionToken<NgFluxConfig>;
56
- type RouterTitleOptions = {
88
+ type RouterTitleConfiguration = {
57
89
  separator?: string;
58
90
  prefix?: string;
59
91
  suffix?: string;
60
92
  };
61
- type LoadingOptions = {
93
+ type LoadingConfiguration = {
62
94
  showOnRouteNavigation?: boolean;
63
95
  component?: NgFluxComponent;
64
96
  };
65
- type DialogAlertOptions = {
97
+ type DialogAlertConfiguration = {
66
98
  okayButton?: ButtonOptions;
67
99
  };
68
- type DialogConfirmOptions = {
100
+ type DialogConfirmConfiguration = {
69
101
  okayButton?: ButtonOptions;
70
102
  cancelButton?: ButtonOptions;
71
103
  };
72
- type DialogPromptOptions = {
104
+ type DialogPromptConfiguration = {
73
105
  submitButton?: ButtonOptions;
74
106
  cancelButton?: ButtonOptions;
75
107
  };
76
- type DialogOptions = {
77
- alert?: DialogAlertOptions;
78
- confirm?: DialogConfirmOptions;
79
- prompt?: DialogPromptOptions;
108
+ type DialogConfiguration = {
109
+ alert?: DialogAlertConfiguration;
110
+ confirm?: DialogConfirmConfiguration;
111
+ prompt?: DialogPromptConfiguration;
80
112
  };
81
- type PaginationOptions = {
113
+ type PaginationConfiguration = {
82
114
  preload?: boolean;
83
115
  transform?: PaginationTransformer;
84
116
  limitOptions?: number[];
85
117
  limit?: number;
86
118
  };
119
+ type ToastConfiguration = {
120
+ options?: Omit<ToastOptions, 'content'>;
121
+ };
87
122
 
88
123
  type OnClosed<T = any> = (cmd: NgFluxDialogCommand<T>) => void;
89
124
  declare class NgFluxDialogRef<T = any> {
@@ -210,7 +245,7 @@ declare class NgFluxActions {
210
245
  declare class NgFluxButton {
211
246
  private readonly ref;
212
247
  readonly icon: _angular_core.InputSignal<string | undefined>;
213
- readonly theme: _angular_core.InputSignal<ButtonTheme | undefined>;
248
+ readonly theme: _angular_core.InputSignal<_ngflux_ngflux.NgFluxTheme | undefined>;
214
249
  readonly type: _angular_core.InputSignal<ButtonType | undefined>;
215
250
  readonly size: _angular_core.InputSignal<ButtonSize | undefined>;
216
251
  readonly direction: _angular_core.InputSignal<ButtonDirection | undefined>;
@@ -254,7 +289,7 @@ declare class NgFluxDialog {
254
289
  alert(data: NgFluxDialogAlertOptions): rxjs.Observable<boolean | null>;
255
290
  success(data: NgFluxDialogAlertOptions): rxjs.Observable<boolean | null>;
256
291
  error(data: NgFluxDialogAlertOptions): rxjs.Observable<boolean | null>;
257
- confirm(data: NgFluxDialogConfirmOptions): rxjs.Observable<any>;
292
+ confirm(data: NgFluxDialogConfirmOptions): rxjs.Observable<boolean>;
258
293
  prompt(data: NgFluxDialogPromptOptions): rxjs.Observable<any>;
259
294
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialog, never>;
260
295
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgFluxDialog>;
@@ -279,6 +314,27 @@ declare class NgFluxDialogInstance<T = any> {
279
314
  send(cmd: NgFluxDialogCommand<T>): void;
280
315
  }
281
316
 
317
+ declare class NgFluxToast {
318
+ private readonly config;
319
+ private readonly ctrl;
320
+ show(options: ToastOptions): void;
321
+ showDefault(options: ToastOptionsWithoutTheme): void;
322
+ showPrimary(options: ToastOptionsWithoutTheme): void;
323
+ showSecondary(options: ToastOptionsWithoutTheme): void;
324
+ showError(options: ToastOptionsWithoutTheme): void;
325
+ showDanger(options: ToastOptionsWithoutTheme): void;
326
+ showSuccess(options: ToastOptionsWithoutTheme): void;
327
+ showWarning(options: ToastOptionsWithoutTheme): void;
328
+ showInfo(options: ToastOptionsWithoutTheme): void;
329
+ showLight(options: ToastOptionsWithoutTheme): void;
330
+ showDark(options: ToastOptionsWithoutTheme): void;
331
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxToast, never>;
332
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgFluxToast>;
333
+ }
334
+
335
+ declare class ToastInstance {
336
+ }
337
+
282
338
  declare class NgFluxDialogHeader {
283
339
  readonly config: _ngflux_ngflux.NgFluxDialogConfig;
284
340
  readonly dialogRef: NgFluxDialogRef<unknown>;
@@ -287,13 +343,6 @@ declare class NgFluxDialogHeader {
287
343
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxDialogHeader, "ngf-dialog-header", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
288
344
  }
289
345
 
290
- declare class NgFluxDialogRootComponent {
291
- readonly injector: Injector;
292
- readonly viewContainer: _angular_core.Signal<ViewContainerRef>;
293
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialogRootComponent, never>;
294
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxDialogRootComponent, "ngf-dialog-root", never, {}, {}, never, never, true, never>;
295
- }
296
-
297
346
  declare class NgFluxLoadingRootComponent {
298
347
  private readonly config;
299
348
  private readonly injector;
@@ -379,6 +428,13 @@ declare class NgFluxPinInput implements FormValueControl<string> {
379
428
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxPinInput, "ngf-pin-input", never, { "chars": { "alias": "chars"; "required": false; "isSignal": true; }; "block": { "alias": "block"; "required": false; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; }, never, never, true, never>;
380
429
  }
381
430
 
431
+ declare class NgFluxThemeDirective {
432
+ readonly ngfTheme: _angular_core.ModelSignal<NgFluxTheme>;
433
+ protected className: _angular_core.Signal<string>;
434
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxThemeDirective, never>;
435
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgFluxThemeDirective, "[ngfTheme]", never, { "ngfTheme": { "alias": "ngfTheme"; "required": false; "isSignal": true; }; }, { "ngfTheme": "ngfThemeChange"; }, never, never, true, never>;
436
+ }
437
+
382
438
  declare class NgFluxForm<TModel> {
383
439
  readonly root: _angular_core.InputSignal<FieldTree<TModel>>;
384
440
  readonly options: _angular_core.InputSignal<FormSubmitOptions<unknown, TModel> | undefined>;
@@ -498,5 +554,5 @@ declare class NgFluxFormMessage {
498
554
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxFormMessage, "ngf-form-message", never, { "field": { "alias": "field"; "required": true; "isSignal": true; }; "pending": { "alias": "pending"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
499
555
  }
500
556
 
501
- export { NGF_CONFIG, NGF_DIALOG_DATA, NgFlux, NgFluxActions, NgFluxButton, NgFluxDialog, NgFluxDialogBody, NgFluxDialogFooter, NgFluxDialogHeader, NgFluxDialogInstance, NgFluxDialogRef, NgFluxDialogRootComponent, NgFluxForm, NgFluxFormMessage, NgFluxFrame, NgFluxLoading, NgFluxLoadingRootComponent, NgFluxPagination, NgFluxPinInput, NgFluxSelect, NgFluxTab, NgFluxTabContentDirective, NgFluxTabGroup, NgFluxTabNavDirective, NgFluxTabNavbar, NgFluxTabPanel, provideNgFlux };
502
- export type { ButtonDirection, ButtonOptions, ButtonSize, ButtonTheme, ButtonType, FrameHeaderMenu, FrameOptions, FrameSize, FrameToolbarItem, Menu, NgFluxComponent, NgFluxConfig, NgFluxDialogAlertOptions, NgFluxDialogButton, NgFluxDialogButtonObj, NgFluxDialogCommand, NgFluxDialogConfig, NgFluxDialogConfirmOptions, NgFluxDialogEvents, NgFluxDialogPromptOptions, NgFluxDialogRoot, NgFluxLoadingEntry, NgFluxRoute, NgFluxRoutes, Pagination, PaginationInfo, PaginationTransformer, SelectItem, SelectTransformer };
557
+ export { NGF_CONFIG, NGF_DIALOG_DATA, NgFlux, NgFluxActions, NgFluxButton, NgFluxDialog, NgFluxDialogBody, NgFluxDialogFooter, NgFluxDialogHeader, NgFluxDialogInstance, NgFluxDialogRef, NgFluxForm, NgFluxFormMessage, NgFluxFrame, NgFluxLoading, NgFluxLoadingRootComponent, NgFluxPagination, NgFluxPinInput, NgFluxSelect, NgFluxTab, NgFluxTabContentDirective, NgFluxTabGroup, NgFluxTabNavDirective, NgFluxTabNavbar, NgFluxTabPanel, NgFluxThemeDirective, NgFluxToast, ToastInstance, provideNgFlux };
558
+ export type { ButtonDirection, ButtonOptions, ButtonSize, ButtonTheme, ButtonType, FrameHeaderMenu, FrameOptions, FrameSize, FrameToolbarItem, Menu, NgFluxComponent, NgFluxConfig, NgFluxDialogAlertOptions, NgFluxDialogButton, NgFluxDialogButtonObj, NgFluxDialogCommand, NgFluxDialogConfig, NgFluxDialogConfirmOptions, NgFluxDialogEvents, NgFluxDialogPromptOptions, NgFluxDialogRoot, NgFluxLoadingEntry, NgFluxRoute, NgFluxRoutes, NgFluxTheme, Pagination, PaginationInfo, PaginationTransformer, SelectItem, SelectTransformer, ToastOptions, ToastOptionsWithoutTheme, ToastPlacement };