@websline/system-components 1.3.24 → 1.3.26

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.
Files changed (31) hide show
  1. package/dist/components/atoms/actions/closeButton/closeButton.variants.js +3 -3
  2. package/dist/components/atoms/actions/iconButton/IconButton.svelte +1 -1
  3. package/dist/components/atoms/actions/iconButton/IconButton.svelte.d.ts +2 -2
  4. package/dist/components/atoms/actions/iconButton/iconButton.variants.js +2 -2
  5. package/dist/components/atoms/input/input.variants.js +3 -3
  6. package/dist/components/atoms/select/Select.svelte +38 -19
  7. package/dist/components/atoms/select/Select.svelte.d.ts +8 -0
  8. package/dist/components/atoms/select/select.variants.d.ts +6 -1
  9. package/dist/components/atoms/select/select.variants.js +17 -12
  10. package/dist/components/molecules/{notification/Notification.svelte → notifications/systemAlert/SystemAlert.svelte} +8 -8
  11. package/dist/components/molecules/notifications/systemAlert/SystemAlert.svelte.d.ts +57 -0
  12. package/dist/components/molecules/{notification/notification.variants.d.ts → notifications/systemAlert/systemAlert.variants.d.ts} +4 -4
  13. package/dist/components/molecules/{notification/notification.variants.js → notifications/systemAlert/systemAlert.variants.js} +6 -6
  14. package/dist/components/molecules/notifications/toast/Toast.svelte +51 -0
  15. package/dist/components/molecules/notifications/toast/Toast.svelte.d.ts +49 -0
  16. package/dist/components/molecules/notifications/toast/toast.variants.d.ts +31 -0
  17. package/dist/components/molecules/notifications/toast/toast.variants.js +18 -0
  18. package/dist/components/molecules/toggleGroup/ToggleGroupItem.svelte +25 -26
  19. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.d.ts +15 -45
  20. package/dist/components/molecules/toggleGroup/toggleGroupItem.variants.js +12 -25
  21. package/dist/components/organisms/notificationGroup/NotificationGroup.svelte +71 -39
  22. package/dist/components/organisms/notificationGroup/NotificationGroup.svelte.d.ts +13 -2
  23. package/dist/components/organisms/notificationGroup/notificationGroup.variants.d.ts +72 -17
  24. package/dist/components/organisms/notificationGroup/notificationGroup.variants.js +14 -4
  25. package/dist/index.css +9 -1
  26. package/dist/index.d.ts +2 -1
  27. package/dist/index.js +2 -1
  28. package/dist/utils/notification.d.ts +6 -1
  29. package/dist/utils/notification.js +18 -4
  30. package/package.json +23 -24
  31. package/dist/components/molecules/notification/Notification.svelte.d.ts +0 -57
@@ -1,161 +1,131 @@
1
1
  export const toggleGroupItemVariants: import("tailwind-variants").TVReturnType<{
2
2
  isActive: {
3
3
  true: {
4
- button: string;
4
+ base: string;
5
5
  };
6
6
  false: {
7
- button: string;
7
+ base: string;
8
8
  };
9
9
  };
10
10
  size: {
11
- small: {
12
- button: string;
13
- };
14
11
  medium: {
15
- button: string;
16
- span: string;
12
+ content: string;
17
13
  };
18
14
  };
19
15
  width: {
20
16
  full: {
21
17
  base: string;
22
- button: string;
23
18
  };
24
19
  };
25
20
  }, {
26
21
  base: string;
27
- button: string;
28
22
  content: string;
29
23
  icon: string;
30
- span: string;
31
24
  trigger: string;
32
25
  }, undefined, {
33
26
  isActive: {
34
27
  true: {
35
- button: string;
28
+ base: string;
36
29
  };
37
30
  false: {
38
- button: string;
31
+ base: string;
39
32
  };
40
33
  };
41
34
  size: {
42
- small: {
43
- button: string;
44
- };
45
35
  medium: {
46
- button: string;
47
- span: string;
36
+ content: string;
48
37
  };
49
38
  };
50
39
  width: {
51
40
  full: {
52
41
  base: string;
53
- button: string;
54
42
  };
55
43
  };
56
44
  }, {
57
45
  base: string;
58
- button: string;
59
46
  content: string;
60
47
  icon: string;
61
- span: string;
62
48
  trigger: string;
63
49
  }, import("tailwind-variants").TVReturnType<{
64
50
  isActive: {
65
51
  true: {
66
- button: string;
52
+ base: string;
67
53
  };
68
54
  false: {
69
- button: string;
55
+ base: string;
70
56
  };
71
57
  };
72
58
  size: {
73
- small: {
74
- button: string;
75
- };
76
59
  medium: {
77
- button: string;
78
- span: string;
60
+ content: string;
79
61
  };
80
62
  };
81
63
  width: {
82
64
  full: {
83
65
  base: string;
84
- button: string;
85
66
  };
86
67
  };
87
68
  }, {
88
69
  base: string;
89
- button: string;
90
70
  content: string;
91
71
  icon: string;
92
- span: string;
93
72
  trigger: string;
94
73
  }, undefined, unknown, unknown, undefined>>;
