@bison-lab/ui 0.12.1 → 0.13.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.
package/dist/index.mjs CHANGED
@@ -5,7 +5,15 @@ import { defaultFontWeights, densityPresets, deriveDarkPalette, deriveLightPalet
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Accordion as Accordion$1, AlertDialog as AlertDialog$1, AspectRatio as AspectRatio$1, Avatar as Avatar$1, Checkbox as Checkbox$1, Collapsible as Collapsible$1, ContextMenu as ContextMenu$1, Dialog as Dialog$1, DropdownMenu as DropdownMenu$1, Label as Label$1, NavigationMenu as NavigationMenu$1, Popover as Popover$1, Progress as Progress$1, RadioGroup as RadioGroup$1, ScrollArea as ScrollArea$1, Select as Select$1, Separator as Separator$1, Slider as Slider$1, Slot, Switch as Switch$1, Tabs as Tabs$1, Tooltip as Tooltip$1, unstable_PasswordToggleField } from "radix-ui";
7
7
  import { cva } from "class-variance-authority";
8
- import { ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Camera, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, Circle, Eye, EyeOff, FileQuestion, ImageIcon, Inbox, Loader2, LogOut, Mail, Menu, MoreHorizontal, PanelLeftIcon, Plus, Search, ServerCrash, SlidersHorizontal, Wrench, X } from "lucide-react";
8
+ import { AlignCenter, AlignLeft, AlignRight, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, ArrowUpDown, Bold, CalendarIcon, Camera, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, ChevronsLeft, ChevronsRight, ChevronsUpDown, Circle, Code, Eye, EyeOff, FileQuestion, Heading1, Heading2, Heading3, ImageIcon, Inbox, Italic, Link, Link2Off, List, ListOrdered, Loader2, LogOut, Mail, Menu, Minus, MoreHorizontal, PanelLeftIcon, Plus, Quote, Redo, Search, ServerCrash, SlidersHorizontal, Strikethrough, Underline, Undo, Wrench, X } from "lucide-react";
9
+ import { DayPicker } from "react-day-picker";
10
+ import { endOfMonth, endOfWeek, format, startOfMonth, startOfWeek, startOfYear, subDays, subMonths, subYears } from "date-fns";
11
+ import { EditorContent, useEditor } from "@tiptap/react";
12
+ import StarterKit from "@tiptap/starter-kit";
13
+ import Placeholder from "@tiptap/extension-placeholder";
14
+ import Link$1 from "@tiptap/extension-link";
15
+ import Underline$1 from "@tiptap/extension-underline";
16
+ import TextAlign from "@tiptap/extension-text-align";
9
17
  import { Toaster as Toaster$1, toast } from "sonner";
10
18
  import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
11
19
  import { Command as Command$1 } from "cmdk";
@@ -526,6 +534,505 @@ const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @_
526
534
  }));
527
535
  SelectSeparator.displayName = Select$1.Separator.displayName;
528
536
  //#endregion
