@frontile/notifications 0.16.1 → 0.16.3-0.17.0-beta.1.0
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/declarations/components/notification-card.d.ts +7 -0
- package/declarations/components/notification-card.d.ts.map +1 -1
- package/declarations/components/notifications-container.d.ts +5 -0
- package/declarations/components/notifications-container.d.ts.map +1 -1
- package/dist/components/notification-card.js +23 -3
- package/dist/components/notification-card.js.map +1 -1
- package/dist/components/notifications-container.js +11 -3
- package/dist/components/notifications-container.js.map +1 -1
- package/package.json +8 -13
- package/tailwind/default-options.js +0 -226
- package/tailwind/index.js +0 -30
|
@@ -27,5 +27,12 @@ export default class NotificationCard extends Component<NotificationCardSignatur
|
|
|
27
27
|
pause(): void;
|
|
28
28
|
resume(): void;
|
|
29
29
|
handleClickCustomAction(customAction: CustomAction): void;
|
|
30
|
+
get classes(): {
|
|
31
|
+
base: string;
|
|
32
|
+
message: string;
|
|
33
|
+
customActions: string;
|
|
34
|
+
customActionButton: string;
|
|
35
|
+
closeButton: string;
|
|
36
|
+
};
|
|
30
37
|
}
|
|
31
38
|
//# sourceMappingURL=notification-card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-card.d.ts","sourceRoot":"","sources":["../../src/components/notification-card.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAc3C,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,YAAY,CAAC;IAC3B,SAAS,EAAE,kBAAkB,CAAC;IAE9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAA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pB;IAEO,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAMtC,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAyBxC,aAAa,CACnB,OAAO,EAAE,WAAW,EACpB,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,GAC3B,IAAI;IAMC,MAAM,IAAI,IAAI;IAId,KAAK,IAAI,IAAI;IAMb,MAAM,IAAI,IAAI;IAMd,uBAAuB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI;IAKjE,IAAI,OAAO;;;;;;MAeV;CA4DF"}
|
|
@@ -15,6 +15,10 @@ export interface NotificationsContainerArgs {
|
|
|
15
15
|
* @defaultValue 16
|
|
16
16
|
*/
|
|
17
17
|
spacing?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Custom class name, it will override the default ones using Tailwind Merge library.
|
|
20
|
+
*/
|
|
21
|
+
class?: string;
|
|
18
22
|
}
|
|
19
23
|
export interface NotificationsContainerSignature {
|
|
20
24
|
Args: NotificationsContainerArgs;
|
|
@@ -24,6 +28,7 @@ export default class NotificationsContainer extends Component<NotificationsConta
|
|
|
24
28
|
notifications: NotificationsService;
|
|
25
29
|
get isTopPlacement(): boolean;
|
|
26
30
|
get sortedNotifications(): Notification[];
|
|
31
|
+
get classes(): string;
|
|
27
32
|
addSpacing(element: HTMLElement): void;
|
|
28
33
|
}
|
|
29
34
|
//# sourceMappingURL=notifications-container.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-container.d.ts","sourceRoot":"","sources":["../../src/components/notifications-container.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"notifications-container.d.ts","sourceRoot":"","sources":["../../src/components/notifications-container.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAM3C,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,YAAY,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAC/B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,+BAA+B;IAC9C,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,SAAS,CAAC,+BAA+B,CAAC;IACnF,aAAa,EAAG,oBAAoB,CAAC;IAE9C,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,IAAI,mBAAmB,IAAI,YAAY,EAAE,CAMxC;IAED,IAAI,OAAO,WAOV;IAEO,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;CAoC/C"}
|
|
@@ -12,9 +12,9 @@ import { on } from '@ember/modifier';
|
|
|
12
12
|
import { concat, fn } from '@ember/helper';
|
|
13
13
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
14
14
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
15
|
-
import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
|
|
16
15
|
import CloseButton from '@frontile/core/components/close-button';
|
|
17
16
|
import { cssTransition } from 'ember-css-transitions';
|
|
17
|
+
import { useStyles } from '@frontile/theme';
|
|
18
18
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
19
19
|
import { setComponentTemplate } from '@ember/component';
|
|
20
20
|
|
|
@@ -75,11 +75,31 @@ let NotificationCard = (_class = (_class2 = class NotificationCard extends Compo
|
|
|
75
75
|
customAction1.onClick();
|
|
76
76
|
this.remove();
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
get classes() {
|
|
79
|
+
const {
|
|
80
|
+
notificationCard: notificationCard1
|
|
81
|
+
} = useStyles();
|
|
82
|
+
let {
|
|
83
|
+
base: base1,
|
|
84
|
+
message: message1,
|
|
85
|
+
customActions: customActions1,
|
|
86
|
+
customActionButton: customActionButton1,
|
|
87
|
+
closeButton: closeButton1
|
|
88
|
+
} = notificationCard1({
|
|
89
|
+
appearance: this.args.notification.appearance
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
base: base1(),
|
|
93
|
+
message: message1(),
|
|
94
|
+
customActions: customActions1(),
|
|
95
|
+
customActionButton: customActionButton1(),
|
|
96
|
+
closeButton: closeButton1()
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}, setComponentTemplate(precompileTemplate("\n {{!-- template-lint-disable no-invalid-interactive --}}\n {{!-- template-lint-disable no-unnecessary-concat --}}\n {{!-- template-lint-disable no-inline-styles --}}\n {{!-- template-lint-disable style-concatenation --}}\n <div {{didInsert this.transitionIn}} {{didUpdate this.transitionOut @notification.isRemoving}}>\n {{#unless @notification.isRemoving}}\n <div {{on \"mouseenter\" this.pause}} {{on \"mouseleave\" this.resume}} {{cssTransition (concat \"notification-transition--slide-from-\" @placement) isEnabled=true}} class={{this.classes.base}} style=\"{{this.styles}}\" ...attributes>\n <div class={{this.classes.message}}>\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction|}}\n <button type=\"button\" class={{this.classes.customActionButton}} {{on \"click\" (fn this.handleClickCustomAction customAction)}}>\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton @onClick={{this.remove}} @size=\"sm\" @class={{this.classes.closeButton}} />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n ", {
|
|
79
100
|
scope: () => ({
|
|
80
101
|
didInsert,
|
|
81
102
|
didUpdate,
|
|
82
|
-
useFrontileClass,
|
|
83
103
|
on,
|
|
84
104
|
cssTransition,
|
|
85
105
|
concat,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-card.js","sources":["../../src/components/notification-card.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { fn, concat } from '@ember/helper';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport useFrontileClass from '@frontile/core/helpers/use-frontile-class';\nimport CloseButton from '@frontile/core/components/close-button';\nimport { cssTransition } from 'ember-css-transitions';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport type { CustomAction, containerPlacement } from '../-private/types';\nexport interface NotificationCardArgs {\n notification: Notification;\n placement: containerPlacement;\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */ spacing?: number;\n}\nexport interface NotificationCardSignature {\n Args: NotificationCardArgs;\n Element: HTMLDivElement;\n}\nexport default class NotificationCard extends Component<NotificationCardSignature> {\n @service\n notifications: NotificationsService;\n @tracked\n hasEntered = false;\n get styles(): unknown {\n const styles1 = [\n `transition-duration: ${this.args.notification.transitionDuration}ms`\n ];\n if (!this.hasEntered) {\n styles1.push(`transition-delay: ${this.args.notification.transitionDuration}ms`);\n }\n return htmlSafe(styles1.join('; '));\n }\n @action\n addSpacing(element1: HTMLElement): void {\n if (this.args.placement && this.args.placement.includes('top')) {\n element1.style.marginTop = `${this.args.spacing || 16}px`;\n }\n }\n @action\n transitionIn(element1: HTMLElement): void {\n const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n const expectedHeight1 = element1.offsetHeight + spacing1;\n const duration1 = this.args.notification.transitionDuration / 2;\n requestAnimationFrame(()=>{\n element1.style.height = '0';\n const transition1 = `height ${duration1}ms ease-in ${duration1}ms`;\n element1.style.transition = transition1;\n requestAnimationFrame(()=>{\n element1.style.height = `${expectedHeight1}px`;\n });\n });\n later(this, ()=>{\n this.hasEntered = true;\n }, this.args.notification.transitionDuration);\n }\n @action\n transitionOut(element1: HTMLElement, [isExiting1, ..._1]: boolean[]): void {\n if (isExiting1) {\n element1.style.height = '0';\n }\n }\n @action\n remove(): void {\n this.notifications.remove(this.args.notification);\n }\n @action\n pause(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.pause();\n }\n }\n @action\n resume(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.resume();\n }\n }\n @action\n handleClickCustomAction(customAction1: CustomAction): void {\n customAction1.onClick();\n this.remove();\n }\n static{\n template(`\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-unnecessary-concat }}\n {{! template-lint-disable no-inline-styles }}\n {{! template-lint-disable style-concatenation }}\n <div\n {{didInsert this.transitionIn}}\n {{didUpdate this.transitionOut @notification.isRemoving}}\n >\n {{#unless @notification.isRemoving}}\n <div\n {{on \"mouseenter\" this.pause}}\n {{on \"mouseleave\" this.resume}}\n {{cssTransition\n (concat \"notification-transition--slide-from-\" @placement)\n isEnabled=true\n }}\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n }}\n style=\"{{this.styles}}\"\n ...attributes\n >\n <div\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"message\"\n }}\n >\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"custom-actions\"\n }}\n >\n {{#each @notification.customActions as |customAction|}}\n <button\n type=\"button\"\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"custom-action-btn\"\n }}\n {{on \"click\" (fn this.handleClickCustomAction customAction)}}\n >\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton\n @onClick={{this.remove}}\n class={{useFrontileClass\n \"notification-card\"\n @notification.appearance\n part=\"close-btn\"\n }}\n />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["NotificationCard","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","styles","styles1","notification","transitionDuration","hasEntered","push","htmlSafe","join","addSpacing","element1","placement","includes","style","marginTop","spacing","transitionIn","spacing1","expectedHeight1","offsetHeight","duration1","requestAnimationFrame","height","transition1","transition","later","transitionOut","isExiting1","_1","remove","notifications","pause","timer","resume","handleClickCustomAction","customAction1","onClick","setComponentTemplate","precompileTemplate","scope","didInsert","didUpdate","useFrontileClass","on","cssTransition","concat","fn","CloseButton","strictMode","_applyDecoratedDescriptor","prototype","service","configurable","enumerable","writable","initializer","tracked","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BqBA,IAAAA,gBAAgB,IAAAC,MAAA,IAAAC,OAAA,GAAtB,MAAMF,gBAAgB,SAASG,SAAS,CAA4B;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,wBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAAD,IAAAA,0BAAA,qBAAAE,YAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAK/E,IAAIC,MAAMA,GAAY;AAClB,IAAA,MAAMC,OAAO,GAAG,CACX,CAAA,qBAAA,EAAuB,IAAI,CAACL,IAAI,CAACM,YAAY,CAACC,kBAAmB,CAAA,EAAA,CAAG,CACxE,CAAA;AACD,IAAA,IAAI,CAAC,IAAI,CAACC,UAAU,EAAE;AAClBH,MAAAA,OAAO,CAACI,IAAI,CAAE,CAAA,kBAAA,EAAoB,IAAI,CAACT,IAAI,CAACM,YAAY,CAACC,kBAAmB,CAAA,EAAA,CAAG,CAAC,CAA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SAAA,EAAA,QAAA,CAAA,EAAAzD,MAAA,CAAAyD,SAAA,CAAAD,EAAAA,yBAAA,CAAAxD,MAAA,CAAAyD,SAAA,YAINO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAAyD,SAAA,EAAAzD,OAAAA,CAAAA,EAAAA,MAAA,CAAAyD,SAAA,CAAAD,EAAAA,yBAAA,CAAAxD,MAAA,CAAAyD,SAAA,EAAA,QAAA,EAAA,CAMNO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAAyD,SAAA,EAAAzD,QAAAA,CAAAA,EAAAA,MAAA,CAAAyD,SAAA,CAAAD,EAAAA,yBAAA,CAAAxD,MAAA,CAAAyD,SAAA,EAAA,yBAAA,EAAA,CAMNO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAlE,MAAA,CAAAyD,SAAA,EAAAzD,yBAAAA,CAAAA,EAAAA,MAAA,CAAAyD,SAAA,IAAAzD,MAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"notification-card.js","sources":["../../src/components/notification-card.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { inject as service } from '@ember/service';\nimport { htmlSafe } from '@ember/template';\nimport { later } from '@ember/runloop';\nimport { on } from '@ember/modifier';\nimport { fn, concat } from '@ember/helper';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport CloseButton from '@frontile/core/components/close-button';\nimport { cssTransition } from 'ember-css-transitions';\nimport { useStyles } from '@frontile/theme';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport type { CustomAction, containerPlacement } from '../-private/types';\nexport interface NotificationCardArgs {\n notification: Notification;\n placement: containerPlacement;\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */ spacing?: number;\n}\nexport interface NotificationCardSignature {\n Args: NotificationCardArgs;\n Element: HTMLDivElement;\n}\nexport default class NotificationCard extends Component<NotificationCardSignature> {\n @service\n notifications: NotificationsService;\n @tracked\n hasEntered = false;\n get styles(): unknown {\n const styles1 = [\n `transition-duration: ${this.args.notification.transitionDuration}ms`\n ];\n if (!this.hasEntered) {\n styles1.push(`transition-delay: ${this.args.notification.transitionDuration}ms`);\n }\n return htmlSafe(styles1.join('; '));\n }\n @action\n addSpacing(element1: HTMLElement): void {\n if (this.args.placement && this.args.placement.includes('top')) {\n element1.style.marginTop = `${this.args.spacing || 16}px`;\n }\n }\n @action\n transitionIn(element1: HTMLElement): void {\n const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n const expectedHeight1 = element1.offsetHeight + spacing1;\n const duration1 = this.args.notification.transitionDuration / 2;\n requestAnimationFrame(()=>{\n element1.style.height = '0';\n const transition1 = `height ${duration1}ms ease-in ${duration1}ms`;\n element1.style.transition = transition1;\n requestAnimationFrame(()=>{\n element1.style.height = `${expectedHeight1}px`;\n });\n });\n later(this, ()=>{\n this.hasEntered = true;\n }, this.args.notification.transitionDuration);\n }\n @action\n transitionOut(element1: HTMLElement, [isExiting1, ..._1]: boolean[]): void {\n if (isExiting1) {\n element1.style.height = '0';\n }\n }\n @action\n remove(): void {\n this.notifications.remove(this.args.notification);\n }\n @action\n pause(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.pause();\n }\n }\n @action\n resume(): void {\n if (this.args.notification.timer) {\n this.args.notification.timer.resume();\n }\n }\n @action\n handleClickCustomAction(customAction1: CustomAction): void {\n customAction1.onClick();\n this.remove();\n }\n get classes() {\n const { notificationCard: notificationCard1 } = useStyles();\n let { base: base1, message: message1, customActions: customActions1, customActionButton: customActionButton1, closeButton: closeButton1 } = notificationCard1({\n appearance: this.args.notification.appearance\n });\n return {\n base: base1(),\n message: message1(),\n customActions: customActions1(),\n customActionButton: customActionButton1(),\n closeButton: closeButton1()\n };\n }\n static{\n template(`\n {{! template-lint-disable no-invalid-interactive }}\n {{! template-lint-disable no-unnecessary-concat }}\n {{! template-lint-disable no-inline-styles }}\n {{! template-lint-disable style-concatenation }}\n <div\n {{didInsert this.transitionIn}}\n {{didUpdate this.transitionOut @notification.isRemoving}}\n >\n {{#unless @notification.isRemoving}}\n <div\n {{on \"mouseenter\" this.pause}}\n {{on \"mouseleave\" this.resume}}\n {{cssTransition\n (concat \"notification-transition--slide-from-\" @placement)\n isEnabled=true\n }}\n class={{this.classes.base}}\n style=\"{{this.styles}}\"\n ...attributes\n >\n <div class={{this.classes.message}}>\n {{@notification.message}}\n </div>\n\n {{#if @notification.customActions}}\n <div class={{this.classes.customActions}}>\n {{#each @notification.customActions as |customAction|}}\n <button\n type=\"button\"\n class={{this.classes.customActionButton}}\n {{on \"click\" (fn this.handleClickCustomAction customAction)}}\n >\n {{customAction.label}}\n </button>\n {{/each}}\n </div>\n {{/if}}\n\n {{#if @notification.allowClosing}}\n <CloseButton\n @onClick={{this.remove}}\n @size=\"sm\"\n @class={{this.classes.closeButton}}\n />\n {{/if}}\n </div>\n {{/unless}}\n </div>\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["NotificationCard","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","_descriptor2","styles","styles1","notification","transitionDuration","hasEntered","push","htmlSafe","join","addSpacing","element1","placement","includes","style","marginTop","spacing","transitionIn","spacing1","expectedHeight1","offsetHeight","duration1","requestAnimationFrame","height","transition1","transition","later","transitionOut","isExiting1","_1","remove","notifications","pause","timer","resume","handleClickCustomAction","customAction1","onClick","classes","notificationCard","notificationCard1","useStyles","base","base1","message","message1","customActions","customActions1","customActionButton","customActionButton1","closeButton","closeButton1","appearance","setComponentTemplate","precompileTemplate","scope","didInsert","didUpdate","on","cssTransition","concat","fn","CloseButton","strictMode","_applyDecoratedDescriptor","prototype","service","configurable","enumerable","writable","initializer","tracked","action","Object","getOwnPropertyDescriptor"],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CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAhF,MAAA,CAAAuE,SAAA,EAAA,QAAA,CAAA,EAAAvE,MAAA,CAAAuE,SAAA,CAAAD,EAAAA,yBAAA,CAAAtE,MAAA,CAAAuE,SAAA,YAINO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAhF,MAAA,CAAAuE,SAAA,EAAAvE,OAAAA,CAAAA,EAAAA,MAAA,CAAAuE,SAAA,CAAAD,EAAAA,yBAAA,CAAAtE,MAAA,CAAAuE,SAAA,EAAA,QAAA,EAAA,CAMNO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAhF,MAAA,CAAAuE,SAAA,EAAAvE,QAAAA,CAAAA,EAAAA,MAAA,CAAAuE,SAAA,CAAAD,EAAAA,yBAAA,CAAAtE,MAAA,CAAAuE,SAAA,EAAA,yBAAA,EAAA,CAMNO,MAAM,CAAA,EAAAC,MAAA,CAAAC,wBAAA,CAAAhF,MAAA,CAAAuE,SAAA,EAAAvE,yBAAAA,CAAAA,EAAAA,MAAA,CAAAuE,SAAA,IAAAvE,MAAA;;;;"}
|
|
@@ -7,8 +7,8 @@ import { inject } from '@ember/service';
|
|
|
7
7
|
import { action } from '@ember/object';
|
|
8
8
|
import didUpdate from '@ember/render-modifiers/modifiers/did-update';
|
|
9
9
|
import didInsert from '@ember/render-modifiers/modifiers/did-insert';
|
|
10
|
-
import useFrontileClass from '@frontile/core/helpers/use-frontile-class';
|
|
11
10
|
import NotificationCard from './notification-card.js';
|
|
11
|
+
import { useStyles } from '@frontile/theme';
|
|
12
12
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
13
13
|
import { setComponentTemplate } from '@ember/component';
|
|
14
14
|
|
|
@@ -28,15 +28,23 @@ let NotificationsContainer = (_class = (_class2 = class NotificationsContainer e
|
|
|
28
28
|
return this.notifications.notifications;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
get classes() {
|
|
32
|
+
const {
|
|
33
|
+
notificationsContainer: notificationsContainer1
|
|
34
|
+
} = useStyles();
|
|
35
|
+
return notificationsContainer1({
|
|
36
|
+
placement: this.args.placement,
|
|
37
|
+
class: this.args.class
|
|
38
|
+
});
|
|
39
|
+
}
|
|
31
40
|
addSpacing(element1) {
|
|
32
41
|
const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;
|
|
33
42
|
if (this.isTopPlacement) {
|
|
34
43
|
element1.style.marginTop = `${spacing1}px`;
|
|
35
44
|
}
|
|
36
45
|
}
|
|
37
|
-
}, setComponentTemplate(precompileTemplate("\n {{#if this.sortedNotifications}}\n <div {{didInsert this.addSpacing}} {{didUpdate this.addSpacing @spacing @placement}} class={{
|
|
46
|
+
}, setComponentTemplate(precompileTemplate("\n {{#if this.sortedNotifications}}\n <div {{didInsert this.addSpacing}} {{didUpdate this.addSpacing @spacing @placement}} class={{this.classes}} role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" ...attributes>\n {{#each this.sortedNotifications as |notification|}}\n <NotificationCard @spacing={{@spacing}} @placement={{if @placement @placement \"bottom-right\"}} @notification={{notification}} />\n {{/each}}\n </div>\n {{/if}}\n ", {
|
|
38
47
|
scope: () => ({
|
|
39
|
-
useFrontileClass,
|
|
40
48
|
didInsert,
|
|
41
49
|
didUpdate,
|
|
42
50
|
NotificationCard
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications-container.js","sources":["../../src/components/notifications-container.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport
|
|
1
|
+
{"version":3,"file":"notifications-container.js","sources":["../../src/components/notifications-container.gts"],"sourcesContent":["import { template } from \"@ember/template-compiler\";\nimport Component from '@glimmer/component';\nimport { inject as service } from '@ember/service';\nimport { action } from '@ember/object';\nimport didUpdate from '@ember/render-modifiers/modifiers/did-update';\nimport didInsert from '@ember/render-modifiers/modifiers/did-insert';\nimport NotificationCard from './notification-card';\nimport type NotificationsService from '../services/notifications';\nimport type Notification from '../-private/notification';\nimport { type containerPlacement } from '../-private/types';\nimport { useStyles } from '@frontile/theme';\nexport interface NotificationsContainerArgs {\n /**\n * The placement of the notifications\n *\n * @defaultValue 'bottom-right'\n */ placement?: containerPlacement;\n /**\n * Spacing for each notification, in px.\n *\n * @defaultValue 16\n */ spacing?: number;\n /**\n * Custom class name, it will override the default ones using Tailwind Merge library.\n */ class?: string;\n}\nexport interface NotificationsContainerSignature {\n Args: NotificationsContainerArgs;\n Element: HTMLDivElement;\n}\nexport default class NotificationsContainer extends Component<NotificationsContainerSignature> {\n @service\n notifications: NotificationsService;\n get isTopPlacement(): boolean {\n return !!(this.args.placement && this.args.placement.includes('top'));\n }\n get sortedNotifications(): Notification[] {\n if (this.isTopPlacement) {\n return this.notifications.notifications.slice().reverse();\n } else {\n return this.notifications.notifications;\n }\n }\n get classes() {\n const { notificationsContainer: notificationsContainer1 } = useStyles();\n return notificationsContainer1({\n placement: this.args.placement,\n class: this.args.class\n });\n }\n @action\n addSpacing(element1: HTMLElement): void {\n const spacing1 = typeof this.args.spacing === 'undefined' ? 16 : this.args.spacing;\n if (this.isTopPlacement) {\n element1.style.marginTop = `${spacing1}px`;\n }\n }\n static{\n template(`\n {{#if this.sortedNotifications}}\n <div\n {{didInsert this.addSpacing}}\n {{didUpdate this.addSpacing @spacing @placement}}\n class={{this.classes}}\n role=\"alert\"\n aria-live=\"assertive\"\n aria-atomic=\"true\"\n ...attributes\n >\n {{#each this.sortedNotifications as |notification|}}\n <NotificationCard\n @spacing={{@spacing}}\n @placement={{if @placement @placement \"bottom-right\"}}\n @notification={{notification}}\n />\n {{/each}}\n </div>\n {{/if}}\n `, {\n component: this,\n eval () {\n return eval(arguments[0]);\n }\n });\n }\n}\n"],"names":["NotificationsContainer","_class","_class2","Component","constructor","args","_initializerDefineProperty","_descriptor","isTopPlacement","placement","includes","sortedNotifications","notifications","slice","reverse","classes","notificationsContainer","notificationsContainer1","useStyles","class","addSpacing","element1","spacing1","spacing","style","marginTop","setComponentTemplate","precompileTemplate","scope","didInsert","didUpdate","NotificationCard","strictMode","_applyDecoratedDescriptor","prototype","service","configurable","enumerable","writable","initializer","action","Object","getOwnPropertyDescriptor"],"mappings":";;;;;;;;;;;;;;;AA8BqBA,IAAAA,sBAAsB,IAAAC,MAAA,IAAAC,OAAA,GAA5B,MAAMF,sBAAsB,SAASG,SAAS,CAAkC;AAAAC,EAAAA,WAAAA,CAAA,GAAAC,IAAA,EAAA;AAAA,IAAA,KAAA,CAAA,GAAAA,IAAA,CAAA,CAAA;AAAAC,IAAAA,0BAAA,wBAAAC,WAAA,EAAA,IAAA,CAAA,CAAA;AAAA,GAAA;EAG3F,IAAIC,cAAcA,GAAY;AAC1B,IAAA,OAAO,CAAC,EAAE,IAAI,CAACH,IAAI,CAACI,SAAS,IAAI,IAAI,CAACJ,IAAI,CAACI,SAAS,CAACC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAA;AACzE,GAAA;EACA,IAAIC,mBAAmBA,GAAmB;IACtC,IAAI,IAAI,CAACH,cAAc,EAAE;AACrB,MAAA,OAAO,IAAI,CAACI,aAAa,CAACA,aAAa,CAACC,KAAK,EAAE,CAACC,OAAO,EAAE,CAAA;AAC7D,KAAC,MAAM;AACH,MAAA,OAAO,IAAI,CAACF,aAAa,CAACA,aAAa,CAAA;AAC3C,KAAA;AACJ,GAAA;EACA,IAAIG,OAAOA,GAAG;IACV,MAAM;AAAEC,MAAAA,sBAAsB,EAAEC,uBAAAA;KAAyB,GAAGC,SAAS,EAAE,CAAA;AACvE,IAAA,OAAOD,uBAAuB,CAAC;AAC3BR,MAAAA,SAAS,EAAE,IAAI,CAACJ,IAAI,CAACI,SAAS;AAC9BU,MAAAA,KAAK,EAAE,IAAI,CAACd,IAAI,CAACc,KAAAA;AACrB,KAAC,CAAC,CAAA;AACN,GAAA;EAEAC,UAAUA,CAACC,QAAqB,EAAQ;AACpC,IAAA,MAAMC,QAAQ,GAAG,OAAO,IAAI,CAACjB,IAAI,CAACkB,OAAO,KAAK,WAAW,GAAG,EAAE,GAAG,IAAI,CAAClB,IAAI,CAACkB,OAAO,CAAA;IAClF,IAAI,IAAI,CAACf,cAAc,EAAE;AACrBa,MAAAA,QAAQ,CAACG,KAAK,CAACC,SAAS,GAAI,CAAA,EAAEH,QAAS,CAAG,EAAA,CAAA,CAAA;AAC9C,KAAA;AACJ,GAAA;AA6BJ,CAAC,EAAAI,oBAAA,CA3BOC,kBAAA,CAoBH,oeAAA,EAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,SAAA;IAAAC,SAAA;AAAAC,IAAAA,gBAAAA;AAAA,GAAA,CAAA;EAAAC,UAAA,EAAA,IAAA;AAKG,CAAC,CAAC,EAAA9B,OAAA,CAAA,EAAAA,OAAA,CAAAK,GAAAA,WAAA,GAAA0B,yBAAA,CAAAhC,MAAA,CAAAiC,SAAA,oBApDLC,MAAO,CAAA,EAAA;EAAAC,YAAA,EAAA,IAAA;EAAAC,UAAA,EAAA,IAAA;EAAAC,QAAA,EAAA,IAAA;EAAAC,WAAA,EAAA,IAAA;AAAA,CAAAN,CAAAA,EAAAA,yBAAA,CAAAhC,MAAA,CAAAiC,SAAA,EAmBPM,YAAAA,EAAAA,CAAAA,MAAM,GAAAC,MAAA,CAAAC,wBAAA,CAAAzC,MAAA,CAAAiC,SAAA,EAAA,YAAA,CAAA,EAAAjC,MAAA,CAAAiC,SAAA,IAAAjC,MAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontile/notifications",
|
|
3
|
-
"version": "0.16.1",
|
|
3
|
+
"version": "0.16.3-0.17.0-beta.1.0",
|
|
4
4
|
"description": "Component Library for Ember Octane apps: Notifications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon",
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"addon-main.js",
|
|
18
18
|
"declarations",
|
|
19
|
-
"dist"
|
|
20
|
-
"tailwind"
|
|
19
|
+
"dist"
|
|
21
20
|
],
|
|
22
21
|
"scripts": {
|
|
23
22
|
"build": "concurrently -m 1 'npm:build:*'",
|
|
@@ -43,8 +42,8 @@
|
|
|
43
42
|
"dependencies": {
|
|
44
43
|
"@ember/render-modifiers": "^2.1.0",
|
|
45
44
|
"@embroider/addon-shim": "^1.8.7",
|
|
46
|
-
"@frontile/core": "^0.16.1",
|
|
47
|
-
"@frontile/
|
|
45
|
+
"@frontile/core": "^0.16.3-0.17.0-beta.1.0",
|
|
46
|
+
"@frontile/theme": "^0.16.3-0.17.0-beta.1.0",
|
|
48
47
|
"ember-auto-import": "^2.6.3",
|
|
49
48
|
"ember-css-transitions": "^4.4.0",
|
|
50
49
|
"ember-get-config": "^2.1.1"
|
|
@@ -57,6 +56,8 @@
|
|
|
57
56
|
"@babel/preset-typescript": "7.23.3",
|
|
58
57
|
"@embroider/addon-dev": "4.1.3",
|
|
59
58
|
"@embroider/addon-shim": "^1.8.6",
|
|
59
|
+
"@glimmer/component": "^1.1.2",
|
|
60
|
+
"@glimmer/tracking": "^1.1.2",
|
|
60
61
|
"@glint/core": "1.2.1",
|
|
61
62
|
"@glint/environment-ember-loose": "1.2.1",
|
|
62
63
|
"@glint/environment-ember-template-imports": "1.2.1",
|
|
@@ -99,13 +100,7 @@
|
|
|
99
100
|
"types": "./declarations/*.d.ts",
|
|
100
101
|
"default": "./dist/*.js"
|
|
101
102
|
},
|
|
102
|
-
"./addon-main.js": "./addon-main.js"
|
|
103
|
-
"./tailwind": {
|
|
104
|
-
"default": "./tailwind/index.js"
|
|
105
|
-
},
|
|
106
|
-
"./tailwind/*": {
|
|
107
|
-
"default": "./tailwind/*.js"
|
|
108
|
-
}
|
|
103
|
+
"./addon-main.js": "./addon-main.js"
|
|
109
104
|
},
|
|
110
105
|
"typesVersions": {
|
|
111
106
|
"*": {
|
|
@@ -114,5 +109,5 @@
|
|
|
114
109
|
]
|
|
115
110
|
}
|
|
116
111
|
},
|
|
117
|
-
"gitHead": "
|
|
112
|
+
"gitHead": "8019dc38f7c307dbbdd4dd41e89cd1dce378b0b1"
|
|
118
113
|
}
|
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
const defaultTheme = require('tailwindcss/resolveConfig')(
|
|
2
|
-
require('tailwindcss/defaultConfig')
|
|
3
|
-
).theme;
|
|
4
|
-
|
|
5
|
-
const defaultConfig = {
|
|
6
|
-
textColor: defaultTheme.colors.white,
|
|
7
|
-
zIndex: 1000,
|
|
8
|
-
info: {
|
|
9
|
-
color: defaultTheme.colors.gray[900],
|
|
10
|
-
buttonHoverColor: defaultTheme.colors.gray[800]
|
|
11
|
-
},
|
|
12
|
-
success: {
|
|
13
|
-
color: defaultTheme.colors.blue[700],
|
|
14
|
-
buttonHoverColor: defaultTheme.colors.blue[800]
|
|
15
|
-
},
|
|
16
|
-
warning: {
|
|
17
|
-
color: defaultTheme.colors.yellow[600],
|
|
18
|
-
buttonHoverColor: defaultTheme.colors.yellow[700]
|
|
19
|
-
},
|
|
20
|
-
error: {
|
|
21
|
-
color: defaultTheme.colors.red[600],
|
|
22
|
-
buttonHoverColor: defaultTheme.colors.red[700]
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
function generateAppearance({ color, buttonHoverColor }) {
|
|
27
|
-
return {
|
|
28
|
-
baseStyle: {
|
|
29
|
-
backgroundColor: color
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
parts: {
|
|
33
|
-
closeBtn: {
|
|
34
|
-
'&:hover': {
|
|
35
|
-
backgroundColor: buttonHoverColor
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
customActionBtn: {
|
|
40
|
-
'&:hover': {
|
|
41
|
-
backgroundColor: buttonHoverColor
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function defaultOptions({ config }) {
|
|
49
|
-
const btnShared = {
|
|
50
|
-
transitionProperty: defaultTheme.transitionProperty.DEFAULT,
|
|
51
|
-
transitionDuration: defaultTheme.transitionDuration[200],
|
|
52
|
-
|
|
53
|
-
'&.focus-visible:focus': {
|
|
54
|
-
outline: 'none',
|
|
55
|
-
boxShadow: defaultTheme.boxShadow.outline
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const notificationEnteringFrom = {
|
|
60
|
-
right: {
|
|
61
|
-
transform: 'translate3d(125%, 0, 0)'
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
left: {
|
|
65
|
-
transform: 'translate3d(-125%, 0, 0)'
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
top: {
|
|
69
|
-
transform: 'translate3d(0, -125%, 0)'
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
bottom: {
|
|
73
|
-
transform: 'translate3d(0, 125%, 0)'
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const zoomOut = {
|
|
78
|
-
leaveTo: {
|
|
79
|
-
transform: 'scale(0.80)',
|
|
80
|
-
opacity: 0
|
|
81
|
-
},
|
|
82
|
-
leave: {
|
|
83
|
-
transform: 'translate3d(0,0,0)'
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
container: {
|
|
89
|
-
baseStyle: {
|
|
90
|
-
width: '100%',
|
|
91
|
-
maxHeight: '100%',
|
|
92
|
-
overflow: 'hidden',
|
|
93
|
-
paddingLeft: defaultTheme.padding[4],
|
|
94
|
-
paddingRight: defaultTheme.padding[4],
|
|
95
|
-
position: 'fixed',
|
|
96
|
-
zIndex: config.zIndex,
|
|
97
|
-
maxWidth: defaultTheme.maxWidth.lg
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
variants: {
|
|
101
|
-
topLeft: {
|
|
102
|
-
top: 0,
|
|
103
|
-
left: 0
|
|
104
|
-
},
|
|
105
|
-
topCenter: {
|
|
106
|
-
top: 0,
|
|
107
|
-
left: '50%',
|
|
108
|
-
transform: 'translateX(-50%)'
|
|
109
|
-
},
|
|
110
|
-
topRight: {
|
|
111
|
-
top: 0,
|
|
112
|
-
right: 0
|
|
113
|
-
},
|
|
114
|
-
bottomLeft: {
|
|
115
|
-
bottom: 0,
|
|
116
|
-
left: 0
|
|
117
|
-
},
|
|
118
|
-
bottomCenter: {
|
|
119
|
-
bottom: 0,
|
|
120
|
-
left: '50%',
|
|
121
|
-
transform: 'translateX(-50%)'
|
|
122
|
-
},
|
|
123
|
-
bottomRight: {
|
|
124
|
-
bottom: 0,
|
|
125
|
-
right: 0
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
card: {
|
|
130
|
-
baseStyle: {
|
|
131
|
-
transitionProperty: defaultTheme.transitionProperty.all,
|
|
132
|
-
transitionDuration: defaultTheme.transitionDuration[200],
|
|
133
|
-
transitionTimingFunction:
|
|
134
|
-
defaultTheme.transitionTimingFunction['in-out'],
|
|
135
|
-
color: config.textColor,
|
|
136
|
-
fontSize: defaultTheme.fontSize.sm[0],
|
|
137
|
-
borderRadius: defaultTheme.borderRadius.DEFAULT,
|
|
138
|
-
boxShadow: defaultTheme.boxShadow.DEFAULT,
|
|
139
|
-
position: 'relative',
|
|
140
|
-
display: 'flex',
|
|
141
|
-
justifyContent: 'space-between',
|
|
142
|
-
alignItems: 'center',
|
|
143
|
-
minHeight: defaultTheme.height[16],
|
|
144
|
-
overflow: 'hidden',
|
|
145
|
-
paddingTop: defaultTheme.padding[3],
|
|
146
|
-
paddingBottom: defaultTheme.padding[3],
|
|
147
|
-
paddingRight: defaultTheme.padding[4],
|
|
148
|
-
paddingLeft: defaultTheme.padding[4]
|
|
149
|
-
},
|
|
150
|
-
|
|
151
|
-
variants: {
|
|
152
|
-
info: generateAppearance(config.info),
|
|
153
|
-
success: generateAppearance(config.success),
|
|
154
|
-
warning: generateAppearance(config.warning),
|
|
155
|
-
error: generateAppearance(config.error)
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
parts: {
|
|
159
|
-
message: {
|
|
160
|
-
flexGrow: 1
|
|
161
|
-
},
|
|
162
|
-
closeBtn: {
|
|
163
|
-
display: 'inline-block',
|
|
164
|
-
padding: defaultTheme.spacing[2],
|
|
165
|
-
marginLeft: defaultTheme.spacing[2],
|
|
166
|
-
marginRight: `-${defaultTheme.spacing[2]}`,
|
|
167
|
-
borderRadius: defaultTheme.borderRadius.full,
|
|
168
|
-
fontSize: 'inherit'
|
|
169
|
-
},
|
|
170
|
-
customActions: {
|
|
171
|
-
display: 'flex',
|
|
172
|
-
flexWrap: 'nowrap'
|
|
173
|
-
},
|
|
174
|
-
customActionBtn: {
|
|
175
|
-
fontWeight: defaultTheme.fontWeight.semibold,
|
|
176
|
-
paddingTop: defaultTheme.spacing[1],
|
|
177
|
-
paddingBottom: defaultTheme.spacing[1],
|
|
178
|
-
paddingLeft: defaultTheme.spacing[2],
|
|
179
|
-
paddingRight: defaultTheme.spacing[2],
|
|
180
|
-
borderRadius: defaultTheme.borderRadius.DEFAULT,
|
|
181
|
-
...btnShared,
|
|
182
|
-
|
|
183
|
-
'&:first-child': {
|
|
184
|
-
marginLeft: defaultTheme.spacing[4]
|
|
185
|
-
},
|
|
186
|
-
'&:last-child': {
|
|
187
|
-
marginRight: `-${defaultTheme.spacing[2]}`
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
},
|
|
192
|
-
transitions: {
|
|
193
|
-
slideFromTopLeft: {
|
|
194
|
-
...zoomOut,
|
|
195
|
-
enter: {
|
|
196
|
-
...notificationEnteringFrom.left
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
slideFromTopCenter: {
|
|
200
|
-
...zoomOut,
|
|
201
|
-
enter: notificationEnteringFrom.top
|
|
202
|
-
},
|
|
203
|
-
slideFromTopRight: {
|
|
204
|
-
...zoomOut,
|
|
205
|
-
enter: notificationEnteringFrom.right
|
|
206
|
-
},
|
|
207
|
-
slideFromBottomLeft: {
|
|
208
|
-
...zoomOut,
|
|
209
|
-
enter: notificationEnteringFrom.left
|
|
210
|
-
},
|
|
211
|
-
slideFromBottomCenter: {
|
|
212
|
-
...zoomOut,
|
|
213
|
-
enter: notificationEnteringFrom.bottom
|
|
214
|
-
},
|
|
215
|
-
slideFromBottomRight: {
|
|
216
|
-
...zoomOut,
|
|
217
|
-
enter: notificationEnteringFrom.right
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
module.exports = {
|
|
224
|
-
defaultConfig,
|
|
225
|
-
defaultOptions
|
|
226
|
-
};
|
package/tailwind/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const plugin = require('tailwindcss/plugin');
|
|
2
|
-
const {
|
|
3
|
-
resolveComponents,
|
|
4
|
-
addSinglePartComponent,
|
|
5
|
-
addMultipartComponent,
|
|
6
|
-
addTransitions
|
|
7
|
-
} = require('@frontile/tailwindcss-plugin-helpers');
|
|
8
|
-
|
|
9
|
-
module.exports = plugin.withOptions(function () {
|
|
10
|
-
return function ({ addComponents, theme }) {
|
|
11
|
-
const { components } = resolveComponents(
|
|
12
|
-
theme('frontile.notifications') || {},
|
|
13
|
-
require('./default-options')
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
addSinglePartComponent(
|
|
17
|
-
addComponents,
|
|
18
|
-
'.notifications-container',
|
|
19
|
-
components.container
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
addMultipartComponent(addComponents, '.notification-card', components.card);
|
|
23
|
-
|
|
24
|
-
addTransitions(
|
|
25
|
-
addComponents,
|
|
26
|
-
'.notification-transition',
|
|
27
|
-
components.transitions
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
});
|