@janovix/blocks 1.0.0-rc.9 → 1.1.0
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/index.cjs +15 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5059,17 +5059,11 @@ function NotificationsWidget({
|
|
|
5059
5059
|
const styles = sizeConfig[size];
|
|
5060
5060
|
const dotBgColor = dotColorConfig[dotColor];
|
|
5061
5061
|
const unreadCount = notifications.filter((n) => !n.read).length;
|
|
5062
|
-
const sortedNotifications = React2__namespace.useMemo(
|
|
5063
|
-
() => [...notifications].sort(
|
|
5064
|
-
(a, b) => b.timestamp.getTime() - a.timestamp.getTime()
|
|
5065
|
-
),
|
|
5066
|
-
[notifications]
|
|
5067
|
-
);
|
|
5068
5062
|
const visibleNotifications = React2__namespace.useMemo(
|
|
5069
|
-
() =>
|
|
5070
|
-
[
|
|
5063
|
+
() => notifications.slice(0, maxVisible),
|
|
5064
|
+
[notifications, maxVisible]
|
|
5071
5065
|
);
|
|
5072
|
-
const hasMore =
|
|
5066
|
+
const hasMore = notifications.length > maxVisible;
|
|
5073
5067
|
React2__namespace.useEffect(() => {
|
|
5074
5068
|
if (playSound && soundType !== "none" && unreadCount > prevCount && prevCount > 0) {
|
|
5075
5069
|
const now = Date.now();
|
|
@@ -5114,7 +5108,14 @@ function NotificationsWidget({
|
|
|
5114
5108
|
initial: { scale: 0, opacity: 0 },
|
|
5115
5109
|
animate: { scale: 1, opacity: 1 },
|
|
5116
5110
|
exit: { scale: 0, opacity: 0 },
|
|
5117
|
-
className: cn(
|
|
5111
|
+
className: cn(
|
|
5112
|
+
"absolute flex items-center justify-center rounded-full",
|
|
5113
|
+
dotBgColor,
|
|
5114
|
+
"text-white font-medium",
|
|
5115
|
+
unreadCount > 9 ? styles.badge : styles.dot,
|
|
5116
|
+
unreadCount > 9 && "px-1"
|
|
5117
|
+
),
|
|
5118
|
+
children: unreadCount > 9 ? /* @__PURE__ */ jsxRuntime.jsx("span", { children: unreadCount > 99 ? "99+" : unreadCount }) : null
|
|
5118
5119
|
}
|
|
5119
5120
|
) }),
|
|
5120
5121
|
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: unreadCount > 0 && showPulse && pulseStyle !== "none" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5158,11 +5159,11 @@ function NotificationsWidget({
|
|
|
5158
5159
|
}
|
|
5159
5160
|
) })
|
|
5160
5161
|
] }),
|
|
5161
|
-
|
|
5162
|
+
notifications.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center py-8 px-4 text-center", children: [
|
|
5162
5163
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-12 h-12 rounded-full bg-muted flex items-center justify-center mb-3", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bell, { className: "w-6 h-6 text-muted-foreground" }) }),
|
|
5163
5164
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: emptyMessage })
|
|
5164
5165
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5165
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "
|
|
5166
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[320px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-border", children: visibleNotifications.map((notification) => {
|
|
5166
5167
|
const config = typeConfig[notification.type || "info"];
|
|
5167
5168
|
const Icon = config.icon;
|
|
5168
5169
|
const hasLink = !!notification.href;
|
|
@@ -5239,10 +5240,10 @@ function NotificationsWidget({
|
|
|
5239
5240
|
(hasMore || onClearAll) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2 border-t border-border bg-muted/30", children: [
|
|
5240
5241
|
hasMore && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
5241
5242
|
"+",
|
|
5242
|
-
|
|
5243
|
+
notifications.length - maxVisible,
|
|
5243
5244
|
" more"
|
|
5244
5245
|
] }),
|
|
5245
|
-
onClearAll &&
|
|
5246
|
+
onClearAll && notifications.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5246
5247
|
Button,
|
|
5247
5248
|
{
|
|
5248
5249
|
variant: "ghost",
|