d9-toast 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Icons.js CHANGED
@@ -1,145 +1,162 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
2
  var Icons = function Icons(_ref) {
2
3
  var name = _ref.name;
3
4
  var icons = {
4
- success: /*#__PURE__*/React.createElement("svg", {
5
+ success: /*#__PURE__*/_jsx("svg", {
5
6
  xmlns: "http://www.w3.org/2000/svg",
6
7
  viewBox: "0 0 24 24",
7
8
  width: "1em",
8
- height: "1em"
9
- }, /*#__PURE__*/React.createElement("path", {
10
- fill: "currentColor",
11
- fillRule: "evenodd",
12
- d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-1.177-7.86l-2.765-2.767L7 12.431l3.119 3.121a1 1 0 0 0 1.414 0l5.952-5.95l-1.062-1.062z"
13
- })),
14
- error: /*#__PURE__*/React.createElement("svg", {
9
+ height: "1em",
10
+ children: /*#__PURE__*/_jsx("path", {
11
+ fill: "currentColor",
12
+ fillRule: "evenodd",
13
+ d: "M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m-1.177-7.86l-2.765-2.767L7 12.431l3.119 3.121a1 1 0 0 0 1.414 0l5.952-5.95l-1.062-1.062z"
14
+ })
15
+ }),
16
+ error: /*#__PURE__*/_jsx("svg", {
15
17
  xmlns: "http://www.w3.org/2000/svg",
16
18
  viewBox: "0 0 24 24",
17
19
  width: "1em",
18
- height: "1em"
19
- }, /*#__PURE__*/React.createElement("path", {
20
- d: "M16.707 2.293A.996.996 0 0 0 16 2H8a.996.996 0 0 0-.707.293l-5 5A.996.996 0 0 0 2 8v8c0 .266.105.52.293.707l5 5A.996.996 0 0 0 8 22h8c.266 0 .52-.105.707-.293l5-5A.996.996 0 0 0 22 16V8a.996.996 0 0 0-.293-.707l-5-5zM13 17h-2v-2h2v2zm0-4h-2V7h2v6z",
21
- fill: "currentColor"
22
- })),
23
- info: /*#__PURE__*/React.createElement("svg", {
20
+ height: "1em",
21
+ children: /*#__PURE__*/_jsx("path", {
22
+ d: "M16.707 2.293A.996.996 0 0 0 16 2H8a.996.996 0 0 0-.707.293l-5 5A.996.996 0 0 0 2 8v8c0 .266.105.52.293.707l5 5A.996.996 0 0 0 8 22h8c.266 0 .52-.105.707-.293l5-5A.996.996 0 0 0 22 16V8a.996.996 0 0 0-.293-.707l-5-5zM13 17h-2v-2h2v2zm0-4h-2V7h2v6z",
23
+ fill: "currentColor"
24
+ })
25
+ }),
26
+ info: /*#__PURE__*/_jsx("svg", {
24
27
  xmlns: "http://www.w3.org/2000/svg",
25
28
  viewBox: "0 0 24 24",
26
29
  width: "1em",
27
- height: "1em"
28
- }, /*#__PURE__*/React.createElement("path", {
29
- fill: "currentColor",
30
- d: "M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1-19.995.324L2 12l.004-.28C2.152 6.327 6.57 2 12 2m0 9h-1l-.117.007a1 1 0 0 0 0 1.986L11 13v3l.007.117a1 1 0 0 0 .876.876L12 17h1l.117-.007a1 1 0 0 0 .876-.876L14 16l-.007-.117a1 1 0 0 0-.764-.857l-.112-.02L13 15v-3l-.007-.117a1 1 0 0 0-.876-.876zm.01-3l-.127.007a1 1 0 0 0 0 1.986L12 10l.127-.007a1 1 0 0 0 0-1.986z"
31
- })),
32
- warning: /*#__PURE__*/React.createElement("svg", {
30
+ height: "1em",
31
+ children: /*#__PURE__*/_jsx("path", {
32
+ fill: "currentColor",
33
+ d: "M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1-19.995.324L2 12l.004-.28C2.152 6.327 6.57 2 12 2m0 9h-1l-.117.007a1 1 0 0 0 0 1.986L11 13v3l.007.117a1 1 0 0 0 .876.876L12 17h1l.117-.007a1 1 0 0 0 .876-.876L14 16l-.007-.117a1 1 0 0 0-.764-.857l-.112-.02L13 15v-3l-.007-.117a1 1 0 0 0-.876-.876zm.01-3l-.127.007a1 1 0 0 0 0 1.986L12 10l.127-.007a1 1 0 0 0 0-1.986z"
34
+ })
35
+ }),
36
+ warning: /*#__PURE__*/_jsx("svg", {
33
37
  xmlns: "http://www.w3.org/2000/svg",
34
38
  viewBox: "0 0 24 24",
35
39
  width: "1em",
36
- height: "1em"
37
- }, /*#__PURE__*/React.createElement("path", {
38
- fill: "currentColor",
39
- d: "m21.171 15.398l-5.912-9.854C14.483 4.251 13.296 3.511 12 3.511s-2.483.74-3.259 2.031l-5.912 9.856c-.786 1.309-.872 2.705-.235 3.83C3.23 20.354 4.472 21 6 21h12c1.528 0 2.77-.646 3.406-1.771s.551-2.521-.235-3.831M12 17.549c-.854 0-1.55-.695-1.55-1.549c0-.855.695-1.551 1.55-1.551s1.55.696 1.55 1.551c0 .854-.696 1.549-1.55 1.549m1.633-7.424c-.011.031-1.401 3.468-1.401 3.468c-.038.094-.13.156-.231.156s-.193-.062-.231-.156l-1.391-3.438a1.8 1.8 0 0 1-.129-.655c0-.965.785-1.75 1.75-1.75a1.752 1.752 0 0 1 1.633 2.375"
40
- })),
41
- loading: /*#__PURE__*/React.createElement("svg", {
40
+ height: "1em",
41
+ children: /*#__PURE__*/_jsx("path", {
42
+ fill: "currentColor",
43
+ d: "m21.171 15.398l-5.912-9.854C14.483 4.251 13.296 3.511 12 3.511s-2.483.74-3.259 2.031l-5.912 9.856c-.786 1.309-.872 2.705-.235 3.83C3.23 20.354 4.472 21 6 21h12c1.528 0 2.77-.646 3.406-1.771s.551-2.521-.235-3.831M12 17.549c-.854 0-1.55-.695-1.55-1.549c0-.855.695-1.551 1.55-1.551s1.55.696 1.55 1.551c0 .854-.696 1.549-1.55 1.549m1.633-7.424c-.011.031-1.401 3.468-1.401 3.468c-.038.094-.13.156-.231.156s-.193-.062-.231-.156l-1.391-3.438a1.8 1.8 0 0 1-.129-.655c0-.965.785-1.75 1.75-1.75a1.752 1.752 0 0 1 1.633 2.375"
44
+ })
45
+ }),
46
+ loading: /*#__PURE__*/_jsx("svg", {
42
47
  xmlns: "http://www.w3.org/2000/svg",
43
48
  viewBox: "0 0 24 24",
44
49
  width: "1em",
45
- height: "1em"
46
- }, /*#__PURE__*/React.createElement("g", {
47
- fill: "none",
48
- stroke: "currentColor",
49
- strokeLinecap: "round",
50
- strokeLinejoin: "round",
51
- strokeWidth: "2"
52
- }, /*#__PURE__*/React.createElement("path", {
53
- strokeDasharray: "16",
54
- strokeDashoffset: "16",
55
- d: "M12 3c4.97 0 9 4.03 9 9"
56
- }, /*#__PURE__*/React.createElement("animate", {
57
- fill: "freeze",
58
- attributeName: "stroke-dashoffset",
59
- dur: "0.3s",
60
- values: "16;0"
61
- }), /*#__PURE__*/React.createElement("animateTransform", {
62
- attributeName: "transform",
63
- dur: "1.5s",
64
- repeatCount: "indefinite",
65
- type: "rotate",
66
- values: "0 12 12;360 12 12"
67
- })), /*#__PURE__*/React.createElement("path", {
68
- strokeDasharray: "64",
69
- strokeDashoffset: "64",
70
- strokeOpacity: ".3",
71
- d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z"
72
- }, /*#__PURE__*/React.createElement("animate", {
73
- fill: "freeze",
74
- attributeName: "stroke-dashoffset",
75
- dur: "1.2s",
76
- values: "64;0"
77
- })))),
78
- submit: /*#__PURE__*/React.createElement("svg", {
50
+ height: "1em",
51
+ children: /*#__PURE__*/_jsxs("g", {
52
+ fill: "none",
53
+ stroke: "currentColor",
54
+ strokeLinecap: "round",
55
+ strokeLinejoin: "round",
56
+ strokeWidth: "2",
57
+ children: [/*#__PURE__*/_jsxs("path", {
58
+ strokeDasharray: "16",
59
+ strokeDashoffset: "16",
60
+ d: "M12 3c4.97 0 9 4.03 9 9",
61
+ children: [/*#__PURE__*/_jsx("animate", {
62
+ fill: "freeze",
63
+ attributeName: "stroke-dashoffset",
64
+ dur: "0.3s",
65
+ values: "16;0"
66
+ }), /*#__PURE__*/_jsx("animateTransform", {
67
+ attributeName: "transform",
68
+ dur: "1.5s",
69
+ repeatCount: "indefinite",
70
+ type: "rotate",
71
+ values: "0 12 12;360 12 12"
72
+ })]
73
+ }), /*#__PURE__*/_jsx("path", {
74
+ strokeDasharray: "64",
75
+ strokeDashoffset: "64",
76
+ strokeOpacity: ".3",
77
+ d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9Z",
78
+ children: /*#__PURE__*/_jsx("animate", {
79
+ fill: "freeze",
80
+ attributeName: "stroke-dashoffset",
81
+ dur: "1.2s",
82
+ values: "64;0"
83
+ })
84
+ })]
85
+ })
86
+ }),
87
+ submit: /*#__PURE__*/_jsx("svg", {
79
88
  xmlns: "http://www.w3.org/2000/svg",
80
89
  viewBox: "0 0 24 24",
81
90
  width: "1em",
82
- height: "1em"
83
- }, /*#__PURE__*/React.createElement("g", {
84
- fill: "none",
85
- stroke: "currentColor",
86
- strokeLinecap: "round",
87
- strokeLinejoin: "round",
88
- strokeWidth: "2"
89
- }, /*#__PURE__*/React.createElement("path", {
90
- strokeDasharray: "2 4",
91
- strokeDashoffset: "6",
92
- d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9"
93
- }, /*#__PURE__*/React.createElement("animate", {
94
- attributeName: "stroke-dashoffset",
95
- dur: "0.6s",
96
- repeatCount: "indefinite",
97
- values: "6;0"
98
- })), /*#__PURE__*/React.createElement("path", {
99
- strokeDasharray: "32",
100
- strokeDashoffset: "32",
101
- d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9"
102
- }, /*#__PURE__*/React.createElement("animate", {
103
- fill: "freeze",
104
- attributeName: "stroke-dashoffset",
105
- begin: "0.1s",
106
- dur: "0.4s",
107
- values: "32;0"
108
- })), /*#__PURE__*/React.createElement("path", {
109
- strokeDasharray: "10",
110
- strokeDashoffset: "10",
111
- d: "M12 16v-7.5"
112
- }, /*#__PURE__*/React.createElement("animate", {
113
- fill: "freeze",
114
- attributeName: "stroke-dashoffset",
115
- begin: "0.5s",
116
- dur: "0.2s",
117
- values: "10;0"
118
- })), /*#__PURE__*/React.createElement("path", {
119
- strokeDasharray: "6",
120
- strokeDashoffset: "6",
121
- d: "M12 8.5l3.5 3.5M12 8.5l-3.5 3.5"
122
- }, /*#__PURE__*/React.createElement("animate", {
123
- fill: "freeze",
124
- attributeName: "stroke-dashoffset",
125
- begin: "0.7s",
126
- dur: "0.2s",
127
- values: "6;0"
128
- })))),
129
- X: /*#__PURE__*/React.createElement("svg", {
91
+ height: "1em",
92
+ children: /*#__PURE__*/_jsxs("g", {
93
+ fill: "none",
94
+ stroke: "currentColor",
95
+ strokeLinecap: "round",
96
+ strokeLinejoin: "round",
97
+ strokeWidth: "2",
98
+ children: [/*#__PURE__*/_jsx("path", {
99
+ strokeDasharray: "2 4",
100
+ strokeDashoffset: "6",
101
+ d: "M12 21c-4.97 0 -9 -4.03 -9 -9c0 -4.97 4.03 -9 9 -9",
102
+ children: /*#__PURE__*/_jsx("animate", {
103
+ attributeName: "stroke-dashoffset",
104
+ dur: "0.6s",
105
+ repeatCount: "indefinite",
106
+ values: "6;0"
107
+ })
108
+ }), /*#__PURE__*/_jsx("path", {
109
+ strokeDasharray: "32",
110
+ strokeDashoffset: "32",
111
+ d: "M12 3c4.97 0 9 4.03 9 9c0 4.97 -4.03 9 -9 9",
112
+ children: /*#__PURE__*/_jsx("animate", {
113
+ fill: "freeze",
114
+ attributeName: "stroke-dashoffset",
115
+ begin: "0.1s",
116
+ dur: "0.4s",
117
+ values: "32;0"
118
+ })
119
+ }), /*#__PURE__*/_jsx("path", {
120
+ strokeDasharray: "10",
121
+ strokeDashoffset: "10",
122
+ d: "M12 16v-7.5",
123
+ children: /*#__PURE__*/_jsx("animate", {
124
+ fill: "freeze",
125
+ attributeName: "stroke-dashoffset",
126
+ begin: "0.5s",
127
+ dur: "0.2s",
128
+ values: "10;0"
129
+ })
130
+ }), /*#__PURE__*/_jsx("path", {
131
+ strokeDasharray: "6",
132
+ strokeDashoffset: "6",
133
+ d: "M12 8.5l3.5 3.5M12 8.5l-3.5 3.5",
134
+ children: /*#__PURE__*/_jsx("animate", {
135
+ fill: "freeze",
136
+ attributeName: "stroke-dashoffset",
137
+ begin: "0.7s",
138
+ dur: "0.2s",
139
+ values: "6;0"
140
+ })
141
+ })]
142
+ })
143
+ }),
144
+ X: /*#__PURE__*/_jsx("svg", {
130
145
  xmlns: "http://www.w3.org/2000/svg",
131
146
  viewBox: "0 0 24 24",
132
147
  width: "1em",
133
- height: "1em"
134
- }, /*#__PURE__*/React.createElement("g", {
135
- fill: "currentColor",
136
- fillRule: "evenodd",
137
- clipRule: "evenodd"
138
- }, /*#__PURE__*/React.createElement("path", {
139
- d: "M5.47 5.47a.75.75 0 0 1 1.06 0l12 12a.75.75 0 1 1-1.06 1.06l-12-12a.75.75 0 0 1 0-1.06"
140
- }), /*#__PURE__*/React.createElement("path", {
141
- d: "M18.53 5.47a.75.75 0 0 1 0 1.06l-12 12a.75.75 0 0 1-1.06-1.06l12-12a.75.75 0 0 1 1.06 0"
142
- })))
148
+ height: "1em",
149
+ children: /*#__PURE__*/_jsxs("g", {
150
+ fill: "currentColor",
151
+ fillRule: "evenodd",
152
+ clipRule: "evenodd",
153
+ children: [/*#__PURE__*/_jsx("path", {
154
+ d: "M5.47 5.47a.75.75 0 0 1 1.06 0l12 12a.75.75 0 1 1-1.06 1.06l-12-12a.75.75 0 0 1 0-1.06"
155
+ }), /*#__PURE__*/_jsx("path", {
156
+ d: "M18.53 5.47a.75.75 0 0 1 0 1.06l-12 12a.75.75 0 0 1-1.06-1.06l12-12a.75.75 0 0 1 1.06 0"
157
+ })]
158
+ })
159
+ })
143
160
  };
144
161
  return icons[name];
145
162
  };
package/dist/Toast.js CHANGED
@@ -6,6 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
6
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
7
  import { useEffect, useRef, useState } from "react";
8
8
  import Icons from "./Icons.js";
9
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
9
10
  var Toast = function Toast(_ref) {
10
11
  var id = _ref.id,
11
12
  message = _ref.message,
@@ -111,46 +112,57 @@ var Toast = function Toast(_ref) {
111
112
  };
112
113
  var keyframes = "\n @keyframes downToUp{\n from {\n transform: translateY(100%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n }\n @keyframes upToDown{\n from {\n transform: translateY(-100%);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n }\n ";
113
114
  var animation = "".concat(position.startsWith("top") && "upToDown" || position.startsWith("bottom") && "downToUp" || position.endsWith("top") && "upToDown" || position.endsWith("bottom") && "downToUp", " 0.3s ease-in");
114
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, keyframes), /*#__PURE__*/React.createElement("div", {
115
- style: {
116
- animation: animation
117
- },
118
- className: "w-80 ".concat(theme === "light" ? "bg-gray-50 text-gray-950" : "bg-gray-950 text-gray-50", " shadow-lg rounded-lg p-1.5 flex flex-col gap-2 relative"),
119
- onMouseEnter: pauseOnHover ? pauseTimer : undefined,
120
- onMouseLeave: pauseOnHover ? resumeTimer : undefined
121
- }, /*#__PURE__*/React.createElement("div", {
122
- className: "flex justify-between items-center px-1 py-0.5 rounded-md inset-shadow-2xs ".concat(colors[type])
123
- }, /*#__PURE__*/React.createElement("span", {
124
- className: "flex items-center gap-2 font-medium text-base"
125
- }, /*#__PURE__*/React.createElement(Icons, {
126
- name: type
127
- }), " ", type.toUpperCase()), closable && /*#__PURE__*/React.createElement("button", {
128
- className: " hover:text-red-600 cursor-pointer",
129
- onClick: remove
130
- }, /*#__PURE__*/React.createElement(Icons, {
131
- name: "X"
132
- }))), /*#__PURE__*/React.createElement("p", {
133
- className: "p-1"
134
- }, message), actions.length > 0 && /*#__PURE__*/React.createElement("div", {
135
- className: "flex justify-end gap-2 mb-2"
136
- }, actions.map(function (a, idx) {
137
- return /*#__PURE__*/React.createElement("button", {
138
- key: idx,
139
- onClick: function onClick() {
140
- var _a$callback;
141
- return (_a$callback = a.callback) === null || _a$callback === void 0 ? void 0 : _a$callback.call(a, {
142
- id: id
143
- });
115
+ return /*#__PURE__*/_jsxs(_Fragment, {
116
+ children: [/*#__PURE__*/_jsx("style", {
117
+ children: keyframes
118
+ }), /*#__PURE__*/_jsxs("div", {
119
+ style: {
120
+ animation: animation
144
121
  },
145
- className: "px-3 py-1 text-sm rounded ".concat(idx === 1 ? "".concat(colors[type], " bg-transparent") : colors[type], " ").concat(theme === "dark" ? "text-gray-50" : "text-gray-900", " ring cursor-pointer")
146
- }, a.text);
147
- })), progress && duration !== 0 && /*#__PURE__*/React.createElement("div", {
148
- className: "h-1 w-full bg-gray-200 rounded overflow-hidden absolute bottom-0 left-0"
149
- }, /*#__PURE__*/React.createElement("div", {
150
- className: "h-1 ".concat(colors[type], " transition-all"),
151
- style: {
152
- width: "".concat(progressWidth, "%")
153
- }
154
- }))));
122
+ className: "w-80 ".concat(theme === "light" ? "bg-gray-50 text-gray-950" : "bg-gray-950 text-gray-50", " shadow-lg rounded-lg p-1.5 flex flex-col gap-2 relative"),
123
+ onMouseEnter: pauseOnHover ? pauseTimer : undefined,
124
+ onMouseLeave: pauseOnHover ? resumeTimer : undefined,
125
+ children: [/*#__PURE__*/_jsxs("div", {
126
+ className: "flex justify-between items-center px-1 py-0.5 rounded-md inset-shadow-2xs ".concat(colors[type]),
127
+ children: [/*#__PURE__*/_jsxs("span", {
128
+ className: "flex items-center gap-2 font-medium text-base",
129
+ children: [/*#__PURE__*/_jsx(Icons, {
130
+ name: type
131
+ }), " ", type.toUpperCase()]
132
+ }), closable && /*#__PURE__*/_jsx("button", {
133
+ className: " hover:text-red-600 cursor-pointer",
134
+ onClick: remove,
135
+ children: /*#__PURE__*/_jsx(Icons, {
136
+ name: "X"
137
+ })
138
+ })]
139
+ }), /*#__PURE__*/_jsx("p", {
140
+ className: "p-1",
141
+ children: message
142
+ }), actions.length > 0 && /*#__PURE__*/_jsx("div", {
143
+ className: "flex justify-end gap-2 mb-2",
144
+ children: actions.map(function (a, idx) {
145
+ return /*#__PURE__*/_jsx("button", {
146
+ onClick: function onClick() {
147
+ var _a$callback;
148
+ return (_a$callback = a.callback) === null || _a$callback === void 0 ? void 0 : _a$callback.call(a, {
149
+ id: id
150
+ });
151
+ },
152
+ className: "px-3 py-1 text-sm rounded ".concat(idx === 1 ? "".concat(colors[type], " bg-transparent") : colors[type], " ").concat(theme === "dark" ? "text-gray-50" : "text-gray-900", " ring cursor-pointer"),
153
+ children: a.text
154
+ }, idx);
155
+ })
156
+ }), progress && duration !== 0 && /*#__PURE__*/_jsx("div", {
157
+ className: "h-1 w-full bg-gray-200 rounded overflow-hidden absolute bottom-0 left-0",
158
+ children: /*#__PURE__*/_jsx("div", {
159
+ className: "h-1 ".concat(colors[type], " transition-all"),
160
+ style: {
161
+ width: "".concat(progressWidth, "%")
162
+ }
163
+ })
164
+ })]
165
+ })]
166
+ });
155
167
  };
