@mekari/pixel3-toast 0.0.1

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 (37) hide show
  1. package/dist/chunk-DUGBXMFI.mjs +29 -0
  2. package/dist/chunk-JUEPRWJM.mjs +83 -0
  3. package/dist/chunk-ML5VRDPF.mjs +20 -0
  4. package/dist/chunk-N2F5444N.mjs +45 -0
  5. package/dist/chunk-OEC2ZSPC.mjs +15 -0
  6. package/dist/chunk-QZ7VFGWC.mjs +6 -0
  7. package/dist/index.d.mts +5 -0
  8. package/dist/index.d.ts +5 -0
  9. package/dist/index.js +190 -0
  10. package/dist/index.mjs +13 -0
  11. package/dist/metafile-cjs.json +1 -0
  12. package/dist/metafile-esm.json +1 -0
  13. package/dist/modules/toast.connects.d.mts +10 -0
  14. package/dist/modules/toast.connects.d.ts +10 -0
  15. package/dist/modules/toast.connects.js +77 -0
  16. package/dist/modules/toast.connects.mjs +8 -0
  17. package/dist/modules/toast.hooks.d.mts +7 -0
  18. package/dist/modules/toast.hooks.d.ts +7 -0
  19. package/dist/modules/toast.hooks.js +89 -0
  20. package/dist/modules/toast.hooks.mjs +9 -0
  21. package/dist/modules/toast.props.d.mts +30 -0
  22. package/dist/modules/toast.props.d.ts +30 -0
  23. package/dist/modules/toast.props.js +53 -0
  24. package/dist/modules/toast.props.mjs +7 -0
  25. package/dist/modules/toast.types.d.mts +33 -0
  26. package/dist/modules/toast.types.d.ts +33 -0
  27. package/dist/modules/toast.types.js +18 -0
  28. package/dist/modules/toast.types.mjs +0 -0
  29. package/dist/modules/toast.utils.d.mts +9 -0
  30. package/dist/modules/toast.utils.d.ts +9 -0
  31. package/dist/modules/toast.utils.js +39 -0
  32. package/dist/modules/toast.utils.mjs +7 -0
  33. package/dist/toast.d.mts +12 -0
  34. package/dist/toast.d.ts +12 -0
  35. package/dist/toast.js +188 -0
  36. package/dist/toast.mjs +13 -0
  37. package/package.json +44 -0
