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/CHANGE_LOG.md +38 -0
- package/README.md +89 -0
- package/dist/index.cjs +426 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -2
- package/dist/index.d.ts +69 -2
- package/dist/index.js +427 -182
- package/dist/index.js.map +1 -1
- package/dist/test-harness/index.cjs +111 -38
- package/dist/test-harness/index.cjs.map +1 -1
- package/dist/test-harness/index.js +81 -23
- package/dist/test-harness/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -301,36 +301,14 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
);
|
|
304
|
-
var variant_styles = {
|
|
305
|
-
default: {
|
|
306
|
-
backgroundColor: "hsl(var(--primary))",
|
|
307
|
-
color: "hsl(var(--primary-foreground))",
|
|
308
|
-
border: "1px solid hsl(var(--primary))"
|
|
309
|
-
},
|
|
310
|
-
destructive: {
|
|
311
|
-
backgroundColor: "hsl(var(--destructive))",
|
|
312
|
-
color: "hsl(var(--destructive-foreground))",
|
|
313
|
-
border: "1px solid hsl(var(--destructive))"
|
|
314
|
-
},
|
|
315
|
-
outline: {
|
|
316
|
-
backgroundColor: "hsl(var(--background))",
|
|
317
|
-
color: "hsl(var(--foreground))",
|
|
318
|
-
border: "1px solid hsl(var(--border))"
|
|
319
|
-
},
|
|
320
|
-
secondary: {
|
|
321
|
-
backgroundColor: "hsl(var(--secondary))",
|
|
322
|
-
color: "hsl(var(--secondary-foreground))"
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
304
|
var Button = React26__namespace.forwardRef(
|
|
326
305
|
({ className, variant, size, asChild = false, style, ...props }, ref) => {
|
|
327
306
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
328
|
-
const fallback_styles = variant_styles[variant ?? "default"] ?? {};
|
|
329
307
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
330
308
|
Comp,
|
|
331
309
|
{
|
|
332
310
|
className: cn(buttonVariants({ variant, size, className })),
|
|
333
|
-
style
|
|
311
|
+
style,
|
|
334
312
|
ref,
|
|
335
313
|
...props
|
|
336
314
|
}
|
|
@@ -3315,13 +3293,41 @@ function get_file_extension(filename) {
|
|
|
3315
3293
|
function is_image_file(mime_type) {
|
|
3316
3294
|
return mime_type.startsWith("image/");
|
|
3317
3295
|
}
|
|
3296
|
+
var ALL_ON = {
|
|
3297
|
+
undo_redo: true,
|
|
3298
|
+
block_type: true,
|
|
3299
|
+
font_family: true,
|
|
3300
|
+
font_size: true,
|
|
3301
|
+
bold: true,
|
|
3302
|
+
italic: true,
|
|
3303
|
+
underline: true,
|
|
3304
|
+
strikethrough: true,
|
|
3305
|
+
subscript: true,
|
|
3306
|
+
superscript: true,
|
|
3307
|
+
link: true,
|
|
3308
|
+
clear_formatting: true,
|
|
3309
|
+
text_color: true,
|
|
3310
|
+
highlight_color: true,
|
|
3311
|
+
alignment: true,
|
|
3312
|
+
bullet_list: true,
|
|
3313
|
+
ordered_list: true,
|
|
3314
|
+
task_list: true,
|
|
3315
|
+
indent: true,
|
|
3316
|
+
horizontal_rule: true,
|
|
3317
|
+
image: true,
|
|
3318
|
+
table: true,
|
|
3319
|
+
variables: true,
|
|
3320
|
+
attachment: true
|
|
3321
|
+
};
|
|
3318
3322
|
var ToolbarSeparator = () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cls_rte_toolbar_separator mx-1 h-6 w-px bg-border" });
|
|
3319
3323
|
var Toolbar = ({
|
|
3320
3324
|
editor,
|
|
3321
3325
|
variables = [],
|
|
3322
3326
|
attachments,
|
|
3323
3327
|
on_attachments_change,
|
|
3324
|
-
disabled = false
|
|
3328
|
+
disabled = false,
|
|
3329
|
+
toolbar,
|
|
3330
|
+
font_families
|
|
3325
3331
|
}) => {
|
|
3326
3332
|
const [link_url, set_link_url] = React26__namespace.useState("https://");
|
|
3327
3333
|
const [link_popover_open, set_link_popover_open] = React26__namespace.useState(false);
|
|
@@ -3339,13 +3345,15 @@ var Toolbar = ({
|
|
|
3339
3345
|
if (!editor) {
|
|
3340
3346
|
return null;
|
|
3341
3347
|
}
|
|
3348
|
+
const tb = { ...ALL_ON, ...toolbar };
|
|
3349
|
+
const font_family_options = font_families && font_families.length > 0 ? font_families : FONT_FAMILIES;
|
|
3342
3350
|
const get_current_font_size = () => {
|
|
3343
3351
|
const attrs = editor.getAttributes("textStyle");
|
|
3344
3352
|
return attrs.fontSize || FONT_SIZE_CONFIG.default;
|
|
3345
3353
|
};
|
|
3346
3354
|
const get_current_font_family = () => {
|
|
3347
3355
|
const attrs = editor.getAttributes("textStyle");
|
|
3348
|
-
return attrs.fontFamily ||
|
|
3356
|
+
return attrs.fontFamily || font_family_options[0].value;
|
|
3349
3357
|
};
|
|
3350
3358
|
const get_current_block_type = () => {
|
|
3351
3359
|
if (editor.isActive("heading", { level: 1 })) return "heading-1";
|
|
@@ -3474,44 +3482,46 @@ var Toolbar = ({
|
|
|
3474
3482
|
editor.chain().focus().insertVariable(variable_name).run();
|
|
3475
3483
|
set_variables_menu_open(false);
|
|
3476
3484
|
};
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3485
|
+
const sections = [];
|
|
3486
|
+
if (tb.undo_redo) {
|
|
3487
|
+
sections.push([
|
|
3488
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3489
|
+
ToolbarButton,
|
|
3490
|
+
{
|
|
3491
|
+
onClick: () => editor.chain().focus().undo().run(),
|
|
3492
|
+
disabled: !editor.can().undo(),
|
|
3493
|
+
tooltip: "Undo",
|
|
3494
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuUndo2, { className: "h-4 w-4" })
|
|
3495
|
+
},
|
|
3496
|
+
"undo"
|
|
3486
3497
|
),
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {}),
|
|
3498
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3499
|
+
ToolbarButton,
|
|
3500
|
+
{
|
|
3501
|
+
onClick: () => editor.chain().focus().redo().run(),
|
|
3502
|
+
disabled: !editor.can().redo(),
|
|
3503
|
+
tooltip: "Redo",
|
|
3504
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuRedo2, { className: "h-4 w-4" })
|
|
3505
|
+
},
|
|
3506
|
+
"redo"
|
|
3507
|
+
)
|
|
3508
|
+
]);
|
|
3509
|
+
}
|
|
3510
|
+
if (tb.block_type) {
|
|
3511
|
+
sections.push([
|
|
3512
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: get_current_block_type(), onValueChange: handle_block_type_change, children: [
|
|
3513
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[130px] text-xs", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
3514
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: BLOCK_TYPES.map((type) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: type.value, className: "text-xs", children: type.label }, type.value)) })
|
|
3515
|
+
] }, "block")
|
|
3516
|
+
]);
|
|
3517
|
+
}
|
|
3518
|
+
{
|
|
3519
|
+
const items = [];
|
|
3520
|
+
if (tb.font_family) {
|
|
3521
|
+
items.push(
|
|
3512
3522
|
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: get_current_font_family(), onValueChange: handle_font_family_change, children: [
|
|
3513
3523
|
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-8 w-[120px] text-xs", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
3514
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children:
|
|
3524
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: font_family_options.map((font) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3515
3525
|
SelectItem,
|
|
3516
3526
|
{
|
|
3517
3527
|
value: font.value,
|
|
@@ -3521,7 +3531,11 @@ var Toolbar = ({
|
|
|
3521
3531
|
},
|
|
3522
3532
|
font.value
|
|
3523
3533
|
)) })
|
|
3524
|
-
] })
|
|
3534
|
+
] }, "family")
|
|
3535
|
+
);
|
|
3536
|
+
}
|
|
3537
|
+
if (tb.font_size) {
|
|
3538
|
+
items.push(
|
|
3525
3539
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center", children: [
|
|
3526
3540
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3527
3541
|
ToolbarButton,
|
|
@@ -3540,8 +3554,15 @@ var Toolbar = ({
|
|
|
3540
3554
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuPlus, { className: "h-3 w-3" })
|
|
3541
3555
|
}
|
|
3542
3556
|
)
|
|
3543
|
-
] })
|
|
3544
|
-
|
|
3557
|
+
] }, "size")
|
|
3558
|
+
);
|
|
3559
|
+
}
|
|
3560
|
+
if (items.length) sections.push(items);
|
|
3561
|
+
}
|
|
3562
|
+
{
|
|
3563
|
+
const items = [];
|
|
3564
|
+
if (tb.bold) {
|
|
3565
|
+
items.push(
|
|
3545
3566
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3546
3567
|
ToolbarButton,
|
|
3547
3568
|
{
|
|
@@ -3549,8 +3570,13 @@ var Toolbar = ({
|
|
|
3549
3570
|
is_active: editor.isActive("bold"),
|
|
3550
3571
|
tooltip: "Bold",
|
|
3551
3572
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuBold, { className: "h-4 w-4" })
|
|
3552
|
-
}
|
|
3553
|
-
|
|
3573
|
+
},
|
|
3574
|
+
"bold"
|
|
3575
|
+
)
|
|
3576
|
+
);
|
|
3577
|
+
}
|
|
3578
|
+
if (tb.italic) {
|
|
3579
|
+
items.push(
|
|
3554
3580
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3555
3581
|
ToolbarButton,
|
|
3556
3582
|
{
|
|
@@ -3558,8 +3584,13 @@ var Toolbar = ({
|
|
|
3558
3584
|
is_active: editor.isActive("italic"),
|
|
3559
3585
|
tooltip: "Italic",
|
|
3560
3586
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuItalic, { className: "h-4 w-4" })
|
|
3561
|
-
}
|
|
3562
|
-
|
|
3587
|
+
},
|
|
3588
|
+
"italic"
|
|
3589
|
+
)
|
|
3590
|
+
);
|
|
3591
|
+
}
|
|
3592
|
+
if (tb.underline) {
|
|
3593
|
+
items.push(
|
|
3563
3594
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3564
3595
|
ToolbarButton,
|
|
3565
3596
|
{
|
|
@@ -3567,8 +3598,13 @@ var Toolbar = ({
|
|
|
3567
3598
|
is_active: editor.isActive("underline"),
|
|
3568
3599
|
tooltip: "Underline",
|
|
3569
3600
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuUnderline, { className: "h-4 w-4" })
|
|
3570
|
-
}
|
|
3571
|
-
|
|
3601
|
+
},
|
|
3602
|
+
"underline"
|
|
3603
|
+
)
|
|
3604
|
+
);
|
|
3605
|
+
}
|
|
3606
|
+
if (tb.strikethrough) {
|
|
3607
|
+
items.push(
|
|
3572
3608
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3573
3609
|
ToolbarButton,
|
|
3574
3610
|
{
|
|
@@ -3576,8 +3612,13 @@ var Toolbar = ({
|
|
|
3576
3612
|
is_active: editor.isActive("strike"),
|
|
3577
3613
|
tooltip: "Strikethrough",
|
|
3578
3614
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuStrikethrough, { className: "h-4 w-4" })
|
|
3579
|
-
}
|
|
3580
|
-
|
|
3615
|
+
},
|
|
3616
|
+
"strike"
|
|
3617
|
+
)
|
|
3618
|
+
);
|
|
3619
|
+
}
|
|
3620
|
+
if (tb.subscript) {
|
|
3621
|
+
items.push(
|
|
3581
3622
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3582
3623
|
ToolbarButton,
|
|
3583
3624
|
{
|
|
@@ -3585,8 +3626,13 @@ var Toolbar = ({
|
|
|
3585
3626
|
is_active: editor.isActive("subscript"),
|
|
3586
3627
|
tooltip: "Subscript",
|
|
3587
3628
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuSubscript, { className: "h-4 w-4" })
|
|
3588
|
-
}
|
|
3589
|
-
|
|
3629
|
+
},
|
|
3630
|
+
"sub"
|
|
3631
|
+
)
|
|
3632
|
+
);
|
|
3633
|
+
}
|
|
3634
|
+
if (tb.superscript) {
|
|
3635
|
+
items.push(
|
|
3590
3636
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3591
3637
|
ToolbarButton,
|
|
3592
3638
|
{
|
|
@@ -3594,9 +3640,17 @@ var Toolbar = ({
|
|
|
3594
3640
|
is_active: editor.isActive("superscript"),
|
|
3595
3641
|
tooltip: "Superscript",
|
|
3596
3642
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuSuperscript, { className: "h-4 w-4" })
|
|
3597
|
-
}
|
|
3598
|
-
|
|
3599
|
-
|
|
3643
|
+
},
|
|
3644
|
+
"super"
|
|
3645
|
+
)
|
|
3646
|
+
);
|
|
3647
|
+
}
|
|
3648
|
+
if (items.length) sections.push(items);
|
|
3649
|
+
}
|
|
3650
|
+
{
|
|
3651
|
+
const items = [];
|
|
3652
|
+
if (tb.link) {
|
|
3653
|
+
items.push(
|
|
3600
3654
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: link_popover_open, onOpenChange: set_link_popover_open, children: [
|
|
3601
3655
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { is_active: editor.isActive("link"), tooltip: "Link", children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuLink, { className: "h-4 w-4" }) }) }),
|
|
3602
3656
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-80 p-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
@@ -3625,16 +3679,28 @@ var Toolbar = ({
|
|
|
3625
3679
|
)
|
|
3626
3680
|
] })
|
|
3627
3681
|
] }) })
|
|
3628
|
-
] })
|
|
3682
|
+
] }, "link")
|
|
3683
|
+
);
|
|
3684
|
+
}
|
|
3685
|
+
if (tb.clear_formatting) {
|
|
3686
|
+
items.push(
|
|
3629
3687
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3630
3688
|
ToolbarButton,
|
|
3631
3689
|
{
|
|
3632
3690
|
onClick: () => editor.chain().focus().unsetAllMarks().clearNodes().run(),
|
|
3633
3691
|
tooltip: "Clear formatting",
|
|
3634
3692
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuRemoveFormatting, { className: "h-4 w-4" })
|
|
3635
|
-
}
|
|
3636
|
-
|
|
3637
|
-
|
|
3693
|
+
},
|
|
3694
|
+
"clear"
|
|
3695
|
+
)
|
|
3696
|
+
);
|
|
3697
|
+
}
|
|
3698
|
+
if (items.length) sections.push(items);
|
|
3699
|
+
}
|
|
3700
|
+
{
|
|
3701
|
+
const items = [];
|
|
3702
|
+
if (tb.text_color) {
|
|
3703
|
+
items.push(
|
|
3638
3704
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: text_color_open, onOpenChange: set_text_color_open, children: [
|
|
3639
3705
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { tooltip: "Text color", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
3640
3706
|
/* @__PURE__ */ jsxRuntime.jsx(lu.LuPalette, { className: "h-4 w-4" }),
|
|
@@ -3673,7 +3739,11 @@ var Toolbar = ({
|
|
|
3673
3739
|
]
|
|
3674
3740
|
}
|
|
3675
3741
|
) })
|
|
3676
|
-
] })
|
|
3742
|
+
] }, "textcolor")
|
|
3743
|
+
);
|
|
3744
|
+
}
|
|
3745
|
+
if (tb.highlight_color) {
|
|
3746
|
+
items.push(
|
|
3677
3747
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: highlight_color_open, onOpenChange: set_highlight_color_open, children: [
|
|
3678
3748
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { tooltip: "Highlight color", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
3679
3749
|
/* @__PURE__ */ jsxRuntime.jsx(lu.LuHighlighter, { className: "h-4 w-4" }),
|
|
@@ -3706,45 +3776,59 @@ var Toolbar = ({
|
|
|
3706
3776
|
]
|
|
3707
3777
|
}
|
|
3708
3778
|
) })
|
|
3709
|
-
] })
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
{
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
{
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3779
|
+
] }, "highlight")
|
|
3780
|
+
);
|
|
3781
|
+
}
|
|
3782
|
+
if (items.length) sections.push(items);
|
|
3783
|
+
}
|
|
3784
|
+
if (tb.alignment) {
|
|
3785
|
+
sections.push([
|
|
3786
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3787
|
+
ToolbarButton,
|
|
3788
|
+
{
|
|
3789
|
+
onClick: () => editor.chain().focus().setTextAlign("left").run(),
|
|
3790
|
+
is_active: editor.isActive({ textAlign: "left" }),
|
|
3791
|
+
tooltip: "Align left",
|
|
3792
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuAlignLeft, { className: "h-4 w-4" })
|
|
3793
|
+
},
|
|
3794
|
+
"align-left"
|
|
3795
|
+
),
|
|
3796
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3797
|
+
ToolbarButton,
|
|
3798
|
+
{
|
|
3799
|
+
onClick: () => editor.chain().focus().setTextAlign("center").run(),
|
|
3800
|
+
is_active: editor.isActive({ textAlign: "center" }),
|
|
3801
|
+
tooltip: "Align center",
|
|
3802
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuAlignCenter, { className: "h-4 w-4" })
|
|
3803
|
+
},
|
|
3804
|
+
"align-center"
|
|
3805
|
+
),
|
|
3806
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3807
|
+
ToolbarButton,
|
|
3808
|
+
{
|
|
3809
|
+
onClick: () => editor.chain().focus().setTextAlign("right").run(),
|
|
3810
|
+
is_active: editor.isActive({ textAlign: "right" }),
|
|
3811
|
+
tooltip: "Align right",
|
|
3812
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuAlignRight, { className: "h-4 w-4" })
|
|
3813
|
+
},
|
|
3814
|
+
"align-right"
|
|
3815
|
+
),
|
|
3816
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3817
|
+
ToolbarButton,
|
|
3818
|
+
{
|
|
3819
|
+
onClick: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
3820
|
+
is_active: editor.isActive({ textAlign: "justify" }),
|
|
3821
|
+
tooltip: "Justify",
|
|
3822
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuAlignJustify, { className: "h-4 w-4" })
|
|
3823
|
+
},
|
|
3824
|
+
"align-justify"
|
|
3825
|
+
)
|
|
3826
|
+
]);
|
|
3827
|
+
}
|
|
3828
|
+
{
|
|
3829
|
+
const items = [];
|
|
3830
|
+
if (tb.bullet_list) {
|
|
3831
|
+
items.push(
|
|
3748
3832
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3749
3833
|
ToolbarButton,
|
|
3750
3834
|
{
|
|
@@ -3752,8 +3836,13 @@ var Toolbar = ({
|
|
|
3752
3836
|
is_active: editor.isActive("bulletList"),
|
|
3753
3837
|
tooltip: "Bullet list",
|
|
3754
3838
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuList, { className: "h-4 w-4" })
|
|
3755
|
-
}
|
|
3756
|
-
|
|
3839
|
+
},
|
|
3840
|
+
"bullet"
|
|
3841
|
+
)
|
|
3842
|
+
);
|
|
3843
|
+
}
|
|
3844
|
+
if (tb.ordered_list) {
|
|
3845
|
+
items.push(
|
|
3757
3846
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3758
3847
|
ToolbarButton,
|
|
3759
3848
|
{
|
|
@@ -3761,8 +3850,13 @@ var Toolbar = ({
|
|
|
3761
3850
|
is_active: editor.isActive("orderedList"),
|
|
3762
3851
|
tooltip: "Numbered list",
|
|
3763
3852
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuListOrdered, { className: "h-4 w-4" })
|
|
3764
|
-
}
|
|
3765
|
-
|
|
3853
|
+
},
|
|
3854
|
+
"ordered"
|
|
3855
|
+
)
|
|
3856
|
+
);
|
|
3857
|
+
}
|
|
3858
|
+
if (tb.task_list) {
|
|
3859
|
+
items.push(
|
|
3766
3860
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3767
3861
|
ToolbarButton,
|
|
3768
3862
|
{
|
|
@@ -3770,56 +3864,71 @@ var Toolbar = ({
|
|
|
3770
3864
|
is_active: editor.isActive("taskList"),
|
|
3771
3865
|
tooltip: "Checklist",
|
|
3772
3866
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuListChecks, { className: "h-4 w-4" })
|
|
3773
|
-
}
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3867
|
+
},
|
|
3868
|
+
"task"
|
|
3869
|
+
)
|
|
3870
|
+
);
|
|
3871
|
+
}
|
|
3872
|
+
if (items.length) sections.push(items);
|
|
3873
|
+
}
|
|
3874
|
+
if (tb.indent) {
|
|
3875
|
+
sections.push([
|
|
3876
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3877
|
+
ToolbarButton,
|
|
3878
|
+
{
|
|
3879
|
+
onClick: () => {
|
|
3880
|
+
if (editor.isActive("listItem")) {
|
|
3881
|
+
editor.chain().focus().liftListItem("listItem").run();
|
|
3882
|
+
} else if (editor.isActive("taskItem")) {
|
|
3883
|
+
editor.chain().focus().liftListItem("taskItem").run();
|
|
3884
|
+
}
|
|
3885
|
+
},
|
|
3886
|
+
disabled: !editor.can().liftListItem("listItem") && !editor.can().liftListItem("taskItem"),
|
|
3887
|
+
tooltip: "Decrease indent",
|
|
3888
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuIndentDecrease, { className: "h-4 w-4" })
|
|
3889
|
+
},
|
|
3890
|
+
"indent-dec"
|
|
3891
|
+
),
|
|
3892
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3893
|
+
ToolbarButton,
|
|
3894
|
+
{
|
|
3895
|
+
onClick: () => {
|
|
3896
|
+
if (editor.isActive("listItem")) {
|
|
3897
|
+
editor.chain().focus().sinkListItem("listItem").run();
|
|
3898
|
+
} else if (editor.isActive("taskItem")) {
|
|
3899
|
+
editor.chain().focus().sinkListItem("taskItem").run();
|
|
3900
|
+
}
|
|
3901
|
+
},
|
|
3902
|
+
disabled: !editor.can().sinkListItem("listItem") && !editor.can().sinkListItem("taskItem"),
|
|
3903
|
+
tooltip: "Increase indent",
|
|
3904
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuIndentIncrease, { className: "h-4 w-4" })
|
|
3905
|
+
},
|
|
3906
|
+
"indent-inc"
|
|
3907
|
+
)
|
|
3908
|
+
]);
|
|
3909
|
+
}
|
|
3910
|
+
{
|
|
3911
|
+
const items = [];
|
|
3912
|
+
if (tb.horizontal_rule) {
|
|
3913
|
+
items.push(
|
|
3914
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { onClick: handle_hr_insert, tooltip: "Horizontal rule", children: /* @__PURE__ */ jsxRuntime.jsx(rx.RxDividerHorizontal, { className: "h-4 w-4" }) }, "hr")
|
|
3915
|
+
);
|
|
3916
|
+
}
|
|
3917
|
+
if (tb.image) {
|
|
3918
|
+
items.push(
|
|
3815
3919
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3816
3920
|
ToolbarButton,
|
|
3817
3921
|
{
|
|
3818
3922
|
onClick: () => image_input_ref.current?.click(),
|
|
3819
3923
|
tooltip: "Insert image",
|
|
3820
3924
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuImage, { className: "h-4 w-4" })
|
|
3821
|
-
}
|
|
3822
|
-
|
|
3925
|
+
},
|
|
3926
|
+
"image"
|
|
3927
|
+
)
|
|
3928
|
+
);
|
|
3929
|
+
}
|
|
3930
|
+
if (tb.table) {
|
|
3931
|
+
items.push(
|
|
3823
3932
|
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: table_menu_open, onOpenChange: set_table_menu_open, children: [
|
|
3824
3933
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3825
3934
|
ToolbarButton,
|
|
@@ -3987,9 +4096,16 @@ var Toolbar = ({
|
|
|
3987
4096
|
] })
|
|
3988
4097
|
] })
|
|
3989
4098
|
) })
|
|
3990
|
-
] })
|
|
3991
|
-
|
|
3992
|
-
|
|
4099
|
+
] }, "table")
|
|
4100
|
+
);
|
|
4101
|
+
}
|
|
4102
|
+
if (items.length) sections.push(items);
|
|
4103
|
+
}
|
|
4104
|
+
{
|
|
4105
|
+
const items = [];
|
|
4106
|
+
if (tb.variables && variables.length > 0) {
|
|
4107
|
+
items.push(
|
|
4108
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Popover, { open: variables_menu_open, onOpenChange: set_variables_menu_open, children: [
|
|
3993
4109
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { tooltip: "Insert variable", children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuVariable, { className: "h-4 w-4" }) }) }),
|
|
3994
4110
|
/* @__PURE__ */ jsxRuntime.jsx(PopoverContent, { className: "w-64 p-0", align: "start", children: /* @__PURE__ */ jsxRuntime.jsxs(Command, { children: [
|
|
3995
4111
|
/* @__PURE__ */ jsxRuntime.jsx(CommandInput, { placeholder: "Search variables...", className: "h-8 text-xs" }),
|
|
@@ -4010,15 +4126,39 @@ var Toolbar = ({
|
|
|
4010
4126
|
)) })
|
|
4011
4127
|
] })
|
|
4012
4128
|
] }) })
|
|
4013
|
-
] })
|
|
4129
|
+
] }, "vars")
|
|
4130
|
+
);
|
|
4131
|
+
}
|
|
4132
|
+
if (tb.attachment) {
|
|
4133
|
+
items.push(
|
|
4014
4134
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4015
4135
|
ToolbarButton,
|
|
4016
4136
|
{
|
|
4017
4137
|
onClick: () => file_input_ref.current?.click(),
|
|
4018
4138
|
tooltip: "Attach file",
|
|
4019
4139
|
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuPaperclip, { className: "h-4 w-4" })
|
|
4020
|
-
}
|
|
4021
|
-
|
|
4140
|
+
},
|
|
4141
|
+
"attach"
|
|
4142
|
+
)
|
|
4143
|
+
);
|
|
4144
|
+
}
|
|
4145
|
+
if (items.length) sections.push(items);
|
|
4146
|
+
}
|
|
4147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4148
|
+
"div",
|
|
4149
|
+
{
|
|
4150
|
+
className: cn(
|
|
4151
|
+
"cls_rte_toolbar",
|
|
4152
|
+
"flex flex-wrap items-center gap-0.5",
|
|
4153
|
+
"p-1.5 rounded-t-md",
|
|
4154
|
+
"bg-muted border-b border-border",
|
|
4155
|
+
disabled && "opacity-50 pointer-events-none"
|
|
4156
|
+
),
|
|
4157
|
+
children: [
|
|
4158
|
+
sections.map((items, i) => /* @__PURE__ */ jsxRuntime.jsxs(React26__namespace.Fragment, { children: [
|
|
4159
|
+
i > 0 && /* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {}),
|
|
4160
|
+
items
|
|
4161
|
+
] }, i)),
|
|
4022
4162
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4023
4163
|
"input",
|
|
4024
4164
|
{
|
|
@@ -4325,7 +4465,9 @@ var HazoUiRte = ({
|
|
|
4325
4465
|
max_height = "400px",
|
|
4326
4466
|
disabled = false,
|
|
4327
4467
|
className,
|
|
4328
|
-
show_output_viewer = false
|
|
4468
|
+
show_output_viewer = false,
|
|
4469
|
+
toolbar,
|
|
4470
|
+
font_families
|
|
4329
4471
|
}) => {
|
|
4330
4472
|
const [attachments, set_attachments] = React26__namespace.useState(
|
|
4331
4473
|
initial_attachments
|
|
@@ -4514,7 +4656,9 @@ var HazoUiRte = ({
|
|
|
4514
4656
|
variables,
|
|
4515
4657
|
attachments,
|
|
4516
4658
|
on_attachments_change: handle_attachments_change,
|
|
4517
|
-
disabled: disabled || is_view_only
|
|
4659
|
+
disabled: disabled || is_view_only,
|
|
4660
|
+
toolbar,
|
|
4661
|
+
font_families
|
|
4518
4662
|
}
|
|
4519
4663
|
),
|
|
4520
4664
|
show_output_viewer && editor && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cls_rte_tabs border-b border-border px-2 pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(Tabs, { value: active_tab, onValueChange: (v) => set_active_tab(v), children: /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "h-9", children: [
|
|
@@ -4549,6 +4693,102 @@ var HazoUiRte = ({
|
|
|
4549
4693
|
);
|
|
4550
4694
|
};
|
|
4551
4695
|
HazoUiRte.displayName = "HazoUiRte";
|
|
4696
|
+
function CanvasTextToolbar({
|
|
4697
|
+
bold,
|
|
4698
|
+
italic,
|
|
4699
|
+
underline,
|
|
4700
|
+
color: color2 = "#000000",
|
|
4701
|
+
align = "left",
|
|
4702
|
+
onBold,
|
|
4703
|
+
onItalic,
|
|
4704
|
+
onUnderline,
|
|
4705
|
+
onColor,
|
|
4706
|
+
onAlign,
|
|
4707
|
+
className,
|
|
4708
|
+
style
|
|
4709
|
+
}) {
|
|
4710
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4711
|
+
"div",
|
|
4712
|
+
{
|
|
4713
|
+
className: cn(
|
|
4714
|
+
"flex items-center gap-0.5 p-1.5 rounded-md",
|
|
4715
|
+
"bg-background border border-border shadow-md",
|
|
4716
|
+
className
|
|
4717
|
+
),
|
|
4718
|
+
style,
|
|
4719
|
+
children: [
|
|
4720
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { is_active: bold, onClick: onBold, tooltip: "Bold", children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuBold, { className: "h-4 w-4" }) }),
|
|
4721
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToolbarButton, { is_active: italic, onClick: onItalic, tooltip: "Italic", children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuItalic, { className: "h-4 w-4" }) }),
|
|
4722
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4723
|
+
ToolbarButton,
|
|
4724
|
+
{
|
|
4725
|
+
is_active: underline,
|
|
4726
|
+
onClick: onUnderline,
|
|
4727
|
+
tooltip: "Underline",
|
|
4728
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuUnderline, { className: "h-4 w-4" })
|
|
4729
|
+
}
|
|
4730
|
+
),
|
|
4731
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-1 h-6 w-px bg-border" }),
|
|
4732
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4733
|
+
ToolbarButton,
|
|
4734
|
+
{
|
|
4735
|
+
is_active: align === "left",
|
|
4736
|
+
onClick: () => onAlign?.("left"),
|
|
4737
|
+
tooltip: "Align left",
|
|
4738
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuAlignLeft, { className: "h-4 w-4" })
|
|
4739
|
+
}
|
|
4740
|
+
),
|
|
4741
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4742
|
+
ToolbarButton,
|
|
4743
|
+
{
|
|
4744
|
+
is_active: align === "center",
|
|
4745
|
+
onClick: () => onAlign?.("center"),
|
|
4746
|
+
tooltip: "Align center",
|
|
4747
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuAlignCenter, { className: "h-4 w-4" })
|
|
4748
|
+
}
|
|
4749
|
+
),
|
|
4750
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4751
|
+
ToolbarButton,
|
|
4752
|
+
{
|
|
4753
|
+
is_active: align === "right",
|
|
4754
|
+
onClick: () => onAlign?.("right"),
|
|
4755
|
+
tooltip: "Align right",
|
|
4756
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu.LuAlignRight, { className: "h-4 w-4" })
|
|
4757
|
+
}
|
|
4758
|
+
),
|
|
4759
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-1 h-6 w-px bg-border" }),
|
|
4760
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4761
|
+
"label",
|
|
4762
|
+
{
|
|
4763
|
+
className: "relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-md hover:bg-accent",
|
|
4764
|
+
title: "Text color",
|
|
4765
|
+
children: [
|
|
4766
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center", children: [
|
|
4767
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-bold text-muted-foreground", children: "A" }),
|
|
4768
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4769
|
+
"div",
|
|
4770
|
+
{
|
|
4771
|
+
className: "h-0.5 w-4 mt-0.5 rounded-full",
|
|
4772
|
+
style: { backgroundColor: color2 }
|
|
4773
|
+
}
|
|
4774
|
+
)
|
|
4775
|
+
] }),
|
|
4776
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4777
|
+
"input",
|
|
4778
|
+
{
|
|
4779
|
+
type: "color",
|
|
4780
|
+
value: color2,
|
|
4781
|
+
onChange: (e) => onColor?.(e.target.value),
|
|
4782
|
+
className: "absolute inset-0 h-full w-full cursor-pointer opacity-0"
|
|
4783
|
+
}
|
|
4784
|
+
)
|
|
4785
|
+
]
|
|
4786
|
+
}
|
|
4787
|
+
)
|
|
4788
|
+
]
|
|
4789
|
+
}
|
|
4790
|
+
) });
|
|
4791
|
+
}
|
|
4552
4792
|
var MdEditorLazy = React26.lazy(() => import('@uiw/react-md-editor'));
|
|
4553
4793
|
var EDITOR_TEXTAREA_SELECTOR = ".w-md-editor-text-input";
|
|
4554
4794
|
function MarkdownEditor({
|
|
@@ -6525,6 +6765,7 @@ function HazoUiDialog({
|
|
|
6525
6765
|
sizeWidth = "min(90vw, 600px)",
|
|
6526
6766
|
sizeHeight = "min(80vh, 800px)",
|
|
6527
6767
|
fixedSize = false,
|
|
6768
|
+
compact = false,
|
|
6528
6769
|
openAnimation = "zoom",
|
|
6529
6770
|
closeAnimation = "zoom",
|
|
6530
6771
|
variant = "default",
|
|
@@ -6571,8 +6812,8 @@ function HazoUiDialog({
|
|
|
6571
6812
|
const headerStyles = {
|
|
6572
6813
|
...headerBar && {
|
|
6573
6814
|
backgroundColor: headerBarColor,
|
|
6574
|
-
paddingTop: "1.5rem",
|
|
6575
|
-
paddingBottom: "1.5rem",
|
|
6815
|
+
paddingTop: compact ? "0.625rem" : "1.5rem",
|
|
6816
|
+
paddingBottom: compact ? "0.625rem" : "1.5rem",
|
|
6576
6817
|
paddingLeft: "1.5rem",
|
|
6577
6818
|
paddingRight: "1.5rem"
|
|
6578
6819
|
},
|
|
@@ -6678,7 +6919,7 @@ function HazoUiDialog({
|
|
|
6678
6919
|
{
|
|
6679
6920
|
className: cn(
|
|
6680
6921
|
"cls_dialog_header shrink-0",
|
|
6681
|
-
!headerBar && "p-6 pb-4",
|
|
6922
|
+
!headerBar && (compact ? "px-6 py-3" : "p-6 pb-4"),
|
|
6682
6923
|
has_merged_variant_header && "pb-3",
|
|
6683
6924
|
showCloseButton && "pr-10",
|
|
6684
6925
|
headerClassName
|
|
@@ -6709,7 +6950,11 @@ function HazoUiDialog({
|
|
|
6709
6950
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6710
6951
|
DialogFooter,
|
|
6711
6952
|
{
|
|
6712
|
-
className: cn(
|
|
6953
|
+
className: cn(
|
|
6954
|
+
"cls_dialog_footer shrink-0",
|
|
6955
|
+
compact ? "px-6 py-2.5" : "p-6 pt-4",
|
|
6956
|
+
footerClassName
|
|
6957
|
+
),
|
|
6713
6958
|
style: footerStyles,
|
|
6714
6959
|
children: footerContent ? (
|
|
6715
6960
|
// Custom footer content replaces default buttons
|
|
@@ -10948,6 +11193,7 @@ exports.ButtonGroupSeparator = ButtonGroupSeparator;
|
|
|
10948
11193
|
exports.ButtonGroupText = ButtonGroupText;
|
|
10949
11194
|
exports.CELEBRATION_GRADIENT = CELEBRATION_GRADIENT;
|
|
10950
11195
|
exports.Calendar = Calendar;
|
|
11196
|
+
exports.CanvasTextToolbar = CanvasTextToolbar;
|
|
10951
11197
|
exports.Card = Card;
|
|
10952
11198
|
exports.CardContent = CardContent;
|
|
10953
11199
|
exports.CardDescription = CardDescription;
|