@krak-stack/registry 0.7.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.
@@ -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/skeleton.tsx
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__ */ jsx5("div", {
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 jsx6 } from "react/jsx-runtime";
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__ */ jsx6(TabsPrimitive.Root, {
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__ */ jsx6(TabsPrimitive.List, {
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__ */ jsx6(TabsPrimitive.Tab, {
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 jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
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__ */ jsx7(PopoverTrigger, {
498
+ renderTrigger ? /* @__PURE__ */ jsx8(PopoverTrigger, {
483
499
  render: renderTrigger(triggerState)
484
- }) : /* @__PURE__ */ jsx7(NotificationMenuTrigger, {
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__ */ jsx7(PopoverHeader, {
493
- className: "border-b px-4 py-3",
494
- children: /* @__PURE__ */ jsx7(PopoverTitle, {
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 items-center gap-2 border-b p-2",
520
+ className: "flex shrink-0 flex-col gap-2 border-b p-2",
505
521
  children: [
506
522
  /* @__PURE__ */ jsxs2(TabsList, {
507
- className: "grid flex-1 grid-cols-2",
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__ */ jsx7(Inbox, {
529
+ /* @__PURE__ */ jsx8(Inbox, {
513
530
  "data-icon": "inline-start"
514
531
  }),
515
- labels.inbox,
516
- inbox.length > 0 ? /* @__PURE__ */ jsx7(Badge, {
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__ */ jsx7(ArchiveRestore, {
547
+ /* @__PURE__ */ jsx8(ArchiveRestore, {
526
548
  "data-icon": "inline-start"
527
549
  }),
528
- labels.archived
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__ */ jsx7(ArchiveButton, {
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__ */ jsx7(NotificationList, {
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 rounded-full"),
595
+ className: cn(buttonVariants({ variant: "outline", size: "icon" }), "relative"),
569
596
  type: "button",
570
597
  children: [
571
- /* @__PURE__ */ jsx7(Bell, {}),
572
- unreadCount > 0 ? /* @__PURE__ */ jsx7(Badge, {
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__ */ jsx7(NotificationListLoading, {
619
+ return /* @__PURE__ */ jsx8(NotificationListLoading, {
593
620
  label: labels.loading
594
621
  });
595
622
  if (error) {
596
- return /* @__PURE__ */ jsx7(NotificationEmpty, {
623
+ return /* @__PURE__ */ jsx8(NotificationEmpty, {
597
624
  description: labels.errorDescription,
598
- icon: /* @__PURE__ */ jsx7(TriangleAlert, {}),
625
+ icon: /* @__PURE__ */ jsx8(TriangleAlert, {}),
599
626
  title: labels.errorTitle
600
627
  });
601
628
  }
602
629
  if (notifications.length === 0) {
603
- return /* @__PURE__ */ jsx7(NotificationEmpty, {
630
+ return /* @__PURE__ */ jsx8(NotificationEmpty, {
604
631
  description: tab === "inbox" ? labels.emptyInboxDescription : labels.emptyArchiveDescription,
605
- icon: tab === "inbox" ? /* @__PURE__ */ jsx7(BellDot, {}) : /* @__PURE__ */ jsx7(Archive, {}),
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__ */ jsx7(ScrollArea, {
610
- className: "h-[min(24rem,60svh)]",
611
- children: /* @__PURE__ */ jsx7("div", {
612
- className: "flex flex-col gap-1 p-2",
613
- children: notifications.map((notification) => /* @__PURE__ */ jsx7(NotificationListItem, {
614
- labels,
615
- locale,
616
- notification,
617
- onArchive,
618
- onNavigate,
619
- renderItem
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 flex min-w-0 items-start gap-1 rounded-lg", unread && "bg-muted/70"),
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__ */ jsx7(Button, {
647
- className: "h-auto min-w-0 flex-1 justify-start px-3 py-2.5 text-left whitespace-normal",
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: renderItem?.(notification) ?? /* @__PURE__ */ jsxs2("span", {
653
- className: "flex min-w-0 flex-1 flex-col gap-1",
654
- children: [
655
- /* @__PURE__ */ jsxs2("span", {
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__ */ jsx7(ArchiveButton, {
680
- className: "mt-2 mr-2 shrink-0",
681
- label: labels.archiveItem(notificationTitle(notification)),
682
- notificationIds: [notification.id],
683
- onArchive
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__ */ jsx7(Empty, {
730
+ return /* @__PURE__ */ jsx8(Empty, {
694
731
  className: "min-h-48 p-6",
695
732
  children: /* @__PURE__ */ jsxs2(EmptyHeader, {
696
733
  children: [
697
- /* @__PURE__ */ jsx7(EmptyMedia, {
734
+ /* @__PURE__ */ jsx8(EmptyMedia, {
698
735
  variant: "icon",
699
736
  children: icon
700
737
  }),
701
- /* @__PURE__ */ jsx7(EmptyTitle, {
702
- className: "text-base",
738
+ /* @__PURE__ */ jsx8(EmptyTitle, {
739
+ className: "text-sm",
703
740
  children: title
704
741
  }),
705
- /* @__PURE__ */ jsx7(EmptyDescription, {
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__ */ jsx7(Button, {
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: /* @__PURE__ */ jsx7(Archive, {})
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__ */ jsx7("div", {
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__ */ jsx7(Skeleton, {
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__ */ jsx7(Skeleton, {
797
+ /* @__PURE__ */ jsx8(Skeleton, {
754
798
  className: "h-4 w-4/5"
755
799
  }),
756
- /* @__PURE__ */ jsx7(Skeleton, {
800
+ /* @__PURE__ */ jsx8(Skeleton, {
757
801
  className: "h-3 w-2/5"
758
802
  })
759
803
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,6 +17,14 @@
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
19
  "exports": {
20
+ "./cron-expression-editor": {
21
+ "types": "./dist/components/ui/cron-expression-editor.d.ts",
22
+ "import": "./dist/components/ui/cron-expression-editor.js"
23
+ },
24
+ "./phone-number-input": {
25
+ "types": "./dist/components/ui/phone-number-input.d.ts",
26
+ "import": "./dist/components/ui/phone-number-input.js"
27
+ },
20
28
  "./image-crop-editor": {
21
29
  "types": "./dist/components/ui/image-crop-editor.d.ts",
22
30
  "import": "./dist/components/ui/image-crop-editor.js"
@@ -370,6 +378,8 @@
370
378
  "dependencies": {
371
379
  "@oxlint/plugins": "1.78.0",
372
380
  "bowser": "^2.14.1",
381
+ "cron-parser": "^5.10.4",
382
+ "libphonenumber-js": "^1.13.16",
373
383
  "motion": "^14.12.0",
374
384
  "react-colorful": "^5.8.1",
375
385
  "web-vitals": "^5.1.0"