@@ -0,0 +1,29 @@
1
+ // src/modules/toast.props.ts
2
+ var toastProps = {
3
+ id: {
4
+ type: String
5
+ },
6
+ variant: {
7
+ type: String,
8
+ default: "success"
9
+ },
10
+ title: {
11
+ type: String,
12
+ default: ""
13
+ },
14
+ position: {
15
+ type: String,
16
+ default: "success"
17
+ },
18
+ duration: {
19
+ type: Number,
20
+ default: 5e3
21
+ },
22
+ render: {
23
+ type: Function
24
+ }
25
+ };
26
+
27
+ export {
28
+ toastProps
29
+ };
@@ -0,0 +1,83 @@
1
+ import {
2
+ useToast
3
+ } from "./chunk-ML5VRDPF.mjs";
4
+ import {
5
+ toastProps
6
+ } from "./chunk-DUGBXMFI.mjs";
7
+ import {
8
+ __name
9
+ } from "./chunk-QZ7VFGWC.mjs";
10
+
11
+ // src/toast.tsx
12
+ import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
13
+ import { defineComponent, ref } from "vue";
14
+ import { toast as toaster, Toaster } from "vue-sonner";
15
+ import { MpIcon } from "@mekari/pixel3-icon";
16
+ var MpToast = defineComponent({
17
+ name: "MpToast",
18
+ props: toastProps,
19
+ setup(props) {
20
+ const api = useToast(props);
21
+ return () => _createVNode("div", api.value.rootProps, [_createVNode(MpIcon, api.value.iconProps, null), _createVNode("p", api.value.labelProps, [api.value.render ? api.value.render() : api.value.title])]);
22
+ }
23
+ });
24
+ var options = ref({});
25
+ var MpToastManager = defineComponent({
26
+ name: "MpToastManager",
27
+ setup() {
28
+ return () => _createVNode(Toaster, _mergeProps(options.value, {
29
+ "expand": true
30
+ }), null);
31
+ }
32
+ });
33
+ var toastManagerNode = /* @__PURE__ */ __name(() => {
34
+ const rootNode = document.querySelectorAll("[data-sonner-toaster]");
35
+ if (rootNode.length === 0) {
36
+ console.warn("[Pixel]: MpToastManager not found in the tree.");
37
+ return false;
38
+ } else if (rootNode.length > 1) {
39
+ console.warn("[Pixel]: Only 1 MpToastManager allowed.");
40
+ return false;
41
+ } else {
42
+ return true;
43
+ }
44
+ }, "toastManagerNode");
45
+ var toast = {
46
+ notify: (option) => {
47
+ const {
48
+ title = "",
49
+ position = "top-center",
50
+ duration = 5e3,
51
+ variant = "success",
52
+ render
53
+ } = option || {};
54
+ if (toastManagerNode()) {
55
+ options.value = {
56
+ position
57
+ };
58
+ toaster.custom(_createVNode(MpToast, {
59
+ "title": title,
60
+ "variant": variant,
61
+ "render": render
62
+ }, null), {
63
+ duration
64
+ });
65
+ }
66
+ },
67
+ closeAll: () => {
68
+ const parentNode = document.querySelectorAll("[data-sonner-toast]");
69
+ if (toastManagerNode()) {
70
+ parentNode == null ? void 0 : parentNode.forEach((childNode, index) => {
71
+ childNode == null ? void 0 : childNode.setAttribute("data-removed", "true");
72
+ childNode == null ? void 0 : childNode.setAttribute("data-visible", "false");
73
+ if (index !== 0)
74
+ childNode.remove();
75
+ });
76
+ }
77
+ }
78
+ };
79
+
80
+ export {
81
+ MpToastManager,
82
+ toast
83
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ toastConnect
3
+ } from "./chunk-N2F5444N.mjs";
4
+ import {
5
+ __name
6
+ } from "./chunk-QZ7VFGWC.mjs";
7
+
8
+ // src/modules/toast.hooks.ts
9
+ import { computed, ref } from "vue";
10
+ import { toastSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
11
+ var useToast = /* @__PURE__ */ __name((props) => {
12
+ const context = ref(props);
13
+ const [value] = toastSlotRecipe.splitVariantProps(context.value);
14
+ const classes = toastSlotRecipe(value);
15
+ return computed(() => toastConnect(context.value, classes));
16
+ }, "useToast");
17
+
18
+ export {
19
+ useToast
20
+ };
@@ -0,0 +1,45 @@
1
+ import {
2
+ getIconVariant
3
+ } from "./chunk-OEC2ZSPC.mjs";
4
+ import {
5
+ __name
6
+ } from "./chunk-QZ7VFGWC.mjs";
7
+
8
+ // src/modules/toast.connects.ts
9
+ import { useId } from "@mekari/pixel3-utils";
10
+ function toastConnect(state, classes) {
11
+ const {
12
+ id,
13
+ title,
14
+ variant,
15
+ render
16
+ } = state;
17
+ const idx = id != null ? id : `mp-toast-${useId()}`;
18
+ return {
19
+ title,
20
+ render,
21
+ rootProps: {
22
+ id: idx,
23
+ class: classes.root,
24
+ "data-pixel-component": "MpToast"
25
+ },
26
+ iconProps: {
27
+ id: `${idx}-icon`,
28
+ variant: "duotone",
29
+ size: "md",
30
+ ...getIconVariant[variant || "success"],
31
+ class: classes.icon,
32
+ "data-pixel-component": "MpToastIcon"
33
+ },
34
+ labelProps: {
35
+ id: `${idx}-label`,
36
+ class: classes.label,
37
+ "data-pixel-component": "MpToastLabel"
38
+ }
39
+ };
40
+ }
41
+ __name(toastConnect, "toastConnect");
42
+
43
+ export {
44
+ toastConnect
45
+ };
@@ -0,0 +1,15 @@
1
+ // src/modules/toast.utils.ts
2
+ var getIconVariant = {
3
+ success: {
4
+ name: "done",
5
+ color: "green.700"
6
+ },
7
+ error: {
8
+ name: "error",
9
+ color: "red.700"
10
+ }
11
+ };
12
+
13
+ export {
14
+ getIconVariant
15
+ };
@@ -0,0 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ export {
5
+ __name
6
+ };
@@ -0,0 +1,5 @@
1
+ export { MpToastManager, toast } from './toast.mjs';
2
+ export { ToastProps } from './modules/toast.types.mjs';
3
+ import 'vue';
4
+ import 'vue/jsx-runtime';
5
+ import '@mekari/pixel3-utils';
@@ -0,0 +1,5 @@
1
+ export { MpToastManager, toast } from './toast.js';
2
+ export { ToastProps } from './modules/toast.types.js';
3
+ import 'vue';
4
+ import 'vue/jsx-runtime';
5
+ import '@mekari/pixel3-utils';
package/dist/index.js ADDED
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ MpToastManager: () => MpToastManager,
25
+ toast: () => toast
26
+ });
27
+ module.exports = __toCommonJS(src_exports);
28
+
29
+ // src/toast.tsx
30
+ var import_vue2 = require("vue");
31
+ var import_vue3 = require("vue");
32
+ var import_vue_sonner = require("vue-sonner");
33
+
34
+ // src/modules/toast.props.ts
35
+ var toastProps = {
36
+ id: {
37
+ type: String
38
+ },
39
+ variant: {
40
+ type: String,
41
+ default: "success"
42
+ },
43
+ title: {
44
+ type: String,
45
+ default: ""
46
+ },
47
+ position: {
48
+ type: String,
49
+ default: "success"
50
+ },
51
+ duration: {
52
+ type: Number,
53
+ default: 5e3
54
+ },
55
+ render: {
56
+ type: Function
57
+ }
58
+ };
59
+
60
+ // src/modules/toast.hooks.ts
61
+ var import_vue = require("vue");
62
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
63
+
64
+ // src/modules/toast.connects.ts
65
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
66
+
67
+ // src/modules/toast.utils.ts
68
+ var getIconVariant = {
69
+ success: {
70
+ name: "done",
71
+ color: "green.700"
72
+ },
73
+ error: {
74
+ name: "error",
75
+ color: "red.700"
76
+ }
77
+ };
78
+
79
+ // src/modules/toast.connects.ts
80
+ function toastConnect(state, classes) {
81
+ const {
82
+ id,
83
+ title,
84
+ variant,
85
+ render
86
+ } = state;
87
+ const idx = id != null ? id : `mp-toast-${(0, import_pixel3_utils.useId)()}`;
88
+ return {
89
+ title,
90
+ render,
91
+ rootProps: {
92
+ id: idx,
93
+ class: classes.root,
94
+ "data-pixel-component": "MpToast"
95
+ },
96
+ iconProps: {
97
+ id: `${idx}-icon`,
98
+ variant: "duotone",
99
+ size: "md",
100
+ ...getIconVariant[variant || "success"],
101
+ class: classes.icon,
102
+ "data-pixel-component": "MpToastIcon"
103
+ },
104
+ labelProps: {
105
+ id: `${idx}-label`,
106
+ class: classes.label,
107
+ "data-pixel-component": "MpToastLabel"
108
+ }
109
+ };
110
+ }
111
+ __name(toastConnect, "toastConnect");
112
+
113
+ // src/modules/toast.hooks.ts
114
+ var useToast = /* @__PURE__ */ __name((props) => {
115
+ const context = (0, import_vue.ref)(props);
116
+ const [value] = import_recipes.toastSlotRecipe.splitVariantProps(context.value);
117
+ const classes = (0, import_recipes.toastSlotRecipe)(value);
118
+ return (0, import_vue.computed)(() => toastConnect(context.value, classes));
119
+ }, "useToast");
120
+
121
+ // src/toast.tsx
122
+ var import_pixel3_icon = require("@mekari/pixel3-icon");
123
+ var MpToast = (0, import_vue3.defineComponent)({
124
+ name: "MpToast",
125
+ props: toastProps,
126
+ setup(props) {
127
+ const api = useToast(props);
128
+ return () => (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, api.value.iconProps, null), (0, import_vue2.createVNode)("p", api.value.labelProps, [api.value.render ? api.value.render() : api.value.title])]);
129
+ }
130
+ });
131
+ var options = (0, import_vue3.ref)({});
132
+ var MpToastManager = (0, import_vue3.defineComponent)({
133
+ name: "MpToastManager",
134
+ setup() {
135
+ return () => (0, import_vue2.createVNode)(import_vue_sonner.Toaster, (0, import_vue2.mergeProps)(options.value, {
136
+ "expand": true
137
+ }), null);
138
+ }
139
+ });
140
+ var toastManagerNode = /* @__PURE__ */ __name(() => {
141
+ const rootNode = document.querySelectorAll("[data-sonner-toaster]");
142
+ if (rootNode.length === 0) {
143
+ console.warn("[Pixel]: MpToastManager not found in the tree.");
144
+ return false;
145
+ } else if (rootNode.length > 1) {
146
+ console.warn("[Pixel]: Only 1 MpToastManager allowed.");
147
+ return false;
148
+ } else {
149
+ return true;
150
+ }
151
+ }, "toastManagerNode");
152
+ var toast = {
153
+ notify: (option) => {
154
+ const {
155
+ title = "",
156
+ position = "top-center",
157
+ duration = 5e3,
158
+ variant = "success",
159
+ render
160
+ } = option || {};
161
+ if (toastManagerNode()) {
162
+ options.value = {
163
+ position
164
+ };
165
+ import_vue_sonner.toast.custom((0, import_vue2.createVNode)(MpToast, {
166
+ "title": title,
167
+ "variant": variant,
168
+ "render": render
169
+ }, null), {
170
+ duration
171
+ });
172
+ }
173
+ },
174
+ closeAll: () => {
175
+ const parentNode = document.querySelectorAll("[data-sonner-toast]");
176
+ if (toastManagerNode()) {
177
+ parentNode == null ? void 0 : parentNode.forEach((childNode, index) => {
178
+ childNode == null ? void 0 : childNode.setAttribute("data-removed", "true");
179
+ childNode == null ? void 0 : childNode.setAttribute("data-visible", "false");
180
+ if (index !== 0)
181
+ childNode.remove();
182
+ });
183
+ }
184
+ }
185
+ };
186
+ // Annotate the CommonJS export names for ESM import in node:
187
+ 0 && (module.exports = {
188
+ MpToastManager,
189
+ toast
190
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,13 @@
1
+ import {
2
+ MpToastManager,
3
+ toast
4
+ } from "./chunk-JUEPRWJM.mjs";
5
+ import "./chunk-ML5VRDPF.mjs";
6
+ import "./chunk-N2F5444N.mjs";
7
+ import "./chunk-DUGBXMFI.mjs";
8
+ import "./chunk-OEC2ZSPC.mjs";
9
+ import "./chunk-QZ7VFGWC.mjs";
10
+ export {
11
+ MpToastManager,
12
+ toast
13
+ };
@@ -0,0 +1 @@
1
+ {"inputs":{"src/modules/toast.props.ts":{"bytes":755,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"./toast.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/toast.utils.ts":{"bytes":321,"imports":[],"format":"esm"},"src/modules/toast.connects.ts":{"bytes":975,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"src/modules/toast.utils.ts","kind":"import-statement","original":"./toast.utils"},{"path":"./toast.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/toast.hooks.ts":{"bytes":598,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/toast.connects.ts","kind":"import-statement","original":"./toast.connects"},{"path":"./toast.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/toast.tsx":{"bytes":2413,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"vue-sonner","kind":"import-statement","external":true},{"path":"src/modules/toast.props.ts","kind":"import-statement","original":"./modules/toast.props"},{"path":"src/modules/toast.hooks.ts","kind":"import-statement","original":"./modules/toast.hooks"},{"path":"./modules/toast.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":240,"imports":[{"path":"src/toast.tsx","kind":"import-statement","original":"./toast"}],"format":"esm"},"src/modules/toast.types.ts":{"bytes":908,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue-sonner","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":155},"src/toast.tsx":{"bytesInOutput":2229},"src/modules/toast.props.ts":{"bytesInOutput":310},"src/modules/toast.hooks.ts":{"bytesInOutput":440},"src/modules/toast.connects.ts":{"bytesInOutput":764},"src/modules/toast.utils.ts":{"bytesInOutput":140}},"bytes":5289},"dist/toast.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"vue-sonner","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/toast.tsx","inputs":{"src/toast.tsx":{"bytesInOutput":2390},"src/modules/toast.props.ts":{"bytesInOutput":310},"src/modules/toast.hooks.ts":{"bytesInOutput":440},"src/modules/toast.connects.ts":{"bytesInOutput":764},"src/modules/toast.utils.ts":{"bytesInOutput":140}},"bytes":5278},"dist/modules/toast.connects.js":{"imports":[{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/toast.connects.ts","inputs":{"src/modules/toast.connects.ts":{"bytesInOutput":926},"src/modules/toast.utils.ts":{"bytesInOutput":140}},"bytes":2160},"dist/modules/toast.hooks.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/toast.hooks.ts","inputs":{"src/modules/toast.hooks.ts":{"bytesInOutput":585},"src/modules/toast.connects.ts":{"bytesInOutput":764},"src/modules/toast.utils.ts":{"bytesInOutput":140}},"bytes":2641},"dist/modules/toast.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/toast.props.ts","inputs":{"src/modules/toast.props.ts":{"bytesInOutput":459}},"bytes":1393},"dist/modules/toast.types.js":{"imports":[],"exports":[],"entryPoint":"src/modules/toast.types.ts","inputs":{"src/modules/toast.types.ts":{"bytesInOutput":82}},"bytes":784},"dist/modules/toast.utils.js":{"imports":[],"exports":[],"entryPoint":"src/modules/toast.utils.ts","inputs":{"src/modules/toast.utils.ts":{"bytesInOutput":297}},"bytes":1235}}}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/modules/toast.props.ts":{"bytes":755,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"./toast.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/toast.utils.ts":{"bytes":321,"imports":[],"format":"esm"},"src/modules/toast.connects.ts":{"bytes":975,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"src/modules/toast.utils.ts","kind":"import-statement","original":"./toast.utils"},{"path":"./toast.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/toast.hooks.ts":{"bytes":598,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/toast.connects.ts","kind":"import-statement","original":"./toast.connects"},{"path":"./toast.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/toast.tsx":{"bytes":2413,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"vue-sonner","kind":"import-statement","external":true},{"path":"src/modules/toast.props.ts","kind":"import-statement","original":"./modules/toast.props"},{"path":"src/modules/toast.hooks.ts","kind":"import-statement","original":"./modules/toast.hooks"},{"path":"./modules/toast.types","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":240,"imports":[{"path":"src/toast.tsx","kind":"import-statement","original":"./toast"}],"format":"esm"},"src/modules/toast.types.ts":{"bytes":908,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-JUEPRWJM.mjs","kind":"import-statement"},{"path":"dist/chunk-ML5VRDPF.mjs","kind":"import-statement"},{"path":"dist/chunk-N2F5444N.mjs","kind":"import-statement"},{"path":"dist/chunk-DUGBXMFI.mjs","kind":"import-statement"},{"path":"dist/chunk-OEC2ZSPC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpToastManager","toast"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":259},"dist/toast.mjs":{"imports":[{"path":"dist/chunk-JUEPRWJM.mjs","kind":"import-statement"},{"path":"dist/chunk-ML5VRDPF.mjs","kind":"import-statement"},{"path":"dist/chunk-N2F5444N.mjs","kind":"import-statement"},{"path":"dist/chunk-DUGBXMFI.mjs","kind":"import-statement"},{"path":"dist/chunk-OEC2ZSPC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpToastManager","toast"],"entryPoint":"src/toast.tsx","inputs":{},"bytes":259},"dist/chunk-JUEPRWJM.mjs":{"imports":[{"path":"dist/chunk-ML5VRDPF.mjs","kind":"import-statement"},{"path":"dist/chunk-DUGBXMFI.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"vue-sonner","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true}],"exports":["MpToastManager","toast"],"inputs":{"src/toast.tsx":{"bytesInOutput":2081}},"bytes":2291},"dist/modules/toast.connects.mjs":{"imports":[{"path":"dist/chunk-N2F5444N.mjs","kind":"import-statement"},{"path":"dist/chunk-OEC2ZSPC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["toastConnect"],"entryPoint":"src/modules/toast.connects.ts","inputs":{},"bytes":147},"dist/modules/toast.hooks.mjs":{"imports":[{"path":"dist/chunk-ML5VRDPF.mjs","kind":"import-statement"},{"path":"dist/chunk-N2F5444N.mjs","kind":"import-statement"},{"path":"dist/chunk-OEC2ZSPC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["useToast"],"entryPoint":"src/modules/toast.hooks.ts","inputs":{},"bytes":171},"dist/chunk-ML5VRDPF.mjs":{"imports":[{"path":"dist/chunk-N2F5444N.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true}],"exports":["useToast"],"inputs":{"src/modules/toast.hooks.ts":{"bytesInOutput":379}},"bytes":538},"dist/chunk-N2F5444N.mjs":{"imports":[{"path":"dist/chunk-OEC2ZSPC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"exports":["toastConnect"],"inputs":{"src/modules/toast.connects.ts":{"bytesInOutput":726}},"bytes":894},"dist/modules/toast.props.mjs":{"imports":[{"path":"dist/chunk-DUGBXMFI.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["toastProps"],"entryPoint":"src/modules/toast.props.ts","inputs":{},"bytes":111},"dist/chunk-DUGBXMFI.mjs":{"imports":[],"exports":["toastProps"],"inputs":{"src/modules/toast.props.ts":{"bytesInOutput":310}},"bytes":366},"dist/modules/toast.types.mjs":{"imports":[],"exports":[],"entryPoint":"src/modules/toast.types.ts","inputs":{"src/modules/toast.types.ts":{"bytesInOutput":0}},"bytes":0},"dist/modules/toast.utils.mjs":{"imports":[{"path":"dist/chunk-OEC2ZSPC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["getIconVariant"],"entryPoint":"src/modules/toast.utils.ts","inputs":{},"bytes":119},"dist/chunk-OEC2ZSPC.mjs":{"imports":[],"exports":["getIconVariant"],"inputs":{"src/modules/toast.utils.ts":{"bytesInOutput":140}},"bytes":200},"dist/chunk-QZ7VFGWC.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151}}}
@@ -0,0 +1,10 @@
1
+ import { ToastState, ToastClasses, ToastApiMachine } from './toast.types.mjs';
2
+ import '@mekari/pixel3-utils';
3
+
4
+ /**
5
+ * Exported toast connects.
6
+ */
7
+
8
+ declare function toastConnect(state: ToastState, classes: ToastClasses): ToastApiMachine;
9
+
10
+ export { toastConnect };
@@ -0,0 +1,10 @@
1
+ import { ToastState, ToastClasses, ToastApiMachine } from './toast.types.js';
2
+ import '@mekari/pixel3-utils';
3
+
4
+ /**
5
+ * Exported toast connects.
6
+ */
7
+
8
+ declare function toastConnect(state: ToastState, classes: ToastClasses): ToastApiMachine;
9
+
10
+ export { toastConnect };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/modules/toast.connects.ts
22
+ var toast_connects_exports = {};
23
+ __export(toast_connects_exports, {
24
+ toastConnect: () => toastConnect
25
+ });
26
+ module.exports = __toCommonJS(toast_connects_exports);
27
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
28
+
29
+ // src/modules/toast.utils.ts
30
+ var getIconVariant = {
31
+ success: {
32
+ name: "done",
33
+ color: "green.700"
34
+ },
35
+ error: {
36
+ name: "error",
37
+ color: "red.700"
38
+ }
39
+ };
40
+
41
+ // src/modules/toast.connects.ts
42
+ function toastConnect(state, classes) {
43
+ const {
44
+ id,
45
+ title,
46
+ variant,
47
+ render
48
+ } = state;
49
+ const idx = id != null ? id : `mp-toast-${(0, import_pixel3_utils.useId)()}`;
50
+ return {
51
+ title,
52
+ render,
53
+ rootProps: {
54
+ id: idx,
55
+ class: classes.root,
56
+ "data-pixel-component": "MpToast"
57
+ },
58
+ iconProps: {
59
+ id: `${idx}-icon`,
60
+ variant: "duotone",
61
+ size: "md",
62
+ ...getIconVariant[variant || "success"],
63
+ class: classes.icon,
64
+ "data-pixel-component": "MpToastIcon"
65
+ },
66
+ labelProps: {
67
+ id: `${idx}-label`,
68
+ class: classes.label,
69
+ "data-pixel-component": "MpToastLabel"
70
+ }
71
+ };
72
+ }
73
+ __name(toastConnect, "toastConnect");
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ toastConnect
77
+ });
@@ -0,0 +1,8 @@
1
+ import {
2
+ toastConnect
3
+ } from "../chunk-N2F5444N.mjs";
4
+ import "../chunk-OEC2ZSPC.mjs";
5
+ import "../chunk-QZ7VFGWC.mjs";
6
+ export {
7
+ toastConnect
8
+ };
@@ -0,0 +1,7 @@
1
+ import * as vue from 'vue';
2
+ import { ToastDefinedContext, ToastApiMachine } from './toast.types.mjs';
3
+ import * as _mekari_pixel3_utils from '@mekari/pixel3-utils';
4
+
5
+ declare const useToast: (props: ToastDefinedContext) => vue.ComputedRef<ToastApiMachine<_mekari_pixel3_utils.PropTypes>>;
6
+
7
+ export { useToast };
@@ -0,0 +1,7 @@
1
+ import * as vue from 'vue';
2
+ import { ToastDefinedContext, ToastApiMachine } from './toast.types.js';
3
+ import * as _mekari_pixel3_utils from '@mekari/pixel3-utils';
4
+
5
+ declare const useToast: (props: ToastDefinedContext) => vue.ComputedRef<ToastApiMachine<_mekari_pixel3_utils.PropTypes>>;
6
+
7
+ export { useToast };
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/modules/toast.hooks.ts
22
+ var toast_hooks_exports = {};
23
+ __export(toast_hooks_exports, {
24
+ useToast: () => useToast
25
+ });
26
+ module.exports = __toCommonJS(toast_hooks_exports);
27
+ var import_vue = require("vue");
28
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
29
+
30
+ // src/modules/toast.connects.ts
31
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
32
+
33
+ // src/modules/toast.utils.ts
34
+ var getIconVariant = {
35
+ success: {
36
+ name: "done",
37
+ color: "green.700"
38
+ },
39
+ error: {
40
+ name: "error",
41
+ color: "red.700"
42
+ }
43
+ };
44
+
45
+ // src/modules/toast.connects.ts
46
+ function toastConnect(state, classes) {
47
+ const {
48
+ id,
49
+ title,
50
+ variant,
51
+ render
52
+ } = state;
53
+ const idx = id != null ? id : `mp-toast-${(0, import_pixel3_utils.useId)()}`;
54
+ return {
55
+ title,
56
+ render,
57
+ rootProps: {
58
+ id: idx,
59
+ class: classes.root,
60
+ "data-pixel-component": "MpToast"
61
+ },
62
+ iconProps: {
63
+ id: `${idx}-icon`,
64
+ variant: "duotone",
65
+ size: "md",
66
+ ...getIconVariant[variant || "success"],
67
+ class: classes.icon,
68
+ "data-pixel-component": "MpToastIcon"
69
+ },
70
+ labelProps: {
71
+ id: `${idx}-label`,
72
+ class: classes.label,
73
+ "data-pixel-component": "MpToastLabel"
74
+ }
75
+ };
76
+ }
77
+ __name(toastConnect, "toastConnect");
78
+
79
+ // src/modules/toast.hooks.ts
80
+ var useToast = /* @__PURE__ */ __name((props) => {
81
+ const context = (0, import_vue.ref)(props);
82
+ const [value] = import_recipes.toastSlotRecipe.splitVariantProps(context.value);
83
+ const classes = (0, import_recipes.toastSlotRecipe)(value);
84
+ return (0, import_vue.computed)(() => toastConnect(context.value, classes));
85
+ }, "useToast");
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ useToast
89
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ useToast
3
+ } from "../chunk-ML5VRDPF.mjs";
4
+ import "../chunk-N2F5444N.mjs";
5
+ import "../chunk-OEC2ZSPC.mjs";
6
+ import "../chunk-QZ7VFGWC.mjs";
7
+ export {
8
+ useToast
9
+ };
@@ -0,0 +1,30 @@
1
+ import { ToastVariant, ToastPosition } from './toast.types.mjs';
2
+ import { PropType } from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare const toastProps: {
6
+ id: {
7
+ type: PropType<string | undefined>;
8
+ };
9
+ variant: {
10
+ type: PropType<ToastVariant | undefined>;
11
+ default: string;
12
+ };
13
+ title: {
14
+ type: PropType<string | undefined>;
15
+ default: string;
16
+ };
17
+ position: {
18
+ type: PropType<ToastPosition | undefined>;
19
+ default: string;
20
+ };
21
+ duration: {
22
+ type: PropType<number | undefined>;
23
+ default: number;
24
+ };
25
+ render: {
26
+ type: PropType<(() => void) | undefined>;
27
+ };
28
+ };
29
+
30
+ export { toastProps };
@@ -0,0 +1,30 @@
1
+ import { ToastVariant, ToastPosition } from './toast.types.js';
2
+ import { PropType } from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare const toastProps: {
6
+ id: {
7
+ type: PropType<string | undefined>;
8
+ };
9
+ variant: {
10
+ type: PropType<ToastVariant | undefined>;
11
+ default: string;
12
+ };
13
+ title: {
14
+ type: PropType<string | undefined>;
15
+ default: string;
16
+ };
17
+ position: {
18
+ type: PropType<ToastPosition | undefined>;
19
+ default: string;
20
+ };
21
+ duration: {
22
+ type: PropType<number | undefined>;
23
+ default: number;
24
+ };
25
+ render: {
26
+ type: PropType<(() => void) | undefined>;
27
+ };
28
+ };
29
+
30
+ export { toastProps };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/modules/toast.props.ts
21
+ var toast_props_exports = {};
22
+ __export(toast_props_exports, {
23
+ toastProps: () => toastProps
24
+ });
25
+ module.exports = __toCommonJS(toast_props_exports);
26
+ var toastProps = {
27
+ id: {
28
+ type: String
29
+ },
30
+ variant: {
31
+ type: String,
32
+ default: "success"
33
+ },
34
+ title: {
35
+ type: String,
36
+ default: ""
37
+ },
38
+ position: {
39
+ type: String,
40
+ default: "success"
41
+ },
42
+ duration: {
43
+ type: Number,
44
+ default: 5e3
45
+ },
46
+ render: {
47
+ type: Function
48
+ }
49
+ };
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ toastProps
53
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ toastProps
3
+ } from "../chunk-DUGBXMFI.mjs";
4
+ import "../chunk-QZ7VFGWC.mjs";
5
+ export {
6
+ toastProps
7
+ };
@@ -0,0 +1,33 @@
1
+ import { Optional, PropTypes } from '@mekari/pixel3-utils';
2
+
3
+ /**
4
+ * Exported toast types.
5
+ */
6
+
7
+ type ToastVariant = 'success' | 'error';
8
+ type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
9
+ interface ToastProps {
10
+ id?: string;
11
+ variant?: ToastVariant;
12
+ title?: string;
13
+ position?: ToastPosition;
14
+ duration?: number;
15
+ render?: () => void;
16
+ }
17
+ type ToastDefinedContext = Optional<ToastProps, 'id'>;
18
+ interface ToastApiMachine<T extends PropTypes = PropTypes> {
19
+ title?: string;
20
+ render?: () => void;
21
+ rootProps?: T['element'];
22
+ iconProps?: T['element'];
23
+ labelProps?: T['element'];
24
+ }
25
+ interface ToastState extends ToastProps {
26
+ }
27
+ interface ToastClasses {
28
+ root?: string;
29
+ icon?: string;
30
+ label?: string;
31
+ }
32
+
33
+ export { ToastApiMachine, ToastClasses, ToastDefinedContext, ToastPosition, ToastProps, ToastState, ToastVariant };
@@ -0,0 +1,33 @@
1
+ import { Optional, PropTypes } from '@mekari/pixel3-utils';
2
+
3
+ /**
4
+ * Exported toast types.
5
+ */
6
+
7
+ type ToastVariant = 'success' | 'error';
8
+ type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
9
+ interface ToastProps {
10
+ id?: string;
11
+ variant?: ToastVariant;
12
+ title?: string;
13
+ position?: ToastPosition;
14
+ duration?: number;
15
+ render?: () => void;
16
+ }
17
+ type ToastDefinedContext = Optional<ToastProps, 'id'>;
18
+ interface ToastApiMachine<T extends PropTypes = PropTypes> {
19
+ title?: string;
20
+ render?: () => void;
21
+ rootProps?: T['element'];
22
+ iconProps?: T['element'];
23
+ labelProps?: T['element'];
24
+ }
25
+ interface ToastState extends ToastProps {
26
+ }
27
+ interface ToastClasses {
28
+ root?: string;
29
+ icon?: string;
30
+ label?: string;
31
+ }
32
+
33
+ export { ToastApiMachine, ToastClasses, ToastDefinedContext, ToastPosition, ToastProps, ToastState, ToastVariant };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/modules/toast.types.ts
17
+ var toast_types_exports = {};
18
+ module.exports = __toCommonJS(toast_types_exports);
File without changes
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Exported toast utils.
3
+ */
4
+ declare const getIconVariant: Record<string, {
5
+ name: string;
6
+ color: string;
7
+ }>;
8
+
9
+ export { getIconVariant };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Exported toast utils.
3
+ */
4
+ declare const getIconVariant: Record<string, {
5
+ name: string;
6
+ color: string;
7
+ }>;
8
+
9
+ export { getIconVariant };
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/modules/toast.utils.ts
21
+ var toast_utils_exports = {};
22
+ __export(toast_utils_exports, {
23
+ getIconVariant: () => getIconVariant
24
+ });
25
+ module.exports = __toCommonJS(toast_utils_exports);
26
+ var getIconVariant = {
27
+ success: {
28
+ name: "done",
29
+ color: "green.700"
30
+ },
31
+ error: {
32
+ name: "error",
33
+ color: "red.700"
34
+ }
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ getIconVariant
39
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ getIconVariant
3
+ } from "../chunk-OEC2ZSPC.mjs";
4
+ import "../chunk-QZ7VFGWC.mjs";
5
+ export {
6
+ getIconVariant
7
+ };
@@ -0,0 +1,12 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+ import { ToastProps } from './modules/toast.types.mjs';
4
+ import '@mekari/pixel3-utils';
5
+
6
+ declare const MpToastManager: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
7
+ declare const toast: {
8
+ notify: (option: ToastProps) => void;
9
+ closeAll: () => void;
10
+ };
11
+
12
+ export { MpToastManager, toast };
@@ -0,0 +1,12 @@
1
+ import * as vue from 'vue';
2
+ import * as vue_jsx_runtime from 'vue/jsx-runtime';
3
+ import { ToastProps } from './modules/toast.types.js';
4
+ import '@mekari/pixel3-utils';
5
+
6
+ declare const MpToastManager: vue.DefineComponent<{}, () => vue_jsx_runtime.JSX.Element, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.PublicProps, Readonly<vue.ExtractPropTypes<{}>>, {}, {}>;
7
+ declare const toast: {
8
+ notify: (option: ToastProps) => void;
9
+ closeAll: () => void;
10
+ };
11
+
12
+ export { MpToastManager, toast };
package/dist/toast.js ADDED
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/toast.tsx
22
+ var toast_exports = {};
23
+ __export(toast_exports, {
24
+ MpToastManager: () => MpToastManager,
25
+ toast: () => toast
26
+ });
27
+ module.exports = __toCommonJS(toast_exports);
28
+ var import_vue2 = require("vue");
29
+ var import_vue3 = require("vue");
30
+ var import_vue_sonner = require("vue-sonner");
31
+
32
+ // src/modules/toast.props.ts
33
+ var toastProps = {
34
+ id: {
35
+ type: String
36
+ },
37
+ variant: {
38
+ type: String,
39
+ default: "success"
40
+ },
41
+ title: {
42
+ type: String,
43
+ default: ""
44
+ },
45
+ position: {
46
+ type: String,
47
+ default: "success"
48
+ },
49
+ duration: {
50
+ type: Number,
51
+ default: 5e3
52
+ },
53
+ render: {
54
+ type: Function
55
+ }
56
+ };
57
+
58
+ // src/modules/toast.hooks.ts
59
+ var import_vue = require("vue");
60
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
61
+
62
+ // src/modules/toast.connects.ts
63
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
64
+
65
+ // src/modules/toast.utils.ts
66
+ var getIconVariant = {
67
+ success: {
68
+ name: "done",
69
+ color: "green.700"
70
+ },
71
+ error: {
72
+ name: "error",
73
+ color: "red.700"
74
+ }
75
+ };
76
+
77
+ // src/modules/toast.connects.ts
78
+ function toastConnect(state, classes) {
79
+ const {
80
+ id,
81
+ title,
82
+ variant,
83
+ render
84
+ } = state;
85
+ const idx = id != null ? id : `mp-toast-${(0, import_pixel3_utils.useId)()}`;
86
+ return {
87
+ title,
88
+ render,
89
+ rootProps: {
90
+ id: idx,
91
+ class: classes.root,
92
+ "data-pixel-component": "MpToast"
93
+ },
94
+ iconProps: {
95
+ id: `${idx}-icon`,
96
+ variant: "duotone",
97
+ size: "md",
98
+ ...getIconVariant[variant || "success"],
99
+ class: classes.icon,
100
+ "data-pixel-component": "MpToastIcon"
101
+ },
102
+ labelProps: {
103
+ id: `${idx}-label`,
104
+ class: classes.label,
105
+ "data-pixel-component": "MpToastLabel"
106
+ }
107
+ };
108
+ }
109
+ __name(toastConnect, "toastConnect");
110
+
111
+ // src/modules/toast.hooks.ts
112
+ var useToast = /* @__PURE__ */ __name((props) => {
113
+ const context = (0, import_vue.ref)(props);
114
+ const [value] = import_recipes.toastSlotRecipe.splitVariantProps(context.value);
115
+ const classes = (0, import_recipes.toastSlotRecipe)(value);
116
+ return (0, import_vue.computed)(() => toastConnect(context.value, classes));
117
+ }, "useToast");
118
+
119
+ // src/toast.tsx
120
+ var import_pixel3_icon = require("@mekari/pixel3-icon");
121
+ var MpToast = (0, import_vue3.defineComponent)({
122
+ name: "MpToast",
123
+ props: toastProps,
124
+ setup(props) {
125
+ const api = useToast(props);
126
+ return () => (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, api.value.iconProps, null), (0, import_vue2.createVNode)("p", api.value.labelProps, [api.value.render ? api.value.render() : api.value.title])]);
127
+ }
128
+ });
129
+ var options = (0, import_vue3.ref)({});
130
+ var MpToastManager = (0, import_vue3.defineComponent)({
131
+ name: "MpToastManager",
132
+ setup() {
133
+ return () => (0, import_vue2.createVNode)(import_vue_sonner.Toaster, (0, import_vue2.mergeProps)(options.value, {
134
+ "expand": true
135
+ }), null);
136
+ }
137
+ });
138
+ var toastManagerNode = /* @__PURE__ */ __name(() => {
139
+ const rootNode = document.querySelectorAll("[data-sonner-toaster]");
140
+ if (rootNode.length === 0) {
141
+ console.warn("[Pixel]: MpToastManager not found in the tree.");
142
+ return false;
143
+ } else if (rootNode.length > 1) {
144
+ console.warn("[Pixel]: Only 1 MpToastManager allowed.");
145
+ return false;
146
+ } else {
147
+ return true;
148
+ }
149
+ }, "toastManagerNode");
150
+ var toast = {
151
+ notify: (option) => {
152
+ const {
153
+ title = "",
154
+ position = "top-center",
155
+ duration = 5e3,
156
+ variant = "success",
157
+ render
158
+ } = option || {};
159
+ if (toastManagerNode()) {
160
+ options.value = {
161
+ position
162
+ };
163
+ import_vue_sonner.toast.custom((0, import_vue2.createVNode)(MpToast, {
164
+ "title": title,
165
+ "variant": variant,
166
+ "render": render
167
+ }, null), {
168
+ duration
169
+ });
170
+ }
171
+ },
172
+ closeAll: () => {
173
+ const parentNode = document.querySelectorAll("[data-sonner-toast]");
174
+ if (toastManagerNode()) {
175
+ parentNode == null ? void 0 : parentNode.forEach((childNode, index) => {
176
+ childNode == null ? void 0 : childNode.setAttribute("data-removed", "true");
177
+ childNode == null ? void 0 : childNode.setAttribute("data-visible", "false");
178
+ if (index !== 0)
179
+ childNode.remove();
180
+ });
181
+ }
182
+ }
183
+ };
184
+ // Annotate the CommonJS export names for ESM import in node:
185
+ 0 && (module.exports = {
186
+ MpToastManager,
187
+ toast
188
+ });
package/dist/toast.mjs ADDED
@@ -0,0 +1,13 @@
1
+ import {
2
+ MpToastManager,
3
+ toast
4
+ } from "./chunk-JUEPRWJM.mjs";
5
+ import "./chunk-ML5VRDPF.mjs";
6
+ import "./chunk-N2F5444N.mjs";
7
+ import "./chunk-DUGBXMFI.mjs";
8
+ import "./chunk-OEC2ZSPC.mjs";
9
+ import "./chunk-QZ7VFGWC.mjs";
10
+ export {
11
+ MpToastManager,
12
+ toast
13
+ };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "@mekari/pixel3-toast",
3
+ "description": "Mekari Pixel 3 | Toast component is used to show dynamic notifications and alerts to user",
4
+ "version": "0.0.1",
5
+ "main": "dist/index.js",
6
+ "license": "MIT",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "dependencies": {
11
+ "vue-sonner": "^1.0.2",
12
+ "@mekari/pixel3-icon": "0.0.5",
13
+ "@mekari/pixel3-styled-system": "0.0.3",
14
+ "@mekari/pixel3-utils": "0.0.4"
15
+ },
16
+ "peerDependencies": {
17
+ "vue": "^3.4.9"
18
+ },
19
+ "devDependencies": {
20
+ "vue": "^3.4.9"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "module": "dist/index.mjs",
26
+ "types": "dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "require": "./dist/index.js",
31
+ "default": "./dist/index.mjs"
32
+ }
33
+ },
34
+ "scripts": {
35
+ "clean": "rimraf dist .turbo",
36
+ "build": "tsup && pnpm build:types",
37
+ "build:fast": "tsup",
38
+ "build:types": "tsup src --dts-only",
39
+ "build:external": "tsup src/index.tsx --external",
40
+ "types:check": "tsc --noEmit",
41
+ "replace-config": "clean-package",
42
+ "restore-config": "clean-package restore"
43
+ }
44
+ }