@ckc-net/puck-extended 0.1.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 +21 -0
- package/dist/index.d.ts +417 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3603 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +87 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3603 @@
|
|
|
1
|
+
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
import { AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, BoldIcon, BoxIcon, CaseLowerIcon, CaseSensitiveIcon, CaseUpperIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, GripVerticalIcon, ImageIcon, ItalicIcon, LightbulbIcon, Loader2Icon, LockIcon, Minus, MinusIcon, MoreHorizontalIcon, SearchIcon, StrikethroughIcon, UnderlineIcon, UploadIcon, XIcon } from "lucide-react";
|
|
5
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
7
|
+
import { Input } from "@base-ui/react/input";
|
|
8
|
+
import { Select } from "@base-ui/react/select";
|
|
9
|
+
import { Radio } from "@base-ui/react/radio";
|
|
10
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
11
|
+
import { Field } from "@base-ui/react/field";
|
|
12
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
13
|
+
import { createUsePuck } from "@measured/puck";
|
|
14
|
+
import { Tabs } from "@base-ui/react/tabs";
|
|
15
|
+
import { Accordion } from "@base-ui/react/accordion";
|
|
16
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
17
|
+
import { tv } from "tailwind-variants";
|
|
18
|
+
import { Button } from "@base-ui/react/button";
|
|
19
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
20
|
+
import { HexColorPicker } from "react-colorful";
|
|
21
|
+
import { Menu } from "@base-ui/react/menu";
|
|
22
|
+
|
|
23
|
+
//#region src/lib/utils.ts
|
|
24
|
+
function cn(...inputs) {
|
|
25
|
+
return twMerge(clsx(inputs));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/components/ui/label.tsx
|
|
30
|
+
function Label$2({ className, readOnly, children, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
32
|
+
"data-slot": "label",
|
|
33
|
+
"data-readonly": readOnly ? "" : void 0,
|
|
34
|
+
className: cn("text-foreground mb-2 flex items-center justify-between gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
35
|
+
...props,
|
|
36
|
+
children: [children, readOnly && /* @__PURE__ */ jsx(LockIcon, { className: "size-4" })]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/Fields/Label/index.tsx
|
|
42
|
+
const Label$1 = ({ label, readOnly }) => /* @__PURE__ */ jsx(Label$2, {
|
|
43
|
+
readOnly,
|
|
44
|
+
className: "rounded-md border border-dashed border-red-500 bg-red-500/10 p-3",
|
|
45
|
+
children: label
|
|
46
|
+
});
|
|
47
|
+
var Label_default = Label$1;
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
//#region src/components/ui/checkbox.tsx
|
|
51
|
+
function Checkbox$2({ className, layout = "horizontal", ...props }) {
|
|
52
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
53
|
+
"data-slot": "checkbox",
|
|
54
|
+
className: cn("peer dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive data-[checked]:text-primary-500 border-input relative block flex shrink-0 cursor-pointer items-center justify-center rounded-md border bg-white p-2 transition-shadow outline-none hover:bg-stone-50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:bg-stone-50 data-[checked]:font-semibold", className),
|
|
55
|
+
...props
|
|
56
|
+
});
|
|
57
|
+
return /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
58
|
+
"data-slot": "checkbox",
|
|
59
|
+
className: cn("peer dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive border-input size-5 shrink-0 rounded-sm border bg-white transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
60
|
+
...props,
|
|
61
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {
|
|
62
|
+
"data-slot": "checkbox-indicator",
|
|
63
|
+
className: "cn-checkbox-indicator grid h-full place-content-center text-current transition-none",
|
|
64
|
+
children: /* @__PURE__ */ jsx(CheckIcon, {
|
|
65
|
+
className: "size-4",
|
|
66
|
+
strokeWidth: 3
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/components/Fields/Checkbox/index.tsx
|
|
74
|
+
const Checkbox$1 = ({ onChange, value, readOnly, field, label }) => {
|
|
75
|
+
if (!field.options || !Array.isArray(field.options)) return null;
|
|
76
|
+
const selectedValues = Array.isArray(value) ? value : [];
|
|
77
|
+
const layout = field.layout || "horizontal";
|
|
78
|
+
const handleChange = (optionValue, checked) => {
|
|
79
|
+
if (!readOnly && typeof checked === "boolean") {
|
|
80
|
+
let newValues;
|
|
81
|
+
if (checked) newValues = [...selectedValues, optionValue];
|
|
82
|
+
else newValues = selectedValues.filter((v) => v !== optionValue);
|
|
83
|
+
onChange(newValues);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
87
|
+
label,
|
|
88
|
+
readOnly
|
|
89
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: "rounded-md border border-dashed border-purple-500 bg-purple-500/10 p-3",
|
|
91
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
92
|
+
className: layout === "horizontal" ? "flex w-fit flex-wrap gap-1.5" : "flex flex-col gap-3",
|
|
93
|
+
children: field.options.map((option, index) => {
|
|
94
|
+
const optionValue = option.value;
|
|
95
|
+
const key = `${String(optionValue)}-${index}`;
|
|
96
|
+
const isChecked = selectedValues.includes(optionValue);
|
|
97
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx("label", {
|
|
98
|
+
className: "flex-1",
|
|
99
|
+
children: /* @__PURE__ */ jsx(Checkbox$2, {
|
|
100
|
+
layout: "horizontal",
|
|
101
|
+
checked: isChecked,
|
|
102
|
+
onCheckedChange: (checked) => handleChange(optionValue, checked),
|
|
103
|
+
disabled: readOnly,
|
|
104
|
+
children: option.label || option.value?.toString()
|
|
105
|
+
})
|
|
106
|
+
}, key);
|
|
107
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
108
|
+
className: "flex cursor-pointer items-center gap-3",
|
|
109
|
+
children: [/* @__PURE__ */ jsx(Checkbox$2, {
|
|
110
|
+
layout: "inline",
|
|
111
|
+
checked: isChecked,
|
|
112
|
+
onCheckedChange: (checked) => handleChange(optionValue, checked),
|
|
113
|
+
disabled: readOnly
|
|
114
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
115
|
+
className: "text-sm",
|
|
116
|
+
children: option.label || option.value?.toString()
|
|
117
|
+
})]
|
|
118
|
+
}, key);
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
})] });
|
|
122
|
+
};
|
|
123
|
+
var Checkbox_default = Checkbox$1;
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/components/ui/input.tsx
|
|
127
|
+
function Input$2({ className, size = "default", ...props }) {
|
|
128
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
129
|
+
"data-slot": "input",
|
|
130
|
+
className: cn("border-border bg-background dark:bg-input/32 placeholder:text-muted-foreground/80 relative h-9 w-full min-w-0 rounded-lg border px-3 py-2 text-base/5 outline-none [transition:box-shadow_150ms_ease-out] sm:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[2px]", "aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 dark:aria-invalid:ring-destructive/24 disabled:opacity-64 [disabled,focus-visible,aria-invalid]:shadow-none", size === "sm" && "h-8 px-3", size === "lg" && "h-10 px-6", props.type === "search" && "[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none [&::-webkit-search-results-button]:appearance-none [&::-webkit-search-results-decoration]:appearance-none", props.type === "file" && "text-muted-foreground file:text-foreground file:me-3 file:bg-transparent file:text-sm file:font-medium", className),
|
|
131
|
+
size: typeof size === "number" ? size : void 0,
|
|
132
|
+
...props
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/components/Fields/Input/index.tsx
|
|
138
|
+
const Input$1 = ({ onChange, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
139
|
+
label,
|
|
140
|
+
readOnly: field.readOnly || readOnly
|
|
141
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
142
|
+
className: "rounded-md border border-dashed border-cyan-500 bg-cyan-500/10 p-3",
|
|
143
|
+
children: /* @__PURE__ */ jsx(Input$2, {
|
|
144
|
+
type: "text",
|
|
145
|
+
placeholder: field.placeholder,
|
|
146
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
147
|
+
readOnly: field.readOnly || readOnly
|
|
148
|
+
})
|
|
149
|
+
})] });
|
|
150
|
+
var Input_default = Input$1;
|
|
151
|
+
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/components/ui/select.tsx
|
|
154
|
+
const cssAnimationPresets$4 = {
|
|
155
|
+
none: "transition-none",
|
|
156
|
+
scale: [`[transition-property:scale,opacity] [will-change:scale,opacity]`, `data-starting-style:scale-80 data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:scale-80`],
|
|
157
|
+
fade: [`[transition-property:opacity] [will-change:opacity]`, `data-starting-style:opacity-0 data-ending-style:opacity-0`],
|
|
158
|
+
slideOutside: [
|
|
159
|
+
`[transition-property:translate,opacity] [will-change:translate,opacity]`,
|
|
160
|
+
`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`,
|
|
161
|
+
`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`,
|
|
162
|
+
`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`,
|
|
163
|
+
`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`,
|
|
164
|
+
`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`,
|
|
165
|
+
`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`
|
|
166
|
+
],
|
|
167
|
+
slideInside: [
|
|
168
|
+
`[transition-property:translate,opacity] [will-change:translate,opacity]`,
|
|
169
|
+
`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`,
|
|
170
|
+
`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`,
|
|
171
|
+
`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`,
|
|
172
|
+
`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`,
|
|
173
|
+
`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`,
|
|
174
|
+
`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`
|
|
175
|
+
],
|
|
176
|
+
wipe: [
|
|
177
|
+
`[transition-property:clip-path] [will-change:clip-path]`,
|
|
178
|
+
`[clip-path:inset(0_0_0_0_round_12px)] [-webkit-clip-path:inset(0_0_0_0_round_12px)]`,
|
|
179
|
+
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_12px)] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_12px)]`,
|
|
180
|
+
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_12px)] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_12px)]`,
|
|
181
|
+
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
182
|
+
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`,
|
|
183
|
+
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
184
|
+
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`
|
|
185
|
+
],
|
|
186
|
+
wipeScale: [
|
|
187
|
+
`[transition-property:clip-path,scale] [will-change:clip-path,scale]`,
|
|
188
|
+
`[clip-path:inset(0_0_0_0_round_12px)] [-webkit-clip-path:inset(0_0_0_0_round_12px)]`,
|
|
189
|
+
`data-starting-style:scale-80 data-ending-style:scale-80`,
|
|
190
|
+
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_12px)] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_12px)]`,
|
|
191
|
+
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_12px)] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_12px)]`,
|
|
192
|
+
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
193
|
+
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`,
|
|
194
|
+
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
195
|
+
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`
|
|
196
|
+
],
|
|
197
|
+
motion: [
|
|
198
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform] [will-change:translate,scale,opacity,rotateX,rotateY,transform]`,
|
|
199
|
+
`[transform:perspective(1000px)]`,
|
|
200
|
+
`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]`,
|
|
201
|
+
`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]`,
|
|
202
|
+
`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]`,
|
|
203
|
+
`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]`,
|
|
204
|
+
`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]`,
|
|
205
|
+
`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]`
|
|
206
|
+
],
|
|
207
|
+
motionBlur: [
|
|
208
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform,filter] [will-change:translate,scale,opacity,rotateX,rotateY,transform,filter]`,
|
|
209
|
+
`[transform:perspective(1000px)]`,
|
|
210
|
+
`data-starting-style:blur-[9px] data-ending-style:blur-[9px]`,
|
|
211
|
+
`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]`,
|
|
212
|
+
`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]`,
|
|
213
|
+
`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]`,
|
|
214
|
+
`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]`,
|
|
215
|
+
`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]`,
|
|
216
|
+
`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]`
|
|
217
|
+
]
|
|
218
|
+
};
|
|
219
|
+
const cssTransitionPresets$4 = {
|
|
220
|
+
inExpo: `duration-[0.35s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
221
|
+
outExpo: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
222
|
+
inOutExpo: `duration-[0.35s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
223
|
+
anticipate: `duration-[0.35s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
224
|
+
quickOut: `duration-[0.35s] ease-out`,
|
|
225
|
+
overshootOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
226
|
+
swiftOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
227
|
+
snappyOut: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
228
|
+
in: `duration-[0.35s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
229
|
+
out: `duration-[0.35s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
230
|
+
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
231
|
+
outIn: `duration-[0.35s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
232
|
+
inQuad: `duration-[0.35s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
233
|
+
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
234
|
+
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
235
|
+
inCubic: `duration-[0.35s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
236
|
+
outCubic: `duration-[0.35s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
237
|
+
inOutCubic: `duration-[0.35s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
238
|
+
inQuart: `duration-[0.35s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
239
|
+
outQuart: `duration-[0.35s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
240
|
+
inOutQuart: `duration-[0.35s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
241
|
+
inQuint: `duration-[0.35s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
242
|
+
outQuint: `duration-[0.35s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
243
|
+
inOutQuint: `duration-[0.35s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
244
|
+
inCirc: `duration-[0.35s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
245
|
+
outCirc: `duration-[0.35s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
246
|
+
inOutCirc: `duration-[0.35s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
247
|
+
inOutBase: `duration-[0.35s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`
|
|
248
|
+
};
|
|
249
|
+
const SelectContext = createContext(void 0);
|
|
250
|
+
function useSelect() {
|
|
251
|
+
const context = useContext(SelectContext);
|
|
252
|
+
if (!context) throw new Error("useSelect must be used within a SelectProvider");
|
|
253
|
+
return context;
|
|
254
|
+
}
|
|
255
|
+
function Select$2({ backdrop = "transparent", ...props }) {
|
|
256
|
+
return /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
257
|
+
value: { backdrop },
|
|
258
|
+
children: /* @__PURE__ */ jsx(Select.Root, {
|
|
259
|
+
"data-slot": "select",
|
|
260
|
+
...props
|
|
261
|
+
})
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function SelectTrigger({ className, ...props }) {
|
|
265
|
+
return /* @__PURE__ */ jsx(Select.Trigger, {
|
|
266
|
+
"data-slot": "select-trigger",
|
|
267
|
+
className: cn("group/select-trigger border-input text-foreground focus-visible:border-primary bg-background dark:bg-input/40 inline-flex h-fit w-full touch-none items-center justify-between gap-3 rounded-lg border px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(2)-1px)] text-sm transition-colors ease-out select-none focus-visible:outline-none", className),
|
|
268
|
+
...props
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
function SelectValue({ className, placeholder = "Select...", ...props }) {
|
|
272
|
+
return /* @__PURE__ */ jsx(Select.Value, {
|
|
273
|
+
"data-slot": "select-value",
|
|
274
|
+
...props,
|
|
275
|
+
render: (renderProps, state) => {
|
|
276
|
+
const newValue = state.value;
|
|
277
|
+
if (!newValue && !renderProps.children) return /* @__PURE__ */ jsx("span", {
|
|
278
|
+
...renderProps,
|
|
279
|
+
className: cn("text-foreground/60 w-full text-left", className),
|
|
280
|
+
children: placeholder
|
|
281
|
+
});
|
|
282
|
+
return /* @__PURE__ */ jsx("span", {
|
|
283
|
+
...renderProps,
|
|
284
|
+
className: cn("fadeIn w-full truncate text-left", className)
|
|
285
|
+
}, newValue);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function SelectIcon({ className, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ jsx(Select.Icon, {
|
|
291
|
+
"data-slot": "select-icon",
|
|
292
|
+
className: cn("text-foreground/72 size-3.5 shrink-0", className),
|
|
293
|
+
...props
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function SelectPortal(props) {
|
|
297
|
+
return /* @__PURE__ */ jsx(Select.Portal, {
|
|
298
|
+
"data-slot": "select-portal",
|
|
299
|
+
...props
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
function SelectBackdrop({ className, ...props }) {
|
|
303
|
+
const { backdrop = "transparent" } = useSelect();
|
|
304
|
+
return /* @__PURE__ */ jsx(Select.Backdrop, {
|
|
305
|
+
"data-slot": "select-backdrop",
|
|
306
|
+
className: cn(backdrop === "opaque" && "fixed inset-0 z-100 bg-black opacity-40 transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:opacity-60", backdrop === "blur" && "fixed inset-0 z-100 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0", backdrop === "transparent" && "hidden", className),
|
|
307
|
+
...props
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
function SelectPositioner({ sideOffset = 4, side = "bottom", className, alignItemWithTrigger = true, ...props }) {
|
|
311
|
+
return /* @__PURE__ */ jsxs(SelectPortal, { children: [/* @__PURE__ */ jsx(SelectBackdrop, {}), /* @__PURE__ */ jsx(Select.Positioner, {
|
|
312
|
+
sideOffset,
|
|
313
|
+
side,
|
|
314
|
+
alignItemWithTrigger,
|
|
315
|
+
"data-slot": "select-positioner",
|
|
316
|
+
className: cn("z-100 outline-none select-none", className),
|
|
317
|
+
...props
|
|
318
|
+
})] });
|
|
319
|
+
}
|
|
320
|
+
function SelectArrow({ className, ...rest }) {
|
|
321
|
+
return /* @__PURE__ */ jsx(Select.Arrow, {
|
|
322
|
+
"data-slot": "select-arrow",
|
|
323
|
+
className: cn("data-[side=bottom]:top-[-9px] data-[side=left]:right-[-14px] data-[side=left]:rotate-90 data-[side=right]:left-[-14px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-9px] data-[side=top]:rotate-180", className),
|
|
324
|
+
...rest
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
function ArrowSvg$1(props) {
|
|
328
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
329
|
+
width: "20",
|
|
330
|
+
height: "10",
|
|
331
|
+
viewBox: "0 0 20 10",
|
|
332
|
+
fill: "none",
|
|
333
|
+
...props,
|
|
334
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
335
|
+
d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",
|
|
336
|
+
className: "fill-popover"
|
|
337
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
338
|
+
d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z",
|
|
339
|
+
className: "fill-border/60"
|
|
340
|
+
})]
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function SelectPopup({ className, animationPreset = "scale", transitionPreset = "outQuint", reduceMotion = false, showArrow = false, side = "bottom", sideOffset = 4, align = "center", alignOffset = 0, alignItemWithTrigger = false, children, ...rest }) {
|
|
344
|
+
const cssAnimationConfig = useMemo(() => {
|
|
345
|
+
if (reduceMotion) return "";
|
|
346
|
+
if (animationPreset) return cssAnimationPresets$4[animationPreset];
|
|
347
|
+
return cssAnimationPresets$4.scale;
|
|
348
|
+
}, [
|
|
349
|
+
animationPreset,
|
|
350
|
+
reduceMotion,
|
|
351
|
+
side
|
|
352
|
+
]);
|
|
353
|
+
const cssTransitionConfig = useMemo(() => {
|
|
354
|
+
if (reduceMotion) return "";
|
|
355
|
+
if (transitionPreset) return cssTransitionPresets$4[transitionPreset];
|
|
356
|
+
return cssTransitionPresets$4.snappyOut;
|
|
357
|
+
}, [
|
|
358
|
+
transitionPreset,
|
|
359
|
+
reduceMotion,
|
|
360
|
+
side
|
|
361
|
+
]);
|
|
362
|
+
return /* @__PURE__ */ jsx(SelectPositioner, {
|
|
363
|
+
side,
|
|
364
|
+
sideOffset,
|
|
365
|
+
align,
|
|
366
|
+
alignOffset,
|
|
367
|
+
alignItemWithTrigger,
|
|
368
|
+
className: "",
|
|
369
|
+
children: /* @__PURE__ */ jsx(Select.Popup, {
|
|
370
|
+
"data-slot": "select-popup",
|
|
371
|
+
render: (renderProps) => {
|
|
372
|
+
if (alignItemWithTrigger) return /* @__PURE__ */ jsxs("div", {
|
|
373
|
+
...renderProps,
|
|
374
|
+
className: cn("pointer-events-auto origin-(--transform-origin)", className),
|
|
375
|
+
style: { ...renderProps.style },
|
|
376
|
+
children: [
|
|
377
|
+
showArrow && /* @__PURE__ */ jsx(SelectArrow, { children: /* @__PURE__ */ jsx(ArrowSvg$1, {}) }),
|
|
378
|
+
/* @__PURE__ */ jsx(Select.ScrollUpArrow, {
|
|
379
|
+
className: cn("top-0 z-50 flex h-6 w-full cursor-default items-center justify-center", "before:from-popover before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[140%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50%"),
|
|
380
|
+
"data-slot": "select-scroll-up-arrow",
|
|
381
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "relative size-4" })
|
|
382
|
+
}),
|
|
383
|
+
children,
|
|
384
|
+
/* @__PURE__ */ jsx(Select.ScrollDownArrow, {
|
|
385
|
+
className: cn("bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center", "before:from-popover before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[140%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50%"),
|
|
386
|
+
"data-slot": "select-scroll-down-arrow",
|
|
387
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "relative size-4" })
|
|
388
|
+
})
|
|
389
|
+
]
|
|
390
|
+
}, "select-popup");
|
|
391
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
392
|
+
...renderProps,
|
|
393
|
+
className: cn("pointer-events-auto origin-(--transform-origin)", className, renderProps.className, cssTransitionConfig, cssAnimationConfig),
|
|
394
|
+
children: [
|
|
395
|
+
showArrow && /* @__PURE__ */ jsx(SelectArrow, { children: /* @__PURE__ */ jsx(ArrowSvg$1, {}) }),
|
|
396
|
+
/* @__PURE__ */ jsx(Select.ScrollUpArrow, {
|
|
397
|
+
className: cn("top-0 z-50 flex h-6 w-full cursor-default items-center justify-center", "before:from-popover before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[140%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50%"),
|
|
398
|
+
"data-slot": "select-scroll-up-arrow",
|
|
399
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, { className: "relative size-4" })
|
|
400
|
+
}),
|
|
401
|
+
children,
|
|
402
|
+
/* @__PURE__ */ jsx(Select.ScrollDownArrow, {
|
|
403
|
+
className: cn("bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center", "before:from-popover before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[140%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50%"),
|
|
404
|
+
"data-slot": "select-scroll-down-arrow",
|
|
405
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "relative size-4" })
|
|
406
|
+
})
|
|
407
|
+
]
|
|
408
|
+
}, "select-popup");
|
|
409
|
+
},
|
|
410
|
+
...rest
|
|
411
|
+
})
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function SelectList({ className, ...props }) {
|
|
415
|
+
return /* @__PURE__ */ jsx(Select.List, {
|
|
416
|
+
"data-slot": "select-list",
|
|
417
|
+
className: cn("bg-popover relative block h-full max-h-[min(var(--available-height),260px)] min-w-(--anchor-width) overflow-y-auto rounded-lg border p-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", className),
|
|
418
|
+
...props
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function SelectItem({ className, ...props }) {
|
|
422
|
+
return /* @__PURE__ */ jsx(Select.Item, {
|
|
423
|
+
"data-slot": "select-item",
|
|
424
|
+
className: cn("relative flex min-w-(--anchor-width) cursor-default items-center gap-2 px-3 py-1.5 text-sm outline-none select-none group-data-[side=none]:min-w-[calc(var(--anchor-width))]", `data-highlighted:before:bg-accent/70 dark:data-highlighted:before:bg-accent data-highlighted:text-accent-foreground data-highlighted:before:border-border/30 data-highlighted:z-0 data-highlighted:before:absolute data-highlighted:before:inset-x-0 data-highlighted:before:inset-y-0 data-highlighted:before:z-[-1] data-highlighted:before:rounded-md data-highlighted:before:border`, className),
|
|
425
|
+
...props
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
function SelectItemText({ className, ...props }) {
|
|
429
|
+
return /* @__PURE__ */ jsx(Select.ItemText, {
|
|
430
|
+
"data-slot": "select-item-text",
|
|
431
|
+
className: cn("flex-1", className),
|
|
432
|
+
...props
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function SelectItemIndicator({ className, ...props }) {
|
|
436
|
+
return /* @__PURE__ */ jsx(Select.ItemIndicator, {
|
|
437
|
+
"data-slot": "select-item-indicator",
|
|
438
|
+
className: cn("ml-auto min-w-fit", className),
|
|
439
|
+
...props
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
//#endregion
|
|
444
|
+
//#region src/components/Fields/NumberUnit/index.tsx
|
|
445
|
+
const NumberUnit = ({ onChange, value, label, field, readOnly }) => {
|
|
446
|
+
const currentValue = value || {
|
|
447
|
+
value: "",
|
|
448
|
+
unit: field.options?.[0]?.value || ""
|
|
449
|
+
};
|
|
450
|
+
const handleInputChange = (newValue) => {
|
|
451
|
+
if (!readOnly) onChange({
|
|
452
|
+
...currentValue,
|
|
453
|
+
value: newValue
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
const handleUnitChange = (newUnit) => {
|
|
457
|
+
if (!readOnly) onChange({
|
|
458
|
+
...currentValue,
|
|
459
|
+
unit: newUnit
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
463
|
+
label,
|
|
464
|
+
readOnly: field.readOnly || readOnly
|
|
465
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
466
|
+
className: "rounded-md border border-dashed border-purple-500 bg-purple-500/10 p-3",
|
|
467
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
468
|
+
className: "flex",
|
|
469
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
470
|
+
className: "flex-1",
|
|
471
|
+
children: /* @__PURE__ */ jsx(Input$2, {
|
|
472
|
+
className: "rounded-r-none",
|
|
473
|
+
type: "text",
|
|
474
|
+
placeholder: field.placeholder || "Value",
|
|
475
|
+
value: currentValue.value,
|
|
476
|
+
onChange: (e) => handleInputChange(e.currentTarget.value),
|
|
477
|
+
readOnly: field.readOnly || readOnly
|
|
478
|
+
})
|
|
479
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
480
|
+
className: "w-18",
|
|
481
|
+
children: /* @__PURE__ */ jsxs(Select$2, {
|
|
482
|
+
items: field.options || [],
|
|
483
|
+
value: currentValue.unit,
|
|
484
|
+
onValueChange: handleUnitChange,
|
|
485
|
+
disabled: field.readOnly || readOnly,
|
|
486
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
487
|
+
className: "rounded-l-none border-l-0",
|
|
488
|
+
children: [/* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5" }) })]
|
|
489
|
+
}), /* @__PURE__ */ jsx(SelectPopup, {
|
|
490
|
+
align: "end",
|
|
491
|
+
side: "bottom",
|
|
492
|
+
children: /* @__PURE__ */ jsx(SelectList, { children: (field.options || []).map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
493
|
+
value: option.value,
|
|
494
|
+
children: [option.label, /* @__PURE__ */ jsx(SelectItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" }) })]
|
|
495
|
+
}, option.value)) })
|
|
496
|
+
})]
|
|
497
|
+
})
|
|
498
|
+
})]
|
|
499
|
+
})
|
|
500
|
+
})] });
|
|
501
|
+
};
|
|
502
|
+
var NumberUnit_default = NumberUnit;
|
|
503
|
+
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/components/Fields/Select/index.tsx
|
|
506
|
+
const Select$1 = ({ onChange, value, label, field, readOnly }) => {
|
|
507
|
+
const itemsWithPlaceholder = [{
|
|
508
|
+
label: field.placeholder || "Select an option",
|
|
509
|
+
value: null
|
|
510
|
+
}, ...field.options.map((option) => ({
|
|
511
|
+
label: option.label,
|
|
512
|
+
value: option.value
|
|
513
|
+
}))];
|
|
514
|
+
const handleValueChange = (newValue) => {
|
|
515
|
+
if (!readOnly && newValue !== null) onChange(newValue);
|
|
516
|
+
};
|
|
517
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
518
|
+
label,
|
|
519
|
+
readOnly: field.readOnly || readOnly
|
|
520
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
521
|
+
className: "rounded-md border border-dashed border-green-500 bg-green-500/10 p-3",
|
|
522
|
+
children: /* @__PURE__ */ jsxs(Select$2, {
|
|
523
|
+
items: itemsWithPlaceholder,
|
|
524
|
+
value: value || null,
|
|
525
|
+
onValueChange: handleValueChange,
|
|
526
|
+
disabled: field.readOnly || readOnly,
|
|
527
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
528
|
+
className: "min-w-46",
|
|
529
|
+
children: [/* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5" }) })]
|
|
530
|
+
}), /* @__PURE__ */ jsx(SelectPopup, {
|
|
531
|
+
align: "center",
|
|
532
|
+
side: "bottom",
|
|
533
|
+
children: /* @__PURE__ */ jsx(SelectList, { children: field.options.map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
534
|
+
value: option.value,
|
|
535
|
+
children: [option.label, /* @__PURE__ */ jsx(SelectItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3" }) })]
|
|
536
|
+
}, typeof option.label === "string" ? option.label : JSON.stringify(option.value))) })
|
|
537
|
+
})]
|
|
538
|
+
})
|
|
539
|
+
})] });
|
|
540
|
+
};
|
|
541
|
+
var Select_default = Select$1;
|
|
542
|
+
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region src/components/ui/radio.tsx
|
|
545
|
+
function RadioGroup$1({ className, layout = "horizontal", ...props }) {
|
|
546
|
+
return /* @__PURE__ */ jsx(RadioGroup, {
|
|
547
|
+
"data-slot": "radio-group",
|
|
548
|
+
className: cn("cn-radio-group w-full", className),
|
|
549
|
+
...props
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function RadioGroupItem({ className, layout = "horizontal", ...props }) {
|
|
553
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx(Radio.Root, {
|
|
554
|
+
"data-slot": "radio-group-item",
|
|
555
|
+
className: cn("text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 group/radio-group-item peer data-[checked]:text-primary-500 relative block flex h-full shrink-0 cursor-pointer items-center justify-center border border-transparent bg-white p-2 text-xs transition-[color,box-shadow] outline-none hover:bg-stone-50 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:bg-stone-50 data-[checked]:font-semibold", className),
|
|
556
|
+
...props
|
|
557
|
+
});
|
|
558
|
+
return /* @__PURE__ */ jsx(Radio.Root, {
|
|
559
|
+
"data-slot": "radio-group-item",
|
|
560
|
+
className: cn("text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 group/radio-group-item peer border-input relative aspect-square size-4 shrink-0 rounded-full border bg-white transition-[color,box-shadow] outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
561
|
+
...props,
|
|
562
|
+
children: /* @__PURE__ */ jsx(Radio.Indicator, {
|
|
563
|
+
"data-slot": "radio-group-indicator",
|
|
564
|
+
className: "cn-radio-group-indicator",
|
|
565
|
+
children: /* @__PURE__ */ jsx("span", { className: "bg-foreground m-1 block size-1.5 rounded-full" })
|
|
566
|
+
})
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/components/Fields/Radio/index.tsx
|
|
572
|
+
const Radio$1 = ({ onChange, value, readOnly, field, label }) => {
|
|
573
|
+
if (!field.options || !Array.isArray(field.options)) return null;
|
|
574
|
+
const layout = field.layout || "horizontal";
|
|
575
|
+
const handleChange = (newValue) => {
|
|
576
|
+
if (!readOnly && newValue != null) onChange(newValue);
|
|
577
|
+
};
|
|
578
|
+
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";
|
|
579
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
580
|
+
label,
|
|
581
|
+
readOnly
|
|
582
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
583
|
+
className: "rounded-md border border-dashed border-amber-500 bg-amber-500/10 p-3",
|
|
584
|
+
children: /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
585
|
+
layout,
|
|
586
|
+
value: value?.toString() || "",
|
|
587
|
+
onValueChange: handleChange,
|
|
588
|
+
disabled: readOnly,
|
|
589
|
+
className: groupClassName,
|
|
590
|
+
children: field.options.map((option, index) => {
|
|
591
|
+
const optionValue = String(option.value ?? "");
|
|
592
|
+
const key = `${optionValue}-${index}`;
|
|
593
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx("label", {
|
|
594
|
+
className: "flex-1",
|
|
595
|
+
children: /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
596
|
+
layout: "horizontal",
|
|
597
|
+
value: optionValue,
|
|
598
|
+
disabled: readOnly,
|
|
599
|
+
children: option.label || option.value?.toString()
|
|
600
|
+
})
|
|
601
|
+
}, key);
|
|
602
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
603
|
+
className: "flex cursor-pointer items-center gap-3",
|
|
604
|
+
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
605
|
+
layout: "inline",
|
|
606
|
+
value: optionValue,
|
|
607
|
+
disabled: readOnly
|
|
608
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
609
|
+
className: "text-sm",
|
|
610
|
+
children: option.label || option.value?.toString()
|
|
611
|
+
})]
|
|
612
|
+
}, key);
|
|
613
|
+
})
|
|
614
|
+
})
|
|
615
|
+
})] });
|
|
616
|
+
};
|
|
617
|
+
var Radio_default = Radio$1;
|
|
618
|
+
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/components/ui/textarea.tsx
|
|
621
|
+
function Textarea$1({ className, size = "default", ...props }) {
|
|
622
|
+
return /* @__PURE__ */ jsx(Field.Control, { render: (defaultProps) => /* @__PURE__ */ jsx("textarea", {
|
|
623
|
+
"data-slot": "textarea",
|
|
624
|
+
className: cn("border-border bg-background dark:bg-input/32 placeholder:text-muted-foreground/80 relative field-sizing-content min-h-17.5 w-full rounded-lg border px-3 py-2 text-base/5 outline-none [transition:box-shadow_150ms_ease-out] max-sm:min-h-20.5 sm:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/16 dark:aria-invalid:ring-destructive/24 disabled:opacity-64 [disabled,focus-visible,aria-invalid]:shadow-none", size === "sm" && "min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5", size === "lg" && "min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5", className),
|
|
625
|
+
...mergeProps(defaultProps, props)
|
|
626
|
+
}) });
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region src/components/Fields/Textarea/index.tsx
|
|
631
|
+
const Textarea = ({ onChange, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
632
|
+
label,
|
|
633
|
+
readOnly: field.readOnly || readOnly
|
|
634
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
635
|
+
className: "rounded-md border border-dashed border-lime-500 bg-lime-500/10 p-3",
|
|
636
|
+
children: /* @__PURE__ */ jsx(Textarea$1, {
|
|
637
|
+
placeholder: field.placeholder,
|
|
638
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
639
|
+
readOnly: field.readOnly || readOnly
|
|
640
|
+
})
|
|
641
|
+
})] });
|
|
642
|
+
var Textarea_default = Textarea;
|
|
643
|
+
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region src/components/ActionBar/index.tsx
|
|
646
|
+
const Action = ({ children, label, onClick }) => /* @__PURE__ */ jsx("button", {
|
|
647
|
+
type: "button",
|
|
648
|
+
className: "hover:text-primary-500 mx-1 flex cursor-pointer items-center justify-center rounded border-none bg-transparent p-1.5 text-stone-700 transition-colors duration-50 hover:bg-stone-50",
|
|
649
|
+
onClick,
|
|
650
|
+
title: label,
|
|
651
|
+
children
|
|
652
|
+
});
|
|
653
|
+
const Group = ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
654
|
+
className: "mx-2 flex h-full items-center first:ml-0 last:mr-0 empty:hidden [&>*]:m-0",
|
|
655
|
+
children
|
|
656
|
+
});
|
|
657
|
+
const Label = ({ label }) => /* @__PURE__ */ jsx("div", {
|
|
658
|
+
className: "text-sm font-[var(--puck-font-family)] font-medium overflow-ellipsis whitespace-nowrap text-stone-700",
|
|
659
|
+
children: label
|
|
660
|
+
});
|
|
661
|
+
const Separator = () => /* @__PURE__ */ jsx("div", { className: "h-full w-px bg-stone-300" });
|
|
662
|
+
const ActionBar = ({ label, parentAction, children }) => /* @__PURE__ */ jsxs("div", {
|
|
663
|
+
className: "border-input flex w-auto items-center rounded-lg border bg-white p-2",
|
|
664
|
+
onClick: (e) => {
|
|
665
|
+
e.stopPropagation();
|
|
666
|
+
},
|
|
667
|
+
children: [
|
|
668
|
+
parentAction && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ActionBar.Group, { children: parentAction }), /* @__PURE__ */ jsx(ActionBar.Separator, {})] }),
|
|
669
|
+
label && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ActionBar.Group, { children: /* @__PURE__ */ jsx(ActionBar.Label, { label }) }), /* @__PURE__ */ jsx(ActionBar.Separator, {})] }),
|
|
670
|
+
/* @__PURE__ */ jsx(ActionBar.Group, { children })
|
|
671
|
+
]
|
|
672
|
+
});
|
|
673
|
+
ActionBar.Action = Action;
|
|
674
|
+
ActionBar.Label = Label;
|
|
675
|
+
ActionBar.Group = Group;
|
|
676
|
+
ActionBar.Separator = Separator;
|
|
677
|
+
var ActionBar_default = ActionBar;
|
|
678
|
+
|
|
679
|
+
//#endregion
|
|
680
|
+
//#region src/components/ui/tabs.tsx
|
|
681
|
+
function isValidVariant(variant) {
|
|
682
|
+
return variant === "segmented" || variant === "underline" || variant === "card";
|
|
683
|
+
}
|
|
684
|
+
const TabsContext = createContext({ variant: "segmented" });
|
|
685
|
+
function useTabs() {
|
|
686
|
+
const context = useContext(TabsContext);
|
|
687
|
+
if (!context) throw new Error("useTabs must be used within a Tabs component");
|
|
688
|
+
return context;
|
|
689
|
+
}
|
|
690
|
+
function Tabs$1({ className, variant = "segmented", ...props }) {
|
|
691
|
+
const finalVariant = isValidVariant(variant) ? variant : "segmented";
|
|
692
|
+
return /* @__PURE__ */ jsx(TabsContext.Provider, {
|
|
693
|
+
value: { variant: finalVariant },
|
|
694
|
+
children: /* @__PURE__ */ jsx(Tabs.Root, {
|
|
695
|
+
"data-slot": "tabs",
|
|
696
|
+
className: cn("flex gap-2 data-[orientation=horizontal]:flex-col data-[orientation=vertical]:flex-row", className),
|
|
697
|
+
...props
|
|
698
|
+
})
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
function TabsList({ className, children, ...props }) {
|
|
702
|
+
const { variant } = useTabs();
|
|
703
|
+
return /* @__PURE__ */ jsxs(Tabs.List, {
|
|
704
|
+
"data-slot": "tabs-list",
|
|
705
|
+
className: cn("text-muted-foreground relative z-0 flex w-fit max-w-full items-center justify-start gap-x-0.5 data-[orientation=vertical]:flex-col max-sm:data-[orientation=horizontal]:overflow-x-auto max-sm:data-[orientation=horizontal]:overflow-y-hidden", variant === "segmented" && "bg-muted rounded-md p-1", variant === "underline" && "data-[orientation=horizontal]:py-1 data-[orientation=vertical]:px-1", variant === "card" && "p-1", className),
|
|
706
|
+
...props,
|
|
707
|
+
children: [children, /* @__PURE__ */ jsx(Tabs.Indicator, {
|
|
708
|
+
"data-slot": "tabs-indicator",
|
|
709
|
+
className: cn("absolute bottom-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) -translate-y-(--active-tab-bottom) transform-gpu transition-[translate,width] duration-200 ease-[cubic-bezier(.25,.46,.45,.94)] will-change-[translate,width]", variant === "segmented" && "bg-card dark:bg-secondary border-border/10 -z-1 h-(--active-tab-height) rounded-sm border shadow-sm", variant === "underline" && "bg-primary z-10 data-[orientation=horizontal]:h-0.5 data-[orientation=horizontal]:translate-y-[1.3px] data-[orientation=vertical]:w-0.5 data-[orientation=vertical]:-translate-x-px", variant === "card" && "bg-secondary border-border/10 -z-1 rounded-sm border")
|
|
710
|
+
})]
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function TabsTrigger({ className, ...props }) {
|
|
714
|
+
const { variant } = useTabs();
|
|
715
|
+
return /* @__PURE__ */ jsx(Tabs.Tab, {
|
|
716
|
+
"data-slot": "tabs-trigger",
|
|
717
|
+
className: cn("text-secondary-foreground/66 data-active:text-foreground hover:text-foreground flex shrink-0 cursor-pointer items-center justify-center gap-2 px-3 py-1 text-sm font-medium break-keep whitespace-nowrap [transition-property:color] duration-200 ease-[cubic-bezier(.25,.46,.45,.94)] outline-none data-[orientation=vertical]:w-full [&_svg]:size-4 [&_svg]:shrink-0", variant === "segmented" && "rounded-md", variant === "underline" && "data-[orientation=horizontal]:py-1.5 data-[orientation=vertical]:items-start data-[orientation=vertical]:justify-start data-[orientation=vertical]:px-2", variant === "card" && "rounded-md", className),
|
|
718
|
+
...props
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
function TabsPanelsWrapper({ children }) {
|
|
722
|
+
const contentContainerRef = useRef(null);
|
|
723
|
+
const [height, setHeight] = useState(0);
|
|
724
|
+
useEffect(() => {
|
|
725
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
726
|
+
for (const entry of entries) setHeight(entry.target.getBoundingClientRect().height);
|
|
727
|
+
});
|
|
728
|
+
if (contentContainerRef.current) resizeObserver.observe(contentContainerRef.current);
|
|
729
|
+
return () => {
|
|
730
|
+
if (contentContainerRef.current) resizeObserver.disconnect();
|
|
731
|
+
};
|
|
732
|
+
}, []);
|
|
733
|
+
return /* @__PURE__ */ jsx("div", {
|
|
734
|
+
className: "relative overflow-hidden [transition-property:height] duration-200 ease-[cubic-bezier(.25,.46,.45,.94)]",
|
|
735
|
+
style: { height: height ?? null },
|
|
736
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
737
|
+
"data-slot": "tabs-panel-wrapper",
|
|
738
|
+
ref: contentContainerRef,
|
|
739
|
+
children
|
|
740
|
+
})
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
function TabsPanel({ className, ...props }) {
|
|
744
|
+
return /* @__PURE__ */ jsx(Tabs.Panel, {
|
|
745
|
+
"data-slot": "tabs-panel",
|
|
746
|
+
className: cn(className),
|
|
747
|
+
...props
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
//#endregion
|
|
752
|
+
//#region src/components/ui/accordion.tsx
|
|
753
|
+
const cssAnimationPresets$3 = {
|
|
754
|
+
none: "transition-none",
|
|
755
|
+
fade: [`[transition-property:opacity,height] [will-change:opacity,height]`, `data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:h-0 data-ending-style:h-0`],
|
|
756
|
+
scale: [`[transition-property:scale,opacity,height] [will-change:scale,opacity,height] origin-left`, `data-starting-style:scale-85 data-starting-style:opacity-0 data-starting-style:h-0 data-ending-style:opacity-0 data-ending-style:h-0 data-ending-style:scale-85`],
|
|
757
|
+
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`],
|
|
758
|
+
perspective: [
|
|
759
|
+
`[transition-property:opacity,rotateX,rotateY,transform,height] [will-change:opacity,rotateX,rotateY,transform,height]`,
|
|
760
|
+
`[transform:perspective(1000px)] origin-top`,
|
|
761
|
+
`data-starting-style:h-0 data-ending-style:h-0`,
|
|
762
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0`,
|
|
763
|
+
`data-starting-style:-rotate-x-[90deg] data-ending-style:-rotate-x-[90deg]`
|
|
764
|
+
],
|
|
765
|
+
perspectiveBlur: [
|
|
766
|
+
`[transition-property:opacity,rotateX,rotateY,transform,height,filter] [will-change:opacity,rotateX,rotateY,transform,height,filter]`,
|
|
767
|
+
`[transform:perspective(1000px)] origin-top`,
|
|
768
|
+
`data-starting-style:h-0 data-ending-style:h-0`,
|
|
769
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0`,
|
|
770
|
+
`data-starting-style:-rotate-x-[90deg] data-ending-style:-rotate-x-[90deg]`,
|
|
771
|
+
`data-starting-style:blur-[9px] data-ending-style:blur-[9px]`
|
|
772
|
+
]
|
|
773
|
+
};
|
|
774
|
+
const cssTransitionPresets$3 = {
|
|
775
|
+
inExpo: `duration-[0.35s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
776
|
+
outExpo: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
777
|
+
inOutExpo: `duration-[0.35s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
778
|
+
anticipate: `duration-[0.35s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
779
|
+
quickOut: `duration-[0.35s] ease-out`,
|
|
780
|
+
overshootOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
781
|
+
swiftOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
782
|
+
snappyOut: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
783
|
+
in: `duration-[0.35s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
784
|
+
out: `duration-[0.35s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
785
|
+
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
786
|
+
outIn: `duration-[0.35s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
787
|
+
inQuad: `duration-[0.35s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
788
|
+
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
789
|
+
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
790
|
+
inCubic: `duration-[0.35s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
791
|
+
outCubic: `duration-[0.35s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
792
|
+
inOutCubic: `duration-[0.35s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
793
|
+
inQuart: `duration-[0.35s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
794
|
+
outQuart: `duration-[0.35s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
795
|
+
inOutQuart: `duration-[0.35s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
796
|
+
inQuint: `duration-[0.35s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
797
|
+
outQuint: `duration-[0.35s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
798
|
+
inOutQuint: `duration-[0.35s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
799
|
+
inCirc: `duration-[0.35s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
800
|
+
outCirc: `duration-[0.35s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
801
|
+
inOutCirc: `duration-[0.35s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
802
|
+
inOutBase: `duration-[0.35s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`
|
|
803
|
+
};
|
|
804
|
+
const AccordionContext = createContext(void 0);
|
|
805
|
+
function useAccordion() {
|
|
806
|
+
const context = useContext(AccordionContext);
|
|
807
|
+
if (!context) throw new Error("useAccordion must be used within a AccordionProvider");
|
|
808
|
+
return context;
|
|
809
|
+
}
|
|
810
|
+
function Accordion$1({ value, defaultValue, onValueChange, animationPreset = "fade", transitionPreset = "outQuad", reduceMotion, variant = "default", className, multiple = false, ...props }) {
|
|
811
|
+
const [accordionValue, setAccordionValue] = useState(value ?? defaultValue ?? []);
|
|
812
|
+
const handleValueChange = (value$1, eventDetails) => {
|
|
813
|
+
setAccordionValue(value$1);
|
|
814
|
+
onValueChange?.(value$1, eventDetails);
|
|
815
|
+
};
|
|
816
|
+
return /* @__PURE__ */ jsx(AccordionContext.Provider, {
|
|
817
|
+
value: {
|
|
818
|
+
value: accordionValue,
|
|
819
|
+
onValueChange: handleValueChange,
|
|
820
|
+
animationPreset,
|
|
821
|
+
transitionPreset,
|
|
822
|
+
reduceMotion,
|
|
823
|
+
variant
|
|
824
|
+
},
|
|
825
|
+
children: /* @__PURE__ */ jsx(Accordion.Root, {
|
|
826
|
+
"data-slot": "accordion",
|
|
827
|
+
value: accordionValue,
|
|
828
|
+
onValueChange: handleValueChange,
|
|
829
|
+
multiple,
|
|
830
|
+
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),
|
|
831
|
+
...props
|
|
832
|
+
})
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
const AccordionItemContext = createContext(void 0);
|
|
836
|
+
function useAccordionItem() {
|
|
837
|
+
const context = useContext(AccordionItemContext);
|
|
838
|
+
if (!context) throw new Error("useAccordionItem must be used within a AccordionItemProvider");
|
|
839
|
+
return context;
|
|
840
|
+
}
|
|
841
|
+
function AccordionItem({ value: itemValue, onOpenChange, className, ...rest }) {
|
|
842
|
+
const { value, variant = "default" } = useAccordion();
|
|
843
|
+
const [isOpen, setIsOpen] = useState(value?.includes(itemValue) ?? false);
|
|
844
|
+
useEffect(() => {
|
|
845
|
+
setIsOpen(value?.includes(itemValue) ?? false);
|
|
846
|
+
}, [value, itemValue]);
|
|
847
|
+
const handleItemOpenChange = (open, eventDetails) => {
|
|
848
|
+
setIsOpen(open);
|
|
849
|
+
onOpenChange?.(open, eventDetails);
|
|
850
|
+
};
|
|
851
|
+
return /* @__PURE__ */ jsx(AccordionItemContext.Provider, {
|
|
852
|
+
value: {
|
|
853
|
+
open: isOpen,
|
|
854
|
+
onOpenChange: handleItemOpenChange,
|
|
855
|
+
variant
|
|
856
|
+
},
|
|
857
|
+
children: /* @__PURE__ */ jsx(Accordion.Item, {
|
|
858
|
+
"data-slot": "accordion-item",
|
|
859
|
+
value: itemValue,
|
|
860
|
+
onOpenChange: handleItemOpenChange,
|
|
861
|
+
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" && [
|
|
862
|
+
"bg-popover border-border/60 relative overflow-hidden border-x",
|
|
863
|
+
"data-closed:border-border/60 data-closed:border-b",
|
|
864
|
+
"first:border-border/60 first:rounded-t-2xl first:border-t",
|
|
865
|
+
"last:border-border/60 last:rounded-b-2xl last:border-b",
|
|
866
|
+
"data-open:border-primary/70 data-open:z-2 data-open:rounded-2xl data-open:border",
|
|
867
|
+
"data-open:my-6 data-open:first:mt-0 data-open:last:mb-0",
|
|
868
|
+
"has-[+_[data-slot='accordion-item'][data-open]]:rounded-b-2xl",
|
|
869
|
+
"has-[+_[data-slot='accordion-item'][data-open]]:border-b!",
|
|
870
|
+
"has-[+_[data-slot='accordion-item'][data-open]]:border-border/60",
|
|
871
|
+
"data-open:[&+[data-slot='accordion-item']]:rounded-t-2xl",
|
|
872
|
+
"data-open:[&+[data-slot='accordion-item'][data-closed]]:border-t",
|
|
873
|
+
"data-open:[&+[data-slot='accordion-item']]:border-border/60",
|
|
874
|
+
"data-closed:first:border-t",
|
|
875
|
+
"data-closed:last:border-b"
|
|
876
|
+
], className),
|
|
877
|
+
...rest
|
|
878
|
+
})
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
function AccordionHeader({ className, ...props }) {
|
|
882
|
+
return /* @__PURE__ */ jsx(Accordion.Header, {
|
|
883
|
+
"data-slot": "accordion-header",
|
|
884
|
+
className: cn(className),
|
|
885
|
+
...props
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
function AccordionTrigger({ className, icon, children, ...props }) {
|
|
889
|
+
const { open, variant = "default" } = useAccordionItem();
|
|
890
|
+
return /* @__PURE__ */ jsx(AccordionHeader, {
|
|
891
|
+
className: "flex",
|
|
892
|
+
children: /* @__PURE__ */ jsxs(Accordion.Trigger, {
|
|
893
|
+
"data-slot": "accordion-trigger",
|
|
894
|
+
className: cn("flex w-full cursor-pointer items-center px-4 py-3 text-left text-sm", "[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 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),
|
|
895
|
+
...props,
|
|
896
|
+
children: [children, /* @__PURE__ */ jsx("span", {
|
|
897
|
+
className: "ml-auto",
|
|
898
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: cn("h-4 w-4 transition-transform duration-200", open ? "rotate-180" : "") })
|
|
899
|
+
})]
|
|
900
|
+
})
|
|
901
|
+
});
|
|
902
|
+
}
|
|
903
|
+
function AccordionPanel({ className, children, style, ...props }) {
|
|
904
|
+
const { variant = "default", animationPreset = "fade", transitionPreset = "snappyOut", reduceMotion = false } = useAccordion();
|
|
905
|
+
const cssAnimationConfig = useMemo(() => {
|
|
906
|
+
if (reduceMotion) return cssAnimationPresets$3.none;
|
|
907
|
+
if (animationPreset) return cssAnimationPresets$3[animationPreset];
|
|
908
|
+
return cssAnimationPresets$3.fade;
|
|
909
|
+
}, [animationPreset, reduceMotion]);
|
|
910
|
+
const cssTransitionConfig = useMemo(() => {
|
|
911
|
+
if (reduceMotion) return "";
|
|
912
|
+
if (transitionPreset) return cssTransitionPresets$3[transitionPreset];
|
|
913
|
+
return cssTransitionPresets$3.inOutExpo;
|
|
914
|
+
}, [transitionPreset, reduceMotion]);
|
|
915
|
+
return /* @__PURE__ */ jsx(Accordion.Panel, {
|
|
916
|
+
"data-slot": "accordion-panel",
|
|
917
|
+
className: cn("h-(--accordion-panel-height) overflow-hidden text-sm", cssAnimationConfig, cssTransitionConfig, className),
|
|
918
|
+
style: {
|
|
919
|
+
willChange: "height, opacity, transform",
|
|
920
|
+
...style
|
|
921
|
+
},
|
|
922
|
+
...props,
|
|
923
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
924
|
+
"data-slot": "accordion-panel-content",
|
|
925
|
+
className: cn(variant === "default" ? "p-0" : "p-3 pl-4"),
|
|
926
|
+
children
|
|
927
|
+
})
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
//#endregion
|
|
932
|
+
//#region src/components/FieldGroups/index.tsx
|
|
933
|
+
const usePuck$1 = createUsePuck();
|
|
934
|
+
const isSingleAccordion = (accordions) => {
|
|
935
|
+
return "fields" in accordions && Array.isArray(accordions.fields);
|
|
936
|
+
};
|
|
937
|
+
const FieldGroups = ({ children }) => {
|
|
938
|
+
const config = usePuck$1((s) => s.config);
|
|
939
|
+
const selectedItem = usePuck$1((s) => s.selectedItem);
|
|
940
|
+
const componentConfig = useMemo(() => {
|
|
941
|
+
if (!selectedItem?.type) return null;
|
|
942
|
+
return config.components?.[selectedItem.type] || null;
|
|
943
|
+
}, [config, selectedItem]);
|
|
944
|
+
const tabsConfig = useMemo(() => {
|
|
945
|
+
if (!componentConfig) return null;
|
|
946
|
+
const configWithTabs = componentConfig;
|
|
947
|
+
if (!configWithTabs.tabs) return null;
|
|
948
|
+
return configWithTabs.tabs;
|
|
949
|
+
}, [componentConfig]);
|
|
950
|
+
const fieldToLocationMap = useMemo(() => {
|
|
951
|
+
const map = /* @__PURE__ */ new Map();
|
|
952
|
+
if (!tabsConfig) return map;
|
|
953
|
+
Object.entries(tabsConfig).forEach(([tabKey, tabConfig]) => {
|
|
954
|
+
const { accordions } = tabConfig;
|
|
955
|
+
if (isSingleAccordion(accordions)) accordions.fields.forEach((fieldName) => {
|
|
956
|
+
map.set(fieldName, {
|
|
957
|
+
tab: tabKey,
|
|
958
|
+
accordion: tabKey
|
|
959
|
+
});
|
|
960
|
+
});
|
|
961
|
+
else Object.entries(accordions).forEach(([accordionKey, accordionConfig]) => {
|
|
962
|
+
if (accordionConfig?.fields) accordionConfig.fields.forEach((fieldName) => {
|
|
963
|
+
map.set(fieldName, {
|
|
964
|
+
tab: tabKey,
|
|
965
|
+
accordion: accordionKey
|
|
966
|
+
});
|
|
967
|
+
});
|
|
968
|
+
});
|
|
969
|
+
});
|
|
970
|
+
return map;
|
|
971
|
+
}, [tabsConfig]);
|
|
972
|
+
const organizedChildren = useMemo(() => {
|
|
973
|
+
const childArray = Children.toArray(children);
|
|
974
|
+
const result = {};
|
|
975
|
+
if (!tabsConfig) return { __ungrouped: { default: childArray } };
|
|
976
|
+
Object.entries(tabsConfig).forEach(([tabKey, tabConfig]) => {
|
|
977
|
+
result[tabKey] = {};
|
|
978
|
+
const { accordions } = tabConfig;
|
|
979
|
+
if (isSingleAccordion(accordions)) result[tabKey][tabKey] = [];
|
|
980
|
+
else Object.keys(accordions).forEach((accordionKey) => {
|
|
981
|
+
result[tabKey][accordionKey] = [];
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
const ungrouped = [];
|
|
985
|
+
childArray.forEach((child) => {
|
|
986
|
+
if (!isValidElement(child)) {
|
|
987
|
+
ungrouped.push(child);
|
|
988
|
+
return;
|
|
989
|
+
}
|
|
990
|
+
const props = child.props;
|
|
991
|
+
let fieldName = null;
|
|
992
|
+
if (props?.field) fieldName = props.field;
|
|
993
|
+
else if (props?.name) fieldName = props.name;
|
|
994
|
+
else if (props?.id) fieldName = props.id;
|
|
995
|
+
else if (child.key && typeof child.key === "string") fieldName = child.key.replace(/^\.\$?/, "");
|
|
996
|
+
if (fieldName) {
|
|
997
|
+
const location = fieldToLocationMap.get(fieldName);
|
|
998
|
+
if (location) {
|
|
999
|
+
const enhancedChild = cloneElement(child, {
|
|
1000
|
+
...child.props || {},
|
|
1001
|
+
"data-field-name": fieldName,
|
|
1002
|
+
"data-tab": location.tab,
|
|
1003
|
+
"data-accordion": location.accordion
|
|
1004
|
+
});
|
|
1005
|
+
if (!result[location.tab]) result[location.tab] = {};
|
|
1006
|
+
if (!result[location.tab][location.accordion]) result[location.tab][location.accordion] = [];
|
|
1007
|
+
result[location.tab][location.accordion].push(enhancedChild);
|
|
1008
|
+
return;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
ungrouped.push(child);
|
|
1012
|
+
});
|
|
1013
|
+
return {
|
|
1014
|
+
...result,
|
|
1015
|
+
__ungrouped: { default: ungrouped }
|
|
1016
|
+
};
|
|
1017
|
+
}, [
|
|
1018
|
+
children,
|
|
1019
|
+
tabsConfig,
|
|
1020
|
+
fieldToLocationMap
|
|
1021
|
+
]);
|
|
1022
|
+
const defaultTab = useMemo(() => {
|
|
1023
|
+
if (!tabsConfig) return "ungrouped";
|
|
1024
|
+
return Object.keys(tabsConfig)[0] || "ungrouped";
|
|
1025
|
+
}, [tabsConfig]);
|
|
1026
|
+
const hasOrganizedFields = useMemo(() => {
|
|
1027
|
+
if (!tabsConfig) return false;
|
|
1028
|
+
return Object.keys(tabsConfig).some((tabKey) => {
|
|
1029
|
+
const tabContent = organizedChildren[tabKey];
|
|
1030
|
+
if (!tabContent || typeof tabContent !== "object") return false;
|
|
1031
|
+
return Object.keys(tabContent).some((accordionKey) => Array.isArray(tabContent[accordionKey]) && tabContent[accordionKey].length > 0);
|
|
1032
|
+
});
|
|
1033
|
+
}, [tabsConfig, organizedChildren]);
|
|
1034
|
+
if (!tabsConfig) return /* @__PURE__ */ jsx("div", {
|
|
1035
|
+
className: "space-y-4",
|
|
1036
|
+
children
|
|
1037
|
+
});
|
|
1038
|
+
if (!hasOrganizedFields) return /* @__PURE__ */ jsx("div", {
|
|
1039
|
+
className: "space-y-4",
|
|
1040
|
+
children
|
|
1041
|
+
});
|
|
1042
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1043
|
+
className: "puck-field-groups",
|
|
1044
|
+
children: [/* @__PURE__ */ jsxs(Tabs$1, {
|
|
1045
|
+
defaultValue: defaultTab,
|
|
1046
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1047
|
+
className: "px-2 pt-2",
|
|
1048
|
+
children: /* @__PURE__ */ jsx(TabsList, {
|
|
1049
|
+
className: "bg-muted w-full justify-center p-1.5",
|
|
1050
|
+
children: Object.entries(tabsConfig).map(([tabKey, tabConfig]) => {
|
|
1051
|
+
const tabContent = organizedChildren[tabKey];
|
|
1052
|
+
if (!tabContent || typeof tabContent !== "object") return null;
|
|
1053
|
+
if (!Object.keys(tabContent).some((accordionKey) => Array.isArray(tabContent[accordionKey]) && tabContent[accordionKey].length > 0)) return null;
|
|
1054
|
+
return /* @__PURE__ */ jsx(TabsTrigger, {
|
|
1055
|
+
value: tabKey,
|
|
1056
|
+
className: "flex-1",
|
|
1057
|
+
children: tabConfig.title
|
|
1058
|
+
}, tabKey);
|
|
1059
|
+
})
|
|
1060
|
+
})
|
|
1061
|
+
}), /* @__PURE__ */ jsx(TabsPanelsWrapper, { children: Object.entries(tabsConfig).map(([tabKey, tabConfig]) => {
|
|
1062
|
+
const tabContent = organizedChildren[tabKey];
|
|
1063
|
+
if (!tabContent || typeof tabContent !== "object") return null;
|
|
1064
|
+
const { accordions } = tabConfig;
|
|
1065
|
+
if (isSingleAccordion(accordions)) {
|
|
1066
|
+
const fields = tabContent[tabKey];
|
|
1067
|
+
if (!fields || !Array.isArray(fields) || fields.length === 0) return null;
|
|
1068
|
+
return /* @__PURE__ */ jsx(TabsPanel, {
|
|
1069
|
+
value: tabKey,
|
|
1070
|
+
children: /* @__PURE__ */ jsx(Accordion$1, {
|
|
1071
|
+
defaultValue: accordions.defaultExpanded ? [tabKey] : [],
|
|
1072
|
+
className: "rounded-none border-none",
|
|
1073
|
+
children: /* @__PURE__ */ jsxs(AccordionItem, {
|
|
1074
|
+
value: tabKey,
|
|
1075
|
+
children: [/* @__PURE__ */ jsx(AccordionTrigger, { children: accordions.title }), /* @__PURE__ */ jsx(AccordionPanel, {
|
|
1076
|
+
className: "p-0",
|
|
1077
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1078
|
+
className: "space-y-4",
|
|
1079
|
+
children: fields
|
|
1080
|
+
})
|
|
1081
|
+
})]
|
|
1082
|
+
})
|
|
1083
|
+
})
|
|
1084
|
+
}, tabKey);
|
|
1085
|
+
}
|
|
1086
|
+
const accordionsRecord = accordions;
|
|
1087
|
+
return /* @__PURE__ */ jsx(TabsPanel, {
|
|
1088
|
+
value: tabKey,
|
|
1089
|
+
children: /* @__PURE__ */ jsx(Accordion$1, {
|
|
1090
|
+
multiple: true,
|
|
1091
|
+
defaultValue: Object.entries(accordionsRecord).filter(([, accordionConfig]) => accordionConfig?.defaultExpanded).map(([accordionKey]) => accordionKey),
|
|
1092
|
+
className: "rounded-none border-none",
|
|
1093
|
+
children: Object.entries(accordionsRecord).map(([accordionKey, accordionConfig]) => {
|
|
1094
|
+
const fields = tabContent[accordionKey];
|
|
1095
|
+
if (!fields || !Array.isArray(fields) || fields.length === 0) return null;
|
|
1096
|
+
return /* @__PURE__ */ jsxs(AccordionItem, {
|
|
1097
|
+
value: accordionKey,
|
|
1098
|
+
children: [/* @__PURE__ */ jsx(AccordionTrigger, { children: accordionConfig.title }), /* @__PURE__ */ jsx(AccordionPanel, {
|
|
1099
|
+
className: "p-0",
|
|
1100
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1101
|
+
className: "space-y-4",
|
|
1102
|
+
children: fields
|
|
1103
|
+
})
|
|
1104
|
+
})]
|
|
1105
|
+
}, accordionKey);
|
|
1106
|
+
})
|
|
1107
|
+
})
|
|
1108
|
+
}, tabKey);
|
|
1109
|
+
}) })]
|
|
1110
|
+
}), organizedChildren["__ungrouped"]?.default && Array.isArray(organizedChildren["__ungrouped"].default) && organizedChildren["__ungrouped"].default.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
1111
|
+
className: "mt-4 space-y-4 border-t pt-4",
|
|
1112
|
+
children: organizedChildren["__ungrouped"].default
|
|
1113
|
+
})]
|
|
1114
|
+
});
|
|
1115
|
+
};
|
|
1116
|
+
var FieldGroups_default = FieldGroups;
|
|
1117
|
+
|
|
1118
|
+
//#endregion
|
|
1119
|
+
//#region src/components/ui/tooltip.tsx
|
|
1120
|
+
const cssAnimationPresets$2 = {
|
|
1121
|
+
none: "transition-none",
|
|
1122
|
+
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`],
|
|
1123
|
+
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`],
|
|
1124
|
+
slideOutside: [
|
|
1125
|
+
`[transition-property:translate,opacity]`,
|
|
1126
|
+
`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`,
|
|
1127
|
+
`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`,
|
|
1128
|
+
`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`,
|
|
1129
|
+
`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`,
|
|
1130
|
+
`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`,
|
|
1131
|
+
`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`
|
|
1132
|
+
],
|
|
1133
|
+
slideInside: [
|
|
1134
|
+
`[transition-property:translate,opacity]`,
|
|
1135
|
+
`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`,
|
|
1136
|
+
`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`,
|
|
1137
|
+
`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`,
|
|
1138
|
+
`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`,
|
|
1139
|
+
`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`,
|
|
1140
|
+
`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`
|
|
1141
|
+
],
|
|
1142
|
+
wipe: [
|
|
1143
|
+
`[transition-property:clip-path] [will-change:clip-path]`,
|
|
1144
|
+
`[clip-path:inset(0_0_0_0_round_var(--radius))] [-webkit-clip-path:inset(0_0_0_0_round_var(--radius))]`,
|
|
1145
|
+
`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))]`,
|
|
1146
|
+
`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))]`,
|
|
1147
|
+
`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))]`,
|
|
1148
|
+
`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))]`,
|
|
1149
|
+
`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))]`,
|
|
1150
|
+
`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))]`
|
|
1151
|
+
],
|
|
1152
|
+
wipeScale: [
|
|
1153
|
+
`[transition-property:clip-path,scale] [will-change:clip-path,scale]`,
|
|
1154
|
+
`[clip-path:inset(0_0_0_0_round_var(--radius))] [-webkit-clip-path:inset(0_0_0_0_round_var(--radius))]`,
|
|
1155
|
+
`data-starting-style:scale-80 data-ending-style:scale-80`,
|
|
1156
|
+
`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))]`,
|
|
1157
|
+
`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))]`,
|
|
1158
|
+
`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))]`,
|
|
1159
|
+
`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))]`,
|
|
1160
|
+
`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))]`,
|
|
1161
|
+
`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))]`
|
|
1162
|
+
],
|
|
1163
|
+
motion: [
|
|
1164
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform] [will-change:translate,scale,opacity,rotateX,rotateY,transform]`,
|
|
1165
|
+
`[transform:perspective(1000px)]`,
|
|
1166
|
+
`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]`,
|
|
1167
|
+
`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]`,
|
|
1168
|
+
`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]`,
|
|
1169
|
+
`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]`,
|
|
1170
|
+
`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]`,
|
|
1171
|
+
`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]`
|
|
1172
|
+
],
|
|
1173
|
+
motionBlur: [
|
|
1174
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform,filter] [will-change:translate,scale,opacity,rotateX,rotateY,transform,filter]`,
|
|
1175
|
+
`[transform:perspective(1000px)]`,
|
|
1176
|
+
`data-starting-style:blur-[9px] data-ending-style:blur-[9px]`,
|
|
1177
|
+
`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]`,
|
|
1178
|
+
`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]`,
|
|
1179
|
+
`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]`,
|
|
1180
|
+
`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]`,
|
|
1181
|
+
`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]`,
|
|
1182
|
+
`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]`
|
|
1183
|
+
]
|
|
1184
|
+
};
|
|
1185
|
+
const cssTransitionPresets$2 = {
|
|
1186
|
+
inExpo: `duration-[0.25s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
1187
|
+
outExpo: `duration-[0.25s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
1188
|
+
inOutExpo: `duration-[0.25s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
1189
|
+
anticipate: `duration-[0.25s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
1190
|
+
quickOut: `duration-[0.25s] ease-out`,
|
|
1191
|
+
overshootOut: `duration-[0.25s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
1192
|
+
swiftOut: `duration-[0.25s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
1193
|
+
snappyOut: `duration-[0.25s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
1194
|
+
in: `duration-[0.25s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
1195
|
+
out: `duration-[0.25s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
1196
|
+
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
1197
|
+
outIn: `duration-[0.25s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
1198
|
+
inQuad: `duration-[0.25s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
1199
|
+
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
1200
|
+
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
1201
|
+
inCubic: `duration-[0.25s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
1202
|
+
outCubic: `duration-[0.25s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
1203
|
+
inOutCubic: `duration-[0.25s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
1204
|
+
inQuart: `duration-[0.25s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
1205
|
+
outQuart: `duration-[0.25s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
1206
|
+
inOutQuart: `duration-[0.25s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
1207
|
+
inQuint: `duration-[0.25s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
1208
|
+
outQuint: `duration-[0.25s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
1209
|
+
inOutQuint: `duration-[0.25s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
1210
|
+
inCirc: `duration-[0.25s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
1211
|
+
outCirc: `duration-[0.25s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
1212
|
+
inOutCirc: `duration-[0.25s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
1213
|
+
inOutBase: `duration-[0.25s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`,
|
|
1214
|
+
none: `duration-0 ease-none`
|
|
1215
|
+
};
|
|
1216
|
+
function TooltipProvider({ delay = 300, ...props }) {
|
|
1217
|
+
return /* @__PURE__ */ jsx(Tooltip.Provider, {
|
|
1218
|
+
"data-slot": "tooltip-provider",
|
|
1219
|
+
delay,
|
|
1220
|
+
...props
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
function Tooltip$1({ ...props }) {
|
|
1224
|
+
return /* @__PURE__ */ jsx(Tooltip.Root, {
|
|
1225
|
+
"data-slot": "tooltip",
|
|
1226
|
+
...props
|
|
1227
|
+
});
|
|
1228
|
+
}
|
|
1229
|
+
function TooltipTrigger(props) {
|
|
1230
|
+
return /* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
1231
|
+
"data-slot": "tooltip-trigger",
|
|
1232
|
+
...props
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
function TooltipPortal(props) {
|
|
1236
|
+
return /* @__PURE__ */ jsx(Tooltip.Portal, {
|
|
1237
|
+
"data-slot": "tooltip-portal",
|
|
1238
|
+
...props
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
function TooltipPositioner({ className, side = "top", ...rest }) {
|
|
1242
|
+
return /* @__PURE__ */ jsx(TooltipPortal, { children: /* @__PURE__ */ jsx(Tooltip.Positioner, {
|
|
1243
|
+
side,
|
|
1244
|
+
"data-slot": "tooltip-positioner",
|
|
1245
|
+
className: cn("z-100", (side === "inline-end" || side === "inline-start") && "**:data-[slot=tooltip-arrow]:hidden", className),
|
|
1246
|
+
...rest
|
|
1247
|
+
}) });
|
|
1248
|
+
}
|
|
1249
|
+
function TooltipPopup({ className, animationPreset = "scale", transitionPreset = "outQuint", reduceMotion = false, showArrow = false, side = "top", sideOffset = 4, align = "center", alignOffset = 0, ...rest }) {
|
|
1250
|
+
const cssAnimationConfig = useMemo(() => {
|
|
1251
|
+
if (reduceMotion) return "none";
|
|
1252
|
+
if (animationPreset) return cssAnimationPresets$2[animationPreset];
|
|
1253
|
+
return cssAnimationPresets$2.scale;
|
|
1254
|
+
}, [
|
|
1255
|
+
animationPreset,
|
|
1256
|
+
reduceMotion,
|
|
1257
|
+
side
|
|
1258
|
+
]);
|
|
1259
|
+
const cssTransitionConfig = useMemo(() => {
|
|
1260
|
+
if (reduceMotion) return "none";
|
|
1261
|
+
if (transitionPreset) return cssTransitionPresets$2[transitionPreset];
|
|
1262
|
+
return cssTransitionPresets$2.snappyOut;
|
|
1263
|
+
}, [
|
|
1264
|
+
transitionPreset,
|
|
1265
|
+
reduceMotion,
|
|
1266
|
+
side
|
|
1267
|
+
]);
|
|
1268
|
+
return /* @__PURE__ */ jsx(TooltipPositioner, {
|
|
1269
|
+
side,
|
|
1270
|
+
sideOffset,
|
|
1271
|
+
align,
|
|
1272
|
+
alignOffset,
|
|
1273
|
+
children: /* @__PURE__ */ jsx(Tooltip.Popup, {
|
|
1274
|
+
"data-slot": "tooltip-popup",
|
|
1275
|
+
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 && [
|
|
1276
|
+
`before: before:bg-popover z-[-1] before:absolute before:h-2 before:w-2 before:rotate-45 before:content-['']`,
|
|
1277
|
+
side === "top" && `before:border-border before:-bottom-[4.7px] before:left-1/2 before:-translate-x-1/2 before:border-r before:border-b`,
|
|
1278
|
+
side === "right" && `before:border-border before:top-1/2 before:-left-[4.07px] before:-translate-y-1/2 before:border-b before:border-l`,
|
|
1279
|
+
side === "bottom" && `before:border-border before:-top-[4.7px] before:left-1/2 before:-translate-x-1/2 before:border-t before:border-l`,
|
|
1280
|
+
side === "left" && `before:border-border before:top-1/2 before:-right-[4.07px] before:-translate-y-1/2 before:border-t before:border-r`,
|
|
1281
|
+
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`,
|
|
1282
|
+
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`
|
|
1283
|
+
]),
|
|
1284
|
+
...rest
|
|
1285
|
+
})
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/components/DrawerItem/index.tsx
|
|
1291
|
+
const usePuck = createUsePuck();
|
|
1292
|
+
const DrawerItem = ({ name, icon }) => {
|
|
1293
|
+
const config = usePuck(useCallback((state) => state.config, []));
|
|
1294
|
+
const componentConfig = Object.values(config.components || {}).find((c) => c.label === name);
|
|
1295
|
+
const iconOrImage = icon || componentConfig?.metadata?.icon;
|
|
1296
|
+
const imageUrl = componentConfig?.metadata?.image;
|
|
1297
|
+
const description = componentConfig?.metadata?.description;
|
|
1298
|
+
const displayIcon = iconOrImage || /* @__PURE__ */ jsx(BoxIcon, { size: 16 });
|
|
1299
|
+
const hasTooltipContent = imageUrl || description;
|
|
1300
|
+
const drawerContent = /* @__PURE__ */ jsx("div", {
|
|
1301
|
+
className: "rounded-md border border-dashed border-red-500 bg-red-500/10 p-3",
|
|
1302
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1303
|
+
className: "hover:bg-muted group flex cursor-grab items-center justify-between gap-2 rounded-md bg-white p-0.5 transition-colors",
|
|
1304
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1305
|
+
className: "flex items-center gap-2 truncate",
|
|
1306
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1307
|
+
className: "border-border group-hover:border-muted rounded-sm border bg-white p-3",
|
|
1308
|
+
children: displayIcon
|
|
1309
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1310
|
+
className: "truncate text-sm font-medium",
|
|
1311
|
+
children: name
|
|
1312
|
+
})]
|
|
1313
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1314
|
+
className: "text-foreground h-full flex-none rounded-sm bg-white px-1 py-3",
|
|
1315
|
+
children: /* @__PURE__ */ jsx(GripVerticalIcon, { size: 16 })
|
|
1316
|
+
})]
|
|
1317
|
+
})
|
|
1318
|
+
});
|
|
1319
|
+
if (!hasTooltipContent) return drawerContent;
|
|
1320
|
+
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
1321
|
+
delay: 200,
|
|
1322
|
+
children: /* @__PURE__ */ jsxs(Tooltip$1, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
1323
|
+
className: "w-full",
|
|
1324
|
+
children: drawerContent
|
|
1325
|
+
}), /* @__PURE__ */ jsxs(TooltipPopup, {
|
|
1326
|
+
side: "right",
|
|
1327
|
+
sideOffset: 8,
|
|
1328
|
+
className: "w-64 p-2",
|
|
1329
|
+
children: [imageUrl && /* @__PURE__ */ jsx("img", {
|
|
1330
|
+
src: imageUrl,
|
|
1331
|
+
alt: name,
|
|
1332
|
+
className: "h-auto w-full rounded-sm object-contain"
|
|
1333
|
+
}), description && /* @__PURE__ */ jsx("p", {
|
|
1334
|
+
className: "text-muted-foreground mt-2 text-sm",
|
|
1335
|
+
children: description
|
|
1336
|
+
})]
|
|
1337
|
+
})] })
|
|
1338
|
+
});
|
|
1339
|
+
};
|
|
1340
|
+
var DrawerItem_default = DrawerItem;
|
|
1341
|
+
|
|
1342
|
+
//#endregion
|
|
1343
|
+
//#region src/overrides/plugin.tsx
|
|
1344
|
+
const createPuckOverridesPlugin = () => {
|
|
1345
|
+
return { overrides: {
|
|
1346
|
+
actionBar: ActionBar_default,
|
|
1347
|
+
drawer: ({ children }) => /* @__PURE__ */ jsx("div", {
|
|
1348
|
+
className: "rounded-md border border-dashed border-green-500 bg-green-500/10 p-3",
|
|
1349
|
+
children
|
|
1350
|
+
}),
|
|
1351
|
+
drawerItem: DrawerItem_default,
|
|
1352
|
+
fields: FieldGroups_default,
|
|
1353
|
+
fieldLabel: ({ children, label }) => /* @__PURE__ */ jsxs("div", {
|
|
1354
|
+
className: "rounded-md border border-dashed border-blue-500 bg-blue-500/10 p-3",
|
|
1355
|
+
children: [/* @__PURE__ */ jsx(Label_default, { label }), children]
|
|
1356
|
+
}),
|
|
1357
|
+
fieldTypes: {
|
|
1358
|
+
checkbox: Checkbox_default,
|
|
1359
|
+
numberUnit: NumberUnit_default,
|
|
1360
|
+
radio: Radio_default,
|
|
1361
|
+
select: Select_default,
|
|
1362
|
+
text: Input_default,
|
|
1363
|
+
textarea: Textarea_default
|
|
1364
|
+
}
|
|
1365
|
+
} };
|
|
1366
|
+
};
|
|
1367
|
+
var plugin_default = createPuckOverridesPlugin;
|
|
1368
|
+
|
|
1369
|
+
//#endregion
|
|
1370
|
+
//#region src/components/ui/button.tsx
|
|
1371
|
+
const buttonVariants = tv({
|
|
1372
|
+
base: [
|
|
1373
|
+
`group inline-flex relative isolate shrink-0 items-center gap-1.5 text-sm justify-center w-fit touch-none whitespace-nowrap cursor-pointer outline-hidden transform-gpu motion-reduce:transform-none overflow-hidden`,
|
|
1374
|
+
`focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-secondary-foreground`,
|
|
1375
|
+
`disabled:cursor-not-allowed disabled:scale-100 disabled:opacity-60 disabled:bg-secondary`,
|
|
1376
|
+
`[transition:scale_0.1s,box-shadow_0.2s,background_0.20s,width_0.2s] [transition-timing-function:cubic-bezier(.6,.04,.98,.335)] will-change-transform`,
|
|
1377
|
+
`[&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none active:scale-98`
|
|
1378
|
+
],
|
|
1379
|
+
variants: {
|
|
1380
|
+
variant: {
|
|
1381
|
+
default: `bg-linear-to-b from-primary/80 dark:from-primary to-primary text-primary-foreground hover:from-primary/75 dark:hover:from-primary/95`,
|
|
1382
|
+
secondary: "border-secondary bg-secondary text-secondary-foreground hover:bg-secondary/90 data-pressed:bg-secondary/90",
|
|
1383
|
+
outline: `border bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50`,
|
|
1384
|
+
ghost: `text-primary hover:bg-primary/10 focus-vislbe:bg-primary/10 focus-visible:border-primary/25`,
|
|
1385
|
+
link: `text-primary hover:underline hover:underline-offset-4 hover:decoration-1 focus-visible:underline focus-visible:underline-offset-4 focus-visible:decoration-1`,
|
|
1386
|
+
destructive: "bg-destructive text-white hover:bg-destructive/90 focus-visible:border-destructive focus-visible:bg-destructive/90 focus-visible:ring-destructive bg-linear-to-t from-destructive/90 to-destructive"
|
|
1387
|
+
},
|
|
1388
|
+
size: {
|
|
1389
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
1390
|
+
xs: "h-6 gap-1 rounded-md px-[calc(--spacing(2)-1px)] py-[calc(--spacing(1)-1px)] text-xs [&_svg:not([class*='size-'])]:size-3",
|
|
1391
|
+
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
1392
|
+
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
1393
|
+
xl: "h-12 px-[calc(--spacing(4)-1px)] py-[calc(--spacing(2)-1px)] text-base [&_svg:not([class*='size-'])]:size-4.5",
|
|
1394
|
+
"icon-sm": "size-8 [&_svg:not([class*='size-'])]:size-3.5",
|
|
1395
|
+
icon: "size-9 [&_svg:not([class*='size-'])]:size-4",
|
|
1396
|
+
"icon-lg": "size-10 [&_svg:not([class*='size-'])]:size-4.5",
|
|
1397
|
+
"icon-xl": "size-12 [&_svg:not([class*='size-'])]:size-4.5"
|
|
1398
|
+
},
|
|
1399
|
+
radius: {
|
|
1400
|
+
none: "rounded-none",
|
|
1401
|
+
sm: "rounded-sm",
|
|
1402
|
+
default: "rounded-md",
|
|
1403
|
+
lg: "rounded-lg",
|
|
1404
|
+
xl: "rounded-xl",
|
|
1405
|
+
full: "rounded-full"
|
|
1406
|
+
}
|
|
1407
|
+
},
|
|
1408
|
+
defaultVariants: {
|
|
1409
|
+
variant: "default",
|
|
1410
|
+
size: "default",
|
|
1411
|
+
radius: "default"
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
function Button$1({ className, variant = "default", size = "default", radius = "default", ...props }) {
|
|
1415
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
1416
|
+
"data-slot": "button",
|
|
1417
|
+
className: cn(buttonVariants({
|
|
1418
|
+
variant,
|
|
1419
|
+
size,
|
|
1420
|
+
radius
|
|
1421
|
+
}), className),
|
|
1422
|
+
...props
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
//#endregion
|
|
1427
|
+
//#region src/components/ui/dialog.tsx
|
|
1428
|
+
const cssAnimationPresets$1 = {
|
|
1429
|
+
none: "transition-none",
|
|
1430
|
+
scale: [
|
|
1431
|
+
`[transition-property:scale,opacity,translate] [will-change:scale,opacity,translate]`,
|
|
1432
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-starting-style:translate-y-4 max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:scale-98 max-sm:data-ending-style:scale-98 max-sm:origin-bottom`,
|
|
1433
|
+
`sm:-translate-y-[calc(2rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))] sm:data-starting-style:scale-98 sm:data-ending-style:scale-98 sm:data-nested:data-ending-style:translate-y-8 sm:data-nested:data-starting-style:translate-y-8`
|
|
1434
|
+
],
|
|
1435
|
+
fade: [
|
|
1436
|
+
`[transition-property:opacity,translate,scale] [will-change:opacity,translate,scale]`,
|
|
1437
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-starting-style:translate-y-4 max-sm:data-ending-style:translate-y-4`,
|
|
1438
|
+
`sm:-translate-y-[calc(2rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1439
|
+
],
|
|
1440
|
+
topFlip: [
|
|
1441
|
+
`[transition-property:opacity,filter,transform,translate,scale] [will-change:opacity,filter,transform,translate,scale]`,
|
|
1442
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:blur-[4px] data-ending-style:blur-[4px] data-starting-style:transform-[perspective(1000px)_rotateX(50deg)_scale(0.8)] data-ending-style:transform-[perspective(1000px)_rotateX(50deg)_scale(0.8)]`,
|
|
1443
|
+
`sm:translate-y-[calc(3.5rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1444
|
+
],
|
|
1445
|
+
bottomFlip: [
|
|
1446
|
+
`[transition-property:opacity,filter,transform,translate,scale] [will-change:opacity,filter,transform,translate,scale]`,
|
|
1447
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:blur-[4px] data-ending-style:blur-[4px] data-starting-style:transform-[perspective(1000px)_rotateX(-50deg)_scale(0.8)] data-ending-style:transform-[perspective(1000px)_rotateX(-50deg)_scale(0.8)]`,
|
|
1448
|
+
`sm:-translate-y-[calc(2rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1449
|
+
],
|
|
1450
|
+
rightFlip: [
|
|
1451
|
+
`[transition-property:opacity,filter,transform,translate,scale] [will-change:opacity,filter,transform,translate,scale]`,
|
|
1452
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:blur-[4px] data-ending-style:blur-[4px] data-starting-style:transform-[perspective(1000px)_rotateY(50deg)_scale(0.8)] data-ending-style:transform-[perspective(1000px)_rotateY(50deg)_scale(0.8)]`,
|
|
1453
|
+
`sm:-translate-x-[calc(2.5rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1454
|
+
],
|
|
1455
|
+
leftFlip: [
|
|
1456
|
+
`[transition-property:opacity,filter,transform,translate,scale] [will-change:opacity,filter,transform,translate,scale]`,
|
|
1457
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:blur-[4px] data-ending-style:blur-[4px] data-starting-style:transform-[perspective(1000px)_rotateY(-50deg)_scale(0.8)] data-ending-style:transform-[perspective(1000px)_rotateY(-50deg)_scale(0.8)]`,
|
|
1458
|
+
`sm:translate-x-[calc(2.5rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1459
|
+
],
|
|
1460
|
+
topSlide: [
|
|
1461
|
+
`[transition-property:opacity,transform,translate,scale] [will-change:opacity,transform,translate,scale]`,
|
|
1462
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:translate-y-[-20px] data-ending-style:translate-y-[-20px] max-sm:data-starting-style:-translate-y-4 max-sm:data-ending-style:-translate-y-4`,
|
|
1463
|
+
`sm:translate-y-[calc(3.5rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1464
|
+
],
|
|
1465
|
+
bottomSlide: [
|
|
1466
|
+
`[transition-property:opacity,transform,translate,scale] [will-change:opacity,transform,translate,scale]`,
|
|
1467
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:translate-y-[20px] data-ending-style:translate-y-[20px] max-sm:data-starting-style:translate-y-4 max-sm:data-ending-style:translate-y-4`,
|
|
1468
|
+
`sm:-translate-y-[calc(2rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1469
|
+
],
|
|
1470
|
+
leftSlide: [
|
|
1471
|
+
`[transition-property:opacity,transform,translate,scale] [will-change:opacity,transform,translate,scale]`,
|
|
1472
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:translate-x-[-20px] data-ending-style:translate-x-[-20px] max-sm:data-starting-style:-translate-x-4 max-sm:data-ending-style:-translate-x-4`,
|
|
1473
|
+
`sm:translate-x-[calc(2.5rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1474
|
+
],
|
|
1475
|
+
rightSlide: [
|
|
1476
|
+
`[transition-property:opacity,transform,translate,scale] [will-change:opacity,transform,translate,scale]`,
|
|
1477
|
+
`data-starting-style:opacity-0 data-ending-style:opacity-0 data-starting-style:translate-x-[20px] data-ending-style:translate-x-[20px] max-sm:data-starting-style:translate-x-4 max-sm:data-ending-style:translate-x-4`,
|
|
1478
|
+
`sm:-translate-x-[calc(2.5rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1479
|
+
],
|
|
1480
|
+
wipe: [
|
|
1481
|
+
`[transition-property:clip-path,translate,scale] [will-change:clip-path,translate,scale] [clip-path:inset(0_0_0_0_round_12px)] [-webkit-clip-path:inset(0_0_0_0_round_12px)]`,
|
|
1482
|
+
`data-starting-style:[clip-path:inset(0_0_100%_0_round_12px)] data-ending-style:[clip-path:inset(0_0_100%_0_round_12px)]`,
|
|
1483
|
+
`sm:-translate-y-[calc(2rem*var(--nested-dialogs))] sm:scale-[calc(1-0.1*var(--nested-dialogs))]`
|
|
1484
|
+
]
|
|
1485
|
+
};
|
|
1486
|
+
const cssTransitionPresets$1 = {
|
|
1487
|
+
inExpo: `duration-[0.35s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
1488
|
+
outExpo: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
1489
|
+
inOutExpo: `duration-[0.35s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
1490
|
+
anticipate: `duration-[0.35s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
1491
|
+
quickOut: `duration-[0.35s] ease-out`,
|
|
1492
|
+
overshootOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
1493
|
+
swiftOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
1494
|
+
snappyOut: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
1495
|
+
in: `duration-[0.35s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
1496
|
+
out: `duration-[0.35s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
1497
|
+
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
1498
|
+
outIn: `duration-[0.35s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
1499
|
+
inQuad: `duration-[0.35s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
1500
|
+
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
1501
|
+
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
1502
|
+
inCubic: `duration-[0.35s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
1503
|
+
outCubic: `duration-[0.35s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
1504
|
+
inOutCubic: `duration-[0.35s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
1505
|
+
inQuart: `duration-[0.35s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
1506
|
+
outQuart: `duration-[0.35s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
1507
|
+
inOutQuart: `duration-[0.35s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
1508
|
+
inQuint: `duration-[0.35s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
1509
|
+
outQuint: `duration-[0.35s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
1510
|
+
inOutQuint: `duration-[0.35s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
1511
|
+
inCirc: `duration-[0.35s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
1512
|
+
outCirc: `duration-[0.35s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
1513
|
+
inOutCirc: `duration-[0.35s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
1514
|
+
inOutBase: `duration-[0.35s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`
|
|
1515
|
+
};
|
|
1516
|
+
const DialogContext = createContext(void 0);
|
|
1517
|
+
function useDialog() {
|
|
1518
|
+
const context = useContext(DialogContext);
|
|
1519
|
+
if (!context) throw new Error("useDialog must be used within a DialogProvider");
|
|
1520
|
+
return context;
|
|
1521
|
+
}
|
|
1522
|
+
function Dialog$1({ modal = true, ...props }) {
|
|
1523
|
+
return /* @__PURE__ */ jsx(DialogContext.Provider, {
|
|
1524
|
+
value: { modal },
|
|
1525
|
+
children: /* @__PURE__ */ jsx(Dialog.Root, {
|
|
1526
|
+
"data-slot": "dialog",
|
|
1527
|
+
modal,
|
|
1528
|
+
...props
|
|
1529
|
+
})
|
|
1530
|
+
});
|
|
1531
|
+
}
|
|
1532
|
+
function DialogTrigger({ ...props }) {
|
|
1533
|
+
return /* @__PURE__ */ jsx(Dialog.Trigger, {
|
|
1534
|
+
"data-slot": "dialog-trigger",
|
|
1535
|
+
...props
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
function DialogPortal(props) {
|
|
1539
|
+
return /* @__PURE__ */ jsx(Dialog.Portal, {
|
|
1540
|
+
"data-slot": "dialog-portal",
|
|
1541
|
+
...props
|
|
1542
|
+
});
|
|
1543
|
+
}
|
|
1544
|
+
function DialogBackdrop({ className, ...props }) {
|
|
1545
|
+
return /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
1546
|
+
"data-slot": "dialog-backdrop",
|
|
1547
|
+
render: /* @__PURE__ */ jsx("div", { className: cn("fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-all duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-[-webkit-touch-callout:none]:absolute", className) }, "dialog-backdrop"),
|
|
1548
|
+
...props
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
function DialogPopup({ className, animationPreset = "scale", transitionPreset = "outCubic", children, reduceMotion = false, showCloseButton = true, ...rest }) {
|
|
1552
|
+
const { modal } = useDialog();
|
|
1553
|
+
const cssAnimationConfig = useMemo(() => {
|
|
1554
|
+
if (reduceMotion) return "none";
|
|
1555
|
+
if (animationPreset) return cssAnimationPresets$1[animationPreset];
|
|
1556
|
+
return cssAnimationPresets$1.scale;
|
|
1557
|
+
}, [animationPreset, reduceMotion]);
|
|
1558
|
+
const cssTransitionConfig = useMemo(() => {
|
|
1559
|
+
if (reduceMotion) return "none";
|
|
1560
|
+
if (transitionPreset) return cssTransitionPresets$1[transitionPreset];
|
|
1561
|
+
return cssTransitionPresets$1.snappyOut;
|
|
1562
|
+
}, [transitionPreset, reduceMotion]);
|
|
1563
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [modal && /* @__PURE__ */ jsx(DialogBackdrop, {}), /* @__PURE__ */ jsx("div", {
|
|
1564
|
+
className: "fixed inset-0 top-1/2 left-1/2 z-50 h-max w-full -translate-x-1/2 -translate-y-1/2 transform",
|
|
1565
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1566
|
+
className: "flex flex-col items-center overflow-hidden p-4 sm:overflow-y-auto",
|
|
1567
|
+
children: /* @__PURE__ */ jsx(Dialog.Popup, {
|
|
1568
|
+
"data-slot": "dialog-popup",
|
|
1569
|
+
render: /* @__PURE__ */ jsxs("div", {
|
|
1570
|
+
className: cn("bg-popover text-popover-foreground border-border relative row-start-2 grid max-h-[calc(100vh-2rem)] w-full min-w-0 gap-4 rounded-2xl border p-6 shadow-lg max-sm:overflow-y-auto", cssTransitionConfig, cssAnimationConfig, className),
|
|
1571
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsxs(Dialog.Close, {
|
|
1572
|
+
"data-slot": "dialog-close",
|
|
1573
|
+
className: "ring-offset-background focus:ring-ring data-open:bg-accent data-open:text-muted-foreground absolute top-4 right-4 rounded-full opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1574
|
+
children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
1575
|
+
className: "sr-only",
|
|
1576
|
+
children: "Close"
|
|
1577
|
+
})]
|
|
1578
|
+
})]
|
|
1579
|
+
}, "dialog-popup"),
|
|
1580
|
+
...rest
|
|
1581
|
+
})
|
|
1582
|
+
})
|
|
1583
|
+
})] });
|
|
1584
|
+
}
|
|
1585
|
+
function DialogHeader({ className, ...props }) {
|
|
1586
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1587
|
+
"data-slot": "dialog-header",
|
|
1588
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
1589
|
+
...props
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
function DialogFooter({ className, ...props }) {
|
|
1593
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1594
|
+
"data-slot": "dialog-footer",
|
|
1595
|
+
className: cn("sm:border-border/60 sm:bg-muted/50 flex flex-col-reverse gap-2 sm:-mx-6 sm:mt-2 sm:-mb-6 sm:flex-row sm:justify-end sm:rounded-b-xl sm:border-t sm:px-6 sm:py-4", className),
|
|
1596
|
+
...props
|
|
1597
|
+
});
|
|
1598
|
+
}
|
|
1599
|
+
function DialogTitle({ className, ...props }) {
|
|
1600
|
+
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
1601
|
+
"data-slot": "dialog-title",
|
|
1602
|
+
className: cn("text-lg leading-none font-semibold", className),
|
|
1603
|
+
...props
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
//#endregion
|
|
1608
|
+
//#region src/components/ui/table.tsx
|
|
1609
|
+
function Table({ className, ...props }) {
|
|
1610
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1611
|
+
"data-slot": "table-container",
|
|
1612
|
+
className: "relative w-full overflow-x-auto",
|
|
1613
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
1614
|
+
"data-slot": "table",
|
|
1615
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
1616
|
+
...props
|
|
1617
|
+
})
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
function TableHeader({ className, ...props }) {
|
|
1621
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
1622
|
+
"data-slot": "table-header",
|
|
1623
|
+
className: cn("[&_tr]:border-b", className),
|
|
1624
|
+
...props
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1627
|
+
function TableBody({ className, ...props }) {
|
|
1628
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
1629
|
+
"data-slot": "table-body",
|
|
1630
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
1631
|
+
...props
|
|
1632
|
+
});
|
|
1633
|
+
}
|
|
1634
|
+
function TableRow({ className, ...props }) {
|
|
1635
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
1636
|
+
"data-slot": "table-row",
|
|
1637
|
+
className: cn("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className),
|
|
1638
|
+
...props
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
function TableHead({ className, ...props }) {
|
|
1642
|
+
return /* @__PURE__ */ jsx("th", {
|
|
1643
|
+
"data-slot": "table-head",
|
|
1644
|
+
className: cn("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
1645
|
+
...props
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
function TableCell({ className, ...props }) {
|
|
1649
|
+
return /* @__PURE__ */ jsx("td", {
|
|
1650
|
+
"data-slot": "table-cell",
|
|
1651
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
1652
|
+
...props
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
//#endregion
|
|
1657
|
+
//#region src/components/ui/pagination.tsx
|
|
1658
|
+
function Pagination({ className, ...props }) {
|
|
1659
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
1660
|
+
role: "navigation",
|
|
1661
|
+
"aria-label": "pagination",
|
|
1662
|
+
"data-slot": "pagination",
|
|
1663
|
+
className: cn("cn-pagination mx-auto flex w-full justify-center", className),
|
|
1664
|
+
...props
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
function PaginationContent({ className, ...props }) {
|
|
1668
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
1669
|
+
"data-slot": "pagination-content",
|
|
1670
|
+
className: cn("cn-pagination-content bg-background divide-border border-border flex items-center divide-x overflow-hidden rounded-md border", className),
|
|
1671
|
+
...props
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
function PaginationItem({ ...props }) {
|
|
1675
|
+
return /* @__PURE__ */ jsx("li", {
|
|
1676
|
+
"data-slot": "pagination-item",
|
|
1677
|
+
className: "h-full",
|
|
1678
|
+
...props
|
|
1679
|
+
});
|
|
1680
|
+
}
|
|
1681
|
+
function PaginationLink({ className, isActive, size = "icon", ...props }) {
|
|
1682
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
1683
|
+
variant: "ghost",
|
|
1684
|
+
size,
|
|
1685
|
+
className: cn("cn-pagination-link hover:bg-muted rounded-none", isActive && "text-primary-500", className),
|
|
1686
|
+
nativeButton: false,
|
|
1687
|
+
render: /* @__PURE__ */ jsx("a", {
|
|
1688
|
+
"aria-current": isActive ? "page" : void 0,
|
|
1689
|
+
"data-slot": "pagination-link",
|
|
1690
|
+
"data-active": isActive,
|
|
1691
|
+
...props
|
|
1692
|
+
})
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1695
|
+
function PaginationPrevious({ className, ...props }) {
|
|
1696
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
1697
|
+
"aria-label": "Go to previous page",
|
|
1698
|
+
size: "default",
|
|
1699
|
+
className: cn("cn-pagination-previous", className),
|
|
1700
|
+
...props,
|
|
1701
|
+
children: [/* @__PURE__ */ jsx(ChevronLeftIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
1702
|
+
className: "cn-pagination-previous-text hidden",
|
|
1703
|
+
children: "Previous"
|
|
1704
|
+
})]
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
function PaginationNext({ className, ...props }) {
|
|
1708
|
+
return /* @__PURE__ */ jsxs(PaginationLink, {
|
|
1709
|
+
"aria-label": "Go to next page",
|
|
1710
|
+
size: "default",
|
|
1711
|
+
className: cn("cn-pagination-next", className),
|
|
1712
|
+
...props,
|
|
1713
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1714
|
+
className: "cn-pagination-next-text hidden",
|
|
1715
|
+
children: "Next"
|
|
1716
|
+
}), /* @__PURE__ */ jsx(ChevronRightIcon, {})]
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
1720
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
1721
|
+
"aria-hidden": true,
|
|
1722
|
+
"data-slot": "pagination-ellipsis",
|
|
1723
|
+
className: cn("cn-pagination-ellipsis flex h-full w-auto items-end justify-center px-2 py-1.5", className),
|
|
1724
|
+
...props,
|
|
1725
|
+
children: [/* @__PURE__ */ jsx(MoreHorizontalIcon, { className: "size-4" }), /* @__PURE__ */ jsx("span", {
|
|
1726
|
+
className: "sr-only",
|
|
1727
|
+
children: "More pages"
|
|
1728
|
+
})]
|
|
1729
|
+
});
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
//#endregion
|
|
1733
|
+
//#region src/components/Pagination/index.tsx
|
|
1734
|
+
const TablePagination = ({ currentPage, totalPages, totalItems, itemsPerPage, onPageChange, onItemsPerPageChange, pageSizeOptions = [
|
|
1735
|
+
5,
|
|
1736
|
+
10,
|
|
1737
|
+
20,
|
|
1738
|
+
50,
|
|
1739
|
+
100
|
|
1740
|
+
], maxVisiblePages = 4, showInfo = true, showPageSizeSelect = true, className }) => {
|
|
1741
|
+
const handleItemsPerPageChange = useCallback((value) => {
|
|
1742
|
+
onItemsPerPageChange(Number(value));
|
|
1743
|
+
}, [onItemsPerPageChange]);
|
|
1744
|
+
const renderPaginationItems = useCallback(() => {
|
|
1745
|
+
const items = [];
|
|
1746
|
+
let startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages / 2));
|
|
1747
|
+
let endPage = Math.min(totalPages, startPage + maxVisiblePages - 1);
|
|
1748
|
+
if (endPage - startPage + 1 < maxVisiblePages) startPage = Math.max(1, endPage - maxVisiblePages + 1);
|
|
1749
|
+
if (startPage > 1) {
|
|
1750
|
+
items.push(/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, {
|
|
1751
|
+
size: "icon",
|
|
1752
|
+
onClick: (e) => {
|
|
1753
|
+
e.preventDefault();
|
|
1754
|
+
onPageChange(1);
|
|
1755
|
+
},
|
|
1756
|
+
children: "1"
|
|
1757
|
+
}) }, "1"));
|
|
1758
|
+
if (startPage > 2) items.push(/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }, "ellipsis-start"));
|
|
1759
|
+
}
|
|
1760
|
+
for (let i = startPage; i <= endPage; i++) items.push(/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, {
|
|
1761
|
+
size: "icon",
|
|
1762
|
+
isActive: currentPage === i,
|
|
1763
|
+
onClick: (e) => {
|
|
1764
|
+
e.preventDefault();
|
|
1765
|
+
onPageChange(i);
|
|
1766
|
+
},
|
|
1767
|
+
children: i
|
|
1768
|
+
}) }, i));
|
|
1769
|
+
if (endPage < totalPages) {
|
|
1770
|
+
if (endPage < totalPages - 1) items.push(/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationEllipsis, {}) }, "ellipsis-end"));
|
|
1771
|
+
items.push(/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationLink, {
|
|
1772
|
+
size: "icon",
|
|
1773
|
+
onClick: (e) => {
|
|
1774
|
+
e.preventDefault();
|
|
1775
|
+
onPageChange(totalPages);
|
|
1776
|
+
},
|
|
1777
|
+
children: totalPages
|
|
1778
|
+
}) }, totalPages));
|
|
1779
|
+
}
|
|
1780
|
+
return items;
|
|
1781
|
+
}, [
|
|
1782
|
+
currentPage,
|
|
1783
|
+
totalPages,
|
|
1784
|
+
maxVisiblePages,
|
|
1785
|
+
onPageChange
|
|
1786
|
+
]);
|
|
1787
|
+
const startItem = totalItems === 0 ? 0 : (currentPage - 1) * itemsPerPage + 1;
|
|
1788
|
+
const endItem = Math.min(currentPage * itemsPerPage, totalItems);
|
|
1789
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1790
|
+
className: cn("grid grid-cols-[1fr_auto_1fr] items-center gap-x-4", className),
|
|
1791
|
+
children: [
|
|
1792
|
+
showInfo && /* @__PURE__ */ jsx("div", {
|
|
1793
|
+
className: "justify-self-start",
|
|
1794
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1795
|
+
className: "text-muted-foreground text-sm",
|
|
1796
|
+
children: [
|
|
1797
|
+
"Showing ",
|
|
1798
|
+
startItem,
|
|
1799
|
+
" to ",
|
|
1800
|
+
endItem,
|
|
1801
|
+
" of ",
|
|
1802
|
+
totalItems,
|
|
1803
|
+
" results"
|
|
1804
|
+
]
|
|
1805
|
+
})
|
|
1806
|
+
}),
|
|
1807
|
+
showPageSizeSelect && /* @__PURE__ */ jsxs("div", {
|
|
1808
|
+
className: "flex items-center gap-2 justify-self-center",
|
|
1809
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1810
|
+
className: "text-muted-foreground text-sm",
|
|
1811
|
+
children: "Per page"
|
|
1812
|
+
}), /* @__PURE__ */ jsxs(Select$2, {
|
|
1813
|
+
value: itemsPerPage.toString(),
|
|
1814
|
+
onValueChange: handleItemsPerPageChange,
|
|
1815
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
1816
|
+
className: "h-8 w-fit",
|
|
1817
|
+
children: [/* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" }) })]
|
|
1818
|
+
}), /* @__PURE__ */ jsx(SelectPopup, { children: /* @__PURE__ */ jsx(SelectList, { children: pageSizeOptions.map((size) => /* @__PURE__ */ jsx(SelectItem, {
|
|
1819
|
+
value: size.toString(),
|
|
1820
|
+
children: /* @__PURE__ */ jsx(SelectItemText, { children: size })
|
|
1821
|
+
}, size)) }) })]
|
|
1822
|
+
})]
|
|
1823
|
+
}),
|
|
1824
|
+
totalPages > 1 && /* @__PURE__ */ jsx("div", {
|
|
1825
|
+
className: "justify-self-end",
|
|
1826
|
+
children: /* @__PURE__ */ jsx(Pagination, { children: /* @__PURE__ */ jsxs(PaginationContent, { children: [
|
|
1827
|
+
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationPrevious, {
|
|
1828
|
+
size: "default",
|
|
1829
|
+
onClick: (e) => {
|
|
1830
|
+
e.preventDefault();
|
|
1831
|
+
if (currentPage > 1) onPageChange(currentPage - 1);
|
|
1832
|
+
},
|
|
1833
|
+
"aria-disabled": currentPage === 1,
|
|
1834
|
+
className: cn(currentPage === 1 && "pointer-events-none opacity-50")
|
|
1835
|
+
}) }),
|
|
1836
|
+
renderPaginationItems(),
|
|
1837
|
+
/* @__PURE__ */ jsx(PaginationItem, { children: /* @__PURE__ */ jsx(PaginationNext, {
|
|
1838
|
+
size: "default",
|
|
1839
|
+
onClick: (e) => {
|
|
1840
|
+
e.preventDefault();
|
|
1841
|
+
if (currentPage < totalPages) onPageChange(currentPage + 1);
|
|
1842
|
+
},
|
|
1843
|
+
"aria-disabled": currentPage === totalPages,
|
|
1844
|
+
className: cn(currentPage === totalPages && "pointer-events-none opacity-50")
|
|
1845
|
+
}) })
|
|
1846
|
+
] }) })
|
|
1847
|
+
})
|
|
1848
|
+
]
|
|
1849
|
+
});
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
//#endregion
|
|
1853
|
+
//#region src/components/ui/input-group.tsx
|
|
1854
|
+
function InputGroup({ className, ...props }) {
|
|
1855
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1856
|
+
"data-slot": "input-group",
|
|
1857
|
+
role: "group",
|
|
1858
|
+
className: cn("group/input-group iteems-center border-border bg-background dark:bg-input/32 relative inline-flex min-w-0 rounded-lg border text-base/5 shadow-xs outline-none", "[transition:box-shadow_150ms_ease-out]", "has-[>[data-align=inline-start]]:[&>input]:pl-2", "has-[>[data-align=inline-end]]:[&>input]:pr-2", "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3", "has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:h-auto has-[>[data-align=block-end]]:[&>textarea]:pt-3", "has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[1px]", "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40", className),
|
|
1859
|
+
...props
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
const inputGroupAddonVariants = tv({
|
|
1863
|
+
base: `flex h-auto cursor-text text-muted-foreground items-center justify-center text-sm gap-2 py-1.5 font-medium select-none not-has-[button]:**:[svg]:opacity-72 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4 group-data-[disabled=true]/input-group:opacity-50`,
|
|
1864
|
+
variants: { align: {
|
|
1865
|
+
"inline-start": "order-first ps-[calc(--spacing(3)-1px)] has-[>[data-slot=badge]]:-ms-1.5 has-[>button]:-ms-2 has-[>kbd]:ms-[-0.35rem] [[data-size=sm]+&]:ps-[calc(--spacing(2.5)-1px)]",
|
|
1866
|
+
"inline-end": "order-last pe-[calc(--spacing(3)-1px)] has-[>[data-slot=badge]]:-me-1.5 has-[>button]:-me-2 has-[>kbd]:me-[-0.35rem] [[data-size=sm]+&]:pe-[calc(--spacing(2.5)-1px)]",
|
|
1867
|
+
"block-start": "order-first w-full justify-start px-[calc(--spacing(3)-1px)] pt-[calc(--spacing(3)-1px)] [.border-b]:pb-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
|
|
1868
|
+
"block-end": "order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]"
|
|
1869
|
+
} },
|
|
1870
|
+
defaultVariants: { align: "inline-start" }
|
|
1871
|
+
});
|
|
1872
|
+
function InputGroupAddon({ className, align = "inline-start", ...props }) {
|
|
1873
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1874
|
+
"data-slot": "input-group-addon",
|
|
1875
|
+
"data-align": align,
|
|
1876
|
+
className: cn(inputGroupAddonVariants({ align }), className),
|
|
1877
|
+
onMouseDown: (e) => {
|
|
1878
|
+
if (e.target.closest("button, a")) return;
|
|
1879
|
+
e.preventDefault();
|
|
1880
|
+
const parent = e.currentTarget.parentElement;
|
|
1881
|
+
const input = parent?.querySelector("input, textarea");
|
|
1882
|
+
if (input && !parent?.querySelector("input:focus, textarea:focus")) input.focus();
|
|
1883
|
+
},
|
|
1884
|
+
...props
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
const inputGroupButtonVariants = tv({
|
|
1888
|
+
base: "text-sm shadow-none flex gap-2 items-center",
|
|
1889
|
+
variants: { size: {
|
|
1890
|
+
xs: "h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",
|
|
1891
|
+
sm: "h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5",
|
|
1892
|
+
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
1893
|
+
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
1894
|
+
} },
|
|
1895
|
+
defaultVariants: { size: "xs" }
|
|
1896
|
+
});
|
|
1897
|
+
function InputGroupInput({ className, ...props }) {
|
|
1898
|
+
return /* @__PURE__ */ jsx(Input$2, {
|
|
1899
|
+
"data-slot": "input-group-control",
|
|
1900
|
+
className: cn("flex-1 rounded-none border-0 bg-transparent shadow-none focus-visible:border-0 focus-visible:ring-0 dark:bg-transparent", className),
|
|
1901
|
+
...props
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
//#endregion
|
|
1906
|
+
//#region src/components/MediaPicker/index.tsx
|
|
1907
|
+
const getEditorConfig = () => {
|
|
1908
|
+
const editorEl = document.getElementById("editor");
|
|
1909
|
+
return {
|
|
1910
|
+
mediasUrl: editorEl?.dataset.mediasUrl || "/admin/pages/puck/medias",
|
|
1911
|
+
uploadUrl: editorEl?.dataset.uploadUrl || "/admin/pages/puck/medias/upload",
|
|
1912
|
+
langId: editorEl?.dataset.langId || ""
|
|
1913
|
+
};
|
|
1914
|
+
};
|
|
1915
|
+
const fetchMedias = async ({ query, filters, page = 1, limit = 10 }) => {
|
|
1916
|
+
const { mediasUrl, langId } = getEditorConfig();
|
|
1917
|
+
const params = new URLSearchParams();
|
|
1918
|
+
if (query) params.append("search", query);
|
|
1919
|
+
if (langId) params.append("lang_id", langId);
|
|
1920
|
+
params.append("page", page.toString());
|
|
1921
|
+
params.append("limit", limit.toString());
|
|
1922
|
+
if (filters) Object.entries(filters).forEach(([key, value]) => {
|
|
1923
|
+
params.append(key, value);
|
|
1924
|
+
});
|
|
1925
|
+
const data = await (await fetch(`${mediasUrl}?${params.toString()}`, { credentials: "same-origin" })).json();
|
|
1926
|
+
if (data.success && data.medias) return {
|
|
1927
|
+
items: data.medias,
|
|
1928
|
+
total: data.total || data.medias.length
|
|
1929
|
+
};
|
|
1930
|
+
return {
|
|
1931
|
+
items: [],
|
|
1932
|
+
total: 0
|
|
1933
|
+
};
|
|
1934
|
+
};
|
|
1935
|
+
const MediaUploadZone = ({ onUploadSuccess }) => {
|
|
1936
|
+
const [uploading, setUploading] = useState(false);
|
|
1937
|
+
const [uploadProgress, setUploadProgress] = useState(0);
|
|
1938
|
+
const [dragActive, setDragActive] = useState(false);
|
|
1939
|
+
const handleUpload = useCallback(async (file) => {
|
|
1940
|
+
setUploading(true);
|
|
1941
|
+
setUploadProgress(0);
|
|
1942
|
+
try {
|
|
1943
|
+
const { uploadUrl, langId } = getEditorConfig();
|
|
1944
|
+
const csrfToken = document.querySelector("meta[name=\"csrf-token\"]");
|
|
1945
|
+
const formData = new FormData();
|
|
1946
|
+
formData.append("file", file);
|
|
1947
|
+
if (langId) formData.append("lang_id", langId);
|
|
1948
|
+
const xhr = new XMLHttpRequest();
|
|
1949
|
+
xhr.upload.addEventListener("progress", (e) => {
|
|
1950
|
+
if (e.lengthComputable) setUploadProgress(e.loaded / e.total * 100);
|
|
1951
|
+
});
|
|
1952
|
+
xhr.addEventListener("load", () => {
|
|
1953
|
+
if (xhr.status === 200) {
|
|
1954
|
+
const response = JSON.parse(xhr.responseText);
|
|
1955
|
+
if (response.success && response.media) onUploadSuccess?.(response.media);
|
|
1956
|
+
} else alert("Error during upload");
|
|
1957
|
+
setUploading(false);
|
|
1958
|
+
setUploadProgress(0);
|
|
1959
|
+
});
|
|
1960
|
+
xhr.addEventListener("error", () => {
|
|
1961
|
+
alert("Error during upload");
|
|
1962
|
+
setUploading(false);
|
|
1963
|
+
setUploadProgress(0);
|
|
1964
|
+
});
|
|
1965
|
+
xhr.open("POST", uploadUrl);
|
|
1966
|
+
if (csrfToken) xhr.setRequestHeader("X-CSRF-TOKEN", csrfToken.content);
|
|
1967
|
+
xhr.send(formData);
|
|
1968
|
+
} catch (error) {
|
|
1969
|
+
console.error("Error during upload:", error);
|
|
1970
|
+
alert("Error during upload");
|
|
1971
|
+
setUploading(false);
|
|
1972
|
+
setUploadProgress(0);
|
|
1973
|
+
}
|
|
1974
|
+
}, [onUploadSuccess]);
|
|
1975
|
+
const handleDrag = useCallback((e) => {
|
|
1976
|
+
e.preventDefault();
|
|
1977
|
+
e.stopPropagation();
|
|
1978
|
+
if (e.type === "dragenter" || e.type === "dragover") setDragActive(true);
|
|
1979
|
+
else if (e.type === "dragleave") setDragActive(false);
|
|
1980
|
+
}, []);
|
|
1981
|
+
const handleDrop = useCallback((e) => {
|
|
1982
|
+
e.preventDefault();
|
|
1983
|
+
e.stopPropagation();
|
|
1984
|
+
setDragActive(false);
|
|
1985
|
+
if (e.dataTransfer.files?.[0]) handleUpload(e.dataTransfer.files[0]);
|
|
1986
|
+
}, [handleUpload]);
|
|
1987
|
+
const handleFileInput = useCallback((e) => {
|
|
1988
|
+
if (e.target.files?.[0]) handleUpload(e.target.files[0]);
|
|
1989
|
+
}, [handleUpload]);
|
|
1990
|
+
const handleClick = useCallback(() => {
|
|
1991
|
+
if (!uploading) document.getElementById("media-upload-input")?.click();
|
|
1992
|
+
}, [uploading]);
|
|
1993
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1994
|
+
className: "w-full",
|
|
1995
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1996
|
+
onDragEnter: handleDrag,
|
|
1997
|
+
onDragLeave: handleDrag,
|
|
1998
|
+
onDragOver: handleDrag,
|
|
1999
|
+
onDrop: handleDrop,
|
|
2000
|
+
className: cn("border-border hover:border-primary/50 flex cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed bg-white p-6 transition-colors", dragActive && "border-primary bg-primary/5", uploading && "pointer-events-none opacity-60"),
|
|
2001
|
+
onClick: handleClick,
|
|
2002
|
+
children: uploading ? /* @__PURE__ */ jsxs("div", {
|
|
2003
|
+
className: "flex flex-col items-center gap-2",
|
|
2004
|
+
children: [
|
|
2005
|
+
/* @__PURE__ */ jsx(Loader2Icon, { className: "text-primary size-6 animate-spin" }),
|
|
2006
|
+
/* @__PURE__ */ jsx("div", {
|
|
2007
|
+
className: "text-sm font-medium",
|
|
2008
|
+
children: "Uploading..."
|
|
2009
|
+
}),
|
|
2010
|
+
/* @__PURE__ */ jsx("div", {
|
|
2011
|
+
className: "bg-muted h-1.5 w-full overflow-hidden rounded-full",
|
|
2012
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
2013
|
+
className: "bg-primary h-full transition-all duration-300",
|
|
2014
|
+
style: { width: `${uploadProgress}%` }
|
|
2015
|
+
})
|
|
2016
|
+
}),
|
|
2017
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2018
|
+
className: "text-muted-foreground text-xs",
|
|
2019
|
+
children: [Math.round(uploadProgress), "%"]
|
|
2020
|
+
})
|
|
2021
|
+
]
|
|
2022
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
2023
|
+
className: "flex flex-col items-center gap-2",
|
|
2024
|
+
children: [
|
|
2025
|
+
/* @__PURE__ */ jsx(UploadIcon, { className: "text-muted-foreground size-8" }),
|
|
2026
|
+
/* @__PURE__ */ jsx("div", {
|
|
2027
|
+
className: "text-sm font-medium",
|
|
2028
|
+
children: "Drop files or click to upload"
|
|
2029
|
+
}),
|
|
2030
|
+
/* @__PURE__ */ jsx("div", {
|
|
2031
|
+
className: "text-muted-foreground text-xs",
|
|
2032
|
+
children: "PNG, JPG, GIF, WebP up to 10MB"
|
|
2033
|
+
})
|
|
2034
|
+
]
|
|
2035
|
+
})
|
|
2036
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
2037
|
+
id: "media-upload-input",
|
|
2038
|
+
type: "file",
|
|
2039
|
+
accept: "image/*",
|
|
2040
|
+
onChange: handleFileInput,
|
|
2041
|
+
className: "hidden",
|
|
2042
|
+
disabled: uploading
|
|
2043
|
+
})]
|
|
2044
|
+
});
|
|
2045
|
+
};
|
|
2046
|
+
const SOURCE_TYPE_OPTIONS = [{
|
|
2047
|
+
label: "Medias",
|
|
2048
|
+
value: "media"
|
|
2049
|
+
}, {
|
|
2050
|
+
label: "URL",
|
|
2051
|
+
value: "url"
|
|
2052
|
+
}];
|
|
2053
|
+
const DEFAULT_VALUE = {
|
|
2054
|
+
type: "media",
|
|
2055
|
+
media: null
|
|
2056
|
+
};
|
|
2057
|
+
const UrlField = ({ value, onChange }) => {
|
|
2058
|
+
return /* @__PURE__ */ jsx(Input$2, {
|
|
2059
|
+
type: "text",
|
|
2060
|
+
value,
|
|
2061
|
+
onChange: useCallback((e) => {
|
|
2062
|
+
onChange(e.target.value);
|
|
2063
|
+
}, [onChange]),
|
|
2064
|
+
placeholder: "https://example.com/image.jpg"
|
|
2065
|
+
});
|
|
2066
|
+
};
|
|
2067
|
+
const MediaLibraryModal = ({ value, onChange, mediaType, open, onOpenChange }) => {
|
|
2068
|
+
const [medias, setMedias] = useState([]);
|
|
2069
|
+
const [loading, setLoading] = useState(false);
|
|
2070
|
+
const [selectedMedia, setSelectedMedia] = useState(value);
|
|
2071
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
2072
|
+
const [totalPages, setTotalPages] = useState(1);
|
|
2073
|
+
const [totalItems, setTotalItems] = useState(0);
|
|
2074
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
2075
|
+
const [itemsPerPage, setItemsPerPage] = useState(10);
|
|
2076
|
+
const loadMedias = useCallback(async (page, limit, query) => {
|
|
2077
|
+
setLoading(true);
|
|
2078
|
+
try {
|
|
2079
|
+
const result = await fetchMedias({
|
|
2080
|
+
page,
|
|
2081
|
+
limit,
|
|
2082
|
+
query,
|
|
2083
|
+
filters: mediaType ? { type: mediaType } : void 0
|
|
2084
|
+
});
|
|
2085
|
+
setMedias(result.items);
|
|
2086
|
+
setTotalItems(result.total);
|
|
2087
|
+
setTotalPages(Math.ceil(result.total / limit));
|
|
2088
|
+
} catch (error) {
|
|
2089
|
+
console.error("Error loading medias:", error);
|
|
2090
|
+
} finally {
|
|
2091
|
+
setLoading(false);
|
|
2092
|
+
}
|
|
2093
|
+
}, [mediaType]);
|
|
2094
|
+
useEffect(() => {
|
|
2095
|
+
if (open) loadMedias(currentPage, itemsPerPage, searchQuery);
|
|
2096
|
+
}, [
|
|
2097
|
+
open,
|
|
2098
|
+
currentPage,
|
|
2099
|
+
itemsPerPage,
|
|
2100
|
+
loadMedias,
|
|
2101
|
+
searchQuery
|
|
2102
|
+
]);
|
|
2103
|
+
const handleSearch = useCallback((query) => {
|
|
2104
|
+
setSearchQuery(query);
|
|
2105
|
+
setCurrentPage(1);
|
|
2106
|
+
}, []);
|
|
2107
|
+
const handleItemsPerPageChange = useCallback((newLimit) => {
|
|
2108
|
+
setItemsPerPage(newLimit);
|
|
2109
|
+
setCurrentPage(1);
|
|
2110
|
+
}, []);
|
|
2111
|
+
const handleMediaSelectAndConfirm = useCallback((media) => {
|
|
2112
|
+
setSelectedMedia(media);
|
|
2113
|
+
onChange(media);
|
|
2114
|
+
onOpenChange(false);
|
|
2115
|
+
}, [onChange, onOpenChange]);
|
|
2116
|
+
const handleUploadSuccess = useCallback(async (media) => {
|
|
2117
|
+
await loadMedias(1, itemsPerPage);
|
|
2118
|
+
setCurrentPage(1);
|
|
2119
|
+
setSelectedMedia(media);
|
|
2120
|
+
}, [loadMedias, itemsPerPage]);
|
|
2121
|
+
return /* @__PURE__ */ jsxs(DialogPopup, {
|
|
2122
|
+
className: "max-w-4xl",
|
|
2123
|
+
children: [
|
|
2124
|
+
/* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Select Media" }) }),
|
|
2125
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2126
|
+
className: "flex flex-col gap-4",
|
|
2127
|
+
children: [/* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(InputGroupInput, {
|
|
2128
|
+
placeholder: "Search...",
|
|
2129
|
+
value: searchQuery,
|
|
2130
|
+
onChange: (e) => handleSearch(e.target.value)
|
|
2131
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(SearchIcon, { className: "size-4" }) })] }), loading ? /* @__PURE__ */ jsx("div", {
|
|
2132
|
+
className: "flex items-center justify-center py-12",
|
|
2133
|
+
children: /* @__PURE__ */ jsx(Loader2Icon, { className: "text-muted-foreground size-8 animate-spin" })
|
|
2134
|
+
}) : medias.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
2135
|
+
className: "border-border overflow-hidden rounded-lg border",
|
|
2136
|
+
children: /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
|
|
2137
|
+
/* @__PURE__ */ jsx(TableHead, {
|
|
2138
|
+
className: "w-20",
|
|
2139
|
+
children: "Preview"
|
|
2140
|
+
}),
|
|
2141
|
+
/* @__PURE__ */ jsx(TableHead, { children: "Name" }),
|
|
2142
|
+
/* @__PURE__ */ jsx(TableHead, { children: "Type" })
|
|
2143
|
+
] }) }), /* @__PURE__ */ jsx(TableBody, { children: medias.map((media) => /* @__PURE__ */ jsxs(TableRow, {
|
|
2144
|
+
className: cn("hover:bg-muted/50 cursor-pointer transition-colors", selectedMedia?.id === media.id && "bg-primary/5"),
|
|
2145
|
+
onClick: () => handleMediaSelectAndConfirm(media),
|
|
2146
|
+
children: [
|
|
2147
|
+
/* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("img", {
|
|
2148
|
+
src: media.thumbnail,
|
|
2149
|
+
alt: media.name,
|
|
2150
|
+
className: "size-12 rounded object-cover"
|
|
2151
|
+
}) }),
|
|
2152
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
2153
|
+
className: "font-medium",
|
|
2154
|
+
children: media.name
|
|
2155
|
+
}),
|
|
2156
|
+
/* @__PURE__ */ jsx(TableCell, {
|
|
2157
|
+
className: "text-muted-foreground text-sm",
|
|
2158
|
+
children: media.type
|
|
2159
|
+
})
|
|
2160
|
+
]
|
|
2161
|
+
}, media.id)) })] })
|
|
2162
|
+
}), /* @__PURE__ */ jsx(TablePagination, {
|
|
2163
|
+
currentPage,
|
|
2164
|
+
totalPages,
|
|
2165
|
+
totalItems,
|
|
2166
|
+
itemsPerPage,
|
|
2167
|
+
onPageChange: setCurrentPage,
|
|
2168
|
+
onItemsPerPageChange: handleItemsPerPageChange,
|
|
2169
|
+
pageSizeOptions: [
|
|
2170
|
+
5,
|
|
2171
|
+
10,
|
|
2172
|
+
20,
|
|
2173
|
+
50
|
|
2174
|
+
]
|
|
2175
|
+
})] }) : /* @__PURE__ */ jsxs("div", {
|
|
2176
|
+
className: "text-muted-foreground flex flex-col items-center justify-center py-12 text-sm",
|
|
2177
|
+
children: [/* @__PURE__ */ jsx(ImageIcon, { className: "mb-2 size-12 opacity-20" }), /* @__PURE__ */ jsx("p", { children: "No media found" })]
|
|
2178
|
+
})]
|
|
2179
|
+
}),
|
|
2180
|
+
/* @__PURE__ */ jsx(DialogFooter, { children: /* @__PURE__ */ jsx(MediaUploadZone, { onUploadSuccess: handleUploadSuccess }) })
|
|
2181
|
+
]
|
|
2182
|
+
});
|
|
2183
|
+
};
|
|
2184
|
+
const MediaLibraryField = ({ value, onChange, mediaType }) => {
|
|
2185
|
+
const [open, setOpen] = useState(false);
|
|
2186
|
+
const [selectedMedia, setSelectedMedia] = useState(value);
|
|
2187
|
+
useEffect(() => {
|
|
2188
|
+
setSelectedMedia(value);
|
|
2189
|
+
}, [value]);
|
|
2190
|
+
const handleChange = useCallback((media) => {
|
|
2191
|
+
setSelectedMedia(media);
|
|
2192
|
+
onChange(media);
|
|
2193
|
+
}, [onChange]);
|
|
2194
|
+
const handleClear = useCallback(() => {
|
|
2195
|
+
handleChange(null);
|
|
2196
|
+
}, [handleChange]);
|
|
2197
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2198
|
+
className: "flex flex-col gap-3",
|
|
2199
|
+
children: [/* @__PURE__ */ jsxs(Dialog$1, {
|
|
2200
|
+
open,
|
|
2201
|
+
onOpenChange: setOpen,
|
|
2202
|
+
children: [/* @__PURE__ */ jsx(DialogTrigger, { render: /* @__PURE__ */ jsx(Button$1, {
|
|
2203
|
+
variant: "outline",
|
|
2204
|
+
className: "w-full",
|
|
2205
|
+
children: selectedMedia ? "Change Media" : "Select Media"
|
|
2206
|
+
}) }), /* @__PURE__ */ jsx(MediaLibraryModal, {
|
|
2207
|
+
value: selectedMedia,
|
|
2208
|
+
onChange: handleChange,
|
|
2209
|
+
mediaType,
|
|
2210
|
+
open,
|
|
2211
|
+
onOpenChange: setOpen
|
|
2212
|
+
})]
|
|
2213
|
+
}), selectedMedia && /* @__PURE__ */ jsxs("div", {
|
|
2214
|
+
className: "border-border bg-background flex items-center gap-3 rounded-lg border p-3",
|
|
2215
|
+
children: [
|
|
2216
|
+
/* @__PURE__ */ jsx("img", {
|
|
2217
|
+
src: selectedMedia.thumbnail,
|
|
2218
|
+
alt: selectedMedia.name,
|
|
2219
|
+
className: "size-16 rounded object-cover"
|
|
2220
|
+
}),
|
|
2221
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2222
|
+
className: "flex-1",
|
|
2223
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
2224
|
+
className: "text-sm font-medium",
|
|
2225
|
+
children: selectedMedia.name
|
|
2226
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
2227
|
+
className: "text-muted-foreground text-xs",
|
|
2228
|
+
children: selectedMedia.type
|
|
2229
|
+
})]
|
|
2230
|
+
}),
|
|
2231
|
+
/* @__PURE__ */ jsx(Button$1, {
|
|
2232
|
+
variant: "ghost",
|
|
2233
|
+
size: "sm",
|
|
2234
|
+
onClick: handleClear,
|
|
2235
|
+
children: "Clear"
|
|
2236
|
+
})
|
|
2237
|
+
]
|
|
2238
|
+
})]
|
|
2239
|
+
});
|
|
2240
|
+
};
|
|
2241
|
+
const useMediaPicker = (initialValue, onChange) => {
|
|
2242
|
+
const currentValue = initialValue || DEFAULT_VALUE;
|
|
2243
|
+
return {
|
|
2244
|
+
currentValue,
|
|
2245
|
+
selectedType: currentValue.type || "media",
|
|
2246
|
+
handleTypeChange: useCallback((newType) => {
|
|
2247
|
+
onChange({
|
|
2248
|
+
...currentValue,
|
|
2249
|
+
type: newType
|
|
2250
|
+
});
|
|
2251
|
+
}, [currentValue, onChange]),
|
|
2252
|
+
handleUrlChange: useCallback((url) => {
|
|
2253
|
+
onChange({
|
|
2254
|
+
...currentValue,
|
|
2255
|
+
url
|
|
2256
|
+
});
|
|
2257
|
+
}, [currentValue, onChange]),
|
|
2258
|
+
handleMediaChange: useCallback((media) => {
|
|
2259
|
+
onChange({
|
|
2260
|
+
...currentValue,
|
|
2261
|
+
media
|
|
2262
|
+
});
|
|
2263
|
+
}, [currentValue, onChange])
|
|
2264
|
+
};
|
|
2265
|
+
};
|
|
2266
|
+
const MediaPicker = ({ value, onChange, mediaType }) => {
|
|
2267
|
+
const { currentValue, selectedType, handleTypeChange, handleUrlChange, handleMediaChange } = useMediaPicker(value, onChange);
|
|
2268
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2269
|
+
className: "rounded-md border border-dashed border-yellow-500 bg-yellow-500/10 p-3",
|
|
2270
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
2271
|
+
className: "flex flex-col gap-y-3",
|
|
2272
|
+
children: [
|
|
2273
|
+
/* @__PURE__ */ jsx(RadioGroup$1, {
|
|
2274
|
+
value: selectedType,
|
|
2275
|
+
onValueChange: handleTypeChange,
|
|
2276
|
+
className: "border-input flex w-fit flex-wrap divide-x divide-stone-200 overflow-hidden rounded-md border",
|
|
2277
|
+
children: SOURCE_TYPE_OPTIONS.map((option) => /* @__PURE__ */ jsx("label", {
|
|
2278
|
+
className: "flex-1",
|
|
2279
|
+
children: /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
2280
|
+
layout: "horizontal",
|
|
2281
|
+
value: option.value,
|
|
2282
|
+
children: option.label
|
|
2283
|
+
})
|
|
2284
|
+
}, option.value))
|
|
2285
|
+
}),
|
|
2286
|
+
selectedType === "url" && /* @__PURE__ */ jsx(UrlField, {
|
|
2287
|
+
value: currentValue.url || "",
|
|
2288
|
+
onChange: handleUrlChange
|
|
2289
|
+
}),
|
|
2290
|
+
selectedType === "media" && /* @__PURE__ */ jsx(MediaLibraryField, {
|
|
2291
|
+
value: currentValue.media || null,
|
|
2292
|
+
onChange: handleMediaChange,
|
|
2293
|
+
mediaType
|
|
2294
|
+
})
|
|
2295
|
+
]
|
|
2296
|
+
})
|
|
2297
|
+
});
|
|
2298
|
+
};
|
|
2299
|
+
const getMediaUrl = (value) => {
|
|
2300
|
+
if (!value) return void 0;
|
|
2301
|
+
if (value.type === "media" && value.media) return value.media.url;
|
|
2302
|
+
return value.url;
|
|
2303
|
+
};
|
|
2304
|
+
|
|
2305
|
+
//#endregion
|
|
2306
|
+
//#region src/utils/display.tsx
|
|
2307
|
+
const displayField = { display: {
|
|
2308
|
+
type: "select",
|
|
2309
|
+
label: "Display",
|
|
2310
|
+
options: [
|
|
2311
|
+
{
|
|
2312
|
+
label: "None (hidden)",
|
|
2313
|
+
value: "hidden"
|
|
2314
|
+
},
|
|
2315
|
+
{
|
|
2316
|
+
label: "Inline",
|
|
2317
|
+
value: "inline"
|
|
2318
|
+
},
|
|
2319
|
+
{
|
|
2320
|
+
label: "Inline Block",
|
|
2321
|
+
value: "inline-block"
|
|
2322
|
+
},
|
|
2323
|
+
{
|
|
2324
|
+
label: "Block",
|
|
2325
|
+
value: "block"
|
|
2326
|
+
},
|
|
2327
|
+
{
|
|
2328
|
+
label: "Flex",
|
|
2329
|
+
value: "flex"
|
|
2330
|
+
},
|
|
2331
|
+
{
|
|
2332
|
+
label: "Inline Flex",
|
|
2333
|
+
value: "inline-flex"
|
|
2334
|
+
}
|
|
2335
|
+
]
|
|
2336
|
+
} };
|
|
2337
|
+
function displayToClasses(display) {
|
|
2338
|
+
const classes = [];
|
|
2339
|
+
if (display) classes.push(display);
|
|
2340
|
+
return classes.join(" ");
|
|
2341
|
+
}
|
|
2342
|
+
const displayDefaultProps = { display: "block" };
|
|
2343
|
+
|
|
2344
|
+
//#endregion
|
|
2345
|
+
//#region src/utils/fontWeight.tsx
|
|
2346
|
+
const fontWeightField = { fontWeight: {
|
|
2347
|
+
type: "select",
|
|
2348
|
+
label: "Font weight",
|
|
2349
|
+
options: [
|
|
2350
|
+
{
|
|
2351
|
+
label: /* @__PURE__ */ jsx(Minus, { size: 16 }),
|
|
2352
|
+
value: ""
|
|
2353
|
+
},
|
|
2354
|
+
{
|
|
2355
|
+
label: "Thin (100)",
|
|
2356
|
+
value: "thin"
|
|
2357
|
+
},
|
|
2358
|
+
{
|
|
2359
|
+
label: "Extra Light (200)",
|
|
2360
|
+
value: "extralight"
|
|
2361
|
+
},
|
|
2362
|
+
{
|
|
2363
|
+
label: "Light (300)",
|
|
2364
|
+
value: "light"
|
|
2365
|
+
},
|
|
2366
|
+
{
|
|
2367
|
+
label: "Normal (400)",
|
|
2368
|
+
value: "normal"
|
|
2369
|
+
},
|
|
2370
|
+
{
|
|
2371
|
+
label: "Medium (500)",
|
|
2372
|
+
value: "medium"
|
|
2373
|
+
},
|
|
2374
|
+
{
|
|
2375
|
+
label: "Semibold (600)",
|
|
2376
|
+
value: "semibold"
|
|
2377
|
+
},
|
|
2378
|
+
{
|
|
2379
|
+
label: "Bold (700)",
|
|
2380
|
+
value: "bold"
|
|
2381
|
+
},
|
|
2382
|
+
{
|
|
2383
|
+
label: "Extra Bold (800)",
|
|
2384
|
+
value: "extrabold"
|
|
2385
|
+
},
|
|
2386
|
+
{
|
|
2387
|
+
label: "Black (900)",
|
|
2388
|
+
value: "black"
|
|
2389
|
+
}
|
|
2390
|
+
]
|
|
2391
|
+
} };
|
|
2392
|
+
function fontWeightToClasses(fontWeight) {
|
|
2393
|
+
if (!fontWeight) return "";
|
|
2394
|
+
return `font-${fontWeight}`;
|
|
2395
|
+
}
|
|
2396
|
+
const fontWeightDefaultProps = { fontWeight: "" };
|
|
2397
|
+
|
|
2398
|
+
//#endregion
|
|
2399
|
+
//#region src/utils/lineHeight.tsx
|
|
2400
|
+
const lineHeightField = { lineHeight: {
|
|
2401
|
+
type: "select",
|
|
2402
|
+
label: "Line height",
|
|
2403
|
+
options: [
|
|
2404
|
+
{
|
|
2405
|
+
label: /* @__PURE__ */ jsx(MinusIcon, { size: 16 }),
|
|
2406
|
+
value: ""
|
|
2407
|
+
},
|
|
2408
|
+
{
|
|
2409
|
+
label: "1",
|
|
2410
|
+
value: "none"
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
label: "1.25",
|
|
2414
|
+
value: "1.25"
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
label: "1.5",
|
|
2418
|
+
value: "1.5"
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
label: "2",
|
|
2422
|
+
value: "2"
|
|
2423
|
+
}
|
|
2424
|
+
]
|
|
2425
|
+
} };
|
|
2426
|
+
function lineHeightToClasses(lineHeight) {
|
|
2427
|
+
if (!lineHeight) return "";
|
|
2428
|
+
return `leading-[${lineHeight}]`;
|
|
2429
|
+
}
|
|
2430
|
+
const lineHeightDefaultProps = { lineHeight: "" };
|
|
2431
|
+
|
|
2432
|
+
//#endregion
|
|
2433
|
+
//#region src/utils/margins.tsx
|
|
2434
|
+
const MARGIN_UNITS = [
|
|
2435
|
+
{
|
|
2436
|
+
label: "px",
|
|
2437
|
+
value: "px"
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
label: "rem",
|
|
2441
|
+
value: "rem"
|
|
2442
|
+
},
|
|
2443
|
+
{
|
|
2444
|
+
label: "em",
|
|
2445
|
+
value: "em"
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
label: "%",
|
|
2449
|
+
value: "%"
|
|
2450
|
+
},
|
|
2451
|
+
{
|
|
2452
|
+
label: "auto",
|
|
2453
|
+
value: "auto"
|
|
2454
|
+
}
|
|
2455
|
+
];
|
|
2456
|
+
function getMarginSummary(item) {
|
|
2457
|
+
if (!item || !item.direction) return "Margin";
|
|
2458
|
+
return `${item.breakpoint ? `${item.breakpoint.toUpperCase()} - ` : ""}${item.direction === "all" ? "All 4 directions" : item.direction === "x" ? "Horizontal" : item.direction === "y" ? "Vertical" : item.direction.charAt(0).toUpperCase() + item.direction.slice(1)}: ${item.margin?.value || "0"}${item.margin?.unit || "px"}`;
|
|
2459
|
+
}
|
|
2460
|
+
const marginsField = { margins: {
|
|
2461
|
+
type: "array",
|
|
2462
|
+
label: "Margins",
|
|
2463
|
+
arrayFields: {
|
|
2464
|
+
breakpoint: {
|
|
2465
|
+
type: "select",
|
|
2466
|
+
label: "Breakpoint",
|
|
2467
|
+
options: [
|
|
2468
|
+
{
|
|
2469
|
+
label: "Base",
|
|
2470
|
+
value: ""
|
|
2471
|
+
},
|
|
2472
|
+
{
|
|
2473
|
+
label: "XS",
|
|
2474
|
+
value: "xs"
|
|
2475
|
+
},
|
|
2476
|
+
{
|
|
2477
|
+
label: "SM",
|
|
2478
|
+
value: "sm"
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
label: "MD",
|
|
2482
|
+
value: "md"
|
|
2483
|
+
},
|
|
2484
|
+
{
|
|
2485
|
+
label: "LG",
|
|
2486
|
+
value: "lg"
|
|
2487
|
+
},
|
|
2488
|
+
{
|
|
2489
|
+
label: "XL",
|
|
2490
|
+
value: "xl"
|
|
2491
|
+
},
|
|
2492
|
+
{
|
|
2493
|
+
label: "2XL",
|
|
2494
|
+
value: "2xl"
|
|
2495
|
+
}
|
|
2496
|
+
]
|
|
2497
|
+
},
|
|
2498
|
+
direction: {
|
|
2499
|
+
type: "select",
|
|
2500
|
+
label: "Direction",
|
|
2501
|
+
options: [
|
|
2502
|
+
{
|
|
2503
|
+
label: "All 4 directions",
|
|
2504
|
+
value: "all"
|
|
2505
|
+
},
|
|
2506
|
+
{
|
|
2507
|
+
label: "Top",
|
|
2508
|
+
value: "top"
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
label: "Right",
|
|
2512
|
+
value: "right"
|
|
2513
|
+
},
|
|
2514
|
+
{
|
|
2515
|
+
label: "Bottom",
|
|
2516
|
+
value: "bottom"
|
|
2517
|
+
},
|
|
2518
|
+
{
|
|
2519
|
+
label: "Left",
|
|
2520
|
+
value: "left"
|
|
2521
|
+
},
|
|
2522
|
+
{
|
|
2523
|
+
label: "Horizontal (X)",
|
|
2524
|
+
value: "x"
|
|
2525
|
+
},
|
|
2526
|
+
{
|
|
2527
|
+
label: "Vertical (Y)",
|
|
2528
|
+
value: "y"
|
|
2529
|
+
}
|
|
2530
|
+
]
|
|
2531
|
+
},
|
|
2532
|
+
margin: {
|
|
2533
|
+
type: "numberUnit",
|
|
2534
|
+
label: "Margin",
|
|
2535
|
+
options: MARGIN_UNITS
|
|
2536
|
+
}
|
|
2537
|
+
},
|
|
2538
|
+
defaultItemProps: {
|
|
2539
|
+
breakpoint: "md",
|
|
2540
|
+
direction: "all",
|
|
2541
|
+
margin: {
|
|
2542
|
+
value: "0",
|
|
2543
|
+
unit: "px"
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
getItemSummary: (item) => getMarginSummary(item)
|
|
2547
|
+
} };
|
|
2548
|
+
function marginsToClasses(margins) {
|
|
2549
|
+
if (!margins || margins.length === 0) return "";
|
|
2550
|
+
const classes = [];
|
|
2551
|
+
margins.forEach((item) => {
|
|
2552
|
+
if (!item || !item.direction || !item.margin) return;
|
|
2553
|
+
const prefix = item.breakpoint ? `${item.breakpoint}:` : "";
|
|
2554
|
+
const value = item.margin.value || "0";
|
|
2555
|
+
const unit = item.margin.unit || "px";
|
|
2556
|
+
if (!value.trim()) return;
|
|
2557
|
+
let marginClass = "";
|
|
2558
|
+
switch (item.direction) {
|
|
2559
|
+
case "all":
|
|
2560
|
+
marginClass = `${prefix}m-[${value}${unit}]`;
|
|
2561
|
+
break;
|
|
2562
|
+
case "x":
|
|
2563
|
+
marginClass = `${prefix}mx-[${value}${unit}]`;
|
|
2564
|
+
break;
|
|
2565
|
+
case "y":
|
|
2566
|
+
marginClass = `${prefix}my-[${value}${unit}]`;
|
|
2567
|
+
break;
|
|
2568
|
+
case "top":
|
|
2569
|
+
marginClass = `${prefix}mt-[${value}${unit}]`;
|
|
2570
|
+
break;
|
|
2571
|
+
case "right":
|
|
2572
|
+
marginClass = `${prefix}mr-[${value}${unit}]`;
|
|
2573
|
+
break;
|
|
2574
|
+
case "bottom":
|
|
2575
|
+
marginClass = `${prefix}mb-[${value}${unit}]`;
|
|
2576
|
+
break;
|
|
2577
|
+
case "left":
|
|
2578
|
+
marginClass = `${prefix}ml-[${value}${unit}]`;
|
|
2579
|
+
break;
|
|
2580
|
+
}
|
|
2581
|
+
if (marginClass) classes.push(marginClass);
|
|
2582
|
+
});
|
|
2583
|
+
return classes.join(" ");
|
|
2584
|
+
}
|
|
2585
|
+
const marginsDefaultProps = { margins: [] };
|
|
2586
|
+
|
|
2587
|
+
//#endregion
|
|
2588
|
+
//#region src/utils/paddings.tsx
|
|
2589
|
+
const PADDING_UNITS = [
|
|
2590
|
+
{
|
|
2591
|
+
label: "px",
|
|
2592
|
+
value: "px"
|
|
2593
|
+
},
|
|
2594
|
+
{
|
|
2595
|
+
label: "rem",
|
|
2596
|
+
value: "rem"
|
|
2597
|
+
},
|
|
2598
|
+
{
|
|
2599
|
+
label: "em",
|
|
2600
|
+
value: "em"
|
|
2601
|
+
},
|
|
2602
|
+
{
|
|
2603
|
+
label: "%",
|
|
2604
|
+
value: "%"
|
|
2605
|
+
}
|
|
2606
|
+
];
|
|
2607
|
+
function getPaddingSummary(item) {
|
|
2608
|
+
if (!item || !item.direction) return "Padding";
|
|
2609
|
+
return `${item.breakpoint ? `${item.breakpoint.toUpperCase()} - ` : ""}${item.direction === "all" ? "All 4 directions" : item.direction === "x" ? "Horizontal" : item.direction === "y" ? "Vertical" : item.direction.charAt(0).toUpperCase() + item.direction.slice(1)}: ${item.padding?.value || "0"}${item.padding?.unit || "px"}`;
|
|
2610
|
+
}
|
|
2611
|
+
const paddingsField = { paddings: {
|
|
2612
|
+
type: "array",
|
|
2613
|
+
label: "Paddings",
|
|
2614
|
+
arrayFields: {
|
|
2615
|
+
breakpoint: {
|
|
2616
|
+
type: "select",
|
|
2617
|
+
label: "Breakpoint",
|
|
2618
|
+
options: [
|
|
2619
|
+
{
|
|
2620
|
+
label: "Base",
|
|
2621
|
+
value: ""
|
|
2622
|
+
},
|
|
2623
|
+
{
|
|
2624
|
+
label: "XS",
|
|
2625
|
+
value: "xs"
|
|
2626
|
+
},
|
|
2627
|
+
{
|
|
2628
|
+
label: "SM",
|
|
2629
|
+
value: "sm"
|
|
2630
|
+
},
|
|
2631
|
+
{
|
|
2632
|
+
label: "MD",
|
|
2633
|
+
value: "md"
|
|
2634
|
+
},
|
|
2635
|
+
{
|
|
2636
|
+
label: "LG",
|
|
2637
|
+
value: "lg"
|
|
2638
|
+
},
|
|
2639
|
+
{
|
|
2640
|
+
label: "XL",
|
|
2641
|
+
value: "xl"
|
|
2642
|
+
},
|
|
2643
|
+
{
|
|
2644
|
+
label: "2XL",
|
|
2645
|
+
value: "2xl"
|
|
2646
|
+
}
|
|
2647
|
+
]
|
|
2648
|
+
},
|
|
2649
|
+
direction: {
|
|
2650
|
+
type: "select",
|
|
2651
|
+
label: "Direction",
|
|
2652
|
+
options: [
|
|
2653
|
+
{
|
|
2654
|
+
label: "All 4 directions",
|
|
2655
|
+
value: "all"
|
|
2656
|
+
},
|
|
2657
|
+
{
|
|
2658
|
+
label: "Top",
|
|
2659
|
+
value: "top"
|
|
2660
|
+
},
|
|
2661
|
+
{
|
|
2662
|
+
label: "Right",
|
|
2663
|
+
value: "right"
|
|
2664
|
+
},
|
|
2665
|
+
{
|
|
2666
|
+
label: "Bottom",
|
|
2667
|
+
value: "bottom"
|
|
2668
|
+
},
|
|
2669
|
+
{
|
|
2670
|
+
label: "Left",
|
|
2671
|
+
value: "left"
|
|
2672
|
+
},
|
|
2673
|
+
{
|
|
2674
|
+
label: "Horizontal (X)",
|
|
2675
|
+
value: "x"
|
|
2676
|
+
},
|
|
2677
|
+
{
|
|
2678
|
+
label: "Vertical (Y)",
|
|
2679
|
+
value: "y"
|
|
2680
|
+
}
|
|
2681
|
+
]
|
|
2682
|
+
},
|
|
2683
|
+
padding: {
|
|
2684
|
+
type: "numberUnit",
|
|
2685
|
+
label: "Padding",
|
|
2686
|
+
options: PADDING_UNITS
|
|
2687
|
+
}
|
|
2688
|
+
},
|
|
2689
|
+
defaultItemProps: {
|
|
2690
|
+
breakpoint: "md",
|
|
2691
|
+
direction: "all",
|
|
2692
|
+
padding: {
|
|
2693
|
+
value: "0",
|
|
2694
|
+
unit: "px"
|
|
2695
|
+
}
|
|
2696
|
+
},
|
|
2697
|
+
getItemSummary: (item) => getPaddingSummary(item)
|
|
2698
|
+
} };
|
|
2699
|
+
function paddingsToClasses(paddings) {
|
|
2700
|
+
if (!paddings || paddings.length === 0) return "";
|
|
2701
|
+
const classes = [];
|
|
2702
|
+
paddings.forEach((item) => {
|
|
2703
|
+
if (!item || !item.direction || !item.padding) return;
|
|
2704
|
+
const prefix = item.breakpoint ? `${item.breakpoint}:` : "";
|
|
2705
|
+
const value = item.padding.value || "0";
|
|
2706
|
+
const unit = item.padding.unit || "px";
|
|
2707
|
+
if (!value.trim()) return;
|
|
2708
|
+
let paddingClass = "";
|
|
2709
|
+
switch (item.direction) {
|
|
2710
|
+
case "all":
|
|
2711
|
+
paddingClass = `${prefix}p-[${value}${unit}]`;
|
|
2712
|
+
break;
|
|
2713
|
+
case "x":
|
|
2714
|
+
paddingClass = `${prefix}px-[${value}${unit}]`;
|
|
2715
|
+
break;
|
|
2716
|
+
case "y":
|
|
2717
|
+
paddingClass = `${prefix}py-[${value}${unit}]`;
|
|
2718
|
+
break;
|
|
2719
|
+
case "top":
|
|
2720
|
+
paddingClass = `${prefix}pt-[${value}${unit}]`;
|
|
2721
|
+
break;
|
|
2722
|
+
case "right":
|
|
2723
|
+
paddingClass = `${prefix}pr-[${value}${unit}]`;
|
|
2724
|
+
break;
|
|
2725
|
+
case "bottom":
|
|
2726
|
+
paddingClass = `${prefix}pb-[${value}${unit}]`;
|
|
2727
|
+
break;
|
|
2728
|
+
case "left":
|
|
2729
|
+
paddingClass = `${prefix}pl-[${value}${unit}]`;
|
|
2730
|
+
break;
|
|
2731
|
+
}
|
|
2732
|
+
if (paddingClass) classes.push(paddingClass);
|
|
2733
|
+
});
|
|
2734
|
+
return classes.join(" ");
|
|
2735
|
+
}
|
|
2736
|
+
const paddingsDefaultProps = { paddings: [] };
|
|
2737
|
+
|
|
2738
|
+
//#endregion
|
|
2739
|
+
//#region src/utils/position.tsx
|
|
2740
|
+
const positionField = {
|
|
2741
|
+
position: {
|
|
2742
|
+
type: "select",
|
|
2743
|
+
label: "Position",
|
|
2744
|
+
options: [
|
|
2745
|
+
{
|
|
2746
|
+
label: "Static",
|
|
2747
|
+
value: "static"
|
|
2748
|
+
},
|
|
2749
|
+
{
|
|
2750
|
+
label: "Relative",
|
|
2751
|
+
value: "relative"
|
|
2752
|
+
},
|
|
2753
|
+
{
|
|
2754
|
+
label: "Absolute",
|
|
2755
|
+
value: "absolute"
|
|
2756
|
+
},
|
|
2757
|
+
{
|
|
2758
|
+
label: "Fixed",
|
|
2759
|
+
value: "fixed"
|
|
2760
|
+
},
|
|
2761
|
+
{
|
|
2762
|
+
label: "Sticky",
|
|
2763
|
+
value: "sticky"
|
|
2764
|
+
}
|
|
2765
|
+
]
|
|
2766
|
+
},
|
|
2767
|
+
top: {
|
|
2768
|
+
type: "text",
|
|
2769
|
+
label: "Top"
|
|
2770
|
+
},
|
|
2771
|
+
right: {
|
|
2772
|
+
type: "text",
|
|
2773
|
+
label: "Right"
|
|
2774
|
+
},
|
|
2775
|
+
bottom: {
|
|
2776
|
+
type: "text",
|
|
2777
|
+
label: "Bottom"
|
|
2778
|
+
},
|
|
2779
|
+
left: {
|
|
2780
|
+
type: "text",
|
|
2781
|
+
label: "Left"
|
|
2782
|
+
},
|
|
2783
|
+
zIndex: {
|
|
2784
|
+
type: "number",
|
|
2785
|
+
label: "Z-Index"
|
|
2786
|
+
}
|
|
2787
|
+
};
|
|
2788
|
+
function positionToClasses(position, top, right, bottom, left, zIndex) {
|
|
2789
|
+
const classes = [];
|
|
2790
|
+
if (position) classes.push(position);
|
|
2791
|
+
if (top && top.trim()) classes.push(`top-[${top}]`);
|
|
2792
|
+
if (right && right.trim()) classes.push(`right-[${right}]`);
|
|
2793
|
+
if (bottom && bottom.trim()) classes.push(`bottom-[${bottom}]`);
|
|
2794
|
+
if (left && left.trim()) classes.push(`left-[${left}]`);
|
|
2795
|
+
if (zIndex !== void 0 && zIndex !== null) classes.push(`z-[${zIndex}]`);
|
|
2796
|
+
return classes.join(" ");
|
|
2797
|
+
}
|
|
2798
|
+
const positionDefaultProps = {
|
|
2799
|
+
position: "static",
|
|
2800
|
+
top: "",
|
|
2801
|
+
right: "",
|
|
2802
|
+
bottom: "",
|
|
2803
|
+
left: "",
|
|
2804
|
+
zIndex: 0
|
|
2805
|
+
};
|
|
2806
|
+
|
|
2807
|
+
//#endregion
|
|
2808
|
+
//#region src/utils/size.tsx
|
|
2809
|
+
const WIDTH_UNITS = [
|
|
2810
|
+
{
|
|
2811
|
+
label: "px",
|
|
2812
|
+
value: "px"
|
|
2813
|
+
},
|
|
2814
|
+
{
|
|
2815
|
+
label: "%",
|
|
2816
|
+
value: "%"
|
|
2817
|
+
},
|
|
2818
|
+
{
|
|
2819
|
+
label: "em",
|
|
2820
|
+
value: "em"
|
|
2821
|
+
},
|
|
2822
|
+
{
|
|
2823
|
+
label: "rem",
|
|
2824
|
+
value: "rem"
|
|
2825
|
+
},
|
|
2826
|
+
{
|
|
2827
|
+
label: "vw",
|
|
2828
|
+
value: "vw"
|
|
2829
|
+
}
|
|
2830
|
+
];
|
|
2831
|
+
const HEIGHT_UNITS = [
|
|
2832
|
+
{
|
|
2833
|
+
label: "px",
|
|
2834
|
+
value: "px"
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
label: "%",
|
|
2838
|
+
value: "%"
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
label: "em",
|
|
2842
|
+
value: "em"
|
|
2843
|
+
},
|
|
2844
|
+
{
|
|
2845
|
+
label: "rem",
|
|
2846
|
+
value: "rem"
|
|
2847
|
+
},
|
|
2848
|
+
{
|
|
2849
|
+
label: "vh",
|
|
2850
|
+
value: "vh"
|
|
2851
|
+
}
|
|
2852
|
+
];
|
|
2853
|
+
const sizeField = {
|
|
2854
|
+
width: {
|
|
2855
|
+
type: "numberUnit",
|
|
2856
|
+
label: "Width",
|
|
2857
|
+
options: WIDTH_UNITS
|
|
2858
|
+
},
|
|
2859
|
+
minWidth: {
|
|
2860
|
+
type: "numberUnit",
|
|
2861
|
+
label: "Min Width",
|
|
2862
|
+
options: WIDTH_UNITS
|
|
2863
|
+
},
|
|
2864
|
+
maxWidth: {
|
|
2865
|
+
type: "numberUnit",
|
|
2866
|
+
label: "Max Width",
|
|
2867
|
+
options: WIDTH_UNITS
|
|
2868
|
+
},
|
|
2869
|
+
height: {
|
|
2870
|
+
type: "numberUnit",
|
|
2871
|
+
label: "Height",
|
|
2872
|
+
options: HEIGHT_UNITS
|
|
2873
|
+
},
|
|
2874
|
+
minHeight: {
|
|
2875
|
+
type: "numberUnit",
|
|
2876
|
+
label: "Min Height",
|
|
2877
|
+
options: HEIGHT_UNITS
|
|
2878
|
+
},
|
|
2879
|
+
maxHeight: {
|
|
2880
|
+
type: "numberUnit",
|
|
2881
|
+
label: "Max Height",
|
|
2882
|
+
options: HEIGHT_UNITS
|
|
2883
|
+
}
|
|
2884
|
+
};
|
|
2885
|
+
const addSizeClass = (classes, size, prefix) => {
|
|
2886
|
+
if (size && size.value && size.value.trim()) classes.push(`${prefix}-[${size.value}${size.unit}]`);
|
|
2887
|
+
};
|
|
2888
|
+
function sizeToClasses(width, minWidth, maxWidth, height, minHeight, maxHeight) {
|
|
2889
|
+
const classes = [];
|
|
2890
|
+
addSizeClass(classes, width, "w");
|
|
2891
|
+
addSizeClass(classes, minWidth, "min-w");
|
|
2892
|
+
addSizeClass(classes, maxWidth, "max-w");
|
|
2893
|
+
addSizeClass(classes, height, "h");
|
|
2894
|
+
addSizeClass(classes, minHeight, "min-h");
|
|
2895
|
+
addSizeClass(classes, maxHeight, "max-h");
|
|
2896
|
+
return classes.join(" ");
|
|
2897
|
+
}
|
|
2898
|
+
const sizeDefaultProps = {
|
|
2899
|
+
width: {
|
|
2900
|
+
value: "",
|
|
2901
|
+
unit: "px"
|
|
2902
|
+
},
|
|
2903
|
+
minWidth: {
|
|
2904
|
+
value: "",
|
|
2905
|
+
unit: "px"
|
|
2906
|
+
},
|
|
2907
|
+
maxWidth: {
|
|
2908
|
+
value: "",
|
|
2909
|
+
unit: "px"
|
|
2910
|
+
},
|
|
2911
|
+
height: {
|
|
2912
|
+
value: "",
|
|
2913
|
+
unit: "px"
|
|
2914
|
+
},
|
|
2915
|
+
minHeight: {
|
|
2916
|
+
value: "",
|
|
2917
|
+
unit: "px"
|
|
2918
|
+
},
|
|
2919
|
+
maxHeight: {
|
|
2920
|
+
value: "",
|
|
2921
|
+
unit: "px"
|
|
2922
|
+
}
|
|
2923
|
+
};
|
|
2924
|
+
|
|
2925
|
+
//#endregion
|
|
2926
|
+
//#region src/utils/spacing.tsx
|
|
2927
|
+
const spacingFields = {
|
|
2928
|
+
...marginsField,
|
|
2929
|
+
...paddingsField
|
|
2930
|
+
};
|
|
2931
|
+
const spacingDefaultProps = {
|
|
2932
|
+
...marginsDefaultProps,
|
|
2933
|
+
...paddingsDefaultProps
|
|
2934
|
+
};
|
|
2935
|
+
function spacingToClasses(props) {
|
|
2936
|
+
return [marginsToClasses(props.margins), paddingsToClasses(props.paddings)].filter(Boolean).join(" ");
|
|
2937
|
+
}
|
|
2938
|
+
const spacingFieldNames = ["margins", "paddings"];
|
|
2939
|
+
|
|
2940
|
+
//#endregion
|
|
2941
|
+
//#region src/utils/spacingOptions.ts
|
|
2942
|
+
const spacingOptions = [
|
|
2943
|
+
{
|
|
2944
|
+
label: "0 rem",
|
|
2945
|
+
value: "0px"
|
|
2946
|
+
},
|
|
2947
|
+
{
|
|
2948
|
+
label: "0.25 rem",
|
|
2949
|
+
value: "4px"
|
|
2950
|
+
},
|
|
2951
|
+
{
|
|
2952
|
+
label: "0.5 rem",
|
|
2953
|
+
value: "8px"
|
|
2954
|
+
},
|
|
2955
|
+
{
|
|
2956
|
+
label: "0.75 rem",
|
|
2957
|
+
value: "12px"
|
|
2958
|
+
},
|
|
2959
|
+
{
|
|
2960
|
+
label: "1 rem",
|
|
2961
|
+
value: "16px"
|
|
2962
|
+
},
|
|
2963
|
+
{
|
|
2964
|
+
label: "1.25 rem",
|
|
2965
|
+
value: "20px"
|
|
2966
|
+
},
|
|
2967
|
+
{
|
|
2968
|
+
label: "1.5 rem",
|
|
2969
|
+
value: "24px"
|
|
2970
|
+
},
|
|
2971
|
+
{
|
|
2972
|
+
label: "1.75 rem",
|
|
2973
|
+
value: "28px"
|
|
2974
|
+
},
|
|
2975
|
+
{
|
|
2976
|
+
label: "2 rem",
|
|
2977
|
+
value: "32px"
|
|
2978
|
+
},
|
|
2979
|
+
{
|
|
2980
|
+
label: "2.25 rem",
|
|
2981
|
+
value: "36px"
|
|
2982
|
+
},
|
|
2983
|
+
{
|
|
2984
|
+
label: "2.5 rem",
|
|
2985
|
+
value: "40px"
|
|
2986
|
+
},
|
|
2987
|
+
{
|
|
2988
|
+
label: "2.75 rem",
|
|
2989
|
+
value: "44px"
|
|
2990
|
+
},
|
|
2991
|
+
{
|
|
2992
|
+
label: "3 rem",
|
|
2993
|
+
value: "48px"
|
|
2994
|
+
},
|
|
2995
|
+
{
|
|
2996
|
+
label: "3.25 rem",
|
|
2997
|
+
value: "52px"
|
|
2998
|
+
},
|
|
2999
|
+
{
|
|
3000
|
+
label: "3.5 rem",
|
|
3001
|
+
value: "56px"
|
|
3002
|
+
},
|
|
3003
|
+
{
|
|
3004
|
+
label: "3.75 rem",
|
|
3005
|
+
value: "60px"
|
|
3006
|
+
},
|
|
3007
|
+
{
|
|
3008
|
+
label: "4 rem",
|
|
3009
|
+
value: "64px"
|
|
3010
|
+
},
|
|
3011
|
+
{
|
|
3012
|
+
label: "4.25 rem",
|
|
3013
|
+
value: "68px"
|
|
3014
|
+
},
|
|
3015
|
+
{
|
|
3016
|
+
label: "4.5 rem",
|
|
3017
|
+
value: "72px"
|
|
3018
|
+
},
|
|
3019
|
+
{
|
|
3020
|
+
label: "4.75 rem",
|
|
3021
|
+
value: "76px"
|
|
3022
|
+
},
|
|
3023
|
+
{
|
|
3024
|
+
label: "5 rem",
|
|
3025
|
+
value: "80px"
|
|
3026
|
+
}
|
|
3027
|
+
];
|
|
3028
|
+
|
|
3029
|
+
//#endregion
|
|
3030
|
+
//#region src/utils/textAlign.tsx
|
|
3031
|
+
const textAlignField = { textAlign: {
|
|
3032
|
+
type: "radio",
|
|
3033
|
+
label: "Text align",
|
|
3034
|
+
options: [
|
|
3035
|
+
{
|
|
3036
|
+
label: /* @__PURE__ */ jsx(AlignLeftIcon, { size: 16 }),
|
|
3037
|
+
value: "left"
|
|
3038
|
+
},
|
|
3039
|
+
{
|
|
3040
|
+
label: /* @__PURE__ */ jsx(AlignCenterIcon, { size: 16 }),
|
|
3041
|
+
value: "center"
|
|
3042
|
+
},
|
|
3043
|
+
{
|
|
3044
|
+
label: /* @__PURE__ */ jsx(AlignRightIcon, { size: 16 }),
|
|
3045
|
+
value: "right"
|
|
3046
|
+
},
|
|
3047
|
+
{
|
|
3048
|
+
label: /* @__PURE__ */ jsx(AlignJustifyIcon, { size: 16 }),
|
|
3049
|
+
value: "justify"
|
|
3050
|
+
}
|
|
3051
|
+
]
|
|
3052
|
+
} };
|
|
3053
|
+
function textAlignToClasses(textAlign) {
|
|
3054
|
+
if (!textAlign) return "";
|
|
3055
|
+
return `text-${textAlign}`;
|
|
3056
|
+
}
|
|
3057
|
+
const textAlignDefaultProps = { textAlign: "left" };
|
|
3058
|
+
|
|
3059
|
+
//#endregion
|
|
3060
|
+
//#region src/components/ui/menu.tsx
|
|
3061
|
+
const cssAnimationPresets = {
|
|
3062
|
+
none: "transition-none",
|
|
3063
|
+
scale: [`[transition-property:scale,opacity] [will-change:scale,opacity]`, `data-starting-style:scale-80 data-starting-style:opacity-0 data-ending-style:opacity-0 data-ending-style:scale-80`],
|
|
3064
|
+
fade: [`[transition-property:opacity] [will-change:opacity]`, `data-starting-style:opacity-0 data-ending-style:opacity-0`],
|
|
3065
|
+
slideOutside: [
|
|
3066
|
+
`[transition-property:translate,opacity] [will-change:translate,opacity]`,
|
|
3067
|
+
`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`,
|
|
3068
|
+
`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`,
|
|
3069
|
+
`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`,
|
|
3070
|
+
`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`,
|
|
3071
|
+
`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`,
|
|
3072
|
+
`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`
|
|
3073
|
+
],
|
|
3074
|
+
slideInside: [
|
|
3075
|
+
`[transition-property:translate,opacity] [will-change:translate,opacity]`,
|
|
3076
|
+
`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`,
|
|
3077
|
+
`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`,
|
|
3078
|
+
`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`,
|
|
3079
|
+
`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`,
|
|
3080
|
+
`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`,
|
|
3081
|
+
`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`
|
|
3082
|
+
],
|
|
3083
|
+
wipe: [
|
|
3084
|
+
`[transition-property:clip-path] [will-change:clip-path]`,
|
|
3085
|
+
`[clip-path:inset(0_0_0_0_round_12px)] [-webkit-clip-path:inset(0_0_0_0_round_12px)]`,
|
|
3086
|
+
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_12px)] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_12px)]`,
|
|
3087
|
+
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_12px)] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_12px)]`,
|
|
3088
|
+
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
3089
|
+
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`,
|
|
3090
|
+
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
3091
|
+
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`
|
|
3092
|
+
],
|
|
3093
|
+
wipeScale: [
|
|
3094
|
+
`[transition-property:clip-path,scale] [will-change:clip-path,scale]`,
|
|
3095
|
+
`[clip-path:inset(0_0_0_0_round_12px)] [-webkit-clip-path:inset(0_0_0_0_round_12px)]`,
|
|
3096
|
+
`data-starting-style:scale-80 data-ending-style:scale-80`,
|
|
3097
|
+
`data-[side=bottom]:data-starting-style:[clip-path:inset(0_0_100%_0_round_12px)] data-[side=bottom]:data-ending-style:[clip-path:inset(0_0_100%_0_round_12px)]`,
|
|
3098
|
+
`data-[side=top]:data-starting-style:[clip-path:inset(100%_0_0_0_round_12px)] data-[side=top]:data-ending-style:[clip-path:inset(100%_0_0_0_round_12px)]`,
|
|
3099
|
+
`data-[side=left]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=left]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
3100
|
+
`data-[side=right]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=right]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`,
|
|
3101
|
+
`data-[side=inline-start]:data-starting-style:[clip-path:inset(0_0_0_100%_round_12px)] data-[side=inline-start]:data-ending-style:[clip-path:inset(0_0_0_100%_round_12px)]`,
|
|
3102
|
+
`data-[side=inline-end]:data-starting-style:[clip-path:inset(0_100%_0_0_round_12px)] data-[side=inline-end]:data-ending-style:[clip-path:inset(0_100%_0_0_round_12px)]`
|
|
3103
|
+
],
|
|
3104
|
+
motion: [
|
|
3105
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform] [will-change:translate,scale,opacity,rotateX,rotateY,transform]`,
|
|
3106
|
+
`[transform:perspective(1000px)]`,
|
|
3107
|
+
`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]`,
|
|
3108
|
+
`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]`,
|
|
3109
|
+
`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]`,
|
|
3110
|
+
`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]`,
|
|
3111
|
+
`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]`,
|
|
3112
|
+
`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]`
|
|
3113
|
+
],
|
|
3114
|
+
motionBlur: [
|
|
3115
|
+
`[transition-property:translate,scale,opacity,rotateX,rotateY,transform,filter] [will-change:translate,scale,opacity,rotateX,rotateY,transform,filter]`,
|
|
3116
|
+
`[transform:perspective(1000px)]`,
|
|
3117
|
+
`data-starting-style:blur-[9px] data-ending-style:blur-[9px]`,
|
|
3118
|
+
`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]`,
|
|
3119
|
+
`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]`,
|
|
3120
|
+
`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]`,
|
|
3121
|
+
`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]`,
|
|
3122
|
+
`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]`,
|
|
3123
|
+
`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]`
|
|
3124
|
+
]
|
|
3125
|
+
};
|
|
3126
|
+
const cssTransitionPresets = {
|
|
3127
|
+
inExpo: `duration-[0.35s] ease-[cubic-bezier(0.95,0.05,0.795,0.035)]`,
|
|
3128
|
+
outExpo: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
3129
|
+
inOutExpo: `duration-[0.35s] ease-[cubic-bezier(1,0,0,1)]`,
|
|
3130
|
+
anticipate: `duration-[0.35s] ease-[cubic-bezier(1,-0.4,0.35,0.95)]`,
|
|
3131
|
+
quickOut: `duration-[0.35s] ease-out`,
|
|
3132
|
+
overshootOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.275)]`,
|
|
3133
|
+
swiftOut: `duration-[0.35s] ease-[cubic-bezier(0.175,0.885,0.32,1.1)]`,
|
|
3134
|
+
snappyOut: `duration-[0.35s] ease-[cubic-bezier(0.19,1,0.22,1)]`,
|
|
3135
|
+
in: `duration-[0.35s] ease-[cubic-bezier(0.42,0,1,1)]`,
|
|
3136
|
+
out: `duration-[0.35s] ease-[cubic-bezier(0,0,0.58,1)]`,
|
|
3137
|
+
inOut: `duration-[0.25s] ease-[cubic-bezier(0.42,0,0.58,1)]`,
|
|
3138
|
+
outIn: `duration-[0.35s] ease-[cubic-bezier(0.1,0.7,0.9,0.5)]`,
|
|
3139
|
+
inQuad: `duration-[0.35s] ease-[cubic-bezier(0.55,0.085,0.68,0.53)]`,
|
|
3140
|
+
outQuad: `duration-[0.25s] ease-[cubic-bezier(0.25,0.46,0.45,0.94)]`,
|
|
3141
|
+
inOutQuad: `duration-[0.32s] ease-[cubic-bezier(0.455,0.03,0.515,0.955)]`,
|
|
3142
|
+
inCubic: `duration-[0.35s] ease-[cubic-bezier(0.55,0.055,0.675,0.19)]`,
|
|
3143
|
+
outCubic: `duration-[0.35s] ease-[cubic-bezier(0.215,0.61,0.355,1)]`,
|
|
3144
|
+
inOutCubic: `duration-[0.35s] ease-[cubic-bezier(0.645,0.045,0.355,1)]`,
|
|
3145
|
+
inQuart: `duration-[0.35s] ease-[cubic-bezier(0.895,0.03,0.685,0.22)]`,
|
|
3146
|
+
outQuart: `duration-[0.35s] ease-[cubic-bezier(0.165,0.84,0.44,1)]`,
|
|
3147
|
+
inOutQuart: `duration-[0.35s] ease-[cubic-bezier(0.77,0,0.175,1)]`,
|
|
3148
|
+
inQuint: `duration-[0.35s] ease-[cubic-bezier(0.755,0.05,0.855,0.06)]`,
|
|
3149
|
+
outQuint: `duration-[0.35s] ease-[cubic-bezier(0.23,1,0.32,1)]`,
|
|
3150
|
+
inOutQuint: `duration-[0.35s] ease-[cubic-bezier(0.86,0,0.07,1)]`,
|
|
3151
|
+
inCirc: `duration-[0.35s] ease-[cubic-bezier(0.6,0.04,0.98,0.335)]`,
|
|
3152
|
+
outCirc: `duration-[0.35s] ease-[cubic-bezier(0.075,0.82,0.165,1)]`,
|
|
3153
|
+
inOutCirc: `duration-[0.35s] ease-[cubic-bezier(0.785,0.135,0.15,0.86)]`,
|
|
3154
|
+
inOutBase: `duration-[0.35s] ease-[cubic-bezier(0.25,0.1,0.25,1)]`
|
|
3155
|
+
};
|
|
3156
|
+
const MenuContext = createContext(void 0);
|
|
3157
|
+
function useMenu() {
|
|
3158
|
+
const context = useContext(MenuContext);
|
|
3159
|
+
if (!context) throw new Error("useMenu must be used within a MenuProvider");
|
|
3160
|
+
return context;
|
|
3161
|
+
}
|
|
3162
|
+
function Menu$1({ backdrop = "transparent", ...props }) {
|
|
3163
|
+
return /* @__PURE__ */ jsx(MenuContext.Provider, {
|
|
3164
|
+
value: { backdrop },
|
|
3165
|
+
children: /* @__PURE__ */ jsx(Menu.Root, {
|
|
3166
|
+
"data-slot": "menu",
|
|
3167
|
+
...props
|
|
3168
|
+
})
|
|
3169
|
+
});
|
|
3170
|
+
}
|
|
3171
|
+
function MenuTrigger({ ...props }) {
|
|
3172
|
+
return /* @__PURE__ */ jsx(Menu.Trigger, {
|
|
3173
|
+
"data-slot": "menu-trigger",
|
|
3174
|
+
...props
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
function MenuPortal(props) {
|
|
3178
|
+
return /* @__PURE__ */ jsx(Menu.Portal, {
|
|
3179
|
+
"data-slot": "menu-portal",
|
|
3180
|
+
...props
|
|
3181
|
+
});
|
|
3182
|
+
}
|
|
3183
|
+
function MenuBackdrop({ className, ...props }) {
|
|
3184
|
+
const { backdrop = "transparent" } = useMenu();
|
|
3185
|
+
return /* @__PURE__ */ jsx(Menu.Backdrop, {
|
|
3186
|
+
"data-slot": "menu-backdrop",
|
|
3187
|
+
className: cn(backdrop === "opaque" && "fixed inset-0 z-100 bg-black opacity-40 transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:opacity-60", backdrop === "blur" && "fixed inset-0 z-100 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0", backdrop === "transparent" && "hidden", className),
|
|
3188
|
+
...props
|
|
3189
|
+
});
|
|
3190
|
+
}
|
|
3191
|
+
function MenuPositioner({ sideOffset = 4, side = "bottom", className, ...rest }) {
|
|
3192
|
+
return /* @__PURE__ */ jsxs(MenuPortal, { children: [/* @__PURE__ */ jsx(MenuBackdrop, {}), /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
3193
|
+
sideOffset,
|
|
3194
|
+
side,
|
|
3195
|
+
"data-slot": "menu-positioner",
|
|
3196
|
+
className: cn("z-100 [--item-block-padding:6px] [--item-inline-padding:8px]", (side === "inline-end" || side === "inline-start") && "**:data-[slot=menu-arrow]:hidden", className),
|
|
3197
|
+
...rest
|
|
3198
|
+
})] });
|
|
3199
|
+
}
|
|
3200
|
+
function MenuArrow({ className, ...rest }) {
|
|
3201
|
+
return /* @__PURE__ */ jsx(Menu.Arrow, {
|
|
3202
|
+
"data-slot": "menu-arrow",
|
|
3203
|
+
className: cn("data-[side=bottom]:top-[-9px] data-[side=left]:right-[-14px] data-[side=left]:rotate-90 data-[side=right]:left-[-14px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-9px] data-[side=top]:rotate-180", className),
|
|
3204
|
+
...rest
|
|
3205
|
+
});
|
|
3206
|
+
}
|
|
3207
|
+
function ArrowSvg(props) {
|
|
3208
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
3209
|
+
width: "20",
|
|
3210
|
+
height: "10",
|
|
3211
|
+
viewBox: "0 0 20 10",
|
|
3212
|
+
fill: "none",
|
|
3213
|
+
...props,
|
|
3214
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
3215
|
+
d: "M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",
|
|
3216
|
+
className: "fill-popover"
|
|
3217
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
3218
|
+
d: "M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z",
|
|
3219
|
+
className: "fill-border/60"
|
|
3220
|
+
})]
|
|
3221
|
+
});
|
|
3222
|
+
}
|
|
3223
|
+
function MenuPopup({ className, animationPreset = "scale", transitionPreset = "snappyOut", reduceMotion = false, showArrow = false, side = "bottom", sideOffset = 4, align = "center", alignOffset = 0, children, ...rest }) {
|
|
3224
|
+
const cssAnimationConfig = useMemo(() => {
|
|
3225
|
+
if (reduceMotion) return "none";
|
|
3226
|
+
if (animationPreset) return cssAnimationPresets[animationPreset];
|
|
3227
|
+
return cssAnimationPresets.scale;
|
|
3228
|
+
}, [
|
|
3229
|
+
animationPreset,
|
|
3230
|
+
reduceMotion,
|
|
3231
|
+
side
|
|
3232
|
+
]);
|
|
3233
|
+
const cssTransitionConfig = useMemo(() => {
|
|
3234
|
+
if (reduceMotion) return "none";
|
|
3235
|
+
if (transitionPreset) return cssTransitionPresets[transitionPreset];
|
|
3236
|
+
return cssTransitionPresets.snappyOut;
|
|
3237
|
+
}, [
|
|
3238
|
+
transitionPreset,
|
|
3239
|
+
reduceMotion,
|
|
3240
|
+
side
|
|
3241
|
+
]);
|
|
3242
|
+
return /* @__PURE__ */ jsx(MenuPositioner, {
|
|
3243
|
+
side,
|
|
3244
|
+
sideOffset,
|
|
3245
|
+
align,
|
|
3246
|
+
alignOffset,
|
|
3247
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
3248
|
+
"data-slot": "menu-popup",
|
|
3249
|
+
render: /* @__PURE__ */ jsxs("div", {
|
|
3250
|
+
className: cn("bg-popover text-popover-foreground border-border/60 pointer-events-auto w-[max(var(--anchor-width),226px)] origin-(--transform-origin) rounded-[12px] border p-1 shadow-xs", className, cssTransitionConfig, cssAnimationConfig),
|
|
3251
|
+
children: [showArrow && /* @__PURE__ */ jsx(MenuArrow, { children: /* @__PURE__ */ jsx(ArrowSvg, {}) }), children]
|
|
3252
|
+
}, "menu-popup"),
|
|
3253
|
+
...rest
|
|
3254
|
+
})
|
|
3255
|
+
});
|
|
3256
|
+
}
|
|
3257
|
+
const MenuRadioGroupContext = createContext({});
|
|
3258
|
+
|
|
3259
|
+
//#endregion
|
|
3260
|
+
//#region src/components/ColorPicker/index.tsx
|
|
3261
|
+
const PREDEFINED_COLORS = [
|
|
3262
|
+
{
|
|
3263
|
+
name: "Blue",
|
|
3264
|
+
value: "#3B82F6"
|
|
3265
|
+
},
|
|
3266
|
+
{
|
|
3267
|
+
name: "Purple",
|
|
3268
|
+
value: "#8B5CF6"
|
|
3269
|
+
},
|
|
3270
|
+
{
|
|
3271
|
+
name: "Pink",
|
|
3272
|
+
value: "#EC4899"
|
|
3273
|
+
},
|
|
3274
|
+
{
|
|
3275
|
+
name: "Rose",
|
|
3276
|
+
value: "#F43F5E"
|
|
3277
|
+
},
|
|
3278
|
+
{
|
|
3279
|
+
name: "Red",
|
|
3280
|
+
value: "#EF4444"
|
|
3281
|
+
},
|
|
3282
|
+
{
|
|
3283
|
+
name: "Orange",
|
|
3284
|
+
value: "#F97316"
|
|
3285
|
+
},
|
|
3286
|
+
{
|
|
3287
|
+
name: "Amber",
|
|
3288
|
+
value: "#F59E0B"
|
|
3289
|
+
},
|
|
3290
|
+
{
|
|
3291
|
+
name: "Green",
|
|
3292
|
+
value: "#10B981"
|
|
3293
|
+
}
|
|
3294
|
+
];
|
|
3295
|
+
const GRAY_COLORS = [
|
|
3296
|
+
{
|
|
3297
|
+
name: "Black",
|
|
3298
|
+
value: "#000000"
|
|
3299
|
+
},
|
|
3300
|
+
{
|
|
3301
|
+
name: "Gray 900",
|
|
3302
|
+
value: "#18181B"
|
|
3303
|
+
},
|
|
3304
|
+
{
|
|
3305
|
+
name: "Gray 600",
|
|
3306
|
+
value: "#52525B"
|
|
3307
|
+
},
|
|
3308
|
+
{
|
|
3309
|
+
name: "Gray 300",
|
|
3310
|
+
value: "#D4D4D8"
|
|
3311
|
+
},
|
|
3312
|
+
{
|
|
3313
|
+
name: "Gray 200",
|
|
3314
|
+
value: "#E4E4E7"
|
|
3315
|
+
},
|
|
3316
|
+
{
|
|
3317
|
+
name: "Gray 100",
|
|
3318
|
+
value: "#F4F4F5"
|
|
3319
|
+
},
|
|
3320
|
+
{
|
|
3321
|
+
name: "White",
|
|
3322
|
+
value: "#FFFFFF"
|
|
3323
|
+
}
|
|
3324
|
+
];
|
|
3325
|
+
const ColorPicker = ({ value, onChange }) => {
|
|
3326
|
+
const handleColorSelect = (color) => {
|
|
3327
|
+
onChange(color);
|
|
3328
|
+
};
|
|
3329
|
+
const handleClearColor = () => {
|
|
3330
|
+
onChange("");
|
|
3331
|
+
};
|
|
3332
|
+
return /* @__PURE__ */ jsxs(Menu$1, { children: [/* @__PURE__ */ jsxs(MenuTrigger, {
|
|
3333
|
+
className: cn("border-input text-foreground focus-visible:border-primary hover:bg-accent w-full justify-between gap-2 rounded-md border bg-white px-3 py-2 text-sm transition-colors", "flex items-center"),
|
|
3334
|
+
children: [value ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
3335
|
+
className: "border-border size-5 rounded-md border",
|
|
3336
|
+
style: { backgroundColor: value }
|
|
3337
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
3338
|
+
className: "flex-1 text-left",
|
|
3339
|
+
children: value
|
|
3340
|
+
})] }) : /* @__PURE__ */ jsxs("div", {
|
|
3341
|
+
className: "flex items-center justify-start gap-2",
|
|
3342
|
+
children: [/* @__PURE__ */ jsx("div", { className: "border-border after:bg-destructive relative size-5 rounded-md border bg-white after:absolute after:inset-0 after:top-1/2 after:left-1/2 after:z-1 after:flex after:h-0.5 after:w-7 after:-translate-x-1/2 after:-translate-y-1/2 after:-rotate-45 after:rounded-full after:content-['']" }), /* @__PURE__ */ jsx("span", { children: "No color" })]
|
|
3343
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" })]
|
|
3344
|
+
}), /* @__PURE__ */ jsx(MenuPopup, {
|
|
3345
|
+
align: "start",
|
|
3346
|
+
side: "bottom",
|
|
3347
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
3348
|
+
className: "flex flex-col gap-3 p-2",
|
|
3349
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
3350
|
+
className: "flex flex-col gap-3",
|
|
3351
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
3352
|
+
type: "button",
|
|
3353
|
+
onClick: handleClearColor,
|
|
3354
|
+
className: "border-border after:bg-destructive relative size-5 cursor-pointer rounded-md border bg-white after:absolute after:inset-0 after:top-1/2 after:left-1/2 after:z-1 after:flex after:h-0.5 after:w-7 after:-translate-x-1/2 after:-translate-y-1/2 after:-rotate-45 after:rounded-full after:content-['']",
|
|
3355
|
+
title: "Clear color",
|
|
3356
|
+
"aria-label": "Clear color"
|
|
3357
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3358
|
+
className: "flex flex-wrap gap-1",
|
|
3359
|
+
children: [PREDEFINED_COLORS.map((color) => /* @__PURE__ */ jsx("button", {
|
|
3360
|
+
type: "button",
|
|
3361
|
+
className: cn("border-primary/20 size-5 cursor-pointer rounded-md border transition-all hover:scale-105"),
|
|
3362
|
+
style: { backgroundColor: color.value },
|
|
3363
|
+
onClick: () => handleColorSelect(color.value),
|
|
3364
|
+
title: color.name,
|
|
3365
|
+
"aria-label": color.name
|
|
3366
|
+
}, color.value)), GRAY_COLORS.map((color) => /* @__PURE__ */ jsx("button", {
|
|
3367
|
+
type: "button",
|
|
3368
|
+
className: cn("border-primary/20 size-5 cursor-pointer rounded-md border transition-all hover:scale-105"),
|
|
3369
|
+
style: { backgroundColor: color.value },
|
|
3370
|
+
onClick: () => handleColorSelect(color.value),
|
|
3371
|
+
title: color.name,
|
|
3372
|
+
"aria-label": color.name
|
|
3373
|
+
}, color.value))]
|
|
3374
|
+
})]
|
|
3375
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3376
|
+
className: "flex flex-col gap-1.5",
|
|
3377
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3378
|
+
className: "text-xs font-medium",
|
|
3379
|
+
children: "Custom Color"
|
|
3380
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
3381
|
+
className: "flex flex-col gap-2",
|
|
3382
|
+
children: [/* @__PURE__ */ jsx(HexColorPicker, {
|
|
3383
|
+
color: value || "#000000",
|
|
3384
|
+
onChange: handleColorSelect,
|
|
3385
|
+
className: "!w-full"
|
|
3386
|
+
}), /* @__PURE__ */ jsx(Input$2, {
|
|
3387
|
+
type: "text",
|
|
3388
|
+
value: value || "",
|
|
3389
|
+
onChange: (e) => handleColorSelect(e.target.value),
|
|
3390
|
+
placeholder: "Select a color"
|
|
3391
|
+
})]
|
|
3392
|
+
})]
|
|
3393
|
+
})]
|
|
3394
|
+
})
|
|
3395
|
+
})] });
|
|
3396
|
+
};
|
|
3397
|
+
var ColorPicker_default = ColorPicker;
|
|
3398
|
+
|
|
3399
|
+
//#endregion
|
|
3400
|
+
//#region src/utils/textColor.tsx
|
|
3401
|
+
const textColorField = { textColor: {
|
|
3402
|
+
type: "custom",
|
|
3403
|
+
label: "Text color",
|
|
3404
|
+
render: ({ value, onChange, field }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, { label: field.label }), /* @__PURE__ */ jsx("div", {
|
|
3405
|
+
className: "rounded-md border border-dashed border-lime-500 bg-lime-500/10 p-3",
|
|
3406
|
+
children: /* @__PURE__ */ jsx(ColorPicker_default, {
|
|
3407
|
+
value,
|
|
3408
|
+
onChange
|
|
3409
|
+
})
|
|
3410
|
+
})] })
|
|
3411
|
+
} };
|
|
3412
|
+
function textColorToClasses(textColor) {
|
|
3413
|
+
if (!textColor) return "";
|
|
3414
|
+
return `text-[${textColor}]`;
|
|
3415
|
+
}
|
|
3416
|
+
const textColorDefaultProps = { textColor: void 0 };
|
|
3417
|
+
|
|
3418
|
+
//#endregion
|
|
3419
|
+
//#region src/utils/textDecoration.tsx
|
|
3420
|
+
const textDecorationField = { textDecoration: {
|
|
3421
|
+
type: "checkbox",
|
|
3422
|
+
label: "Text decoration",
|
|
3423
|
+
layout: "horizontal",
|
|
3424
|
+
options: [
|
|
3425
|
+
{
|
|
3426
|
+
label: /* @__PURE__ */ jsx(BoldIcon, { size: 16 }),
|
|
3427
|
+
value: "bold"
|
|
3428
|
+
},
|
|
3429
|
+
{
|
|
3430
|
+
label: /* @__PURE__ */ jsx(LightbulbIcon, { size: 16 }),
|
|
3431
|
+
value: "light"
|
|
3432
|
+
},
|
|
3433
|
+
{
|
|
3434
|
+
label: /* @__PURE__ */ jsx(ItalicIcon, { size: 16 }),
|
|
3435
|
+
value: "italic"
|
|
3436
|
+
},
|
|
3437
|
+
{
|
|
3438
|
+
label: /* @__PURE__ */ jsx(UnderlineIcon, { size: 16 }),
|
|
3439
|
+
value: "underline"
|
|
3440
|
+
},
|
|
3441
|
+
{
|
|
3442
|
+
label: /* @__PURE__ */ jsx(StrikethroughIcon, { size: 16 }),
|
|
3443
|
+
value: "line-through"
|
|
3444
|
+
}
|
|
3445
|
+
]
|
|
3446
|
+
} };
|
|
3447
|
+
function textDecorationToClasses(textDecoration) {
|
|
3448
|
+
if (!textDecoration || textDecoration.length === 0) return "";
|
|
3449
|
+
const classes = [];
|
|
3450
|
+
if (textDecoration.includes("bold")) classes.push("font-bold");
|
|
3451
|
+
if (textDecoration.includes("light")) classes.push("font-light");
|
|
3452
|
+
if (textDecoration.includes("italic")) classes.push("italic");
|
|
3453
|
+
if (textDecoration.includes("underline")) classes.push("underline");
|
|
3454
|
+
if (textDecoration.includes("line-through")) classes.push("line-through");
|
|
3455
|
+
return classes.join(" ");
|
|
3456
|
+
}
|
|
3457
|
+
const textDecorationDefaultProps = { textDecoration: [] };
|
|
3458
|
+
|
|
3459
|
+
//#endregion
|
|
3460
|
+
//#region src/utils/textSize.tsx
|
|
3461
|
+
const textSizeField = { textSize: {
|
|
3462
|
+
type: "select",
|
|
3463
|
+
placeholder: /* @__PURE__ */ jsx(MinusIcon, { size: 16 }),
|
|
3464
|
+
label: "Text size",
|
|
3465
|
+
options: [
|
|
3466
|
+
{
|
|
3467
|
+
label: /* @__PURE__ */ jsx(MinusIcon, { size: 16 }),
|
|
3468
|
+
value: ""
|
|
3469
|
+
},
|
|
3470
|
+
{
|
|
3471
|
+
label: "XS (12px)",
|
|
3472
|
+
value: "xs"
|
|
3473
|
+
},
|
|
3474
|
+
{
|
|
3475
|
+
label: "SM (14px)",
|
|
3476
|
+
value: "sm"
|
|
3477
|
+
},
|
|
3478
|
+
{
|
|
3479
|
+
label: "Base (16px)",
|
|
3480
|
+
value: "base"
|
|
3481
|
+
},
|
|
3482
|
+
{
|
|
3483
|
+
label: "LG (18px)",
|
|
3484
|
+
value: "lg"
|
|
3485
|
+
},
|
|
3486
|
+
{
|
|
3487
|
+
label: "XL (20px)",
|
|
3488
|
+
value: "xl"
|
|
3489
|
+
},
|
|
3490
|
+
{
|
|
3491
|
+
label: "2XL (24px)",
|
|
3492
|
+
value: "2xl"
|
|
3493
|
+
},
|
|
3494
|
+
{
|
|
3495
|
+
label: "3XL (30px)",
|
|
3496
|
+
value: "3xl"
|
|
3497
|
+
},
|
|
3498
|
+
{
|
|
3499
|
+
label: "4XL (36px)",
|
|
3500
|
+
value: "4xl"
|
|
3501
|
+
},
|
|
3502
|
+
{
|
|
3503
|
+
label: "5XL (48px)",
|
|
3504
|
+
value: "5xl"
|
|
3505
|
+
},
|
|
3506
|
+
{
|
|
3507
|
+
label: "6XL (60px)",
|
|
3508
|
+
value: "6xl"
|
|
3509
|
+
},
|
|
3510
|
+
{
|
|
3511
|
+
label: "7XL (72px)",
|
|
3512
|
+
value: "7xl"
|
|
3513
|
+
},
|
|
3514
|
+
{
|
|
3515
|
+
label: "8XL (96px)",
|
|
3516
|
+
value: "8xl"
|
|
3517
|
+
},
|
|
3518
|
+
{
|
|
3519
|
+
label: "9XL (128px)",
|
|
3520
|
+
value: "9xl"
|
|
3521
|
+
}
|
|
3522
|
+
]
|
|
3523
|
+
} };
|
|
3524
|
+
function textSizeToClasses(textSize) {
|
|
3525
|
+
if (!textSize) return "";
|
|
3526
|
+
return `text-${textSize}`;
|
|
3527
|
+
}
|
|
3528
|
+
const textSizeDefaultProps = { textSize: "" };
|
|
3529
|
+
|
|
3530
|
+
//#endregion
|
|
3531
|
+
//#region src/utils/textTransform.tsx
|
|
3532
|
+
const textTransformField = { textTransform: {
|
|
3533
|
+
type: "radio",
|
|
3534
|
+
label: "Text transform",
|
|
3535
|
+
options: [
|
|
3536
|
+
{
|
|
3537
|
+
label: /* @__PURE__ */ jsx(MinusIcon, { size: 16 }),
|
|
3538
|
+
value: "none"
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
label: /* @__PURE__ */ jsx(CaseUpperIcon, { size: 16 }),
|
|
3542
|
+
value: "uppercase"
|
|
3543
|
+
},
|
|
3544
|
+
{
|
|
3545
|
+
label: /* @__PURE__ */ jsx(CaseLowerIcon, { size: 16 }),
|
|
3546
|
+
value: "lowercase"
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
label: /* @__PURE__ */ jsx(CaseSensitiveIcon, { size: 16 }),
|
|
3550
|
+
value: "capitalize"
|
|
3551
|
+
}
|
|
3552
|
+
]
|
|
3553
|
+
} };
|
|
3554
|
+
function textTransformToClasses(textTransform) {
|
|
3555
|
+
if (!textTransform || textTransform === "none") return "";
|
|
3556
|
+
return textTransform;
|
|
3557
|
+
}
|
|
3558
|
+
const textTransformDefaultProps = { textTransform: "none" };
|
|
3559
|
+
|
|
3560
|
+
//#endregion
|
|
3561
|
+
//#region src/utils/typography.tsx
|
|
3562
|
+
const typographyFields = {
|
|
3563
|
+
...textAlignField,
|
|
3564
|
+
...textTransformField,
|
|
3565
|
+
...textDecorationField,
|
|
3566
|
+
...textSizeField,
|
|
3567
|
+
...textColorField,
|
|
3568
|
+
...lineHeightField,
|
|
3569
|
+
...fontWeightField
|
|
3570
|
+
};
|
|
3571
|
+
const typographyDefaultProps = {
|
|
3572
|
+
...textAlignDefaultProps,
|
|
3573
|
+
...textTransformDefaultProps,
|
|
3574
|
+
...textDecorationDefaultProps,
|
|
3575
|
+
...textSizeDefaultProps,
|
|
3576
|
+
...textColorDefaultProps,
|
|
3577
|
+
...lineHeightDefaultProps,
|
|
3578
|
+
...fontWeightDefaultProps
|
|
3579
|
+
};
|
|
3580
|
+
function typographyToClasses(props) {
|
|
3581
|
+
return [
|
|
3582
|
+
textAlignToClasses(props.textAlign),
|
|
3583
|
+
textTransformToClasses(props.textTransform),
|
|
3584
|
+
textDecorationToClasses(props.textDecoration),
|
|
3585
|
+
textSizeToClasses(props.textSize),
|
|
3586
|
+
textColorToClasses(props.textColor),
|
|
3587
|
+
lineHeightToClasses(props.lineHeight),
|
|
3588
|
+
fontWeightToClasses(props.fontWeight)
|
|
3589
|
+
].filter(Boolean).join(" ");
|
|
3590
|
+
}
|
|
3591
|
+
const typographyFieldNames = [
|
|
3592
|
+
"textAlign",
|
|
3593
|
+
"textTransform",
|
|
3594
|
+
"textDecoration",
|
|
3595
|
+
"textSize",
|
|
3596
|
+
"textColor",
|
|
3597
|
+
"lineHeight",
|
|
3598
|
+
"fontWeight"
|
|
3599
|
+
];
|
|
3600
|
+
|
|
3601
|
+
//#endregion
|
|
3602
|
+
export { Label_default as Label, MediaPicker, TablePagination, plugin_default as createPuckOverridesPlugin, displayDefaultProps, displayField, displayToClasses, fontWeightDefaultProps, fontWeightField, fontWeightToClasses, getMediaUrl, lineHeightDefaultProps, lineHeightField, lineHeightToClasses, marginsDefaultProps, marginsField, marginsToClasses, paddingsDefaultProps, paddingsField, paddingsToClasses, positionDefaultProps, positionField, positionToClasses, sizeDefaultProps, sizeField, sizeToClasses, spacingDefaultProps, spacingFieldNames, spacingFields, spacingOptions, spacingToClasses, textAlignDefaultProps, textAlignField, textAlignToClasses, textColorDefaultProps, textColorField, textColorToClasses, textDecorationDefaultProps, textDecorationField, textDecorationToClasses, textSizeDefaultProps, textSizeField, textSizeToClasses, textTransformDefaultProps, textTransformField, textTransformToClasses, typographyDefaultProps, typographyFieldNames, typographyFields, typographyToClasses };
|
|
3603
|
+
//# sourceMappingURL=index.js.map
|