@krak-stack/registry 0.10.13 → 0.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @krak-stack/registry
2
2
 
3
+ ## 0.10.14
4
+
5
+ ### Patch Changes
6
+
7
+ - Render notification destinations as native links and improve keyboard focus outlines in the notification menu.
8
+
3
9
  ## 0.10.13
4
10
 
5
11
  ### Patch Changes
@@ -411,7 +411,7 @@ function NotificationMenu({
411
411
  className: "flex shrink-0 flex-col gap-2 border-b p-2",
412
412
  children: [
413
413
  /* @__PURE__ */ jsxs2(TabsList, {
414
- className: "grid w-full min-w-0 grid-cols-2",
414
+ className: "w-full min-w-0 gap-2",
415
415
  children: [
416
416
  /* @__PURE__ */ jsxs2(TabsTrigger, {
417
417
  className: "min-w-0",
@@ -525,9 +525,9 @@ function NotificationList({
525
525
  });
526
526
  }
527
527
  return /* @__PURE__ */ jsx7(ScrollArea, {
528
- className: "flex max-h-[min(24rem,60svh)] min-h-0 min-w-0 flex-auto flex-col overflow-hidden [&>[data-slot=scroll-area-viewport]]:h-auto [&>[data-slot=scroll-area-viewport]]:min-h-0 [&>[data-slot=scroll-area-viewport][data-has-overflow-y]]:[--notification-scrollbar-gutter:0.375rem]",
528
+ className: "flex max-h-[min(24rem,60svh)] min-h-0 min-w-0 flex-auto flex-col overflow-hidden [&>[data-slot=scroll-area-viewport]]:h-auto [&>[data-slot=scroll-area-viewport]]:min-h-0 [&>[data-slot=scroll-area-viewport][data-has-overflow-y]]:[--notification-scrollbar-gutter:--spacing(2.5)]",
529
529
  children: /* @__PURE__ */ jsx7("div", {
530
- className: "flex min-w-0 flex-col",
530
+ className: "divide-border flex min-w-0 flex-col divide-y pe-[var(--notification-scrollbar-gutter,0px)]",
531
531
  children: notifications.map((notification) => /* @__PURE__ */ jsx7(NotificationListItem, {
532
532
  labels,
533
533
  locale,
@@ -548,15 +548,10 @@ function NotificationListItem({
548
548
  renderItem
549
549
  }) {
550
550
  const unread = !notification.readAt && !notification.archivedAt;
551
- const selectNotification = () => {
552
- if (onNavigate) {
553
- onNavigate(notification);
554
- return;
555
- }
556
- if (notification.href && globalThis.window) {
557
- window.location.assign(notification.href);
558
- }
559
- };
551
+ const { href } = notification;
552
+ const canArchive = !notification.archivedAt && onArchive;
553
+ const rowClassName = cn("h-auto w-full min-w-0 justify-start rounded-none px-3 py-4 text-start [overflow-wrap:anywhere] whitespace-normal", canArchive && "pe-14");
554
+ const actionClassName = cn(rowClassName, "focus-visible:inset-ring-ring/50 focus-visible:ring-0 focus-visible:inset-ring-3 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:-outline-offset-2 forced-colors:focus-visible:outline-solid");
560
555
  const content = renderItem?.(notification) ?? /* @__PURE__ */ jsxs2("span", {
561
556
  className: "flex min-w-0 flex-1 flex-col gap-1",
562
557
  children: [
@@ -584,23 +579,35 @@ function NotificationListItem({
584
579
  ]
585
580
  });
586
581
  return /* @__PURE__ */ jsxs2("div", {
587
- className: cn("group relative min-w-0", unread && "bg-muted/70"),
582
+ className: cn("relative flex min-w-0", unread && "bg-muted/70"),
588
583
  "data-unread": unread || undefined,
589
584
  children: [
590
- /* @__PURE__ */ jsx7(Button, {
591
- className: cn("h-auto w-full min-w-0 cursor-pointer justify-start rounded-none border-0 border-b border-border px-3 py-4 pr-[calc(0.75rem+var(--notification-scrollbar-gutter,0px))] text-left [overflow-wrap:anywhere] whitespace-normal group-last:border-b-0", !notification.archivedAt && onArchive && "pr-[calc(3.5rem+var(--notification-scrollbar-gutter,0px))]"),
592
- onClick: selectNotification,
585
+ href ? /* @__PURE__ */ jsx7("a", {
586
+ className: cn(buttonVariants({ variant: "ghost" }), actionClassName),
587
+ href,
588
+ onClick: (event) => {
589
+ if (!onNavigate || event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
590
+ return;
591
+ }
592
+ event.preventDefault();
593
+ onNavigate(notification);
594
+ },
595
+ children: content
596
+ }) : onNavigate ? /* @__PURE__ */ jsx7(Button, {
597
+ className: actionClassName,
598
+ onClick: () => onNavigate(notification),
593
599
  type: "button",
594
600
  variant: "ghost",
595
601
  children: content
602
+ }) : /* @__PURE__ */ jsx7("div", {
603
+ className: cn(rowClassName, "flex items-center text-sm font-medium"),
604
+ children: content
596
605
  }),
597
- !notification.archivedAt && onArchive ? /* @__PURE__ */ jsx7("div", {
598
- className: "absolute top-3 right-[calc(0.5rem+var(--notification-scrollbar-gutter,0px))]",
599
- children: /* @__PURE__ */ jsx7(ArchiveButton, {
600
- label: labels.archiveItem(notificationTitle(notification)),
601
- notificationIds: [notification.id],
602
- onArchive
603
- })
606
+ canArchive ? /* @__PURE__ */ jsx7(ArchiveButton, {
607
+ className: "absolute end-2 top-2",
608
+ label: labels.archiveItem(notificationTitle(notification)),
609
+ notificationIds: [notification.id],
610
+ onArchive: canArchive
604
611
  }) : null
605
612
  ]
606
613
  });
@@ -651,7 +658,7 @@ function ArchiveButton({
651
658
  className,
652
659
  disabled: pending,
653
660
  onClick: () => void archiveNotifications(),
654
- size: showLabel ? "sm" : "icon-sm",
661
+ size: showLabel ? "default" : "icon",
655
662
  title: label,
656
663
  type: "button",
657
664
  variant: showLabel ? "outline" : "ghost",
@@ -504,7 +504,7 @@ function NotificationMenu({
504
504
  className: "flex shrink-0 flex-col gap-2 border-b p-2",
505
505
  children: [
506
506
  /* @__PURE__ */ jsxs2(TabsList, {
507
- className: "grid w-full min-w-0 grid-cols-2",
507
+ className: "w-full min-w-0 gap-2",
508
508
  children: [
509
509
  /* @__PURE__ */ jsxs2(TabsTrigger, {
510
510
  className: "min-w-0",
@@ -618,9 +618,9 @@ function NotificationList({
618
618
  });
619
619
  }
620
620
  return /* @__PURE__ */ jsx7(ScrollArea, {
621
- className: "flex max-h-[min(24rem,60svh)] min-h-0 min-w-0 flex-auto flex-col overflow-hidden [&>[data-slot=scroll-area-viewport]]:h-auto [&>[data-slot=scroll-area-viewport]]:min-h-0 [&>[data-slot=scroll-area-viewport][data-has-overflow-y]]:[--notification-scrollbar-gutter:0.375rem]",
621
+ className: "flex max-h-[min(24rem,60svh)] min-h-0 min-w-0 flex-auto flex-col overflow-hidden [&>[data-slot=scroll-area-viewport]]:h-auto [&>[data-slot=scroll-area-viewport]]:min-h-0 [&>[data-slot=scroll-area-viewport][data-has-overflow-y]]:[--notification-scrollbar-gutter:--spacing(2.5)]",
622
622
  children: /* @__PURE__ */ jsx7("div", {
623
- className: "flex min-w-0 flex-col",
623
+ className: "divide-border flex min-w-0 flex-col divide-y pe-[var(--notification-scrollbar-gutter,0px)]",
624
624
  children: notifications.map((notification) => /* @__PURE__ */ jsx7(NotificationListItem, {
625
625
  labels,
626
626
  locale,
@@ -641,15 +641,10 @@ function NotificationListItem({
641
641
  renderItem
642
642
  }) {
643
643
  const unread = !notification.readAt && !notification.archivedAt;
644
- const selectNotification = () => {
645
- if (onNavigate) {
646
- onNavigate(notification);
647
- return;
648
- }
649
- if (notification.href && globalThis.window) {
650
- window.location.assign(notification.href);
651
- }
652
- };
644
+ const { href } = notification;
645
+ const canArchive = !notification.archivedAt && onArchive;
646
+ const rowClassName = cn("h-auto w-full min-w-0 justify-start rounded-none px-3 py-4 text-start [overflow-wrap:anywhere] whitespace-normal", canArchive && "pe-14");
647
+ const actionClassName = cn(rowClassName, "focus-visible:inset-ring-ring/50 focus-visible:ring-0 focus-visible:inset-ring-3 forced-colors:focus-visible:outline-2 forced-colors:focus-visible:-outline-offset-2 forced-colors:focus-visible:outline-solid");
653
648
  const content = renderItem?.(notification) ?? /* @__PURE__ */ jsxs2("span", {
654
649
  className: "flex min-w-0 flex-1 flex-col gap-1",
655
650
  children: [
@@ -677,23 +672,35 @@ function NotificationListItem({
677
672
  ]
678
673
  });
679
674
  return /* @__PURE__ */ jsxs2("div", {
680
- className: cn("group relative min-w-0", unread && "bg-muted/70"),
675
+ className: cn("relative flex min-w-0", unread && "bg-muted/70"),
681
676
  "data-unread": unread || undefined,
682
677
  children: [
683
- /* @__PURE__ */ jsx7(Button, {
684
- className: cn("h-auto w-full min-w-0 cursor-pointer justify-start rounded-none border-0 border-b border-border px-3 py-4 pr-[calc(0.75rem+var(--notification-scrollbar-gutter,0px))] text-left [overflow-wrap:anywhere] whitespace-normal group-last:border-b-0", !notification.archivedAt && onArchive && "pr-[calc(3.5rem+var(--notification-scrollbar-gutter,0px))]"),
685
- onClick: selectNotification,
678
+ href ? /* @__PURE__ */ jsx7("a", {
679
+ className: cn(buttonVariants({ variant: "ghost" }), actionClassName),
680
+ href,
681
+ onClick: (event) => {
682
+ if (!onNavigate || event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
683
+ return;
684
+ }
685
+ event.preventDefault();
686
+ onNavigate(notification);
687
+ },
688
+ children: content
689
+ }) : onNavigate ? /* @__PURE__ */ jsx7(Button, {
690
+ className: actionClassName,
691
+ onClick: () => onNavigate(notification),
686
692
  type: "button",
687
693
  variant: "ghost",
688
694
  children: content
695
+ }) : /* @__PURE__ */ jsx7("div", {
696
+ className: cn(rowClassName, "flex items-center text-sm font-medium"),
697
+ children: content
689
698
  }),
690
- !notification.archivedAt && onArchive ? /* @__PURE__ */ jsx7("div", {
691
- className: "absolute top-3 right-[calc(0.5rem+var(--notification-scrollbar-gutter,0px))]",
692
- children: /* @__PURE__ */ jsx7(ArchiveButton, {
693
- label: labels.archiveItem(notificationTitle(notification)),
694
- notificationIds: [notification.id],
695
- onArchive
696
- })
699
+ canArchive ? /* @__PURE__ */ jsx7(ArchiveButton, {
700
+ className: "absolute end-2 top-2",
701
+ label: labels.archiveItem(notificationTitle(notification)),
702
+ notificationIds: [notification.id],
703
+ onArchive: canArchive
697
704
  }) : null
698
705
  ]
699
706
  });
@@ -744,7 +751,7 @@ function ArchiveButton({
744
751
  className,
745
752
  disabled: pending,
746
753
  onClick: () => void archiveNotifications(),
747
- size: showLabel ? "sm" : "icon-sm",
754
+ size: showLabel ? "default" : "icon",
748
755
  title: label,
749
756
  type: "button",
750
757
  variant: showLabel ? "outline" : "ghost",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.10.13",
3
+ "version": "0.10.14",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {