@yamada-ui/notice 0.3.6 → 0.3.7
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/{chunk-BILB5EAU.mjs → chunk-NHAFNMZC.mjs} +40 -6
- package/dist/index.js +34 -5
- package/dist/index.mjs +1 -1
- package/dist/notice.js +34 -5
- package/dist/notice.mjs +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// src/notice.tsx
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
AlertDescription,
|
|
5
|
+
AlertIcon,
|
|
6
|
+
AlertTitle
|
|
7
|
+
} from "@yamada-ui/alert";
|
|
3
8
|
import { CloseButton } from "@yamada-ui/close-button";
|
|
4
9
|
import {
|
|
5
10
|
ui,
|
|
@@ -21,7 +26,14 @@ var getNoticePlacement = (state, id) => {
|
|
|
21
26
|
}
|
|
22
27
|
};
|
|
23
28
|
var counter = 0;
|
|
24
|
-
var createNotice = (message, {
|
|
29
|
+
var createNotice = (message, {
|
|
30
|
+
id,
|
|
31
|
+
placement = "top",
|
|
32
|
+
duration,
|
|
33
|
+
onCloseComplete,
|
|
34
|
+
status,
|
|
35
|
+
style
|
|
36
|
+
}) => {
|
|
25
37
|
counter += 1;
|
|
26
38
|
id = id != null ? id : counter;
|
|
27
39
|
return {
|
|
@@ -67,7 +79,10 @@ var createNoticeFunc = (defaultOptions, theme) => {
|
|
|
67
79
|
};
|
|
68
80
|
var useNotice = (defaultOptions) => {
|
|
69
81
|
const { theme } = useTheme();
|
|
70
|
-
return useMemo(
|
|
82
|
+
return useMemo(
|
|
83
|
+
() => createNoticeFunc(defaultOptions != null ? defaultOptions : {}, theme),
|
|
84
|
+
[defaultOptions, theme]
|
|
85
|
+
);
|
|
71
86
|
};
|
|
72
87
|
var initialState = {
|
|
73
88
|
top: [],
|
|
@@ -148,7 +163,10 @@ var createNoticeStore = (initialState2) => {
|
|
|
148
163
|
placements = placement;
|
|
149
164
|
return placements.reduce(
|
|
150
165
|
(acc, placement2) => {
|
|
151
|
-
acc[placement2] = prev[placement2].map((notice) => ({
|
|
166
|
+
acc[placement2] = prev[placement2].map((notice) => ({
|
|
167
|
+
...notice,
|
|
168
|
+
isDelete: true
|
|
169
|
+
}));
|
|
152
170
|
return acc;
|
|
153
171
|
},
|
|
154
172
|
{ ...prev }
|
|
@@ -192,12 +210,28 @@ var Notice = ({
|
|
|
192
210
|
boxShadow: "lg",
|
|
193
211
|
pe: isClosable ? 8 : void 0,
|
|
194
212
|
children: [
|
|
195
|
-
/* @__PURE__ */ jsx(
|
|
213
|
+
/* @__PURE__ */ jsx(
|
|
214
|
+
AlertIcon,
|
|
215
|
+
{
|
|
216
|
+
variant: icon == null ? void 0 : icon.variant,
|
|
217
|
+
...(icon == null ? void 0 : icon.color) ? { color: icon.color } : {},
|
|
218
|
+
children: icon == null ? void 0 : icon.children
|
|
219
|
+
}
|
|
220
|
+
),
|
|
196
221
|
/* @__PURE__ */ jsxs(ui.div, { flex: "1", children: [
|
|
197
222
|
title ? /* @__PURE__ */ jsx(AlertTitle, { noOfLines: 1, children: title }) : null,
|
|
198
223
|
description ? /* @__PURE__ */ jsx(AlertDescription, { noOfLines: 3, children: description }) : null
|
|
199
224
|
] }),
|
|
200
|
-
isClosable ? /* @__PURE__ */ jsx(
|
|
225
|
+
isClosable ? /* @__PURE__ */ jsx(
|
|
226
|
+
CloseButton,
|
|
227
|
+
{
|
|
228
|
+
size: "sm",
|
|
229
|
+
onClick: onClose,
|
|
230
|
+
position: "absolute",
|
|
231
|
+
top: 2,
|
|
232
|
+
right: 2
|
|
233
|
+
}
|
|
234
|
+
) : null
|
|
201
235
|
]
|
|
202
236
|
}
|
|
203
237
|
);
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,14 @@ var getNoticePlacement = (state, id) => {
|
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
var counter = 0;
|
|
48
|
-
var createNotice = (message, {
|
|
48
|
+
var createNotice = (message, {
|
|
49
|
+
id,
|
|
50
|
+
placement = "top",
|
|
51
|
+
duration,
|
|
52
|
+
onCloseComplete,
|
|
53
|
+
status,
|
|
54
|
+
style
|
|
55
|
+
}) => {
|
|
49
56
|
counter += 1;
|
|
50
57
|
id = id != null ? id : counter;
|
|
51
58
|
return {
|
|
@@ -91,7 +98,10 @@ var createNoticeFunc = (defaultOptions, theme) => {
|
|
|
91
98
|
};
|
|
92
99
|
var useNotice = (defaultOptions) => {
|
|
93
100
|
const { theme } = (0, import_core.useTheme)();
|
|
94
|
-
return (0, import_react.useMemo)(
|
|
101
|
+
return (0, import_react.useMemo)(
|
|
102
|
+
() => createNoticeFunc(defaultOptions != null ? defaultOptions : {}, theme),
|
|
103
|
+
[defaultOptions, theme]
|
|
104
|
+
);
|
|
95
105
|
};
|
|
96
106
|
var initialState = {
|
|
97
107
|
top: [],
|
|
@@ -172,7 +182,10 @@ var createNoticeStore = (initialState2) => {
|
|
|
172
182
|
placements = placement;
|
|
173
183
|
return placements.reduce(
|
|
174
184
|
(acc, placement2) => {
|
|
175
|
-
acc[placement2] = prev[placement2].map((notice) => ({
|
|
185
|
+
acc[placement2] = prev[placement2].map((notice) => ({
|
|
186
|
+
...notice,
|
|
187
|
+
isDelete: true
|
|
188
|
+
}));
|
|
176
189
|
return acc;
|
|
177
190
|
},
|
|
178
191
|
{ ...prev }
|
|
@@ -216,12 +229,28 @@ var Notice = ({
|
|
|
216
229
|
boxShadow: "lg",
|
|
217
230
|
pe: isClosable ? 8 : void 0,
|
|
218
231
|
children: [
|
|
219
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
233
|
+
import_alert.AlertIcon,
|
|
234
|
+
{
|
|
235
|
+
variant: icon == null ? void 0 : icon.variant,
|
|
236
|
+
...(icon == null ? void 0 : icon.color) ? { color: icon.color } : {},
|
|
237
|
+
children: icon == null ? void 0 : icon.children
|
|
238
|
+
}
|
|
239
|
+
),
|
|
220
240
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { flex: "1", children: [
|
|
221
241
|
title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_alert.AlertTitle, { noOfLines: 1, children: title }) : null,
|
|
222
242
|
description ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_alert.AlertDescription, { noOfLines: 3, children: description }) : null
|
|
223
243
|
] }),
|
|
224
|
-
isClosable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
244
|
+
isClosable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
245
|
+
import_close_button.CloseButton,
|
|
246
|
+
{
|
|
247
|
+
size: "sm",
|
|
248
|
+
onClick: onClose,
|
|
249
|
+
position: "absolute",
|
|
250
|
+
top: 2,
|
|
251
|
+
right: 2
|
|
252
|
+
}
|
|
253
|
+
) : null
|
|
225
254
|
]
|
|
226
255
|
}
|
|
227
256
|
);
|
package/dist/index.mjs
CHANGED
package/dist/notice.js
CHANGED
|
@@ -43,7 +43,14 @@ var getNoticePlacement = (state, id) => {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
var counter = 0;
|
|
46
|
-
var createNotice = (message, {
|
|
46
|
+
var createNotice = (message, {
|
|
47
|
+
id,
|
|
48
|
+
placement = "top",
|
|
49
|
+
duration,
|
|
50
|
+
onCloseComplete,
|
|
51
|
+
status,
|
|
52
|
+
style
|
|
53
|
+
}) => {
|
|
47
54
|
counter += 1;
|
|
48
55
|
id = id != null ? id : counter;
|
|
49
56
|
return {
|
|
@@ -89,7 +96,10 @@ var createNoticeFunc = (defaultOptions, theme) => {
|
|
|
89
96
|
};
|
|
90
97
|
var useNotice = (defaultOptions) => {
|
|
91
98
|
const { theme } = (0, import_core.useTheme)();
|
|
92
|
-
return (0, import_react.useMemo)(
|
|
99
|
+
return (0, import_react.useMemo)(
|
|
100
|
+
() => createNoticeFunc(defaultOptions != null ? defaultOptions : {}, theme),
|
|
101
|
+
[defaultOptions, theme]
|
|
102
|
+
);
|
|
93
103
|
};
|
|
94
104
|
var initialState = {
|
|
95
105
|
top: [],
|
|
@@ -170,7 +180,10 @@ var createNoticeStore = (initialState2) => {
|
|
|
170
180
|
placements = placement;
|
|
171
181
|
return placements.reduce(
|
|
172
182
|
(acc, placement2) => {
|
|
173
|
-
acc[placement2] = prev[placement2].map((notice) => ({
|
|
183
|
+
acc[placement2] = prev[placement2].map((notice) => ({
|
|
184
|
+
...notice,
|
|
185
|
+
isDelete: true
|
|
186
|
+
}));
|
|
174
187
|
return acc;
|
|
175
188
|
},
|
|
176
189
|
{ ...prev }
|
|
@@ -214,12 +227,28 @@ var Notice = ({
|
|
|
214
227
|
boxShadow: "lg",
|
|
215
228
|
pe: isClosable ? 8 : void 0,
|
|
216
229
|
children: [
|
|
217
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
231
|
+
import_alert.AlertIcon,
|
|
232
|
+
{
|
|
233
|
+
variant: icon == null ? void 0 : icon.variant,
|
|
234
|
+
...(icon == null ? void 0 : icon.color) ? { color: icon.color } : {},
|
|
235
|
+
children: icon == null ? void 0 : icon.children
|
|
236
|
+
}
|
|
237
|
+
),
|
|
218
238
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { flex: "1", children: [
|
|
219
239
|
title ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_alert.AlertTitle, { noOfLines: 1, children: title }) : null,
|
|
220
240
|
description ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_alert.AlertDescription, { noOfLines: 3, children: description }) : null
|
|
221
241
|
] }),
|
|
222
|
-
isClosable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
242
|
+
isClosable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
243
|
+
import_close_button.CloseButton,
|
|
244
|
+
{
|
|
245
|
+
size: "sm",
|
|
246
|
+
onClick: onClose,
|
|
247
|
+
position: "absolute",
|
|
248
|
+
top: 2,
|
|
249
|
+
right: 2
|
|
250
|
+
}
|
|
251
|
+
) : null
|
|
223
252
|
]
|
|
224
253
|
}
|
|
225
254
|
);
|
package/dist/notice.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamada-ui/notice",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "Yamada UI notice component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"yamada",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"url": "https://github.com/hirotomoyamada/yamada-ui/issues"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yamada-ui/core": "0.5.
|
|
39
|
-
"@yamada-ui/close-button": "0.2.
|
|
40
|
-
"@yamada-ui/alert": "0.3.
|
|
41
|
-
"@yamada-ui/utils": "0.1.
|
|
38
|
+
"@yamada-ui/core": "0.5.2",
|
|
39
|
+
"@yamada-ui/close-button": "0.2.7",
|
|
40
|
+
"@yamada-ui/alert": "0.3.7",
|
|
41
|
+
"@yamada-ui/utils": "0.1.4"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"react": "^18.0.0",
|