@krak-stack/registry 0.8.0 → 0.8.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @krak-stack/registry
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Preserve native Space and Shift+Enter typing in the agent textarea instead of activating the reference popover trigger. Include regression coverage for plain text and reference queries.
|
|
8
|
+
- 09d03cc: Expose the notification menu through the browser-safe `@krak-stack/notifications/client` entry point using the optional registry peer. Keep one shared menu implementation. Constrain popover and notification content overflow, place archive actions inside notification cards, and show a labeled Archive all button beneath the tabs. Use the standard rounded trigger button.
|
|
9
|
+
|
|
3
10
|
## 0.8.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
|
@@ -145,7 +145,7 @@ declare const RevertButton: ({ locale, messages, original, }: {
|
|
|
145
145
|
messages?: FormMessageTranslations;
|
|
146
146
|
original: string;
|
|
147
147
|
}) => JSX.Element | undefined;
|
|
148
|
-
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
148
|
+
declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta>(props: import("@tanstack/form-core").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
149
149
|
readonly TextField: typeof TextField;
|
|
150
150
|
readonly TextAreaField: typeof TextAreaField;
|
|
151
151
|
readonly SelectField: typeof SelectField;
|
|
@@ -161,7 +161,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
161
161
|
readonly FormError: typeof FormError;
|
|
162
162
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
163
163
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
164
|
-
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/
|
|
164
|
+
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
165
165
|
readonly TextField: typeof TextField;
|
|
166
166
|
readonly TextAreaField: typeof TextAreaField;
|
|
167
167
|
readonly SelectField: typeof SelectField;
|
|
@@ -178,7 +178,7 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
178
178
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
179
179
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
180
180
|
}, TRenderProps>) => import("react").FunctionComponent<import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
|
|
181
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/
|
|
181
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/form-core").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
|
|
182
182
|
readonly TextField: typeof TextField;
|
|
183
183
|
readonly TextAreaField: typeof TextAreaField;
|
|
184
184
|
readonly SelectField: typeof SelectField;
|
|
@@ -211,8 +211,8 @@ declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tans
|
|
|
211
211
|
readonly FormError: typeof FormError;
|
|
212
212
|
readonly FieldWrapper: typeof FieldWrapper;
|
|
213
213
|
readonly BlockNavigation: typeof BlockNavigation;
|
|
214
|
-
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/
|
|
215
|
-
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/
|
|
214
|
+
}, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends import("@tanstack/form-core").DeepKeysOfType<TFormData, TFieldGroupData | null | undefined> | import("@tanstack/form-core").FieldsMap<TFormData, TFieldGroupData>, TOnMount extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/form-core").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/form-core").FormAsyncValidateOrFn<TFormData>, TFormSubmitMeta>(params: import("react").PropsWithChildren<NoInfer<TRenderProps> & {
|
|
215
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFieldGroupApi<unknown, TFormData, string | import("@tanstack/form-core").FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, {
|
|
216
216
|
readonly TextField: typeof TextField;
|
|
217
217
|
readonly TextAreaField: typeof TextAreaField;
|
|
218
218
|
readonly SelectField: typeof SelectField;
|
|
@@ -2095,6 +2095,8 @@ function AgentWidget({
|
|
|
2095
2095
|
/* @__PURE__ */ jsx19(PopoverTrigger, {
|
|
2096
2096
|
id: referenceInputId,
|
|
2097
2097
|
nativeButton: false,
|
|
2098
|
+
onKeyDown: (event) => event.preventBaseUIHandler(),
|
|
2099
|
+
onKeyUp: (event) => event.preventBaseUIHandler(),
|
|
2098
2100
|
render: /* @__PURE__ */ jsx19(InputGroupTextarea, {
|
|
2099
2101
|
ref: inputRef,
|
|
2100
2102
|
className: "caret-foreground selection:bg-primary selection:text-primary-foreground relative max-h-32 w-full [scrollbar-width:thin] [scrollbar-color:var(--border)_transparent] [scrollbar-gutter:stable] overflow-y-auto overscroll-contain text-left text-transparent",
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
Inbox,
|
|
8
8
|
TriangleAlert
|
|
9
9
|
} from "lucide-react";
|
|
10
|
-
import { useState } from "react";
|
|
10
|
+
import { Fragment, useState } from "react";
|
|
11
11
|
import { Schema } from "effect";
|
|
12
12
|
|
|
13
13
|
// ../../src/components/ui/badge.tsx
|
|
@@ -245,10 +245,26 @@ function ScrollBar({
|
|
|
245
245
|
});
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
// ../../src/components/ui/
|
|
248
|
+
// ../../src/components/ui/separator.tsx
|
|
249
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
249
250
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
251
|
+
function Separator({
|
|
252
|
+
className,
|
|
253
|
+
orientation = "horizontal",
|
|
254
|
+
...props
|
|
255
|
+
}) {
|
|
256
|
+
return /* @__PURE__ */ jsx5(SeparatorPrimitive, {
|
|
257
|
+
"data-slot": "separator",
|
|
258
|
+
orientation,
|
|
259
|
+
className: cn("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch", className),
|
|
260
|
+
...props
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ../../src/components/ui/skeleton.tsx
|
|
265
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
250
266
|
function Skeleton({ className, ...props }) {
|
|
251
|
-
return /* @__PURE__ */
|
|
267
|
+
return /* @__PURE__ */ jsx6("div", {
|
|
252
268
|
"data-slot": "skeleton",
|
|
253
269
|
className: cn("animate-pulse rounded-md bg-muted", className),
|
|
254
270
|
...props
|
|
@@ -258,13 +274,13 @@ function Skeleton({ className, ...props }) {
|
|
|
258
274
|
// ../../src/components/ui/tabs.tsx
|
|
259
275
|
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
260
276
|
import { cva as cva4 } from "class-variance-authority";
|
|
261
|
-
import { jsx as
|
|
277
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
262
278
|
function Tabs({
|
|
263
279
|
className,
|
|
264
280
|
orientation = "horizontal",
|
|
265
281
|
...props
|
|
266
282
|
}) {
|
|
267
|
-
return /* @__PURE__ */
|
|
283
|
+
return /* @__PURE__ */ jsx7(TabsPrimitive.Root, {
|
|
268
284
|
"data-slot": "tabs",
|
|
269
285
|
"data-orientation": orientation,
|
|
270
286
|
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
@@ -287,7 +303,7 @@ function TabsList({
|
|
|
287
303
|
variant = "default",
|
|
288
304
|
...props
|
|
289
305
|
}) {
|
|
290
|
-
return /* @__PURE__ */
|
|
306
|
+
return /* @__PURE__ */ jsx7(TabsPrimitive.List, {
|
|
291
307
|
"data-slot": "tabs-list",
|
|
292
308
|
"data-variant": variant,
|
|
293
309
|
className: cn(tabsListVariants({ variant }), className),
|
|
@@ -295,7 +311,7 @@ function TabsList({
|
|
|
295
311
|
});
|
|
296
312
|
}
|
|
297
313
|
function TabsTrigger({ className, ...props }) {
|
|
298
|
-
return /* @__PURE__ */
|
|
314
|
+
return /* @__PURE__ */ jsx7(TabsPrimitive.Tab, {
|
|
299
315
|
"data-slot": "tabs-trigger",
|
|
300
316
|
className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
|
|
301
317
|
...props
|
|
@@ -304,7 +320,7 @@ function TabsTrigger({ className, ...props }) {
|
|
|
304
320
|
|
|
305
321
|
// ../../src/services/notification/client/notification-menu.tsx
|
|
306
322
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
307
|
-
import { jsx as
|
|
323
|
+
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
308
324
|
var defaultMessages = {
|
|
309
325
|
en: {
|
|
310
326
|
archive: "Archive",
|
|
@@ -386,65 +402,76 @@ function NotificationMenu({
|
|
|
386
402
|
open,
|
|
387
403
|
onOpenChange: handleOpenChange,
|
|
388
404
|
children: [
|
|
389
|
-
renderTrigger ? /* @__PURE__ */
|
|
405
|
+
renderTrigger ? /* @__PURE__ */ jsx8(PopoverTrigger, {
|
|
390
406
|
render: renderTrigger(triggerState)
|
|
391
|
-
}) : /* @__PURE__ */
|
|
407
|
+
}) : /* @__PURE__ */ jsx8(NotificationMenuTrigger, {
|
|
392
408
|
labels,
|
|
393
409
|
unreadCount: unreadIds.length
|
|
394
410
|
}),
|
|
395
411
|
/* @__PURE__ */ jsxs2(PopoverContent, {
|
|
396
412
|
align: "end",
|
|
397
|
-
className: cn("max-h-[min(32rem,80svh)] w-96 max-w-[calc(100vw-1rem)] gap-0 p-0", className),
|
|
413
|
+
className: cn("max-h-[min(32rem,80svh,var(--available-height))] w-96 max-w-[calc(100vw-1rem)] gap-0 overflow-hidden p-0", className),
|
|
398
414
|
children: [
|
|
399
|
-
/* @__PURE__ */
|
|
400
|
-
className: "border-b px-4 py-3",
|
|
401
|
-
children: /* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ jsx8(PopoverHeader, {
|
|
416
|
+
className: "shrink-0 border-b px-4 py-3",
|
|
417
|
+
children: /* @__PURE__ */ jsx8(PopoverTitle, {
|
|
402
418
|
children: labels.notifications
|
|
403
419
|
})
|
|
404
420
|
}),
|
|
405
421
|
/* @__PURE__ */ jsxs2(Tabs, {
|
|
406
422
|
value: tab,
|
|
407
423
|
onValueChange: (value) => setTab(value === "archive" ? "archive" : "inbox"),
|
|
408
|
-
className: "min-h-0 gap-0",
|
|
424
|
+
className: "min-h-0 min-w-0 flex-1 gap-0",
|
|
409
425
|
children: [
|
|
410
426
|
/* @__PURE__ */ jsxs2("div", {
|
|
411
|
-
className: "flex
|
|
427
|
+
className: "flex shrink-0 flex-col gap-2 border-b p-2",
|
|
412
428
|
children: [
|
|
413
429
|
/* @__PURE__ */ jsxs2(TabsList, {
|
|
414
|
-
className: "grid
|
|
430
|
+
className: "grid w-full min-w-0 grid-cols-2",
|
|
415
431
|
children: [
|
|
416
432
|
/* @__PURE__ */ jsxs2(TabsTrigger, {
|
|
433
|
+
className: "min-w-0",
|
|
417
434
|
value: "inbox",
|
|
418
435
|
children: [
|
|
419
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ jsx8(Inbox, {
|
|
420
437
|
"data-icon": "inline-start"
|
|
421
438
|
}),
|
|
422
|
-
|
|
423
|
-
|
|
439
|
+
/* @__PURE__ */ jsx8("span", {
|
|
440
|
+
className: "truncate",
|
|
441
|
+
children: labels.inbox
|
|
442
|
+
}),
|
|
443
|
+
inbox.length > 0 ? /* @__PURE__ */ jsx8(Badge, {
|
|
444
|
+
className: "shrink-0 tabular-nums",
|
|
424
445
|
variant: "secondary",
|
|
425
446
|
children: inbox.length
|
|
426
447
|
}) : null
|
|
427
448
|
]
|
|
428
449
|
}),
|
|
429
450
|
/* @__PURE__ */ jsxs2(TabsTrigger, {
|
|
451
|
+
className: "min-w-0",
|
|
430
452
|
value: "archive",
|
|
431
453
|
children: [
|
|
432
|
-
/* @__PURE__ */
|
|
454
|
+
/* @__PURE__ */ jsx8(ArchiveRestore, {
|
|
433
455
|
"data-icon": "inline-start"
|
|
434
456
|
}),
|
|
435
|
-
|
|
457
|
+
/* @__PURE__ */ jsx8("span", {
|
|
458
|
+
className: "truncate",
|
|
459
|
+
children: labels.archived
|
|
460
|
+
})
|
|
436
461
|
]
|
|
437
462
|
})
|
|
438
463
|
]
|
|
439
464
|
}),
|
|
440
|
-
tab === "inbox" && inbox.length > 0 && onArchive ? /* @__PURE__ */
|
|
465
|
+
tab === "inbox" && inbox.length > 0 && onArchive ? /* @__PURE__ */ jsx8(ArchiveButton, {
|
|
466
|
+
showLabel: true,
|
|
467
|
+
className: "w-full",
|
|
441
468
|
label: labels.archiveAll,
|
|
442
469
|
notificationIds: inbox.map((notification) => notification.id),
|
|
443
470
|
onArchive
|
|
444
471
|
}) : null
|
|
445
472
|
]
|
|
446
473
|
}),
|
|
447
|
-
/* @__PURE__ */
|
|
474
|
+
/* @__PURE__ */ jsx8(NotificationList, {
|
|
448
475
|
error,
|
|
449
476
|
isLoading,
|
|
450
477
|
labels,
|
|
@@ -472,11 +499,11 @@ function NotificationMenuTrigger({
|
|
|
472
499
|
const labels = providedLabels ?? notificationMenuMessages(locale, messages);
|
|
473
500
|
return /* @__PURE__ */ jsxs2(PopoverTrigger, {
|
|
474
501
|
"aria-label": unreadCount > 0 ? `${labels.notifications}, ${labels.unread(unreadCount)}` : labels.notifications,
|
|
475
|
-
className: cn(buttonVariants({ variant: "outline", size: "icon" }), "relative
|
|
502
|
+
className: cn(buttonVariants({ variant: "outline", size: "icon" }), "relative"),
|
|
476
503
|
type: "button",
|
|
477
504
|
children: [
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
unreadCount > 0 ? /* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ jsx8(Bell, {}),
|
|
506
|
+
unreadCount > 0 ? /* @__PURE__ */ jsx8(Badge, {
|
|
480
507
|
"aria-hidden": "true",
|
|
481
508
|
className: "absolute -top-1 -right-1 min-w-5 px-1 tabular-nums",
|
|
482
509
|
children: unreadCount > 99 ? "99+" : unreadCount
|
|
@@ -496,34 +523,39 @@ function NotificationList({
|
|
|
496
523
|
tab
|
|
497
524
|
}) {
|
|
498
525
|
if (isLoading)
|
|
499
|
-
return /* @__PURE__ */
|
|
526
|
+
return /* @__PURE__ */ jsx8(NotificationListLoading, {
|
|
500
527
|
label: labels.loading
|
|
501
528
|
});
|
|
502
529
|
if (error) {
|
|
503
|
-
return /* @__PURE__ */
|
|
530
|
+
return /* @__PURE__ */ jsx8(NotificationEmpty, {
|
|
504
531
|
description: labels.errorDescription,
|
|
505
|
-
icon: /* @__PURE__ */
|
|
532
|
+
icon: /* @__PURE__ */ jsx8(TriangleAlert, {}),
|
|
506
533
|
title: labels.errorTitle
|
|
507
534
|
});
|
|
508
535
|
}
|
|
509
536
|
if (notifications.length === 0) {
|
|
510
|
-
return /* @__PURE__ */
|
|
537
|
+
return /* @__PURE__ */ jsx8(NotificationEmpty, {
|
|
511
538
|
description: tab === "inbox" ? labels.emptyInboxDescription : labels.emptyArchiveDescription,
|
|
512
|
-
icon: tab === "inbox" ? /* @__PURE__ */
|
|
539
|
+
icon: tab === "inbox" ? /* @__PURE__ */ jsx8(BellDot, {}) : /* @__PURE__ */ jsx8(Archive, {}),
|
|
513
540
|
title: tab === "inbox" ? labels.emptyInboxTitle : labels.emptyArchiveTitle
|
|
514
541
|
});
|
|
515
542
|
}
|
|
516
|
-
return /* @__PURE__ */
|
|
517
|
-
className: "h-[min(24rem,60svh)]",
|
|
518
|
-
children: /* @__PURE__ */
|
|
519
|
-
className: "flex
|
|
520
|
-
children: notifications.map((notification) => /* @__PURE__ */
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
543
|
+
return /* @__PURE__ */ jsx8(ScrollArea, {
|
|
544
|
+
className: "h-[min(24rem,60svh)] min-h-0 min-w-0 flex-1",
|
|
545
|
+
children: /* @__PURE__ */ jsx8("div", {
|
|
546
|
+
className: "flex min-w-0 flex-col",
|
|
547
|
+
children: notifications.map((notification, index) => /* @__PURE__ */ jsxs2(Fragment, {
|
|
548
|
+
children: [
|
|
549
|
+
index > 0 ? /* @__PURE__ */ jsx8(Separator, {}) : null,
|
|
550
|
+
/* @__PURE__ */ jsx8(NotificationListItem, {
|
|
551
|
+
labels,
|
|
552
|
+
locale,
|
|
553
|
+
notification,
|
|
554
|
+
onArchive,
|
|
555
|
+
onNavigate,
|
|
556
|
+
renderItem
|
|
557
|
+
})
|
|
558
|
+
]
|
|
527
559
|
}, notification.id))
|
|
528
560
|
})
|
|
529
561
|
});
|
|
@@ -546,48 +578,53 @@ function NotificationListItem({
|
|
|
546
578
|
window.location.assign(notification.href);
|
|
547
579
|
}
|
|
548
580
|
};
|
|
581
|
+
const content = renderItem?.(notification) ?? /* @__PURE__ */ jsxs2("span", {
|
|
582
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
583
|
+
children: [
|
|
584
|
+
/* @__PURE__ */ jsxs2("span", {
|
|
585
|
+
className: "flex min-w-0 items-start gap-2",
|
|
586
|
+
children: [
|
|
587
|
+
unread ? /* @__PURE__ */ jsx8("span", {
|
|
588
|
+
"aria-hidden": "true",
|
|
589
|
+
className: "bg-primary mt-1.5 size-2 shrink-0 rounded-full"
|
|
590
|
+
}) : null,
|
|
591
|
+
/* @__PURE__ */ jsx8("span", {
|
|
592
|
+
className: "min-w-0 flex-1 font-medium",
|
|
593
|
+
children: notification.title
|
|
594
|
+
})
|
|
595
|
+
]
|
|
596
|
+
}),
|
|
597
|
+
notification.description ? /* @__PURE__ */ jsx8("span", {
|
|
598
|
+
className: "text-muted-foreground line-clamp-2 text-xs font-normal",
|
|
599
|
+
children: notification.description
|
|
600
|
+
}) : null,
|
|
601
|
+
notification.timestampLabel || notification.createdAt ? /* @__PURE__ */ jsx8("span", {
|
|
602
|
+
className: "text-muted-foreground text-xs font-normal",
|
|
603
|
+
children: notification.timestampLabel ?? formatNotificationDate(notification.createdAt, locale)
|
|
604
|
+
}) : null
|
|
605
|
+
]
|
|
606
|
+
});
|
|
549
607
|
return /* @__PURE__ */ jsxs2("div", {
|
|
550
|
-
className: cn("group
|
|
608
|
+
className: cn("group grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start py-2", unread && "bg-muted/70"),
|
|
551
609
|
"data-unread": unread || undefined,
|
|
552
610
|
children: [
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
-
className: "h-auto min-w-0
|
|
555
|
-
disabled: !notification.href && !onNavigate,
|
|
611
|
+
notification.href || onNavigate ? /* @__PURE__ */ jsx8(Button, {
|
|
612
|
+
className: "h-auto w-full min-w-0 justify-start px-3 py-2.5 text-left [overflow-wrap:anywhere] whitespace-normal",
|
|
556
613
|
onClick: selectNotification,
|
|
557
614
|
type: "button",
|
|
558
615
|
variant: "ghost",
|
|
559
|
-
children:
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
className: "flex min-w-0 items-start gap-2",
|
|
564
|
-
children: [
|
|
565
|
-
unread ? /* @__PURE__ */ jsx7("span", {
|
|
566
|
-
"aria-hidden": "true",
|
|
567
|
-
className: "bg-primary mt-1.5 size-2 shrink-0 rounded-full"
|
|
568
|
-
}) : null,
|
|
569
|
-
/* @__PURE__ */ jsx7("span", {
|
|
570
|
-
className: "min-w-0 flex-1 font-medium",
|
|
571
|
-
children: notification.title
|
|
572
|
-
})
|
|
573
|
-
]
|
|
574
|
-
}),
|
|
575
|
-
notification.description ? /* @__PURE__ */ jsx7("span", {
|
|
576
|
-
className: "text-muted-foreground line-clamp-2 text-xs font-normal",
|
|
577
|
-
children: notification.description
|
|
578
|
-
}) : null,
|
|
579
|
-
notification.timestampLabel || notification.createdAt ? /* @__PURE__ */ jsx7("span", {
|
|
580
|
-
className: "text-muted-foreground text-xs font-normal",
|
|
581
|
-
children: notification.timestampLabel ?? formatNotificationDate(notification.createdAt, locale)
|
|
582
|
-
}) : null
|
|
583
|
-
]
|
|
584
|
-
})
|
|
616
|
+
children: content
|
|
617
|
+
}) : /* @__PURE__ */ jsx8("div", {
|
|
618
|
+
className: "flex min-w-0 px-3 py-2.5 [overflow-wrap:anywhere]",
|
|
619
|
+
children: content
|
|
585
620
|
}),
|
|
586
|
-
!notification.archivedAt && onArchive ? /* @__PURE__ */
|
|
587
|
-
className: "
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
621
|
+
!notification.archivedAt && onArchive ? /* @__PURE__ */ jsx8("div", {
|
|
622
|
+
className: "pt-2 pr-2",
|
|
623
|
+
children: /* @__PURE__ */ jsx8(ArchiveButton, {
|
|
624
|
+
label: labels.archiveItem(notificationTitle(notification)),
|
|
625
|
+
notificationIds: [notification.id],
|
|
626
|
+
onArchive
|
|
627
|
+
})
|
|
591
628
|
}) : null
|
|
592
629
|
]
|
|
593
630
|
});
|
|
@@ -597,19 +634,20 @@ function NotificationEmpty({
|
|
|
597
634
|
icon,
|
|
598
635
|
title
|
|
599
636
|
}) {
|
|
600
|
-
return /* @__PURE__ */
|
|
637
|
+
return /* @__PURE__ */ jsx8(Empty, {
|
|
601
638
|
className: "min-h-48 p-6",
|
|
602
639
|
children: /* @__PURE__ */ jsxs2(EmptyHeader, {
|
|
603
640
|
children: [
|
|
604
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ jsx8(EmptyMedia, {
|
|
605
642
|
variant: "icon",
|
|
606
643
|
children: icon
|
|
607
644
|
}),
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
className: "text-
|
|
645
|
+
/* @__PURE__ */ jsx8(EmptyTitle, {
|
|
646
|
+
className: "text-sm",
|
|
610
647
|
children: title
|
|
611
648
|
}),
|
|
612
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ jsx8(EmptyDescription, {
|
|
650
|
+
className: "text-xs",
|
|
613
651
|
children: description
|
|
614
652
|
})
|
|
615
653
|
]
|
|
@@ -619,6 +657,7 @@ function NotificationEmpty({
|
|
|
619
657
|
function ArchiveButton({
|
|
620
658
|
className,
|
|
621
659
|
label,
|
|
660
|
+
showLabel = false,
|
|
622
661
|
notificationIds,
|
|
623
662
|
onArchive
|
|
624
663
|
}) {
|
|
@@ -631,36 +670,41 @@ function ArchiveButton({
|
|
|
631
670
|
setPending(false);
|
|
632
671
|
}
|
|
633
672
|
};
|
|
634
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ jsxs2(Button, {
|
|
635
674
|
"aria-label": label,
|
|
636
675
|
className,
|
|
637
676
|
disabled: pending,
|
|
638
677
|
onClick: () => void archiveNotifications(),
|
|
639
|
-
size: "icon-sm",
|
|
678
|
+
size: showLabel ? "sm" : "icon-sm",
|
|
640
679
|
title: label,
|
|
641
680
|
type: "button",
|
|
642
|
-
variant: "ghost",
|
|
643
|
-
children:
|
|
681
|
+
variant: showLabel ? "outline" : "ghost",
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ jsx8(Archive, {
|
|
684
|
+
"data-icon": showLabel ? "inline-start" : undefined
|
|
685
|
+
}),
|
|
686
|
+
showLabel ? label : null
|
|
687
|
+
]
|
|
644
688
|
});
|
|
645
689
|
}
|
|
646
690
|
function NotificationListLoading({ label }) {
|
|
647
|
-
return /* @__PURE__ */
|
|
691
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
648
692
|
"aria-label": label,
|
|
649
693
|
className: "flex flex-col gap-2 p-3",
|
|
650
694
|
role: "status",
|
|
651
695
|
children: [0, 1, 2].map((item) => /* @__PURE__ */ jsxs2("div", {
|
|
652
696
|
className: "flex items-center gap-3 p-2",
|
|
653
697
|
children: [
|
|
654
|
-
/* @__PURE__ */
|
|
698
|
+
/* @__PURE__ */ jsx8(Skeleton, {
|
|
655
699
|
className: "size-2 shrink-0 rounded-full"
|
|
656
700
|
}),
|
|
657
701
|
/* @__PURE__ */ jsxs2("div", {
|
|
658
702
|
className: "flex flex-1 flex-col gap-2",
|
|
659
703
|
children: [
|
|
660
|
-
/* @__PURE__ */
|
|
704
|
+
/* @__PURE__ */ jsx8(Skeleton, {
|
|
661
705
|
className: "h-4 w-4/5"
|
|
662
706
|
}),
|
|
663
|
-
/* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ jsx8(Skeleton, {
|
|
664
708
|
className: "h-3 w-2/5"
|
|
665
709
|
})
|
|
666
710
|
]
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
Inbox,
|
|
101
101
|
TriangleAlert
|
|
102
102
|
} from "lucide-react";
|
|
103
|
-
import { useState } from "react";
|
|
103
|
+
import { Fragment, useState } from "react";
|
|
104
104
|
import { Schema as Schema2 } from "effect";
|
|
105
105
|
|
|
106
106
|
// ../../src/components/ui/badge.tsx
|
|
@@ -338,10 +338,26 @@ function ScrollBar({
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
-
// ../../src/components/ui/
|
|
341
|
+
// ../../src/components/ui/separator.tsx
|
|
342
|
+
import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
|
|
342
343
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
344
|
+
function Separator({
|
|
345
|
+
className,
|
|
346
|
+
orientation = "horizontal",
|
|
347
|
+
...props
|
|
348
|
+
}) {
|
|
349
|
+
return /* @__PURE__ */ jsx5(SeparatorPrimitive, {
|
|
350
|
+
"data-slot": "separator",
|
|
351
|
+
orientation,
|
|
352
|
+
className: cn("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch", className),
|
|
353
|
+
...props
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ../../src/components/ui/skeleton.tsx
|
|
358
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
343
359
|
function Skeleton({ className, ...props }) {
|
|
344
|
-
return /* @__PURE__ */
|
|
360
|
+
return /* @__PURE__ */ jsx6("div", {
|
|
345
361
|
"data-slot": "skeleton",
|
|
346
362
|
className: cn("animate-pulse rounded-md bg-muted", className),
|
|
347
363
|
...props
|
|
@@ -351,13 +367,13 @@ function Skeleton({ className, ...props }) {
|
|
|
351
367
|
// ../../src/components/ui/tabs.tsx
|
|
352
368
|
import { Tabs as TabsPrimitive } from "@base-ui/react/tabs";
|
|
353
369
|
import { cva as cva4 } from "class-variance-authority";
|
|
354
|
-
import { jsx as
|
|
370
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
355
371
|
function Tabs({
|
|
356
372
|
className,
|
|
357
373
|
orientation = "horizontal",
|
|
358
374
|
...props
|
|
359
375
|
}) {
|
|
360
|
-
return /* @__PURE__ */
|
|
376
|
+
return /* @__PURE__ */ jsx7(TabsPrimitive.Root, {
|
|
361
377
|
"data-slot": "tabs",
|
|
362
378
|
"data-orientation": orientation,
|
|
363
379
|
className: cn("group/tabs flex gap-2 data-horizontal:flex-col", className),
|
|
@@ -380,7 +396,7 @@ function TabsList({
|
|
|
380
396
|
variant = "default",
|
|
381
397
|
...props
|
|
382
398
|
}) {
|
|
383
|
-
return /* @__PURE__ */
|
|
399
|
+
return /* @__PURE__ */ jsx7(TabsPrimitive.List, {
|
|
384
400
|
"data-slot": "tabs-list",
|
|
385
401
|
"data-variant": variant,
|
|
386
402
|
className: cn(tabsListVariants({ variant }), className),
|
|
@@ -388,7 +404,7 @@ function TabsList({
|
|
|
388
404
|
});
|
|
389
405
|
}
|
|
390
406
|
function TabsTrigger({ className, ...props }) {
|
|
391
|
-
return /* @__PURE__ */
|
|
407
|
+
return /* @__PURE__ */ jsx7(TabsPrimitive.Tab, {
|
|
392
408
|
"data-slot": "tabs-trigger",
|
|
393
409
|
className: cn("relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent", "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground", "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100", className),
|
|
394
410
|
...props
|
|
@@ -397,7 +413,7 @@ function TabsTrigger({ className, ...props }) {
|
|
|
397
413
|
|
|
398
414
|
// ../../src/services/notification/client/notification-menu.tsx
|
|
399
415
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider";
|
|
400
|
-
import { jsx as
|
|
416
|
+
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
401
417
|
var defaultMessages = {
|
|
402
418
|
en: {
|
|
403
419
|
archive: "Archive",
|
|
@@ -479,65 +495,76 @@ function NotificationMenu({
|
|
|
479
495
|
open,
|
|
480
496
|
onOpenChange: handleOpenChange,
|
|
481
497
|
children: [
|
|
482
|
-
renderTrigger ? /* @__PURE__ */
|
|
498
|
+
renderTrigger ? /* @__PURE__ */ jsx8(PopoverTrigger, {
|
|
483
499
|
render: renderTrigger(triggerState)
|
|
484
|
-
}) : /* @__PURE__ */
|
|
500
|
+
}) : /* @__PURE__ */ jsx8(NotificationMenuTrigger, {
|
|
485
501
|
labels,
|
|
486
502
|
unreadCount: unreadIds.length
|
|
487
503
|
}),
|
|
488
504
|
/* @__PURE__ */ jsxs2(PopoverContent, {
|
|
489
505
|
align: "end",
|
|
490
|
-
className: cn("max-h-[min(32rem,80svh)] w-96 max-w-[calc(100vw-1rem)] gap-0 p-0", className),
|
|
506
|
+
className: cn("max-h-[min(32rem,80svh,var(--available-height))] w-96 max-w-[calc(100vw-1rem)] gap-0 overflow-hidden p-0", className),
|
|
491
507
|
children: [
|
|
492
|
-
/* @__PURE__ */
|
|
493
|
-
className: "border-b px-4 py-3",
|
|
494
|
-
children: /* @__PURE__ */
|
|
508
|
+
/* @__PURE__ */ jsx8(PopoverHeader, {
|
|
509
|
+
className: "shrink-0 border-b px-4 py-3",
|
|
510
|
+
children: /* @__PURE__ */ jsx8(PopoverTitle, {
|
|
495
511
|
children: labels.notifications
|
|
496
512
|
})
|
|
497
513
|
}),
|
|
498
514
|
/* @__PURE__ */ jsxs2(Tabs, {
|
|
499
515
|
value: tab,
|
|
500
516
|
onValueChange: (value) => setTab(value === "archive" ? "archive" : "inbox"),
|
|
501
|
-
className: "min-h-0 gap-0",
|
|
517
|
+
className: "min-h-0 min-w-0 flex-1 gap-0",
|
|
502
518
|
children: [
|
|
503
519
|
/* @__PURE__ */ jsxs2("div", {
|
|
504
|
-
className: "flex
|
|
520
|
+
className: "flex shrink-0 flex-col gap-2 border-b p-2",
|
|
505
521
|
children: [
|
|
506
522
|
/* @__PURE__ */ jsxs2(TabsList, {
|
|
507
|
-
className: "grid
|
|
523
|
+
className: "grid w-full min-w-0 grid-cols-2",
|
|
508
524
|
children: [
|
|
509
525
|
/* @__PURE__ */ jsxs2(TabsTrigger, {
|
|
526
|
+
className: "min-w-0",
|
|
510
527
|
value: "inbox",
|
|
511
528
|
children: [
|
|
512
|
-
/* @__PURE__ */
|
|
529
|
+
/* @__PURE__ */ jsx8(Inbox, {
|
|
513
530
|
"data-icon": "inline-start"
|
|
514
531
|
}),
|
|
515
|
-
|
|
516
|
-
|
|
532
|
+
/* @__PURE__ */ jsx8("span", {
|
|
533
|
+
className: "truncate",
|
|
534
|
+
children: labels.inbox
|
|
535
|
+
}),
|
|
536
|
+
inbox.length > 0 ? /* @__PURE__ */ jsx8(Badge, {
|
|
537
|
+
className: "shrink-0 tabular-nums",
|
|
517
538
|
variant: "secondary",
|
|
518
539
|
children: inbox.length
|
|
519
540
|
}) : null
|
|
520
541
|
]
|
|
521
542
|
}),
|
|
522
543
|
/* @__PURE__ */ jsxs2(TabsTrigger, {
|
|
544
|
+
className: "min-w-0",
|
|
523
545
|
value: "archive",
|
|
524
546
|
children: [
|
|
525
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ jsx8(ArchiveRestore, {
|
|
526
548
|
"data-icon": "inline-start"
|
|
527
549
|
}),
|
|
528
|
-
|
|
550
|
+
/* @__PURE__ */ jsx8("span", {
|
|
551
|
+
className: "truncate",
|
|
552
|
+
children: labels.archived
|
|
553
|
+
})
|
|
529
554
|
]
|
|
530
555
|
})
|
|
531
556
|
]
|
|
532
557
|
}),
|
|
533
|
-
tab === "inbox" && inbox.length > 0 && onArchive ? /* @__PURE__ */
|
|
558
|
+
tab === "inbox" && inbox.length > 0 && onArchive ? /* @__PURE__ */ jsx8(ArchiveButton, {
|
|
559
|
+
showLabel: true,
|
|
560
|
+
className: "w-full",
|
|
534
561
|
label: labels.archiveAll,
|
|
535
562
|
notificationIds: inbox.map((notification) => notification.id),
|
|
536
563
|
onArchive
|
|
537
564
|
}) : null
|
|
538
565
|
]
|
|
539
566
|
}),
|
|
540
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ jsx8(NotificationList, {
|
|
541
568
|
error,
|
|
542
569
|
isLoading,
|
|
543
570
|
labels,
|
|
@@ -565,11 +592,11 @@ function NotificationMenuTrigger({
|
|
|
565
592
|
const labels = providedLabels ?? notificationMenuMessages(locale, messages);
|
|
566
593
|
return /* @__PURE__ */ jsxs2(PopoverTrigger, {
|
|
567
594
|
"aria-label": unreadCount > 0 ? `${labels.notifications}, ${labels.unread(unreadCount)}` : labels.notifications,
|
|
568
|
-
className: cn(buttonVariants({ variant: "outline", size: "icon" }), "relative
|
|
595
|
+
className: cn(buttonVariants({ variant: "outline", size: "icon" }), "relative"),
|
|
569
596
|
type: "button",
|
|
570
597
|
children: [
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
unreadCount > 0 ? /* @__PURE__ */
|
|
598
|
+
/* @__PURE__ */ jsx8(Bell, {}),
|
|
599
|
+
unreadCount > 0 ? /* @__PURE__ */ jsx8(Badge, {
|
|
573
600
|
"aria-hidden": "true",
|
|
574
601
|
className: "absolute -top-1 -right-1 min-w-5 px-1 tabular-nums",
|
|
575
602
|
children: unreadCount > 99 ? "99+" : unreadCount
|
|
@@ -589,34 +616,39 @@ function NotificationList({
|
|
|
589
616
|
tab
|
|
590
617
|
}) {
|
|
591
618
|
if (isLoading)
|
|
592
|
-
return /* @__PURE__ */
|
|
619
|
+
return /* @__PURE__ */ jsx8(NotificationListLoading, {
|
|
593
620
|
label: labels.loading
|
|
594
621
|
});
|
|
595
622
|
if (error) {
|
|
596
|
-
return /* @__PURE__ */
|
|
623
|
+
return /* @__PURE__ */ jsx8(NotificationEmpty, {
|
|
597
624
|
description: labels.errorDescription,
|
|
598
|
-
icon: /* @__PURE__ */
|
|
625
|
+
icon: /* @__PURE__ */ jsx8(TriangleAlert, {}),
|
|
599
626
|
title: labels.errorTitle
|
|
600
627
|
});
|
|
601
628
|
}
|
|
602
629
|
if (notifications.length === 0) {
|
|
603
|
-
return /* @__PURE__ */
|
|
630
|
+
return /* @__PURE__ */ jsx8(NotificationEmpty, {
|
|
604
631
|
description: tab === "inbox" ? labels.emptyInboxDescription : labels.emptyArchiveDescription,
|
|
605
|
-
icon: tab === "inbox" ? /* @__PURE__ */
|
|
632
|
+
icon: tab === "inbox" ? /* @__PURE__ */ jsx8(BellDot, {}) : /* @__PURE__ */ jsx8(Archive, {}),
|
|
606
633
|
title: tab === "inbox" ? labels.emptyInboxTitle : labels.emptyArchiveTitle
|
|
607
634
|
});
|
|
608
635
|
}
|
|
609
|
-
return /* @__PURE__ */
|
|
610
|
-
className: "h-[min(24rem,60svh)]",
|
|
611
|
-
children: /* @__PURE__ */
|
|
612
|
-
className: "flex
|
|
613
|
-
children: notifications.map((notification) => /* @__PURE__ */
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
636
|
+
return /* @__PURE__ */ jsx8(ScrollArea, {
|
|
637
|
+
className: "h-[min(24rem,60svh)] min-h-0 min-w-0 flex-1",
|
|
638
|
+
children: /* @__PURE__ */ jsx8("div", {
|
|
639
|
+
className: "flex min-w-0 flex-col",
|
|
640
|
+
children: notifications.map((notification, index) => /* @__PURE__ */ jsxs2(Fragment, {
|
|
641
|
+
children: [
|
|
642
|
+
index > 0 ? /* @__PURE__ */ jsx8(Separator, {}) : null,
|
|
643
|
+
/* @__PURE__ */ jsx8(NotificationListItem, {
|
|
644
|
+
labels,
|
|
645
|
+
locale,
|
|
646
|
+
notification,
|
|
647
|
+
onArchive,
|
|
648
|
+
onNavigate,
|
|
649
|
+
renderItem
|
|
650
|
+
})
|
|
651
|
+
]
|
|
620
652
|
}, notification.id))
|
|
621
653
|
})
|
|
622
654
|
});
|
|
@@ -639,48 +671,53 @@ function NotificationListItem({
|
|
|
639
671
|
window.location.assign(notification.href);
|
|
640
672
|
}
|
|
641
673
|
};
|
|
674
|
+
const content = renderItem?.(notification) ?? /* @__PURE__ */ jsxs2("span", {
|
|
675
|
+
className: "flex min-w-0 flex-1 flex-col gap-1",
|
|
676
|
+
children: [
|
|
677
|
+
/* @__PURE__ */ jsxs2("span", {
|
|
678
|
+
className: "flex min-w-0 items-start gap-2",
|
|
679
|
+
children: [
|
|
680
|
+
unread ? /* @__PURE__ */ jsx8("span", {
|
|
681
|
+
"aria-hidden": "true",
|
|
682
|
+
className: "bg-primary mt-1.5 size-2 shrink-0 rounded-full"
|
|
683
|
+
}) : null,
|
|
684
|
+
/* @__PURE__ */ jsx8("span", {
|
|
685
|
+
className: "min-w-0 flex-1 font-medium",
|
|
686
|
+
children: notification.title
|
|
687
|
+
})
|
|
688
|
+
]
|
|
689
|
+
}),
|
|
690
|
+
notification.description ? /* @__PURE__ */ jsx8("span", {
|
|
691
|
+
className: "text-muted-foreground line-clamp-2 text-xs font-normal",
|
|
692
|
+
children: notification.description
|
|
693
|
+
}) : null,
|
|
694
|
+
notification.timestampLabel || notification.createdAt ? /* @__PURE__ */ jsx8("span", {
|
|
695
|
+
className: "text-muted-foreground text-xs font-normal",
|
|
696
|
+
children: notification.timestampLabel ?? formatNotificationDate(notification.createdAt, locale)
|
|
697
|
+
}) : null
|
|
698
|
+
]
|
|
699
|
+
});
|
|
642
700
|
return /* @__PURE__ */ jsxs2("div", {
|
|
643
|
-
className: cn("group
|
|
701
|
+
className: cn("group grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start py-2", unread && "bg-muted/70"),
|
|
644
702
|
"data-unread": unread || undefined,
|
|
645
703
|
children: [
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
className: "h-auto min-w-0
|
|
648
|
-
disabled: !notification.href && !onNavigate,
|
|
704
|
+
notification.href || onNavigate ? /* @__PURE__ */ jsx8(Button, {
|
|
705
|
+
className: "h-auto w-full min-w-0 justify-start px-3 py-2.5 text-left [overflow-wrap:anywhere] whitespace-normal",
|
|
649
706
|
onClick: selectNotification,
|
|
650
707
|
type: "button",
|
|
651
708
|
variant: "ghost",
|
|
652
|
-
children:
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
className: "flex min-w-0 items-start gap-2",
|
|
657
|
-
children: [
|
|
658
|
-
unread ? /* @__PURE__ */ jsx7("span", {
|
|
659
|
-
"aria-hidden": "true",
|
|
660
|
-
className: "bg-primary mt-1.5 size-2 shrink-0 rounded-full"
|
|
661
|
-
}) : null,
|
|
662
|
-
/* @__PURE__ */ jsx7("span", {
|
|
663
|
-
className: "min-w-0 flex-1 font-medium",
|
|
664
|
-
children: notification.title
|
|
665
|
-
})
|
|
666
|
-
]
|
|
667
|
-
}),
|
|
668
|
-
notification.description ? /* @__PURE__ */ jsx7("span", {
|
|
669
|
-
className: "text-muted-foreground line-clamp-2 text-xs font-normal",
|
|
670
|
-
children: notification.description
|
|
671
|
-
}) : null,
|
|
672
|
-
notification.timestampLabel || notification.createdAt ? /* @__PURE__ */ jsx7("span", {
|
|
673
|
-
className: "text-muted-foreground text-xs font-normal",
|
|
674
|
-
children: notification.timestampLabel ?? formatNotificationDate(notification.createdAt, locale)
|
|
675
|
-
}) : null
|
|
676
|
-
]
|
|
677
|
-
})
|
|
709
|
+
children: content
|
|
710
|
+
}) : /* @__PURE__ */ jsx8("div", {
|
|
711
|
+
className: "flex min-w-0 px-3 py-2.5 [overflow-wrap:anywhere]",
|
|
712
|
+
children: content
|
|
678
713
|
}),
|
|
679
|
-
!notification.archivedAt && onArchive ? /* @__PURE__ */
|
|
680
|
-
className: "
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
714
|
+
!notification.archivedAt && onArchive ? /* @__PURE__ */ jsx8("div", {
|
|
715
|
+
className: "pt-2 pr-2",
|
|
716
|
+
children: /* @__PURE__ */ jsx8(ArchiveButton, {
|
|
717
|
+
label: labels.archiveItem(notificationTitle(notification)),
|
|
718
|
+
notificationIds: [notification.id],
|
|
719
|
+
onArchive
|
|
720
|
+
})
|
|
684
721
|
}) : null
|
|
685
722
|
]
|
|
686
723
|
});
|
|
@@ -690,19 +727,20 @@ function NotificationEmpty({
|
|
|
690
727
|
icon,
|
|
691
728
|
title
|
|
692
729
|
}) {
|
|
693
|
-
return /* @__PURE__ */
|
|
730
|
+
return /* @__PURE__ */ jsx8(Empty, {
|
|
694
731
|
className: "min-h-48 p-6",
|
|
695
732
|
children: /* @__PURE__ */ jsxs2(EmptyHeader, {
|
|
696
733
|
children: [
|
|
697
|
-
/* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ jsx8(EmptyMedia, {
|
|
698
735
|
variant: "icon",
|
|
699
736
|
children: icon
|
|
700
737
|
}),
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
-
className: "text-
|
|
738
|
+
/* @__PURE__ */ jsx8(EmptyTitle, {
|
|
739
|
+
className: "text-sm",
|
|
703
740
|
children: title
|
|
704
741
|
}),
|
|
705
|
-
/* @__PURE__ */
|
|
742
|
+
/* @__PURE__ */ jsx8(EmptyDescription, {
|
|
743
|
+
className: "text-xs",
|
|
706
744
|
children: description
|
|
707
745
|
})
|
|
708
746
|
]
|
|
@@ -712,6 +750,7 @@ function NotificationEmpty({
|
|
|
712
750
|
function ArchiveButton({
|
|
713
751
|
className,
|
|
714
752
|
label,
|
|
753
|
+
showLabel = false,
|
|
715
754
|
notificationIds,
|
|
716
755
|
onArchive
|
|
717
756
|
}) {
|
|
@@ -724,36 +763,41 @@ function ArchiveButton({
|
|
|
724
763
|
setPending(false);
|
|
725
764
|
}
|
|
726
765
|
};
|
|
727
|
-
return /* @__PURE__ */
|
|
766
|
+
return /* @__PURE__ */ jsxs2(Button, {
|
|
728
767
|
"aria-label": label,
|
|
729
768
|
className,
|
|
730
769
|
disabled: pending,
|
|
731
770
|
onClick: () => void archiveNotifications(),
|
|
732
|
-
size: "icon-sm",
|
|
771
|
+
size: showLabel ? "sm" : "icon-sm",
|
|
733
772
|
title: label,
|
|
734
773
|
type: "button",
|
|
735
|
-
variant: "ghost",
|
|
736
|
-
children:
|
|
774
|
+
variant: showLabel ? "outline" : "ghost",
|
|
775
|
+
children: [
|
|
776
|
+
/* @__PURE__ */ jsx8(Archive, {
|
|
777
|
+
"data-icon": showLabel ? "inline-start" : undefined
|
|
778
|
+
}),
|
|
779
|
+
showLabel ? label : null
|
|
780
|
+
]
|
|
737
781
|
});
|
|
738
782
|
}
|
|
739
783
|
function NotificationListLoading({ label }) {
|
|
740
|
-
return /* @__PURE__ */
|
|
784
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
741
785
|
"aria-label": label,
|
|
742
786
|
className: "flex flex-col gap-2 p-3",
|
|
743
787
|
role: "status",
|
|
744
788
|
children: [0, 1, 2].map((item) => /* @__PURE__ */ jsxs2("div", {
|
|
745
789
|
className: "flex items-center gap-3 p-2",
|
|
746
790
|
children: [
|
|
747
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ jsx8(Skeleton, {
|
|
748
792
|
className: "size-2 shrink-0 rounded-full"
|
|
749
793
|
}),
|
|
750
794
|
/* @__PURE__ */ jsxs2("div", {
|
|
751
795
|
className: "flex flex-1 flex-col gap-2",
|
|
752
796
|
children: [
|
|
753
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ jsx8(Skeleton, {
|
|
754
798
|
className: "h-4 w-4/5"
|
|
755
799
|
}),
|
|
756
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ jsx8(Skeleton, {
|
|
757
801
|
className: "h-3 w-2/5"
|
|
758
802
|
})
|
|
759
803
|
]
|