@ngflux/ngflux 3.2.3 → 3.2.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.
@@ -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.4",
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,11 +48,41 @@ 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
81
  loading?: LoadingOptions;
51
82
  dialog?: DialogOptions;
52
83
  pagination?: PaginationOptions;
53
84
  title?: RouterTitleOptions;
85
+ toast?: ToastConfiguration;
54
86
  };
55
87
  declare const NGF_CONFIG: InjectionToken<NgFluxConfig>;
56
88
  type RouterTitleOptions = {
@@ -84,6 +116,7 @@ type PaginationOptions = {
84
116
  limitOptions?: number[];
85
117
  limit?: number;
86
118
  };
119
+ type ToastConfiguration = Omit<ToastOptions, 'content'>;
87
120
 
88
121
  type OnClosed<T = any> = (cmd: NgFluxDialogCommand<T>) => void;
89
122
  declare class NgFluxDialogRef<T = any> {
@@ -210,7 +243,7 @@ declare class NgFluxActions {
210
243
  declare class NgFluxButton {
211
244
  private readonly ref;
212
245
  readonly icon: _angular_core.InputSignal<string | undefined>;
213
- readonly theme: _angular_core.InputSignal<ButtonTheme | undefined>;
246
+ readonly theme: _angular_core.InputSignal<_ngflux_ngflux.NgFluxTheme | undefined>;
214
247
  readonly type: _angular_core.InputSignal<ButtonType | undefined>;
215
248
  readonly size: _angular_core.InputSignal<ButtonSize | undefined>;
216
249
  readonly direction: _angular_core.InputSignal<ButtonDirection | undefined>;
@@ -254,7 +287,7 @@ declare class NgFluxDialog {
254
287
  alert(data: NgFluxDialogAlertOptions): rxjs.Observable<boolean | null>;
255
288
  success(data: NgFluxDialogAlertOptions): rxjs.Observable<boolean | null>;
256
289
  error(data: NgFluxDialogAlertOptions): rxjs.Observable<boolean | null>;
257
- confirm(data: NgFluxDialogConfirmOptions): rxjs.Observable<any>;
290
+ confirm(data: NgFluxDialogConfirmOptions): rxjs.Observable<boolean>;
258
291
  prompt(data: NgFluxDialogPromptOptions): rxjs.Observable<any>;
259
292
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxDialog, never>;
260
293
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgFluxDialog>;
@@ -279,6 +312,27 @@ declare class NgFluxDialogInstance<T = any> {
279
312
  send(cmd: NgFluxDialogCommand<T>): void;
280
313
  }
281
314
 
315
+ declare class NgFluxToast {
316
+ private readonly config;
317
+ private readonly ctrl;
318
+ show(options: ToastOptions): void;
319
+ showDefault(options: ToastOptionsWithoutTheme): void;
320
+ showPrimary(options: ToastOptionsWithoutTheme): void;
321
+ showSecondary(options: ToastOptionsWithoutTheme): void;
322
+ showError(options: ToastOptionsWithoutTheme): void;
323
+ showDanger(options: ToastOptionsWithoutTheme): void;
324
+ showSuccess(options: ToastOptionsWithoutTheme): void;
325
+ showWarning(options: ToastOptionsWithoutTheme): void;
326
+ showInfo(options: ToastOptionsWithoutTheme): void;
327
+ showLight(options: ToastOptionsWithoutTheme): void;
328
+ showDark(options: ToastOptionsWithoutTheme): void;
329
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxToast, never>;
330
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<NgFluxToast>;
331
+ }
332
+
333
+ declare class ToastInstance {
334
+ }
335
+
282
336
  declare class NgFluxDialogHeader {
283
337
  readonly config: _ngflux_ngflux.NgFluxDialogConfig;
284
338
  readonly dialogRef: NgFluxDialogRef<unknown>;
@@ -287,13 +341,6 @@ declare class NgFluxDialogHeader {
287
341
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgFluxDialogHeader, "ngf-dialog-header", never, { "icon": { "alias": "icon"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
288
342
  }
289
343
 
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
344
  declare class NgFluxLoadingRootComponent {
298
345
  private readonly config;
299
346
  private readonly injector;
@@ -379,6 +426,13 @@ declare class NgFluxPinInput implements FormValueControl<string> {
379
426
  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
427
  }
381
428
 
429
+ declare class NgFluxThemeDirective {
430
+ readonly ngfTheme: _angular_core.ModelSignal<NgFluxTheme>;
431
+ protected className: _angular_core.Signal<string>;
432
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgFluxThemeDirective, never>;
433
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgFluxThemeDirective, "[ngfTheme]", never, { "ngfTheme": { "alias": "ngfTheme"; "required": false; "isSignal": true; }; }, { "ngfTheme": "ngfThemeChange"; }, never, never, true, never>;
434
+ }
435
+
382
436
  declare class NgFluxForm<TModel> {
383
437
  readonly root: _angular_core.InputSignal<FieldTree<TModel>>;
384
438
  readonly options: _angular_core.InputSignal<FormSubmitOptions<unknown, TModel> | undefined>;
@@ -498,5 +552,5 @@ declare class NgFluxFormMessage {
498
552
  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
553
  }
500
554
 
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 };
555
+ 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 };
556
+ 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 };