hazo_ui 4.3.0 → 4.6.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.js CHANGED
@@ -50,7 +50,7 @@ import TableCell from '@tiptap/extension-table-cell';
50
50
  import TableHeader from '@tiptap/extension-table-header';
51
51
  import TaskList from '@tiptap/extension-task-list';
52
52
  import TaskItem from '@tiptap/extension-task-item';
53
- import { LuUndo2, LuRedo2, LuMinus, LuPlus, LuBold, LuItalic, LuUnderline, LuStrikethrough, LuSubscript, LuSuperscript, LuLink, LuRemoveFormatting, LuPalette, LuHighlighter, LuAlignLeft, LuAlignCenter, LuAlignRight, LuAlignJustify, LuList, LuListOrdered, LuListChecks, LuIndentDecrease, LuIndentIncrease, LuImage, LuTable, LuTableRowsSplit, LuTableColumnsSplit, LuTrash2, LuGrid3X3, LuVariable, LuPaperclip, LuX, LuFileText, LuFileCode, LuFile } from 'react-icons/lu';
53
+ import { LuBold, LuItalic, LuUnderline, LuAlignLeft, LuAlignCenter, LuAlignRight, LuUndo2, LuRedo2, LuMinus, LuPlus, LuStrikethrough, LuSubscript, LuSuperscript, LuLink, LuRemoveFormatting, LuPalette, LuHighlighter, LuAlignJustify, LuList, LuListOrdered, LuListChecks, LuIndentDecrease, LuIndentIncrease, LuTable, LuTableRowsSplit, LuTableColumnsSplit, LuTrash2, LuGrid3X3, LuVariable, LuPaperclip, LuX, LuImage, LuFileText, LuFileCode, LuFile } from 'react-icons/lu';
54
54
  import { RxDividerHorizontal } from 'react-icons/rx';
55
55
  import { Extension, Node, mergeAttributes } from '@tiptap/core';
56
56
  import * as TabsPrimitive from '@radix-ui/react-tabs';
@@ -231,36 +231,14 @@ var buttonVariants = cva(
231
231
  }
232
232
  }
233
233
  );
