@webdevarif/dashui 1.1.0 → 1.2.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/dist/index.mjs CHANGED
@@ -3560,6 +3560,166 @@ function HslColorInput({ value, onChange, className, inputClassName, disabled })
3560
3560
  ] });
3561
3561
  }
3562
3562
 
3563
+ // src/components/editors/tiptap-editor.tsx
3564
+ import { useEditor, EditorContent } from "@tiptap/react";
3565
+ import StarterKit from "@tiptap/starter-kit";
3566
+ import Placeholder from "@tiptap/extension-placeholder";
3567
+ import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
3568
+ function TiptapEditor({
3569
+ value,
3570
+ onChange,
3571
+ placeholder = "Start writing\u2026",
3572
+ disabled = false,
3573
+ className = ""
3574
+ }) {
3575
+ const editor = useEditor({
3576
+ immediatelyRender: false,
3577
+ extensions: [
3578
+ StarterKit.configure({
3579
+ heading: { levels: [1, 2, 3] }
3580
+ }),
3581
+ Placeholder.configure({ placeholder })
3582
+ ],
3583
+ content: value,
3584
+ editable: !disabled,
3585
+ editorProps: {
3586
+ attributes: {
3587
+ class: "prose prose-sm max-w-none min-h-[400px] p-4 outline-none focus:outline-none bg-white dark:bg-slate-900 text-slate-900 dark:text-white rounded-lg border border-gray-200 dark:border-slate-700"
3588
+ }
3589
+ },
3590
+ onUpdate: ({ editor: editor2 }) => {
3591
+ onChange(editor2.getJSON());
3592
+ }
3593
+ });
3594
+ if (!editor) return null;
3595
+ return /* @__PURE__ */ jsxs38("div", { className: `tiptap-wrapper ${className}`.trim(), children: [
3596
+ /* @__PURE__ */ jsxs38("div", { className: "flex gap-1 p-2 border-b border-gray-200 dark:border-slate-700 bg-gray-50 dark:bg-slate-800 rounded-t-lg", children: [
3597
+ /* @__PURE__ */ jsx55(
3598
+ ToolbarButton,
3599
+ {
3600
+ onClick: () => editor.chain().focus().toggleBold().run(),
3601
+ active: editor.isActive("bold"),
3602
+ title: "Bold (Ctrl+B)",
3603
+ children: /* @__PURE__ */ jsx55("strong", { children: "B" })
3604
+ }
3605
+ ),
3606
+ /* @__PURE__ */ jsx55(
3607
+ ToolbarButton,
3608
+ {
3609
+ onClick: () => editor.chain().focus().toggleItalic().run(),
3610
+ active: editor.isActive("italic"),
3611
+ title: "Italic (Ctrl+I)",
3612
+ children: /* @__PURE__ */ jsx55("em", { children: "I" })
3613
+ }
3614
+ ),
3615
+ /* @__PURE__ */ jsx55(
3616
+ ToolbarButton,
3617
+ {
3618
+ onClick: () => editor.chain().focus().toggleStrike().run(),
3619
+ active: editor.isActive("strike"),
3620
+ title: "Strikethrough",
3621
+ children: /* @__PURE__ */ jsx55("s", { children: "S" })
3622
+ }
3623
+ ),
3624
+ /* @__PURE__ */ jsx55("div", { className: "w-px bg-gray-300 dark:bg-slate-600 mx-1" }),
3625
+ /* @__PURE__ */ jsx55(
3626
+ ToolbarButton,
3627
+ {
3628
+ onClick: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
3629
+ active: editor.isActive("heading", { level: 1 }),
3630
+ title: "Heading 1",
3631
+ children: "H1"
3632
+ }
3633
+ ),
3634
+ /* @__PURE__ */ jsx55(
3635
+ ToolbarButton,
3636
+ {
3637
+ onClick: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
3638
+ active: editor.isActive("heading", { level: 2 }),
3639
+ title: "Heading 2",
3640
+ children: "H2"
3641
+ }
3642
+ ),
3643
+ /* @__PURE__ */ jsx55(
3644
+ ToolbarButton,
3645
+ {
3646
+ onClick: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
3647
+ active: editor.isActive("heading", { level: 3 }),
3648
+ title: "Heading 3",
3649
+ children: "H3"
3650
+ }
3651
+ ),
3652
+ /* @__PURE__ */ jsx55("div", { className: "w-px bg-gray-300 dark:bg-slate-600 mx-1" }),
3653
+ /* @__PURE__ */ jsx55(
3654
+ ToolbarButton,
3655
+ {
3656
+ onClick: () => editor.chain().focus().toggleBulletList().run(),
3657
+ active: editor.isActive("bulletList"),
3658
+ title: "Bullet list",
3659
+ children: "\u2022"
3660
+ }
3661
+ ),
3662
+ /* @__PURE__ */ jsx55(
3663
+ ToolbarButton,
3664
+ {
3665
+ onClick: () => editor.chain().focus().toggleOrderedList().run(),
3666
+ active: editor.isActive("orderedList"),
3667
+ title: "Ordered list",
3668
+ children: "1."
3669
+ }
3670
+ ),
3671
+ /* @__PURE__ */ jsx55("div", { className: "w-px bg-gray-300 dark:bg-slate-600 mx-1" }),
3672
+ /* @__PURE__ */ jsx55(
3673
+ ToolbarButton,
3674
+ {
3675
+ onClick: () => editor.chain().focus().toggleCodeBlock().run(),
3676
+ active: editor.isActive("codeBlock"),
3677
+ title: "Code block",
3678
+ children: "<>"
3679
+ }
3680
+ ),
3681
+ /* @__PURE__ */ jsx55(
3682
+ ToolbarButton,
3683
+ {
3684
+ onClick: () => editor.chain().focus().toggleCode().run(),
3685
+ active: editor.isActive("code"),
3686
+ title: "Inline code",
3687
+ children: "`"
3688
+ }
3689
+ ),
3690
+ /* @__PURE__ */ jsx55("div", { className: "w-px bg-gray-300 dark:bg-slate-600 mx-1" }),
3691
+ /* @__PURE__ */ jsx55(
3692
+ ToolbarButton,
3693
+ {
3694
+ onClick: () => editor.chain().focus().setHorizontalRule().run(),
3695
+ title: "Horizontal rule",
3696
+ children: "\u2014"
3697
+ }
3698
+ )
3699
+ ] }),
3700
+ /* @__PURE__ */ jsx55(EditorContent, { editor })
3701
+ ] });
3702
+ }
3703
+ function ToolbarButton({
3704
+ onClick,
3705
+ active,
3706
+ title,
3707
+ children
3708
+ }) {
3709
+ return /* @__PURE__ */ jsx55(
3710
+ "button",
3711
+ {
3712
+ onClick,
3713
+ title,
3714
+ className: `
3715
+ px-2 py-1 rounded text-sm font-medium transition-colors
3716
+ ${active ? "bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400" : "bg-transparent text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-slate-700"}
3717
+ `,
3718
+ children
3719
+ }
3720
+ );
3721
+ }
3722
+
3563
3723
  // src/hooks/index.ts
