Skip to content

Commit

Permalink
feat: add transformers to toaster inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
tutkli committed Feb 20, 2024
1 parent 9bb7039 commit dcf1d46
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions libs/ngx-sonner/src/lib/toaster.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { isPlatformBrowser } from '@angular/common';
import {
booleanAttribute,
ChangeDetectionStrategy,
Component,
computed,
effect,
ElementRef,
inject,
input,
numberAttribute,
OnDestroy,
PLATFORM_ID,
signal,
Expand Down Expand Up @@ -110,15 +112,28 @@ export class ToasterComponent implements OnDestroy {
toasts = this.sonner.toasts;
heights = this.sonner.heights;

invert = input<ToasterProps['invert']>(false);
invert = input<ToasterProps['invert'], unknown>(false, {
transform: booleanAttribute,
});
theme = input<ToasterProps['theme']>('light');
position = input<ToasterProps['position']>('bottom-right');
hotKey = input<ToasterProps['hotkey']>(['altKey', 'KeyT']);
richColors = input<ToasterProps['richColors']>(false);
expand = input<ToasterProps['expand']>(false);
duration = input<ToasterProps['duration']>(TOAST_LIFETIME);
visibleToasts = input<ToasterProps['visibleToasts']>(VISIBLE_TOASTS_AMOUNT);
closeButton = input<ToasterProps['closeButton']>(false);
richColors = input<ToasterProps['richColors'], unknown>(false, {
transform: booleanAttribute,
});
expand = input<ToasterProps['expand'], unknown>(false, {
transform: booleanAttribute,
});
duration = input<ToasterProps['duration'], unknown>(TOAST_LIFETIME, {
transform: numberAttribute,
});
visibleToasts = input<ToasterProps['visibleToasts'], unknown>(
VISIBLE_TOASTS_AMOUNT,
{ transform: numberAttribute }
);
closeButton = input<ToasterProps['closeButton'], unknown>(false, {
transform: booleanAttribute,
});
toastOptions = input<ToasterProps['toastOptions']>({});
offset = input<ToasterProps['offset']>(null);
dir = input<ToasterProps['dir']>(this.getDocumentDirection());
Expand Down

0 comments on commit dcf1d46

Please sign in to comment.