156
168
  export default Toast;
@@ -1,5 +1,4 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
2
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
4
3
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
4
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
@@ -17,6 +16,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
17
16
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
18
17
  import { createContext, useCallback, useContext, useState } from "react";
19
18
  import Toast from "./Toast.js";
19
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
20
20
  var ToastContext = /*#__PURE__*/createContext();
21
21
  export var useToast = function useToast() {
22
22
  return useContext(ToastContext);
@@ -81,21 +81,21 @@ export var ToastProvider = function ToastProvider(_ref) {
81
81
  });
82
82
  });
83
83
  }, []);
84
- return /*#__PURE__*/React.createElement(ToastContext.Provider, {
84
+ return /*#__PURE__*/_jsxs(ToastContext.Provider, {
85
85
  value: {
86
86
  showToast: showToast,
87
87
  removeToast: removeToast
88
- }
89
- }, children, /*#__PURE__*/React.createElement("div", {
90
- className: "fixed z-50 flex gap-3 ".concat(getPositionClasses(position))
91
- }, toasts.map(function (toast) {
92
- return /*#__PURE__*/React.createElement(Toast, _extends({
93
- key: toast.id
94
- }, toast, {
95
- position: position,
96
- remove: function remove() {
97
- return removeToast(toast.id);
98
- }
99
- }));
100
- })));
88
+ },
89
+ children: [children, /*#__PURE__*/_jsx("div", {
90
+ className: "fixed z-50 flex gap-3 ".concat(getPositionClasses(position)),
91
+ children: toasts.map(function (toast) {
92
+ return /*#__PURE__*/_jsx(Toast, _objectSpread(_objectSpread({}, toast), {}, {
93
+ position: position,
94
+ remove: function remove() {
95
+ return removeToast(toast.id);
96
+ }
97
+ }), toast.id);
98
+ })
99
+ })]
100
+ });
101
101
  };
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
+ import React, { createContext, useState, useContext, useRef, useEffect, useCallback } from "react";
1
2
  import "../dist/toast.css";
2
3
  export { ToastProvider, useToast } from "./ToastContext.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "d9-toast",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Customizable toast notifications for React",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",