95
74
  export const toggleGroupItemTabVariants: import("tailwind-variants").TVReturnType<{
96
75
  isActive: {
97
76
  true: {
98
- button: string;
77
+ base: string;
99
78
  };
100
79
  false: {
101
- button: string;
80
+ base: string;
102
81
  };
103
82
  };
104
83
  width: {
105
84
  full: {
106
85
  base: string;
107
- button: string;
108
86
  };
109
87
  };
110
88
  }, {
111
89
  base: string;
112
- button: string;
113
90
  content: string;
114
91
  icon: string;
115
- span: string;
116
92
  trigger: string;
117
93
  }, undefined, {
118
94
  isActive: {
119
95
  true: {
120
- button: string;
96
+ base: string;
121
97
  };
122
98
  false: {
123
- button: string;
99
+ base: string;
124
100
  };
125
101
  };
126
102
  width: {
127
103
  full: {
128
104
  base: string;
129
- button: string;
130
105
  };
131
106
  };
132
107
  }, {
133
108
  base: string;
134
- button: string;
135
109
  content: string;
136
110
  icon: string;
137
- span: string;
138
111
  trigger: string;
139
112
  }, import("tailwind-variants").TVReturnType<{
140
113
  isActive: {
141
114
  true: {
142
- button: string;
115
+ base: string;
143
116
  };
144
117
  false: {
145
- button: string;
118
+ base: string;
146
119
  };
147
120
  };
148
121
  width: {
149
122
  full: {
150
123
  base: string;
151
- button: string;
152
124
  };
153
125
  };
154
126
  }, {
155
127
  base: string;
156
- button: string;
157
128
  content: string;
158
129
  icon: string;
159
- span: string;
160
130
  trigger: string;
161
131
  }, undefined, unknown, unknown, undefined>>;
@@ -2,36 +2,28 @@ import { tv } from "../../../utils/tailwind.js";
2
2
 