234
- var variant_styles = {
235
- default: {
236
- backgroundColor: "hsl(var(--primary))",
237
- color: "hsl(var(--primary-foreground))",
238
- border: "1px solid hsl(var(--primary))"
239
- },
240
- destructive: {
241
- backgroundColor: "hsl(var(--destructive))",
242
- color: "hsl(var(--destructive-foreground))",
243
- border: "1px solid hsl(var(--destructive))"
244
- },
245
- outline: {
246
- backgroundColor: "hsl(var(--background))",
247
- color: "hsl(var(--foreground))",
248
- border: "1px solid hsl(var(--border))"
249
- },
250
- secondary: {
251
- backgroundColor: "hsl(var(--secondary))",
252
- color: "hsl(var(--secondary-foreground))"
253
- }
254
- };
255
234
  var Button = React26.forwardRef(
256
235
  ({ className, variant, size, asChild = false, style, ...props }, ref) => {
257
236
  const Comp = asChild ? Slot : "button";
258
- const fallback_styles = variant_styles[variant ?? "default"] ?? {};
259
237
  return /* @__PURE__ */ jsx(
260
238
  Comp,
261
239
  {
262
240
  className: cn(buttonVariants({ variant, size, className })),
263
- style: { ...fallback_styles, ...style },
241
+ style,
264
242
  ref,
265
243
  ...props
266
244
  }
@@ -3245,13 +3223,41 @@ function get_file_extension(filename) {
3245
3223
  function is_image_file(mime_type) {
3246
3224
  return mime_type.startsWith("image/");
3247
3225
  }
3226
+ var ALL_ON = {
3227
+ undo_redo: true,
3228
+ block_type: true,
3229
+ font_family: true,
3230
+ font_size: true,
3231
+ bold: true,
3232
+ italic: true,
3233
+ underline: true,
3234
+ strikethrough: true,
3235
+ subscript: true,
3236
+ superscript: true,
3237
+ link: true,
3238
+ clear_formatting: true,
3239
+ text_color: true,
3240
+ highlight_color: true,
3241
+ alignment: true,
3242
+ bullet_list: true,
3243
+ ordered_list: true,
3244
+ task_list: true,
3245
+ indent: true,
3246
+ horizontal_rule: true,
3247
+ image: true,
3248
+ table: true,
3249
+ variables: true,
3250
+ attachment: true
3251
+ };
3248
3252
  var ToolbarSeparator = () => /* @__PURE__ */ jsx("div", { className: "cls_rte_toolbar_separator mx-1 h-6 w-px bg-border" });
3249
3253
  var Toolbar = ({
3250
3254
  editor,
3251
3255
  variables = [],
3252
3256
  attachments,
3253
3257
  on_attachments_change,
3254
- disabled = false
3258
+ disabled = false,
3259
+ toolbar,
3260
+ font_families
3255
3261
  }) => {
3256
3262
  const [link_url, set_link_url] = React26.useState("https://");
3257
3263
  const [link_popover_open, set_link_popover_open] = React26.useState(false);
@@ -3269,13 +3275,15 @@ var Toolbar = ({
3269
3275
  if (!editor) {
3270
3276
  return null;
3271
3277
  }
3278
+ const tb = { ...ALL_ON, ...toolbar };
3279
+ const font_family_options = font_families && font_families.length > 0 ? font_families : FONT_FAMILIES;
3272
3280
  const get_current_font_size = () => {
3273
3281
  const attrs = editor.getAttributes("textStyle");
3274
3282
  return attrs.fontSize || FONT_SIZE_CONFIG.default;
3275
3283
  };
3276
3284
  const get_current_font_family = () => {
3277
3285
  const attrs = editor.getAttributes("textStyle");
3278
- return attrs.fontFamily || FONT_FAMILIES[0].value;
3286
+ return attrs.fontFamily || font_family_options[0].value;
3279
3287
  };
3280
3288
  const get_current_block_type = () => {
3281
3289
  if (editor.isActive("heading", { level: 1 })) return "heading-1";
@@ -3404,44 +3412,46 @@ var Toolbar = ({
3404
3412
  editor.chain().focus().insertVariable(variable_name).run();
3405
3413
  set_variables_menu_open(false);
3406
3414
  };
3407
- return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs(
3408
- "div",
3409
- {
3410
- className: cn(
3411
- "cls_rte_toolbar",
3412
- "flex flex-wrap items-center gap-0.5",
3413
- "p-1.5 rounded-t-md",
3414
- "bg-muted border-b border-border",
3415
- disabled && "opacity-50 pointer-events-none"
3415
+ const sections = [];
3416
+ if (tb.undo_redo) {
3417
+ sections.push([
3418
+ /* @__PURE__ */ jsx(
3419
+ ToolbarButton,
3420
+ {
3421
+ onClick: () => editor.chain().focus().undo().run(),
3422
+ disabled: !editor.can().undo(),
3423
+ tooltip: "Undo",
3424
+ children: /* @__PURE__ */ jsx(LuUndo2, { className: "h-4 w-4" })
3425
+ },
3426
+ "undo"
3416
3427
  ),
3417
- children: [
3418
- /* @__PURE__ */ jsx(
3419
- ToolbarButton,
3420
- {
3421
- onClick: () => editor.chain().focus().undo().run(),
3422
- disabled: !editor.can().undo(),
3423
- tooltip: "Undo",
3424
- children: /* @__PURE__ */ jsx(LuUndo2, { className: "h-4 w-4" })
3425
- }
3426
- ),
3427
- /* @__PURE__ */ jsx(
3428
- ToolbarButton,
3429
- {
3430
- onClick: () => editor.chain().focus().redo().run(),
3431
- disabled: !editor.can().redo(),
3432
- tooltip: "Redo",
3433
- children: /* @__PURE__ */ jsx(LuRedo2, { className: "h-4 w-4" })
3434
- }
3435
- ),
3436
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3437
- /* @__PURE__ */ jsxs(Select, { value: get_current_block_type(), onValueChange: handle_block_type_change, children: [
3438
- /* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-[130px] text-xs", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
3439
- /* @__PURE__ */ jsx(SelectContent, { children: BLOCK_TYPES.map((type) => /* @__PURE__ */ jsx(SelectItem, { value: type.value, className: "text-xs", children: type.label }, type.value)) })
3440
- ] }),
3441
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3428
+ /* @__PURE__ */ jsx(
3429
+ ToolbarButton,
3430
+ {
3431
+ onClick: () => editor.chain().focus().redo().run(),
3432
+ disabled: !editor.can().redo(),
3433
+ tooltip: "Redo",
3434
+ children: /* @__PURE__ */ jsx(LuRedo2, { className: "h-4 w-4" })
3435
+ },
3436
+ "redo"
3437
+ )
3438
+ ]);
3439
+ }
3440
+ if (tb.block_type) {
3441
+ sections.push([
3442
+ /* @__PURE__ */ jsxs(Select, { value: get_current_block_type(), onValueChange: handle_block_type_change, children: [
3443
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-[130px] text-xs", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
3444
+ /* @__PURE__ */ jsx(SelectContent, { children: BLOCK_TYPES.map((type) => /* @__PURE__ */ jsx(SelectItem, { value: type.value, className: "text-xs", children: type.label }, type.value)) })
3445
+ ] }, "block")
3446
+ ]);
3447
+ }
3448
+ {
3449
+ const items = [];
3450
+ if (tb.font_family) {
3451
+ items.push(
3442
3452
  /* @__PURE__ */ jsxs(Select, { value: get_current_font_family(), onValueChange: handle_font_family_change, children: [
3443
3453
  /* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 w-[120px] text-xs", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
3444
- /* @__PURE__ */ jsx(SelectContent, { children: FONT_FAMILIES.map((font) => /* @__PURE__ */ jsx(
3454
+ /* @__PURE__ */ jsx(SelectContent, { children: font_family_options.map((font) => /* @__PURE__ */ jsx(
3445
3455
  SelectItem,
3446
3456
  {
3447
3457
  value: font.value,
@@ -3451,7 +3461,11 @@ var Toolbar = ({
3451
3461
  },
3452
3462
  font.value
3453
3463
  )) })
3454
- ] }),
3464
+ ] }, "family")
3465
+ );
3466
+ }
3467
+ if (tb.font_size) {
3468
+ items.push(
3455
3469
  /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
3456
3470
  /* @__PURE__ */ jsx(
3457
3471
  ToolbarButton,
@@ -3470,8 +3484,15 @@ var Toolbar = ({
3470
3484
  children: /* @__PURE__ */ jsx(LuPlus, { className: "h-3 w-3" })
3471
3485
  }
3472
3486
  )
3473
- ] }),
3474
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3487
+ ] }, "size")
3488
+ );
3489
+ }
3490
+ if (items.length) sections.push(items);
3491
+ }
3492
+ {
3493
+ const items = [];
3494
+ if (tb.bold) {
3495
+ items.push(
3475
3496
  /* @__PURE__ */ jsx(
3476
3497
  ToolbarButton,
3477
3498
  {
@@ -3479,8 +3500,13 @@ var Toolbar = ({
3479
3500
  is_active: editor.isActive("bold"),
3480
3501
  tooltip: "Bold",
3481
3502
  children: /* @__PURE__ */ jsx(LuBold, { className: "h-4 w-4" })
3482
- }
3483
- ),
3503
+ },
3504
+ "bold"
3505
+ )
3506
+ );
3507
+ }
3508
+ if (tb.italic) {
3509
+ items.push(
3484
3510
  /* @__PURE__ */ jsx(
3485
3511
  ToolbarButton,
3486
3512
  {
@@ -3488,8 +3514,13 @@ var Toolbar = ({
3488
3514
  is_active: editor.isActive("italic"),
3489
3515
  tooltip: "Italic",
3490
3516
  children: /* @__PURE__ */ jsx(LuItalic, { className: "h-4 w-4" })
3491
- }
3492
- ),
3517
+ },
3518
+ "italic"
3519
+ )
3520
+ );
3521
+ }
3522
+ if (tb.underline) {
3523
+ items.push(
3493
3524
  /* @__PURE__ */ jsx(
3494
3525
  ToolbarButton,
3495
3526
  {
@@ -3497,8 +3528,13 @@ var Toolbar = ({
3497
3528
  is_active: editor.isActive("underline"),
3498
3529
  tooltip: "Underline",
3499
3530
  children: /* @__PURE__ */ jsx(LuUnderline, { className: "h-4 w-4" })
3500
- }
3501
- ),
3531
+ },
3532
+ "underline"
3533
+ )
3534
+ );
3535
+ }
3536
+ if (tb.strikethrough) {
3537
+ items.push(
3502
3538
  /* @__PURE__ */ jsx(
3503
3539
  ToolbarButton,
3504
3540
  {
@@ -3506,8 +3542,13 @@ var Toolbar = ({
3506
3542
  is_active: editor.isActive("strike"),
3507
3543
  tooltip: "Strikethrough",
3508
3544
  children: /* @__PURE__ */ jsx(LuStrikethrough, { className: "h-4 w-4" })
3509
- }
3510
- ),
3545
+ },
3546
+ "strike"
3547
+ )
3548
+ );
3549
+ }
3550
+ if (tb.subscript) {
3551
+ items.push(
3511
3552
  /* @__PURE__ */ jsx(
3512
3553
  ToolbarButton,
3513
3554
  {
@@ -3515,8 +3556,13 @@ var Toolbar = ({
3515
3556
  is_active: editor.isActive("subscript"),
3516
3557
  tooltip: "Subscript",
3517
3558
  children: /* @__PURE__ */ jsx(LuSubscript, { className: "h-4 w-4" })
3518
- }
3519
- ),
3559
+ },
3560
+ "sub"
3561
+ )
3562
+ );
3563
+ }
3564
+ if (tb.superscript) {
3565
+ items.push(
3520
3566
  /* @__PURE__ */ jsx(
3521
3567
  ToolbarButton,
3522
3568
  {
@@ -3524,9 +3570,17 @@ var Toolbar = ({
3524
3570
  is_active: editor.isActive("superscript"),
3525
3571
  tooltip: "Superscript",
3526
3572
  children: /* @__PURE__ */ jsx(LuSuperscript, { className: "h-4 w-4" })
3527
- }
3528
- ),
3529
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3573
+ },
3574
+ "super"
3575
+ )
3576
+ );
3577
+ }
3578
+ if (items.length) sections.push(items);
3579
+ }
3580
+ {
3581
+ const items = [];
3582
+ if (tb.link) {
3583
+ items.push(
3530
3584
  /* @__PURE__ */ jsxs(Popover, { open: link_popover_open, onOpenChange: set_link_popover_open, children: [
3531
3585
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { is_active: editor.isActive("link"), tooltip: "Link", children: /* @__PURE__ */ jsx(LuLink, { className: "h-4 w-4" }) }) }),
3532
3586
  /* @__PURE__ */ jsx(PopoverContent, { className: "w-80 p-3", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
@@ -3555,16 +3609,28 @@ var Toolbar = ({
3555
3609
  )
3556
3610
  ] })
3557
3611
  ] }) })
3558
- ] }),
3612
+ ] }, "link")
3613
+ );
3614
+ }
3615
+ if (tb.clear_formatting) {
3616
+ items.push(
3559
3617
  /* @__PURE__ */ jsx(
3560
3618
  ToolbarButton,
3561
3619
  {
3562
3620
  onClick: () => editor.chain().focus().unsetAllMarks().clearNodes().run(),
3563
3621
  tooltip: "Clear formatting",
3564
3622
  children: /* @__PURE__ */ jsx(LuRemoveFormatting, { className: "h-4 w-4" })
3565
- }
3566
- ),
3567
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3623
+ },
3624
+ "clear"
3625
+ )
3626
+ );
3627
+ }
3628
+ if (items.length) sections.push(items);
3629
+ }
3630
+ {
3631
+ const items = [];
3632
+ if (tb.text_color) {
3633
+ items.push(
3568
3634
  /* @__PURE__ */ jsxs(Popover, { open: text_color_open, onOpenChange: set_text_color_open, children: [
3569
3635
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "Text color", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
3570
3636
  /* @__PURE__ */ jsx(LuPalette, { className: "h-4 w-4" }),
@@ -3603,7 +3669,11 @@ var Toolbar = ({
3603
3669
  ]
3604
3670
  }
3605
3671
  ) })
3606
- ] }),
3672
+ ] }, "textcolor")
3673
+ );
3674
+ }
3675
+ if (tb.highlight_color) {
3676
+ items.push(
3607
3677
  /* @__PURE__ */ jsxs(Popover, { open: highlight_color_open, onOpenChange: set_highlight_color_open, children: [
3608
3678
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "Highlight color", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
3609
3679
  /* @__PURE__ */ jsx(LuHighlighter, { className: "h-4 w-4" }),
@@ -3636,45 +3706,59 @@ var Toolbar = ({
3636
3706
  ]
3637
3707
  }
3638
3708
  ) })
3639
- ] }),
3640
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3641
- /* @__PURE__ */ jsx(
3642
- ToolbarButton,
3643
- {
3644
- onClick: () => editor.chain().focus().setTextAlign("left").run(),
3645
- is_active: editor.isActive({ textAlign: "left" }),
3646
- tooltip: "Align left",
3647
- children: /* @__PURE__ */ jsx(LuAlignLeft, { className: "h-4 w-4" })
3648
- }
3649
- ),
3650
- /* @__PURE__ */ jsx(
3651
- ToolbarButton,
3652
- {
3653
- onClick: () => editor.chain().focus().setTextAlign("center").run(),
3654
- is_active: editor.isActive({ textAlign: "center" }),
3655
- tooltip: "Align center",
3656
- children: /* @__PURE__ */ jsx(LuAlignCenter, { className: "h-4 w-4" })
3657
- }
3658
- ),
3659
- /* @__PURE__ */ jsx(
3660
- ToolbarButton,
3661
- {
3662
- onClick: () => editor.chain().focus().setTextAlign("right").run(),
3663
- is_active: editor.isActive({ textAlign: "right" }),
3664
- tooltip: "Align right",
3665
- children: /* @__PURE__ */ jsx(LuAlignRight, { className: "h-4 w-4" })
3666
- }
3667
- ),
3668
- /* @__PURE__ */ jsx(
3669
- ToolbarButton,
3670
- {
3671
- onClick: () => editor.chain().focus().setTextAlign("justify").run(),
3672
- is_active: editor.isActive({ textAlign: "justify" }),
3673
- tooltip: "Justify",
3674
- children: /* @__PURE__ */ jsx(LuAlignJustify, { className: "h-4 w-4" })
3675
- }
3676
- ),
3677
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3709
+ ] }, "highlight")
3710
+ );
3711
+ }
3712
+ if (items.length) sections.push(items);
3713
+ }
3714
+ if (tb.alignment) {
3715
+ sections.push([
3716
+ /* @__PURE__ */ jsx(
3717
+ ToolbarButton,
3718
+ {
3719
+ onClick: () => editor.chain().focus().setTextAlign("left").run(),
3720
+ is_active: editor.isActive({ textAlign: "left" }),
3721
+ tooltip: "Align left",
3722
+ children: /* @__PURE__ */ jsx(LuAlignLeft, { className: "h-4 w-4" })
3723
+ },
3724
+ "align-left"
3725
+ ),
3726
+ /* @__PURE__ */ jsx(
3727
+ ToolbarButton,
3728
+ {
3729
+ onClick: () => editor.chain().focus().setTextAlign("center").run(),
3730
+ is_active: editor.isActive({ textAlign: "center" }),
3731
+ tooltip: "Align center",
3732
+ children: /* @__PURE__ */ jsx(LuAlignCenter, { className: "h-4 w-4" })
3733
+ },
3734
+ "align-center"
3735
+ ),
3736
+ /* @__PURE__ */ jsx(
3737
+ ToolbarButton,
3738
+ {
3739
+ onClick: () => editor.chain().focus().setTextAlign("right").run(),
3740
+ is_active: editor.isActive({ textAlign: "right" }),
3741
+ tooltip: "Align right",
3742
+ children: /* @__PURE__ */ jsx(LuAlignRight, { className: "h-4 w-4" })
3743
+ },
3744
+ "align-right"
3745
+ ),
3746
+ /* @__PURE__ */ jsx(
3747
+ ToolbarButton,
3748
+ {
3749
+ onClick: () => editor.chain().focus().setTextAlign("justify").run(),
3750
+ is_active: editor.isActive({ textAlign: "justify" }),
3751
+ tooltip: "Justify",
3752
+ children: /* @__PURE__ */ jsx(LuAlignJustify, { className: "h-4 w-4" })
3753
+ },
3754
+ "align-justify"
3755
+ )
3756
+ ]);
3757
+ }
3758
+ {
3759
+ const items = [];
3760
+ if (tb.bullet_list) {
3761
+ items.push(
3678
3762
  /* @__PURE__ */ jsx(
3679
3763
  ToolbarButton,
3680
3764
  {
@@ -3682,8 +3766,13 @@ var Toolbar = ({
3682
3766
  is_active: editor.isActive("bulletList"),
3683
3767
  tooltip: "Bullet list",
3684
3768
  children: /* @__PURE__ */ jsx(LuList, { className: "h-4 w-4" })
3685
- }
3686
- ),
3769
+ },
3770
+ "bullet"
3771
+ )
3772
+ );
3773
+ }
3774
+ if (tb.ordered_list) {
3775
+ items.push(
3687
3776
  /* @__PURE__ */ jsx(
3688
3777
  ToolbarButton,
3689
3778
  {
@@ -3691,8 +3780,13 @@ var Toolbar = ({
3691
3780
  is_active: editor.isActive("orderedList"),
3692
3781
  tooltip: "Numbered list",
3693
3782
  children: /* @__PURE__ */ jsx(LuListOrdered, { className: "h-4 w-4" })
3694
- }
3695
- ),
3783
+ },
3784
+ "ordered"
3785
+ )
3786
+ );
3787
+ }
3788
+ if (tb.task_list) {
3789
+ items.push(
3696
3790
  /* @__PURE__ */ jsx(
3697
3791
  ToolbarButton,
3698
3792
  {
@@ -3700,56 +3794,71 @@ var Toolbar = ({
3700
3794
  is_active: editor.isActive("taskList"),
3701
3795
  tooltip: "Checklist",
3702
3796
  children: /* @__PURE__ */ jsx(LuListChecks, { className: "h-4 w-4" })
3703
- }
3704
- ),
3705
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3706
- /* @__PURE__ */ jsx(
3707
- ToolbarButton,
3708
- {
3709
- onClick: () => {
3710
- if (editor.isActive("listItem")) {
3711
- editor.chain().focus().liftListItem("listItem").run();
3712
- } else if (editor.isActive("taskItem")) {
3713
- editor.chain().focus().liftListItem("taskItem").run();
3714
- }
3715
- },
3716
- disabled: !editor.can().liftListItem("listItem") && !editor.can().liftListItem("taskItem"),
3717
- tooltip: "Decrease indent",
3718
- children: /* @__PURE__ */ jsx(LuIndentDecrease, { className: "h-4 w-4" })
3719
- }
3720
- ),
3721
- /* @__PURE__ */ jsx(
3722
- ToolbarButton,
3723
- {
3724
- onClick: () => {
3725
- if (editor.isActive("listItem")) {
3726
- editor.chain().focus().sinkListItem("listItem").run();
3727
- } else if (editor.isActive("taskItem")) {
3728
- editor.chain().focus().sinkListItem("taskItem").run();
3729
- }
3730
- },
3731
- disabled: !editor.can().sinkListItem("listItem") && !editor.can().sinkListItem("taskItem"),
3732
- tooltip: "Increase indent",
3733
- children: /* @__PURE__ */ jsx(LuIndentIncrease, { className: "h-4 w-4" })
3734
- }
3735
- ),
3736
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3737
- /* @__PURE__ */ jsx(
3738
- ToolbarButton,
3739
- {
3740
- onClick: handle_hr_insert,
3741
- tooltip: "Horizontal rule",
3742
- children: /* @__PURE__ */ jsx(RxDividerHorizontal, { className: "h-4 w-4" })
3743
- }
3744
- ),
3797
+ },
3798
+ "task"
3799
+ )
3800
+ );
3801
+ }
3802
+ if (items.length) sections.push(items);
3803
+ }
3804
+ if (tb.indent) {
3805
+ sections.push([
3806
+ /* @__PURE__ */ jsx(
3807
+ ToolbarButton,
3808
+ {
3809
+ onClick: () => {
3810
+ if (editor.isActive("listItem")) {
3811
+ editor.chain().focus().liftListItem("listItem").run();
3812
+ } else if (editor.isActive("taskItem")) {
3813
+ editor.chain().focus().liftListItem("taskItem").run();
3814
+ }
3815
+ },
3816
+ disabled: !editor.can().liftListItem("listItem") && !editor.can().liftListItem("taskItem"),
3817
+ tooltip: "Decrease indent",
3818
+ children: /* @__PURE__ */ jsx(LuIndentDecrease, { className: "h-4 w-4" })
3819
+ },
3820
+ "indent-dec"
3821
+ ),
3822
+ /* @__PURE__ */ jsx(
3823
+ ToolbarButton,
3824
+ {
3825
+ onClick: () => {
3826
+ if (editor.isActive("listItem")) {
3827
+ editor.chain().focus().sinkListItem("listItem").run();
3828
+ } else if (editor.isActive("taskItem")) {
3829
+ editor.chain().focus().sinkListItem("taskItem").run();
3830
+ }
3831
+ },
3832
+ disabled: !editor.can().sinkListItem("listItem") && !editor.can().sinkListItem("taskItem"),
3833
+ tooltip: "Increase indent",
3834
+ children: /* @__PURE__ */ jsx(LuIndentIncrease, { className: "h-4 w-4" })
3835
+ },
3836
+ "indent-inc"
3837
+ )
3838
+ ]);
3839
+ }
3840
+ {
3841
+ const items = [];
3842
+ if (tb.horizontal_rule) {
3843
+ items.push(
3844
+ /* @__PURE__ */ jsx(ToolbarButton, { onClick: handle_hr_insert, tooltip: "Horizontal rule", children: /* @__PURE__ */ jsx(RxDividerHorizontal, { className: "h-4 w-4" }) }, "hr")
3845
+ );
3846
+ }
3847
+ if (tb.image) {
3848
+ items.push(
3745
3849
  /* @__PURE__ */ jsx(
3746
3850
  ToolbarButton,
3747
3851
  {
3748
3852
  onClick: () => image_input_ref.current?.click(),
3749
3853
  tooltip: "Insert image",
3750
3854
  children: /* @__PURE__ */ jsx(LuImage, { className: "h-4 w-4" })
3751
- }
3752
- ),
3855
+ },
3856
+ "image"
3857
+ )
3858
+ );
3859
+ }
3860
+ if (tb.table) {
3861
+ items.push(
3753
3862
  /* @__PURE__ */ jsxs(Popover, { open: table_menu_open, onOpenChange: set_table_menu_open, children: [
3754
3863
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
3755
3864
  ToolbarButton,
@@ -3917,9 +4026,16 @@ var Toolbar = ({
3917
4026
  ] })
3918
4027
  ] })
3919
4028
  ) })
