asterui 0.12.49 → 0.12.51
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/components/Alert.js +18 -18
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/Autocomplete.js +115 -114
- package/dist/components/Autocomplete.js.map +1 -1
- package/dist/components/Avatar.js +33 -32
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Badge.js +99 -99
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Breadcrumb.js +12 -11
- package/dist/components/Breadcrumb.js.map +1 -1
- package/dist/components/Browser.js +10 -10
- package/dist/components/Browser.js.map +1 -1
- package/dist/components/Button.js +80 -79
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts +2 -0
- package/dist/components/Card.js +111 -110
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Carousel.js +59 -59
- package/dist/components/Carousel.js.map +1 -1
- package/dist/components/Cascader.js +175 -174
- package/dist/components/Cascader.js.map +1 -1
- package/dist/components/Chat.js +27 -27
- package/dist/components/Chat.js.map +1 -1
- package/dist/components/Checkbox.js +98 -97
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Code.js +11 -11
- package/dist/components/Code.js.map +1 -1
- package/dist/components/Collapse.js +46 -46
- package/dist/components/Collapse.js.map +1 -1
- package/dist/components/ColorPicker.d.ts +1 -1
- package/dist/components/ColorPicker.js +93 -91
- package/dist/components/ColorPicker.js.map +1 -1
- package/dist/components/Command.js +120 -120
- package/dist/components/Command.js.map +1 -1
- package/dist/components/ConfigProvider.d.ts +1 -1
- package/dist/components/ConfigProvider.js +9 -9
- package/dist/components/ConfigProvider.js.map +1 -1
- package/dist/components/ContextMenu.js +33 -33
- package/dist/components/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton.js +74 -73
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/Countdown.js +60 -59
- package/dist/components/Countdown.js.map +1 -1
- package/dist/components/DatePicker.d.ts +1 -1
- package/dist/components/DatePicker.js +54 -53
- package/dist/components/DatePicker.js.map +1 -1
- package/dist/components/Diff.js +10 -10
- package/dist/components/Diff.js.map +1 -1
- package/dist/components/Divider.js +21 -20
- package/dist/components/Divider.js.map +1 -1
- package/dist/components/Dock.js +28 -27
- package/dist/components/Dock.js.map +1 -1
- package/dist/components/Drawer.js +43 -43
- package/dist/components/Drawer.js.map +1 -1
- package/dist/components/Dropdown.js +127 -127
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/Empty.js +16 -15
- package/dist/components/Empty.js.map +1 -1
- package/dist/components/Fieldset.js +11 -10
- package/dist/components/Fieldset.js.map +1 -1
- package/dist/components/FileInput.js +30 -29
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Filter.d.ts +1 -1
- package/dist/components/Filter.js +32 -30
- package/dist/components/Filter.js.map +1 -1
- package/dist/components/FloatButton.js +83 -83
- package/dist/components/FloatButton.js.map +1 -1
- package/dist/components/Footer.js +14 -13
- package/dist/components/Footer.js.map +1 -1
- package/dist/components/Form.js +133 -132
- package/dist/components/Form.js.map +1 -1
- package/dist/components/Hero.js +12 -11
- package/dist/components/Hero.js.map +1 -1
- package/dist/components/HoverGallery.js +7 -7
- package/dist/components/HoverGallery.js.map +1 -1
- package/dist/components/Image.js +40 -40
- package/dist/components/Image.js.map +1 -1
- package/dist/components/Input.js +171 -169
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputNumber.js +84 -83
- package/dist/components/InputNumber.js.map +1 -1
- package/dist/components/Join.js +11 -10
- package/dist/components/Join.js.map +1 -1
- package/dist/components/Kbd.js +15 -15
- package/dist/components/Kbd.js.map +1 -1
- package/dist/components/List.d.ts +1 -1
- package/dist/components/List.js +75 -72
- package/dist/components/List.js.map +1 -1
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Loading.js +31 -29
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/Mask.js +31 -31
- package/dist/components/Mask.js.map +1 -1
- package/dist/components/Mention.js +61 -61
- package/dist/components/Mention.js.map +1 -1
- package/dist/components/Menu.js +84 -84
- package/dist/components/Menu.js.map +1 -1
- package/dist/components/Message.js +30 -29
- package/dist/components/Message.js.map +1 -1
- package/dist/components/Modal.js +117 -116
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/MonthCalendar.d.ts +31 -0
- package/dist/components/MonthCalendar.js +205 -0
- package/dist/components/MonthCalendar.js.map +1 -0
- package/dist/components/Navbar.js +25 -25
- package/dist/components/Navbar.js.map +1 -1
- package/dist/components/Notification.js +56 -55
- package/dist/components/Notification.js.map +1 -1
- package/dist/components/OTPInput.js +69 -68
- package/dist/components/OTPInput.js.map +1 -1
- package/dist/components/Pagination.d.ts +1 -1
- package/dist/components/Pagination.js +60 -58
- package/dist/components/Pagination.js.map +1 -1
- package/dist/components/Phone.js +10 -10
- package/dist/components/Phone.js.map +1 -1
- package/dist/components/Popconfirm.js +60 -60
- package/dist/components/Popconfirm.js.map +1 -1
- package/dist/components/Progress.js +17 -17
- package/dist/components/Progress.js.map +1 -1
- package/dist/components/QRCode.js +23 -23
- package/dist/components/QRCode.js.map +1 -1
- package/dist/components/RadialProgress.js +17 -17
- package/dist/components/RadialProgress.js.map +1 -1
- package/dist/components/Radio.js +41 -40
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Range.d.ts +1 -1
- package/dist/components/Range.js +39 -37
- package/dist/components/Range.js.map +1 -1
- package/dist/components/Rating.js +79 -78
- package/dist/components/Rating.js.map +1 -1
- package/dist/components/ResponsiveDrawer.js +27 -27
- package/dist/components/ResponsiveDrawer.js.map +1 -1
- package/dist/components/RichTextEditor.d.ts +32 -0
- package/dist/components/RichTextEditor.js +335 -0
- package/dist/components/RichTextEditor.js.map +1 -0
- package/dist/components/Segmented.d.ts +1 -1
- package/dist/components/Segmented.js +48 -46
- package/dist/components/Segmented.js.map +1 -1
- package/dist/components/Select.js +55 -54
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Skeleton.js +9 -9
- package/dist/components/Skeleton.js.map +1 -1
- package/dist/components/Splitter.js +1 -3
- package/dist/components/Splitter.js.map +1 -1
- package/dist/components/Stat.js +17 -16
- package/dist/components/Stat.js.map +1 -1
- package/dist/components/Status.js +29 -29
- package/dist/components/Status.js.map +1 -1
- package/dist/components/Steps.js +61 -61
- package/dist/components/Steps.js.map +1 -1
- package/dist/components/Table.js +256 -256
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Tabs.js +65 -65
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Tag.js +147 -147
- package/dist/components/Tag.js.map +1 -1
- package/dist/components/TextRotate.js +6 -6
- package/dist/components/TextRotate.js.map +1 -1
- package/dist/components/Textarea.js +35 -34
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/ThemeController.d.ts +1 -1
- package/dist/components/ThemeController.js +71 -68
- package/dist/components/ThemeController.js.map +1 -1
- package/dist/components/TimePicker.d.ts +1 -1
- package/dist/components/TimePicker.js +133 -129
- package/dist/components/TimePicker.js.map +1 -1
- package/dist/components/Timeline.js +79 -79
- package/dist/components/Timeline.js.map +1 -1
- package/dist/components/Toggle.js +33 -32
- package/dist/components/Toggle.js.map +1 -1
- package/dist/components/Tooltip.js +25 -25
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/Tour.js +126 -126
- package/dist/components/Tour.js.map +1 -1
- package/dist/components/Transfer.js +93 -92
- package/dist/components/Transfer.js.map +1 -1
- package/dist/components/Tree.js +200 -200
- package/dist/components/Tree.js.map +1 -1
- package/dist/components/TreeSelect.js +255 -254
- package/dist/components/TreeSelect.js.map +1 -1
- package/dist/components/Typography.js +71 -70
- package/dist/components/Typography.js.map +1 -1
- package/dist/components/Upload.js +81 -81
- package/dist/components/Upload.js.map +1 -1
- package/dist/components/WeekCalendar.d.ts +35 -0
- package/dist/components/WeekCalendar.js +204 -0
- package/dist/components/WeekCalendar.js.map +1 -0
- package/dist/components/Window.js +7 -7
- package/dist/components/Window.js.map +1 -1
- package/dist/editor.d.ts +1 -0
- package/dist/editor.js +5 -0
- package/dist/editor.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +211 -207
- package/dist/index.js.map +1 -1
- package/package.json +30 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { jsxs as h, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as H, useState as Y } from "react";
|
|
3
|
+
const A = {
|
|
4
|
+
locale: "en",
|
|
5
|
+
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
6
|
+
monthsLong: [
|
|
7
|
+
"January",
|
|
8
|
+
"February",
|
|
9
|
+
"March",
|
|
10
|
+
"April",
|
|
11
|
+
"May",
|
|
12
|
+
"June",
|
|
13
|
+
"July",
|
|
14
|
+
"August",
|
|
15
|
+
"September",
|
|
16
|
+
"October",
|
|
17
|
+
"November",
|
|
18
|
+
"December"
|
|
19
|
+
],
|
|
20
|
+
moreText: "more"
|
|
21
|
+
}, M = (t) => C(t, /* @__PURE__ */ new Date()), C = (t, e) => {
|
|
22
|
+
const n = new Date(t), r = new Date(e);
|
|
23
|
+
return n.setHours(0, 0, 0, 0), r.setHours(0, 0, 0, 0), r.getTime() === n.getTime();
|
|
24
|
+
}, J = (t) => {
|
|
25
|
+
const e = /* @__PURE__ */ new Date(), n = new Date(t);
|
|
26
|
+
return e.setHours(0, 0, 0, 0), n.setHours(0, 0, 0, 0), n > e;
|
|
27
|
+
}, L = (t) => {
|
|
28
|
+
const e = /* @__PURE__ */ new Date(), n = new Date(t);
|
|
29
|
+
return e.setHours(0, 0, 0, 0), n.setHours(0, 0, 0, 0), n < e;
|
|
30
|
+
}, I = (t, e) => t.filter(
|
|
31
|
+
(n) => n.date.getDate() === e.getDate() && n.date.getMonth() === e.getMonth() && n.date.getFullYear() === e.getFullYear()
|
|
32
|
+
), $ = (t, e) => new Date(t, e + 1, 0).getDate(), q = (t, e) => new Date(t, e, 1).getDay(), z = (t, e) => {
|
|
33
|
+
const n = $(t, e), r = q(t, e), p = [];
|
|
34
|
+
if (r > 0) {
|
|
35
|
+
const o = e === 0 ? 11 : e - 1, a = e === 0 ? t - 1 : t, i = $(a, o);
|
|
36
|
+
for (let g = 0; g < r; g++) {
|
|
37
|
+
const x = i - r + g + 1;
|
|
38
|
+
p.push({
|
|
39
|
+
day: x,
|
|
40
|
+
month: o,
|
|
41
|
+
year: a,
|
|
42
|
+
isCurrentMonth: !1,
|
|
43
|
+
date: new Date(a, o, x)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const d = [];
|
|
48
|
+
for (let o = 1; o <= n; o++)
|
|
49
|
+
d.push({
|
|
50
|
+
day: o,
|
|
51
|
+
month: e,
|
|
52
|
+
year: t,
|
|
53
|
+
isCurrentMonth: !0,
|
|
54
|
+
date: new Date(t, e, o)
|
|
55
|
+
});
|
|
56
|
+
const m = [], u = 42 - (p.length + d.length);
|
|
57
|
+
if (u > 0) {
|
|
58
|
+
const o = e === 11 ? 0 : e + 1, a = e === 11 ? t + 1 : t;
|
|
59
|
+
for (let i = 1; i <= u; i++)
|
|
60
|
+
m.push({
|
|
61
|
+
day: i,
|
|
62
|
+
month: o,
|
|
63
|
+
year: a,
|
|
64
|
+
isCurrentMonth: !1,
|
|
65
|
+
date: new Date(a, o, i)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return [...p, ...d, ...m];
|
|
69
|
+
}, G = H(
|
|
70
|
+
({
|
|
71
|
+
date: t = /* @__PURE__ */ new Date(),
|
|
72
|
+
events: e = [],
|
|
73
|
+
maxEventsPerDay: n = 5,
|
|
74
|
+
onEventClick: r,
|
|
75
|
+
onDayClick: p,
|
|
76
|
+
onMoreEventsClick: d,
|
|
77
|
+
header: m,
|
|
78
|
+
daySelector: D,
|
|
79
|
+
locale: u = A,
|
|
80
|
+
ellipsis: o,
|
|
81
|
+
allowPastInteraction: a = !1,
|
|
82
|
+
className: i = "",
|
|
83
|
+
...g
|
|
84
|
+
}, x) => {
|
|
85
|
+
const [v, T] = Y(/* @__PURE__ */ new Date()), w = t.getFullYear(), N = t.getMonth();
|
|
86
|
+
return /* @__PURE__ */ h(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
ref: x,
|
|
90
|
+
className: `flex h-full w-full flex-col bg-base-100 ${i}`,
|
|
91
|
+
...g,
|
|
92
|
+
children: [
|
|
93
|
+
m && /* @__PURE__ */ l("div", { className: "mb-4 flex items-center justify-between", children: /* @__PURE__ */ l("div", { children: /* @__PURE__ */ h("h2", { className: "m-0 text-lg font-medium text-base-content", children: [
|
|
94
|
+
u.monthsLong[N],
|
|
95
|
+
" ",
|
|
96
|
+
w
|
|
97
|
+
] }) }) }),
|
|
98
|
+
/* @__PURE__ */ l("div", { className: "grid grid-cols-7 border-b border-base-300", children: u.daysShort.map((s, b) => /* @__PURE__ */ l(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: "py-1 text-center text-xs font-medium uppercase text-base-content/60",
|
|
102
|
+
children: s
|
|
103
|
+
},
|
|
104
|
+
b
|
|
105
|
+
)) }),
|
|
106
|
+
/* @__PURE__ */ l("div", { className: "grid flex-1 grid-cols-7 grid-rows-6 border-l border-base-300", children: z(w, N).map((s, b) => {
|
|
107
|
+
const f = I(e, s.date), y = L(s.date) && !M(s.date), F = D && C(s.date, v);
|
|
108
|
+
return /* @__PURE__ */ h(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
className: `
|
|
112
|
+
relative cursor-pointer overflow-hidden border-b border-r border-base-300 p-1
|
|
113
|
+
hover:bg-base-200
|
|
114
|
+
${s.isCurrentMonth ? "" : "bg-base-200"}
|
|
115
|
+
${M(s.date) ? "bg-primary/10" : ""}
|
|
116
|
+
${y ? "opacity-60" : ""}
|
|
117
|
+
${y && !a ? "cursor-not-allowed" : ""}
|
|
118
|
+
${F ? "z-10 outline outline-2 outline-primary" : ""}
|
|
119
|
+
`,
|
|
120
|
+
onClick: () => {
|
|
121
|
+
y && !a || (D && T(s.date), setTimeout(() => {
|
|
122
|
+
p?.(s.date);
|
|
123
|
+
}, 0));
|
|
124
|
+
},
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ l("div", { className: "mb-0.5 flex justify-center", children: /* @__PURE__ */ l(
|
|
127
|
+
"span",
|
|
128
|
+
{
|
|
129
|
+
className: `
|
|
130
|
+
flex items-center justify-center text-xs leading-none
|
|
131
|
+
${M(s.date) ? "font-bold text-primary" : "text-base-content"}
|
|
132
|
+
${s.isCurrentMonth ? "" : "text-base-content/40"}
|
|
133
|
+
${y && s.isCurrentMonth ? "text-base-content/40" : ""}
|
|
134
|
+
`,
|
|
135
|
+
children: s.day
|
|
136
|
+
}
|
|
137
|
+
) }),
|
|
138
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col", children: [
|
|
139
|
+
f.slice(
|
|
140
|
+
0,
|
|
141
|
+
f.length > n ? n - 1 : n
|
|
142
|
+
).map((c, k) => /* @__PURE__ */ h(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
className: `
|
|
146
|
+
flex cursor-pointer items-center rounded px-1 py-0.5 text-xs leading-none
|
|
147
|
+
transition-colors hover:bg-base-content/5
|
|
148
|
+
${J(c.date), "text-base-content"}
|
|
149
|
+
${c.strikethrough ? "line-through" : ""}
|
|
150
|
+
`,
|
|
151
|
+
style: c.style,
|
|
152
|
+
onClick: (S) => {
|
|
153
|
+
S.stopPropagation(), r && r(c);
|
|
154
|
+
},
|
|
155
|
+
title: c.title,
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ l(
|
|
158
|
+
"span",
|
|
159
|
+
{
|
|
160
|
+
className: "mr-1.5 inline-block h-2 w-2 shrink-0 rounded-full",
|
|
161
|
+
style: { backgroundColor: c.color }
|
|
162
|
+
}
|
|
163
|
+
),
|
|
164
|
+
/* @__PURE__ */ l(
|
|
165
|
+
"span",
|
|
166
|
+
{
|
|
167
|
+
className: `overflow-hidden whitespace-nowrap ${o ? "text-ellipsis" : ""}`,
|
|
168
|
+
children: c.title
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
k
|
|
174
|
+
)),
|
|
175
|
+
f.length > n && /* @__PURE__ */ h(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: "cursor-pointer rounded px-1 py-0.5 text-[11px] text-base-content/60 hover:bg-base-content/5",
|
|
179
|
+
onClick: (c) => {
|
|
180
|
+
c.stopPropagation(), d && d(s.date, f);
|
|
181
|
+
},
|
|
182
|
+
children: [
|
|
183
|
+
"+",
|
|
184
|
+
f.length - n + 1,
|
|
185
|
+
" ",
|
|
186
|
+
u.moreText
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
b
|
|
194
|
+
);
|
|
195
|
+
}) })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
G.displayName = "MonthCalendar";
|
|
202
|
+
export {
|
|
203
|
+
G as MonthCalendar
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=MonthCalendar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonthCalendar.js","sources":["../../src/components/MonthCalendar.tsx"],"sourcesContent":["import React, { useState, forwardRef } from 'react'\n\n// DaisyUI classes\n// (No DaisyUI classes used in this component)\n\n// Types\nexport type CalendarEvent = {\n date: Date\n title: string\n color: string\n strikethrough?: boolean\n style?: React.CSSProperties\n}\n\nexport type CalendarLocale = {\n locale: string\n daysShort: string[]\n monthsLong: string[]\n moreText: string\n formatTime?: (date: Date) => string\n}\n\n// Default English locale\nconst defaultLocale: CalendarLocale = {\n locale: 'en',\n daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n monthsLong: [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ],\n moreText: 'more',\n}\n\n// Utility functions\nconst isToday = (date: Date) => isEqual(date, new Date())\n\nconst isEqual = (a: Date, b: Date) => {\n const acopy = new Date(a)\n const bcopy = new Date(b)\n acopy.setHours(0, 0, 0, 0)\n bcopy.setHours(0, 0, 0, 0)\n return bcopy.getTime() === acopy.getTime()\n}\n\nconst isFutureDate = (date: Date) => {\n const today = new Date()\n const checkDate = new Date(date)\n today.setHours(0, 0, 0, 0)\n checkDate.setHours(0, 0, 0, 0)\n return checkDate > today\n}\n\nconst isPastDate = (date: Date) => {\n const today = new Date()\n const checkDate = new Date(date)\n today.setHours(0, 0, 0, 0)\n checkDate.setHours(0, 0, 0, 0)\n return checkDate < today\n}\n\nconst getEventsForDate = <T extends CalendarEvent>(events: T[], date: Date) => {\n return events.filter(\n (event) =>\n event.date.getDate() === date.getDate() &&\n event.date.getMonth() === date.getMonth() &&\n event.date.getFullYear() === date.getFullYear()\n )\n}\n\nconst getDaysInMonth = (year: number, month: number) => {\n return new Date(year, month + 1, 0).getDate()\n}\n\nconst getFirstDayOfMonth = (year: number, month: number) => {\n return new Date(year, month, 1).getDay()\n}\n\nconst generateCalendarGrid = (year: number, month: number) => {\n const daysInMonth = getDaysInMonth(year, month)\n const firstDayOfMonth = getFirstDayOfMonth(year, month)\n\n const prevMonthDays = []\n\n if (firstDayOfMonth > 0) {\n const prevMonth = month === 0 ? 11 : month - 1\n const prevMonthYear = month === 0 ? year - 1 : year\n const daysInPrevMonth = getDaysInMonth(prevMonthYear, prevMonth)\n\n for (let i = 0; i < firstDayOfMonth; i++) {\n const day = daysInPrevMonth - firstDayOfMonth + i + 1\n prevMonthDays.push({\n day,\n month: prevMonth,\n year: prevMonthYear,\n isCurrentMonth: false,\n date: new Date(prevMonthYear, prevMonth, day),\n })\n }\n }\n\n const currentMonthDays = []\n\n for (let day = 1; day <= daysInMonth; day++) {\n currentMonthDays.push({\n day,\n month,\n year,\n isCurrentMonth: true,\n date: new Date(year, month, day),\n })\n }\n\n const nextMonthDays = []\n const totalDaysDisplayed = prevMonthDays.length + currentMonthDays.length\n const daysToAdd = 6 * 7 - totalDaysDisplayed\n\n if (daysToAdd > 0) {\n const nextMonth = month === 11 ? 0 : month + 1\n const nextMonthYear = month === 11 ? year + 1 : year\n\n for (let day = 1; day <= daysToAdd; day++) {\n nextMonthDays.push({\n day,\n month: nextMonth,\n year: nextMonthYear,\n isCurrentMonth: false,\n date: new Date(nextMonthYear, nextMonth, day),\n })\n }\n }\n\n return [...prevMonthDays, ...currentMonthDays, ...nextMonthDays]\n}\n\nexport interface MonthCalendarProps<T extends CalendarEvent = CalendarEvent>\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {\n date?: Date\n events?: T[]\n onEventClick?: (event: T) => void\n onDayClick?: (date: Date) => void\n locale?: CalendarLocale\n allowPastInteraction?: boolean\n maxEventsPerDay?: number\n onMoreEventsClick?: (date: Date, events: T[]) => void\n header?: boolean\n daySelector?: boolean\n ellipsis?: boolean\n}\n\nexport const MonthCalendar = forwardRef<HTMLDivElement, MonthCalendarProps>(\n <T extends CalendarEvent>(\n {\n date = new Date(),\n events = [],\n maxEventsPerDay = 5,\n onEventClick,\n onDayClick,\n onMoreEventsClick,\n header,\n daySelector,\n locale = defaultLocale,\n ellipsis,\n allowPastInteraction = false,\n className = '',\n ...rest\n }: MonthCalendarProps<T>,\n ref: React.ForwardedRef<HTMLDivElement>\n ) => {\n const [selectedDate, setSelectedDate] = useState(new Date())\n\n const year = date.getFullYear()\n const month = date.getMonth()\n\n return (\n <div\n ref={ref}\n className={`flex h-full w-full flex-col bg-base-100 ${className}`}\n {...rest}\n >\n {header && (\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h2 className=\"m-0 text-lg font-medium text-base-content\">\n {locale.monthsLong[month]} {year}\n </h2>\n </div>\n </div>\n )}\n\n {/* Weekday header */}\n <div className=\"grid grid-cols-7 border-b border-base-300\">\n {locale.daysShort.map((day, index) => (\n <div\n key={index}\n className=\"py-1 text-center text-xs font-medium uppercase text-base-content/60\"\n >\n {day}\n </div>\n ))}\n </div>\n\n {/* Calendar grid */}\n <div className=\"grid flex-1 grid-cols-7 grid-rows-6 border-l border-base-300\">\n {generateCalendarGrid(year, month).map((dateObj, index) => {\n const dateEvents = getEventsForDate(events as T[], dateObj.date)\n const isPast = isPastDate(dateObj.date) && !isToday(dateObj.date)\n const isSelected = daySelector && isEqual(dateObj.date, selectedDate)\n\n return (\n <div\n key={index}\n className={`\n relative cursor-pointer overflow-hidden border-b border-r border-base-300 p-1\n hover:bg-base-200\n ${!dateObj.isCurrentMonth ? 'bg-base-200' : ''}\n ${isToday(dateObj.date) ? 'bg-primary/10' : ''}\n ${isPast ? 'opacity-60' : ''}\n ${isPast && !allowPastInteraction ? 'cursor-not-allowed' : ''}\n ${isSelected ? 'z-10 outline outline-2 outline-primary' : ''}\n `}\n onClick={() => {\n if (isPast && !allowPastInteraction) {\n return\n }\n\n if (daySelector) {\n setSelectedDate(dateObj.date)\n }\n\n setTimeout(() => {\n onDayClick?.(dateObj.date)\n }, 0)\n }}\n >\n {/* Date number */}\n <div className=\"mb-0.5 flex justify-center\">\n <span\n className={`\n flex items-center justify-center text-xs leading-none\n ${isToday(dateObj.date) ? 'font-bold text-primary' : 'text-base-content'}\n ${!dateObj.isCurrentMonth ? 'text-base-content/40' : ''}\n ${isPast && dateObj.isCurrentMonth ? 'text-base-content/40' : ''}\n `}\n >\n {dateObj.day}\n </span>\n </div>\n\n {/* Events container */}\n <div className=\"flex flex-col\">\n {dateEvents\n .slice(\n 0,\n dateEvents.length > maxEventsPerDay\n ? maxEventsPerDay - 1\n : maxEventsPerDay\n )\n .map((event, eventIndex) => (\n <div\n key={eventIndex}\n className={`\n flex cursor-pointer items-center rounded px-1 py-0.5 text-xs leading-none\n transition-colors hover:bg-base-content/5\n ${isFutureDate(event.date) ? 'text-base-content' : 'text-base-content'}\n ${event.strikethrough ? 'line-through' : ''}\n `}\n style={event.style}\n onClick={(e) => {\n e.stopPropagation()\n if (onEventClick) {\n onEventClick(event)\n }\n }}\n title={event.title}\n >\n <span\n className=\"mr-1.5 inline-block h-2 w-2 shrink-0 rounded-full\"\n style={{ backgroundColor: event.color }}\n />\n <span\n className={`overflow-hidden whitespace-nowrap ${ellipsis ? 'text-ellipsis' : ''}`}\n >\n {event.title}\n </span>\n </div>\n ))}\n {dateEvents.length > maxEventsPerDay && (\n <div\n className=\"cursor-pointer rounded px-1 py-0.5 text-[11px] text-base-content/60 hover:bg-base-content/5\"\n onClick={(e) => {\n e.stopPropagation()\n if (onMoreEventsClick) {\n onMoreEventsClick(dateObj.date, dateEvents)\n }\n }}\n >\n +{dateEvents.length - maxEventsPerDay + 1} {locale.moreText}\n </div>\n )}\n </div>\n </div>\n )\n })}\n </div>\n </div>\n )\n }\n) as <T extends CalendarEvent = CalendarEvent>(\n props: MonthCalendarProps<T> & { ref?: React.ForwardedRef<HTMLDivElement> }\n) => React.ReactElement\n\n;(MonthCalendar as React.FC).displayName = 'MonthCalendar'\n"],"names":["defaultLocale","isToday","date","isEqual","a","b","acopy","bcopy","isFutureDate","today","checkDate","isPastDate","getEventsForDate","events","event","getDaysInMonth","year","month","getFirstDayOfMonth","generateCalendarGrid","daysInMonth","firstDayOfMonth","prevMonthDays","prevMonth","prevMonthYear","daysInPrevMonth","i","day","currentMonthDays","nextMonthDays","daysToAdd","nextMonth","nextMonthYear","MonthCalendar","forwardRef","maxEventsPerDay","onEventClick","onDayClick","onMoreEventsClick","header","daySelector","locale","ellipsis","allowPastInteraction","className","rest","ref","selectedDate","setSelectedDate","useState","jsxs","jsx","index","dateObj","dateEvents","isPast","isSelected","eventIndex","e"],"mappings":";;AAuBA,MAAMA,IAAgC;AAAA,EACpC,QAAQ;AAAA,EACR,WAAW,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK;AAAA,EAC3D,YAAY;AAAA,IACV;AAAA,IACA;AAA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ar-start", x = "navbar-center", N = "navbar-end", g = {
|
|
3
3
|
base: "bg-base-100",
|
|
4
4
|
neutral: "bg-neutral text-neutral-content",
|
|
5
5
|
primary: "bg-primary text-primary-content",
|
|
6
6
|
secondary: "bg-secondary text-secondary-content",
|
|
7
7
|
accent: "bg-accent text-accent-content"
|
|
8
|
-
},
|
|
8
|
+
}, h = {
|
|
9
9
|
none: "",
|
|
10
10
|
sm: "shadow-sm",
|
|
11
11
|
md: "shadow-md",
|
|
12
12
|
lg: "shadow-lg",
|
|
13
13
|
xl: "shadow-xl"
|
|
14
|
-
},
|
|
14
|
+
}, y = {
|
|
15
15
|
none: "",
|
|
16
16
|
sm: "rounded-sm",
|
|
17
17
|
md: "rounded-md",
|
|
18
18
|
lg: "rounded-lg",
|
|
19
19
|
xl: "rounded-xl",
|
|
20
20
|
full: "rounded-full"
|
|
21
|
-
},
|
|
21
|
+
}, p = ({
|
|
22
22
|
children: n,
|
|
23
|
-
start:
|
|
24
|
-
center:
|
|
25
|
-
end:
|
|
26
|
-
color:
|
|
27
|
-
sticky:
|
|
28
|
-
shadow:
|
|
29
|
-
rounded:
|
|
30
|
-
className:
|
|
31
|
-
...
|
|
23
|
+
start: s,
|
|
24
|
+
center: e,
|
|
25
|
+
end: r,
|
|
26
|
+
color: d = "base",
|
|
27
|
+
sticky: c = !1,
|
|
28
|
+
shadow: l = "none",
|
|
29
|
+
rounded: b = "none",
|
|
30
|
+
className: m = "",
|
|
31
|
+
...o
|
|
32
32
|
}) => {
|
|
33
33
|
const t = [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
i,
|
|
35
|
+
g[d],
|
|
36
|
+
c && "sticky top-0 z-50",
|
|
37
|
+
h[l],
|
|
38
|
+
y[b],
|
|
39
|
+
m
|
|
40
40
|
].filter(Boolean).join(" ");
|
|
41
|
-
return n ? /* @__PURE__ */ a("nav", { className: t, ...
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
return n ? /* @__PURE__ */ a("nav", { className: t, ...o, children: n }) : /* @__PURE__ */ v("nav", { className: t, ...o, children: [
|
|
42
|
+
s && /* @__PURE__ */ a("div", { className: u, children: s }),
|
|
43
|
+
e && /* @__PURE__ */ a("div", { className: x, children: e }),
|
|
44
|
+
r && /* @__PURE__ */ a("div", { className: N, children: r })
|
|
45
45
|
] });
|
|
46
46
|
};
|
|
47
47
|
export {
|
|
48
|
-
|
|
48
|
+
p as Navbar
|
|
49
49
|
};
|
|
50
50
|
//# sourceMappingURL=Navbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Navbar.js","sources":["../../src/components/Navbar.tsx"],"sourcesContent":["import React from 'react'\n\nexport type NavbarColor = 'base' | 'neutral' | 'primary' | 'secondary' | 'accent'\nexport type NavbarShadow = 'none' | 'sm' | 'md' | 'lg' | 'xl'\nexport type NavbarRounded = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'\n\nexport interface NavbarProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {\n children?: React.ReactNode\n /** Content for the start section of the navbar (typically logo/brand) */\n start?: React.ReactNode\n /** Content for the center section of the navbar */\n center?: React.ReactNode\n /** Content for the end section of the navbar (typically actions/menu) */\n end?: React.ReactNode\n /** Background color variant */\n color?: NavbarColor\n /** Make navbar sticky at the top */\n sticky?: boolean\n /** Shadow depth */\n shadow?: NavbarShadow\n /** Border radius */\n rounded?: NavbarRounded\n}\n\nconst colorClasses: Record<NavbarColor, string> = {\n base: 'bg-base-100',\n neutral: 'bg-neutral text-neutral-content',\n primary: 'bg-primary text-primary-content',\n secondary: 'bg-secondary text-secondary-content',\n accent: 'bg-accent text-accent-content',\n}\n\nconst shadowClasses: Record<NavbarShadow, string> = {\n none: '',\n sm: 'shadow-sm',\n md: 'shadow-md',\n lg: 'shadow-lg',\n xl: 'shadow-xl',\n}\n\nconst roundedClasses: Record<NavbarRounded, string> = {\n none: '',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n full: 'rounded-full',\n}\n\nexport const Navbar: React.FC<NavbarProps> = ({\n children,\n start,\n center,\n end,\n color = 'base',\n sticky = false,\n shadow = 'none',\n rounded = 'none',\n className = '',\n ...rest\n}) => {\n const navbarClasses = [\n
|
|
1
|
+
{"version":3,"file":"Navbar.js","sources":["../../src/components/Navbar.tsx"],"sourcesContent":["import React from 'react'\n\n// DaisyUI classes\nconst dNavbar = 'navbar'\nconst dNavbarStart = 'navbar-start'\nconst dNavbarCenter = 'navbar-center'\nconst dNavbarEnd = 'navbar-end'\n\nexport type NavbarColor = 'base' | 'neutral' | 'primary' | 'secondary' | 'accent'\nexport type NavbarShadow = 'none' | 'sm' | 'md' | 'lg' | 'xl'\nexport type NavbarRounded = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'\n\nexport interface NavbarProps extends Omit<React.HTMLAttributes<HTMLElement>, 'color'> {\n children?: React.ReactNode\n /** Content for the start section of the navbar (typically logo/brand) */\n start?: React.ReactNode\n /** Content for the center section of the navbar */\n center?: React.ReactNode\n /** Content for the end section of the navbar (typically actions/menu) */\n end?: React.ReactNode\n /** Background color variant */\n color?: NavbarColor\n /** Make navbar sticky at the top */\n sticky?: boolean\n /** Shadow depth */\n shadow?: NavbarShadow\n /** Border radius */\n rounded?: NavbarRounded\n}\n\nconst colorClasses: Record<NavbarColor, string> = {\n base: 'bg-base-100',\n neutral: 'bg-neutral text-neutral-content',\n primary: 'bg-primary text-primary-content',\n secondary: 'bg-secondary text-secondary-content',\n accent: 'bg-accent text-accent-content',\n}\n\nconst shadowClasses: Record<NavbarShadow, string> = {\n none: '',\n sm: 'shadow-sm',\n md: 'shadow-md',\n lg: 'shadow-lg',\n xl: 'shadow-xl',\n}\n\nconst roundedClasses: Record<NavbarRounded, string> = {\n none: '',\n sm: 'rounded-sm',\n md: 'rounded-md',\n lg: 'rounded-lg',\n xl: 'rounded-xl',\n full: 'rounded-full',\n}\n\nexport const Navbar: React.FC<NavbarProps> = ({\n children,\n start,\n center,\n end,\n color = 'base',\n sticky = false,\n shadow = 'none',\n rounded = 'none',\n className = '',\n ...rest\n}) => {\n const navbarClasses = [\n dNavbar,\n colorClasses[color],\n sticky && 'sticky top-0 z-50',\n shadowClasses[shadow],\n roundedClasses[rounded],\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n if (children) {\n return <nav className={navbarClasses} {...rest}>{children}</nav>\n }\n\n return (\n <nav className={navbarClasses} {...rest}>\n {start && <div className={dNavbarStart}>{start}</div>}\n {center && <div className={dNavbarCenter}>{center}</div>}\n {end && <div className={dNavbarEnd}>{end}</div>}\n </nav>\n )\n}\n"],"names":["dNavbar","dNavbarStart","dNavbarCenter","dNavbarEnd","colorClasses","shadowClasses","roundedClasses","Navbar","children","start","center","end","color","sticky","shadow","rounded","className","rest","navbarClasses","jsxs","jsx"],"mappings":";AAGA,MAAMA,IAAU,UACVC,IAAe,gBACfC,IAAgB,iBAChBC,IAAa,cAwBbC,IAA4C;AAAA,EAChD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,WAAW;AAAA,EACX,QAAQ;AACV,GAEMC,IAA8C;AAAA,EAClD,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEMC,IAAgD;AAAA,EACpD,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,MAAM;AACR,GAEaC,IAAgC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,QAAAC,IAAS;AAAA,EACT,SAAAC,IAAU;AAAA,EACV,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgB;AAAA,IACpBlB;AAAA,IACAI,EAAaQ,CAAK;AAAA,IAClBC,KAAU;AAAA,IACVR,EAAcS,CAAM;AAAA,IACpBR,EAAeS,CAAO;AAAA,IACtBC;AAAA,EAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,SAAIR,sBACM,OAAA,EAAI,WAAWU,GAAgB,GAAGD,GAAO,UAAAT,GAAS,IAI1D,gBAAAW,EAAC,OAAA,EAAI,WAAWD,GAAgB,GAAGD,GAChC,UAAA;AAAA,IAAAR,KAAS,gBAAAW,EAAC,OAAA,EAAI,WAAWnB,GAAe,UAAAQ,GAAM;AAAA,IAC9CC,KAAU,gBAAAU,EAAC,OAAA,EAAI,WAAWlB,GAAgB,UAAAQ,GAAO;AAAA,IACjDC,KAAO,gBAAAS,EAAC,OAAA,EAAI,WAAWjB,GAAa,UAAAQ,EAAA,CAAI;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as s, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { jsx as s, Fragment as f, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as $, useEffect as C } from "react";
|
|
3
|
+
import g from "react-dom/client";
|
|
4
|
+
const l = "toast", h = "toast-top", p = "toast-bottom", u = "toast-start", m = "toast-end", v = "toast-center", w = "alert", b = "alert-success", x = "alert-error", N = "alert-info", y = "alert-warning", z = "btn", R = "btn-xs", B = "btn-ghost", L = "btn-circle";
|
|
5
|
+
class M {
|
|
5
6
|
notifications = [];
|
|
6
7
|
listeners = [];
|
|
7
8
|
container = null;
|
|
@@ -19,27 +20,27 @@ class m {
|
|
|
19
20
|
this.listeners.forEach((e) => e());
|
|
20
21
|
}
|
|
21
22
|
ensureContainer() {
|
|
22
|
-
this.container || (this.container = document.createElement("div"), document.body.appendChild(this.container), this.root =
|
|
23
|
+
this.container || (this.container = document.createElement("div"), document.body.appendChild(this.container), this.root = g.createRoot(this.container), this.root.render(/* @__PURE__ */ s(T, { manager: this })));
|
|
23
24
|
}
|
|
24
25
|
open(e) {
|
|
25
26
|
this.ensureContainer();
|
|
26
|
-
const o = e.key ?? `notification-${++this.idCounter}`,
|
|
27
|
+
const o = e.key ?? `notification-${++this.idCounter}`, n = e.variant === "compact", i = {
|
|
27
28
|
...e,
|
|
28
29
|
id: o,
|
|
29
30
|
createdAt: Date.now(),
|
|
30
|
-
duration: e.duration ?? (
|
|
31
|
-
placement: e.placement ?? (
|
|
31
|
+
duration: e.duration ?? (n ? 3 : 4.5),
|
|
32
|
+
placement: e.placement ?? (n ? "topCenter" : "topRight"),
|
|
32
33
|
variant: e.variant ?? "default",
|
|
33
|
-
closable: e.closable ?? !
|
|
34
|
+
closable: e.closable ?? !n,
|
|
34
35
|
type: e.type ?? "info"
|
|
35
|
-
},
|
|
36
|
-
return
|
|
36
|
+
}, r = this.notifications.findIndex((a) => a.id === o);
|
|
37
|
+
return r !== -1 ? this.notifications[r] = i : this.notifications.push(i), this.emit(), i.duration && i.duration > 0 && setTimeout(() => {
|
|
37
38
|
this.close(o);
|
|
38
|
-
},
|
|
39
|
+
}, i.duration * 1e3), o;
|
|
39
40
|
}
|
|
40
41
|
close(e) {
|
|
41
|
-
const o = this.notifications.find((
|
|
42
|
-
this.notifications = this.notifications.filter((
|
|
42
|
+
const o = this.notifications.find((n) => n.id === e);
|
|
43
|
+
this.notifications = this.notifications.filter((n) => n.id !== e), this.emit(), o?.onClose && o.onClose();
|
|
43
44
|
}
|
|
44
45
|
success(e) {
|
|
45
46
|
return this.open({ ...e, type: "success" });
|
|
@@ -57,12 +58,12 @@ class m {
|
|
|
57
58
|
this.notifications = [], this.emit();
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
const [, e] =
|
|
62
|
-
|
|
61
|
+
function T({ manager: t }) {
|
|
62
|
+
const [, e] = $({});
|
|
63
|
+
C(() => t.subscribe(() => {
|
|
63
64
|
e({});
|
|
64
65
|
}), [t]);
|
|
65
|
-
const o = t.getNotifications(),
|
|
66
|
+
const o = t.getNotifications(), n = {
|
|
66
67
|
topLeft: [],
|
|
67
68
|
topRight: [],
|
|
68
69
|
topCenter: [],
|
|
@@ -70,70 +71,70 @@ function v({ manager: t }) {
|
|
|
70
71
|
bottomRight: [],
|
|
71
72
|
bottomCenter: []
|
|
72
73
|
};
|
|
73
|
-
o.forEach((
|
|
74
|
-
r
|
|
74
|
+
o.forEach((r) => {
|
|
75
|
+
n[r.placement].push(r);
|
|
75
76
|
});
|
|
76
|
-
const
|
|
77
|
-
topRight:
|
|
78
|
-
topLeft:
|
|
79
|
-
topCenter:
|
|
80
|
-
bottomRight:
|
|
81
|
-
bottomLeft:
|
|
82
|
-
bottomCenter:
|
|
77
|
+
const i = {
|
|
78
|
+
topRight: `${l} ${h} ${m} z-[9999]`,
|
|
79
|
+
topLeft: `${l} ${h} ${u} z-[9999]`,
|
|
80
|
+
topCenter: `${l} ${h} ${v} z-[9999]`,
|
|
81
|
+
bottomRight: `${l} ${p} ${m} z-[9999]`,
|
|
82
|
+
bottomLeft: `${l} ${p} ${u} z-[9999]`,
|
|
83
|
+
bottomCenter: `${l} ${p} ${v} z-[9999]`
|
|
83
84
|
};
|
|
84
|
-
return /* @__PURE__ */ s(
|
|
85
|
-
|
|
85
|
+
return /* @__PURE__ */ s(f, { children: Object.entries(n).map(([r, a]) => a.length === 0 ? null : /* @__PURE__ */ s("div", { className: i[r], children: a.map((c) => /* @__PURE__ */ s(
|
|
86
|
+
k,
|
|
86
87
|
{
|
|
87
|
-
notification:
|
|
88
|
-
onClose: () => t.close(
|
|
88
|
+
notification: c,
|
|
89
|
+
onClose: () => t.close(c.id)
|
|
89
90
|
},
|
|
90
|
-
|
|
91
|
-
)) },
|
|
91
|
+
c.id
|
|
92
|
+
)) }, r)) });
|
|
92
93
|
}
|
|
93
|
-
function
|
|
94
|
-
const o = t.variant === "compact",
|
|
95
|
-
success:
|
|
96
|
-
error:
|
|
97
|
-
info:
|
|
98
|
-
warning:
|
|
99
|
-
},
|
|
94
|
+
function k({ notification: t, onClose: e }) {
|
|
95
|
+
const o = t.variant === "compact", n = {
|
|
96
|
+
success: b,
|
|
97
|
+
error: x,
|
|
98
|
+
info: N,
|
|
99
|
+
warning: y
|
|
100
|
+
}, i = {
|
|
100
101
|
success: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z", clipRule: "evenodd" }) }),
|
|
101
102
|
error: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }),
|
|
102
103
|
info: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }),
|
|
103
104
|
warning: /* @__PURE__ */ s("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-5 w-5", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ s("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) })
|
|
104
|
-
},
|
|
105
|
+
}, r = () => {
|
|
105
106
|
t.onClick && t.onClick();
|
|
106
|
-
},
|
|
107
|
+
}, a = t.icon ?? i[t.type];
|
|
107
108
|
return o ? /* @__PURE__ */ s(
|
|
108
109
|
"div",
|
|
109
110
|
{
|
|
110
|
-
className:
|
|
111
|
+
className: `${w} ${n[t.type]} shadow-md py-2 px-4 cursor-pointer${t.className ? ` ${t.className}` : ""}`,
|
|
111
112
|
style: t.style,
|
|
112
113
|
"data-testid": t["data-testid"],
|
|
113
|
-
onClick:
|
|
114
|
-
children: /* @__PURE__ */
|
|
115
|
-
|
|
114
|
+
onClick: r,
|
|
115
|
+
children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
116
|
+
a,
|
|
116
117
|
/* @__PURE__ */ s("span", { children: t.message })
|
|
117
118
|
] })
|
|
118
119
|
}
|
|
119
|
-
) : /* @__PURE__ */
|
|
120
|
+
) : /* @__PURE__ */ d(
|
|
120
121
|
"div",
|
|
121
122
|
{
|
|
122
|
-
className:
|
|
123
|
+
className: `${w} ${n[t.type]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative${t.className ? ` ${t.className}` : ""}`,
|
|
123
124
|
style: t.style,
|
|
124
125
|
"data-testid": t["data-testid"],
|
|
125
|
-
onClick:
|
|
126
|
+
onClick: r,
|
|
126
127
|
children: [
|
|
127
|
-
/* @__PURE__ */
|
|
128
|
+
/* @__PURE__ */ d("div", { className: t.closable ? "pr-8" : "", children: [
|
|
128
129
|
t.message && /* @__PURE__ */ s("div", { className: "font-bold", children: t.message }),
|
|
129
130
|
t.description && /* @__PURE__ */ s("div", { className: "text-sm", children: t.description })
|
|
130
131
|
] }),
|
|
131
132
|
t.closable && /* @__PURE__ */ s(
|
|
132
133
|
"button",
|
|
133
134
|
{
|
|
134
|
-
className:
|
|
135
|
-
onClick: (
|
|
136
|
-
|
|
135
|
+
className: `${z} ${R} ${B} ${L} absolute top-2 right-2`,
|
|
136
|
+
onClick: (c) => {
|
|
137
|
+
c.stopPropagation(), e();
|
|
137
138
|
},
|
|
138
139
|
children: "✕"
|
|
139
140
|
}
|
|
@@ -142,8 +143,8 @@ function w({ notification: t, onClose: e }) {
|
|
|
142
143
|
}
|
|
143
144
|
);
|
|
144
145
|
}
|
|
145
|
-
const
|
|
146
|
+
const j = new M();
|
|
146
147
|
export {
|
|
147
|
-
|
|
148
|
+
j as notification
|
|
148
149
|
};
|
|
149
150
|
//# sourceMappingURL=Notification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.js","sources":["../../src/components/Notification.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport ReactDOM from 'react-dom/client'\n\nexport type NotificationType = 'success' | 'info' | 'warning' | 'error'\nexport type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'topCenter' | 'bottomCenter'\nexport type NotificationVariant = 'default' | 'compact'\n\nexport interface NotificationConfig {\n message: React.ReactNode\n description?: React.ReactNode\n type?: NotificationType\n duration?: number // in seconds, 0 = no auto close\n placement?: NotificationPlacement\n variant?: NotificationVariant\n closable?: boolean\n icon?: React.ReactNode\n key?: string\n className?: string\n style?: React.CSSProperties\n 'data-testid'?: string\n onClick?: () => void\n onClose?: () => void\n}\n\ninterface NotificationItem extends NotificationConfig {\n id: string\n createdAt: number\n}\n\ntype Listener = () => void\n\nclass NotificationManager {\n private notifications: NotificationItem[] = []\n private listeners: Listener[] = []\n private container: HTMLDivElement | null = null\n private root: ReactDOM.Root | null = null\n private idCounter = 0\n\n subscribe(listener: Listener) {\n this.listeners.push(listener)\n return () => {\n this.listeners = this.listeners.filter((l) => l !== listener)\n }\n }\n\n getNotifications() {\n return this.notifications\n }\n\n private emit() {\n this.listeners.forEach((listener) => listener())\n }\n\n private ensureContainer() {\n if (!this.container) {\n this.container = document.createElement('div')\n document.body.appendChild(this.container)\n this.root = ReactDOM.createRoot(this.container)\n this.root.render(<NotificationContainer manager={this} />)\n }\n }\n\n open(config: NotificationConfig) {\n this.ensureContainer()\n\n const id = config.key ?? `notification-${++this.idCounter}`\n const isCompact = config.variant === 'compact'\n const notificationItem: NotificationItem = {\n ...config,\n id,\n createdAt: Date.now(),\n duration: config.duration ?? (isCompact ? 3 : 4.5),\n placement: config.placement ?? (isCompact ? 'topCenter' : 'topRight'),\n variant: config.variant ?? 'default',\n closable: config.closable ?? !isCompact,\n type: config.type ?? 'info',\n }\n\n // If key exists, update the existing notification\n const existingIndex = this.notifications.findIndex((n) => n.id === id)\n if (existingIndex !== -1) {\n this.notifications[existingIndex] = notificationItem\n } else {\n this.notifications.push(notificationItem)\n }\n this.emit()\n\n // Auto-dismiss\n if (notificationItem.duration && notificationItem.duration > 0) {\n setTimeout(() => {\n this.close(id)\n }, notificationItem.duration * 1000)\n }\n\n return id\n }\n\n close(id: string) {\n const notification = this.notifications.find((n) => n.id === id)\n this.notifications = this.notifications.filter((n) => n.id !== id)\n this.emit()\n\n if (notification?.onClose) {\n notification.onClose()\n }\n }\n\n success(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'success' })\n }\n\n error(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'error' })\n }\n\n info(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'info' })\n }\n\n warning(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'warning' })\n }\n\n destroy() {\n this.notifications = []\n this.emit()\n }\n}\n\ninterface NotificationContainerProps {\n manager: NotificationManager\n}\n\nfunction NotificationContainer({ manager }: NotificationContainerProps) {\n const [, forceUpdate] = useState({})\n\n useEffect(() => {\n const unsubscribe = manager.subscribe(() => {\n forceUpdate({})\n })\n return unsubscribe\n }, [manager])\n\n const notifications = manager.getNotifications()\n\n // Group by placement\n const grouped: Record<NotificationPlacement, NotificationItem[]> = {\n topLeft: [],\n topRight: [],\n topCenter: [],\n bottomLeft: [],\n bottomRight: [],\n bottomCenter: [],\n }\n\n notifications.forEach((notification) => {\n grouped[notification.placement!].push(notification)\n })\n\n const placementClasses: Record<NotificationPlacement, string> = {\n topRight: 'toast toast-top toast-end z-[9999]',\n topLeft: 'toast toast-top toast-start z-[9999]',\n topCenter: 'toast toast-top toast-center z-[9999]',\n bottomRight: 'toast toast-bottom toast-end z-[9999]',\n bottomLeft: 'toast toast-bottom toast-start z-[9999]',\n bottomCenter: 'toast toast-bottom toast-center z-[9999]',\n }\n\n return (\n <>\n {Object.entries(grouped).map(([placement, items]) => {\n if (items.length === 0) return null\n\n return (\n <div key={placement} className={placementClasses[placement as NotificationPlacement]}>\n {items.map((notification) => (\n <NotificationItem\n key={notification.id}\n notification={notification}\n onClose={() => manager.close(notification.id)}\n />\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\ninterface NotificationItemProps {\n notification: NotificationItem\n onClose: () => void\n}\n\nfunction NotificationItem({ notification, onClose }: NotificationItemProps) {\n const isCompact = notification.variant === 'compact'\n\n const alertTypeClasses: Record<NotificationType, string> = {\n success: 'alert-success',\n error: 'alert-error',\n info: 'alert-info',\n warning: 'alert-warning',\n }\n\n const typeIcons: Record<NotificationType, React.ReactNode> = {\n success: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clipRule=\"evenodd\" /></svg>,\n error: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clipRule=\"evenodd\" /></svg>,\n info: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\" clipRule=\"evenodd\" /></svg>,\n warning: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clipRule=\"evenodd\" /></svg>,\n }\n\n const handleClick = () => {\n if (notification.onClick) {\n notification.onClick()\n }\n }\n\n const icon = notification.icon ?? typeIcons[notification.type!]\n\n if (isCompact) {\n return (\n <div\n className={`alert ${alertTypeClasses[notification.type!]} shadow-md py-2 px-4 cursor-pointer${notification.className ? ` ${notification.className}` : ''}`}\n style={notification.style}\n data-testid={notification['data-testid']}\n onClick={handleClick}\n >\n <div className=\"flex items-center gap-2\">\n {icon}\n <span>{notification.message}</span>\n </div>\n </div>\n )\n }\n\n return (\n <div\n className={`alert ${alertTypeClasses[notification.type!]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative${notification.className ? ` ${notification.className}` : ''}`}\n style={notification.style}\n data-testid={notification['data-testid']}\n onClick={handleClick}\n >\n <div className={notification.closable ? 'pr-8' : ''}>\n {notification.message && <div className=\"font-bold\">{notification.message}</div>}\n {notification.description && <div className=\"text-sm\">{notification.description}</div>}\n </div>\n {notification.closable && (\n <button\n className=\"btn btn-xs btn-ghost btn-circle absolute top-2 right-2\"\n onClick={(e) => {\n e.stopPropagation()\n onClose()\n }}\n >\n ✕\n </button>\n )}\n </div>\n )\n}\n\nexport const notification = new NotificationManager()\n"],"names":["NotificationManager","listener","l","ReactDOM","jsx","NotificationContainer","config","id","isCompact","notificationItem","existingIndex","n","notification","manager","forceUpdate","useState","useEffect","notifications","grouped","placementClasses","Fragment","placement","items","NotificationItem","onClose","alertTypeClasses","typeIcons","handleClick","icon","jsxs","e"],"mappings":";;;AA+BA,MAAMA,EAAoB;AAAA,EAChB,gBAAoC,CAAA;AAAA,EACpC,YAAwB,CAAA;AAAA,EACxB,YAAmC;AAAA,EACnC,OAA6B;AAAA,EAC7B,YAAY;AAAA,EAEpB,UAAUC,GAAoB;AAC5B,gBAAK,UAAU,KAAKA,CAAQ,GACrB,MAAM;AACX,WAAK,YAAY,KAAK,UAAU,OAAO,CAACC,MAAMA,MAAMD,CAAQ;AAAA,IAC9D;AAAA,EACF;AAAA,EAEA,mBAAmB;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,OAAO;AACb,SAAK,UAAU,QAAQ,CAACA,MAAaA,GAAU;AAAA,EACjD;AAAA,EAEQ,kBAAkB;AACxB,IAAK,KAAK,cACR,KAAK,YAAY,SAAS,cAAc,KAAK,GAC7C,SAAS,KAAK,YAAY,KAAK,SAAS,GACxC,KAAK,OAAOE,EAAS,WAAW,KAAK,SAAS,GAC9C,KAAK,KAAK,OAAO,gBAAAC,EAACC,GAAA,EAAsB,SAAS,MAA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J,OAAOA,EAAa;AAAA,MACpB,eAAaA,EAAa,aAAa;AAAA,MACvC,SAASe;AAAA,MAET,UAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,2BACZ,UAAA;AAAA,QAAAD;AAAA,QACD,gBAAAxB,EAAC,QAAA,EAAM,UAAAQ,EAAa,QAAA,CAAQ;AAAA,MAAA,EAAA,CAC9B;AAAA,IAAA;AAAA,EAAA,IAMJ,gBAAAiB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,SAASJ,EAAiBb,EAAa,IAAK,CAAC,iEAAiEA,EAAa,YAAY,IAAIA,EAAa,SAAS,KAAK,EAAE;AAAA,MACnL,OAAOA,EAAa;AAAA,MACpB,eAAaA,EAAa,aAAa;AAAA,MACvC,SAASe;AAAA,MAET,UAAA;AAAA,QAAA,gBAAAE,EAAC,OAAA,EAAI,WAAWjB,EAAa,WAAW,SAAS,IAC9C,UAAA;AAAA,UAAAA,EAAa,WAAW,gBAAAR,EAAC,OAAA,EAAI,WAAU,aAAa,UAAAQ,EAAa,SAAQ;AAAA,UACzEA,EAAa,eAAe,gBAAAR,EAAC,OAAA,EAAI,WAAU,WAAW,UAAAQ,EAAa,YAAA,CAAY;AAAA,QAAA,GAClF;AAAA,QACCA,EAAa,YACZ,gBAAAR;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS,CAAC0B,MAAM;AACd,cAAAA,EAAE,gBAAA,GACFN,EAAA;AAAA,YACF;AAAA,YACD,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAMZ,IAAe,IAAIZ,EAAA;"}
|
|
1
|
+
{"version":3,"file":"Notification.js","sources":["../../src/components/Notification.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport ReactDOM from 'react-dom/client'\n\n// DaisyUI classes\nconst dToast = 'toast'\nconst dToastTop = 'toast-top'\nconst dToastBottom = 'toast-bottom'\nconst dToastStart = 'toast-start'\nconst dToastEnd = 'toast-end'\nconst dToastCenter = 'toast-center'\nconst dAlert = 'alert'\nconst dAlertSuccess = 'alert-success'\nconst dAlertError = 'alert-error'\nconst dAlertInfo = 'alert-info'\nconst dAlertWarning = 'alert-warning'\nconst dBtn = 'btn'\nconst dBtnXs = 'btn-xs'\nconst dBtnGhost = 'btn-ghost'\nconst dBtnCircle = 'btn-circle'\n\nexport type NotificationType = 'success' | 'info' | 'warning' | 'error'\nexport type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'topCenter' | 'bottomCenter'\nexport type NotificationVariant = 'default' | 'compact'\n\nexport interface NotificationConfig {\n message: React.ReactNode\n description?: React.ReactNode\n type?: NotificationType\n duration?: number // in seconds, 0 = no auto close\n placement?: NotificationPlacement\n variant?: NotificationVariant\n closable?: boolean\n icon?: React.ReactNode\n key?: string\n className?: string\n style?: React.CSSProperties\n 'data-testid'?: string\n onClick?: () => void\n onClose?: () => void\n}\n\ninterface NotificationItem extends NotificationConfig {\n id: string\n createdAt: number\n}\n\ntype Listener = () => void\n\nclass NotificationManager {\n private notifications: NotificationItem[] = []\n private listeners: Listener[] = []\n private container: HTMLDivElement | null = null\n private root: ReactDOM.Root | null = null\n private idCounter = 0\n\n subscribe(listener: Listener) {\n this.listeners.push(listener)\n return () => {\n this.listeners = this.listeners.filter((l) => l !== listener)\n }\n }\n\n getNotifications() {\n return this.notifications\n }\n\n private emit() {\n this.listeners.forEach((listener) => listener())\n }\n\n private ensureContainer() {\n if (!this.container) {\n this.container = document.createElement('div')\n document.body.appendChild(this.container)\n this.root = ReactDOM.createRoot(this.container)\n this.root.render(<NotificationContainer manager={this} />)\n }\n }\n\n open(config: NotificationConfig) {\n this.ensureContainer()\n\n const id = config.key ?? `notification-${++this.idCounter}`\n const isCompact = config.variant === 'compact'\n const notificationItem: NotificationItem = {\n ...config,\n id,\n createdAt: Date.now(),\n duration: config.duration ?? (isCompact ? 3 : 4.5),\n placement: config.placement ?? (isCompact ? 'topCenter' : 'topRight'),\n variant: config.variant ?? 'default',\n closable: config.closable ?? !isCompact,\n type: config.type ?? 'info',\n }\n\n // If key exists, update the existing notification\n const existingIndex = this.notifications.findIndex((n) => n.id === id)\n if (existingIndex !== -1) {\n this.notifications[existingIndex] = notificationItem\n } else {\n this.notifications.push(notificationItem)\n }\n this.emit()\n\n // Auto-dismiss\n if (notificationItem.duration && notificationItem.duration > 0) {\n setTimeout(() => {\n this.close(id)\n }, notificationItem.duration * 1000)\n }\n\n return id\n }\n\n close(id: string) {\n const notification = this.notifications.find((n) => n.id === id)\n this.notifications = this.notifications.filter((n) => n.id !== id)\n this.emit()\n\n if (notification?.onClose) {\n notification.onClose()\n }\n }\n\n success(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'success' })\n }\n\n error(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'error' })\n }\n\n info(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'info' })\n }\n\n warning(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'warning' })\n }\n\n destroy() {\n this.notifications = []\n this.emit()\n }\n}\n\ninterface NotificationContainerProps {\n manager: NotificationManager\n}\n\nfunction NotificationContainer({ manager }: NotificationContainerProps) {\n const [, forceUpdate] = useState({})\n\n useEffect(() => {\n const unsubscribe = manager.subscribe(() => {\n forceUpdate({})\n })\n return unsubscribe\n }, [manager])\n\n const notifications = manager.getNotifications()\n\n // Group by placement\n const grouped: Record<NotificationPlacement, NotificationItem[]> = {\n topLeft: [],\n topRight: [],\n topCenter: [],\n bottomLeft: [],\n bottomRight: [],\n bottomCenter: [],\n }\n\n notifications.forEach((notification) => {\n grouped[notification.placement!].push(notification)\n })\n\n const placementClasses: Record<NotificationPlacement, string> = {\n topRight: `${dToast} ${dToastTop} ${dToastEnd} z-[9999]`,\n topLeft: `${dToast} ${dToastTop} ${dToastStart} z-[9999]`,\n topCenter: `${dToast} ${dToastTop} ${dToastCenter} z-[9999]`,\n bottomRight: `${dToast} ${dToastBottom} ${dToastEnd} z-[9999]`,\n bottomLeft: `${dToast} ${dToastBottom} ${dToastStart} z-[9999]`,\n bottomCenter: `${dToast} ${dToastBottom} ${dToastCenter} z-[9999]`,\n }\n\n return (\n <>\n {Object.entries(grouped).map(([placement, items]) => {\n if (items.length === 0) return null\n\n return (\n <div key={placement} className={placementClasses[placement as NotificationPlacement]}>\n {items.map((notification) => (\n <NotificationItem\n key={notification.id}\n notification={notification}\n onClose={() => manager.close(notification.id)}\n />\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\ninterface NotificationItemProps {\n notification: NotificationItem\n onClose: () => void\n}\n\nfunction NotificationItem({ notification, onClose }: NotificationItemProps) {\n const isCompact = notification.variant === 'compact'\n\n const alertTypeClasses: Record<NotificationType, string> = {\n success: dAlertSuccess,\n error: dAlertError,\n info: dAlertInfo,\n warning: dAlertWarning,\n }\n\n const typeIcons: Record<NotificationType, React.ReactNode> = {\n success: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\" clipRule=\"evenodd\" /></svg>,\n error: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\" clipRule=\"evenodd\" /></svg>,\n info: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\" clipRule=\"evenodd\" /></svg>,\n warning: <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"h-5 w-5\" viewBox=\"0 0 20 20\" fill=\"currentColor\"><path fillRule=\"evenodd\" d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\" clipRule=\"evenodd\" /></svg>,\n }\n\n const handleClick = () => {\n if (notification.onClick) {\n notification.onClick()\n }\n }\n\n const icon = notification.icon ?? typeIcons[notification.type!]\n\n if (isCompact) {\n return (\n <div\n className={`${dAlert} ${alertTypeClasses[notification.type!]} shadow-md py-2 px-4 cursor-pointer${notification.className ? ` ${notification.className}` : ''}`}\n style={notification.style}\n data-testid={notification['data-testid']}\n onClick={handleClick}\n >\n <div className=\"flex items-center gap-2\">\n {icon}\n <span>{notification.message}</span>\n </div>\n </div>\n )\n }\n\n return (\n <div\n className={`${dAlert} ${alertTypeClasses[notification.type!]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative${notification.className ? ` ${notification.className}` : ''}`}\n style={notification.style}\n data-testid={notification['data-testid']}\n onClick={handleClick}\n >\n <div className={notification.closable ? 'pr-8' : ''}>\n {notification.message && <div className=\"font-bold\">{notification.message}</div>}\n {notification.description && <div className=\"text-sm\">{notification.description}</div>}\n </div>\n {notification.closable && (\n <button\n className={`${dBtn} ${dBtnXs} ${dBtnGhost} ${dBtnCircle} absolute top-2 right-2`}\n onClick={(e) => {\n e.stopPropagation()\n onClose()\n }}\n >\n ✕\n </button>\n )}\n </div>\n )\n}\n\nexport const notification = new NotificationManager()\n"],"names":["dToast","dToastTop","dToastBottom","dToastStart","dToastEnd","dToastCenter","dAlert","dAlertSuccess","dAlertError","dAlertInfo","dAlertWarning","dBtn","dBtnXs","dBtnGhost","dBtnCircle","NotificationManager","listener","l","ReactDOM","jsx","NotificationContainer","config","id","isCompact","notificationItem","existingIndex","n","notification","manager","forceUpdate","useState","useEffect","notifications","grouped","placementClasses","Fragment","placement","items","NotificationItem","onClose","alertTypeClasses","typeIcons","handleClick","icon","jsxs","e"],"mappings":";;;AAIA,MAAMA,IAAS,SACTC,IAAY,aACZC,IAAe,gBACfC,IAAc,eACdC,IAAY,aACZC,IAAe,gBACfC,IAAS,SACTC,IAAgB,iBAChBC,IAAc,eACdC,IAAa,cACbC,IAAgB,iBAChBC,IAAO,OACPC,IAAS,UACTC,IAAY,aACZC,IAAa;AA8BnB,MAAMC,EAAoB;AAAA,EAChB,gBAAoC,CAAA;AAAA,EACpC,YAAwB,CAAA;AAAA,EACxB,YAAmC;AAAA,EACnC,OAA6B;AAAA,EAC7B,YAAY;AAAA,EAEpB,UAAUC,GAAoB;AAC5B,gBAAK,UAAU,KAAKA,CAAQ,GACrB,MAAM;AACX,WAAK,YAAY,KAAK,UAAU,OAAO,CAACC,MAAMA,MAAMD,CAAQ;AAAA,IAC9D;AAAA,EACF;AAAA,EAEA,mBAAmB;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,OAAO;AACb,SAAK,UAAU,QAAQ,CAACA,MAAaA,GAAU;AAAA,EACjD;AAAA,EAEQ,kBAAkB;AACxB,IAAK,KAAK,cACR,KAAK,YAAY,SAAS,cAAc,KAAK,GAC7C,SAAS,KAAK,YAAY,KAAK,SAAS,GACxC,KAAK,OAAOE,EAAS,WAAW,KAAK,SAAS,GAC9C,KAAK,KAAK,OAAO,gBAAAC,EAACC,GAAA,EAAsB,SAAS,MAAM,CAAE;AAAA,EAE7D;A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