537
+ //#region src/components/calendar.tsx
538
+ const Calendar = ({ className, classNames, showOutsideDays = true, ...props }) => {
539
+ return /* @__PURE__ */ jsx(DayPicker, {
540
+ showOutsideDays,
541
+ className: cn("p-3", className),
542
+ classNames: {
543
+ months: "flex flex-col sm:flex-row gap-2",
544
+ month: "flex flex-col gap-4",
545
+ month_caption: "flex justify-center pt-1 relative items-center w-full",
546
+ caption_label: "text-sm font-medium",
547
+ nav: "flex items-center gap-1",
548
+ button_previous: "absolute left-1 inline-flex items-center justify-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 border border-input rounded-md z-10",
549
+ button_next: "absolute right-1 inline-flex items-center justify-center h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 border border-input rounded-md z-10",
550
+ month_grid: "w-full border-collapse space-x-1",
551
+ weekdays: "flex",
552
+ weekday: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
553
+ week: "flex w-full mt-2",
554
+ day: cn("relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50", props.mode === "range" ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md" : "[&:has([aria-selected])]:rounded-md"),
555
+ day_button: cn("inline-flex items-center justify-center h-9 w-9 p-0 font-normal aria-selected:opacity-100 rounded-md", "hover:bg-accent hover:text-accent-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),
556
+ range_start: "day-range-start rounded-l-md",
557
+ range_end: "day-range-end rounded-r-md",
558
+ selected: "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
559
+ today: "bg-accent text-accent-foreground",
560
+ outside: "day-outside text-muted-foreground aria-selected:text-muted-foreground opacity-50 aria-selected:opacity-30",
561
+ disabled: "text-muted-foreground opacity-50",
562
+ range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
563
+ hidden: "invisible",
564
+ ...classNames
565
+ },
566
+ components: { Chevron: ({ orientation }) => {
567
+ return /* @__PURE__ */ jsx(orientation === "left" ? ChevronLeft : ChevronRight, { className: "h-4 w-4" });
568
+ } },
569
+ ...props
570
+ });
571
+ };
572
+ Calendar.displayName = "Calendar";
573
+ //#endregion
574
+ //#region src/components/popover.tsx
575
+ const Popover = Popover$1.Root;
576
+ const PopoverTrigger = Popover$1.Trigger;
577
+ const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Content, {
578
+ ref,
579
+ align,
580
+ sideOffset,
581
+ className: cn("z-[var(--z-popover)] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
582
+ ...props
583
+ }) }));
584
+ PopoverContent.displayName = Popover$1.Content.displayName;
585
+ //#endregion
586
+ //#region src/components/date-picker.tsx
587
+ const DatePicker = React.forwardRef(({ value, onChange, placeholder = "Pick a date", dateFormat = "PPP", disabled = false, className, fromDate, toDate, disabledDates }, ref) => {
588
+ const [open, setOpen] = React.useState(false);
589
+ const handleSelect = (date) => {
590
+ onChange?.(date);
591
+ setOpen(false);
592
+ };
593
+ return /* @__PURE__ */ jsxs(Popover, {
594
+ open,
595
+ onOpenChange: setOpen,
596
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
597
+ asChild: true,
598
+ children: /* @__PURE__ */ jsxs(Button, {
599
+ ref,
600
+ variant: "outline",
601
+ disabled,
602
+ className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground", className),
603
+ children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }), value ? format(value, dateFormat) : /* @__PURE__ */ jsx("span", { children: placeholder })]
604
+ })
605
+ }), /* @__PURE__ */ jsx(PopoverContent, {
606
+ className: "w-auto p-0",
607
+ align: "start",
608
+ children: /* @__PURE__ */ jsx(Calendar, {
609
+ mode: "single",
610
+ selected: value,
611
+ onSelect: handleSelect,
612
+ disabled: disabledDates ? disabledDates : void 0,
613
+ startMonth: fromDate,
614
+ endMonth: toDate,
615
+ autoFocus: true
616
+ })
617
+ })]
618
+ });
619
+ });
620
+ DatePicker.displayName = "DatePicker";
621
+ //#endregion
622
+ //#region src/components/date-range-picker.tsx
623
+ /** Built-in preset range generators */
624
+ const dateRangePresets = {
625
+ today: () => ({
626
+ label: "Today",
627
+ range: () => {
628
+ const today = /* @__PURE__ */ new Date();
629
+ return {
630
+ from: today,
631
+ to: today
632
+ };
633
+ }
634
+ }),
635
+ yesterday: () => ({
636
+ label: "Yesterday",
637
+ range: () => {
638
+ const yesterday = subDays(/* @__PURE__ */ new Date(), 1);
639
+ return {
640
+ from: yesterday,
641
+ to: yesterday
642
+ };
643
+ }
644
+ }),
645
+ last7Days: () => ({
646
+ label: "Last 7 days",
647
+ range: () => ({
648
+ from: subDays(/* @__PURE__ */ new Date(), 6),
649
+ to: /* @__PURE__ */ new Date()
650
+ })
651
+ }),
652
+ last14Days: () => ({
653
+ label: "Last 14 days",
654
+ range: () => ({
655
+ from: subDays(/* @__PURE__ */ new Date(), 13),
656
+ to: /* @__PURE__ */ new Date()
657
+ })
658
+ }),
659
+ last30Days: () => ({
660
+ label: "Last 30 days",
661
+ range: () => ({
662
+ from: subDays(/* @__PURE__ */ new Date(), 29),
663
+ to: /* @__PURE__ */ new Date()
664
+ })
665
+ }),
666
+ last90Days: () => ({
667
+ label: "Last 90 days",
668
+ range: () => ({
669
+ from: subDays(/* @__PURE__ */ new Date(), 89),
670
+ to: /* @__PURE__ */ new Date()
671
+ })
672
+ }),
673
+ thisWeek: () => ({
674
+ label: "This week",
675
+ range: () => ({
676
+ from: startOfWeek(/* @__PURE__ */ new Date()),
677
+ to: endOfWeek(/* @__PURE__ */ new Date())
678
+ })
679
+ }),
680
+ lastWeek: () => ({
681
+ label: "Last week",
682
+ range: () => {
683
+ const lastWeek = subDays(/* @__PURE__ */ new Date(), 7);
684
+ return {
685
+ from: startOfWeek(lastWeek),
686
+ to: endOfWeek(lastWeek)
687
+ };
688
+ }
689
+ }),
690
+ thisMonth: () => ({
691
+ label: "This month",
692
+ range: () => ({
693
+ from: startOfMonth(/* @__PURE__ */ new Date()),
694
+ to: endOfMonth(/* @__PURE__ */ new Date())
695
+ })
696
+ }),
697
+ lastMonth: () => ({
698
+ label: "Last month",
699
+ range: () => {
700
+ const lastMonth = subMonths(/* @__PURE__ */ new Date(), 1);
701
+ return {
702
+ from: startOfMonth(lastMonth),
703
+ to: endOfMonth(lastMonth)
704
+ };
705
+ }
706
+ }),
707
+ thisYear: () => ({
708
+ label: "This year",
709
+ range: () => ({
710
+ from: startOfYear(/* @__PURE__ */ new Date()),
711
+ to: /* @__PURE__ */ new Date()
712
+ })
713
+ }),
714
+ lastYear: () => ({
715
+ label: "Last year",
716
+ range: () => {
717
+ return {
718
+ from: startOfYear(subYears(/* @__PURE__ */ new Date(), 1)),
719
+ to: /* @__PURE__ */ new Date()
720
+ };
721
+ }
722
+ })
723
+ };
724
+ const DateRangePicker = React.forwardRef(({ value, onChange, placeholder = "Pick a date range", dateFormat = "LLL dd, y", disabled = false, className, presets, numberOfMonths = 2, fromDate, toDate }, ref) => {
725
+ const [open, setOpen] = React.useState(false);
726
+ const handlePresetClick = (preset) => {
727
+ const range = preset.range();
728
+ onChange?.(range);
729
+ };
730
+ return /* @__PURE__ */ jsxs(Popover, {
731
+ open,
732
+ onOpenChange: setOpen,
733
+ children: [/* @__PURE__ */ jsx(PopoverTrigger, {
734
+ asChild: true,
735
+ children: /* @__PURE__ */ jsxs(Button, {
736
+ ref,
737
+ variant: "outline",
738
+ disabled,
739
+ className: cn("w-full justify-start text-left font-normal", !value && "text-muted-foreground", className),
740
+ children: [/* @__PURE__ */ jsx(CalendarIcon, { className: "mr-2 h-4 w-4" }), value?.from ? value.to ? /* @__PURE__ */ jsxs(Fragment, { children: [
741
+ format(value.from, dateFormat),
742
+ " – ",
743
+ format(value.to, dateFormat)
744
+ ] }) : format(value.from, dateFormat) : /* @__PURE__ */ jsx("span", { children: placeholder })]
745
+ })
746
+ }), /* @__PURE__ */ jsx(PopoverContent, {
747
+ className: "w-auto p-0",
748
+ align: "start",
749
+ children: /* @__PURE__ */ jsxs("div", {
750
+ className: cn("flex", presets && presets.length > 0 && "flex-row"),
751
+ children: [presets && presets.length > 0 && /* @__PURE__ */ jsxs("div", {
752
+ className: "flex flex-col gap-1 border-r p-3 min-w-[160px]",
753
+ children: [/* @__PURE__ */ jsx("p", {
754
+ className: "mb-1 text-xs font-medium text-muted-foreground",
755
+ children: "Quick select"
756
+ }), presets.map((preset) => /* @__PURE__ */ jsx(Button, {
757
+ variant: "ghost",
758
+ size: "sm",
759
+ className: "justify-start text-left text-sm font-normal",
760
+ onClick: () => handlePresetClick(preset),
761
+ children: preset.label
762
+ }, preset.label))]
763
+ }), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Calendar, {
764
+ mode: "range",
765
+ defaultMonth: value?.from,
766
+ selected: value,
767
+ onSelect: onChange,
768
+ numberOfMonths,
769
+ startMonth: fromDate,
770
+ endMonth: toDate,
771
+ autoFocus: true
772
+ }) })]
773
+ })
774
+ })]
775
+ });
776
+ });
777
+ DateRangePicker.displayName = "DateRangePicker";
778
+ //#endregion
779
+ //#region src/components/separator.tsx
780
+ const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(Separator$1.Root, {
781
+ ref,
782
+ decorative,
783
+ orientation,
784
+ className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className),
785
+ ...props
786
+ }));
787
+ Separator.displayName = Separator$1.Root.displayName;
788
+ //#endregion
789
+ //#region src/components/tooltip.tsx
790
+ const TooltipProvider = Tooltip$1.Provider;
791
+ const Tooltip = Tooltip$1.Root;
792
+ const TooltipTrigger = Tooltip$1.Trigger;
793
+ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Tooltip$1.Content, {
794
+ ref,
795
+ sideOffset,
796
+ className: cn("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
797
+ ...props
798
+ }));
799
+ TooltipContent.displayName = Tooltip$1.Content.displayName;
800
+ //#endregion
801
+ //#region src/components/text-editor.tsx
802
+ const ToolbarButton = ({ onClick, isActive, disabled, tooltip, children }) => /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
803
+ asChild: true,
804
+ children: /* @__PURE__ */ jsx(Button, {
805
+ type: "button",
806
+ variant: "ghost",
807
+ size: "sm",
808
+ disabled,
809
+ className: cn("h-8 w-8 p-0", isActive && "bg-accent text-accent-foreground"),
810
+ onClick,
811
+ children
812
+ })
813
+ }), /* @__PURE__ */ jsx(TooltipContent, {
814
+ side: "bottom",
815
+ children: /* @__PURE__ */ jsx("p", {
816
+ className: "text-xs",
817
+ children: tooltip
818
+ })
819
+ })] });
820
+ const defaultToolbar = [
821
+ "bold",
822
+ "italic",
823
+ "underline",
824
+ "strike",
825
+ "code",
826
+ "heading",
827
+ "bulletList",
828
+ "orderedList",
829
+ "blockquote",
830
+ "horizontalRule",
831
+ "link",
832
+ "align",
833
+ "undo",
834
+ "redo"
835
+ ];
836
+ const EditorToolbar = ({ editor, toolbar = defaultToolbar }) => {
837
+ const has = (feature) => toolbar?.includes(feature) ?? false;
838
+ const handleLink = () => {
839
+ if (editor.isActive("link")) {
840
+ editor.chain().focus().unsetLink().run();
841
+ return;
842
+ }
843
+ const url = window.prompt("Enter URL:");
844
+ if (url) editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
845
+ };
846
+ return /* @__PURE__ */ jsx(TooltipProvider, {
847
+ delayDuration: 300,
848
+ children: /* @__PURE__ */ jsxs("div", {
849
+ className: "flex flex-wrap items-center gap-0.5 border-b px-2 py-1",
850
+ children: [
851
+ has("bold") && /* @__PURE__ */ jsx(ToolbarButton, {
852
+ onClick: () => editor.chain().focus().toggleBold().run(),
853
+ isActive: editor.isActive("bold"),
854
+ tooltip: "Bold",
855
+ children: /* @__PURE__ */ jsx(Bold, { className: "h-4 w-4" })
856
+ }),
857
+ has("italic") && /* @__PURE__ */ jsx(ToolbarButton, {
858
+ onClick: () => editor.chain().focus().toggleItalic().run(),
859
+ isActive: editor.isActive("italic"),
860
+ tooltip: "Italic",
861
+ children: /* @__PURE__ */ jsx(Italic, { className: "h-4 w-4" })
862
+ }),
863
+ has("underline") && /* @__PURE__ */ jsx(ToolbarButton, {
864
+ onClick: () => editor.chain().focus().toggleUnderline().run(),
865
+ isActive: editor.isActive("underline"),
866
+ tooltip: "Underline",
867
+ children: /* @__PURE__ */ jsx(Underline, { className: "h-4 w-4" })
868
+ }),
869
+ has("strike") && /* @__PURE__ */ jsx(ToolbarButton, {
870
+ onClick: () => editor.chain().focus().toggleStrike().run(),
871
+ isActive: editor.isActive("strike"),
872
+ tooltip: "Strikethrough",
873
+ children: /* @__PURE__ */ jsx(Strikethrough, { className: "h-4 w-4" })
874
+ }),
875
+ has("code") && /* @__PURE__ */ jsx(ToolbarButton, {
876
+ onClick: () => editor.chain().focus().toggleCode().run(),
877
+ isActive: editor.isActive("code"),
878
+ tooltip: "Code",
879
+ children: /* @__PURE__ */ jsx(Code, { className: "h-4 w-4" })
880
+ }),
881
+ (has("bold") || has("italic") || has("underline") || has("strike") || has("code")) && (has("heading") || has("bulletList") || has("orderedList") || has("blockquote")) && /* @__PURE__ */ jsx(Separator, {
882
+ orientation: "vertical",
883
+ className: "mx-1 h-6"
884
+ }),
885
+ has("heading") && /* @__PURE__ */ jsxs(Fragment, { children: [
886
+ /* @__PURE__ */ jsx(ToolbarButton, {
887
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
888
+ isActive: editor.isActive("heading", { level: 1 }),
889
+ tooltip: "Heading 1",
890
+ children: /* @__PURE__ */ jsx(Heading1, { className: "h-4 w-4" })
891
+ }),
892
+ /* @__PURE__ */ jsx(ToolbarButton, {
893
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
894
+ isActive: editor.isActive("heading", { level: 2 }),
895
+ tooltip: "Heading 2",
896
+ children: /* @__PURE__ */ jsx(Heading2, { className: "h-4 w-4" })
897
+ }),
898
+ /* @__PURE__ */ jsx(ToolbarButton, {
899
+ onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
900
+ isActive: editor.isActive("heading", { level: 3 }),
901
+ tooltip: "Heading 3",
902
+ children: /* @__PURE__ */ jsx(Heading3, { className: "h-4 w-4" })
903
+ })
904
+ ] }),
905
+ has("bulletList") && /* @__PURE__ */ jsx(ToolbarButton, {
906
+ onClick: () => editor.chain().focus().toggleBulletList().run(),
907
+ isActive: editor.isActive("bulletList"),
908
+ tooltip: "Bullet list",
909
+ children: /* @__PURE__ */ jsx(List, { className: "h-4 w-4" })
910
+ }),
911
+ has("orderedList") && /* @__PURE__ */ jsx(ToolbarButton, {
912
+ onClick: () => editor.chain().focus().toggleOrderedList().run(),
913
+ isActive: editor.isActive("orderedList"),
914
+ tooltip: "Ordered list",
915
+ children: /* @__PURE__ */ jsx(ListOrdered, { className: "h-4 w-4" })
916
+ }),
917
+ has("blockquote") && /* @__PURE__ */ jsx(ToolbarButton, {
918
+ onClick: () => editor.chain().focus().toggleBlockquote().run(),
919
+ isActive: editor.isActive("blockquote"),
920
+ tooltip: "Blockquote",
921
+ children: /* @__PURE__ */ jsx(Quote, { className: "h-4 w-4" })
922
+ }),
923
+ has("horizontalRule") && /* @__PURE__ */ jsx(ToolbarButton, {
924
+ onClick: () => editor.chain().focus().setHorizontalRule().run(),
925
+ tooltip: "Horizontal rule",
926
+ children: /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4" })
927
+ }),
928
+ (has("heading") || has("bulletList") || has("orderedList") || has("blockquote")) && (has("link") || has("align")) && /* @__PURE__ */ jsx(Separator, {
929
+ orientation: "vertical",
930
+ className: "mx-1 h-6"
931
+ }),
932
+ has("link") && /* @__PURE__ */ jsx(ToolbarButton, {
933
+ onClick: handleLink,
934
+ isActive: editor.isActive("link"),
935
+ tooltip: editor.isActive("link") ? "Remove link" : "Add link",
936
+ children: editor.isActive("link") ? /* @__PURE__ */ jsx(Link2Off, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Link, { className: "h-4 w-4" })
937
+ }),
938
+ has("align") && /* @__PURE__ */ jsxs(Fragment, { children: [
939
+ /* @__PURE__ */ jsx(ToolbarButton, {
940
+ onClick: () => editor.chain().focus().setTextAlign("left").run(),
941
+ isActive: editor.isActive({ textAlign: "left" }),
942
+ tooltip: "Align left",
943
+ children: /* @__PURE__ */ jsx(AlignLeft, { className: "h-4 w-4" })
944
+ }),
945
+ /* @__PURE__ */ jsx(ToolbarButton, {
946
+ onClick: () => editor.chain().focus().setTextAlign("center").run(),
947
+ isActive: editor.isActive({ textAlign: "center" }),
948
+ tooltip: "Align center",
949
+ children: /* @__PURE__ */ jsx(AlignCenter, { className: "h-4 w-4" })
950
+ }),
951
+ /* @__PURE__ */ jsx(ToolbarButton, {
952
+ onClick: () => editor.chain().focus().setTextAlign("right").run(),
953
+ isActive: editor.isActive({ textAlign: "right" }),
954
+ tooltip: "Align right",
955
+ children: /* @__PURE__ */ jsx(AlignRight, { className: "h-4 w-4" })
956
+ })
957
+ ] }),
958
+ (has("link") || has("align")) && (has("undo") || has("redo")) && /* @__PURE__ */ jsx(Separator, {
959
+ orientation: "vertical",
960
+ className: "mx-1 h-6"
961
+ }),
962
+ has("undo") && /* @__PURE__ */ jsx(ToolbarButton, {
963
+ onClick: () => editor.chain().focus().undo().run(),
964
+ disabled: !editor.can().undo(),
965
+ tooltip: "Undo",
966
+ children: /* @__PURE__ */ jsx(Undo, { className: "h-4 w-4" })
967
+ }),
968
+ has("redo") && /* @__PURE__ */ jsx(ToolbarButton, {
969
+ onClick: () => editor.chain().focus().redo().run(),
970
+ disabled: !editor.can().redo(),
971
+ tooltip: "Redo",
972
+ children: /* @__PURE__ */ jsx(Redo, { className: "h-4 w-4" })
973
+ })
974
+ ]
975
+ })
976
+ });
977
+ };
978
+ const TextEditor = React.forwardRef(({ value, onChange, placeholder = "Start writing...", disabled = false, className, contentClassName, minHeight = "150px", hideToolbar = false, toolbar = defaultToolbar, onEditorReady }, ref) => {
979
+ const editor = useEditor({
980
+ extensions: [
981
+ StarterKit.configure({ heading: { levels: [
982
+ 1,
983
+ 2,
984
+ 3
985
+ ] } }),
986
+ Placeholder.configure({ placeholder }),
987
+ Underline$1,
988
+ Link$1.configure({
989
+ openOnClick: false,
990
+ HTMLAttributes: { class: "text-primary underline underline-offset-4 cursor-pointer" }
991
+ }),
992
+ TextAlign.configure({ types: ["heading", "paragraph"] })
993
+ ],
994
+ content: value,
995
+ editable: !disabled,
996
+ onUpdate: ({ editor: e }) => {
997
+ onChange?.(e.getHTML());
998
+ },
999
+ onCreate: ({ editor: e }) => {
1000
+ onEditorReady?.(e);
1001
+ }
1002
+ });
1003
+ React.useEffect(() => {
1004
+ if (editor && disabled !== void 0) editor.setEditable(!disabled);
1005
+ }, [editor, disabled]);
1006
+ React.useEffect(() => {
1007
+ if (editor && value !== void 0 && editor.getHTML() !== value) editor.commands.setContent(value);
1008
+ }, [editor, value]);
1009
+ if (!editor) return null;
1010
+ return /* @__PURE__ */ jsxs("div", {
1011
+ ref,
1012
+ className: cn("rounded-md border border-input bg-background ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2", disabled && "cursor-not-allowed opacity-50", className),
1013
+ children: [!hideToolbar && /* @__PURE__ */ jsx(EditorToolbar, {
1014
+ editor,
1015
+ toolbar
1016
+ }), /* @__PURE__ */ jsx(EditorContent, {
1017
+ editor,
1018
+ className: cn("prose prose-sm dark:prose-invert max-w-none px-3 py-2 focus:outline-none [&_.tiptap]:outline-none [&_.tiptap.ProseMirror]:outline-none", `[&_.tiptap]:min-h-[${minHeight}]`, "[&_.tiptap_p.is-editor-empty:first-child::before]:text-muted-foreground [&_.tiptap_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_.tiptap_p.is-editor-empty:first-child::before]:float-left [&_.tiptap_p.is-editor-empty:first-child::before]:h-0 [&_.tiptap_p.is-editor-empty:first-child::before]:pointer-events-none", contentClassName),
1019
+ style: { minHeight }
1020
+ })]
1021
+ });
1022
+ });
1023
+ TextEditor.displayName = "TextEditor";
1024
+ //#endregion
1025
+ //#region src/components/text-content.tsx
1026
+ const TextContent = React.forwardRef(({ content, className, ...props }, ref) => {
1027
+ return /* @__PURE__ */ jsx("div", {
1028
+ ref,
1029
+ className: cn("prose prose-sm dark:prose-invert max-w-none", "prose-headings:font-heading prose-headings:tracking-tight", "prose-a:text-primary prose-a:underline prose-a:underline-offset-4", "prose-blockquote:border-l-primary", "prose-code:rounded prose-code:bg-muted prose-code:px-1.5 prose-code:py-0.5 prose-code:text-sm prose-code:font-mono", "prose-pre:bg-muted prose-pre:rounded-md", "prose-hr:border-border", className),
1030
+ dangerouslySetInnerHTML: { __html: content },
1031
+ ...props
1032
+ });
1033
+ });
1034
+ TextContent.displayName = "TextContent";
1035
+ //#endregion
529
1036
  //#region src/components/checkbox.tsx
