@devalok/shilp-sutra 0.6.2 → 0.7.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.
Files changed (84) hide show
  1. package/dist/_virtual/client.js +5 -0
  2. package/dist/_virtual/index.js +5 -0
  3. package/dist/_virtual/react-dom-client.development.js +5 -0
  4. package/dist/_virtual/react-dom-client.production.js +5 -0
  5. package/dist/_virtual/scheduler.development.js +5 -0
  6. package/dist/_virtual/scheduler.production.js +5 -0
  7. package/dist/_virtual/shilp-sutra.js +5 -0
  8. package/dist/_virtual/shilp-sutra2.js +5 -0
  9. package/dist/composed/confirm-dialog.d.ts +27 -0
  10. package/dist/composed/confirm-dialog.d.ts.map +1 -0
  11. package/dist/composed/confirm-dialog.js +45 -0
  12. package/dist/composed/extensions/emoji-suggestion.d.ts +8 -0
  13. package/dist/composed/extensions/emoji-suggestion.d.ts.map +1 -0
  14. package/dist/composed/extensions/emoji-suggestion.js +119 -0
  15. package/dist/composed/extensions/file-attachment.d.ts +3 -0
  16. package/dist/composed/extensions/file-attachment.d.ts.map +1 -0
  17. package/dist/composed/extensions/file-attachment.js +55 -0
  18. package/dist/composed/extensions/mention-suggestion.d.ts +10 -0
  19. package/dist/composed/extensions/mention-suggestion.d.ts.map +1 -0
  20. package/dist/composed/extensions/mention-suggestion.js +79 -0
  21. package/dist/composed/index.d.ts +3 -1
  22. package/dist/composed/index.d.ts.map +1 -1
  23. package/dist/composed/index.js +28 -26
  24. package/dist/composed/rich-text-editor.d.ts +19 -0
  25. package/dist/composed/rich-text-editor.d.ts.map +1 -1
  26. package/dist/composed/rich-text-editor.js +320 -161
  27. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.development.js +17062 -0
  28. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/cjs/react-dom-client.production.js +9790 -0
  29. package/dist/node_modules/.pnpm/react-dom@19.2.4_react@19.2.4/node_modules/react-dom/client.js +20 -0
  30. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.development.js +237 -0
  31. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/cjs/scheduler.production.js +234 -0
  32. package/dist/node_modules/.pnpm/scheduler@0.27.0/node_modules/scheduler/index.js +11 -0
  33. package/dist/primitives/_internal/react-arrow.js +8 -19
  34. package/dist/primitives/_internal/react-compose-refs.js +14 -14
  35. package/dist/primitives/_internal/react-context.js +41 -39
  36. package/dist/primitives/_internal/react-dismissable-layer.js +62 -90
  37. package/dist/primitives/_internal/react-popper.js +107 -169
  38. package/dist/primitives/_internal/react-portal.js +1 -1
  39. package/dist/primitives/_internal/react-primitive.js +1 -1
  40. package/dist/primitives/_internal/react-use-size.js +8 -8
  41. package/dist/primitives/react-slot.js +12 -12
  42. package/dist/shell/app-command-palette.d.ts +3 -1
  43. package/dist/shell/app-command-palette.d.ts.map +1 -1
  44. package/dist/shell/app-command-palette.js +35 -34
  45. package/dist/shell/bottom-navbar.d.ts.map +1 -1
  46. package/dist/shell/bottom-navbar.js +31 -31
  47. package/dist/shell/index.d.ts +1 -1
  48. package/dist/shell/index.d.ts.map +1 -1
  49. package/dist/shell/notification-center.d.ts +10 -0
  50. package/dist/shell/notification-center.d.ts.map +1 -1
  51. package/dist/shell/notification-center.js +129 -117
  52. package/dist/shell/top-bar.d.ts +20 -0
  53. package/dist/shell/top-bar.d.ts.map +1 -1
  54. package/dist/shell/top-bar.js +100 -70
  55. package/dist/tailwind/index.cjs +1 -0
  56. package/dist/tailwind/preset.d.ts.map +1 -1
  57. package/dist/tailwind/preset.js +1 -0
  58. package/dist/tokens/semantic.css +7 -0
  59. package/dist/ui/alert.js +42 -63
  60. package/dist/ui/avatar.js +20 -62
  61. package/dist/ui/badge.d.ts +1 -1
  62. package/dist/ui/badge.d.ts.map +1 -1
  63. package/dist/ui/badge.js +88 -112
  64. package/dist/ui/button-group.js +14 -29
  65. package/dist/ui/button.js +64 -108
  66. package/dist/ui/card.js +18 -62
  67. package/dist/ui/checkbox.js +1 -21
  68. package/dist/ui/color-input.d.ts +17 -0
  69. package/dist/ui/color-input.d.ts.map +1 -0
  70. package/dist/ui/color-input.js +87 -0
  71. package/dist/ui/index.d.ts +1 -0
  72. package/dist/ui/index.d.ts.map +1 -1
  73. package/dist/ui/index.js +314 -312
  74. package/dist/ui/input.js +25 -51
  75. package/dist/ui/label.js +1 -15
  76. package/dist/ui/popover.js +6 -6
  77. package/dist/ui/separator.js +4 -19
  78. package/dist/ui/spinner.js +1 -36
  79. package/dist/ui/switch.js +1 -20
  80. package/dist/ui/tabs.js +20 -47
  81. package/dist/ui/tooltip.js +6 -17
  82. package/llms-full.txt +117 -9
  83. package/llms.txt +9 -6
  84. package/package.json +592 -528
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as t, Fragment as S } from "react/jsx-runtime";
3
- import * as $ from "react";
4
- import { useRef as k, useCallback as f } from "react";
5
- import { Popover as P, PopoverTrigger as Y, PopoverContent as _ } from "../ui/popover.js";
6
- import { Tooltip as Q, TooltipTrigger as U, TooltipContent as B } from "../ui/tooltip.js";
7
- import { IconBell as G, IconChecks as H, IconInbox as K } from "@tabler/icons-react";
2
+ import { jsxs as r, jsx as t, Fragment as S } from "react/jsx-runtime";
3
+ import * as H from "react";
4
+ import { useRef as z, useCallback as b } from "react";
5
+ import { Popover as B, PopoverTrigger as G, PopoverContent as L } from "../ui/popover.js";
6
+ import { Tooltip as O, TooltipTrigger as X, TooltipContent as _ } from "../ui/tooltip.js";
7
+ import { IconBell as q, IconChecks as F, IconInbox as J, IconX as Q } from "@tabler/icons-react";
8
8
  import { cn as x } from "../ui/lib/utils.js";
