@ckc-net/puck-extended 0.2.2 → 0.4.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/LICENSE +1 -1
- package/README.md +200 -0
- package/dist/index.d.ts +293 -222
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1248 -489
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import React, { Children, cloneElement,
|
|
1
|
+
import React, { Children, cloneElement, isValidElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
2
5
|
import { clsx } from "clsx";
|
|
3
6
|
import { twMerge } from "tailwind-merge";
|
|
4
|
-
import { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, BaselineIcon, BoldIcon, BoxIcon, CaseLowerIcon, CaseSensitiveIcon, CaseUpperIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleAlertIcon, CircleCheckIcon, DatabaseIcon, FileIcon, FileTextIcon, GripVerticalIcon, InfoIcon, ItalicIcon, LightbulbIcon, LinkIcon, Loader2Icon, LoaderCircleIcon, LockIcon, MinusIcon, MoreHorizontalIcon, SearchIcon, StrikethroughIcon, TriangleAlertIcon, UnderlineIcon, UploadIcon, XIcon } from "lucide-react";
|
|
7
|
+
import { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, BaselineIcon, BoldIcon, BoxIcon, CaseLowerIcon, CaseSensitiveIcon, CaseUpperIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronsUpDownIcon, CircleAlertIcon, CircleCheckIcon, DatabaseIcon, FileIcon, FileTextIcon, GripVerticalIcon, InfoIcon, ItalicIcon, LightbulbIcon, LinkIcon, Loader2Icon, LoaderCircleIcon, LockIcon, MinusIcon, MoreHorizontalIcon, PlusIcon, SearchIcon, SparklesIcon, StrikethroughIcon, Trash2Icon, TriangleAlertIcon, UnderlineIcon, UploadIcon, XIcon } from "lucide-react";
|
|
5
8
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
6
10
|
import { Checkbox as Checkbox$1 } from "@base-ui/react/checkbox";
|
|
7
11
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
8
|
-
import { mergeProps } from "@base-ui/react/merge-props";
|
|
9
12
|
import { Select as Select$1 } from "@base-ui/react/select";
|
|
10
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
11
|
-
import { cva } from "class-variance-authority";
|
|
12
13
|
import { Radio } from "@base-ui/react/radio";
|
|
13
14
|
import { RadioGroup as RadioGroup$1 } from "@base-ui/react/radio-group";
|
|
14
15
|
import { Field } from "@base-ui/react/field";
|
|
15
|
-
import { createUsePuck } from "@puckeditor/core";
|
|
16
|
+
import { AutoField, createUsePuck, walkTree } from "@puckeditor/core";
|
|
16
17
|
import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
|
|
17
|
-
import { Accordion as
|
|
18
|
-
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
18
|
+
import { Accordion as AccordionPrimitive } from "@base-ui/react/accordion";
|
|
19
19
|
import { Popover as Popover$1 } from "@base-ui/react/popover";
|
|
20
20
|
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
21
21
|
import { ScrollArea as ScrollArea$1 } from "@base-ui/react/scroll-area";
|
|
@@ -23,7 +23,7 @@ import { flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-tabl
|
|
|
23
23
|
import { Color } from "@tiptap/extension-color";
|
|
24
24
|
import { TextStyle } from "@tiptap/extension-text-style";
|
|
25
25
|
import { HexColorPicker } from "react-colorful";
|
|
26
|
-
import { Menu as
|
|
26
|
+
import { Menu as MenuPrimitive } from "@base-ui/react/menu";
|
|
27
27
|
import { Separator as Separator$1 } from "@base-ui/react/separator";
|
|
28
28
|
import { Switch as Switch$1 } from "@base-ui/react/switch";
|
|
29
29
|
import { Toast } from "@base-ui/react/toast";
|
|
@@ -33,6 +33,55 @@ function cn(...inputs) {
|
|
|
33
33
|
return twMerge(clsx(inputs));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/components/ui/button.tsx
|
|
38
|
+
const buttonVariants = cva("[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
size: "default",
|
|
41
|
+
variant: "default"
|
|
42
|
+
},
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
default: "h-9 px-[calc(--spacing(3)-1px)] sm:h-8",
|
|
46
|
+
icon: "size-9 sm:size-8",
|
|
47
|
+
"icon-lg": "size-10 sm:size-9",
|
|
48
|
+
"icon-sm": "size-8 sm:size-7",
|
|
49
|
+
"icon-xl": "size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
|
|
50
|
+
"icon-xs": "size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5",
|
|
51
|
+
lg: "h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",
|
|
52
|
+
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7",
|
|
53
|
+
xl: "h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
|
|
54
|
+
xs: "h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5"
|
|
55
|
+
},
|
|
56
|
+
variant: {
|
|
57
|
+
default: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-primary/90",
|
|
58
|
+
destructive: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-destructive/90",
|
|
59
|
+
"destructive-outline": "border-input bg-transparent not-dark:bg-clip-padding text-destructive-foreground not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/6%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/32 [:hover,[data-pressed]]:bg-destructive/4",
|
|
60
|
+
ghost: "border-transparent data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent",
|
|
61
|
+
link: "border-transparent underline-offset-4 [:hover,[data-pressed]]:underline",
|
|
62
|
+
outline: "border-input bg-background not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/6%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
|
|
63
|
+
primary: "border-transparent from-primary-600 to-primary-500 hover:from-primary-500 hover:to-primary-600 bg-linear-to-t text-white inset-shadow-[0_2px_0_0] inset-shadow-white/25 hover:text-white",
|
|
64
|
+
secondary: "border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
function Button({ className, variant, size, render, ...props }) {
|
|
69
|
+
const typeValue = render ? void 0 : "button";
|
|
70
|
+
return useRender({
|
|
71
|
+
defaultTagName: "button",
|
|
72
|
+
props: mergeProps({
|
|
73
|
+
className: cn(buttonVariants({
|
|
74
|
+
className,
|
|
75
|
+
size,
|
|
76
|
+
variant
|
|
77
|
+
})),
|
|
78
|
+
"data-slot": "button",
|
|
79
|
+
type: typeValue
|
|
80
|
+
}, props),
|
|
81
|
+
render
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
36
85
|
//#endregion
|
|
37
86
|
//#region src/components/ui/label.tsx
|
|
38
87
|
function Label$2({ className, readOnly, children, ...props }) {
|
|
@@ -45,11 +94,198 @@ function Label$2({ className, readOnly, children, ...props }) {
|
|
|
45
94
|
});
|
|
46
95
|
}
|
|
47
96
|
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/components/ui/tooltip.tsx
|
|
99
|
+
const cssAnimationPresets = {
|
|
100
|
+
none: "transition-none",
|
|
101
|
+
scale: [`[transition-property:scale,opacity]`, `data-starting-style:scale-80 data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:scale-80`],
|
|
102
|
+
fade: [`[transition-property:opacity,scale]`, `data-starting-style:scale-98 data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:scale-98`],
|
|
103
|
+
slideOutside: [
|
|
104
|
+
`[transition-property:translate,opacity]`,
|
|
105
|
+
`data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:translate-y-[10px] data-[side=bottom]:data-ending-style:translate-y-[10px] data-[side=bottom]:data-ending-style:opacity-0`,
|
|
106
|
+
`data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:translate-y-[-10px] data-[side=top]:data-ending-style:translate-y-[-10px] data-[side=top]:data-ending-style:opacity-0`,
|
|
107
|
+
`data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:translate-x-[-10px] data-[side=left]:data-ending-style:translate-x-[-10px] data-[side=left]:data-ending-style:opacity-0`,
|
|
108
|
+
`data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:translate-x-[10px] data-[side=right]:data-ending-style:translate-x-[10px] data-[side=right]:data-ending-style:opacity-0`,
|
|
109
|
+
`data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:translate-x-[-10px] data-[side=inline-start]:data-ending-style:translate-x-[-10px] data-[side=inline-start]:data-ending-style:opacity-0`,
|
|
110
|
+
`data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:translate-x-[10px] data-[side=inline-end]:data-ending-style:translate-x-[10px] data-[side=inline-end]:data-ending-style:opacity-0`
|
|
111
|
+
],
|
|
112
|
+
slideInside: [
|
|
113
|
+
`[transition-property:translate,opacity]`,
|
|
114
|
+
`data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:translate-y-[-10px] data-[side=bottom]:data-ending-style:translate-y-[-10px] data-[side=bottom]:data-ending-style:opacity-0`,
|
|
115
|
+
`data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:translate-y-[10px] data-[side=top]:data-ending-style:translate-y-[10px] data-[side=top]:data-ending-style:opacity-0`,
|
|
116
|
+
`data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:translate-x-[10px] data-[side=left]:data-ending-style:translate-x-[10px] data-[side=left]:data-ending-style:opacity-0`,
|
|
117
|
+
`data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:translate-x-[-10px] data-[side=right]:data-ending-style:translate-x-[-10px] data-[side=right]:data-ending-style:opacity-0`,
|
|
118
|
+
`data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:translate-x-[10px] data-[side=inline-start]:data-ending-style:translate-x-[10px] data-[side=inline-start]:data-ending-style:opacity-0`,
|
|
119
|
+
`data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:translate-x-[-10px] data-[side=inline-end]:data-ending-style:translate-x-[-10px] data-[side=inline-end]:data-ending-style:opacity-0`
|
|
120
|
+
],
|
|
121
|
+
wipe: [
|
|
122
|
+
`[transition-property:clip-path] [will-change:clip-path]`,
|
|
123
|
+
`[clip-path:inset(0_0_0_0_round_var(--radius))] [-webkit-clip-path:inset(0_0_0_0_round_var(--radius))]`,
|
|
124
|
+
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_var(--radius))] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_var(--radius))]`,
|
|
125
|
+
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_var(--radius))] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_var(--radius))]`,
|
|
126
|
+
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
127
|
+
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`,
|
|
128
|
+
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
129
|
+
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`
|
|
130
|
+
],
|
|
131
|
+
wipeScale: [
|
|
132
|
+
`[transition-property:clip-path,scale] [will-change:clip-path,scale]`,
|
|
133
|
+
`[clip-path:inset(0_0_0_0_round_var(--radius))] [-webkit-clip-path:inset(0_0_0_0_round_var(--radius))]`,
|
|
134
|
+
`data-starting-style:scale-80 data-ending-style:scale-80`,
|
|
135
|
+
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_var(--radius))] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_var(--radius))]`,
|
|
136
|
+
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_var(--radius))] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_var(--radius))]`,
|
|
137
|
+
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
138
|
+
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`,
|
|
139
|
+
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
140
|
+
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`
|
|
141
|
+
],
|
|
142
|
+
motion: [
|
|
143
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform] [will-change:translate,scale,opacity,rotateX,rotateY,transform]`,
|
|
144
|
+
`[transform:perspective(1000px)]`,
|
|
145
|
+
`data-[side=bottom]:data-starting-style:translate-y-[7px] data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:scale-[0.26] data-[side=bottom]:data-starting-style:rotate-x-[70deg] data-[side=bottom]:data-ending-style:translate-y-[7px] data-[side=bottom]:data-ending-style:opacity-0 data-[side=bottom]:data-ending-style:scale-[0.26] data-[side=bottom]:data-ending-style:rotate-x-[70deg]`,
|
|
146
|
+
`data-[side=top]:data-starting-style:translate-y-[7px] data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:scale-[0.26] data-[side=top]:data-starting-style:rotate-x-[70deg] data-[side=top]:data-ending-style:translate-y-[7px] data-[side=top]:data-ending-style:opacity-0 data-[side=top]:data-ending-style:scale-[0.26] data-[side=top]:data-ending-style:rotate-x-[70deg]`,
|
|
147
|
+
`data-[side=left]:data-starting-style:translate-x-[-7px] data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:scale-[0.26] data-[side=left]:data-starting-style:rotate-y-[-40deg] data-[side=left]:data-ending-style:translate-x-[-7px] data-[side=left]:data-ending-style:opacity-0 data-[side=left]:data-ending-style:scale-[0.26] data-[side=left]:data-ending-style:rotate-y-[-40deg]`,
|
|
148
|
+
`data-[side=right]:data-starting-style:translate-x-[7px] data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:scale-[0.26] data-[side=right]:data-starting-style:rotate-y-[40deg] data-[side=right]:data-ending-style:translate-x-[7px] data-[side=right]:data-ending-style:opacity-0 data-[side=right]:data-ending-style:scale-[0.26] data-[side=right]:data-ending-style:rotate-y-[40deg]`,
|
|
149
|
+
`data-[side=inline-start]:data-starting-style:translate-x-[-7px] data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:scale-[0.26] data-[side=inline-start]:data-starting-style:rotate-y-[-40deg] data-[side=inline-start]:data-ending-style:translate-x-[-7px] data-[side=inline-start]:data-ending-style:opacity-0 data-[side=inline-start]:data-ending-style:scale-[0.26] data-[side=inline-start]:data-ending-style:rotate-y-[-40deg]`,
|
|
150
|
+
`data-[side=inline-end]:data-starting-style:translate-x-[7px] data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:scale-[0.26] data-[side=inline-end]:data-starting-style:rotate-y-[40deg] data-[side=inline-end]:data-ending-style:translate-x-[7px] data-[side=inline-end]:data-ending-style:opacity-0 data-[side=inline-end]:data-ending-style:scale-[0.26] data-[side=inline-end]:data-ending-style:rotate-y-[40deg]`
|
|
151
|
+
],
|
|
152
|
+
motionBlur: [
|
|
153
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform,filter] [will-change:translate,scale,opacity,rotateX,rotateY,transform,filter]`,
|
|
154
|
+
`[transform:perspective(1000px)]`,
|
|
155
|
+
`data-starting-style:blur-[9px] data-ending-style:blur-[9px]`,
|
|
156
|
+
`data-[side=bottom]:data-starting-style:translate-y-[7px] data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:scale-[0.26] data-[side=bottom]:data-starting-style:rotate-x-[70deg] data-[side=bottom]:data-ending-style:translate-y-[7px] data-[side=bottom]:data-ending-style:opacity-0 data-[side=bottom]:data-ending-style:scale-[0.26] data-[side=bottom]:data-ending-style:rotate-x-[70deg]`,
|
|
157
|
+
`data-[side=top]:data-starting-style:translate-y-[7px] data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:scale-[0.26] data-[side=top]:data-starting-style:rotate-x-[70deg] data-[side=top]:data-ending-style:translate-y-[7px] data-[side=top]:data-ending-style:opacity-0 data-[side=top]:data-ending-style:scale-[0.26] data-[side=top]:data-ending-style:rotate-x-[70deg]`,
|
|
158
|
+
`data-[side=left]:data-starting-style:translate-x-[-7px] data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:scale-[0.26] data-[side=left]:data-starting-style:rotate-y-[-40deg] data-[side=left]:data-ending-style:translate-x-[-7px] data-[side=left]:data-ending-style:opacity-0 data-[side=left]:data-ending-style:scale-[0.26] data-[side=left]:data-ending-style:rotate-y-[-40deg]`,
|
|
159
|
+
`data-[side=right]:data-starting-style:translate-x-[7px] data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:scale-[0.26] data-[side=right]:data-starting-style:rotate-y-[40deg] data-[side=right]:data-ending-style:translate-x-[7px] data-[side=right]:data-ending-style:opacity-0 data-[side=right]:data-ending-style:scale-[0.26] data-[side=right]:data-ending-style:rotate-y-[40deg]`,
|
|
160
|
+
`data-[side=inline-start]:data-starting-style:translate-x-[-7px] data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:scale-[0.26] data-[side=inline-start]:data-starting-style:rotate-y-[-40deg] data-[side=inline-start]:data-ending-style:translate-x-[-7px] data-[side=inline-start]:data-ending-style:opacity-0 data-[side=inline-start]:data-ending-style:scale-[0.26] data-[side=inline-start]:data-ending-style:rotate-y-[-40deg]`,
|
|
161
|
+
`data-[side=inline-end]:data-starting-style:translate-x-[7px] data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:scale-[0.26] data-[side=inline-end]:data-starting-style:rotate-y-[40deg] data-[side=inline-end]:data-ending-style:translate-x-[7px] data-[side=inline-end]:data-ending-style:opacity-0 data-[side=inline-end]:data-ending-style:scale-[0.26] data-[side=inline-end]:data-ending-style:rotate-y-[40deg]`
|
|
162
|
+
]
|
|
163
|
+
};
|
|
164
|
+
const cssTransitionPresets = {
|
|
165
|
+
inExpo: `duration-[0.25s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
166
|
+
outExpo: `duration-[0.25s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
167
|
+
inOutExpo: `duration-[0.25s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
168
|
+
anticipate: `duration-[0.25s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
169
|
+
quickOut: `duration-[0.25s] ease-out`,
|
|
170
|
+
overshootOut: `duration-[0.25s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
171
|
+
swiftOut: `duration-[0.25s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
172
|
+
snappyOut: `duration-[0.25s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
173
|
+
in: `duration-[0.25s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
174
|
+
out: `duration-[0.25s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
175
|
+
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
176
|
+
outIn: `duration-[0.25s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
177
|
+
inQuad: `duration-[0.25s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
178
|
+
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
179
|
+
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
180
|
+
inCubic: `duration-[0.25s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
181
|
+
outCubic: `duration-[0.25s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
182
|
+
inOutCubic: `duration-[0.25s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
183
|
+
inQuart: `duration-[0.25s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
184
|
+
outQuart: `duration-[0.25s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
185
|
+
inOutQuart: `duration-[0.25s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
186
|
+
inQuint: `duration-[0.25s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
187
|
+
outQuint: `duration-[0.25s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
188
|
+
inOutQuint: `duration-[0.25s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
189
|
+
inCirc: `duration-[0.25s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
190
|
+
outCirc: `duration-[0.25s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
191
|
+
inOutCirc: `duration-[0.25s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
192
|
+
inOutBase: `duration-[0.25s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`,
|
|
193
|
+
none: `duration-0 ease-none`
|
|
194
|
+
};
|
|
195
|
+
function TooltipProvider({ delay = 300, ...props }) {
|
|
196
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Provider, {
|
|
197
|
+
"data-slot": "tooltip-provider",
|
|
198
|
+
delay,
|
|
199
|
+
...props
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function Tooltip({ ...props }) {
|
|
203
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Root, {
|
|
204
|
+
"data-slot": "tooltip",
|
|
205
|
+
...props
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function TooltipTrigger(props) {
|
|
209
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, {
|
|
210
|
+
"data-slot": "tooltip-trigger",
|
|
211
|
+
...props
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function TooltipPortal(props) {
|
|
215
|
+
return /* @__PURE__ */ jsx(Tooltip$1.Portal, {
|
|
216
|
+
"data-slot": "tooltip-portal",
|
|
217
|
+
...props
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function TooltipPositioner({ className, side = "top", ...rest }) {
|
|
221
|
+
return /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
222
|
+
side,
|
|
223
|
+
"data-slot": "tooltip-positioner",
|
|
224
|
+
className: cn("z-100", (side === "inline-end" || side === "inline-start") && "**:data-[slot=tooltip-arrow]:hidden", className),
|
|
225
|
+
...rest
|
|
226
|
+
}) });
|
|
227
|
+
}
|
|
228
|
+
function TooltipPopup({ className, animationPreset = "fade", transitionPreset = "outQuint", reduceMotion = false, showArrow = false, side = "top", sideOffset = 4, align = "center", alignOffset = 0, ...rest }) {
|
|
229
|
+
const cssAnimationConfig = useMemo(() => {
|
|
230
|
+
if (reduceMotion) return "none";
|
|
231
|
+
if (animationPreset) return cssAnimationPresets[animationPreset];
|
|
232
|
+
return cssAnimationPresets.scale;
|
|
233
|
+
}, [
|
|
234
|
+
animationPreset,
|
|
235
|
+
reduceMotion,
|
|
236
|
+
side
|
|
237
|
+
]);
|
|
238
|
+
const cssTransitionConfig = useMemo(() => {
|
|
239
|
+
if (reduceMotion) return "none";
|
|
240
|
+
if (transitionPreset) return cssTransitionPresets[transitionPreset];
|
|
241
|
+
return cssTransitionPresets.snappyOut;
|
|
242
|
+
}, [
|
|
243
|
+
transitionPreset,
|
|
244
|
+
reduceMotion,
|
|
245
|
+
side
|
|
246
|
+
]);
|
|
247
|
+
return /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
248
|
+
side,
|
|
249
|
+
sideOffset,
|
|
250
|
+
align,
|
|
251
|
+
alignOffset,
|
|
252
|
+
children: /* @__PURE__ */ jsx(Tooltip$1.Popup, {
|
|
253
|
+
"data-slot": "tooltip-popup",
|
|
254
|
+
className: cn("[--radius:10px]", "bg-popover border-border pointer-events-auto w-fit origin-(--transform-origin) rounded-(--radius) border px-2 py-1 text-[13px] text-balance shadow-xs data-instant:duration-0!", className, cssAnimationConfig, cssTransitionConfig, showArrow && [
|
|
255
|
+
`before: before:bg-popover z-[-1] before:absolute before:h-2 before:w-2 before:rotate-45 before:content-['']`,
|
|
256
|
+
side === "top" && `before:border-border before:-bottom-[4.7px] before:left-1/2 before:-translate-x-1/2 before:border-r before:border-b`,
|
|
257
|
+
side === "right" && `before:border-border before:top-1/2 before:-left-[4.07px] before:-translate-y-1/2 before:border-b before:border-l`,
|
|
258
|
+
side === "bottom" && `before:border-border before:-top-[4.7px] before:left-1/2 before:-translate-x-1/2 before:border-t before:border-l`,
|
|
259
|
+
side === "left" && `before:border-border before:top-1/2 before:-right-[4.07px] before:-translate-y-1/2 before:border-t before:border-r`,
|
|
260
|
+
side === "inline-start" && `before:border-border before:top-1/2 before:-right-[4.07px] before:-translate-y-1/2 before:border-t before:border-r`,
|
|
261
|
+
side === "inline-end" && `before:border-border before:top-1/2 before:-left-[4.07px] before:-translate-y-1/2 before:border-b before:border-l`
|
|
262
|
+
]),
|
|
263
|
+
...rest
|
|
264
|
+
})
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
48
268
|
//#endregion
|
|
49
269
|
//#region src/components/Fields/Label/index.tsx
|
|
50
|
-
const Label$1 = ({ label, readOnly }) => /* @__PURE__ */
|
|
270
|
+
const Label$1 = ({ label, readOnly, tooltip, action }) => /* @__PURE__ */ jsxs(Label$2, {
|
|
51
271
|
readOnly,
|
|
52
|
-
children: label
|
|
272
|
+
children: [label, (action || tooltip) && /* @__PURE__ */ jsxs("div", {
|
|
273
|
+
className: "flex items-center gap-x-1.5",
|
|
274
|
+
children: [action, tooltip && /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
275
|
+
delay: 200,
|
|
276
|
+
render: /* @__PURE__ */ jsx("span", {}),
|
|
277
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
278
|
+
variant: "secondary",
|
|
279
|
+
className: "!text-xs !rounded-full !p-0 !size-5 flex items-center justify-center",
|
|
280
|
+
children: "?"
|
|
281
|
+
})
|
|
282
|
+
}), /* @__PURE__ */ jsx(TooltipPopup, {
|
|
283
|
+
side: "top",
|
|
284
|
+
align: "end",
|
|
285
|
+
className: "max-w-64 text-xs",
|
|
286
|
+
children: tooltip
|
|
287
|
+
})] })]
|
|
288
|
+
})]
|
|
53
289
|
});
|
|
54
290
|
var Label_default = Label$1;
|
|
55
291
|
|
|
@@ -90,11 +326,13 @@ const FieldCheckbox = ({ onChange, value, readOnly, field, label }) => {
|
|
|
90
326
|
onChange(newValues);
|
|
91
327
|
}
|
|
92
328
|
};
|
|
93
|
-
|
|
329
|
+
const containerClassName = layout === "horizontal" ? "flex w-fit flex-wrap gap-1.5" : "flex flex-col gap-3";
|
|
330
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [label && /* @__PURE__ */ jsx(Label_default, {
|
|
94
331
|
label,
|
|
95
|
-
readOnly
|
|
332
|
+
readOnly: field.readOnly || readOnly,
|
|
333
|
+
tooltip: field.tooltip
|
|
96
334
|
}), /* @__PURE__ */ jsx("div", {
|
|
97
|
-
className:
|
|
335
|
+
className: containerClassName,
|
|
98
336
|
children: field.options.map((option, index) => {
|
|
99
337
|
const optionValue = option.value;
|
|
100
338
|
const key = `${String(optionValue)}-${index}`;
|
|
@@ -152,7 +390,8 @@ function Input({ className, size = "default", unstyled = false, nativeInput = fa
|
|
|
152
390
|
//#region src/components/Fields/Input/index.tsx
|
|
153
391
|
const FieldInput = ({ onChange, value, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [label && /* @__PURE__ */ jsx(Label_default, {
|
|
154
392
|
label,
|
|
155
|
-
readOnly: field.readOnly || readOnly
|
|
393
|
+
readOnly: field.readOnly || readOnly,
|
|
394
|
+
tooltip: field.tooltip
|
|
156
395
|
}), /* @__PURE__ */ jsx(Input, {
|
|
157
396
|
type: "text",
|
|
158
397
|
value: value || "",
|
|
@@ -278,9 +517,9 @@ function SelectGroupLabel(props) {
|
|
|
278
517
|
//#endregion
|
|
279
518
|
//#region src/components/Fields/NumberUnit/index.tsx
|
|
280
519
|
const FieldNumberUnit = ({ onChange, value, label, field, readOnly }) => {
|
|
281
|
-
const currentValue =
|
|
282
|
-
value: "",
|
|
283
|
-
unit: field.options?.[0]?.value
|
|
520
|
+
const currentValue = {
|
|
521
|
+
value: value?.value ?? "",
|
|
522
|
+
unit: value?.unit ?? field.options?.[0]?.value ?? ""
|
|
284
523
|
};
|
|
285
524
|
const handleInputChange = (newValue) => {
|
|
286
525
|
if (!readOnly) onChange({
|
|
@@ -294,9 +533,10 @@ const FieldNumberUnit = ({ onChange, value, label, field, readOnly }) => {
|
|
|
294
533
|
unit: newUnit
|
|
295
534
|
});
|
|
296
535
|
};
|
|
297
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
536
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [label && /* @__PURE__ */ jsx(Label_default, {
|
|
298
537
|
label,
|
|
299
|
-
readOnly: field.readOnly || readOnly
|
|
538
|
+
readOnly: field.readOnly || readOnly,
|
|
539
|
+
tooltip: field.tooltip
|
|
300
540
|
}), /* @__PURE__ */ jsxs("div", {
|
|
301
541
|
className: "flex",
|
|
302
542
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -356,9 +596,10 @@ const FieldSelect = ({ onChange, value, label, field, readOnly }) => {
|
|
|
356
596
|
return acc;
|
|
357
597
|
}, {});
|
|
358
598
|
const hasGroups = Object.keys(groupedOptions).some((key) => key !== "__ungrouped");
|
|
359
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
599
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [label && /* @__PURE__ */ jsx(Label_default, {
|
|
360
600
|
label,
|
|
361
|
-
readOnly: field.readOnly || readOnly
|
|
601
|
+
readOnly: field.readOnly || readOnly,
|
|
602
|
+
tooltip: field.tooltip
|
|
362
603
|
}), /* @__PURE__ */ jsxs(Select, {
|
|
363
604
|
items: itemsWithPlaceholder,
|
|
364
605
|
value: selectValue,
|
|
@@ -421,9 +662,10 @@ const FieldRadio = ({ onChange, value, readOnly, field, label }) => {
|
|
|
421
662
|
if (!readOnly && newValue != null) onChange(newValue);
|
|
422
663
|
};
|
|
423
664
|
const groupClassName = layout === "horizontal" ? "border-input flex w-fit flex-wrap divide-x divide-stone-200 overflow-hidden rounded-md border" : "flex flex-col gap-3";
|
|
424
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
665
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [label && /* @__PURE__ */ jsx(Label_default, {
|
|
425
666
|
label,
|
|
426
|
-
readOnly
|
|
667
|
+
readOnly: field.readOnly || readOnly,
|
|
668
|
+
tooltip: field.tooltip
|
|
427
669
|
}), /* @__PURE__ */ jsx(RadioGroup, {
|
|
428
670
|
layout,
|
|
429
671
|
value: value?.toString() || "",
|
|
@@ -475,9 +717,10 @@ function Textarea({ className, size = "default", unstyled = false, ...props }) {
|
|
|
475
717
|
|
|
476
718
|
//#endregion
|
|
477
719
|
//#region src/components/Fields/Textarea/index.tsx
|
|
478
|
-
const FieldTextarea = ({ onChange, value, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
720
|
+
const FieldTextarea = ({ onChange, value, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [label && /* @__PURE__ */ jsx(Label_default, {
|
|
479
721
|
label,
|
|
480
|
-
readOnly: field.readOnly || readOnly
|
|
722
|
+
readOnly: field.readOnly || readOnly,
|
|
723
|
+
tooltip: field.tooltip
|
|
481
724
|
}), /* @__PURE__ */ jsx(Textarea, {
|
|
482
725
|
value: value || "",
|
|
483
726
|
placeholder: field.placeholder,
|
|
@@ -495,7 +738,7 @@ const Action = ({ children, label, onClick }) => /* @__PURE__ */ jsx("button", {
|
|
|
495
738
|
title: label,
|
|
496
739
|
children
|
|
497
740
|
});
|
|
498
|
-
const Group = ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
741
|
+
const Group$1 = ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
499
742
|
className: "mx-2 flex h-full items-center first:ml-0 last:mr-0 empty:hidden [&>*]:m-0",
|
|
500
743
|
children
|
|
501
744
|
});
|
|
@@ -517,7 +760,7 @@ const ActionBar = ({ label, parentAction, children }) => /* @__PURE__ */ jsxs("d
|
|
|
517
760
|
});
|
|
518
761
|
ActionBar.Action = Action;
|
|
519
762
|
ActionBar.Label = Label;
|
|
520
|
-
ActionBar.Group = Group;
|
|
763
|
+
ActionBar.Group = Group$1;
|
|
521
764
|
ActionBar.Separator = Separator$2;
|
|
522
765
|
var ActionBar_default = ActionBar;
|
|
523
766
|
|
|
@@ -558,179 +801,40 @@ function TabsPanel({ className, ...props }) {
|
|
|
558
801
|
|
|
559
802
|
//#endregion
|
|
560
803
|
//#region src/components/ui/accordion.tsx
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
slide: [`[transition-property:translate,opacity,height] [will-change:translate,opacity,height]`, `data-starting-style:opacity-0 data-starting-style:translate-y-[10px] data-ending-style:translate-y-[10px] data-ending-style:opacity-0 data-ending-style:h-0 data-starting-style:h-0`],
|
|
566
|
-
perspective: [
|
|
567
|
-
`[transition-property:opacity,rotateX,rotateY,transform,height] [will-change:opacity,rotateX,rotateY,transform,height]`,
|
|
568
|
-
`[transform:perspective(1000px)] origin-top`,
|
|
569
|
-
`data-starting-style:h-0 data-ending-style:h-0`,
|
|
570
|
-
`data-starting-style:opacity-0 data-ending-style:opacity-0`,
|
|
571
|
-
`data-starting-style:-rotate-x-[90deg] data-ending-style:-rotate-x-[90deg]`
|
|
572
|
-
],
|
|
573
|
-
perspectiveBlur: [
|
|
574
|
-
`[transition-property:opacity,rotateX,rotateY,transform,height,filter] [will-change:opacity,rotateX,rotateY,transform,height,filter]`,
|
|
575
|
-
`[transform:perspective(1000px)] origin-top`,
|
|
576
|
-
`data-starting-style:h-0 data-ending-style:h-0`,
|
|
577
|
-
`data-starting-style:opacity-0 data-ending-style:opacity-0`,
|
|
578
|
-
`data-starting-style:-rotate-x-[90deg] data-ending-style:-rotate-x-[90deg]`,
|
|
579
|
-
`data-starting-style:blur-[9px] data-ending-style:blur-[9px]`
|
|
580
|
-
]
|
|
581
|
-
};
|
|
582
|
-
const cssTransitionPresets$1 = {
|
|
583
|
-
inExpo: `duration-[0.35s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
584
|
-
outExpo: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
585
|
-
inOutExpo: `duration-[0.35s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
586
|
-
anticipate: `duration-[0.35s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
587
|
-
quickOut: `duration-[0.35s] ease-out`,
|
|
588
|
-
overshootOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
589
|
-
swiftOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
590
|
-
snappyOut: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
591
|
-
in: `duration-[0.35s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
592
|
-
out: `duration-[0.35s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
593
|
-
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
594
|
-
outIn: `duration-[0.35s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
595
|
-
inQuad: `duration-[0.35s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
596
|
-
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
597
|
-
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
598
|
-
inCubic: `duration-[0.35s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
599
|
-
outCubic: `duration-[0.35s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
600
|
-
inOutCubic: `duration-[0.35s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
601
|
-
inQuart: `duration-[0.35s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
602
|
-
outQuart: `duration-[0.35s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
603
|
-
inOutQuart: `duration-[0.35s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
604
|
-
inQuint: `duration-[0.35s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
605
|
-
outQuint: `duration-[0.35s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
606
|
-
inOutQuint: `duration-[0.35s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
607
|
-
inCirc: `duration-[0.35s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
608
|
-
outCirc: `duration-[0.35s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
609
|
-
inOutCirc: `duration-[0.35s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
610
|
-
inOutBase: `duration-[0.35s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`
|
|
611
|
-
};
|
|
612
|
-
const AccordionContext = createContext(void 0);
|
|
613
|
-
function useAccordion() {
|
|
614
|
-
const context = useContext(AccordionContext);
|
|
615
|
-
if (!context) throw new Error("useAccordion must be used within a AccordionProvider");
|
|
616
|
-
return context;
|
|
617
|
-
}
|
|
618
|
-
function Accordion({ value, defaultValue, onValueChange, animationPreset = "fade", transitionPreset = "outQuad", reduceMotion, variant = "default", className, multiple = false, ...props }) {
|
|
619
|
-
const [accordionValue, setAccordionValue] = useState(value ?? defaultValue ?? []);
|
|
620
|
-
const handleValueChange = (value$1, eventDetails) => {
|
|
621
|
-
setAccordionValue(value$1);
|
|
622
|
-
onValueChange?.(value$1, eventDetails);
|
|
623
|
-
};
|
|
624
|
-
return /* @__PURE__ */ jsx(AccordionContext.Provider, {
|
|
625
|
-
value: {
|
|
626
|
-
value: accordionValue,
|
|
627
|
-
onValueChange: handleValueChange,
|
|
628
|
-
animationPreset,
|
|
629
|
-
transitionPreset,
|
|
630
|
-
reduceMotion,
|
|
631
|
-
variant
|
|
632
|
-
},
|
|
633
|
-
children: /* @__PURE__ */ jsx(Accordion$1.Root, {
|
|
634
|
-
"data-slot": "accordion",
|
|
635
|
-
value: accordionValue,
|
|
636
|
-
onValueChange: handleValueChange,
|
|
637
|
-
multiple,
|
|
638
|
-
className: cn("w-full", variant === "default" && "flex flex-col rounded-2xl border outline-hidden", variant === "card" && "flex flex-col gap-1.5", variant === "swiss" && "rounded-2xl", className),
|
|
639
|
-
...props
|
|
640
|
-
})
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
const AccordionItemContext = createContext(void 0);
|
|
644
|
-
function useAccordionItem() {
|
|
645
|
-
const context = useContext(AccordionItemContext);
|
|
646
|
-
if (!context) throw new Error("useAccordionItem must be used within a AccordionItemProvider");
|
|
647
|
-
return context;
|
|
648
|
-
}
|
|
649
|
-
function AccordionItem({ value: itemValue, onOpenChange, className, ...rest }) {
|
|
650
|
-
const { value, variant = "default" } = useAccordion();
|
|
651
|
-
const [isOpen, setIsOpen] = useState(value?.includes(itemValue) ?? false);
|
|
652
|
-
useEffect(() => {
|
|
653
|
-
setIsOpen(value?.includes(itemValue) ?? false);
|
|
654
|
-
}, [value, itemValue]);
|
|
655
|
-
const handleItemOpenChange = (open, eventDetails) => {
|
|
656
|
-
setIsOpen(open);
|
|
657
|
-
onOpenChange?.(open, eventDetails);
|
|
658
|
-
};
|
|
659
|
-
return /* @__PURE__ */ jsx(AccordionItemContext.Provider, {
|
|
660
|
-
value: {
|
|
661
|
-
open: isOpen,
|
|
662
|
-
onOpenChange: handleItemOpenChange,
|
|
663
|
-
variant
|
|
664
|
-
},
|
|
665
|
-
children: /* @__PURE__ */ jsx(Accordion$1.Item, {
|
|
666
|
-
"data-slot": "accordion-item",
|
|
667
|
-
value: itemValue,
|
|
668
|
-
onOpenChange: handleItemOpenChange,
|
|
669
|
-
className: cn("w-full outline-hidden contain-layout", `[transition-property:border-radius,margin,border] duration-260 ease-[cubic-bezier(0.215,0.61,0.355,1)] will-change-[border-radius,margin,border]`, "focus-within:relative focus-within:z-2", variant === "default" && "border-border bg-card border-b first:rounded-t-2xl last:rounded-b-2xl last:border-b-0", variant === "card" && "rounded-[14px] border p-1", variant === "swiss" && [
|
|
670
|
-
"bg-popover border-border/60 relative overflow-hidden border-x",
|
|
671
|
-
"data-closed:border-border/60 data-closed:border-b",
|
|
672
|
-
"first:border-border/60 first:rounded-t-2xl first:border-t",
|
|
673
|
-
"last:border-border/60 last:rounded-b-2xl last:border-b",
|
|
674
|
-
"data-open:border-primary/70 data-open:z-2 data-open:rounded-2xl data-open:border",
|
|
675
|
-
"data-open:my-6 data-open:first:mt-0 data-open:last:mb-0",
|
|
676
|
-
"has-[+_[data-slot='accordion-item'][data-open]]:rounded-b-2xl",
|
|
677
|
-
"has-[+_[data-slot='accordion-item'][data-open]]:border-b!",
|
|
678
|
-
"has-[+_[data-slot='accordion-item'][data-open]]:border-border/60",
|
|
679
|
-
"data-open:[&+[data-slot='accordion-item']]:rounded-t-2xl",
|
|
680
|
-
"data-open:[&+[data-slot='accordion-item'][data-closed]]:border-t",
|
|
681
|
-
"data-open:[&+[data-slot='accordion-item']]:border-border/60",
|
|
682
|
-
"data-closed:first:border-t",
|
|
683
|
-
"data-closed:last:border-b"
|
|
684
|
-
], className),
|
|
685
|
-
...rest
|
|
686
|
-
})
|
|
804
|
+
function Accordion(props) {
|
|
805
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Root, {
|
|
806
|
+
"data-slot": "accordion",
|
|
807
|
+
...props
|
|
687
808
|
});
|
|
688
809
|
}
|
|
689
|
-
function
|
|
690
|
-
return /* @__PURE__ */ jsx(
|
|
691
|
-
|
|
692
|
-
|
|
810
|
+
function AccordionItem({ className, ...props }) {
|
|
811
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Item, {
|
|
812
|
+
className: cn("border-b last:border-b-0", className),
|
|
813
|
+
"data-slot": "accordion-item",
|
|
693
814
|
...props
|
|
694
815
|
});
|
|
695
816
|
}
|
|
696
|
-
function AccordionTrigger({ className,
|
|
697
|
-
|
|
698
|
-
return /* @__PURE__ */ jsx(AccordionHeader, {
|
|
817
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
818
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Header, {
|
|
699
819
|
className: "flex",
|
|
700
|
-
children: /* @__PURE__ */ jsxs(
|
|
820
|
+
children: /* @__PURE__ */ jsxs(AccordionPrimitive.Trigger, {
|
|
821
|
+
className: cn("flex flex-1 cursor-pointer items-start justify-between gap-4 py-3 text-left font-medium text-sm outline-none transition-all focus-visible:ring-[3px] focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-64 data-panel-open:*:data-[slot=accordion-indicator]:rotate-180 px-4 hover:bg-muted", className),
|
|
701
822
|
"data-slot": "accordion-trigger",
|
|
702
|
-
className: cn("hover:bg-muted bg-muted flex w-full cursor-pointer items-center px-4 py-3 text-left text-sm not-data-panel-open:bg-transparent", "[transition-property:background-color,border-radius] duration-200 ease-[cubic-bezier(0.215,0.61,0.355,1)] will-change-[background-color,border-radius]", `focus-visible:bg-accent not-data-panel-open:dark:hover:bg-accent dark:focus-visible:bg-accent focus-visible:outline-ring font-medium focus-visible:outline-2 data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:opacity-50`, variant === "card" && [`not-data-panel-open:bg-secondary/80 data-panel-open:bg-secondary/80 rounded-lg data-panel-open:rounded-b-none`], className),
|
|
703
823
|
...props,
|
|
704
|
-
children: [children, /* @__PURE__ */ jsx(
|
|
705
|
-
className: "
|
|
706
|
-
|
|
824
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
825
|
+
className: "pointer-events-none size-4 shrink-0 translate-y-0.5 opacity-80 transition-transform duration-0 ease-in-out",
|
|
826
|
+
"data-slot": "accordion-indicator"
|
|
707
827
|
})]
|
|
708
828
|
})
|
|
709
829
|
});
|
|
710
830
|
}
|
|
711
|
-
function AccordionPanel({ className, children,
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
if (reduceMotion) return cssAnimationPresets$1.none;
|
|
715
|
-
if (animationPreset) return cssAnimationPresets$1[animationPreset];
|
|
716
|
-
return cssAnimationPresets$1.fade;
|
|
717
|
-
}, [animationPreset, reduceMotion]);
|
|
718
|
-
const cssTransitionConfig = useMemo(() => {
|
|
719
|
-
if (reduceMotion) return "";
|
|
720
|
-
if (transitionPreset) return cssTransitionPresets$1[transitionPreset];
|
|
721
|
-
return cssTransitionPresets$1.inOutExpo;
|
|
722
|
-
}, [transitionPreset, reduceMotion]);
|
|
723
|
-
return /* @__PURE__ */ jsx(Accordion$1.Panel, {
|
|
831
|
+
function AccordionPanel({ className, children, ...props }) {
|
|
832
|
+
return /* @__PURE__ */ jsx(AccordionPrimitive.Panel, {
|
|
833
|
+
className: "h-(--accordion-panel-height) overflow-hidden text-muted-foreground text-sm transition-[height] duration-0 ease-in-out data-ending-style:h-0 data-starting-style:h-0",
|
|
724
834
|
"data-slot": "accordion-panel",
|
|
725
|
-
className: cn("h-(--accordion-panel-height) overflow-hidden text-sm", cssAnimationConfig, cssTransitionConfig, className),
|
|
726
|
-
style: {
|
|
727
|
-
willChange: "height, opacity, transform",
|
|
728
|
-
...style
|
|
729
|
-
},
|
|
730
835
|
...props,
|
|
731
836
|
children: /* @__PURE__ */ jsx("div", {
|
|
732
|
-
|
|
733
|
-
className: cn(variant === "default" ? "p-0" : "p-3 pl-4"),
|
|
837
|
+
className: cn("pt-0 pb-4", className),
|
|
734
838
|
children
|
|
735
839
|
})
|
|
736
840
|
});
|
|
@@ -738,13 +842,13 @@ function AccordionPanel({ className, children, style, ...props }) {
|
|
|
738
842
|
|
|
739
843
|
//#endregion
|
|
740
844
|
//#region src/components/FieldGroups/index.tsx
|
|
741
|
-
const usePuck$
|
|
845
|
+
const usePuck$2 = createUsePuck();
|
|
742
846
|
const isSingleAccordion = (accordions) => {
|
|
743
847
|
return "fields" in accordions && Array.isArray(accordions.fields);
|
|
744
848
|
};
|
|
745
849
|
const FieldGroups = ({ children }) => {
|
|
746
|
-
const config = usePuck$
|
|
747
|
-
const selectedItem = usePuck$
|
|
850
|
+
const config = usePuck$2((s) => s.config);
|
|
851
|
+
const selectedItem = usePuck$2((s) => s.selectedItem);
|
|
748
852
|
const componentConfig = useMemo(() => {
|
|
749
853
|
if (!selectedItem?.type) return null;
|
|
750
854
|
return config.components?.[selectedItem.type] || null;
|
|
@@ -923,182 +1027,11 @@ const FieldGroups = ({ children }) => {
|
|
|
923
1027
|
};
|
|
924
1028
|
var FieldGroups_default = FieldGroups;
|
|
925
1029
|
|
|
926
|
-
//#endregion
|
|
927
|
-
//#region src/components/ui/tooltip.tsx
|
|
928
|
-
const cssAnimationPresets = {
|
|
929
|
-
none: "transition-none",
|
|
930
|
-
scale: [`[transition-property:scale,opacity]`, `data-starting-style:scale-80 data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:scale-80`],
|
|
931
|
-
fade: [`[transition-property:opacity,scale]`, `data-starting-style:scale-98 data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:scale-98`],
|
|
932
|
-
slideOutside: [
|
|
933
|
-
`[transition-property:translate,opacity]`,
|
|
934
|
-
`data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:translate-y-[10px] data-[side=bottom]:data-ending-style:translate-y-[10px] data-[side=bottom]:data-ending-style:opacity-0`,
|
|
935
|
-
`data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:translate-y-[-10px] data-[side=top]:data-ending-style:translate-y-[-10px] data-[side=top]:data-ending-style:opacity-0`,
|
|
936
|
-
`data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:translate-x-[-10px] data-[side=left]:data-ending-style:translate-x-[-10px] data-[side=left]:data-ending-style:opacity-0`,
|
|
937
|
-
`data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:translate-x-[10px] data-[side=right]:data-ending-style:translate-x-[10px] data-[side=right]:data-ending-style:opacity-0`,
|
|
938
|
-
`data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:translate-x-[-10px] data-[side=inline-start]:data-ending-style:translate-x-[-10px] data-[side=inline-start]:data-ending-style:opacity-0`,
|
|
939
|
-
`data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:translate-x-[10px] data-[side=inline-end]:data-ending-style:translate-x-[10px] data-[side=inline-end]:data-ending-style:opacity-0`
|
|
940
|
-
],
|
|
941
|
-
slideInside: [
|
|
942
|
-
`[transition-property:translate,opacity]`,
|
|
943
|
-
`data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:translate-y-[-10px] data-[side=bottom]:data-ending-style:translate-y-[-10px] data-[side=bottom]:data-ending-style:opacity-0`,
|
|
944
|
-
`data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:translate-y-[10px] data-[side=top]:data-ending-style:translate-y-[10px] data-[side=top]:data-ending-style:opacity-0`,
|
|
945
|
-
`data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:translate-x-[10px] data-[side=left]:data-ending-style:translate-x-[10px] data-[side=left]:data-ending-style:opacity-0`,
|
|
946
|
-
`data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:translate-x-[-10px] data-[side=right]:data-ending-style:translate-x-[-10px] data-[side=right]:data-ending-style:opacity-0`,
|
|
947
|
-
`data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:translate-x-[10px] data-[side=inline-start]:data-ending-style:translate-x-[10px] data-[side=inline-start]:data-ending-style:opacity-0`,
|
|
948
|
-
`data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:translate-x-[-10px] data-[side=inline-end]:data-ending-style:translate-x-[-10px] data-[side=inline-end]:data-ending-style:opacity-0`
|
|
949
|
-
],
|
|
950
|
-
wipe: [
|
|
951
|
-
`[transition-property:clip-path] [will-change:clip-path]`,
|
|
952
|
-
`[clip-path:inset(0_0_0_0_round_var(--radius))] [-webkit-clip-path:inset(0_0_0_0_round_var(--radius))]`,
|
|
953
|
-
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_var(--radius))] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_var(--radius))]`,
|
|
954
|
-
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_var(--radius))] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_var(--radius))]`,
|
|
955
|
-
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
956
|
-
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`,
|
|
957
|
-
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
958
|
-
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`
|
|
959
|
-
],
|
|
960
|
-
wipeScale: [
|
|
961
|
-
`[transition-property:clip-path,scale] [will-change:clip-path,scale]`,
|
|
962
|
-
`[clip-path:inset(0_0_0_0_round_var(--radius))] [-webkit-clip-path:inset(0_0_0_0_round_var(--radius))]`,
|
|
963
|
-
`data-starting-style:scale-80 data-ending-style:scale-80`,
|
|
964
|
-
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_var(--radius))] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_var(--radius))]`,
|
|
965
|
-
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_var(--radius))] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_var(--radius))]`,
|
|
966
|
-
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
967
|
-
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`,
|
|
968
|
-
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_var(--radius))] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_var(--radius))]`,
|
|
969
|
-
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_var(--radius))] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_var(--radius))]`
|
|
970
|
-
],
|
|
971
|
-
motion: [
|
|
972
|
-
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform] [will-change:translate,scale,opacity,rotateX,rotateY,transform]`,
|
|
973
|
-
`[transform:perspective(1000px)]`,
|
|
974
|
-
`data-[side=bottom]:data-starting-style:translate-y-[7px] data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:scale-[0.26] data-[side=bottom]:data-starting-style:rotate-x-[70deg] data-[side=bottom]:data-ending-style:translate-y-[7px] data-[side=bottom]:data-ending-style:opacity-0 data-[side=bottom]:data-ending-style:scale-[0.26] data-[side=bottom]:data-ending-style:rotate-x-[70deg]`,
|
|
975
|
-
`data-[side=top]:data-starting-style:translate-y-[7px] data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:scale-[0.26] data-[side=top]:data-starting-style:rotate-x-[70deg] data-[side=top]:data-ending-style:translate-y-[7px] data-[side=top]:data-ending-style:opacity-0 data-[side=top]:data-ending-style:scale-[0.26] data-[side=top]:data-ending-style:rotate-x-[70deg]`,
|
|
976
|
-
`data-[side=left]:data-starting-style:translate-x-[-7px] data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:scale-[0.26] data-[side=left]:data-starting-style:rotate-y-[-40deg] data-[side=left]:data-ending-style:translate-x-[-7px] data-[side=left]:data-ending-style:opacity-0 data-[side=left]:data-ending-style:scale-[0.26] data-[side=left]:data-ending-style:rotate-y-[-40deg]`,
|
|
977
|
-
`data-[side=right]:data-starting-style:translate-x-[7px] data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:scale-[0.26] data-[side=right]:data-starting-style:rotate-y-[40deg] data-[side=right]:data-ending-style:translate-x-[7px] data-[side=right]:data-ending-style:opacity-0 data-[side=right]:data-ending-style:scale-[0.26] data-[side=right]:data-ending-style:rotate-y-[40deg]`,
|
|
978
|
-
`data-[side=inline-start]:data-starting-style:translate-x-[-7px] data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:scale-[0.26] data-[side=inline-start]:data-starting-style:rotate-y-[-40deg] data-[side=inline-start]:data-ending-style:translate-x-[-7px] data-[side=inline-start]:data-ending-style:opacity-0 data-[side=inline-start]:data-ending-style:scale-[0.26] data-[side=inline-start]:data-ending-style:rotate-y-[-40deg]`,
|
|
979
|
-
`data-[side=inline-end]:data-starting-style:translate-x-[7px] data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:scale-[0.26] data-[side=inline-end]:data-starting-style:rotate-y-[40deg] data-[side=inline-end]:data-ending-style:translate-x-[7px] data-[side=inline-end]:data-ending-style:opacity-0 data-[side=inline-end]:data-ending-style:scale-[0.26] data-[side=inline-end]:data-ending-style:rotate-y-[40deg]`
|
|
980
|
-
],
|
|
981
|
-
motionBlur: [
|
|
982
|
-
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform,filter] [will-change:translate,scale,opacity,rotateX,rotateY,transform,filter]`,
|
|
983
|
-
`[transform:perspective(1000px)]`,
|
|
984
|
-
`data-starting-style:blur-[9px] data-ending-style:blur-[9px]`,
|
|
985
|
-
`data-[side=bottom]:data-starting-style:translate-y-[7px] data-[side=bottom]:data-starting-style:opacity-0 data-[side=bottom]:data-starting-style:scale-[0.26] data-[side=bottom]:data-starting-style:rotate-x-[70deg] data-[side=bottom]:data-ending-style:translate-y-[7px] data-[side=bottom]:data-ending-style:opacity-0 data-[side=bottom]:data-ending-style:scale-[0.26] data-[side=bottom]:data-ending-style:rotate-x-[70deg]`,
|
|
986
|
-
`data-[side=top]:data-starting-style:translate-y-[7px] data-[side=top]:data-starting-style:opacity-0 data-[side=top]:data-starting-style:scale-[0.26] data-[side=top]:data-starting-style:rotate-x-[70deg] data-[side=top]:data-ending-style:translate-y-[7px] data-[side=top]:data-ending-style:opacity-0 data-[side=top]:data-ending-style:scale-[0.26] data-[side=top]:data-ending-style:rotate-x-[70deg]`,
|
|
987
|
-
`data-[side=left]:data-starting-style:translate-x-[-7px] data-[side=left]:data-starting-style:opacity-0 data-[side=left]:data-starting-style:scale-[0.26] data-[side=left]:data-starting-style:rotate-y-[-40deg] data-[side=left]:data-ending-style:translate-x-[-7px] data-[side=left]:data-ending-style:opacity-0 data-[side=left]:data-ending-style:scale-[0.26] data-[side=left]:data-ending-style:rotate-y-[-40deg]`,
|
|
988
|
-
`data-[side=right]:data-starting-style:translate-x-[7px] data-[side=right]:data-starting-style:opacity-0 data-[side=right]:data-starting-style:scale-[0.26] data-[side=right]:data-starting-style:rotate-y-[40deg] data-[side=right]:data-ending-style:translate-x-[7px] data-[side=right]:data-ending-style:opacity-0 data-[side=right]:data-ending-style:scale-[0.26] data-[side=right]:data-ending-style:rotate-y-[40deg]`,
|
|
989
|
-
`data-[side=inline-start]:data-starting-style:translate-x-[-7px] data-[side=inline-start]:data-starting-style:opacity-0 data-[side=inline-start]:data-starting-style:scale-[0.26] data-[side=inline-start]:data-starting-style:rotate-y-[-40deg] data-[side=inline-start]:data-ending-style:translate-x-[-7px] data-[side=inline-start]:data-ending-style:opacity-0 data-[side=inline-start]:data-ending-style:scale-[0.26] data-[side=inline-start]:data-ending-style:rotate-y-[-40deg]`,
|
|
990
|
-
`data-[side=inline-end]:data-starting-style:translate-x-[7px] data-[side=inline-end]:data-starting-style:opacity-0 data-[side=inline-end]:data-starting-style:scale-[0.26] data-[side=inline-end]:data-starting-style:rotate-y-[40deg] data-[side=inline-end]:data-ending-style:translate-x-[7px] data-[side=inline-end]:data-ending-style:opacity-0 data-[side=inline-end]:data-ending-style:scale-[0.26] data-[side=inline-end]:data-ending-style:rotate-y-[40deg]`
|
|
991
|
-
]
|
|
992
|
-
};
|
|
993
|
-
const cssTransitionPresets = {
|
|
994
|
-
inExpo: `duration-[0.25s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
995
|
-
outExpo: `duration-[0.25s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
996
|
-
inOutExpo: `duration-[0.25s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
997
|
-
anticipate: `duration-[0.25s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
998
|
-
quickOut: `duration-[0.25s] ease-out`,
|
|
999
|
-
overshootOut: `duration-[0.25s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
1000
|
-
swiftOut: `duration-[0.25s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
1001
|
-
snappyOut: `duration-[0.25s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
1002
|
-
in: `duration-[0.25s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
1003
|
-
out: `duration-[0.25s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
1004
|
-
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
1005
|
-
outIn: `duration-[0.25s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
1006
|
-
inQuad: `duration-[0.25s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
1007
|
-
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
1008
|
-
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
1009
|
-
inCubic: `duration-[0.25s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
1010
|
-
outCubic: `duration-[0.25s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
1011
|
-
inOutCubic: `duration-[0.25s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
1012
|
-
inQuart: `duration-[0.25s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
1013
|
-
outQuart: `duration-[0.25s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
1014
|
-
inOutQuart: `duration-[0.25s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
1015
|
-
inQuint: `duration-[0.25s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
1016
|
-
outQuint: `duration-[0.25s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
1017
|
-
inOutQuint: `duration-[0.25s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
1018
|
-
inCirc: `duration-[0.25s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
1019
|
-
outCirc: `duration-[0.25s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
1020
|
-
inOutCirc: `duration-[0.25s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
1021
|
-
inOutBase: `duration-[0.25s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`,
|
|
1022
|
-
none: `duration-0 ease-none`
|
|
1023
|
-
};
|
|
1024
|
-
function TooltipProvider({ delay = 300, ...props }) {
|
|
1025
|
-
return /* @__PURE__ */ jsx(Tooltip$1.Provider, {
|
|
1026
|
-
"data-slot": "tooltip-provider",
|
|
1027
|
-
delay,
|
|
1028
|
-
...props
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
function Tooltip({ ...props }) {
|
|
1032
|
-
return /* @__PURE__ */ jsx(Tooltip$1.Root, {
|
|
1033
|
-
"data-slot": "tooltip",
|
|
1034
|
-
...props
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
function TooltipTrigger(props) {
|
|
1038
|
-
return /* @__PURE__ */ jsx(Tooltip$1.Trigger, {
|
|
1039
|
-
"data-slot": "tooltip-trigger",
|
|
1040
|
-
...props
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
1043
|
-
function TooltipPortal(props) {
|
|
1044
|
-
return /* @__PURE__ */ jsx(Tooltip$1.Portal, {
|
|
1045
|
-
"data-slot": "tooltip-portal",
|
|
1046
|
-
...props
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
function TooltipPositioner({ className, side = "top", ...rest }) {
|
|
1050
|
-
return /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
1051
|
-
side,
|
|
1052
|
-
"data-slot": "tooltip-positioner",
|
|
1053
|
-
className: cn("z-100", (side === "inline-end" || side === "inline-start") && "**:data-[slot=tooltip-arrow]:hidden", className),
|
|
1054
|
-
...rest
|
|
1055
|
-
}) });
|
|
1056
|
-
}
|
|
1057
|
-
function TooltipPopup({ className, animationPreset = "scale", transitionPreset = "outQuint", reduceMotion = false, showArrow = false, side = "top", sideOffset = 4, align = "center", alignOffset = 0, ...rest }) {
|
|
1058
|
-
const cssAnimationConfig = useMemo(() => {
|
|
1059
|
-
if (reduceMotion) return "none";
|
|
1060
|
-
if (animationPreset) return cssAnimationPresets[animationPreset];
|
|
1061
|
-
return cssAnimationPresets.scale;
|
|
1062
|
-
}, [
|
|
1063
|
-
animationPreset,
|
|
1064
|
-
reduceMotion,
|
|
1065
|
-
side
|
|
1066
|
-
]);
|
|
1067
|
-
const cssTransitionConfig = useMemo(() => {
|
|
1068
|
-
if (reduceMotion) return "none";
|
|
1069
|
-
if (transitionPreset) return cssTransitionPresets[transitionPreset];
|
|
1070
|
-
return cssTransitionPresets.snappyOut;
|
|
1071
|
-
}, [
|
|
1072
|
-
transitionPreset,
|
|
1073
|
-
reduceMotion,
|
|
1074
|
-
side
|
|
1075
|
-
]);
|
|
1076
|
-
return /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
1077
|
-
side,
|
|
1078
|
-
sideOffset,
|
|
1079
|
-
align,
|
|
1080
|
-
alignOffset,
|
|
1081
|
-
children: /* @__PURE__ */ jsx(Tooltip$1.Popup, {
|
|
1082
|
-
"data-slot": "tooltip-popup",
|
|
1083
|
-
className: cn("[--radius:10px]", "bg-popover border-border pointer-events-auto w-fit origin-(--transform-origin) rounded-(--radius) border px-2 py-1 text-[13px] text-balance shadow-xs data-instant:duration-0!", className, cssAnimationConfig, cssTransitionConfig, showArrow && [
|
|
1084
|
-
`before: before:bg-popover z-[-1] before:absolute before:h-2 before:w-2 before:rotate-45 before:content-['']`,
|
|
1085
|
-
side === "top" && `before:border-border before:-bottom-[4.7px] before:left-1/2 before:-translate-x-1/2 before:border-r before:border-b`,
|
|
1086
|
-
side === "right" && `before:border-border before:top-1/2 before:-left-[4.07px] before:-translate-y-1/2 before:border-b before:border-l`,
|
|
1087
|
-
side === "bottom" && `before:border-border before:-top-[4.7px] before:left-1/2 before:-translate-x-1/2 before:border-t before:border-l`,
|
|
1088
|
-
side === "left" && `before:border-border before:top-1/2 before:-right-[4.07px] before:-translate-y-1/2 before:border-t before:border-r`,
|
|
1089
|
-
side === "inline-start" && `before:border-border before:top-1/2 before:-right-[4.07px] before:-translate-y-1/2 before:border-t before:border-r`,
|
|
1090
|
-
side === "inline-end" && `before:border-border before:top-1/2 before:-left-[4.07px] before:-translate-y-1/2 before:border-b before:border-l`
|
|
1091
|
-
]),
|
|
1092
|
-
...rest
|
|
1093
|
-
})
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
1030
|
//#endregion
|
|
1098
1031
|
//#region src/components/DrawerItem/index.tsx
|
|
1099
|
-
const usePuck = createUsePuck();
|
|
1032
|
+
const usePuck$1 = createUsePuck();
|
|
1100
1033
|
const DrawerItem = ({ name, icon }) => {
|
|
1101
|
-
const componentConfig = usePuck(useCallback((state) => state.config, [])).components?.[name];
|
|
1034
|
+
const componentConfig = usePuck$1(useCallback((state) => state.config, [])).components?.[name];
|
|
1102
1035
|
const iconOrImage = icon || componentConfig?.metadata?.icon;
|
|
1103
1036
|
const imageUrl = componentConfig?.metadata?.image;
|
|
1104
1037
|
const description = componentConfig?.metadata?.description;
|
|
@@ -1122,25 +1055,23 @@ const DrawerItem = ({ name, icon }) => {
|
|
|
1122
1055
|
})]
|
|
1123
1056
|
});
|
|
1124
1057
|
if (!hasTooltipContent) return drawerContent;
|
|
1125
|
-
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
1058
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
1126
1059
|
delay: 200,
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
})] })
|
|
1143
|
-
});
|
|
1060
|
+
className: "w-full",
|
|
1061
|
+
children: drawerContent
|
|
1062
|
+
}), /* @__PURE__ */ jsxs(TooltipPopup, {
|
|
1063
|
+
side: "right",
|
|
1064
|
+
sideOffset: 8,
|
|
1065
|
+
className: "w-64 p-2",
|
|
1066
|
+
children: [imageUrl && /* @__PURE__ */ jsx("img", {
|
|
1067
|
+
src: imageUrl,
|
|
1068
|
+
alt: name,
|
|
1069
|
+
className: "h-auto w-full rounded-sm object-contain"
|
|
1070
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
1071
|
+
className: "text-muted-foreground mt-2 text-sm",
|
|
1072
|
+
children: description
|
|
1073
|
+
})]
|
|
1074
|
+
})] }) });
|
|
1144
1075
|
};
|
|
1145
1076
|
var DrawerItem_default = DrawerItem;
|
|
1146
1077
|
|
|
@@ -1152,7 +1083,10 @@ const createPuckOverridesPlugin = () => {
|
|
|
1152
1083
|
drawer: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
1153
1084
|
drawerItem: DrawerItem_default,
|
|
1154
1085
|
fields: FieldGroups_default,
|
|
1155
|
-
fieldLabel: ({ children, label }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
1086
|
+
fieldLabel: ({ children, label, field, tooltip }) => /* @__PURE__ */ jsxs(Fragment, { children: [label && /* @__PURE__ */ jsx(Label_default, {
|
|
1087
|
+
label,
|
|
1088
|
+
tooltip: tooltip ?? field?.tooltip
|
|
1089
|
+
}), children] }),
|
|
1156
1090
|
fieldTypes: {
|
|
1157
1091
|
checkbox: Checkbox_default,
|
|
1158
1092
|
numberUnit: NumberUnit_default,
|
|
@@ -1165,55 +1099,6 @@ const createPuckOverridesPlugin = () => {
|
|
|
1165
1099
|
};
|
|
1166
1100
|
var plugin_default = createPuckOverridesPlugin;
|
|
1167
1101
|
|
|
1168
|
-
//#endregion
|
|
1169
|
-
//#region src/components/ui/button.tsx
|
|
1170
|
-
const buttonVariants = cva("[&_svg]:-mx-0.5 relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-lg border font-medium text-base outline-none transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
1171
|
-
defaultVariants: {
|
|
1172
|
-
size: "default",
|
|
1173
|
-
variant: "default"
|
|
1174
|
-
},
|
|
1175
|
-
variants: {
|
|
1176
|
-
size: {
|
|
1177
|
-
default: "h-9 px-[calc(--spacing(3)-1px)] sm:h-8",
|
|
1178
|
-
icon: "size-9 sm:size-8",
|
|
1179
|
-
"icon-lg": "size-10 sm:size-9",
|
|
1180
|
-
"icon-sm": "size-8 sm:size-7",
|
|
1181
|
-
"icon-xl": "size-11 sm:size-10 [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
|
|
1182
|
-
"icon-xs": "size-7 rounded-md before:rounded-[calc(var(--radius-md)-1px)] sm:size-6 not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-4 sm:not-in-data-[slot=input-group]:[&_svg:not([class*='size-'])]:size-3.5",
|
|
1183
|
-
lg: "h-10 px-[calc(--spacing(3.5)-1px)] sm:h-9",
|
|
1184
|
-
sm: "h-8 gap-1.5 px-[calc(--spacing(2.5)-1px)] sm:h-7",
|
|
1185
|
-
xl: "h-11 px-[calc(--spacing(4)-1px)] text-lg sm:h-10 sm:text-base [&_svg:not([class*='size-'])]:size-5 sm:[&_svg:not([class*='size-'])]:size-4.5",
|
|
1186
|
-
xs: "h-7 gap-1 rounded-md px-[calc(--spacing(2)-1px)] text-sm before:rounded-[calc(var(--radius-md)-1px)] sm:h-6 sm:text-xs [&_svg:not([class*='size-'])]:size-4 sm:[&_svg:not([class*='size-'])]:size-3.5"
|
|
1187
|
-
},
|
|
1188
|
-
variant: {
|
|
1189
|
-
default: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-primary bg-primary text-primary-foreground shadow-primary/24 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-primary/90",
|
|
1190
|
-
destructive: "not-disabled:inset-shadow-[0_1px_--theme(--color-white/16%)] border-destructive bg-destructive text-white shadow-destructive/24 [:active,[data-pressed]]:inset-shadow-[0_1px_--theme(--color-black/8%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-destructive/90",
|
|
1191
|
-
"destructive-outline": "border-input bg-transparent not-dark:bg-clip-padding text-destructive-foreground not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/6%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:border-destructive/32 [:hover,[data-pressed]]:bg-destructive/4",
|
|
1192
|
-
ghost: "border-transparent data-pressed:bg-accent [:hover,[data-pressed]]:bg-accent",
|
|
1193
|
-
link: "border-transparent underline-offset-4 [:hover,[data-pressed]]:underline",
|
|
1194
|
-
outline: "border-input bg-background not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/6%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] [:disabled,:active,[data-pressed]]:shadow-none [:hover,[data-pressed]]:bg-accent/50 dark:[:hover,[data-pressed]]:bg-input/64",
|
|
1195
|
-
primary: "border-transparent from-primary-600 to-primary-500 hover:from-primary-500 hover:to-primary-600 bg-linear-to-t text-white inset-shadow-[0_2px_0_0] inset-shadow-white/25 hover:text-white",
|
|
1196
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground [:active,[data-pressed]]:bg-secondary/80 [:hover,[data-pressed]]:bg-secondary/90"
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
});
|
|
1200
|
-
function Button({ className, variant, size, render, ...props }) {
|
|
1201
|
-
const typeValue = render ? void 0 : "button";
|
|
1202
|
-
return useRender({
|
|
1203
|
-
defaultTagName: "button",
|
|
1204
|
-
props: mergeProps({
|
|
1205
|
-
className: cn(buttonVariants({
|
|
1206
|
-
className,
|
|
1207
|
-
size,
|
|
1208
|
-
variant
|
|
1209
|
-
})),
|
|
1210
|
-
"data-slot": "button",
|
|
1211
|
-
type: typeValue
|
|
1212
|
-
}, props),
|
|
1213
|
-
render
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
1102
|
//#endregion
|
|
1218
1103
|
//#region src/components/ui/popover.tsx
|
|
1219
1104
|
const PopoverCreateHandle = Popover$1.createHandle;
|
|
@@ -2511,6 +2396,16 @@ const fetchMedias = async ({ query, filters, page = 1, limit = 10, sortBy, sortO
|
|
|
2511
2396
|
total: 0
|
|
2512
2397
|
};
|
|
2513
2398
|
};
|
|
2399
|
+
const fetchMediaById = async (id) => {
|
|
2400
|
+
try {
|
|
2401
|
+
return (await fetchMedias({
|
|
2402
|
+
filters: { id: id.toString() },
|
|
2403
|
+
limit: 1
|
|
2404
|
+
})).items[0] ?? null;
|
|
2405
|
+
} catch {
|
|
2406
|
+
return null;
|
|
2407
|
+
}
|
|
2408
|
+
};
|
|
2514
2409
|
const MediaUploadZone = ({ onUploadSuccess, acceptedTypes = "image/*,video/*,application/pdf", maxSize = 10 }) => {
|
|
2515
2410
|
const [uploading, setUploading] = useState(false);
|
|
2516
2411
|
const [uploadProgress, setUploadProgress] = useState(0);
|
|
@@ -2531,7 +2426,7 @@ const MediaUploadZone = ({ onUploadSuccess, acceptedTypes = "image/*,video/*,app
|
|
|
2531
2426
|
return new Promise((resolve, reject) => {
|
|
2532
2427
|
try {
|
|
2533
2428
|
const { uploadUrl, langId } = getEditorConfig();
|
|
2534
|
-
const csrfToken =
|
|
2429
|
+
const csrfToken = getCsrfToken();
|
|
2535
2430
|
const formData = new FormData();
|
|
2536
2431
|
formData.append("file", file);
|
|
2537
2432
|
if (langId) formData.append("lang_id", langId);
|
|
@@ -2550,7 +2445,7 @@ const MediaUploadZone = ({ onUploadSuccess, acceptedTypes = "image/*,video/*,app
|
|
|
2550
2445
|
reject(/* @__PURE__ */ new Error("Error during upload"));
|
|
2551
2446
|
});
|
|
2552
2447
|
xhr.open("POST", uploadUrl);
|
|
2553
|
-
if (csrfToken) xhr.setRequestHeader("X-CSRF-TOKEN", csrfToken
|
|
2448
|
+
if (csrfToken) xhr.setRequestHeader("X-CSRF-TOKEN", csrfToken);
|
|
2554
2449
|
xhr.send(formData);
|
|
2555
2450
|
} catch (error) {
|
|
2556
2451
|
reject(error);
|
|
@@ -2812,7 +2707,11 @@ const MediaPicker = ({ value, onChange, mediaType, acceptedTypes = "image/*,vide
|
|
|
2812
2707
|
const handleMediaChange = (media) => {
|
|
2813
2708
|
onChange({
|
|
2814
2709
|
type: "media",
|
|
2815
|
-
media
|
|
2710
|
+
media: {
|
|
2711
|
+
id: media.id,
|
|
2712
|
+
name: media.name,
|
|
2713
|
+
thumbnail: media.thumbnail
|
|
2714
|
+
}
|
|
2816
2715
|
});
|
|
2817
2716
|
};
|
|
2818
2717
|
const handleClear = () => {
|
|
@@ -2826,12 +2725,13 @@ const MediaPicker = ({ value, onChange, mediaType, acceptedTypes = "image/*,vide
|
|
|
2826
2725
|
children: [/* @__PURE__ */ jsx("div", {
|
|
2827
2726
|
className: "flex items-center gap-2",
|
|
2828
2727
|
children: /* @__PURE__ */ jsxs(InputGroup, { children: [
|
|
2829
|
-
currentValue.type === "media" && currentValue.media && /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
2728
|
+
currentValue.type === "media" && currentValue.media?.thumbnail && /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
2830
2729
|
align: "inline-start",
|
|
2831
2730
|
className: "pl-1.5",
|
|
2832
|
-
children: /* @__PURE__ */ jsx(
|
|
2833
|
-
|
|
2834
|
-
|
|
2731
|
+
children: /* @__PURE__ */ jsx("img", {
|
|
2732
|
+
src: currentValue.media.thumbnail,
|
|
2733
|
+
alt: currentValue.media.name,
|
|
2734
|
+
className: cn("max-h-12 my-1.5 aspect-square border border-border rounded-md object-cover")
|
|
2835
2735
|
})
|
|
2836
2736
|
}),
|
|
2837
2737
|
/* @__PURE__ */ jsx(InputGroupInput, {
|
|
@@ -2866,51 +2766,102 @@ const MediaPicker = ({ value, onChange, mediaType, acceptedTypes = "image/*,vide
|
|
|
2866
2766
|
})
|
|
2867
2767
|
});
|
|
2868
2768
|
};
|
|
2769
|
+
/**
|
|
2770
|
+
* Retourne l'URL directe si le type est "url".
|
|
2771
|
+
* Pour les références média (`type: "media"`), utiliser `useMediaUrl` à la place.
|
|
2772
|
+
*/
|
|
2869
2773
|
const getMediaUrl = (value) => {
|
|
2870
2774
|
if (!value) return void 0;
|
|
2871
|
-
if (value.type === "
|
|
2872
|
-
|
|
2775
|
+
if (value.type === "url") return value.url;
|
|
2776
|
+
};
|
|
2777
|
+
/**
|
|
2778
|
+
* Hook React qui résout dynamiquement l'URL courante d'un `MediaPickerValue`.
|
|
2779
|
+
*
|
|
2780
|
+
* Pour les références média (`type: "media"`), l'URL est récupérée depuis
|
|
2781
|
+
* l'API à partir de l'`id` du média — ce qui garantit que le lien reste
|
|
2782
|
+
* valide même si l'URL du fichier a été modifiée après la sélection.
|
|
2783
|
+
*
|
|
2784
|
+
* @example
|
|
2785
|
+
* const { url, loading } = useMediaUrl(value)
|
|
2786
|
+
* return loading ? <Spinner /> : <img src={url} />
|
|
2787
|
+
*/
|
|
2788
|
+
const useMediaUrl = (value) => {
|
|
2789
|
+
const [url, setUrl] = useState(void 0);
|
|
2790
|
+
const [loading, setLoading] = useState(false);
|
|
2791
|
+
const mediaId = value?.type === "media" ? value.media?.id : void 0;
|
|
2792
|
+
const directUrl = value?.type === "url" ? value.url : void 0;
|
|
2793
|
+
useEffect(() => {
|
|
2794
|
+
if (directUrl !== void 0) {
|
|
2795
|
+
setUrl(directUrl || void 0);
|
|
2796
|
+
return;
|
|
2797
|
+
}
|
|
2798
|
+
if (mediaId !== void 0) {
|
|
2799
|
+
let cancelled = false;
|
|
2800
|
+
setLoading(true);
|
|
2801
|
+
fetchMediaById(mediaId).then((media) => {
|
|
2802
|
+
if (!cancelled) setUrl(media ? media.url : void 0);
|
|
2803
|
+
}).catch(() => {
|
|
2804
|
+
if (!cancelled) setUrl(void 0);
|
|
2805
|
+
}).finally(() => {
|
|
2806
|
+
if (!cancelled) setLoading(false);
|
|
2807
|
+
});
|
|
2808
|
+
return () => {
|
|
2809
|
+
cancelled = true;
|
|
2810
|
+
};
|
|
2811
|
+
}
|
|
2812
|
+
setUrl(void 0);
|
|
2813
|
+
}, [mediaId, directUrl]);
|
|
2814
|
+
return {
|
|
2815
|
+
url,
|
|
2816
|
+
loading
|
|
2817
|
+
};
|
|
2873
2818
|
};
|
|
2874
2819
|
|
|
2875
2820
|
//#endregion
|
|
2876
2821
|
//#region src/components/ui/menu.tsx
|
|
2877
|
-
const MenuCreateHandle =
|
|
2878
|
-
const Menu =
|
|
2879
|
-
const MenuPortal =
|
|
2880
|
-
function MenuTrigger(props) {
|
|
2881
|
-
return /* @__PURE__ */ jsx(
|
|
2822
|
+
const MenuCreateHandle = MenuPrimitive.createHandle;
|
|
2823
|
+
const Menu = MenuPrimitive.Root;
|
|
2824
|
+
const MenuPortal = MenuPrimitive.Portal;
|
|
2825
|
+
function MenuTrigger({ className, children, ...props }) {
|
|
2826
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Trigger, {
|
|
2827
|
+
className,
|
|
2882
2828
|
"data-slot": "menu-trigger",
|
|
2883
|
-
...props
|
|
2829
|
+
...props,
|
|
2830
|
+
children
|
|
2884
2831
|
});
|
|
2885
2832
|
}
|
|
2886
|
-
function MenuPopup({ children, className, sideOffset = 4, align = "center", alignOffset, side = "bottom", ...props }) {
|
|
2887
|
-
return /* @__PURE__ */ jsx(
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2833
|
+
function MenuPopup({ children, className, sideOffset = 4, align = "center", alignOffset, side = "bottom", anchor, portalProps, ...props }) {
|
|
2834
|
+
return /* @__PURE__ */ jsx(MenuPortal, {
|
|
2835
|
+
...portalProps,
|
|
2836
|
+
children: /* @__PURE__ */ jsx(MenuPrimitive.Positioner, {
|
|
2837
|
+
align,
|
|
2838
|
+
alignOffset,
|
|
2839
|
+
anchor,
|
|
2840
|
+
className: "z-50",
|
|
2841
|
+
"data-slot": "menu-positioner",
|
|
2842
|
+
side,
|
|
2843
|
+
sideOffset,
|
|
2844
|
+
children: /* @__PURE__ */ jsx(MenuPrimitive.Popup, {
|
|
2845
|
+
className: cn("relative flex not-[class*='w-']:min-w-32 origin-(--transform-origin) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 outline-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] focus:outline-none dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", className),
|
|
2846
|
+
"data-slot": "menu-popup",
|
|
2847
|
+
...props,
|
|
2848
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2849
|
+
className: "max-h-(--available-height) w-full overflow-y-auto p-1",
|
|
2850
|
+
children
|
|
2851
|
+
})
|
|
2901
2852
|
})
|
|
2902
2853
|
})
|
|
2903
|
-
})
|
|
2854
|
+
});
|
|
2904
2855
|
}
|
|
2905
2856
|
function MenuGroup(props) {
|
|
2906
|
-
return /* @__PURE__ */ jsx(
|
|
2857
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Group, {
|
|
2907
2858
|
"data-slot": "menu-group",
|
|
2908
2859
|
...props
|
|
2909
2860
|
});
|
|
2910
2861
|
}
|
|
2911
2862
|
function MenuItem({ className, inset, variant = "default", ...props }) {
|
|
2912
|
-
return /* @__PURE__ */ jsx(
|
|
2913
|
-
className: cn("
|
|
2863
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Item, {
|
|
2864
|
+
className: cn("flex min-h-8 cursor-default select-none items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-inset:ps-8 data-[variant=destructive]:text-destructive-foreground data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not([class*='opacity-'])]:opacity-80 [&>svg:not([class*='size-'])]:size-4.5 sm:[&>svg:not([class*='size-'])]:size-4 [&>svg]:pointer-events-none [&>svg]:-mx-0.5 [&>svg]:shrink-0", className),
|
|
2914
2865
|
"data-inset": inset,
|
|
2915
2866
|
"data-slot": "menu-item",
|
|
2916
2867
|
"data-variant": variant,
|
|
@@ -2918,21 +2869,22 @@ function MenuItem({ className, inset, variant = "default", ...props }) {
|
|
|
2918
2869
|
});
|
|
2919
2870
|
}
|
|
2920
2871
|
function MenuCheckboxItem({ className, children, checked, variant = "default", ...props }) {
|
|
2921
|
-
return /* @__PURE__ */ jsx(
|
|
2872
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.CheckboxItem, {
|
|
2922
2873
|
checked,
|
|
2923
|
-
className: cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 ps-2 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", variant === "switch" ? "grid-cols-[1fr_auto] gap-4 pe-1.5" : "grid-cols-[
|
|
2874
|
+
className: cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default items-center gap-2 rounded-sm py-1 ps-2 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", variant === "switch" ? "grid-cols-[1fr_auto] gap-4 pe-1.5" : "grid-cols-[.75rem_1fr] pe-4", className),
|
|
2924
2875
|
"data-slot": "menu-checkbox-item",
|
|
2925
2876
|
...props,
|
|
2926
2877
|
children: variant === "switch" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
2927
2878
|
className: "col-start-1",
|
|
2928
2879
|
children
|
|
2929
|
-
}), /* @__PURE__ */ jsx(
|
|
2930
|
-
className: "inset-shadow-[0_1px_--theme(--color-black/
|
|
2880
|
+
}), /* @__PURE__ */ jsx(MenuPrimitive.CheckboxItemIndicator, {
|
|
2881
|
+
className: "inset-shadow-[0_1px_--theme(--color-black/4%)] inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(4)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:opacity-64 sm:[--thumb-size:--spacing(3)]",
|
|
2931
2882
|
keepMounted: true,
|
|
2932
2883
|
children: /* @__PURE__ */ jsx("span", { className: "pointer-events-none block aspect-square h-full in-[[data-slot=menu-checkbox-item][data-checked]]:origin-[var(--thumb-size)_50%] origin-left in-[[data-slot=menu-checkbox-item][data-checked]]:translate-x-[calc(var(--thumb-size)-4px)] in-[[data-slot=menu-checkbox-item]:active]:not-data-disabled:scale-x-110 in-[[data-slot=menu-checkbox-item]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.10)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s]" })
|
|
2933
|
-
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(
|
|
2934
|
-
className: "col-start-1",
|
|
2884
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuPrimitive.CheckboxItemIndicator, {
|
|
2885
|
+
className: "col-start-1 -ms-0.5",
|
|
2935
2886
|
children: /* @__PURE__ */ jsx("svg", {
|
|
2887
|
+
"aria-hidden": "true",
|
|
2936
2888
|
fill: "none",
|
|
2937
2889
|
height: "24",
|
|
2938
2890
|
stroke: "currentColor",
|
|
@@ -2951,19 +2903,20 @@ function MenuCheckboxItem({ className, children, checked, variant = "default", .
|
|
|
2951
2903
|
});
|
|
2952
2904
|
}
|
|
2953
2905
|
function MenuRadioGroup(props) {
|
|
2954
|
-
return /* @__PURE__ */ jsx(
|
|
2906
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.RadioGroup, {
|
|
2955
2907
|
"data-slot": "menu-radio-group",
|
|
2956
2908
|
...props
|
|
2957
2909
|
});
|
|
2958
2910
|
}
|
|
2959
2911
|
function MenuRadioItem({ className, children, ...props }) {
|
|
2960
|
-
return /* @__PURE__ */ jsxs(
|
|
2961
|
-
className: cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[
|
|
2912
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.RadioItem, {
|
|
2913
|
+
className: cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[.75rem_1fr] items-center gap-2 rounded-sm py-1 ps-2 pe-4 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", className),
|
|
2962
2914
|
"data-slot": "menu-radio-item",
|
|
2963
2915
|
...props,
|
|
2964
|
-
children: [/* @__PURE__ */ jsx(
|
|
2965
|
-
className: "col-start-1",
|
|
2916
|
+
children: [/* @__PURE__ */ jsx(MenuPrimitive.RadioItemIndicator, {
|
|
2917
|
+
className: "col-start-1 -ms-0.5",
|
|
2966
2918
|
children: /* @__PURE__ */ jsx("svg", {
|
|
2919
|
+
"aria-hidden": "true",
|
|
2967
2920
|
fill: "none",
|
|
2968
2921
|
height: "24",
|
|
2969
2922
|
stroke: "currentColor",
|
|
@@ -2982,7 +2935,7 @@ function MenuRadioItem({ className, children, ...props }) {
|
|
|
2982
2935
|
});
|
|
2983
2936
|
}
|
|
2984
2937
|
function MenuGroupLabel({ className, inset, ...props }) {
|
|
2985
|
-
return /* @__PURE__ */ jsx(
|
|
2938
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.GroupLabel, {
|
|
2986
2939
|
className: cn("px-2 py-1.5 font-medium text-muted-foreground text-xs data-inset:ps-9 sm:data-inset:ps-8", className),
|
|
2987
2940
|
"data-inset": inset,
|
|
2988
2941
|
"data-slot": "menu-label",
|
|
@@ -2990,32 +2943,25 @@ function MenuGroupLabel({ className, inset, ...props }) {
|
|
|
2990
2943
|
});
|
|
2991
2944
|
}
|
|
2992
2945
|
function MenuSeparator({ className, ...props }) {
|
|
2993
|
-
return /* @__PURE__ */ jsx(
|
|
2946
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.Separator, {
|
|
2994
2947
|
className: cn("mx-2 my-1 h-px bg-border", className),
|
|
2995
2948
|
"data-slot": "menu-separator",
|
|
2996
2949
|
...props
|
|
2997
2950
|
});
|
|
2998
2951
|
}
|
|
2999
|
-
function MenuShortcut({ className, ...props }) {
|
|
3000
|
-
return /* @__PURE__ */ jsx("kbd", {
|
|
3001
|
-
className: cn("ms-auto font-medium font-sans text-muted-foreground/72 text-xs tracking-widest", className),
|
|
3002
|
-
"data-slot": "menu-shortcut",
|
|
3003
|
-
...props
|
|
3004
|
-
});
|
|
3005
|
-
}
|
|
3006
2952
|
function MenuSub(props) {
|
|
3007
|
-
return /* @__PURE__ */ jsx(
|
|
2953
|
+
return /* @__PURE__ */ jsx(MenuPrimitive.SubmenuRoot, {
|
|
3008
2954
|
"data-slot": "menu-sub",
|
|
3009
2955
|
...props
|
|
3010
2956
|
});
|
|
3011
2957
|
}
|
|
3012
2958
|
function MenuSubTrigger({ className, inset, children, ...props }) {
|
|
3013
|
-
return /* @__PURE__ */ jsxs(
|
|
3014
|
-
className: cn("flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none", className),
|
|
2959
|
+
return /* @__PURE__ */ jsxs(MenuPrimitive.SubmenuTrigger, {
|
|
2960
|
+
className: cn("flex min-h-8 items-center gap-2 rounded-sm px-2 py-1 text-base text-foreground outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-popup-open:bg-accent data-inset:ps-8 data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&>svg:not(:last-child)]:-mx-0.5 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none", className),
|
|
3015
2961
|
"data-inset": inset,
|
|
3016
2962
|
"data-slot": "menu-sub-trigger",
|
|
3017
2963
|
...props,
|
|
3018
|
-
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "-me-0.5
|
|
2964
|
+
children: [children, /* @__PURE__ */ jsx(ChevronRightIcon, { className: "ms-auto -me-0.5 opacity-80" })]
|
|
3019
2965
|
});
|
|
3020
2966
|
}
|
|
3021
2967
|
function MenuSubPopup({ className, sideOffset = 0, alignOffset, align = "start", ...props }) {
|
|
@@ -3180,6 +3126,321 @@ function AnchoredToasts() {
|
|
|
3180
3126
|
});
|
|
3181
3127
|
}
|
|
3182
3128
|
|
|
3129
|
+
//#endregion
|
|
3130
|
+
//#region src/blocks/Template/index.tsx
|
|
3131
|
+
const usePuck = createUsePuck();
|
|
3132
|
+
/**
|
|
3133
|
+
* Module-level cache keyed by storageKey.
|
|
3134
|
+
* Populated when the field is rendered; consumed by resolveData.
|
|
3135
|
+
*/
|
|
3136
|
+
const _resolveCache = /* @__PURE__ */ new Map();
|
|
3137
|
+
const resolveApiUrl = (apiUrl) => {
|
|
3138
|
+
if (!apiUrl) return void 0;
|
|
3139
|
+
return typeof apiUrl === "function" ? apiUrl() : apiUrl;
|
|
3140
|
+
};
|
|
3141
|
+
/**
|
|
3142
|
+
* Factory that returns a ready-to-use Puck `ComponentConfig` for a Template
|
|
3143
|
+
* block.
|
|
3144
|
+
*
|
|
3145
|
+
* Without `apiUrl` — templates are saved in `localStorage` (per-browser).
|
|
3146
|
+
* With `apiUrl` — templates are saved in a database and shared across all
|
|
3147
|
+
* users and devices.
|
|
3148
|
+
*
|
|
3149
|
+
* @example
|
|
3150
|
+
* // Basic (localStorage)
|
|
3151
|
+
* Template: createTemplateBlock({ storageKey: 'my-project' })
|
|
3152
|
+
*
|
|
3153
|
+
* // Database-backed (shared)
|
|
3154
|
+
* Template: createTemplateBlock({
|
|
3155
|
+
* storageKey: 'my-project',
|
|
3156
|
+
* apiUrl: () => document.getElementById('editor')?.dataset.templatesUrl,
|
|
3157
|
+
* getHeaders: () => ({ 'X-CSRF-TOKEN': getCsrfToken() }),
|
|
3158
|
+
* })
|
|
3159
|
+
*/
|
|
3160
|
+
function createTemplateBlock(options = {}) {
|
|
3161
|
+
const { storageKey = "puck-template", defaultTemplates = {}, apiUrl, getHeaders } = options;
|
|
3162
|
+
const localStorageKey = `puck-templates:${storageKey}`;
|
|
3163
|
+
const useApi = !!apiUrl;
|
|
3164
|
+
/** Read saved templates from the appropriate storage. */
|
|
3165
|
+
const getStoredTemplates = () => {
|
|
3166
|
+
if (useApi) return _resolveCache.get(storageKey) ?? {};
|
|
3167
|
+
try {
|
|
3168
|
+
return JSON.parse(localStorage.getItem(localStorageKey) ?? "{}");
|
|
3169
|
+
} catch {
|
|
3170
|
+
return {};
|
|
3171
|
+
}
|
|
3172
|
+
};
|
|
3173
|
+
return {
|
|
3174
|
+
fields: {
|
|
3175
|
+
template: {
|
|
3176
|
+
type: "custom",
|
|
3177
|
+
render: ({ name, value, onChange }) => {
|
|
3178
|
+
const config = usePuck((s) => s.config);
|
|
3179
|
+
const props = usePuck((s) => s.selectedItem?.props);
|
|
3180
|
+
const [apiTemplates, setApiTemplates] = useState([]);
|
|
3181
|
+
const [localTemplates, setLocalTemplates] = useState(useApi ? {} : JSON.parse(localStorage.getItem(localStorageKey) ?? "{}"));
|
|
3182
|
+
const [isLoading, setIsLoading] = useState(useApi);
|
|
3183
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
3184
|
+
const [newTemplateName, setNewTemplateName] = useState("");
|
|
3185
|
+
useEffect(() => {
|
|
3186
|
+
if (!useApi) return;
|
|
3187
|
+
const url = resolveApiUrl(apiUrl);
|
|
3188
|
+
if (!url) {
|
|
3189
|
+
setIsLoading(false);
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
setIsLoading(true);
|
|
3193
|
+
fetch(`${url}?key=${encodeURIComponent(storageKey)}`, {
|
|
3194
|
+
headers: {
|
|
3195
|
+
Accept: "application/json",
|
|
3196
|
+
...getHeaders?.() ?? {}
|
|
3197
|
+
},
|
|
3198
|
+
credentials: "same-origin"
|
|
3199
|
+
}).then((r) => r.json()).then((json) => {
|
|
3200
|
+
const tpls = json.templates ?? [];
|
|
3201
|
+
setApiTemplates(tpls);
|
|
3202
|
+
syncCache(tpls);
|
|
3203
|
+
}).catch(() => {}).finally(() => setIsLoading(false));
|
|
3204
|
+
}, []);
|
|
3205
|
+
const syncCache = (tpls) => {
|
|
3206
|
+
const cached = {};
|
|
3207
|
+
tpls.forEach((t) => {
|
|
3208
|
+
cached[String(t.id)] = {
|
|
3209
|
+
label: t.name,
|
|
3210
|
+
data: t.data
|
|
3211
|
+
};
|
|
3212
|
+
});
|
|
3213
|
+
_resolveCache.set(storageKey, cached);
|
|
3214
|
+
};
|
|
3215
|
+
const handleSave = async () => {
|
|
3216
|
+
if (!props?.children?.length) return;
|
|
3217
|
+
setIsSaving(true);
|
|
3218
|
+
try {
|
|
3219
|
+
const data = props.children.map((child) => {
|
|
3220
|
+
return walkTree({
|
|
3221
|
+
type: child.type,
|
|
3222
|
+
props: {
|
|
3223
|
+
...child.props,
|
|
3224
|
+
id: crypto.randomUUID()
|
|
3225
|
+
}
|
|
3226
|
+
}, config, (content) => content.map((item) => ({
|
|
3227
|
+
...item,
|
|
3228
|
+
props: {
|
|
3229
|
+
...item.props,
|
|
3230
|
+
id: crypto.randomUUID()
|
|
3231
|
+
}
|
|
3232
|
+
})));
|
|
3233
|
+
});
|
|
3234
|
+
const label = newTemplateName.trim() || (/* @__PURE__ */ new Date()).toLocaleString();
|
|
3235
|
+
if (useApi) {
|
|
3236
|
+
const url = resolveApiUrl(apiUrl);
|
|
3237
|
+
const created = (await (await fetch(url, {
|
|
3238
|
+
method: "POST",
|
|
3239
|
+
headers: {
|
|
3240
|
+
"Content-Type": "application/json",
|
|
3241
|
+
Accept: "application/json",
|
|
3242
|
+
...getHeaders?.() ?? {}
|
|
3243
|
+
},
|
|
3244
|
+
credentials: "same-origin",
|
|
3245
|
+
body: JSON.stringify({
|
|
3246
|
+
key: storageKey,
|
|
3247
|
+
name: label,
|
|
3248
|
+
data
|
|
3249
|
+
})
|
|
3250
|
+
})).json()).template;
|
|
3251
|
+
const updated = [...apiTemplates, created];
|
|
3252
|
+
setApiTemplates(updated);
|
|
3253
|
+
syncCache(updated);
|
|
3254
|
+
onChange(String(created.id));
|
|
3255
|
+
} else {
|
|
3256
|
+
const templateId = crypto.randomUUID();
|
|
3257
|
+
const updated = {
|
|
3258
|
+
...localTemplates,
|
|
3259
|
+
[templateId]: {
|
|
3260
|
+
label,
|
|
3261
|
+
data
|
|
3262
|
+
}
|
|
3263
|
+
};
|
|
3264
|
+
localStorage.setItem(localStorageKey, JSON.stringify(updated));
|
|
3265
|
+
setLocalTemplates(updated);
|
|
3266
|
+
onChange(templateId);
|
|
3267
|
+
}
|
|
3268
|
+
setNewTemplateName("");
|
|
3269
|
+
} finally {
|
|
3270
|
+
setIsSaving(false);
|
|
3271
|
+
}
|
|
3272
|
+
};
|
|
3273
|
+
const handleDelete = async (templateValue) => {
|
|
3274
|
+
if (useApi) {
|
|
3275
|
+
const url = resolveApiUrl(apiUrl);
|
|
3276
|
+
await fetch(`${url}/${templateValue}`, {
|
|
3277
|
+
method: "DELETE",
|
|
3278
|
+
headers: {
|
|
3279
|
+
Accept: "application/json",
|
|
3280
|
+
...getHeaders?.() ?? {}
|
|
3281
|
+
},
|
|
3282
|
+
credentials: "same-origin"
|
|
3283
|
+
});
|
|
3284
|
+
const updated = apiTemplates.filter((t) => String(t.id) !== templateValue);
|
|
3285
|
+
setApiTemplates(updated);
|
|
3286
|
+
syncCache(updated);
|
|
3287
|
+
} else {
|
|
3288
|
+
const { [templateValue]: _, ...rest } = localTemplates;
|
|
3289
|
+
localStorage.setItem(localStorageKey, JSON.stringify(rest));
|
|
3290
|
+
setLocalTemplates(rest);
|
|
3291
|
+
}
|
|
3292
|
+
if (value === templateValue) onChange("blank");
|
|
3293
|
+
};
|
|
3294
|
+
const builtInOptions = [{
|
|
3295
|
+
label: "Blank",
|
|
3296
|
+
value: "blank"
|
|
3297
|
+
}, ...Object.entries(defaultTemplates).map(([k, t]) => ({
|
|
3298
|
+
value: k,
|
|
3299
|
+
label: t.label
|
|
3300
|
+
}))];
|
|
3301
|
+
const savedOptions = useApi ? apiTemplates.map((t) => ({
|
|
3302
|
+
value: String(t.id),
|
|
3303
|
+
label: t.name
|
|
3304
|
+
})) : Object.entries(localTemplates).map(([k, t]) => ({
|
|
3305
|
+
value: k,
|
|
3306
|
+
label: t.label
|
|
3307
|
+
}));
|
|
3308
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
3309
|
+
className: "flex flex-col gap-3",
|
|
3310
|
+
children: [isLoading ? /* @__PURE__ */ jsxs(Label$2, {
|
|
3311
|
+
className: "justify-start",
|
|
3312
|
+
children: [/* @__PURE__ */ jsx(Loader2Icon, {
|
|
3313
|
+
size: 16,
|
|
3314
|
+
className: "animate-spin"
|
|
3315
|
+
}), "Templates loading..."]
|
|
3316
|
+
}) : /* @__PURE__ */ jsx(AutoField, {
|
|
3317
|
+
value,
|
|
3318
|
+
onChange,
|
|
3319
|
+
field: {
|
|
3320
|
+
label: "Select a template",
|
|
3321
|
+
type: "select",
|
|
3322
|
+
options: [...builtInOptions, ...savedOptions]
|
|
3323
|
+
}
|
|
3324
|
+
}), savedOptions.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
3325
|
+
style: {
|
|
3326
|
+
marginTop: 8,
|
|
3327
|
+
borderTop: "1px solid var(--puck-color-grey-09)",
|
|
3328
|
+
paddingTop: 8
|
|
3329
|
+
},
|
|
3330
|
+
children: savedOptions.map((opt) => /* @__PURE__ */ jsxs("div", {
|
|
3331
|
+
style: {
|
|
3332
|
+
display: "flex",
|
|
3333
|
+
alignItems: "center",
|
|
3334
|
+
justifyContent: "space-between",
|
|
3335
|
+
padding: "3px 0",
|
|
3336
|
+
fontSize: 11,
|
|
3337
|
+
color: "var(--puck-color-grey-04)"
|
|
3338
|
+
},
|
|
3339
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3340
|
+
style: {
|
|
3341
|
+
overflow: "hidden",
|
|
3342
|
+
textOverflow: "ellipsis",
|
|
3343
|
+
whiteSpace: "nowrap",
|
|
3344
|
+
marginRight: 4
|
|
3345
|
+
},
|
|
3346
|
+
children: opt.label
|
|
3347
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
3348
|
+
onClick: () => handleDelete(opt.value),
|
|
3349
|
+
style: {
|
|
3350
|
+
background: "none",
|
|
3351
|
+
border: "none",
|
|
3352
|
+
cursor: "pointer",
|
|
3353
|
+
padding: 2,
|
|
3354
|
+
color: "var(--puck-color-rose-06, #e11d48)",
|
|
3355
|
+
flexShrink: 0,
|
|
3356
|
+
display: "flex",
|
|
3357
|
+
alignItems: "center"
|
|
3358
|
+
},
|
|
3359
|
+
title: "Supprimer ce template",
|
|
3360
|
+
type: "button",
|
|
3361
|
+
children: /* @__PURE__ */ jsx(Trash2Icon, { size: 12 })
|
|
3362
|
+
})]
|
|
3363
|
+
}, opt.value))
|
|
3364
|
+
})]
|
|
3365
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3366
|
+
className: "flex flex-col gap-3",
|
|
3367
|
+
children: [
|
|
3368
|
+
/* @__PURE__ */ jsx(Label$2, {
|
|
3369
|
+
className: "mb-0",
|
|
3370
|
+
children: "Nom du template"
|
|
3371
|
+
}),
|
|
3372
|
+
/* @__PURE__ */ jsx(Input, {
|
|
3373
|
+
type: "text",
|
|
3374
|
+
value: newTemplateName,
|
|
3375
|
+
onChange: (e) => setNewTemplateName(e.target.value),
|
|
3376
|
+
onKeyDown: (e) => {
|
|
3377
|
+
if (e.key === "Enter" && !isSaving && props?.children?.length) handleSave();
|
|
3378
|
+
},
|
|
3379
|
+
placeholder: (/* @__PURE__ */ new Date()).toLocaleString()
|
|
3380
|
+
}),
|
|
3381
|
+
/* @__PURE__ */ jsx(Button, {
|
|
3382
|
+
variant: "outline",
|
|
3383
|
+
onClick: handleSave,
|
|
3384
|
+
disabled: isSaving || !props?.children?.length,
|
|
3385
|
+
children: isSaving ? "Sauvegarde…" : "Sauvegarder comme template"
|
|
3386
|
+
})
|
|
3387
|
+
]
|
|
3388
|
+
})] });
|
|
3389
|
+
}
|
|
3390
|
+
},
|
|
3391
|
+
children: { type: "slot" }
|
|
3392
|
+
},
|
|
3393
|
+
defaultProps: {
|
|
3394
|
+
template: "blank",
|
|
3395
|
+
children: []
|
|
3396
|
+
},
|
|
3397
|
+
resolveData: async (data, { changed, trigger }) => {
|
|
3398
|
+
if (!changed.template || trigger === "load") return data;
|
|
3399
|
+
const allTemplates = {
|
|
3400
|
+
blank: {
|
|
3401
|
+
label: "Blank",
|
|
3402
|
+
data: []
|
|
3403
|
+
},
|
|
3404
|
+
...defaultTemplates,
|
|
3405
|
+
...getStoredTemplates()
|
|
3406
|
+
};
|
|
3407
|
+
if (useApi && !allTemplates[data.props.template]) try {
|
|
3408
|
+
const url = resolveApiUrl(apiUrl);
|
|
3409
|
+
if (url) {
|
|
3410
|
+
const tpls = (await (await fetch(`${url}?key=${encodeURIComponent(storageKey)}`, {
|
|
3411
|
+
headers: {
|
|
3412
|
+
Accept: "application/json",
|
|
3413
|
+
...getHeaders?.() ?? {}
|
|
3414
|
+
},
|
|
3415
|
+
credentials: "same-origin"
|
|
3416
|
+
})).json()).templates ?? [];
|
|
3417
|
+
const cached = {};
|
|
3418
|
+
tpls.forEach((t) => {
|
|
3419
|
+
cached[String(t.id)] = {
|
|
3420
|
+
label: t.name,
|
|
3421
|
+
data: t.data
|
|
3422
|
+
};
|
|
3423
|
+
});
|
|
3424
|
+
_resolveCache.set(storageKey, cached);
|
|
3425
|
+
Object.assign(allTemplates, cached);
|
|
3426
|
+
}
|
|
3427
|
+
} catch {}
|
|
3428
|
+
const children = allTemplates[data.props.template]?.data ?? allTemplates["blank"].data;
|
|
3429
|
+
return {
|
|
3430
|
+
...data,
|
|
3431
|
+
props: {
|
|
3432
|
+
...data.props,
|
|
3433
|
+
children
|
|
3434
|
+
}
|
|
3435
|
+
};
|
|
3436
|
+
},
|
|
3437
|
+
render: ({ children: Children$1 }) => /* @__PURE__ */ jsx("div", {
|
|
3438
|
+
className: "flex flex-col md:grid",
|
|
3439
|
+
children: /* @__PURE__ */ jsx(Children$1, {})
|
|
3440
|
+
})
|
|
3441
|
+
};
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3183
3444
|
//#endregion
|
|
3184
3445
|
//#region src/utils/animation.tsx
|
|
3185
3446
|
const animationField = { animation: {
|
|
@@ -3284,6 +3545,112 @@ function animationToAttributes(animation) {
|
|
|
3284
3545
|
}
|
|
3285
3546
|
const animationDefaultProps = { animation: "" };
|
|
3286
3547
|
|
|
3548
|
+
//#endregion
|
|
3549
|
+
//#region src/components/ui/group.tsx
|
|
3550
|
+
const groupVariants = cva("flex w-fit *:focus-visible:z-1 has-[>[data-slot=group]]:gap-2 *:has-focus-visible:z-1 dark:*:[[data-slot=separator]:has(~button:hover):not(:has(~[data-slot=separator]~[data-slot]:hover)),[data-slot=separator]:has(~[data-slot][data-pressed]):not(:has(~[data-slot=separator]~[data-slot][data-pressed]))]:before:bg-input/64 dark:*:[button:hover~[data-slot=separator]:not([data-slot]:hover~[data-slot=separator]~[data-slot=separator]),[data-slot][data-pressed]~[data-slot=separator]:not([data-slot][data-pressed]~[data-slot=separator]~[data-slot=separator])]:before:bg-input/64", {
|
|
3551
|
+
defaultVariants: { orientation: "horizontal" },
|
|
3552
|
+
variants: { orientation: {
|
|
3553
|
+
horizontal: "*:[[data-slot]~[data-slot]:not([data-slot=separator])]:before:-start-[0.5px] *:data-slot:not-data-[slot=separator]:has-[~[data-slot]]:before:-end-[0.5px] *:pointer-coarse:after:min-w-auto *:data-slot:has-[~[data-slot]]:rounded-e-none *:data-slot:has-[~[data-slot]]:border-e-0 *:data-slot:has-[~[data-slot]]:before:rounded-e-none *:[[data-slot]~[data-slot]]:rounded-s-none *:[[data-slot]~[data-slot]]:border-s-0 *:[[data-slot]~[data-slot]]:before:rounded-s-none",
|
|
3554
|
+
vertical: "*:[[data-slot]~[data-slot]:not([data-slot=separator])]:before:-top-[0.5px] *:data-slot:not-data-[slot=separator]:has-[~[data-slot]]:before:-bottom-[0.5px] flex-col *:pointer-coarse:after:min-h-auto *:data-slot:has-[~[data-slot]]:rounded-b-none *:data-slot:has-[~[data-slot]]:border-b-0 *:data-slot:not-data-[slot=separator]:has-[~[data-slot]]:before:hidden *:data-slot:has-[~[data-slot]]:before:rounded-b-none dark:*:last:before:hidden dark:*:first:before:block *:[[data-slot]~[data-slot]]:rounded-t-none *:[[data-slot]~[data-slot]]:border-t-0 *:[[data-slot]~[data-slot]]:before:rounded-t-none"
|
|
3555
|
+
} }
|
|
3556
|
+
});
|
|
3557
|
+
function Group({ className, orientation, children, ...props }) {
|
|
3558
|
+
return /* @__PURE__ */ jsx("div", {
|
|
3559
|
+
className: cn(groupVariants({ orientation }), className),
|
|
3560
|
+
"data-orientation": orientation,
|
|
3561
|
+
"data-slot": "group",
|
|
3562
|
+
role: "group",
|
|
3563
|
+
...props,
|
|
3564
|
+
children
|
|
3565
|
+
});
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3568
|
+
//#endregion
|
|
3569
|
+
//#region src/utils/customClasses.tsx
|
|
3570
|
+
function CustomClassesField({ value, onChange, field }) {
|
|
3571
|
+
const [input, setInput] = useState("");
|
|
3572
|
+
const tags = value || [];
|
|
3573
|
+
const addTag = () => {
|
|
3574
|
+
const trimmed = input.trim();
|
|
3575
|
+
if (!trimmed || tags.includes(trimmed)) {
|
|
3576
|
+
setInput("");
|
|
3577
|
+
return;
|
|
3578
|
+
}
|
|
3579
|
+
onChange([...tags, trimmed]);
|
|
3580
|
+
setInput("");
|
|
3581
|
+
};
|
|
3582
|
+
const removeTag = (tag) => {
|
|
3583
|
+
onChange(tags.filter((t) => t !== tag));
|
|
3584
|
+
};
|
|
3585
|
+
const handleKeyDown = (e) => {
|
|
3586
|
+
if (e.key === "Enter") {
|
|
3587
|
+
e.preventDefault();
|
|
3588
|
+
addTag();
|
|
3589
|
+
}
|
|
3590
|
+
};
|
|
3591
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, { label: field.label }), /* @__PURE__ */ jsxs("div", {
|
|
3592
|
+
className: "flex flex-col gap-y-2",
|
|
3593
|
+
children: [tags.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
3594
|
+
className: "flex flex-wrap gap-1",
|
|
3595
|
+
children: tags.map((tag) => /* @__PURE__ */ jsxs("div", {
|
|
3596
|
+
className: "flex items-center gap-1 pl-1.5 pr-1 py-0.5 bg-secondary text-secondary-foreground rounded-md text-xs leading-none",
|
|
3597
|
+
children: [tag, /* @__PURE__ */ jsx(Button, {
|
|
3598
|
+
size: "icon-xs",
|
|
3599
|
+
variant: "ghost",
|
|
3600
|
+
className: "!size-4 rounded-sm hover:text-destructive text-secondary-foreground/50",
|
|
3601
|
+
type: "button",
|
|
3602
|
+
onClick: () => removeTag(tag),
|
|
3603
|
+
"aria-label": `Delete ${tag}`,
|
|
3604
|
+
children: /* @__PURE__ */ jsx(XIcon, { size: 10 })
|
|
3605
|
+
})]
|
|
3606
|
+
}, tag))
|
|
3607
|
+
}), /* @__PURE__ */ jsxs(Group, {
|
|
3608
|
+
"aria-label": "Custom classes",
|
|
3609
|
+
className: "gap-2 w-full",
|
|
3610
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
3611
|
+
type: "text",
|
|
3612
|
+
value: input,
|
|
3613
|
+
placeholder: "Class name",
|
|
3614
|
+
onChange: (e) => setInput(e.currentTarget.value),
|
|
3615
|
+
onKeyDown: handleKeyDown
|
|
3616
|
+
}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
3617
|
+
size: "icon",
|
|
3618
|
+
variant: "primary",
|
|
3619
|
+
onClick: addTag,
|
|
3620
|
+
"aria-label": "Add",
|
|
3621
|
+
children: /* @__PURE__ */ jsx(PlusIcon, {})
|
|
3622
|
+
}) })]
|
|
3623
|
+
})]
|
|
3624
|
+
})] });
|
|
3625
|
+
}
|
|
3626
|
+
const customClassesField = { customClasses: {
|
|
3627
|
+
type: "custom",
|
|
3628
|
+
label: "Classes",
|
|
3629
|
+
render: ({ value, onChange, field }) => /* @__PURE__ */ jsx(CustomClassesField, {
|
|
3630
|
+
value,
|
|
3631
|
+
onChange,
|
|
3632
|
+
field
|
|
3633
|
+
})
|
|
3634
|
+
} };
|
|
3635
|
+
function customClassesToClasses(customClasses) {
|
|
3636
|
+
if (!customClasses || customClasses.length === 0) return "";
|
|
3637
|
+
return customClasses.join(" ");
|
|
3638
|
+
}
|
|
3639
|
+
const customClassesDefaultProps = { customClasses: [] };
|
|
3640
|
+
|
|
3641
|
+
//#endregion
|
|
3642
|
+
//#region src/utils/pagePicker.tsx
|
|
3643
|
+
const pageField = {
|
|
3644
|
+
type: "custom",
|
|
3645
|
+
render: ({ value, onChange, field }) => /* @__PURE__ */ jsxs(Fragment, { children: [field.label && /* @__PURE__ */ jsx(Label_default, {
|
|
3646
|
+
label: field.label,
|
|
3647
|
+
tooltip: field.tooltip
|
|
3648
|
+
}), /* @__PURE__ */ jsx(PagePicker, {
|
|
3649
|
+
value,
|
|
3650
|
+
onChange
|
|
3651
|
+
})] })
|
|
3652
|
+
};
|
|
3653
|
+
|
|
3287
3654
|
//#endregion
|
|
3288
3655
|
//#region src/utils/display.tsx
|
|
3289
3656
|
const displayField = { display: {
|
|
@@ -4236,6 +4603,20 @@ const typographyFieldNames = [
|
|
|
4236
4603
|
"fontWeight"
|
|
4237
4604
|
];
|
|
4238
4605
|
|
|
4606
|
+
//#endregion
|
|
4607
|
+
//#region src/utils/csrf.ts
|
|
4608
|
+
/**
|
|
4609
|
+
* Récupère le jeton CSRF à partir d'une balise meta dans le DOM.
|
|
4610
|
+
* Standard Laravel : <meta name="csrf-token" content="...">
|
|
4611
|
+
*
|
|
4612
|
+
* @returns Le jeton CSRF sous forme de chaîne, ou null s'il n'est pas trouvé ou si l'exécution n'est pas côté client.
|
|
4613
|
+
*/
|
|
4614
|
+
function getCsrfToken() {
|
|
4615
|
+
if (typeof document === "undefined") return null;
|
|
4616
|
+
const meta = document.querySelector("meta[name=\"csrf-token\"]");
|
|
4617
|
+
return meta ? meta.getAttribute("content") : null;
|
|
4618
|
+
}
|
|
4619
|
+
|
|
4239
4620
|
//#endregion
|
|
4240
4621
|
//#region src/hooks/useOptimizedImage.tsx
|
|
4241
4622
|
const BREAKPOINTS = [
|
|
@@ -4333,5 +4714,383 @@ function useOptimizedImage(src) {
|
|
|
4333
4714
|
}
|
|
4334
4715
|
|
|
4335
4716
|
//#endregion
|
|
4336
|
-
|
|
4717
|
+
//#region src/plugins/redactor-assistant/utils/constants.ts
|
|
4718
|
+
const QUICK_ACTIONS = [
|
|
4719
|
+
{
|
|
4720
|
+
label: "Improve",
|
|
4721
|
+
task: "rewrite",
|
|
4722
|
+
instructions: "Improve this text to make it clearer and more engaging."
|
|
4723
|
+
},
|
|
4724
|
+
{
|
|
4725
|
+
label: "Shorten",
|
|
4726
|
+
task: "rewrite",
|
|
4727
|
+
instructions: "Shorten this text while keeping the essential ideas."
|
|
4728
|
+
},
|
|
4729
|
+
{
|
|
4730
|
+
label: "Lengthen",
|
|
4731
|
+
task: "rewrite",
|
|
4732
|
+
instructions: "Expand this text with more details."
|
|
4733
|
+
},
|
|
4734
|
+
{
|
|
4735
|
+
label: "Pro tone",
|
|
4736
|
+
task: "rewrite",
|
|
4737
|
+
instructions: "Rewrite this text with a professional and formal tone."
|
|
4738
|
+
},
|
|
4739
|
+
{
|
|
4740
|
+
label: "SEO",
|
|
4741
|
+
task: "seo",
|
|
4742
|
+
instructions: "Optimize this text for search engines."
|
|
4743
|
+
},
|
|
4744
|
+
{
|
|
4745
|
+
label: "Summarize",
|
|
4746
|
+
task: "summarize",
|
|
4747
|
+
instructions: "Summarize this text in a few concise sentences, capturing the key points."
|
|
4748
|
+
}
|
|
4749
|
+
];
|
|
4750
|
+
|
|
4751
|
+
//#endregion
|
|
4752
|
+
//#region src/plugins/redactor-assistant/components/RedactorMenuButton.tsx
|
|
4753
|
+
function RedactorMenuButton({ onAction, onGenerate, loading = false }) {
|
|
4754
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
4755
|
+
openOnHover: true,
|
|
4756
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
4757
|
+
size: "icon-sm",
|
|
4758
|
+
title: "AI writing assistance",
|
|
4759
|
+
disabled: loading,
|
|
4760
|
+
children: /* @__PURE__ */ jsx(SparklesIcon, { size: 10 })
|
|
4761
|
+
})
|
|
4762
|
+
}), /* @__PURE__ */ jsxs(MenuPopup, {
|
|
4763
|
+
align: "end",
|
|
4764
|
+
className: "min-w-0!",
|
|
4765
|
+
children: [
|
|
4766
|
+
/* @__PURE__ */ jsx(MenuGroup, { children: /* @__PURE__ */ jsx(MenuItem, {
|
|
4767
|
+
className: "cursor-pointer",
|
|
4768
|
+
onClick: () => onGenerate?.(),
|
|
4769
|
+
children: "Generate"
|
|
4770
|
+
}) }),
|
|
4771
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
4772
|
+
/* @__PURE__ */ jsx(MenuGroup, { children: QUICK_ACTIONS.map((action) => /* @__PURE__ */ jsx(MenuItem, {
|
|
4773
|
+
className: "cursor-pointer",
|
|
4774
|
+
onClick: () => onAction(action.task, action.instructions),
|
|
4775
|
+
children: action.label
|
|
4776
|
+
}, action.label)) })
|
|
4777
|
+
]
|
|
4778
|
+
})] });
|
|
4779
|
+
}
|
|
4780
|
+
|
|
4781
|
+
//#endregion
|
|
4782
|
+
//#region src/plugins/redactor-assistant/utils/redactorClient.ts
|
|
4783
|
+
const AI_ENDPOINT = "/admin/puck/redactor";
|
|
4784
|
+
const TIMEOUT_MS = 35e3;
|
|
4785
|
+
/**
|
|
4786
|
+
* Appelle l'endpoint Redactor backend. Ne jamais exposer de clé API côté client.
|
|
4787
|
+
*/
|
|
4788
|
+
async function callRedactor(request) {
|
|
4789
|
+
const token = getCsrfToken();
|
|
4790
|
+
const controller = new AbortController();
|
|
4791
|
+
const timeoutId = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
4792
|
+
try {
|
|
4793
|
+
const response = await fetch(AI_ENDPOINT, {
|
|
4794
|
+
method: "POST",
|
|
4795
|
+
headers: {
|
|
4796
|
+
"Content-Type": "application/json",
|
|
4797
|
+
Accept: "application/json",
|
|
4798
|
+
...token ? { "X-CSRF-TOKEN": token } : {}
|
|
4799
|
+
},
|
|
4800
|
+
body: JSON.stringify(request),
|
|
4801
|
+
credentials: "same-origin",
|
|
4802
|
+
signal: controller.signal
|
|
4803
|
+
});
|
|
4804
|
+
if (!response.ok) {
|
|
4805
|
+
const body = await response.json().catch(() => ({}));
|
|
4806
|
+
throw new Error(body.error || `Erreur serveur (${response.status})`);
|
|
4807
|
+
}
|
|
4808
|
+
const data = await response.json();
|
|
4809
|
+
if (!data.text || typeof data.text !== "string") throw new Error("Réponse Redactor invalide.");
|
|
4810
|
+
return { text: data.text };
|
|
4811
|
+
} catch (error) {
|
|
4812
|
+
if (error.name === "AbortError") throw new Error("La requête Redactor a expiré. Réessayez.");
|
|
4813
|
+
throw error;
|
|
4814
|
+
} finally {
|
|
4815
|
+
clearTimeout(timeoutId);
|
|
4816
|
+
}
|
|
4817
|
+
}
|
|
4818
|
+
|
|
4819
|
+
//#endregion
|
|
4820
|
+
//#region src/plugins/redactor-assistant/utils/buildContext.ts
|
|
4821
|
+
/**
|
|
4822
|
+
* Construit un résumé textuel de la page à partir des données Puck.
|
|
4823
|
+
*/
|
|
4824
|
+
function buildPageSummary(data) {
|
|
4825
|
+
if (!data?.content?.length) return "Page vide.";
|
|
4826
|
+
return data.content.map((block, i) => {
|
|
4827
|
+
const textProps = extractTextProps(block.props);
|
|
4828
|
+
const propsStr = textProps.length > 0 ? `: ${textProps.join(", ")}` : "";
|
|
4829
|
+
return `[${i + 1}] ${block.type}${propsStr}`;
|
|
4830
|
+
}).join("\n");
|
|
4831
|
+
}
|
|
4832
|
+
/**
|
|
4833
|
+
* Extrait les propriétés textuelles d'un bloc pour le résumé.
|
|
4834
|
+
*/
|
|
4835
|
+
function extractTextProps(props) {
|
|
4836
|
+
const textFields = [];
|
|
4837
|
+
for (const [key, value] of Object.entries(props)) {
|
|
4838
|
+
if (key === "id") continue;
|
|
4839
|
+
if (typeof value === "string" && value.length > 0 && value.length <= 200) {
|
|
4840
|
+
const truncated = value.length > 80 ? value.substring(0, 80) + "…" : value;
|
|
4841
|
+
textFields.push(`${key}="${truncated}"`);
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
return textFields;
|
|
4845
|
+
}
|
|
4846
|
+
/**
|
|
4847
|
+
* Construit le contexte AI complet à partir des données Puck et du bloc sélectionné.
|
|
4848
|
+
*/
|
|
4849
|
+
function buildContext(data, selectedBlock, brandVoice) {
|
|
4850
|
+
return {
|
|
4851
|
+
pageSummary: buildPageSummary(data),
|
|
4852
|
+
currentBlock: selectedBlock ? {
|
|
4853
|
+
type: selectedBlock.type,
|
|
4854
|
+
props: selectedBlock.props
|
|
4855
|
+
} : null,
|
|
4856
|
+
brandVoice: {
|
|
4857
|
+
tone: brandVoice?.tone ?? "professionnel",
|
|
4858
|
+
language: brandVoice?.language ?? "français"
|
|
4859
|
+
}
|
|
4860
|
+
};
|
|
4861
|
+
}
|
|
4862
|
+
|
|
4863
|
+
//#endregion
|
|
4864
|
+
//#region src/plugins/redactor-assistant/hooks/useRedactor.ts
|
|
4865
|
+
/**
|
|
4866
|
+
* Custom hook to manage the Redactor logic (API calls, loading, error, result).
|
|
4867
|
+
* Encapsulates the core logic for both the sidebar plugin and the richtext button.
|
|
4868
|
+
*/
|
|
4869
|
+
function useRedactor() {
|
|
4870
|
+
const [instructions, setInstructions] = useState("");
|
|
4871
|
+
const [loading, setLoading] = useState(false);
|
|
4872
|
+
const [error, setError] = useState(null);
|
|
4873
|
+
const [result, setResult] = useState(null);
|
|
4874
|
+
const [previousValue, setPreviousValue] = useState(null);
|
|
4875
|
+
/**
|
|
4876
|
+
* Call the redactor API to generate or rewrite text.
|
|
4877
|
+
*/
|
|
4878
|
+
const generate = async ({ task, taskInstructions, input, appData, currentBlock, outputFormat }) => {
|
|
4879
|
+
setLoading(true);
|
|
4880
|
+
setError(null);
|
|
4881
|
+
setResult(null);
|
|
4882
|
+
try {
|
|
4883
|
+
const context = buildContext(appData, currentBlock);
|
|
4884
|
+
const response = await callRedactor({
|
|
4885
|
+
task,
|
|
4886
|
+
instructions: taskInstructions || instructions,
|
|
4887
|
+
input,
|
|
4888
|
+
context,
|
|
4889
|
+
outputFormat
|
|
4890
|
+
});
|
|
4891
|
+
setResult(response.text);
|
|
4892
|
+
setPreviousValue(input);
|
|
4893
|
+
return response.text;
|
|
4894
|
+
} catch (err) {
|
|
4895
|
+
setError(err.message || "Unknown error.");
|
|
4896
|
+
throw err;
|
|
4897
|
+
} finally {
|
|
4898
|
+
setLoading(false);
|
|
4899
|
+
}
|
|
4900
|
+
};
|
|
4901
|
+
return {
|
|
4902
|
+
instructions,
|
|
4903
|
+
setInstructions,
|
|
4904
|
+
loading,
|
|
4905
|
+
error,
|
|
4906
|
+
setError,
|
|
4907
|
+
result,
|
|
4908
|
+
setResult,
|
|
4909
|
+
previousValue,
|
|
4910
|
+
setPreviousValue,
|
|
4911
|
+
generate
|
|
4912
|
+
};
|
|
4913
|
+
}
|
|
4914
|
+
|
|
4915
|
+
//#endregion
|
|
4916
|
+
//#region src/components/ui/alert.tsx
|
|
4917
|
+
const alertVariants = cva("relative grid w-full items-start gap-x-2 gap-y-0.5 rounded-lg border text-card-foreground text-sm has-[>svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:gap-x-2 [&>svg]:h-lh [&>svg]:w-4", {
|
|
4918
|
+
defaultVariants: {
|
|
4919
|
+
size: "default",
|
|
4920
|
+
variant: "default"
|
|
4921
|
+
},
|
|
4922
|
+
variants: {
|
|
4923
|
+
size: {
|
|
4924
|
+
default: "px-3.5 py-3",
|
|
4925
|
+
sm: "px-2.5 py-2 text-xs"
|
|
4926
|
+
},
|
|
4927
|
+
variant: {
|
|
4928
|
+
default: "bg-transparent dark:bg-input/32 [&>svg]:text-muted-foreground",
|
|
4929
|
+
error: "border-destructive/32 bg-destructive/4 [&>svg]:text-destructive",
|
|
4930
|
+
info: "border-info/32 bg-info/4 [&>svg]:text-info",
|
|
4931
|
+
success: "border-success/32 bg-success/4 [&>svg]:text-success",
|
|
4932
|
+
warning: "border-warning/32 bg-warning/4 [&>svg]:text-warning"
|
|
4933
|
+
}
|
|
4934
|
+
}
|
|
4935
|
+
});
|
|
4936
|
+
function Alert({ className, size, variant, ...props }) {
|
|
4937
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4938
|
+
className: cn(alertVariants({
|
|
4939
|
+
size,
|
|
4940
|
+
variant
|
|
4941
|
+
}), className),
|
|
4942
|
+
"data-slot": "alert",
|
|
4943
|
+
role: "alert",
|
|
4944
|
+
...props
|
|
4945
|
+
});
|
|
4946
|
+
}
|
|
4947
|
+
function AlertTitle({ className, ...props }) {
|
|
4948
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4949
|
+
className: cn("font-medium [svg~&]:col-start-2", className),
|
|
4950
|
+
"data-slot": "alert-title",
|
|
4951
|
+
...props
|
|
4952
|
+
});
|
|
4953
|
+
}
|
|
4954
|
+
function AlertDescription({ className, ...props }) {
|
|
4955
|
+
return /* @__PURE__ */ jsx("div", {
|
|
4956
|
+
className: cn("flex flex-col gap-2.5 text-muted-foreground [svg~&]:col-start-2", className),
|
|
4957
|
+
"data-slot": "alert-description",
|
|
4958
|
+
...props
|
|
4959
|
+
});
|
|
4960
|
+
}
|
|
4961
|
+
|
|
4962
|
+
//#endregion
|
|
4963
|
+
//#region src/plugins/redactor-assistant/components/RedactorRichTextButton.tsx
|
|
4964
|
+
const useTypedPuck = createUsePuck();
|
|
4965
|
+
function RedactorRichTextButton({ value, onChange, children, label, field }) {
|
|
4966
|
+
const appState = useTypedPuck((s) => s.appState);
|
|
4967
|
+
const [mode, setMode] = useState(null);
|
|
4968
|
+
const { instructions, setInstructions, loading, error, result, setResult, generate } = useRedactor();
|
|
4969
|
+
const textValue = typeof value === "string" ? value : "";
|
|
4970
|
+
const selectedItem = appState.ui.itemSelector ? appState.data.content?.[appState.ui.itemSelector.index] : null;
|
|
4971
|
+
const handleGenerate = async (task, taskInstructions) => {
|
|
4972
|
+
await generate({
|
|
4973
|
+
task,
|
|
4974
|
+
taskInstructions,
|
|
4975
|
+
input: textValue,
|
|
4976
|
+
appData: appState.data,
|
|
4977
|
+
currentBlock: selectedItem,
|
|
4978
|
+
outputFormat: "html"
|
|
4979
|
+
}).catch(() => {});
|
|
4980
|
+
};
|
|
4981
|
+
const applyResult = () => {
|
|
4982
|
+
if (result === null) return;
|
|
4983
|
+
onChange(result);
|
|
4984
|
+
setResult(null);
|
|
4985
|
+
setMode(null);
|
|
4986
|
+
};
|
|
4987
|
+
const showPanel = loading || mode === "generate" || result !== null || !!error;
|
|
4988
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
4989
|
+
label && /* @__PURE__ */ jsx(Label_default, {
|
|
4990
|
+
label,
|
|
4991
|
+
tooltip: field?.tooltip,
|
|
4992
|
+
action: /* @__PURE__ */ jsx(RedactorMenuButton, {
|
|
4993
|
+
onAction: handleGenerate,
|
|
4994
|
+
onGenerate: () => setMode("generate"),
|
|
4995
|
+
loading
|
|
4996
|
+
})
|
|
4997
|
+
}),
|
|
4998
|
+
/* @__PURE__ */ jsx("div", {
|
|
4999
|
+
className: loading ? "pointer-events-none opacity-60" : "",
|
|
5000
|
+
children
|
|
5001
|
+
}),
|
|
5002
|
+
showPanel && /* @__PURE__ */ jsxs("div", {
|
|
5003
|
+
className: "mt-3 border border-gray-200 rounded-lg bg-muted p-3 flex flex-col gap-y-3",
|
|
5004
|
+
children: [
|
|
5005
|
+
error && /* @__PURE__ */ jsx(Alert, {
|
|
5006
|
+
variant: "error",
|
|
5007
|
+
size: "sm",
|
|
5008
|
+
children: /* @__PURE__ */ jsx(AlertTitle, { children: error })
|
|
5009
|
+
}),
|
|
5010
|
+
loading && /* @__PURE__ */ jsxs("div", {
|
|
5011
|
+
className: "flex items-center justify-center gap-1.5 text-muted-foreground",
|
|
5012
|
+
children: [/* @__PURE__ */ jsx(Loader2Icon, {
|
|
5013
|
+
size: 14,
|
|
5014
|
+
className: "animate-spin"
|
|
5015
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
5016
|
+
className: "text-sm",
|
|
5017
|
+
children: "Generating…"
|
|
5018
|
+
})]
|
|
5019
|
+
}),
|
|
5020
|
+
mode === "generate" && !loading && result === null && /* @__PURE__ */ jsxs("div", {
|
|
5021
|
+
className: "flex flex-col",
|
|
5022
|
+
children: [
|
|
5023
|
+
/* @__PURE__ */ jsx(Label_default, {
|
|
5024
|
+
label: "AI writing assistance",
|
|
5025
|
+
tooltip: "The generated text will fully replace your current content. Your original text will not be preserved."
|
|
5026
|
+
}),
|
|
5027
|
+
/* @__PURE__ */ jsx(Textarea, {
|
|
5028
|
+
value: instructions,
|
|
5029
|
+
onChange: (e) => setInstructions(e.target.value),
|
|
5030
|
+
placeholder: "Ex: Write a short introduction about our services, in a professional tone…",
|
|
5031
|
+
disabled: loading
|
|
5032
|
+
}),
|
|
5033
|
+
/* @__PURE__ */ jsxs("div", {
|
|
5034
|
+
className: "flex justify-end gap-x-2 mt-3",
|
|
5035
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
5036
|
+
variant: "outline",
|
|
5037
|
+
onClick: () => setMode(null),
|
|
5038
|
+
disabled: loading,
|
|
5039
|
+
children: "Cancel"
|
|
5040
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
5041
|
+
variant: "default",
|
|
5042
|
+
onClick: () => handleGenerate(textValue ? "rewrite" : "generate", instructions),
|
|
5043
|
+
disabled: loading,
|
|
5044
|
+
children: "Generate"
|
|
5045
|
+
})]
|
|
5046
|
+
})
|
|
5047
|
+
]
|
|
5048
|
+
}),
|
|
5049
|
+
result !== null && !loading && /* @__PURE__ */ jsxs("div", {
|
|
5050
|
+
className: "flex flex-col",
|
|
5051
|
+
children: [/* @__PURE__ */ jsx(Alert, {
|
|
5052
|
+
variant: "success",
|
|
5053
|
+
size: "sm",
|
|
5054
|
+
children: /* @__PURE__ */ jsx(AlertDescription, {
|
|
5055
|
+
className: "max-h-[150px] overflow-auto",
|
|
5056
|
+
dangerouslySetInnerHTML: { __html: result }
|
|
5057
|
+
})
|
|
5058
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
5059
|
+
className: "flex justify-end gap-x-2 mt-3",
|
|
5060
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
5061
|
+
variant: "outline",
|
|
5062
|
+
onClick: () => setResult(null),
|
|
5063
|
+
children: "Ignore"
|
|
5064
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
5065
|
+
variant: "default",
|
|
5066
|
+
onClick: applyResult,
|
|
5067
|
+
children: "Apply"
|
|
5068
|
+
})]
|
|
5069
|
+
})]
|
|
5070
|
+
})
|
|
5071
|
+
]
|
|
5072
|
+
})
|
|
5073
|
+
] });
|
|
5074
|
+
}
|
|
5075
|
+
|
|
5076
|
+
//#endregion
|
|
5077
|
+
//#region src/plugins/redactor-assistant/index.tsx
|
|
5078
|
+
createUsePuck();
|
|
5079
|
+
function createRedactorPlugin() {
|
|
5080
|
+
return {
|
|
5081
|
+
name: "redactor-assistant",
|
|
5082
|
+
overrides: { fieldTypes: { richtext: ({ children, onChange, value, field, label }) => {
|
|
5083
|
+
return /* @__PURE__ */ jsx(RedactorRichTextButton, {
|
|
5084
|
+
value,
|
|
5085
|
+
onChange,
|
|
5086
|
+
label,
|
|
5087
|
+
field,
|
|
5088
|
+
children: React.cloneElement(children, { Label: ({ children: c }) => /* @__PURE__ */ jsx(Fragment, { children: c }) })
|
|
5089
|
+
});
|
|
5090
|
+
} } }
|
|
5091
|
+
};
|
|
5092
|
+
}
|
|
5093
|
+
|
|
5094
|
+
//#endregion
|
|
5095
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, ActionBar_default as ActionBar, AnchoredToastProvider, Badge, Button, Checkbox, ColorPicker, ColorPickerContent, Dialog, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPopup, DialogTitle, DialogTrigger, DrawerItem_default as DrawerItem, Checkbox_default as FieldCheckbox, FieldGroups_default as FieldGroups, Input_default as FieldInput, NumberUnit_default as FieldNumberUnit, Radio_default as FieldRadio, Select_default as FieldSelect, Textarea_default as FieldTextarea, Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, GRAY_COLORS, Input, InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, InputGroupTextarea, Label_default as Label, MediaPicker, Menu, MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubPopup, MenuSubTrigger, MenuTrigger, PREDEFINED_COLORS, PagePicker, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PickerModal, Popover, PopoverClose, PopoverPopup as PopoverContent, PopoverPopup, PopoverCreateHandle, PopoverDescription, PopoverTitle, PopoverTrigger, RadioGroup, RadioGroupItem, RichTextMenuColorPicker, RichTextMenuLink, ScrollArea, ScrollBar, Select, SelectGroup, SelectGroupLabel, SelectItem, SelectPopup, SelectSeparator, SelectTrigger, SelectValue, Separator, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsPanel as TabsContent, TabsPanel, TabsList, TabsTab, TabsTab as TabsTrigger, Textarea, ToastProvider, Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger, anchoredToastManager, animationDefaultProps, animationField, animationToAttributes, badgeVariants, buttonVariants, plugin_default as createPuckOverridesPlugin, createRedactorPlugin, createTemplateBlock, customClassesDefaultProps, customClassesField, customClassesToClasses, displayDefaultProps, displayField, displayToClasses, fontWeightDefaultProps, fontWeightField, fontWeightToClasses, getCsrfToken, getMediaUrl, lineHeightDefaultProps, lineHeightField, lineHeightToClasses, marginDefaultProps, marginField, marginToClasses, paddingDefaultProps, paddingField, paddingToClasses, pageField, positionDefaultProps, positionField, positionToClasses, richTextMenuColorPickerExtension, sizeDefaultProps, sizeField, sizeToClasses, spacingDefaultProps, spacingFieldNames, spacingFields, spacingOptions, spacingToClasses, textAlignDefaultProps, textAlignField, textAlignToClasses, textColorDefaultProps, textColorField, textColorToClasses, textDecorationDefaultProps, textDecorationField, textDecorationToClasses, textSizeDefaultProps, textSizeField, textSizeToClasses, textTransformDefaultProps, textTransformField, textTransformToClasses, toastManager, typographyDefaultProps, typographyFieldNames, typographyFields, typographyToClasses, useMediaUrl, useOptimizedImage, usePageUrl };
|
|
4337
5096
|
//# sourceMappingURL=index.js.map
|