530
1037
  const Checkbox = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(Checkbox$1.Root, {
531
1038
  ref,
@@ -662,16 +1169,6 @@ const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => /* @__
662
1169
  }));
663
1170
  AvatarFallback.displayName = Avatar$1.Fallback.displayName;
664
1171
  //#endregion
665
- //#region src/components/separator.tsx
666
- const Separator = React.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(Separator$1.Root, {
667
- ref,
668
- decorative,
669
- orientation,
670
- className: cn("shrink-0 bg-border", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className),
671
- ...props
672
- }));
673
- Separator.displayName = Separator$1.Root.displayName;
674
- //#endregion
675
1172
  //#region src/components/dialog.tsx
676
1173
  const Dialog = Dialog$1.Root;
677
1174
  const DialogTrigger = Dialog$1.Trigger;
@@ -822,18 +1319,6 @@ const SheetDescription = React.forwardRef(({ className, ...props }, ref) => /* @
822
1319
  }));
823
1320
  SheetDescription.displayName = Dialog$1.Description.displayName;
824
1321
  //#endregion
825
- //#region src/components/popover.tsx
826
- const Popover = Popover$1.Root;
827
- const PopoverTrigger = Popover$1.Trigger;
828
- const PopoverContent = React.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Popover$1.Portal, { children: /* @__PURE__ */ jsx(Popover$1.Content, {
829
- ref,
830
- align,
831
- sideOffset,
832
- className: cn("z-[var(--z-popover)] w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
833
- ...props
834
- }) }));
835
- PopoverContent.displayName = Popover$1.Content.displayName;
836
- //#endregion
837
1322
  //#region src/components/dropdown-menu.tsx