9
- function L(e) {
10
- const l = Date.now(), a = new Date(e).getTime(), d = l - a, c = Math.floor(d / 1e3), i = Math.floor(c / 60), n = Math.floor(i / 60), m = Math.floor(n / 24);
11
- return c < 60 ? "just now" : i < 60 ? `${i}m ago` : n < 24 ? `${n}h ago` : m < 7 ? `${m}d ago` : new Date(e).toLocaleDateString(void 0, {
9
+ function U(e) {
10
+ const l = Date.now(), i = new Date(e).getTime(), d = l - i, c = Math.floor(d / 1e3), n = Math.floor(c / 60), a = Math.floor(n / 60), m = Math.floor(a / 24);
11
+ return c < 60 ? "just now" : n < 60 ? `${n}m ago` : a < 24 ? `${a}h ago` : m < 7 ? `${m}d ago` : new Date(e).toLocaleDateString(void 0, {
12
12
  day: "numeric",
13
13
  month: "short"
14
14
  });
@@ -16,50 +16,36 @@ function L(e) {
16
16
  function N(e, l) {
17
17
  return e.getFullYear() === l.getFullYear() && e.getMonth() === l.getMonth() && e.getDate() === l.getDate();
18
18
  }
19
- function O(e) {
20
- const l = new Date(e), a = /* @__PURE__ */ new Date(), d = /* @__PURE__ */ new Date();
21
- return d.setDate(a.getDate() - 1), N(l, a) ? "Today" : N(l, d) ? "Yesterday" : "Earlier";
19
+ function V(e) {
20
+ const l = new Date(e), i = /* @__PURE__ */ new Date(), d = /* @__PURE__ */ new Date();
21
+ return d.setDate(i.getDate() - 1), N(l, i) ? "Today" : N(l, d) ? "Yesterday" : "Earlier";
22
22
  }
23
- const g = {
23
+ const v = {
24
24
  INFO: "bg-info",
25
25
  IMPORTANT: "bg-warning",
26
26
  CRITICAL: "bg-error"
27
27
  };
28
- function q(e) {
29
- if (!e.entityType) return null;
30
- switch (e.entityType) {
31
- case "TASK":
32
- return e.projectId ? `/projects/${e.projectId}/board` : null;
33
- case "BREAK_REQUEST":
34
- return "/breaks";
35
- case "ATTENDANCE":
36
- return "/attendance";
37
- case "CLIENT_REQUEST":
38
- return e.projectId ? `/projects/${e.projectId}/requests` : null;
39
- case "REVIEW_REQUEST":
40
- return e.projectId ? `/projects/${e.projectId}/board` : null;
41
- case "PROJECT":
42
- return e.projectId ? `/projects/${e.projectId}/board` : "/projects";
43
- default:
44
- return null;
45
- }
46
- }
47
- function z({
28
+ function W({
48
29
  notification: e,
49
30
  onRead: l,
50
- onNavigate: a,
51
- getRoute: d
31
+ onNavigate: i,
32
+ getRoute: d,
33
+ onDismiss: c
52
34
  }) {
53
- const c = d(e);
54
- return /* @__PURE__ */ s(
55
- "button",
35
+ const n = d(e), a = () => {
36
+ e.isRead || l(e.id), n && i(n);
37
+ };
38
+ return /* @__PURE__ */ r(
39
+ "div",
56
40
  {
57
- type: "button",
58
- onClick: () => {
59
- e.isRead || l(e.id), c && a(c);
41
+ role: "button",
42
+ tabIndex: 0,
43
+ onClick: a,
44
+ onKeyDown: (o) => {
45
+ (o.key === "Enter" || o.key === " ") && (o.preventDefault(), a());
60
46
  },
61
47
  className: x(
62
- "flex w-full items-start gap-ds-04 px-ds-05 py-ds-04 text-left transition-colors",
48
+ "group relative flex w-full cursor-pointer items-start gap-ds-04 px-ds-05 py-ds-04 text-left transition-colors",
63
49
  "hover:bg-layer-02",
64
50
  !e.isRead && "bg-interactive/[0.03]"
65
51
  ),
@@ -69,12 +55,12 @@ function z({
69
55
  {
70
56
  className: x(
71
57
  "h-[8px] w-[8px] rounded-ds-full",
72
- g[e.tier] || g.INFO,
58
+ v[e.tier] || v.INFO,
73
59
  e.isRead && "opacity-[0.38]"
74
60
  )
75
61
  }
76
62
  ) }),
77
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
63
+ /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
78
64
  /* @__PURE__ */ t(
79
65
  "p",
80
66
  {
@@ -86,138 +72,164 @@ function z({
86
72
  }
87
73
  ),
88
74
  e.body && /* @__PURE__ */ t("p", { className: "mt-ds-01 line-clamp-2 text-ds-sm text-text-placeholder", children: e.body }),
89
- /* @__PURE__ */ s("div", { className: "mt-ds-02 flex items-center gap-ds-03", children: [
90
- /* @__PURE__ */ t("span", { className: "text-ds-sm text-text-placeholder", children: L(e.createdAt) }),
91
- e.project && /* @__PURE__ */ s(S, { children: [
75
+ /* @__PURE__ */ r("div", { className: "mt-ds-02 flex items-center gap-ds-03", children: [
76
+ /* @__PURE__ */ t("span", { className: "text-ds-sm text-text-placeholder", children: U(e.createdAt) }),
77
+ e.project && /* @__PURE__ */ r(S, { children: [
92
78
  /* @__PURE__ */ t("span", { className: "text-text-placeholder", children: "·" }),
93
79
  /* @__PURE__ */ t("span", { className: "truncate text-ds-sm text-text-placeholder", children: e.project.title })
94
80
  ] })
95
81
  ] })
96
82
  ] }),
97
- !e.isRead && /* @__PURE__ */ t("div", { className: "mt-ds-02b shrink-0", children: /* @__PURE__ */ t("span", { className: "block h-[8px] w-[8px] rounded-ds-full bg-interactive" }) })
83
+ !e.isRead && /* @__PURE__ */ t("div", { className: "mt-ds-02b shrink-0", children: /* @__PURE__ */ t("span", { className: "block h-[8px] w-[8px] rounded-ds-full bg-interactive" }) }),
84
+ c && /* @__PURE__ */ t(
85
+ "button",
86
+ {
87
+ type: "button",
88
+ "aria-label": `Dismiss notification: ${e.title}`,
89
+ onClick: (o) => {
90
+ o.stopPropagation(), c(e.id);
91
+ },
92
+ onKeyDown: (o) => o.stopPropagation(),
93
+ className: "absolute right-ds-03 top-ds-03 hidden rounded-ds-sm p-ds-01 text-text-placeholder hover:bg-layer-03 hover:text-text-secondary group-hover:flex group-focus-within:flex",
94
+ children: /* @__PURE__ */ t(Q, { className: "h-ico-sm w-ico-sm" })
95
+ }
96
+ )
98
97
  ]
99
98
  }
100
99
  );
101
100
  }
102
- const J = $.forwardRef(
101
+ const Z = H.forwardRef(
103
102
  ({
104
103
  notifications: e = [],
105
104
  unreadCount: l,
106
- open: a,
105
+ open: i,
107
106
  onOpenChange: d,
108
107
  isLoading: c = !1,
109
- hasMore: i = !1,
110
- onFetchMore: n,
108
+ hasMore: n = !1,
109
+ onFetchMore: a,
111
110
  onMarkRead: m,
112
- onMarkAllRead: b,
113
- onNavigate: h,
111
+ onMarkAllRead: o,
112
+ onNavigate: f,
114
113
  getNotificationRoute: w,
115
- className: v,
116
- ...j
117
- }, T) => {
118
- const y = k(null), o = l ?? e.filter((r) => !r.isRead).length, I = w ?? q, R = f(
119
- (r) => {
120
- d == null || d(!1), h == null || h(r);
114
+ onDismiss: D,
115
+ headerActions: I,
116
+ emptyState: T,
117
+ footerSlot: g,
118
+ popoverClassName: j,
119
+ className: C,
120
+ ...R
121
+ }, k) => {
122
+ const y = z(null), u = l ?? e.filter((s) => !s.isRead).length, P = w ?? (() => null), Y = b(
123
+ (s) => {
124
+ d == null || d(!1), f == null || f(s);
121
125
  },
122
- [h, d]
123
- ), E = f(
124
- (r) => {
125
- m == null || m(r);
126
+ [f, d]
127
+ ), $ = b(
128
+ (s) => {
129
+ m == null || m(s);
126
130
  },
127
131
  [m]
128
- ), C = f(() => {
129
- const r = y.current;
130
- !r || c || !i || r.scrollTop + r.clientHeight >= r.scrollHeight - 50 && (n == null || n());
131
- }, [c, i, n]), D = e.reduce(
132
- (r, u) => {
133
- const p = O(u.createdAt);
134
- return r[p] || (r[p] = []), r[p].push(u), r;
132
+ ), A = b(() => {
133
+ const s = y.current;
134
+ !s || c || !n || s.scrollTop + s.clientHeight >= s.scrollHeight - 50 && (a == null || a());
135
+ }, [c, n, a]), E = e.reduce(
136
+ (s, h) => {
137
+ const p = V(h.createdAt);
138
+ return s[p] || (s[p] = []), s[p].push(h), s;
135
139
  },
136
140
  {}
137
- ), A = ["Today", "Yesterday", "Earlier"];
138
- return /* @__PURE__ */ s(P, { open: a, onOpenChange: d, children: [
139
- /* @__PURE__ */ s(Q, { children: [
140
- /* @__PURE__ */ t(U, { asChild: !0, children: /* @__PURE__ */ t(Y, { asChild: !0, children: /* @__PURE__ */ s(
141
+ ), K = ["Today", "Yesterday", "Earlier"];
142
+ return /* @__PURE__ */ r(B, { open: i, onOpenChange: d, children: [
143
+ /* @__PURE__ */ r(O, { children: [
144
+ /* @__PURE__ */ t(X, { asChild: !0, children: /* @__PURE__ */ t(G, { asChild: !0, children: /* @__PURE__ */ r(
141
145
  "button",
142
146
  {
143
- ...j,
144
- ref: T,
145
- "aria-label": o > 0 ? `Notifications, ${o} unread` : "Notifications",
147
+ ...R,
148
+ ref: k,
149
+ "aria-label": u > 0 ? `Notifications, ${u} unread` : "Notifications",
146
150
  className: x(
147
151
  "relative flex h-ds-sm-plus w-ds-sm-plus items-center justify-center rounded-ds-full border border-border bg-layer-02 text-text-secondary transition-colors hover:bg-layer-03",
148
- v
152
+ C
149
153
  ),
150
154
  children: [
151
- /* @__PURE__ */ t(G, { className: "h-ico-sm w-ico-sm", "aria-hidden": "true" }),
152
- o > 0 && /* @__PURE__ */ t("span", { className: "absolute -right-ds-01 -top-ds-01 flex h-4 min-w-4 items-center justify-center rounded-ds-full bg-interactive px-ds-02 text-ds-xs font-semibold text-text-on-color", children: o > 99 ? "99+" : o })
155
+ /* @__PURE__ */ t(q, { className: "h-ico-sm w-ico-sm", "aria-hidden": "true" }),
156
+ u > 0 && /* @__PURE__ */ t("span", { className: "absolute -right-ds-01 -top-ds-01 flex h-4 min-w-4 items-center justify-center rounded-ds-full bg-interactive px-ds-02 text-ds-xs font-semibold text-text-on-color", children: u > 99 ? "99+" : u })
153
157
  ]
154
158
  }
155
159
  ) }) }),
156
- /* @__PURE__ */ t(B, { side: "bottom", align: "center", children: "Notifications" })
160
+ /* @__PURE__ */ t(_, { side: "bottom", align: "center", children: "Notifications" })
157
161
  ] }),
158
- /* @__PURE__ */ s(
159
- _,
162
+ /* @__PURE__ */ r(
163
+ L,
160
164
  {
161
- className: "w-[380px] rounded-ds-xl border border-border bg-layer-01 p-0 shadow-03",
165
+ className: x(
166
+ "w-[380px] rounded-ds-xl border border-border bg-layer-01 p-0 shadow-03",
167
+ j
168
+ ),
162
169
  sideOffset: 8,
163
170
  align: "end",
164
171
  children: [
165
- /* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b border-border px-ds-05 py-ds-04", children: [
166
- /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03", children: [
172
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between border-b border-border px-ds-05 py-ds-04", children: [
173
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-ds-03", children: [
167
174
  /* @__PURE__ */ t("h3", { className: "text-ds-md font-semibold text-text-primary", children: "Notifications" }),
168
- o > 0 && /* @__PURE__ */ t("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-ds-full bg-interactive/10 px-ds-02b text-ds-sm font-semibold text-interactive", children: o })
175
+ u > 0 && /* @__PURE__ */ t("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-ds-full bg-interactive/10 px-ds-02b text-ds-sm font-semibold text-interactive", children: u })
169
176
  ] }),
170
- o > 0 && b && /* @__PURE__ */ s(
171
- "button",
172
- {
173
- type: "button",
174
- onClick: b,
175
- className: "flex items-center gap-ds-02 text-ds-sm text-text-placeholder transition-colors hover:text-interactive",
176
- children: [
177
- /* @__PURE__ */ t(H, { className: "h-ico-sm w-ico-sm" }),
178
- "Mark all read"
179
- ]
180
- }
181
- )
177
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-ds-03", children: [
178
+ u > 0 && o && /* @__PURE__ */ r(
179
+ "button",
180
+ {
181
+ type: "button",
182
+ onClick: o,
183
+ className: "flex items-center gap-ds-02 text-ds-sm text-text-placeholder transition-colors hover:text-interactive",
184
+ children: [
185
+ /* @__PURE__ */ t(F, { className: "h-ico-sm w-ico-sm" }),
186
+ "Mark all read"
187
+ ]
188
+ }
189
+ ),
190
+ I
191
+ ] })
182
192
  ] }),
183
- /* @__PURE__ */ s(
193
+ /* @__PURE__ */ r(
184
194
  "div",
185
195
  {
186
196
  ref: y,
187
- onScroll: C,
197
+ onScroll: A,
188
198
  className: "max-h-[420px] overflow-y-auto",
189
199
  children: [
190
- e.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center px-ds-05 py-ds-09", children: [
191
- /* @__PURE__ */ t("div", { className: "flex h-ds-lg w-ds-lg items-center justify-center rounded-ds-full bg-layer-02", children: /* @__PURE__ */ t(K, { className: "h-ico-lg w-ico-lg text-text-placeholder" }) }),
200
+ e.length === 0 ? T || /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center px-ds-05 py-ds-09", children: [
201
+ /* @__PURE__ */ t("div", { className: "flex h-ds-lg w-ds-lg items-center justify-center rounded-ds-full bg-layer-02", children: /* @__PURE__ */ t(J, { className: "h-ico-lg w-ico-lg text-text-placeholder" }) }),
192
202
  /* @__PURE__ */ t("p", { className: "mt-ds-04 text-ds-md text-text-placeholder", children: "No notifications yet" }),
193
203
  /* @__PURE__ */ t("p", { className: "mt-ds-02 text-ds-sm text-text-placeholder", children: "You're all caught up!" })
194
- ] }) : A.map((r) => {
195
- const u = D[r];
196
- return !u || u.length === 0 ? null : /* @__PURE__ */ s("div", { children: [
197
- /* @__PURE__ */ t("div", { className: "sticky top-0 z-raised bg-layer-01 px-ds-05 py-ds-02b", children: /* @__PURE__ */ t("span", { className: "text-ds-sm font-medium text-text-placeholder", children: r }) }),
198
- u.map((p) => /* @__PURE__ */ t(
199
- z,
204
+ ] }) : K.map((s) => {
205
+ const h = E[s];
206
+ return !h || h.length === 0 ? null : /* @__PURE__ */ r("div", { children: [
207
+ /* @__PURE__ */ t("div", { className: "sticky top-0 z-raised bg-layer-01 px-ds-05 py-ds-02b", children: /* @__PURE__ */ t("span", { className: "text-ds-sm font-medium text-text-placeholder", children: s }) }),
208
+ h.map((p) => /* @__PURE__ */ t(
209
+ W,
200
210
  {
201
211
  notification: p,
202
- onRead: E,
203
- onNavigate: R,
204
- getRoute: I
212
+ onRead: $,
213
+ onNavigate: Y,
214
+ getRoute: P,
215
+ onDismiss: D
205
216
  },
206
217
  p.id
207
218
  ))
208
- ] }, r);
219
+ ] }, s);
209
220
  }),
210
221
  c && /* @__PURE__ */ t("div", { className: "flex items-center justify-center py-ds-05", children: /* @__PURE__ */ t("div", { className: "h-ico-md w-ico-md animate-spin rounded-ds-full border-2 border-border border-t-interactive" }) })
211
222
  ]
212
223
  }
213
- )
224
+ ),
225
+ g && /* @__PURE__ */ t("div", { className: "border-t border-border px-ds-05 py-ds-03", children: g })
214
226
  ]
215
227
  }
216
228
  )
217
229
  ] });
218
230
  }
219
231
  );
220
- J.displayName = "NotificationCenter";
232
+ Z.displayName = "NotificationCenter";
221
233
  export {
222
- J as NotificationCenter
234
+ Z as NotificationCenter
223
235
  };
@@ -9,6 +9,24 @@ export interface TopBarUser {
9
9
  email?: string;
10
10
  image?: string | null;
11
11
  }
12
+ export interface UserMenuItem {
13
+ /** Display label */
14
+ label: string;
15
+ /** Optional icon (ReactNode) */
16
+ icon?: React.ReactNode;
17
+ /** Navigate via onNavigate when clicked */
18
+ href?: string;
19
+ /** Custom click handler */
20
+ onClick?: () => void;
21
+ /** Render a separator before this item */
22
+ separator?: boolean;
23
+ /** Text color semantic token (e.g. "error") — maps to text-{color} */
24
+ color?: string;
25
+ /** Badge content — string for count, true for dot indicator */
26
+ badge?: string | boolean;
27
+ /** Whether the item is disabled */
28
+ disabled?: boolean;
29
+ }
12
30
  export interface TopBarProps extends React.HTMLAttributes<HTMLDivElement> {
13
31
  /** Page title displayed on desktop */
14
32
  pageTitle?: string;
@@ -26,6 +44,8 @@ export interface TopBarProps extends React.HTMLAttributes<HTMLDivElement> {
26
44
  mobileLogo?: React.ReactNode;
27
45
  /** Notification center slot -- render your NotificationCenter here */
28
46
  notificationSlot?: React.ReactNode;
47
+ /** Custom menu items rendered between Profile and Dark/Light Mode */
48
+ userMenuItems?: UserMenuItem[];
29
49
  /** Additional className */
30
50
  className?: string;
31
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"top-bar.d.ts","sourceRoot":"","sources":["../../src/shell/top-bar.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuB9B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uDAAuD;IACvD,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,mCAAmC;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAMD,QAAA,MAAM,MAAM,oFAyLX,CAAA;AAGD,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"top-bar.d.ts","sourceRoot":"","sources":["../../src/shell/top-bar.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuB9B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,gCAAgC;IAChC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uDAAuD;IACvD,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,mCAAmC;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,sEAAsE;IACtE,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAClC,qEAAqE;IACrE,aAAa,CAAC,EAAE,YAAY,EAAE,CAAA;IAC9B,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAMD,QAAA,MAAM,MAAM,oFAwOX,CAAA;AAGD,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -1,29 +1,30 @@
1
1
  "use client";
2
- import { jsxs as r, jsx as e, Fragment as w } from "react/jsx-runtime";
3
- import * as C from "react";
4
- import { useColorMode as k } from "../hooks/use-color-mode.js";
5
- import { Avatar as M, AvatarImage as v, AvatarFallback as I } from "../ui/avatar.js";
6
- import { DropdownMenu as S, DropdownMenuTrigger as T, DropdownMenuContent as D, DropdownMenuItem as d, DropdownMenuSeparator as A } from "../ui/dropdown-menu.js";
7
- import { Tooltip as l, TooltipTrigger as o, TooltipContent as a } from "../ui/tooltip.js";
8
- import { SidebarTrigger as j } from "../ui/sidebar.js";
9
- import { IconSearch as K, IconSparkles as U, IconUser as B, IconSun as E, IconMoon as F, IconLogout as R } from "@tabler/icons-react";
10
- import { cn as z } from "../ui/lib/utils.js";
11
- const L = C.forwardRef(
2
+ import { jsxs as s, jsx as e, Fragment as I } from "react/jsx-runtime";
3
+ import * as g from "react";
4
+ import { useColorMode as j } from "../hooks/use-color-mode.js";
5
+ import { Avatar as A, AvatarImage as K, AvatarFallback as F } from "../ui/avatar.js";
6
+ import { DropdownMenu as U, DropdownMenuTrigger as B, DropdownMenuContent as E, DropdownMenuItem as d, DropdownMenuSeparator as w } from "../ui/dropdown-menu.js";
7
+ import { Tooltip as c, TooltipTrigger as n, TooltipContent as i } from "../ui/tooltip.js";
8
+ import { SidebarTrigger as R } from "../ui/sidebar.js";
9
+ import { IconSearch as z, IconSparkles as L, IconUser as O, IconSun as P, IconMoon as q, IconLogout as G } from "@tabler/icons-react";
10
+ import { cn as o } from "../ui/lib/utils.js";
11
+ const H = g.forwardRef(
12
12
  ({
13
- pageTitle: c = "",
14
- user: t,
15
- onNavigate: s,
16
- onLogout: n,
17
- onSearchClick: i,
18
- onAiChatClick: m,
19
- mobileLogo: p,
20
- notificationSlot: b,
21
- className: u,
22
- ...y
23
- }, f) => {
24
- var x;
25
- const { colorMode: h, toggleColorMode: g } = k(), N = () => {
26
- i ? i() : document.dispatchEvent(
13
+ pageTitle: m = "",
14
+ user: l,
15
+ onNavigate: t,
16
+ onLogout: p,
17
+ onSearchClick: h,
18
+ onAiChatClick: x,
19
+ mobileLogo: b,
20
+ notificationSlot: N,
21
+ userMenuItems: a,
22
+ className: C,
23
+ ...k
24
+ }, v) => {
25
+ var u;
26
+ const { colorMode: f, toggleColorMode: M } = j(), S = () => {
27
+ h ? h() : document.dispatchEvent(
27
28
  new KeyboardEvent("keydown", {
28
29
  key: "k",
29
30
  ctrlKey: !0,
@@ -31,99 +32,128 @@ const L = C.forwardRef(
31
32
  })
32
33
  );
33
34
  };
34
- return /* @__PURE__ */ r(
35
+ return /* @__PURE__ */ s(
35
36
  "div",
36
37
  {
37
- ...y,
38
- ref: f,
39
- className: z(
38
+ ...k,
39
+ ref: v,
40
+ className: o(
40
41
  "z-sticky flex w-full items-center border-b border-border bg-layer-01 px-ds-05 py-ds-04 md:px-ds-06",
41
- u
42
+ C
42
43
  ),
43
44
  children: [
44
- /* @__PURE__ */ r("div", { className: "flex items-center gap-ds-04", children: [
45
- /* @__PURE__ */ e(j, { className: "hidden text-text-secondary md:flex" }),
46
- p && /* @__PURE__ */ e("div", { className: "md:hidden", children: p }),
47
- c && /* @__PURE__ */ e("h2", { className: "hidden text-ds-lg text-text-primary md:block", children: c })
45
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-04", children: [
46
+ /* @__PURE__ */ e(R, { className: "hidden text-text-secondary md:flex" }),
47
+ b && /* @__PURE__ */ e("div", { className: "md:hidden", children: b }),
48
+ m && /* @__PURE__ */ e("h2", { className: "hidden text-ds-lg text-text-primary md:block", children: m })
48
49
  ] }),
49
- /* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-ds-03 md:gap-ds-05", children: [
50
- /* @__PURE__ */ r(l, { children: [
51
- /* @__PURE__ */ e(o, { asChild: !0, children: /* @__PURE__ */ e(
50
+ /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-ds-03 md:gap-ds-05", children: [
51
+ /* @__PURE__ */ s(c, { children: [
52
+ /* @__PURE__ */ e(n, { asChild: !0, children: /* @__PURE__ */ e(
52
53
  "button",
53
54
  {
54
55
  type: "button",
55
- onClick: N,
56
+ onClick: S,
56
57
  "aria-label": "Search (Ctrl+K)",
57
58
  className: "flex h-ds-sm-plus w-ds-sm-plus items-center justify-center rounded-ds-full border border-border bg-layer-02 text-text-secondary transition-colors hover:bg-layer-03",
58
- children: /* @__PURE__ */ e(K, { className: "h-ico-sm w-ico-sm", "aria-hidden": "true" })
59
+ children: /* @__PURE__ */ e(z, { className: "h-ico-sm w-ico-sm", "aria-hidden": "true" })
59
60
  }
60
61
  ) }),
61
- /* @__PURE__ */ e(a, { side: "bottom", align: "center", children: "Search (Ctrl+K)" })
62
+ /* @__PURE__ */ e(i, { side: "bottom", align: "center", children: "Search (Ctrl+K)" })
62
63
  ] }),
63
- b,
64
- m && /* @__PURE__ */ r(l, { children: [
65
- /* @__PURE__ */ e(o, { asChild: !0, children: /* @__PURE__ */ e(
64
+ N,
65
+ x && /* @__PURE__ */ s(c, { children: [
66
+ /* @__PURE__ */ e(n, { asChild: !0, children: /* @__PURE__ */ e(
66
67
  "button",
67
68
  {
68
69
  type: "button",
69
- onClick: m,
70
+ onClick: x,
70
71
  "aria-label": "AI Chat",
71
72
  className: "flex h-ds-sm-plus w-ds-sm-plus items-center justify-center rounded-ds-full border border-border bg-layer-02 text-text-secondary transition-colors hover:bg-layer-03",
72
- children: /* @__PURE__ */ e(U, { className: "h-ico-sm w-ico-sm", "aria-hidden": "true" })
73
+ children: /* @__PURE__ */ e(L, { className: "h-ico-sm w-ico-sm", "aria-hidden": "true" })
73
74
  }
74
75
  ) }),
75
- /* @__PURE__ */ e(a, { side: "bottom", align: "center", children: "AI Chat" })
76
+ /* @__PURE__ */ e(i, { side: "bottom", align: "center", children: "AI Chat" })
76
77
  ] }),
77
- t && /* @__PURE__ */ r(S, { children: [
78
- /* @__PURE__ */ r(l, { children: [
79
- /* @__PURE__ */ e(o, { asChild: !0, children: /* @__PURE__ */ e(T, { asChild: !0, children: /* @__PURE__ */ e("button", { type: "button", className: "flex items-center gap-ds-03 outline-none", children: /* @__PURE__ */ r(M, { className: "h-ds-sm-plus w-ds-sm-plus cursor-pointer", children: [
80
- t.image ? /* @__PURE__ */ e(v, { src: t.image, alt: t.name }) : null,
81
- /* @__PURE__ */ e(I, { className: "bg-layer-02 text-text-primary", children: (x = t.name) == null ? void 0 : x.charAt(0).toUpperCase() })
78
+ l && /* @__PURE__ */ s(U, { children: [
79
+ /* @__PURE__ */ s(c, { children: [
80
+ /* @__PURE__ */ e(n, { asChild: !0, children: /* @__PURE__ */ e(B, { asChild: !0, children: /* @__PURE__ */ e("button", { type: "button", className: "flex items-center gap-ds-03 outline-none", children: /* @__PURE__ */ s(A, { className: "h-ds-sm-plus w-ds-sm-plus cursor-pointer", children: [
81
+ l.image ? /* @__PURE__ */ e(K, { src: l.image, alt: l.name }) : null,
82
+ /* @__PURE__ */ e(F, { className: "bg-layer-02 text-text-primary", children: (u = l.name) == null ? void 0 : u.charAt(0).toUpperCase() })
82
83
  ] }) }) }) }),
83
- /* @__PURE__ */ e(a, { side: "bottom", align: "center", children: "User Menu" })
84
+ /* @__PURE__ */ e(i, { side: "bottom", align: "center", children: "User Menu" })
84
85
  ] }),
85
- /* @__PURE__ */ r(
86
- D,
86
+ /* @__PURE__ */ s(
87
+ E,
87
88
  {
88
89
  className: "w-[200px] rounded-ds-xl border border-border bg-layer-01 p-0 shadow-03",
89
90
  sideOffset: 8,
90
91
  align: "end",
91
92
  children: [
92
- /* @__PURE__ */ r("div", { className: "border-b border-border px-ds-05 py-ds-04", children: [
93
- /* @__PURE__ */ e("p", { className: "text-ds-md text-text-primary", children: t.name }),
94
- t.email && /* @__PURE__ */ e("p", { className: "text-ds-sm text-text-placeholder", children: t.email })
93
+ /* @__PURE__ */ s("div", { className: "border-b border-border px-ds-05 py-ds-04", children: [
94
+ /* @__PURE__ */ e("p", { className: "text-ds-md text-text-primary", children: l.name }),
95
+ l.email && /* @__PURE__ */ e("p", { className: "text-ds-sm text-text-placeholder", children: l.email })
95
96
  ] }),
96
- /* @__PURE__ */ r(
97
+ /* @__PURE__ */ s(
97
98
  d,
98
99
  {
99
100
  className: "flex w-full cursor-pointer items-center gap-ds-03 px-ds-05 py-ds-04 hover:bg-layer-02",
100
- onClick: () => s == null ? void 0 : s("/profile"),
101
+ onClick: () => t == null ? void 0 : t("/profile"),
101
102
  children: [
102
- /* @__PURE__ */ e(B, { className: "h-ico-sm w-ico-sm text-text-secondary" }),
103
+ /* @__PURE__ */ e(O, { className: "h-ico-sm w-ico-sm text-text-secondary" }),
103
104
  /* @__PURE__ */ e("span", { className: "text-ds-md text-text-secondary", children: "Profile" })
104
105
  ]
105
106
  }
106
107
  ),
107
- /* @__PURE__ */ r(
108
+ a == null ? void 0 : a.map((r, T) => {
109
+ const D = {
110
+ error: "text-error",
111
+ success: "text-success",
112
+ warning: "text-warning",
113
+ info: "text-info"
114
+ }, y = r.color ? D[r.color] ?? "text-text-secondary" : "text-text-secondary";
115
+ return /* @__PURE__ */ s(g.Fragment, { children: [
116
+ r.separator && /* @__PURE__ */ e(w, { className: "bg-border" }),
117
+ /* @__PURE__ */ s(
118
+ d,
119
+ {
120
+ className: o(
121
+ "flex w-full cursor-pointer items-center gap-ds-03 px-ds-05 py-ds-04 hover:bg-layer-02",
122
+ r.disabled && "pointer-events-none opacity-[0.38]"
123
+ ),
124
+ disabled: r.disabled,
125
+ onClick: () => {
126
+ r.disabled || (r.onClick ? r.onClick() : r.href && (t == null || t(r.href)));
127
+ },
128
+ children: [
129
+ r.icon && /* @__PURE__ */ e("span", { className: o("[&>svg]:h-ico-sm [&>svg]:w-ico-sm", y), children: r.icon }),
130
+ /* @__PURE__ */ e("span", { className: o("text-ds-md", y), children: r.label }),
131
+ r.badge != null && r.badge !== !1 && (typeof r.badge == "string" ? /* @__PURE__ */ e("span", { className: "ml-auto inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-ds-full bg-error px-ds-02 text-[10px] font-semibold leading-none text-text-on-color", children: r.badge }) : /* @__PURE__ */ e("span", { className: "ml-auto h-[8px] w-[8px] rounded-ds-full bg-error" }))
132
+ ]
133
+ }
134
+ )
135
+ ] }, r.label + T);
136
+ }),
137
+ /* @__PURE__ */ s(
108
138
  d,
109
139
  {
110
140
  className: "flex w-full cursor-pointer items-center gap-ds-03 px-ds-05 py-ds-04 hover:bg-layer-02",
111
- onClick: g,
141
+ onClick: M,
112
142
  children: [
113
- h === "dark" ? /* @__PURE__ */ e(E, { className: "h-ico-sm w-ico-sm text-text-secondary" }) : /* @__PURE__ */ e(F, { className: "h-ico-sm w-ico-sm text-text-secondary" }),
114
- /* @__PURE__ */ e("span", { className: "text-ds-md text-text-secondary", children: h === "dark" ? "Light Mode" : "Dark Mode" })
143
+ f === "dark" ? /* @__PURE__ */ e(P, { className: "h-ico-sm w-ico-sm text-text-secondary" }) : /* @__PURE__ */ e(q, { className: "h-ico-sm w-ico-sm text-text-secondary" }),
144
+ /* @__PURE__ */ e("span", { className: "text-ds-md text-text-secondary", children: f === "dark" ? "Light Mode" : "Dark Mode" })
115
145
  ]
116
146
  }
117
147
  ),
118
- n && /* @__PURE__ */ r(w, { children: [
119
- /* @__PURE__ */ e(A, { className: "bg-border" }),
120
- /* @__PURE__ */ r(
148
+ p && /* @__PURE__ */ s(I, { children: [
149
+ /* @__PURE__ */ e(w, { className: "bg-border" }),
150
+ /* @__PURE__ */ s(
121
151
  d,
122
152
  {
123
153
  className: "flex w-full cursor-pointer items-center gap-ds-03 px-ds-05 py-ds-04 hover:bg-layer-02",
124
- onClick: n,
154
+ onClick: p,
125
155
  children: [
126
- /* @__PURE__ */ e(R, { className: "h-ico-sm w-ico-sm text-error" }),
156
+ /* @__PURE__ */ e(G, { className: "h-ico-sm w-ico-sm text-error" }),
127
157
  /* @__PURE__ */ e("span", { className: "text-ds-md text-error", children: "Logout" })
128
158
  ]
129
159
  }
@@ -139,7 +169,7 @@ const L = C.forwardRef(
139
169
  );
140
170
  }
141
171
  );
142
- L.displayName = "TopBar";
172
+ H.displayName = "TopBar";
143
173
  export {
144
- L as TopBar
174
+ H as TopBar
145
175
  };