@janovix/blocks 1.1.0 → 1.1.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5059,11 +5059,17 @@ 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
|
+
);
|
|
5062
5068
|
const visibleNotifications = React2__namespace.useMemo(
|
|
5063
|
-
() =>
|
|
5064
|
-
[
|
|
5069
|
+
() => sortedNotifications.slice(0, maxVisible),
|
|
5070
|
+
[sortedNotifications, maxVisible]
|
|
5065
5071
|
);
|
|
5066
|
-
const hasMore =
|
|
5072
|
+
const hasMore = sortedNotifications.length > maxVisible;
|
|
5067
5073
|
React2__namespace.useEffect(() => {
|
|
5068
5074
|
if (playSound && soundType !== "none" && unreadCount > prevCount && prevCount > 0) {
|
|
5069
5075
|
const now = Date.now();
|
|
@@ -5108,14 +5114,7 @@ function NotificationsWidget({
|
|
|
5108
5114
|
initial: { scale: 0, opacity: 0 },
|
|
5109
5115
|
animate: { scale: 1, opacity: 1 },
|
|
5110
5116
|
exit: { scale: 0, opacity: 0 },
|
|
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
|
|
5117
|
+
className: cn("absolute rounded-full", dotBgColor, styles.dot)
|
|
5119
5118
|
}
|
|
5120
5119
|
) }),
|
|
5121
5120
|
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: unreadCount > 0 && showPulse && pulseStyle !== "none" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5159,11 +5158,11 @@ function NotificationsWidget({
|
|
|
5159
5158
|
}
|
|
5160
5159
|
) })
|
|
5161
5160
|
] }),
|
|
5162
|
-
|
|
5161
|
+
sortedNotifications.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center py-8 px-4 text-center", children: [
|
|
5163
5162
|
/* @__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" }) }),
|
|
5164
5163
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: emptyMessage })
|
|
5165
5164
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5166
|
-
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "h-[
|
|
5165
|
+
/* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "max-h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-border", children: visibleNotifications.map((notification) => {
|
|
5167
5166
|
const config = typeConfig[notification.type || "info"];
|
|
5168
5167
|
const Icon = config.icon;
|
|
5169
5168
|
const hasLink = !!notification.href;
|
|
@@ -5240,10 +5239,10 @@ function NotificationsWidget({
|
|
|
5240
5239
|
(hasMore || onClearAll) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2 border-t border-border bg-muted/30", children: [
|
|
5241
5240
|
hasMore && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
5242
5241
|
"+",
|
|
5243
|
-
|
|
5242
|
+
sortedNotifications.length - maxVisible,
|
|
5244
5243
|
" more"
|
|
5245
5244
|
] }),
|
|
5246
|
-
onClearAll &&
|
|
5245
|
+
onClearAll && sortedNotifications.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5247
5246
|
Button,
|
|
5248
5247
|
{
|
|
5249
5248
|
variant: "ghost",
|