3
3
  const toggleGroupItemVariants = tv({
4
4
  slots: {
5
- base: "relative h-full whitespace-nowrap",
6
- button:
7
- "block h-full cursor-pointer rounded-sm bg-transparent ui-select-label font-medium transition-[background,color]",
8
- content: "relative z-2 flex items-center justify-center",
9
- icon: "shrink-0",
10
- span: "",
5
+ base: "relative inline-flex h-full cursor-pointer items-center justify-center rounded-sm bg-transparent px-1 ui-select-label font-medium whitespace-nowrap transition-[background,color]",
6
+ content: "relative z-2",
7
+ icon: "relative z-2 shrink-0",
11
8
  trigger: "absolute inset-0 z-1 rounded-sm bg-white shadow-sm",
12
9
  },
13
10
  variants: {
14
11
  isActive: {
15
12
  true: {
16
- button: "text-neutral-900 dark:text-neutral-200",
13
+ base: "text-neutral-900 dark:text-neutral-200",
17
14
  },
18
15
  false: {
19
- button: "text-neutral-500",
16
+ base: "text-neutral-500",
20
17
  },
21
18
  },
22
19
  size: {
23
- small: {
24
- button: "px-1",
25
- },
26
20
  medium: {
27
- button: "px-2.5",
28
- span: "px-2",
21
+ content: "px-2",
29
22
  },
30
23
  },
31
24
  width: {
32
25
  full: {
33
26
  base: "w-full",
34
- button: "w-full",
35
27
  },
36
28
  },
37
29
  },
@@ -39,16 +31,14 @@ const toggleGroupItemVariants = tv({
39
31
  {
40
32
  appearance: "default",
41
33
  class: {
42
- button:
43
- "hover:bg-neutral-300 hover:text-neutral-900 dark:hover:bg-neutral-600 dark:hover:text-white",
34
+ base: "hover:bg-neutral-300 hover:text-neutral-900 dark:hover:bg-neutral-600 dark:hover:text-white",
44
35
  trigger: "dark:bg-neutral-700",
45
36
  },
46
37
  },
47
38
  {
48
39
  appearance: "raised",
49
40
  class: {
50
- button:
51
- "hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-600 dark:hover:text-white",
41
+ base: "hover:bg-neutral-100 hover:text-neutral-900 dark:hover:bg-neutral-600 dark:hover:text-white",
52
42
  trigger: "dark:bg-neutral-800",
53
43
  },
54
44
  },
@@ -57,26 +47,23 @@ const toggleGroupItemVariants = tv({
57
47
 
58
48
  const toggleGroupItemTabVariants = tv({
59
49
  slots: {
60
- base: "relative h-full whitespace-nowrap text-neutral-900 dark:text-neutral-200",
61
- button: "h-full cursor-pointer ui-button-default transition-[color]",
62
- content: "flex items-center justify-center gap-1",
50
+ base: "relative inline-flex h-full cursor-pointer items-center justify-center gap-1 ui-button-default whitespace-nowrap transition-[color]",
51
+ content: "",
63
52
  icon: "shrink-0",
64
- span: "",
65
53
  trigger: "absolute -bottom-px left-0 h-0.5 w-full rounded-t-xs bg-current",
66
54
  },
67
55
  variants: {
68
56
  isActive: {
69
57
  true: {
70
- button: "text-current",
58
+ base: "text-neutral-900 dark:text-neutral-200",
71
59
  },
72
60
  false: {
73
- button: "text-neutral-500 hover:text-current",
61
+ base: "text-neutral-500 hover:text-neutral-900 dark:hover:text-neutral-200",
74
62
  },
75
63
  },
76
64
  width: {
77
65
  full: {
78
66
  base: "w-full",
79
- button: "w-full",
80
67
  },
81
68
  },
82
69
  },
@@ -1,68 +1,100 @@
1
1
  <script>
2
- import { onMount } from "svelte";
3
- import { fly } from "svelte/transition";
2
+ import { settled } from "svelte";
4
3
  import { cubicOut } from "svelte/easing";
5
- import { Notification } from "../../../index.js";
4
+ import { fly } from "svelte/transition";
5
+ import { SvelteMap } from "svelte/reactivity";
6
+ import { NOTIFICATION_POSITIONS } from "../../../utils/notification.js";
6
7
  import { notificationGroupVariants } from "./notificationGroup.variants.js";
7
8
 
8
- onMount(() => {
9
- document.body.addEventListener("notification:show", addNotification);
9
+ const MOVE_MS = 400;
10
+ const IN_MS = 220;
11
+ const STAGGER = MOVE_MS - 200;
10
12
 
11
- return () => {
12
- document.body.removeEventListener("notification:show", addNotification);
13
- };
14
- });
13
+ /**
14
+ * @typedef {Object} Props
15
+ * @property {string} [class=""] Additional CSS classes to apply to each notification column
16
+ */
15
17
 
16
- const addNotification = (e) => {
17
- const { detail } = e;
18
+ /** @type {Props} */
19
+ let { class: className = "" } = $props();
18
20
 
19
- if (detail.position === "bottom-left") {
20
- dataBottomLeft.push(detail);
21
- } else if (detail.position === "bottom-right") {
22
- dataBottomRight.push(detail);
21
+ let data = new SvelteMap();
22
+ let showColumns = $state(false);
23
+
24
+ const zPoints = {};
25
+ let zOrder = $state([]);
26
+
27
+ let styles = $derived(notificationGroupVariants());
28
+
29
+ const handleShow = async (e) => {
30
+ if (!showColumns) {
31
+ showColumns = true;
32
+ await settled();
23
33
  }
34
+
35
+ const { detail } = e;
36
+ data.set(detail.id, detail);
37
+
38
+ updateZOrder(detail.position);
24
39
  };
25
40
 
26
- let dataBottomLeft = $state([]);
27
- let dataBottomRight = $state([]);
41
+ const handleClose = (id) => {
42
+ data.delete(id);
43
+ };
28
44
 
29
- let { bottomLeft, bottomRight } = $derived(notificationGroupVariants());
45
+ const handleLastClose = () => {
46
+ showColumns = false;
47
+ };
30
48
 
31
- const MOVE_MS = 400;
32
- const IN_MS = 220;
33
- const STAGGER = MOVE_MS - 200;
49
+ // ensure the column with the latest update is on top
50
+ const updateZOrder = (topPosition) => {
51
+ zPoints[topPosition] = Date.now();
34
52
 
35
- const handleClose = (id, position) => {
36
- if (position === "bottom-left") {
37
- const index = dataBottomLeft.findIndex((n) => n.id === id);
38
- if (index !== -1) dataBottomLeft.splice(index, 1);
39
- } else if (position === "bottom-right") {
40
- const index = dataBottomRight.findIndex((n) => n.id === id);
41
- if (index !== -1) dataBottomRight.splice(index, 1);
42
- }
53
+ zOrder = Object.entries(zPoints)
54
+ .sort(([, aTs], [, bTs]) => aTs - bTs)
55
+ .map(([key]) => key);
43
56
  };
44
57
  </script>
45
58
 
46
- {#each [{ data: dataBottomLeft, class: bottomLeft(), x: -32, position: "bottom-left" }, { data: dataBottomRight, class: bottomRight(), x: 32, position: "bottom-right" }] as { data, class: cls, x, position }, idx (idx)}
47
- <div class={cls}>
48
- {#each data as item, i (item.id)}
59
+ <svelte:body onnotification:show={handleShow} />
60
+
61
+ {#snippet column(position, x = 0, y = 0)}
62
+ {@const items = [...data.values()].filter((item) => item.position === position)}
63
+ <div
64
+ class={styles.base({
65
+ class: className,
66
+ position,
67
+ zOrder: zOrder.findIndex((key) => key === position),
68
+ })}>
69
+ {#each items as { id, el, props }, i (id)}
49
70
  <div
50
71
  in:fly={{
51
72
  x,
52
- y: 0,
73
+ y,
53
74
  duration: IN_MS,
54
- delay: i === data.length - 1 ? STAGGER : 0,
75
+ delay: i === items.length - 1 ? STAGGER : 0,
55
76
  easing: cubicOut,
56
77
  }}
57
78
  out:fly={{
58
79
  x,
59
- y: 0,
80
+ y,
60
81
  duration: IN_MS,
61
- delay: i === data.length - 1 ? STAGGER : 0,
82
+ delay: i === items.length - 1 ? STAGGER : 0,
62
83
  easing: cubicOut,
63
- }}>
64
- <Notification {...item} onClose={() => handleClose(item.id, position)} />
84
+ }}
85
+ onoutroend={data.size === 0 ? handleLastClose : null}>
86
+ {@render el?.({
87
+ ...props,
88
+ class: styles.item({ class: props.class }),
89
+ onClose: () => handleClose(id),
90
+ })}
65
91
  </div>
66
92
  {/each}
67
93
  </div>
68
- {/each}
94
+ {/snippet}
95
+
96
+ {#if showColumns}
97
+ {@render column(NOTIFICATION_POSITIONS.BOTTOM_LEFT, -32)}
98
+ {@render column(NOTIFICATION_POSITIONS.BOTTOM_CENTER, 0, 32)}
99
+ {@render column(NOTIFICATION_POSITIONS.BOTTOM_RIGHT, 32)}
100
+ {/if}
@@ -1,6 +1,17 @@
1
1
  export default NotificationGroup;
2
2
  type NotificationGroup = {
3
3
  $on?(type: string, callback: (e: any) => void): () => void;
4
- $set?(props: Partial<Record<string, never>>): void;
4
+ $set?(props: Partial<Props>): void;
5
+ };
6
+ declare const NotificationGroup: import("svelte").Component<{
7
+ /**
8
+ * Additional CSS classes to apply to each notification column
9
+ */
10
+ class?: string;
11
+ }, {}, "">;
12
+ type Props = {
13
+ /**
14
+ * Additional CSS classes to apply to each notification column
15
+ */
16
+ class?: string;
5
17
  };
6
- declare const NotificationGroup: import("svelte").Component<Record<string, never>, {}, "">;
@@ -1,24 +1,79 @@
1
1
  export const notificationGroupVariants: import("tailwind-variants").TVReturnType<{
2
- [key: string]: {
3
- [key: string]: import("tailwind-variants").ClassValue | {
4
- bottomLeft?: import("tailwind-variants").ClassValue;
5
- bottomRight?: import("tailwind-variants").ClassValue;
2
+ position: {
3
+ bc: {
4
+ base: string;
5
+ };
6
+ bl: {
7
+ base: string;
8
+ };
9
+ br: {
10
+ base: string;
11
+ };
12
+ };
13
+ zOrder: {
14
+ 0: {
15
+ base: string;
16
+ };
17
+ 1: {
18
+ base: string;
19
+ };
20
+ 2: {
21
+ base: string;
22
+ };
23
+ };
24
+ }, {
25
+ base: string;
26
+ item: string;
27
+ }, undefined, {
28
+ position: {
29
+ bc: {
30
+ base: string;
31
+ };
32
+ bl: {
33
+ base: string;
34
+ };
35
+ br: {
36
+ base: string;
6
37
  };
7
38
  };
8
- } | {
9
- [x: string]: {
10
- [x: string]: import("tailwind-variants").ClassValue | {
11
- bottomLeft?: import("tailwind-variants").ClassValue;
12
- bottomRight?: import("tailwind-variants").ClassValue;
39
+ zOrder: {
40
+ 0: {
41
+ base: string;
42
+ };
43
+ 1: {
44
+ base: string;
45
+ };
46
+ 2: {
47
+ base: string;
48
+ };
49
+ };
50
+ }, {
51
+ base: string;
52
+ item: string;
53
+ }, import("tailwind-variants").TVReturnType<{
54
+ position: {
55
+ bc: {
56
+ base: string;
57
+ };
58
+ bl: {
59
+ base: string;
60
+ };
61
+ br: {
62
+ base: string;
63
+ };
64
+ };
65
+ zOrder: {
66
+ 0: {
67
+ base: string;
68
+ };
69
+ 1: {
70
+ base: string;
71
+ };
72
+ 2: {
73
+ base: string;
13
74
  };
14
75
  };
15
76
  }, {
16
- bottomLeft: string;
17
- bottomRight: string;
18
- }, undefined, any, {
19
- bottomLeft: string;
20
- bottomRight: string;
21
- }, import("tailwind-variants").TVReturnType<any, {
22
- bottomLeft: string;
23
- bottomRight: string;
77
+ base: string;
78
+ item: string;
24
79
  }, undefined, unknown, unknown, undefined>>;
@@ -2,10 +2,20 @@ import { tv } from "../../../utils/tailwind.js";
2
2
 
3
3
  const notificationGroupVariants = tv({
4
4
  slots: {
5
- bottomLeft:
6
- "absolute bottom-4 left-4 z-snackbar flex flex-col gap-2 overflow-hidden",
7
- bottomRight:
8
- "absolute right-4 bottom-4 z-snackbar flex flex-col gap-2 overflow-hidden",
5
+ base: "pointer-events-none fixed inset-x-0 bottom-0 flex flex-col gap-2 overflow-hidden p-4",
6
+ item: "pointer-events-auto max-w-xs shadow-sm",
7
+ },
8
+ variants: {
9
+ position: {
10
+ bc: { base: "items-center" },
11
+ bl: { base: "items-start" },
12
+ br: { base: "items-end" },
13
+ },
14
+ zOrder: {
15
+ 0: { base: "z-10000" },
16
+ 1: { base: "z-10001" },
17
+ 2: { base: "z-10002" },
18
+ },
9
19
  },
10
20
  });
11
21
 
package/dist/index.css CHANGED
@@ -136,7 +136,7 @@
136
136
  --font-body: "Borna", "sans-serif";
137
137
  --font-sans: "Borna", sans-serif;
138
138
 
139
- /* Box Shadows */
139
+ /* Box Shadows - NOTE: dark mode values defined bellow theme */
140
140
 
141
141
  --shadow-sm: 0 2px 16px 0 rgba(0, 0, 0, 0.08);
142
142
  --shadow-toggle: 0 2px 4px 0 rgba(0, 0, 0, 0.24);
@@ -220,3 +220,11 @@
220
220
  --color-green-800: #2f461a;
221
221
  --color-green-900: #18230d;
222
222
  }
223
+
224
+ @layer utilities {
225
+ &:where(.dark, .dark *) {
226
+ .shadow-sm {
227
+ --tw-shadow: 0 2px 16px 0 var(--tw-shadow-color, rgba(0, 0, 0, 0.24));
228
+ }
229
+ }
230
+ }
package/dist/index.d.ts CHANGED
@@ -26,10 +26,11 @@ export { default as ComboBox } from "./components/molecules/comboBox/ComboBox.sv
26
26
  export { default as FormActions } from "./components/molecules/formActions/FormActions.svelte";
27
27
  export { default as FormField } from "./components/molecules/formField/FormField.svelte";
28
28
  export { default as FormLayout } from "./components/molecules/formLayout/FormLayout.svelte";
29
- export { default as Notification } from "./components/molecules/notification/Notification.svelte";
30
29
  export { default as RichTextEditor } from "./components/molecules/richTextEditor/RichTextEditor.svelte";
31
30
  export { default as SelectorCard } from "./components/molecules/selectorCard/SelectorCard.svelte";
31
+ export { default as SystemAlert } from "./components/molecules/notifications/systemAlert/SystemAlert.svelte";
32
32
  export { default as TagSelector } from "./components/molecules/tagSelector/TagSelector.svelte";
33
+ export { default as Toast } from "./components/molecules/notifications/toast/Toast.svelte";
33
34
  export { default as ToggleGroup } from "./components/molecules/toggleGroup/ToggleGroup.svelte";
34
35
  export { default as ToggleGroupItem } from "./components/molecules/toggleGroup/ToggleGroupItem.svelte";
35
36
  export * as Dialog from "./components/organisms/dialog/index.js";
package/dist/index.js CHANGED
@@ -36,10 +36,11 @@ export { default as ComboBox } from "./components/molecules/comboBox/ComboBox.sv
36
36
  export { default as FormActions } from "./components/molecules/formActions/FormActions.svelte";
37
37
  export { default as FormField } from "./components/molecules/formField/FormField.svelte";
38
38
  export { default as FormLayout } from "./components/molecules/formLayout/FormLayout.svelte";
39
- export { default as Notification } from "./components/molecules/notification/Notification.svelte";
40
39
  export { default as RichTextEditor } from "./components/molecules/richTextEditor/RichTextEditor.svelte";
41
40
  export { default as SelectorCard } from "./components/molecules/selectorCard/SelectorCard.svelte";
41
+ export { default as SystemAlert } from "./components/molecules/notifications/systemAlert/SystemAlert.svelte";
42
42
  export { default as TagSelector } from "./components/molecules/tagSelector/TagSelector.svelte";
43
+ export { default as Toast } from "./components/molecules/notifications/toast/Toast.svelte";
43
44
  export { default as ToggleGroup } from "./components/molecules/toggleGroup/ToggleGroup.svelte";
44
45
  export { default as ToggleGroupItem } from "./components/molecules/toggleGroup/ToggleGroupItem.svelte";
45
46
 
@@ -1 +1,6 @@
1
- export function showNotification(props: any): void;
1
+ export namespace NOTIFICATION_POSITIONS {
2
+ let BOTTOM_CENTER: string;
3
+ let BOTTOM_LEFT: string;
4
+ let BOTTOM_RIGHT: string;
5
+ }
6
+ export function showNotification(el: any, position?: string, props?: {}): string;
@@ -1,11 +1,25 @@
1
- import { v4 as uuidv4 } from "uuid";
1
+ import { generateId } from "./a11y.js";
2
+
3
+ const NOTIFICATION_POSITIONS = {
4
+ BOTTOM_CENTER: "bc",
5
+ BOTTOM_LEFT: "bl",
6
+ BOTTOM_RIGHT: "br",
7
+ };
8
+
9
+ const showNotification = (
10
+ el,
11
+ position = NOTIFICATION_POSITIONS.BOTTOM_LEFT,
12
+ props = {},
13
+ ) => {
14
+ const id = generateId();
2
15
 
3
- const showNotification = (props) => {
4
16
  document.body.dispatchEvent(
5
17
  new CustomEvent("notification:show", {
6
- detail: { id: uuidv4(), ...props },
18
+ detail: { el, id, position, props },
7
19
  }),
8
20
  );
21
+
22
+ return id;
9
23
  };
10
24
 
11
- export { showNotification };
25
+ export { NOTIFICATION_POSITIONS, showNotification };