3920
- ] }),
3921
- /* @__PURE__ */ jsx(ToolbarSeparator, {}),
3922
- variables.length > 0 && /* @__PURE__ */ jsxs(Popover, { open: variables_menu_open, onOpenChange: set_variables_menu_open, children: [
4029
+ ] }, "table")
4030
+ );
4031
+ }
4032
+ if (items.length) sections.push(items);
4033
+ }
4034
+ {
4035
+ const items = [];
4036
+ if (tb.variables && variables.length > 0) {
4037
+ items.push(
4038
+ /* @__PURE__ */ jsxs(Popover, { open: variables_menu_open, onOpenChange: set_variables_menu_open, children: [
3923
4039
  /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(ToolbarButton, { tooltip: "Insert variable", children: /* @__PURE__ */ jsx(LuVariable, { className: "h-4 w-4" }) }) }),
3924
4040
  /* @__PURE__ */ jsx(PopoverContent, { className: "w-64 p-0", align: "start", children: /* @__PURE__ */ jsxs(Command, { children: [
3925
4041
  /* @__PURE__ */ jsx(CommandInput, { placeholder: "Search variables...", className: "h-8 text-xs" }),
@@ -3940,15 +4056,39 @@ var Toolbar = ({
3940
4056
  )) })
3941
4057
  ] })
3942
4058
  ] }) })