3564
3724
  import { useState as useState12 } from "react";
3565
3725
  function useDisclosure(initial = false) {
@@ -3579,9 +3739,9 @@ function usePagination(total, pageSize = 20) {
3579
3739
  }
3580
3740
 
3581
3741
  // src/components/auth/AuthShell.tsx
3582
- import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
3742
+ import { jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
3583
3743
  function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
3584
- return /* @__PURE__ */ jsxs38(
3744
+ return /* @__PURE__ */ jsxs39(
3585
3745
  "div",
3586
3746
  {
3587
3747
  style: {
@@ -3596,7 +3756,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
3596
3756
  overflow: "hidden"
3597
3757
  },
3598
3758
  children: [
3599
- pattern === "dots" && /* @__PURE__ */ jsx55(
3759
+ pattern === "dots" && /* @__PURE__ */ jsx56(
3600
3760
  "div",
3601
3761
  {
3602
3762
  "aria-hidden": true,
@@ -3610,7 +3770,7 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
3610
3770
  }
3611
3771
  }
3612
3772
  ),
3613
- pattern === "grid" && /* @__PURE__ */ jsx55(
3773
+ pattern === "grid" && /* @__PURE__ */ jsx56(
3614
3774
  "div",
3615
3775
  {
3616
3776
  "aria-hidden": true,
@@ -3624,16 +3784,16 @@ function AuthShell({ children, pattern = "dots", maxWidth = "520px" }) {
3624
3784
  }
3625
3785
  }
3626
3786
  ),
3627
- /* @__PURE__ */ jsx55("div", { style: { position: "relative", zIndex: 1, width: "100%", maxWidth }, children })
3787
+ /* @__PURE__ */ jsx56("div", { style: { position: "relative", zIndex: 1, width: "100%", maxWidth }, children })
3628
3788
  ]
3629
3789
  }
3630
3790
  );
3631
3791
  }
3632
3792
 
3633
3793
  // src/components/auth/AuthCard.tsx
3634
- import { jsx as jsx56 } from "react/jsx-runtime";
3794
+ import { jsx as jsx57 } from "react/jsx-runtime";
3635
3795
  function AuthCard({ children, padding = "24px 28px" }) {
3636
- return /* @__PURE__ */ jsx56(
3796
+ return /* @__PURE__ */ jsx57(
3637
3797
  "div",
3638
3798
  {
3639
3799
  style: {
@@ -3650,10 +3810,10 @@ function AuthCard({ children, padding = "24px 28px" }) {
3650
3810
  }
3651
3811
 
3652
3812
  // src/components/auth/AuthLogo.tsx
3653
- import { jsx as jsx57, jsxs as jsxs39 } from "react/jsx-runtime";
3813
+ import { jsx as jsx58, jsxs as jsxs40 } from "react/jsx-runtime";
3654
3814
  function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }) {
3655
- return /* @__PURE__ */ jsxs39("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "10px", marginBottom: "28px" }, children: [
3656
- imageUrl ? /* @__PURE__ */ jsx57(
3815
+ return /* @__PURE__ */ jsxs40("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", gap: "10px", marginBottom: "28px" }, children: [
3816
+ imageUrl ? /* @__PURE__ */ jsx58(
3657
3817
  "img",
3658
3818
  {
3659
3819
  src: imageUrl,
@@ -3662,7 +3822,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
3662
3822
  height: size,
3663
3823
  style: { borderRadius: "calc(var(--radius, 0.5rem) * 1.2)", flexShrink: 0, display: "block" }
3664
3824
  }
3665
- ) : /* @__PURE__ */ jsx57(
3825
+ ) : /* @__PURE__ */ jsx58(
3666
3826
  "div",
3667
3827
  {
3668
3828
  style: {
@@ -3681,7 +3841,7 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
3681
3841
  children: letter
3682
3842
  }
3683
3843
  ),
3684
- /* @__PURE__ */ jsx57(
3844
+ /* @__PURE__ */ jsx58(
3685
3845
  "span",
3686
3846
  {
3687
3847
  style: {
@@ -3697,10 +3857,10 @@ function AuthLogo({ appName = "Builify CMS", letter = "B", imageUrl, size = 36 }
3697
3857
  }
3698
3858
 
3699
3859
  // src/components/auth/AuthHeader.tsx
3700
- import { jsx as jsx58, jsxs as jsxs40 } from "react/jsx-runtime";
3860
+ import { jsx as jsx59, jsxs as jsxs41 } from "react/jsx-runtime";
3701
3861
  function AuthHeader({ title, description }) {
3702
- return /* @__PURE__ */ jsxs40("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
3703
- /* @__PURE__ */ jsx58(
3862
+ return /* @__PURE__ */ jsxs41("div", { style: { marginBottom: "24px", textAlign: "center" }, children: [
3863
+ /* @__PURE__ */ jsx59(
3704
3864
  "h1",
3705
3865
  {
3706
3866
  style: {
@@ -3713,7 +3873,7 @@ function AuthHeader({ title, description }) {
3713
3873
  children: title
3714
3874
  }
3715
3875
  ),
3716
- description && /* @__PURE__ */ jsx58(
3876
+ description && /* @__PURE__ */ jsx59(
3717
3877
  "p",
3718
3878
  {
3719
3879
  style: {
@@ -3729,12 +3889,12 @@ function AuthHeader({ title, description }) {
3729
3889
  }
3730
3890
 
3731
3891
  // src/components/auth/AuthField.tsx
3732
- import { jsx as jsx59, jsxs as jsxs41 } from "react/jsx-runtime";
3892
+ import { jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
3733
3893
  function AuthField({ label, error, hint, rightLabel, id, ...props }) {
3734
3894
  const fieldId = id ?? label.toLowerCase().replace(/\s+/g, "-");
3735
- return /* @__PURE__ */ jsxs41("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
3736
- /* @__PURE__ */ jsxs41("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
3737
- /* @__PURE__ */ jsx59(
3895
+ return /* @__PURE__ */ jsxs42("div", { style: { display: "flex", flexDirection: "column", gap: "6px" }, children: [
3896
+ /* @__PURE__ */ jsxs42("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
3897
+ /* @__PURE__ */ jsx60(
3738
3898
  "label",
3739
3899
  {
3740
3900
  htmlFor: fieldId,
@@ -3746,9 +3906,9 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
3746
3906
  children: label
3747
3907
  }
3748
3908
  ),
3749
- rightLabel && /* @__PURE__ */ jsx59("span", { style: { fontSize: "0.8125rem" }, children: rightLabel })
3909
+ rightLabel && /* @__PURE__ */ jsx60("span", { style: { fontSize: "0.8125rem" }, children: rightLabel })
3750
3910
  ] }),
3751
- /* @__PURE__ */ jsx59(
3911
+ /* @__PURE__ */ jsx60(
3752
3912
  "input",
3753
3913
  {
3754
3914
  id: fieldId,
@@ -3778,13 +3938,13 @@ function AuthField({ label, error, hint, rightLabel, id, ...props }) {
3778
3938
  ...props
3779
3939
  }
3780
3940
  ),
3781
- error && /* @__PURE__ */ jsx59("p", { style: { fontSize: "0.8rem", color: "var(--destructive)", margin: 0 }, children: error }),
3782
- hint && !error && /* @__PURE__ */ jsx59("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground)", margin: 0 }, children: hint })
3941
+ error && /* @__PURE__ */ jsx60("p", { style: { fontSize: "0.8rem", color: "var(--destructive)", margin: 0 }, children: error }),
3942
+ hint && !error && /* @__PURE__ */ jsx60("p", { style: { fontSize: "0.8rem", color: "var(--muted-foreground)", margin: 0 }, children: hint })
3783
3943
  ] });
3784
3944
  }
3785
3945
 
3786
3946
  // src/components/auth/AuthButton.tsx
3787
- import { Fragment as Fragment4, jsx as jsx60, jsxs as jsxs42 } from "react/jsx-runtime";
3947
+ import { Fragment as Fragment4, jsx as jsx61, jsxs as jsxs43 } from "react/jsx-runtime";
3788
3948
  function AuthButton({
3789
3949
  loading,
3790
3950
  variant = "primary",
@@ -3827,7 +3987,7 @@ function AuthButton({
3827
3987
  color: "var(--foreground)"
3828
3988
  }
3829
3989
  };
3830
- return /* @__PURE__ */ jsx60(
3990
+ return /* @__PURE__ */ jsx61(
3831
3991
  "button",
3832
3992
  {
3833
3993
  disabled: loading || disabled,
@@ -3839,8 +3999,8 @@ function AuthButton({
3839
3999
  e.currentTarget.style.filter = "none";
3840
4000
  },
3841
4001
  ...props,
3842
- children: loading ? /* @__PURE__ */ jsxs42(Fragment4, { children: [
3843
- /* @__PURE__ */ jsx60(
4002
+ children: loading ? /* @__PURE__ */ jsxs43(Fragment4, { children: [
4003
+ /* @__PURE__ */ jsx61(
3844
4004
  "span",
3845
4005
  {
3846
4006
  style: {
@@ -3861,19 +4021,19 @@ function AuthButton({
3861
4021
  }
3862
4022
 
3863
4023
  // src/components/auth/AuthDivider.tsx
3864
- import { jsx as jsx61, jsxs as jsxs43 } from "react/jsx-runtime";
4024
+ import { jsx as jsx62, jsxs as jsxs44 } from "react/jsx-runtime";
3865
4025
  function AuthDivider({ label = "or" }) {
3866
- return /* @__PURE__ */ jsxs43("div", { style: { display: "flex", alignItems: "center", gap: "12px", margin: "20px 0" }, children: [
3867
- /* @__PURE__ */ jsx61("div", { style: { flex: 1, height: 1, background: "var(--border)" } }),
3868
- /* @__PURE__ */ jsx61("span", { style: { fontSize: "0.75rem", color: "var(--muted-foreground)", userSelect: "none" }, children: label }),
3869
- /* @__PURE__ */ jsx61("div", { style: { flex: 1, height: 1, background: "var(--border)" } })
4026
+ return /* @__PURE__ */ jsxs44("div", { style: { display: "flex", alignItems: "center", gap: "12px", margin: "20px 0" }, children: [
4027
+ /* @__PURE__ */ jsx62("div", { style: { flex: 1, height: 1, background: "var(--border)" } }),
4028
+ /* @__PURE__ */ jsx62("span", { style: { fontSize: "0.75rem", color: "var(--muted-foreground)", userSelect: "none" }, children: label }),
4029
+ /* @__PURE__ */ jsx62("div", { style: { flex: 1, height: 1, background: "var(--border)" } })
3870
4030
  ] });
3871
4031
  }
3872
4032
 
3873
4033
  // src/components/auth/AuthFootnote.tsx
3874
- import { jsx as jsx62, jsxs as jsxs44 } from "react/jsx-runtime";
4034
+ import { jsx as jsx63, jsxs as jsxs45 } from "react/jsx-runtime";
3875
4035
  function AuthFootnote({ text, linkText, linkHref }) {
3876
- return /* @__PURE__ */ jsxs44("p", { style: {
4036
+ return /* @__PURE__ */ jsxs45("p", { style: {
3877
4037
  textAlign: "center",
3878
4038
  marginTop: "20px",
3879
4039
  fontSize: "0.8125rem",
@@ -3881,7 +4041,7 @@ function AuthFootnote({ text, linkText, linkHref }) {
3881
4041
  }, children: [
3882
4042
  text,
3883
4043
  " ",
3884
- /* @__PURE__ */ jsx62(
4044
+ /* @__PURE__ */ jsx63(
3885
4045
  "a",
3886
4046
  {
3887
4047
  href: linkHref,
@@ -4009,6 +4169,7 @@ export {
4009
4169
  Textarea,
4010
4170
  ThemeProvider,
4011
4171
  ThemeToggle,
4172
+ TiptapEditor,
4012
4173
  Tooltip,
4013
4174
  TooltipContent,
4014
4175
  TooltipProvider,