838
1323
  const DropdownMenu = DropdownMenu$1.Root;
839
1324
  const DropdownMenuTrigger = DropdownMenu$1.Trigger;
@@ -905,18 +1390,6 @@ const DropdownMenuShortcut = ({ className, ...props }) => /* @__PURE__ */ jsx("s
905
1390
  ...props
906
1391
  });
907
1392
  //#endregion
908
- //#region src/components/tooltip.tsx
909
- const TooltipProvider = Tooltip$1.Provider;
910
- const Tooltip = Tooltip$1.Root;
911
- const TooltipTrigger = Tooltip$1.Trigger;
912
- const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(Tooltip$1.Content, {
913
- ref,
914
- sideOffset,
915
- className: cn("z-[var(--z-tooltip)] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className),
916
- ...props
917
- }));
918
- TooltipContent.displayName = Tooltip$1.Content.displayName;
919
- //#endregion
920
1393
  //#region src/components/toast.tsx
921
1394
  function Toaster({ position = "bottom-right", richColors = true, closeButton = true, ...props }) {
922
1395
  return /* @__PURE__ */ jsx(Toaster$1, {
@@ -3525,6 +3998,6 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
3525
3998
  });
3526
3999
  }
3527
4000
  //#endregion
3528
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, MediaCard, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeScope, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, avatarVariants, badgeVariants, buttonVariants, cn, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
4001
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, MediaCard, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
3529
4002
 
3530
4003
  //# sourceMappingURL=index.mjs.map