3943
- ] }),
4059
+ ] }, "vars")
4060
+ );
4061
+ }
4062
+ if (tb.attachment) {
4063
+ items.push(
3944
4064
  /* @__PURE__ */ jsx(
3945
4065
  ToolbarButton,
3946
4066
  {
3947
4067
  onClick: () => file_input_ref.current?.click(),
3948
4068
  tooltip: "Attach file",
3949
4069
  children: /* @__PURE__ */ jsx(LuPaperclip, { className: "h-4 w-4" })
3950
- }
3951
- ),
4070
+ },
4071
+ "attach"
4072
+ )
4073
+ );
4074
+ }
4075
+ if (items.length) sections.push(items);
4076
+ }
4077
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs(
4078
+ "div",
4079
+ {
4080
+ className: cn(
4081
+ "cls_rte_toolbar",
4082
+ "flex flex-wrap items-center gap-0.5",
4083
+ "p-1.5 rounded-t-md",
4084
+ "bg-muted border-b border-border",
4085
+ disabled && "opacity-50 pointer-events-none"
4086
+ ),
4087
+ children: [
4088
+ sections.map((items, i) => /* @__PURE__ */ jsxs(React26.Fragment, { children: [
4089
+ i > 0 && /* @__PURE__ */ jsx(ToolbarSeparator, {}),
4090
+ items
4091
+ ] }, i)),
3952
4092
  /* @__PURE__ */ jsx(
3953
4093
  "input",
3954
4094
  {
@@ -4255,7 +4395,9 @@ var HazoUiRte = ({
4255
4395
  max_height = "400px",
4256
4396
  disabled = false,
4257
4397
  className,
4258
- show_output_viewer = false
4398
+ show_output_viewer = false,
4399
+ toolbar,
4400
+ font_families
4259
4401
  }) => {
4260
4402
  const [attachments, set_attachments] = React26.useState(
4261
4403
  initial_attachments
@@ -4444,7 +4586,9 @@ var HazoUiRte = ({
4444
4586
  variables,
4445
4587
  attachments,
4446
4588
  on_attachments_change: handle_attachments_change,
4447
- disabled: disabled || is_view_only
4589
+ disabled: disabled || is_view_only,
4590
+ toolbar,
4591
+ font_families
4448
4592
  }
4449
4593
  ),
4450
4594
  show_output_viewer && editor && /* @__PURE__ */ jsx("div", { className: "cls_rte_tabs border-b border-border px-2 pt-2", children: /* @__PURE__ */ jsx(Tabs, { value: active_tab, onValueChange: (v) => set_active_tab(v), children: /* @__PURE__ */ jsxs(TabsList, { className: "h-9", children: [
@@ -4479,6 +4623,102 @@ var HazoUiRte = ({
4479
4623
  );
4480
4624
  };
4481
4625
  HazoUiRte.displayName = "HazoUiRte";
4626
+ function CanvasTextToolbar({
4627
+ bold,
4628
+ italic,
4629
+ underline,
4630
+ color: color2 = "#000000",
4631
+ align = "left",
4632
+ onBold,
4633
+ onItalic,
4634
+ onUnderline,
4635
+ onColor,
4636
+ onAlign,
4637
+ className,
4638
+ style
4639
+ }) {
4640
+ return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs(
4641
+ "div",
4642
+ {
4643
+ className: cn(
4644
+ "flex items-center gap-0.5 p-1.5 rounded-md",
4645
+ "bg-background border border-border shadow-md",
4646
+ className
4647
+ ),
4648
+ style,
4649
+ children: [
4650
+ /* @__PURE__ */ jsx(ToolbarButton, { is_active: bold, onClick: onBold, tooltip: "Bold", children: /* @__PURE__ */ jsx(LuBold, { className: "h-4 w-4" }) }),
4651
+ /* @__PURE__ */ jsx(ToolbarButton, { is_active: italic, onClick: onItalic, tooltip: "Italic", children: /* @__PURE__ */ jsx(LuItalic, { className: "h-4 w-4" }) }),
4652
+ /* @__PURE__ */ jsx(
4653
+ ToolbarButton,
4654
+ {
4655
+ is_active: underline,
4656
+ onClick: onUnderline,
4657
+ tooltip: "Underline",
4658
+ children: /* @__PURE__ */ jsx(LuUnderline, { className: "h-4 w-4" })
4659
+ }
4660
+ ),
4661
+ /* @__PURE__ */ jsx("div", { className: "mx-1 h-6 w-px bg-border" }),
4662
+ /* @__PURE__ */ jsx(
4663
+ ToolbarButton,
4664
+ {
4665
+ is_active: align === "left",
4666
+ onClick: () => onAlign?.("left"),
4667
+ tooltip: "Align left",
4668
+ children: /* @__PURE__ */ jsx(LuAlignLeft, { className: "h-4 w-4" })
4669
+ }
4670
+ ),
4671
+ /* @__PURE__ */ jsx(
4672
+ ToolbarButton,
4673
+ {
4674
+ is_active: align === "center",
4675
+ onClick: () => onAlign?.("center"),
4676
+ tooltip: "Align center",
4677
+ children: /* @__PURE__ */ jsx(LuAlignCenter, { className: "h-4 w-4" })
4678
+ }
4679
+ ),
4680
+ /* @__PURE__ */ jsx(
4681
+ ToolbarButton,
4682
+ {
4683
+ is_active: align === "right",
4684
+ onClick: () => onAlign?.("right"),
4685
+ tooltip: "Align right",
4686
+ children: /* @__PURE__ */ jsx(LuAlignRight, { className: "h-4 w-4" })
4687
+ }
4688
+ ),
4689
+ /* @__PURE__ */ jsx("div", { className: "mx-1 h-6 w-px bg-border" }),
4690
+ /* @__PURE__ */ jsxs(
4691
+ "label",
4692
+ {
4693
+ className: "relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md hover:bg-accent",
4694
+ title: "Text color",
4695
+ children: [
4696
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
4697
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-bold text-muted-foreground", children: "A" }),
4698
+ /* @__PURE__ */ jsx(
4699
+ "div",
4700
+ {
4701
+ className: "h-0.5 w-4 mt-0.5 rounded-full",
4702
+ style: { backgroundColor: color2 }
4703
+ }
4704
+ )
4705
+ ] }),
4706
+ /* @__PURE__ */ jsx(
4707
+ "input",
4708
+ {
4709
+ type: "color",
4710
+ value: color2,
4711
+ onChange: (e) => onColor?.(e.target.value),
4712
+ className: "absolute inset-0 h-full w-full cursor-pointer opacity-0"
4713
+ }
4714
+ )
4715
+ ]
4716
+ }
4717
+ )
4718
+ ]
4719
+ }
4720
+ ) });
4721
+ }
4482
4722
  var MdEditorLazy = lazy(() => import('@uiw/react-md-editor'));
4483
4723
  var EDITOR_TEXTAREA_SELECTOR = ".w-md-editor-text-input";
4484
4724
  function MarkdownEditor({
@@ -6455,6 +6695,7 @@ function HazoUiDialog({
6455
6695
  sizeWidth = "min(90vw, 600px)",
6456
6696
  sizeHeight = "min(80vh, 800px)",
6457
6697
  fixedSize = false,
6698
+ compact = false,
6458
6699
  openAnimation = "zoom",
6459
6700
  closeAnimation = "zoom",
6460
6701
  variant = "default",
@@ -6501,8 +6742,8 @@ function HazoUiDialog({
6501
6742
  const headerStyles = {
6502
6743
  ...headerBar && {
6503
6744
  backgroundColor: headerBarColor,
6504
- paddingTop: "1.5rem",
6505
- paddingBottom: "1.5rem",
6745
+ paddingTop: compact ? "0.625rem" : "1.5rem",
6746
+ paddingBottom: compact ? "0.625rem" : "1.5rem",
6506
6747
  paddingLeft: "1.5rem",
6507
6748
  paddingRight: "1.5rem"
6508
6749
  },
@@ -6608,7 +6849,7 @@ function HazoUiDialog({
6608
6849
  {
6609
6850
  className: cn(
6610
6851
  "cls_dialog_header shrink-0",
6611
- !headerBar && "p-6 pb-4",
6852
+ !headerBar && (compact ? "px-6 py-3" : "p-6 pb-4"),
6612
6853
  has_merged_variant_header && "pb-3",
6613
6854
  showCloseButton && "pr-10",
6614
6855
  headerClassName
@@ -6639,7 +6880,11 @@ function HazoUiDialog({
6639
6880
  /* @__PURE__ */ jsx(
6640
6881
  DialogFooter,
6641
6882
  {
6642
- className: cn("cls_dialog_footer shrink-0 p-6 pt-4", footerClassName),
6883
+ className: cn(
6884
+ "cls_dialog_footer shrink-0",
6885
+ compact ? "px-6 py-2.5" : "p-6 pt-4",
6886
+ footerClassName
6887
+ ),
6643
6888
  style: footerStyles,
6644
6889
  children: footerContent ? (
6645
6890
  // Custom footer content replaces default buttons
@@ -10852,6 +11097,6 @@ function HazoUiEtaProgress({
10852
11097
  );
10853
11098
  }
10854
11099
 
10855
- export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CelebrationProvider, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CommandNodeExtension, CommandPill, CommandPopover, DateRangeSelector, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ErrorBanner, ErrorPage, FunnelChart, HazoContextProvider, HazoUiConfirmDialog, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, HazoUiFlexInput, HazoUiFlexRadio, HazoUiImageCropper, HazoUiImageCropperDialog, HazoUiKanban, HazoUiKanbanFilter, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, HazoUiProgressBar, HazoUiRte, HazoUiTable, HazoUiTextarea, HazoUiTextbox, HazoUiToaster, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, InverseSparkline, Label3 as Label, LoadingTimeout, MarkdownEditor, NotificationCountBadge, NotificationItem, NotificationPanel, Popover, PopoverContent, PopoverTrigger, ProgressiveImage, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, SkeletonCircle, SkeletonGroup, SkeletonRect, Slider, Sparkline, Spinner, StackedBars, Switch, Table2 as Table, TableBody, TableCaption, TableCell2 as TableCell, TableFooter, TableHead, TableHeader2 as TableHeader, TableRow2 as TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyKanbanFilter, buttonGroupVariants, celebrate, cn, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
11100
+ export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CELEBRATION_GRADIENT, Calendar, CanvasTextToolbar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CelebrationProvider, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CommandNodeExtension, CommandPill, CommandPopover, DateRangeSelector, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, ErrorBanner, ErrorPage, FunnelChart, HazoContextProvider, HazoUiConfirmDialog, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiEtaProgress, HazoUiFlexInput, HazoUiFlexRadio, HazoUiImageCropper, HazoUiImageCropperDialog, HazoUiKanban, HazoUiKanbanFilter, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, HazoUiProgressBar, HazoUiRte, HazoUiTable, HazoUiTextarea, HazoUiTextbox, HazoUiToaster, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputAffix, InverseSparkline, Label3 as Label, LoadingTimeout, MarkdownEditor, NotificationCountBadge, NotificationItem, NotificationPanel, Popover, PopoverContent, PopoverTrigger, ProgressiveImage, RadioGroup, RadioGroupItem, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, SkeletonCircle, SkeletonGroup, SkeletonRect, Slider, Sparkline, Spinner, StackedBars, Switch, Table2 as Table, TableBody, TableCaption, TableCell2 as TableCell, TableFooter, TableHead, TableHeader2 as TableHeader, TableRow2 as TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, applyKanbanFilter, buttonGroupVariants, celebrate, cn, computeEta, create_command_suggestion_extension, easeToward, errorToast, format_num, generateUUID, get_hazo_ui_config, get_logger, median, parse_commands_from_text, pick_x_label_indices, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, set_logger, successToast, text_to_tiptap_content, toggleVariants, useClickOutside, useCopyToClipboard, useDebounce, useErrorDisplay, useEtaProgress, useFullscreen, useIsMobile, useLoadingState, useLocalStorage, useMediaQuery, useSessionStorage, useViewport, useWakeLock, use_fullscreen, use_wake_lock };
10856
11101
  //# sourceMappingURL=index.js.map
10857
11102
  //# sourceMappingURL=index.js.map