@xenide-io/the-old-ui-theme 0.6.13 → 0.6.14
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/suite.js
CHANGED
|
@@ -1636,17 +1636,17 @@ function SuiteNotificationBell({
|
|
|
1636
1636
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1637
1637
|
DropdownMenu2,
|
|
1638
1638
|
{
|
|
1639
|
-
"aria-label": "Notifications",
|
|
1639
|
+
"aria-label": unread > 0 ? `Notifications, ${unread} unread` : "Notifications",
|
|
1640
1640
|
triggerId: triggerId != null ? triggerId : `${dataTest}-trigger`,
|
|
1641
1641
|
triggerDataTest: triggerDataTest != null ? triggerDataTest : `${dataTest}-trigger`,
|
|
1642
1642
|
align: "end",
|
|
1643
1643
|
panelClassName: "w-80 overflow-hidden p-0",
|
|
1644
1644
|
open,
|
|
1645
1645
|
onOpenChange,
|
|
1646
|
-
trigger: /* @__PURE__ */ (0, import_jsx_runtime7.
|
|
1646
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "relative inline-flex h-11 w-11 items-center justify-center overflow-visible rounded-full text-ph-mutedtext transition hover:bg-ph-muted hover:text-ph-ink", children: [
|
|
1647
1647
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_iconoir_react3.Bell, { className: "h-5 w-5", strokeWidth: 1.75, "aria-hidden": true }),
|
|
1648
|
-
unread > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "absolute right-0 top-0 flex h-
|
|
1649
|
-
] })
|
|
1648
|
+
unread > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "pointer-events-none absolute right-0 top-0 z-[1] flex h-4 min-w-4 translate-x-1/2 items-center justify-center rounded-full bg-ph-brand px-1 text-[9px] font-semibold leading-none text-white ring-2 ring-ph-surface", children: unread > 9 ? "9+" : unread }) : null
|
|
1649
|
+
] }),
|
|
1650
1650
|
children: [
|
|
1651
1651
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between border-b border-ph-border px-3 py-2", children: [
|
|
1652
1652
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-sm font-semibold text-ph-ink", children: "Notifications" }),
|
package/dist/suite.mjs
CHANGED
|
@@ -1279,17 +1279,17 @@ function SuiteNotificationBell({
|
|
|
1279
1279
|
return /* @__PURE__ */ jsxs7(
|
|
1280
1280
|
DropdownMenu2,
|
|
1281
1281
|
{
|
|
1282
|
-
"aria-label": "Notifications",
|
|
1282
|
+
"aria-label": unread > 0 ? `Notifications, ${unread} unread` : "Notifications",
|
|
1283
1283
|
triggerId: triggerId != null ? triggerId : `${dataTest}-trigger`,
|
|
1284
1284
|
triggerDataTest: triggerDataTest != null ? triggerDataTest : `${dataTest}-trigger`,
|
|
1285
1285
|
align: "end",
|
|
1286
1286
|
panelClassName: "w-80 overflow-hidden p-0",
|
|
1287
1287
|
open,
|
|
1288
1288
|
onOpenChange,
|
|
1289
|
-
trigger: /* @__PURE__ */
|
|
1289
|
+
trigger: /* @__PURE__ */ jsxs7("span", { className: "relative inline-flex h-11 w-11 items-center justify-center overflow-visible rounded-full text-ph-mutedtext transition hover:bg-ph-muted hover:text-ph-ink", children: [
|
|
1290
1290
|
/* @__PURE__ */ jsx7(Bell, { className: "h-5 w-5", strokeWidth: 1.75, "aria-hidden": true }),
|
|
1291
|
-
unread > 0 ? /* @__PURE__ */ jsx7("span", { className: "absolute right-0 top-0 flex h-
|
|
1292
|
-
] })
|
|
1291
|
+
unread > 0 ? /* @__PURE__ */ jsx7("span", { className: "pointer-events-none absolute right-0 top-0 z-[1] flex h-4 min-w-4 translate-x-1/2 items-center justify-center rounded-full bg-ph-brand px-1 text-[9px] font-semibold leading-none text-white ring-2 ring-ph-surface", children: unread > 9 ? "9+" : unread }) : null
|
|
1292
|
+
] }),
|
|
1293
1293
|
children: [
|
|
1294
1294
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between border-b border-ph-border px-3 py-2", children: [
|
|
1295
1295
|
/* @__PURE__ */ jsx7("span", { className: "text-sm font-semibold text-ph-ink", children: "Notifications" }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenide-io/the-old-ui-theme",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
4
|
"description": "Props-driven React components and theme tokens inspired by classic interface design \u2014 optimized for Next.js apps and internal tools.",
|
|
5
5
|
"author": "Xenide",
|
|
6
6
|
"license": "MIT",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cleanup, render, waitFor } from "@testing-library/react";
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
|
|
4
|
+
vi.mock("next/navigation", () => ({
|
|
5
|
+
useRouter: () => ({ push: vi.fn() }),
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
import { SuiteNotificationBell } from "./suite-notification-bell";
|
|
9
|
+
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
cleanup();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe("SuiteNotificationBell", () => {
|
|
15
|
+
it("anchors the unread badge to the button corner, not the bell glyph", async () => {
|
|
16
|
+
render(
|
|
17
|
+
<SuiteNotificationBell
|
|
18
|
+
fetchNotifications={async () => ({
|
|
19
|
+
notifications: [],
|
|
20
|
+
unread_count: 12,
|
|
21
|
+
})}
|
|
22
|
+
markRead={async () => undefined}
|
|
23
|
+
markAllRead={async () => undefined}
|
|
24
|
+
dropdownMenu={({ trigger, "aria-label": label, children }) => (
|
|
25
|
+
<div aria-label={label}>
|
|
26
|
+
{trigger}
|
|
27
|
+
{children}
|
|
28
|
+
</div>
|
|
29
|
+
)}
|
|
30
|
+
cacheKey={null}
|
|
31
|
+
/>,
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const badge = await waitFor(() => {
|
|
35
|
+
const el = document.querySelector("span.bg-ph-brand");
|
|
36
|
+
if (!el) throw new Error("missing badge");
|
|
37
|
+
return el;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
expect(badge.textContent).toBe("9+");
|
|
41
|
+
expect(badge.className).toContain("translate-x-1/2");
|
|
42
|
+
expect(badge.className).not.toContain("-translate-y");
|
|
43
|
+
expect(badge.parentElement?.className).toContain("h-11");
|
|
44
|
+
expect(badge.parentElement?.className).toContain("w-11");
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -170,7 +170,9 @@ export function SuiteNotificationBell({
|
|
|
170
170
|
|
|
171
171
|
return (
|
|
172
172
|
<DropdownMenu
|
|
173
|
-
aria-label=
|
|
173
|
+
aria-label={
|
|
174
|
+
unread > 0 ? `Notifications, ${unread} unread` : "Notifications"
|
|
175
|
+
}
|
|
174
176
|
triggerId={triggerId ?? `${dataTest}-trigger`}
|
|
175
177
|
triggerDataTest={triggerDataTest ?? `${dataTest}-trigger`}
|
|
176
178
|
align="end"
|
|
@@ -178,15 +180,13 @@ export function SuiteNotificationBell({
|
|
|
178
180
|
open={open}
|
|
179
181
|
onOpenChange={onOpenChange}
|
|
180
182
|
trigger={
|
|
181
|
-
<span className="inline-flex h-11 w-11 items-center justify-center rounded-full text-ph-mutedtext transition hover:bg-ph-muted hover:text-ph-ink">
|
|
182
|
-
<
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
) : null}
|
|
189
|
-
</span>
|
|
183
|
+
<span className="relative inline-flex h-11 w-11 items-center justify-center overflow-visible rounded-full text-ph-mutedtext transition hover:bg-ph-muted hover:text-ph-ink">
|
|
184
|
+
<Bell className="h-5 w-5" strokeWidth={1.75} aria-hidden />
|
|
185
|
+
{unread > 0 ? (
|
|
186
|
+
<span className="pointer-events-none absolute right-0 top-0 z-[1] flex h-4 min-w-4 translate-x-1/2 items-center justify-center rounded-full bg-ph-brand px-1 text-[9px] font-semibold leading-none text-white ring-2 ring-ph-surface">
|
|
187
|
+
{unread > 9 ? "9+" : unread}
|
|
188
|
+
</span>
|
|
189
|
+
) : null}
|
|
190
190
|
</span>
|
|
191
191
|
}
|
|
192
192
|
>
|