@drawnagency/primitives 0.1.108 → 0.1.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-PZJL2S3Z.js → chunk-3ZRQ4G5F.js} +1 -1
- package/dist/{chunk-LUAI5DWR.js → chunk-5PVRACZY.js} +2 -2
- package/dist/{chunk-IPKZ5FU6.js → chunk-67ZOQCUD.js} +7 -7
- package/dist/chunk-F2LYQPXV.js +77 -0
- package/dist/{chunk-JIQBLG6Y.js → chunk-LQHYVPBS.js} +6 -6
- package/dist/{chunk-ZHHJVKU7.js → chunk-WBDPDGFA.js} +59 -175
- package/dist/{chunk-5IZ2KTMU.js → chunk-WXBHP4JY.js} +1 -1
- package/dist/chunk-XIDE4TDF.js +194 -0
- package/dist/{chunk-D6TLUVOP.js → chunk-ZKVKNUJC.js} +47 -1
- package/dist/components/editor/index.js +4 -4
- package/dist/components/primitives/index.d.ts +2 -0
- package/dist/components/primitives/index.d.ts.map +1 -1
- package/dist/components/primitives/index.js +12 -5
- package/dist/components/sections/brand-guide.js +5 -5
- package/dist/components/sections/register-schemas.js +9 -9
- package/dist/components/sections/register.js +9 -9
- package/dist/index.js +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/link.d.ts.map +1 -1
- package/dist/schemas/link.js +1 -1
- package/package.json +1 -1
- package/src/components/primitives/index.ts +5 -0
- package/src/components/shared/LinkField.tsx +1 -1
- package/src/schemas/link.ts +4 -1
- package/dist/chunk-5THS4K5D.js +0 -123
- package/dist/chunk-ZSPCE6MZ.js +0 -70
|
@@ -23,7 +23,7 @@ var LinkValueSchema = z.discriminatedUnion("kind", [
|
|
|
23
23
|
target: LinkTargetSchema.describe("Where the link opens: '_self' (same tab) or '_blank' (new tab).")
|
|
24
24
|
})
|
|
25
25
|
]);
|
|
26
|
-
var DEFAULT_LINK = { kind: "
|
|
26
|
+
var DEFAULT_LINK = { kind: "internal", pageId: "", anchorSectionId: null, target: "_self" };
|
|
27
27
|
|
|
28
28
|
export {
|
|
29
29
|
LinkTargetSchema,
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Checkbox
|
|
3
|
-
|
|
4
|
-
Input
|
|
5
|
-
} from "./chunk-5THS4K5D.js";
|
|
2
|
+
Checkbox
|
|
3
|
+
} from "./chunk-F2LYQPXV.js";
|
|
6
4
|
import {
|
|
7
5
|
EditableGrid,
|
|
8
6
|
EditablePlainText,
|
|
9
7
|
MediaBlock,
|
|
10
8
|
containerGridClass,
|
|
11
9
|
useEditableCollection
|
|
12
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WXBHP4JY.js";
|
|
13
11
|
import {
|
|
14
12
|
AddIcon,
|
|
15
13
|
DeleteIcon,
|
|
16
14
|
DragHandle,
|
|
15
|
+
FormLabel,
|
|
17
16
|
IconButton,
|
|
17
|
+
Input,
|
|
18
18
|
useMediaLibrary
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZKVKNUJC.js";
|
|
20
20
|
import {
|
|
21
21
|
DEFAULT_LINK,
|
|
22
22
|
LinkValueSchema
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-3ZRQ4G5F.js";
|
|
24
24
|
import {
|
|
25
25
|
DOCUMENT_MIME_TO_EXT
|
|
26
26
|
} from "./chunk-BS5AQHZG.js";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn
|
|
3
|
+
} from "./chunk-7EOSDFS3.js";
|
|
4
|
+
|
|
5
|
+
// src/components/shared/Checkbox.tsx
|
|
6
|
+
import { useId } from "react";
|
|
7
|
+
import { Check } from "lucide-react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
function Checkbox({
|
|
10
|
+
checked,
|
|
11
|
+
onChange,
|
|
12
|
+
label,
|
|
13
|
+
description,
|
|
14
|
+
disabled,
|
|
15
|
+
className,
|
|
16
|
+
startAdornment,
|
|
17
|
+
align = "start"
|
|
18
|
+
}) {
|
|
19
|
+
const id = useId();
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
"label",
|
|
22
|
+
{
|
|
23
|
+
htmlFor: id,
|
|
24
|
+
className: cn(
|
|
25
|
+
"flex cursor-pointer gap-3 select-none hover:opacity-80",
|
|
26
|
+
align === "start" ? "items-start" : "items-center",
|
|
27
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs(
|
|
32
|
+
"span",
|
|
33
|
+
{
|
|
34
|
+
className: cn(
|
|
35
|
+
"relative flex h-5 w-5 shrink-0 items-center justify-center",
|
|
36
|
+
align === "start" && "mt-0.5"
|
|
37
|
+
),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"input",
|
|
41
|
+
{
|
|
42
|
+
id,
|
|
43
|
+
type: "checkbox",
|
|
44
|
+
checked,
|
|
45
|
+
disabled,
|
|
46
|
+
onChange: (e) => onChange(e.target.checked),
|
|
47
|
+
className: "sr-only"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
"span",
|
|
52
|
+
{
|
|
53
|
+
"aria-hidden": "true",
|
|
54
|
+
className: cn(
|
|
55
|
+
"flex h-5 w-5 items-center justify-center rounded border transition-colors",
|
|
56
|
+
checked ? "border-primary bg-primary text-primary-contrast" : "border-base-300 bg-base hover:border-primary",
|
|
57
|
+
disabled && "pointer-events-none"
|
|
58
|
+
),
|
|
59
|
+
children: checked && /* @__PURE__ */ jsx(Check, { size: 14, strokeWidth: 3 })
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
startAdornment,
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
67
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-base-contrast", children: label }),
|
|
68
|
+
description && /* @__PURE__ */ jsx("span", { className: "block text-base-contrast-light", children: description })
|
|
69
|
+
] })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
Checkbox
|
|
77
|
+
};
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
stripHtmlToPlainText,
|
|
10
10
|
trimTrailingSpacers,
|
|
11
11
|
truncate
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-67ZOQCUD.js";
|
|
13
13
|
import {
|
|
14
14
|
DeleteButton,
|
|
15
15
|
DragHandle,
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
buildBlockDropData,
|
|
24
24
|
canDropBlock,
|
|
25
25
|
isBlockDragData
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WBDPDGFA.js";
|
|
27
27
|
import {
|
|
28
28
|
EditableRichText,
|
|
29
29
|
defineHeadingSection
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-5PVRACZY.js";
|
|
31
31
|
import {
|
|
32
32
|
EditablePlainText,
|
|
33
33
|
ImageDropZone,
|
|
@@ -37,18 +37,18 @@ import {
|
|
|
37
37
|
containerGridClass,
|
|
38
38
|
masonryColumnsClass,
|
|
39
39
|
spacerHiddenClass
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-WXBHP4JY.js";
|
|
41
41
|
import {
|
|
42
42
|
useMediaLibrary,
|
|
43
43
|
useResolvedMedia
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-ZKVKNUJC.js";
|
|
45
45
|
import {
|
|
46
46
|
embedUrl
|
|
47
47
|
} from "./chunk-Y4JQGO6G.js";
|
|
48
48
|
import {
|
|
49
49
|
DEFAULT_LINK,
|
|
50
50
|
LinkValueSchema
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-3ZRQ4G5F.js";
|
|
52
52
|
import {
|
|
53
53
|
sanitizeHtml
|
|
54
54
|
} from "./chunk-72CG6AA2.js";
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Checkbox
|
|
3
|
-
|
|
4
|
-
Input
|
|
5
|
-
} from "./chunk-5THS4K5D.js";
|
|
2
|
+
Checkbox
|
|
3
|
+
} from "./chunk-F2LYQPXV.js";
|
|
6
4
|
import {
|
|
7
5
|
Button,
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
LinkField,
|
|
7
|
+
Select
|
|
8
|
+
} from "./chunk-XIDE4TDF.js";
|
|
10
9
|
import {
|
|
11
10
|
DeleteIcon,
|
|
12
11
|
DragHandle,
|
|
12
|
+
FormLabel,
|
|
13
13
|
IconButton,
|
|
14
|
+
Input,
|
|
14
15
|
SettingsIcon,
|
|
15
16
|
useMediaLibrary,
|
|
16
17
|
useResolvedMedia
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-ZKVKNUJC.js";
|
|
18
19
|
import {
|
|
19
20
|
formatFileSize
|
|
20
21
|
} from "./chunk-XBYJQ5RS.js";
|
|
@@ -100,128 +101,11 @@ function SettingsButton({ onClick }) {
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
// src/components/editor/SettingsForm.tsx
|
|
103
|
-
import { useId
|
|
104
|
-
|
|
105
|
-
// src/components/shared/Select.tsx
|
|
106
|
-
import { useId } from "react";
|
|
107
|
-
import { ChevronDown } from "lucide-react";
|
|
108
|
-
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
109
|
-
function Select({
|
|
110
|
-
label,
|
|
111
|
-
value,
|
|
112
|
-
onChange,
|
|
113
|
-
options,
|
|
114
|
-
disabled,
|
|
115
|
-
className,
|
|
116
|
-
selectClassName
|
|
117
|
-
}) {
|
|
118
|
-
const id = useId();
|
|
119
|
-
return /* @__PURE__ */ jsxs3("div", { className, children: [
|
|
120
|
-
label && /* @__PURE__ */ jsx5(FormLabel, { htmlFor: id, children: label }),
|
|
121
|
-
/* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
122
|
-
/* @__PURE__ */ jsx5(
|
|
123
|
-
"select",
|
|
124
|
-
{
|
|
125
|
-
id,
|
|
126
|
-
value,
|
|
127
|
-
onChange: (e) => onChange(e.target.value),
|
|
128
|
-
disabled,
|
|
129
|
-
className: cn(
|
|
130
|
-
"w-full appearance-none rounded border border-base-200 bg-base py-2 pr-8 pl-3 text-sm text-base-contrast",
|
|
131
|
-
"focus:border-base-contrast focus:outline-none focus:ring-1 focus:ring-base-contrast",
|
|
132
|
-
disabled && "cursor-not-allowed opacity-50",
|
|
133
|
-
selectClassName
|
|
134
|
-
),
|
|
135
|
-
children: options.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt.value, children: opt.label }, opt.value))
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
/* @__PURE__ */ jsx5(
|
|
139
|
-
ChevronDown,
|
|
140
|
-
{
|
|
141
|
-
size: 14,
|
|
142
|
-
className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-base-contrast-light"
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
] })
|
|
146
|
-
] });
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// src/components/shared/LinkField.tsx
|
|
150
|
-
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
151
|
-
var TARGET_OPTIONS = [
|
|
152
|
-
{ label: "Same tab (_self)", value: "_self" },
|
|
153
|
-
{ label: "New tab (_blank)", value: "_blank" }
|
|
154
|
-
];
|
|
155
|
-
function LinkField({ label, value, onChange }) {
|
|
156
|
-
const { pages, getPageHeadings } = usePages();
|
|
157
|
-
const isInternal = value.kind === "internal";
|
|
158
|
-
function setMode(kind) {
|
|
159
|
-
if (kind === value.kind) return;
|
|
160
|
-
onChange(kind === "external" ? { kind: "external", href: "", target: value.target } : { kind: "internal", pageId: "", anchorSectionId: null, target: "_self" });
|
|
161
|
-
}
|
|
162
|
-
const pageId = isInternal ? value.pageId : "";
|
|
163
|
-
const headings = pageId ? getPageHeadings(pageId) : [];
|
|
164
|
-
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-3", children: [
|
|
165
|
-
/* @__PURE__ */ jsx6(FormLabel, { children: label }),
|
|
166
|
-
/* @__PURE__ */ jsx6("div", { className: "flex gap-2", role: "tablist", children: ["external", "internal"].map((kind) => /* @__PURE__ */ jsx6(
|
|
167
|
-
"button",
|
|
168
|
-
{
|
|
169
|
-
type: "button",
|
|
170
|
-
role: "tab",
|
|
171
|
-
"aria-selected": value.kind === kind,
|
|
172
|
-
onClick: () => setMode(kind),
|
|
173
|
-
className: cn(
|
|
174
|
-
"cursor-pointer rounded border px-3 py-1 text-sm capitalize",
|
|
175
|
-
value.kind === kind ? "border-primary bg-primary text-primary-contrast" : "border-base-200 text-base-contrast"
|
|
176
|
-
),
|
|
177
|
-
children: kind === "external" ? "External URL" : "Internal page"
|
|
178
|
-
},
|
|
179
|
-
kind
|
|
180
|
-
)) }),
|
|
181
|
-
value.kind === "external" ? /* @__PURE__ */ jsx6(
|
|
182
|
-
Input,
|
|
183
|
-
{
|
|
184
|
-
label: "URL",
|
|
185
|
-
value: value.href,
|
|
186
|
-
placeholder: "https://...",
|
|
187
|
-
onChange: (href) => onChange({ kind: "external", href, target: value.target })
|
|
188
|
-
}
|
|
189
|
-
) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
190
|
-
/* @__PURE__ */ jsx6(
|
|
191
|
-
Select,
|
|
192
|
-
{
|
|
193
|
-
label: "Page",
|
|
194
|
-
value: value.pageId,
|
|
195
|
-
options: [{ label: "Select a page\u2026", value: "" }, ...pages.map((p) => ({ label: p.title, value: p.id }))],
|
|
196
|
-
onChange: (pid) => onChange({ kind: "internal", pageId: pid, anchorSectionId: null, target: value.target })
|
|
197
|
-
}
|
|
198
|
-
),
|
|
199
|
-
/* @__PURE__ */ jsx6(
|
|
200
|
-
Select,
|
|
201
|
-
{
|
|
202
|
-
label: "Section",
|
|
203
|
-
value: value.anchorSectionId ?? "",
|
|
204
|
-
disabled: !pageId,
|
|
205
|
-
options: [{ label: "None (top of page)", value: "" }, ...headings.map((h) => ({ label: h.label, value: h.id }))],
|
|
206
|
-
onChange: (anchor) => onChange({ kind: "internal", pageId, anchorSectionId: anchor || null, target: value.target })
|
|
207
|
-
}
|
|
208
|
-
)
|
|
209
|
-
] }),
|
|
210
|
-
value.kind === "external" && /* @__PURE__ */ jsx6(
|
|
211
|
-
Select,
|
|
212
|
-
{
|
|
213
|
-
label: "Opens in",
|
|
214
|
-
value: value.target,
|
|
215
|
-
options: TARGET_OPTIONS,
|
|
216
|
-
onChange: (t) => onChange({ ...value, target: t })
|
|
217
|
-
}
|
|
218
|
-
)
|
|
219
|
-
] });
|
|
220
|
-
}
|
|
104
|
+
import { useId, useState as useState3 } from "react";
|
|
221
105
|
|
|
222
106
|
// src/components/shared/VideoSourceField.tsx
|
|
223
107
|
import { useState } from "react";
|
|
224
|
-
import { jsx as
|
|
108
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
225
109
|
var ASPECTS = [
|
|
226
110
|
{ label: "9:16", width: 9, height: 16 },
|
|
227
111
|
{ label: "4:5", width: 4, height: 5 },
|
|
@@ -270,9 +154,9 @@ function VideoSourceField({ value, onChange }) {
|
|
|
270
154
|
setLoading(false);
|
|
271
155
|
}
|
|
272
156
|
}
|
|
273
|
-
return /* @__PURE__ */
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-3", children: [
|
|
158
|
+
/* @__PURE__ */ jsx5(FormLabel, { children: "Source" }),
|
|
159
|
+
/* @__PURE__ */ jsx5("div", { className: "flex gap-2", role: "tablist", children: ["library", "embed"].map((m) => /* @__PURE__ */ jsx5(
|
|
276
160
|
"button",
|
|
277
161
|
{
|
|
278
162
|
type: "button",
|
|
@@ -287,9 +171,9 @@ function VideoSourceField({ value, onChange }) {
|
|
|
287
171
|
},
|
|
288
172
|
m
|
|
289
173
|
)) }),
|
|
290
|
-
mode === "library" ? /* @__PURE__ */
|
|
291
|
-
libraryImageId ? resolved.poster ? /* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
174
|
+
mode === "library" ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
|
|
175
|
+
libraryImageId ? resolved.poster ? /* @__PURE__ */ jsx5("img", { src: resolved.poster, alt: "", className: "h-12 w-20 rounded object-cover" }) : /* @__PURE__ */ jsx5("span", { className: "text-sm text-base-contrast-light", children: "Video selected" }) : /* @__PURE__ */ jsx5("span", { className: "text-sm text-base-contrast-light", children: "No video selected" }),
|
|
176
|
+
/* @__PURE__ */ jsx5(
|
|
293
177
|
Button,
|
|
294
178
|
{
|
|
295
179
|
type: "button",
|
|
@@ -299,9 +183,9 @@ function VideoSourceField({ value, onChange }) {
|
|
|
299
183
|
children: "Choose video"
|
|
300
184
|
}
|
|
301
185
|
)
|
|
302
|
-
] }) : /* @__PURE__ */
|
|
303
|
-
/* @__PURE__ */
|
|
304
|
-
/* @__PURE__ */
|
|
186
|
+
] }) : /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-2", children: [
|
|
187
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
188
|
+
/* @__PURE__ */ jsx5(
|
|
305
189
|
"input",
|
|
306
190
|
{
|
|
307
191
|
type: "text",
|
|
@@ -321,7 +205,7 @@ function VideoSourceField({ value, onChange }) {
|
|
|
321
205
|
className: "flex-1 rounded border border-base-200 bg-base px-2 py-1 text-sm text-base-contrast placeholder:text-base-contrast-light focus:outline-none focus:ring-1 focus:ring-primary"
|
|
322
206
|
}
|
|
323
207
|
),
|
|
324
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ jsx5(
|
|
325
209
|
Button,
|
|
326
210
|
{
|
|
327
211
|
type: "button",
|
|
@@ -333,13 +217,13 @@ function VideoSourceField({ value, onChange }) {
|
|
|
333
217
|
}
|
|
334
218
|
)
|
|
335
219
|
] }),
|
|
336
|
-
error ? /* @__PURE__ */
|
|
337
|
-
!error && fallback ? /* @__PURE__ */
|
|
338
|
-
value?.type === "external" && value.provider === "instagram" ? /* @__PURE__ */
|
|
339
|
-
/* @__PURE__ */
|
|
220
|
+
error ? /* @__PURE__ */ jsx5("p", { className: "text-xs text-red-600", children: error }) : null,
|
|
221
|
+
!error && fallback ? /* @__PURE__ */ jsx5("p", { className: "text-xs text-base-contrast-light/70", children: "Added \u2014 couldn't fetch exact dimensions, using 16:9." }) : null,
|
|
222
|
+
value?.type === "external" && value.provider === "instagram" ? /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-2", children: [
|
|
223
|
+
/* @__PURE__ */ jsx5("span", { className: "text-xs text-base-contrast-light", children: "Aspect" }),
|
|
340
224
|
ASPECTS.map(({ label, width, height }) => {
|
|
341
225
|
const active = value.width === width && value.height === height;
|
|
342
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ jsx5(
|
|
343
227
|
"button",
|
|
344
228
|
{
|
|
345
229
|
type: "button",
|
|
@@ -373,22 +257,22 @@ function useResolvedDocument(documentId) {
|
|
|
373
257
|
}
|
|
374
258
|
|
|
375
259
|
// src/components/shared/DocumentSourceField.tsx
|
|
376
|
-
import { jsx as
|
|
260
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
377
261
|
function DocumentSourceField({ value, onChange }) {
|
|
378
262
|
const mediaLibrary = useMediaLibrary();
|
|
379
263
|
const documentId = value?.documentId || void 0;
|
|
380
264
|
const { entry, missing } = useResolvedDocument(documentId);
|
|
381
|
-
return /* @__PURE__ */
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
entry ? /* @__PURE__ */
|
|
265
|
+
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-3", children: [
|
|
266
|
+
/* @__PURE__ */ jsx6(FormLabel, { children: "Document" }),
|
|
267
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-3", children: [
|
|
268
|
+
entry ? /* @__PURE__ */ jsxs4("span", { className: "min-w-0 flex-1 truncate text-sm text-base-contrast", children: [
|
|
385
269
|
entry.filename,
|
|
386
|
-
/* @__PURE__ */
|
|
270
|
+
/* @__PURE__ */ jsxs4("span", { className: "text-base-contrast-light", children: [
|
|
387
271
|
" \xB7 ",
|
|
388
272
|
formatFileSize(entry.size)
|
|
389
273
|
] })
|
|
390
|
-
] }) : /* @__PURE__ */
|
|
391
|
-
/* @__PURE__ */
|
|
274
|
+
] }) : /* @__PURE__ */ jsx6("span", { className: "flex-1 text-sm text-base-contrast-light", children: missing ? "File missing" : "No document selected" }),
|
|
275
|
+
/* @__PURE__ */ jsx6(
|
|
392
276
|
Button,
|
|
393
277
|
{
|
|
394
278
|
type: "button",
|
|
@@ -404,7 +288,7 @@ function DocumentSourceField({ value, onChange }) {
|
|
|
404
288
|
|
|
405
289
|
// src/components/shared/Tabs.tsx
|
|
406
290
|
import { useState as useState2 } from "react";
|
|
407
|
-
import { jsx as
|
|
291
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
408
292
|
function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar }) {
|
|
409
293
|
const [uncontrolledId, setUncontrolledId] = useState2(defaultTabId ?? tabs[0]?.id);
|
|
410
294
|
const isControlled = activeTabId !== void 0;
|
|
@@ -414,8 +298,8 @@ function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar })
|
|
|
414
298
|
if (!isControlled) setUncontrolledId(id);
|
|
415
299
|
onTabChange?.(id);
|
|
416
300
|
}
|
|
417
|
-
return /* @__PURE__ */
|
|
418
|
-
/* @__PURE__ */
|
|
301
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
302
|
+
/* @__PURE__ */ jsx7("div", { className: cn("border-b border-base-200", fullBleedTabBar && "-mx-6 px-6"), children: /* @__PURE__ */ jsx7("div", { className: "flex", role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ jsx7(
|
|
419
303
|
"button",
|
|
420
304
|
{
|
|
421
305
|
type: "button",
|
|
@@ -430,12 +314,12 @@ function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar })
|
|
|
430
314
|
},
|
|
431
315
|
tab.id
|
|
432
316
|
)) }) }),
|
|
433
|
-
/* @__PURE__ */
|
|
317
|
+
/* @__PURE__ */ jsx7("div", { role: "tabpanel", className: cn("flex min-h-0 flex-1 flex-col px-px", fullBleedTabBar && "pt-4"), children: activeTab?.content })
|
|
434
318
|
] });
|
|
435
319
|
}
|
|
436
320
|
|
|
437
321
|
// src/components/editor/SettingsForm.tsx
|
|
438
|
-
import { jsx as
|
|
322
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
439
323
|
function resolveValues(schema, values) {
|
|
440
324
|
const resolved = {};
|
|
441
325
|
for (const [key, field] of Object.entries(schema)) {
|
|
@@ -474,10 +358,10 @@ function RangeField({
|
|
|
474
358
|
value,
|
|
475
359
|
onChange
|
|
476
360
|
}) {
|
|
477
|
-
const id =
|
|
478
|
-
return /* @__PURE__ */
|
|
479
|
-
/* @__PURE__ */
|
|
480
|
-
/* @__PURE__ */
|
|
361
|
+
const id = useId();
|
|
362
|
+
return /* @__PURE__ */ jsxs6("div", { children: [
|
|
363
|
+
/* @__PURE__ */ jsx8(FormLabel, { htmlFor: id, children: field.label }),
|
|
364
|
+
/* @__PURE__ */ jsx8(
|
|
481
365
|
"input",
|
|
482
366
|
{
|
|
483
367
|
id,
|
|
@@ -497,7 +381,7 @@ function RangeField({
|
|
|
497
381
|
function renderField(key, field, value, handleFieldChange) {
|
|
498
382
|
switch (field.type) {
|
|
499
383
|
case "text":
|
|
500
|
-
return /* @__PURE__ */
|
|
384
|
+
return /* @__PURE__ */ jsx8(
|
|
501
385
|
Input,
|
|
502
386
|
{
|
|
503
387
|
label: field.label,
|
|
@@ -508,7 +392,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
508
392
|
key
|
|
509
393
|
);
|
|
510
394
|
case "number":
|
|
511
|
-
return /* @__PURE__ */
|
|
395
|
+
return /* @__PURE__ */ jsx8(
|
|
512
396
|
Input,
|
|
513
397
|
{
|
|
514
398
|
label: field.label,
|
|
@@ -519,7 +403,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
519
403
|
key
|
|
520
404
|
);
|
|
521
405
|
case "checkbox":
|
|
522
|
-
return /* @__PURE__ */
|
|
406
|
+
return /* @__PURE__ */ jsx8(
|
|
523
407
|
Checkbox,
|
|
524
408
|
{
|
|
525
409
|
label: field.label,
|
|
@@ -529,7 +413,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
529
413
|
key
|
|
530
414
|
);
|
|
531
415
|
case "select":
|
|
532
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ jsx8(
|
|
533
417
|
Select,
|
|
534
418
|
{
|
|
535
419
|
label: field.label,
|
|
@@ -540,7 +424,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
540
424
|
key
|
|
541
425
|
);
|
|
542
426
|
case "range":
|
|
543
|
-
return /* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ jsx8(
|
|
544
428
|
RangeField,
|
|
545
429
|
{
|
|
546
430
|
field,
|
|
@@ -550,7 +434,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
550
434
|
key
|
|
551
435
|
);
|
|
552
436
|
case "link":
|
|
553
|
-
return /* @__PURE__ */
|
|
437
|
+
return /* @__PURE__ */ jsx8(
|
|
554
438
|
LinkField,
|
|
555
439
|
{
|
|
556
440
|
label: field.label,
|
|
@@ -560,7 +444,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
560
444
|
key
|
|
561
445
|
);
|
|
562
446
|
case "video-source":
|
|
563
|
-
return /* @__PURE__ */
|
|
447
|
+
return /* @__PURE__ */ jsx8(
|
|
564
448
|
VideoSourceField,
|
|
565
449
|
{
|
|
566
450
|
value,
|
|
@@ -569,7 +453,7 @@ function renderField(key, field, value, handleFieldChange) {
|
|
|
569
453
|
key
|
|
570
454
|
);
|
|
571
455
|
case "document-source":
|
|
572
|
-
return /* @__PURE__ */
|
|
456
|
+
return /* @__PURE__ */ jsx8(
|
|
573
457
|
DocumentSourceField,
|
|
574
458
|
{
|
|
575
459
|
value,
|
|
@@ -594,12 +478,12 @@ function SettingsForm({ schema, values, onChange, tabs }) {
|
|
|
594
478
|
const otherKeys = Object.keys(schema).filter((key) => !listed.has(key));
|
|
595
479
|
const panel = "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-px";
|
|
596
480
|
const tabItems = [
|
|
597
|
-
...tabs.map((t) => ({ id: t.label, label: t.label, content: /* @__PURE__ */
|
|
598
|
-
...otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: /* @__PURE__ */
|
|
481
|
+
...tabs.map((t) => ({ id: t.label, label: t.label, content: /* @__PURE__ */ jsx8("div", { className: panel, children: fields(t.fields) }) })),
|
|
482
|
+
...otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: /* @__PURE__ */ jsx8("div", { className: panel, children: fields(otherKeys) }) }] : []
|
|
599
483
|
];
|
|
600
|
-
return /* @__PURE__ */
|
|
484
|
+
return /* @__PURE__ */ jsx8(Tabs, { tabs: tabItems, fullBleedTabBar: true });
|
|
601
485
|
}
|
|
602
|
-
return /* @__PURE__ */
|
|
486
|
+
return /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-4", children: Object.entries(schema).map(([key, field]) => renderField(key, field, local[key], handleFieldChange)) });
|
|
603
487
|
}
|
|
604
488
|
|
|
605
489
|
// src/components/shared/Popover.tsx
|
|
@@ -655,7 +539,7 @@ function useFocusTrap(ref, active) {
|
|
|
655
539
|
}
|
|
656
540
|
|
|
657
541
|
// src/components/shared/Popover.tsx
|
|
658
|
-
import { jsx as
|
|
542
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
659
543
|
function Popover({
|
|
660
544
|
isOpen,
|
|
661
545
|
onClose,
|
|
@@ -738,7 +622,7 @@ function Popover({
|
|
|
738
622
|
if (portal) {
|
|
739
623
|
if (!fixedPos) return null;
|
|
740
624
|
return createPortal(
|
|
741
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ jsx9(
|
|
742
626
|
"div",
|
|
743
627
|
{
|
|
744
628
|
ref: panelRef,
|
|
@@ -757,7 +641,7 @@ function Popover({
|
|
|
757
641
|
document.body
|
|
758
642
|
);
|
|
759
643
|
}
|
|
760
|
-
return /* @__PURE__ */
|
|
644
|
+
return /* @__PURE__ */ jsx9(
|
|
761
645
|
"div",
|
|
762
646
|
{
|
|
763
647
|
ref: panelRef,
|
|
@@ -775,10 +659,10 @@ function Popover({
|
|
|
775
659
|
|
|
776
660
|
// src/components/shared/PopoverItem.tsx
|
|
777
661
|
import { forwardRef as forwardRef2 } from "react";
|
|
778
|
-
import { jsx as
|
|
662
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
779
663
|
var PopoverItem = forwardRef2(
|
|
780
664
|
function PopoverItem2({ className, children, ...rest }, ref) {
|
|
781
|
-
return /* @__PURE__ */
|
|
665
|
+
return /* @__PURE__ */ jsx10(
|
|
782
666
|
"button",
|
|
783
667
|
{
|
|
784
668
|
ref,
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormLabel,
|
|
3
|
+
Input
|
|
4
|
+
} from "./chunk-ZKVKNUJC.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-7EOSDFS3.js";
|
|
8
|
+
|
|
9
|
+
// src/components/shared/PagesContext.tsx
|
|
10
|
+
import { createContext, useContext } from "react";
|
|
11
|
+
var PagesContext = createContext({ pages: [], getPageHeadings: () => [] });
|
|
12
|
+
function usePages() {
|
|
13
|
+
return useContext(PagesContext);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/components/shared/Select.tsx
|
|
17
|
+
import { useId } from "react";
|
|
18
|
+
import { ChevronDown } from "lucide-react";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
function Select({
|
|
21
|
+
label,
|
|
22
|
+
value,
|
|
23
|
+
onChange,
|
|
24
|
+
options,
|
|
25
|
+
disabled,
|
|
26
|
+
className,
|
|
27
|
+
selectClassName
|
|
28
|
+
}) {
|
|
29
|
+
const id = useId();
|
|
30
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
31
|
+
label && /* @__PURE__ */ jsx(FormLabel, { htmlFor: id, children: label }),
|
|
32
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
"select",
|
|
35
|
+
{
|
|
36
|
+
id,
|
|
37
|
+
value,
|
|
38
|
+
onChange: (e) => onChange(e.target.value),
|
|
39
|
+
disabled,
|
|
40
|
+
className: cn(
|
|
41
|
+
"w-full appearance-none rounded border border-base-200 bg-base py-2 pr-8 pl-3 text-sm text-base-contrast",
|
|
42
|
+
"focus:border-base-contrast focus:outline-none focus:ring-1 focus:ring-base-contrast",
|
|
43
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
44
|
+
selectClassName
|
|
45
|
+
),
|
|
46
|
+
children: options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt.value, children: opt.label }, opt.value))
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
ChevronDown,
|
|
51
|
+
{
|
|
52
|
+
size: 14,
|
|
53
|
+
className: "pointer-events-none absolute right-2.5 top-1/2 -translate-y-1/2 text-base-contrast-light"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] })
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/components/shared/LinkField.tsx
|
|
61
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
62
|
+
var TARGET_OPTIONS = [
|
|
63
|
+
{ label: "Same tab (_self)", value: "_self" },
|
|
64
|
+
{ label: "New tab (_blank)", value: "_blank" }
|
|
65
|
+
];
|
|
66
|
+
function LinkField({ label, value, onChange }) {
|
|
67
|
+
const { pages, getPageHeadings } = usePages();
|
|
68
|
+
const isInternal = value.kind === "internal";
|
|
69
|
+
function setMode(kind) {
|
|
70
|
+
if (kind === value.kind) return;
|
|
71
|
+
onChange(kind === "external" ? { kind: "external", href: "", target: value.target } : { kind: "internal", pageId: "", anchorSectionId: null, target: "_self" });
|
|
72
|
+
}
|
|
73
|
+
const pageId = isInternal ? value.pageId : "";
|
|
74
|
+
const headings = pageId ? getPageHeadings(pageId) : [];
|
|
75
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-3", children: [
|
|
76
|
+
/* @__PURE__ */ jsx2(FormLabel, { children: label }),
|
|
77
|
+
/* @__PURE__ */ jsx2("div", { className: "flex gap-2", role: "tablist", children: ["internal", "external"].map((kind) => /* @__PURE__ */ jsx2(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
role: "tab",
|
|
82
|
+
"aria-selected": value.kind === kind,
|
|
83
|
+
onClick: () => setMode(kind),
|
|
84
|
+
className: cn(
|
|
85
|
+
"cursor-pointer rounded border px-3 py-1 text-sm capitalize",
|
|
86
|
+
value.kind === kind ? "border-primary bg-primary text-primary-contrast" : "border-base-200 text-base-contrast"
|
|
87
|
+
),
|
|
88
|
+
children: kind === "external" ? "External URL" : "Internal page"
|
|
89
|
+
},
|
|
90
|
+
kind
|
|
91
|
+
)) }),
|
|
92
|
+
value.kind === "external" ? /* @__PURE__ */ jsx2(
|
|
93
|
+
Input,
|
|
94
|
+
{
|
|
95
|
+
label: "URL",
|
|
96
|
+
value: value.href,
|
|
97
|
+
placeholder: "https://...",
|
|
98
|
+
onChange: (href) => onChange({ kind: "external", href, target: value.target })
|
|
99
|
+
}
|
|
100
|
+
) : /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx2(
|
|
102
|
+
Select,
|
|
103
|
+
{
|
|
104
|
+
label: "Page",
|
|
105
|
+
value: value.pageId,
|
|
106
|
+
options: [{ label: "Select a page\u2026", value: "" }, ...pages.map((p) => ({ label: p.title, value: p.id }))],
|
|
107
|
+
onChange: (pid) => onChange({ kind: "internal", pageId: pid, anchorSectionId: null, target: value.target })
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ jsx2(
|
|
111
|
+
Select,
|
|
112
|
+
{
|
|
113
|
+
label: "Section",
|
|
114
|
+
value: value.anchorSectionId ?? "",
|
|
115
|
+
disabled: !pageId,
|
|
116
|
+
options: [{ label: "None (top of page)", value: "" }, ...headings.map((h) => ({ label: h.label, value: h.id }))],
|
|
117
|
+
onChange: (anchor) => onChange({ kind: "internal", pageId, anchorSectionId: anchor || null, target: value.target })
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] }),
|
|
121
|
+
value.kind === "external" && /* @__PURE__ */ jsx2(
|
|
122
|
+
Select,
|
|
123
|
+
{
|
|
124
|
+
label: "Opens in",
|
|
125
|
+
value: value.target,
|
|
126
|
+
options: TARGET_OPTIONS,
|
|
127
|
+
onChange: (t) => onChange({ ...value, target: t })
|
|
128
|
+
}
|
|
129
|
+
)
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// src/components/shared/Button.tsx
|
|
134
|
+
import { forwardRef } from "react";
|
|
135
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
136
|
+
var boxSize = {
|
|
137
|
+
sm: "rounded px-3 py-1.5 text-xs font-medium",
|
|
138
|
+
md: "rounded px-4 py-2 text-sm font-medium"
|
|
139
|
+
};
|
|
140
|
+
var ghostSize = {
|
|
141
|
+
sm: "text-xs font-medium",
|
|
142
|
+
md: "text-sm font-medium"
|
|
143
|
+
};
|
|
144
|
+
var variantClasses = {
|
|
145
|
+
primary: "bg-base-contrast text-base-accent hover:bg-base-contrast/90",
|
|
146
|
+
brand: "bg-primary text-primary-contrast hover:opacity-90",
|
|
147
|
+
secondary: "border border-base-200 text-base-contrast hover:bg-base-accent",
|
|
148
|
+
destructive: "border border-red-600 text-red-600 hover:bg-red-600 hover:text-white"
|
|
149
|
+
};
|
|
150
|
+
var ghostToneClasses = {
|
|
151
|
+
neutral: "text-base-contrast-light hover:text-base-contrast",
|
|
152
|
+
destructive: "text-red-600 hover:text-red-800"
|
|
153
|
+
};
|
|
154
|
+
var Button = forwardRef(function Button2({
|
|
155
|
+
variant = "primary",
|
|
156
|
+
size = "sm",
|
|
157
|
+
tone = "neutral",
|
|
158
|
+
fullWidth = false,
|
|
159
|
+
isLoading = false,
|
|
160
|
+
loadingLabel,
|
|
161
|
+
disabled,
|
|
162
|
+
className,
|
|
163
|
+
children,
|
|
164
|
+
...rest
|
|
165
|
+
}, ref) {
|
|
166
|
+
const isGhost = variant === "ghost";
|
|
167
|
+
const resolvedDisabled = disabled || isLoading;
|
|
168
|
+
const label = isLoading && loadingLabel ? loadingLabel : children;
|
|
169
|
+
return /* @__PURE__ */ jsx3(
|
|
170
|
+
"button",
|
|
171
|
+
{
|
|
172
|
+
ref,
|
|
173
|
+
disabled: resolvedDisabled,
|
|
174
|
+
className: cn(
|
|
175
|
+
"inline-flex items-center justify-center transition-colors",
|
|
176
|
+
isGhost ? ghostSize[size] : boxSize[size],
|
|
177
|
+
isGhost ? ghostToneClasses[tone] : variantClasses[variant],
|
|
178
|
+
fullWidth && "w-full",
|
|
179
|
+
resolvedDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
180
|
+
className
|
|
181
|
+
),
|
|
182
|
+
...rest,
|
|
183
|
+
children: label
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
Button,
|
|
190
|
+
PagesContext,
|
|
191
|
+
usePages,
|
|
192
|
+
Select,
|
|
193
|
+
LinkField
|
|
194
|
+
};
|
|
@@ -106,6 +106,50 @@ var IconButton = forwardRef(
|
|
|
106
106
|
}
|
|
107
107
|
);
|
|
108
108
|
|
|
109
|
+
// src/components/shared/FormLabel.tsx
|
|
110
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
111
|
+
function FormLabel({ htmlFor, children, className }) {
|
|
112
|
+
return /* @__PURE__ */ jsx3(
|
|
113
|
+
"label",
|
|
114
|
+
{
|
|
115
|
+
htmlFor,
|
|
116
|
+
className: cn("mb-1.5 block text-sm font-medium text-base-contrast", className),
|
|
117
|
+
children
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/components/shared/Input.tsx
|
|
123
|
+
import { forwardRef as forwardRef2, useId } from "react";
|
|
124
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
125
|
+
var Input = forwardRef2(function Input2({ label, value, onChange, type = "text", className, disabled, error, ...rest }, ref) {
|
|
126
|
+
const id = useId();
|
|
127
|
+
const errorId = `${id}-error`;
|
|
128
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
129
|
+
/* @__PURE__ */ jsx4(FormLabel, { htmlFor: id, children: label }),
|
|
130
|
+
/* @__PURE__ */ jsx4(
|
|
131
|
+
"input",
|
|
132
|
+
{
|
|
133
|
+
ref,
|
|
134
|
+
id,
|
|
135
|
+
type,
|
|
136
|
+
value,
|
|
137
|
+
onChange: (e) => onChange(e.target.value),
|
|
138
|
+
disabled,
|
|
139
|
+
"aria-invalid": error ? true : void 0,
|
|
140
|
+
"aria-describedby": error ? errorId : void 0,
|
|
141
|
+
className: cn(
|
|
142
|
+
"w-full rounded border bg-base px-3 py-2 text-sm text-base-contrast focus:outline-none focus:ring-1",
|
|
143
|
+
error ? "border-red-600 focus:border-red-600 focus:ring-red-600" : "border-base-200 focus:border-base-contrast focus:ring-base-contrast",
|
|
144
|
+
disabled && "cursor-not-allowed opacity-50"
|
|
145
|
+
),
|
|
146
|
+
...rest
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
error && /* @__PURE__ */ jsx4("p", { id: errorId, className: "mt-1 text-xs text-red-600", children: error })
|
|
150
|
+
] });
|
|
151
|
+
});
|
|
152
|
+
|
|
109
153
|
export {
|
|
110
154
|
useMediaLibrary,
|
|
111
155
|
useResolvedMedia,
|
|
@@ -113,5 +157,7 @@ export {
|
|
|
113
157
|
AddIcon,
|
|
114
158
|
DeleteIcon,
|
|
115
159
|
SettingsIcon,
|
|
116
|
-
IconButton
|
|
160
|
+
IconButton,
|
|
161
|
+
FormLabel,
|
|
162
|
+
Input
|
|
117
163
|
};
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
buildBlockDropData,
|
|
12
12
|
canDropBlock,
|
|
13
13
|
isBlockDragData
|
|
14
|
-
} from "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
14
|
+
} from "../../chunk-WBDPDGFA.js";
|
|
15
|
+
import "../../chunk-F2LYQPXV.js";
|
|
16
|
+
import "../../chunk-XIDE4TDF.js";
|
|
17
17
|
import {
|
|
18
18
|
AddIcon,
|
|
19
19
|
IconButton
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-ZKVKNUJC.js";
|
|
21
21
|
import "../../chunk-XBYJQ5RS.js";
|
|
22
22
|
import "../../chunk-4RNF2DRG.js";
|
|
23
23
|
import {
|
|
@@ -7,4 +7,6 @@ export { ResolvedMedia } from "./ResolvedMedia";
|
|
|
7
7
|
export { LinkPopover } from "./LinkPopover";
|
|
8
8
|
export { defineHeadingSection } from "./defineHeadingSection";
|
|
9
9
|
export { MediaBlock } from "../sections/Media/MediaBlock";
|
|
10
|
+
export { LinkField } from "../shared/LinkField";
|
|
11
|
+
export { usePages, PagesContext, type PagesContextValue } from "../shared/PagesContext";
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAI1D,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
EditableRichText,
|
|
3
3
|
LinkPopover,
|
|
4
4
|
defineHeadingSection
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-5PVRACZY.js";
|
|
6
6
|
import {
|
|
7
7
|
EditableGrid,
|
|
8
8
|
EditablePlainText,
|
|
@@ -10,13 +10,17 @@ import {
|
|
|
10
10
|
MediaBlock,
|
|
11
11
|
ResolvedMedia,
|
|
12
12
|
useEditableCollection
|
|
13
|
-
} from "../../chunk-
|
|
14
|
-
import
|
|
13
|
+
} from "../../chunk-WXBHP4JY.js";
|
|
14
|
+
import {
|
|
15
|
+
LinkField,
|
|
16
|
+
PagesContext,
|
|
17
|
+
usePages
|
|
18
|
+
} from "../../chunk-XIDE4TDF.js";
|
|
15
19
|
import {
|
|
16
20
|
DeleteIcon,
|
|
17
21
|
DragHandle,
|
|
18
22
|
IconButton
|
|
19
|
-
} from "../../chunk-
|
|
23
|
+
} from "../../chunk-ZKVKNUJC.js";
|
|
20
24
|
import "../../chunk-XBYJQ5RS.js";
|
|
21
25
|
import "../../chunk-72CG6AA2.js";
|
|
22
26
|
import {
|
|
@@ -164,8 +168,11 @@ export {
|
|
|
164
168
|
EditablePlainText,
|
|
165
169
|
EditableRichText,
|
|
166
170
|
ImageDropZone,
|
|
171
|
+
LinkField,
|
|
167
172
|
LinkPopover,
|
|
168
173
|
MediaBlock,
|
|
174
|
+
PagesContext,
|
|
169
175
|
ResolvedMedia,
|
|
170
|
-
defineHeadingSection
|
|
176
|
+
defineHeadingSection,
|
|
177
|
+
usePages
|
|
171
178
|
};
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
ColorItemSchema,
|
|
3
3
|
ColorSpaceSchema,
|
|
4
4
|
brandGuideSectionDefs
|
|
5
|
-
} from "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
5
|
+
} from "../../chunk-67ZOQCUD.js";
|
|
6
|
+
import "../../chunk-F2LYQPXV.js";
|
|
7
|
+
import "../../chunk-WXBHP4JY.js";
|
|
8
|
+
import "../../chunk-ZKVKNUJC.js";
|
|
9
9
|
import "../../chunk-XBYJQ5RS.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-3ZRQ4G5F.js";
|
|
11
11
|
import "../../chunk-BS5AQHZG.js";
|
|
12
12
|
import "../../chunk-WDSVHKAH.js";
|
|
13
13
|
import "../../chunk-4RNF2DRG.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
allSectionDefs
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-LQHYVPBS.js";
|
|
4
|
+
import "../../chunk-67ZOQCUD.js";
|
|
5
|
+
import "../../chunk-WBDPDGFA.js";
|
|
6
|
+
import "../../chunk-F2LYQPXV.js";
|
|
7
|
+
import "../../chunk-5PVRACZY.js";
|
|
8
|
+
import "../../chunk-WXBHP4JY.js";
|
|
9
|
+
import "../../chunk-XIDE4TDF.js";
|
|
10
|
+
import "../../chunk-ZKVKNUJC.js";
|
|
11
11
|
import "../../chunk-Y4JQGO6G.js";
|
|
12
12
|
import "../../chunk-XBYJQ5RS.js";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-3ZRQ4G5F.js";
|
|
14
14
|
import "../../chunk-BS5AQHZG.js";
|
|
15
15
|
import "../../chunk-WDSVHKAH.js";
|
|
16
16
|
import "../../chunk-4RNF2DRG.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
allSectionDefs
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-LQHYVPBS.js";
|
|
4
|
+
import "../../chunk-67ZOQCUD.js";
|
|
5
|
+
import "../../chunk-WBDPDGFA.js";
|
|
6
|
+
import "../../chunk-F2LYQPXV.js";
|
|
7
|
+
import "../../chunk-5PVRACZY.js";
|
|
8
|
+
import "../../chunk-WXBHP4JY.js";
|
|
9
|
+
import "../../chunk-XIDE4TDF.js";
|
|
10
|
+
import "../../chunk-ZKVKNUJC.js";
|
|
11
11
|
import "../../chunk-Y4JQGO6G.js";
|
|
12
12
|
import "../../chunk-XBYJQ5RS.js";
|
|
13
|
-
import "../../chunk-
|
|
13
|
+
import "../../chunk-3ZRQ4G5F.js";
|
|
14
14
|
import "../../chunk-BS5AQHZG.js";
|
|
15
15
|
import "../../chunk-WDSVHKAH.js";
|
|
16
16
|
import "../../chunk-4RNF2DRG.js";
|
package/dist/index.js
CHANGED
package/dist/schemas/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/schemas/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;EAA8B,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUhD;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;2BAmB1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/schemas/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,gBAAgB;;;EAA8B,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUhD;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;2BAmB1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAKxD,eAAO,MAAM,YAAY,EAAE,SAAoF,CAAC"}
|
package/dist/schemas/link.js
CHANGED
package/package.json
CHANGED
|
@@ -9,3 +9,8 @@ export { ResolvedMedia } from "./ResolvedMedia";
|
|
|
9
9
|
export { LinkPopover } from "./LinkPopover";
|
|
10
10
|
export { defineHeadingSection } from "./defineHeadingSection";
|
|
11
11
|
export { MediaBlock } from "../sections/Media/MediaBlock";
|
|
12
|
+
// Link selector (external URL / internal page + section) plus the pages context
|
|
13
|
+
// that feeds its dropdowns, so custom sections can reuse the same link picker the
|
|
14
|
+
// Button/Media sections use and derive labels from the live page/heading list.
|
|
15
|
+
export { LinkField } from "../shared/LinkField";
|
|
16
|
+
export { usePages, PagesContext, type PagesContextValue } from "../shared/PagesContext";
|
|
@@ -35,7 +35,7 @@ export function LinkField({ label, value, onChange }: Props) {
|
|
|
35
35
|
<div className="flex flex-col gap-3">
|
|
36
36
|
<FormLabel>{label}</FormLabel>
|
|
37
37
|
<div className="flex gap-2" role="tablist">
|
|
38
|
-
{(["
|
|
38
|
+
{(["internal", "external"] as const).map((kind) => (
|
|
39
39
|
<button
|
|
40
40
|
key={kind}
|
|
41
41
|
type="button"
|
package/src/schemas/link.ts
CHANGED
|
@@ -43,4 +43,7 @@ export const LinkValueSchema = z.discriminatedUnion("kind", [
|
|
|
43
43
|
|
|
44
44
|
export type LinkValue = z.infer<typeof LinkValueSchema>;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
// Defaults to an (empty) internal link so the picker opens on the Internal-page
|
|
47
|
+
// tab everywhere it is used; an empty pageId resolves to no href, same as an
|
|
48
|
+
// empty external link, so this stays a safe "unset" sentinel.
|
|
49
|
+
export const DEFAULT_LINK: LinkValue = { kind: "internal", pageId: "", anchorSectionId: null, target: "_self" };
|
package/dist/chunk-5THS4K5D.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-7EOSDFS3.js";
|
|
4
|
-
|
|
5
|
-
// src/components/shared/FormLabel.tsx
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
function FormLabel({ htmlFor, children, className }) {
|
|
8
|
-
return /* @__PURE__ */ jsx(
|
|
9
|
-
"label",
|
|
10
|
-
{
|
|
11
|
-
htmlFor,
|
|
12
|
-
className: cn("mb-1.5 block text-sm font-medium text-base-contrast", className),
|
|
13
|
-
children
|
|
14
|
-
}
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// src/components/shared/Input.tsx
|
|
19
|
-
import { forwardRef, useId } from "react";
|
|
20
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
21
|
-
var Input = forwardRef(function Input2({ label, value, onChange, type = "text", className, disabled, error, ...rest }, ref) {
|
|
22
|
-
const id = useId();
|
|
23
|
-
const errorId = `${id}-error`;
|
|
24
|
-
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
25
|
-
/* @__PURE__ */ jsx2(FormLabel, { htmlFor: id, children: label }),
|
|
26
|
-
/* @__PURE__ */ jsx2(
|
|
27
|
-
"input",
|
|
28
|
-
{
|
|
29
|
-
ref,
|
|
30
|
-
id,
|
|
31
|
-
type,
|
|
32
|
-
value,
|
|
33
|
-
onChange: (e) => onChange(e.target.value),
|
|
34
|
-
disabled,
|
|
35
|
-
"aria-invalid": error ? true : void 0,
|
|
36
|
-
"aria-describedby": error ? errorId : void 0,
|
|
37
|
-
className: cn(
|
|
38
|
-
"w-full rounded border bg-base px-3 py-2 text-sm text-base-contrast focus:outline-none focus:ring-1",
|
|
39
|
-
error ? "border-red-600 focus:border-red-600 focus:ring-red-600" : "border-base-200 focus:border-base-contrast focus:ring-base-contrast",
|
|
40
|
-
disabled && "cursor-not-allowed opacity-50"
|
|
41
|
-
),
|
|
42
|
-
...rest
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
error && /* @__PURE__ */ jsx2("p", { id: errorId, className: "mt-1 text-xs text-red-600", children: error })
|
|
46
|
-
] });
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
// src/components/shared/Checkbox.tsx
|
|
50
|
-
import { useId as useId2 } from "react";
|
|
51
|
-
import { Check } from "lucide-react";
|
|
52
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
53
|
-
function Checkbox({
|
|
54
|
-
checked,
|
|
55
|
-
onChange,
|
|
56
|
-
label,
|
|
57
|
-
description,
|
|
58
|
-
disabled,
|
|
59
|
-
className,
|
|
60
|
-
startAdornment,
|
|
61
|
-
align = "start"
|
|
62
|
-
}) {
|
|
63
|
-
const id = useId2();
|
|
64
|
-
return /* @__PURE__ */ jsxs2(
|
|
65
|
-
"label",
|
|
66
|
-
{
|
|
67
|
-
htmlFor: id,
|
|
68
|
-
className: cn(
|
|
69
|
-
"flex cursor-pointer gap-3 select-none hover:opacity-80",
|
|
70
|
-
align === "start" ? "items-start" : "items-center",
|
|
71
|
-
disabled && "cursor-not-allowed opacity-50",
|
|
72
|
-
className
|
|
73
|
-
),
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ jsxs2(
|
|
76
|
-
"span",
|
|
77
|
-
{
|
|
78
|
-
className: cn(
|
|
79
|
-
"relative flex h-5 w-5 shrink-0 items-center justify-center",
|
|
80
|
-
align === "start" && "mt-0.5"
|
|
81
|
-
),
|
|
82
|
-
children: [
|
|
83
|
-
/* @__PURE__ */ jsx3(
|
|
84
|
-
"input",
|
|
85
|
-
{
|
|
86
|
-
id,
|
|
87
|
-
type: "checkbox",
|
|
88
|
-
checked,
|
|
89
|
-
disabled,
|
|
90
|
-
onChange: (e) => onChange(e.target.checked),
|
|
91
|
-
className: "sr-only"
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
/* @__PURE__ */ jsx3(
|
|
95
|
-
"span",
|
|
96
|
-
{
|
|
97
|
-
"aria-hidden": "true",
|
|
98
|
-
className: cn(
|
|
99
|
-
"flex h-5 w-5 items-center justify-center rounded border transition-colors",
|
|
100
|
-
checked ? "border-primary bg-primary text-primary-contrast" : "border-base-300 bg-base hover:border-primary",
|
|
101
|
-
disabled && "pointer-events-none"
|
|
102
|
-
),
|
|
103
|
-
children: checked && /* @__PURE__ */ jsx3(Check, { size: 14, strokeWidth: 3 })
|
|
104
|
-
}
|
|
105
|
-
)
|
|
106
|
-
]
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
startAdornment,
|
|
110
|
-
/* @__PURE__ */ jsxs2("div", { className: "text-sm", children: [
|
|
111
|
-
/* @__PURE__ */ jsx3("span", { className: "font-medium text-base-contrast", children: label }),
|
|
112
|
-
description && /* @__PURE__ */ jsx3("span", { className: "block text-base-contrast-light", children: description })
|
|
113
|
-
] })
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export {
|
|
120
|
-
FormLabel,
|
|
121
|
-
Input,
|
|
122
|
-
Checkbox
|
|
123
|
-
};
|
package/dist/chunk-ZSPCE6MZ.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn
|
|
3
|
-
} from "./chunk-7EOSDFS3.js";
|
|
4
|
-
|
|
5
|
-
// src/components/shared/Button.tsx
|
|
6
|
-
import { forwardRef } from "react";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
var boxSize = {
|
|
9
|
-
sm: "rounded px-3 py-1.5 text-xs font-medium",
|
|
10
|
-
md: "rounded px-4 py-2 text-sm font-medium"
|
|
11
|
-
};
|
|
12
|
-
var ghostSize = {
|
|
13
|
-
sm: "text-xs font-medium",
|
|
14
|
-
md: "text-sm font-medium"
|
|
15
|
-
};
|
|
16
|
-
var variantClasses = {
|
|
17
|
-
primary: "bg-base-contrast text-base-accent hover:bg-base-contrast/90",
|
|
18
|
-
brand: "bg-primary text-primary-contrast hover:opacity-90",
|
|
19
|
-
secondary: "border border-base-200 text-base-contrast hover:bg-base-accent",
|
|
20
|
-
destructive: "border border-red-600 text-red-600 hover:bg-red-600 hover:text-white"
|
|
21
|
-
};
|
|
22
|
-
var ghostToneClasses = {
|
|
23
|
-
neutral: "text-base-contrast-light hover:text-base-contrast",
|
|
24
|
-
destructive: "text-red-600 hover:text-red-800"
|
|
25
|
-
};
|
|
26
|
-
var Button = forwardRef(function Button2({
|
|
27
|
-
variant = "primary",
|
|
28
|
-
size = "sm",
|
|
29
|
-
tone = "neutral",
|
|
30
|
-
fullWidth = false,
|
|
31
|
-
isLoading = false,
|
|
32
|
-
loadingLabel,
|
|
33
|
-
disabled,
|
|
34
|
-
className,
|
|
35
|
-
children,
|
|
36
|
-
...rest
|
|
37
|
-
}, ref) {
|
|
38
|
-
const isGhost = variant === "ghost";
|
|
39
|
-
const resolvedDisabled = disabled || isLoading;
|
|
40
|
-
const label = isLoading && loadingLabel ? loadingLabel : children;
|
|
41
|
-
return /* @__PURE__ */ jsx(
|
|
42
|
-
"button",
|
|
43
|
-
{
|
|
44
|
-
ref,
|
|
45
|
-
disabled: resolvedDisabled,
|
|
46
|
-
className: cn(
|
|
47
|
-
"inline-flex items-center justify-center transition-colors",
|
|
48
|
-
isGhost ? ghostSize[size] : boxSize[size],
|
|
49
|
-
isGhost ? ghostToneClasses[tone] : variantClasses[variant],
|
|
50
|
-
fullWidth && "w-full",
|
|
51
|
-
resolvedDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer",
|
|
52
|
-
className
|
|
53
|
-
),
|
|
54
|
-
...rest,
|
|
55
|
-
children: label
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
// src/components/shared/PagesContext.tsx
|
|
61
|
-
import { createContext, useContext } from "react";
|
|
62
|
-
var PagesContext = createContext({ pages: [], getPageHeadings: () => [] });
|
|
63
|
-
function usePages() {
|
|
64
|
-
return useContext(PagesContext);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export {
|
|
68
|
-
Button,
|
|
69
|
-
usePages
|
|
70
|
-
};
|