@drawnagency/primitives 0.1.61 → 0.1.63

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.
Files changed (78) hide show
  1. package/dist/{chunk-UQ4OYRW7.js → chunk-2BHPWO7M.js} +54 -166
  2. package/dist/chunk-4E66N6UV.js +10 -0
  3. package/dist/chunk-5THS4K5D.js +123 -0
  4. package/dist/{chunk-TG43X7JO.js → chunk-75P6HWPN.js} +29 -5
  5. package/dist/{chunk-ODCJQOVO.js → chunk-7IMQVDDJ.js} +1 -1
  6. package/dist/{chunk-4OX3Z7SB.js → chunk-FECCYOPJ.js} +32 -671
  7. package/dist/{chunk-WLMJCNU7.js → chunk-I5737FJY.js} +0 -8
  8. package/dist/chunk-QYQ3DQHI.js +1201 -0
  9. package/dist/{chunk-BT7STGDW.js → chunk-TEYTLQVH.js} +0 -15
  10. package/dist/chunk-VMDKWUMT.js +652 -0
  11. package/dist/{chunk-AM5LZD6Q.js → chunk-ZYXLNJ5M.js} +6 -5
  12. package/dist/components/brandguide/ColorSwatchSettings.d.ts +1 -1
  13. package/dist/components/brandguide/ColorSwatchSettings.d.ts.map +1 -1
  14. package/dist/components/brandguide/Colors.d.ts +1 -1
  15. package/dist/components/brandguide/Colors.d.ts.map +1 -1
  16. package/dist/components/editor/index.js +4 -2
  17. package/dist/components/primitives/IconPicker.d.ts +1 -7
  18. package/dist/components/primitives/IconPicker.d.ts.map +1 -1
  19. package/dist/components/primitives/index.js +10 -7
  20. package/dist/components/sections/Colors/index.d.ts.map +1 -1
  21. package/dist/components/sections/Colors/schema.d.ts +19 -0
  22. package/dist/components/sections/Colors/schema.d.ts.map +1 -0
  23. package/dist/components/sections/DoDontMedia/DoDontMediaBlock.d.ts +20 -0
  24. package/dist/components/sections/DoDontMedia/DoDontMediaBlock.d.ts.map +1 -0
  25. package/dist/components/sections/DoDontMedia/index.d.ts +45 -0
  26. package/dist/components/sections/DoDontMedia/index.d.ts.map +1 -0
  27. package/dist/components/sections/IconList/DoDontToggle.d.ts +14 -0
  28. package/dist/components/sections/IconList/DoDontToggle.d.ts.map +1 -0
  29. package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
  30. package/dist/components/sections/IconList/index.d.ts.map +1 -1
  31. package/dist/components/sections/Media/MediaBlock.d.ts +1 -3
  32. package/dist/components/sections/Media/MediaBlock.d.ts.map +1 -1
  33. package/dist/components/sections/Media/index.d.ts +0 -1
  34. package/dist/components/sections/Media/index.d.ts.map +1 -1
  35. package/dist/components/sections/all-sections.d.ts +54 -18
  36. package/dist/components/sections/all-sections.d.ts.map +1 -1
  37. package/dist/components/sections/brand-guide.d.ts +84 -0
  38. package/dist/components/sections/brand-guide.d.ts.map +1 -0
  39. package/dist/components/sections/brand-guide.js +21 -0
  40. package/dist/components/sections/core-sections.d.ts +93 -0
  41. package/dist/components/sections/core-sections.d.ts.map +1 -0
  42. package/dist/components/sections/register-schemas.js +108 -1155
  43. package/dist/components/shell/EditorShell.d.ts.map +1 -1
  44. package/dist/components/shell/view-branch.d.ts +12 -0
  45. package/dist/components/shell/view-branch.d.ts.map +1 -0
  46. package/dist/index.js +29 -33
  47. package/dist/lib/index.js +4 -4
  48. package/dist/lib/loader.d.ts.map +1 -1
  49. package/dist/lib/migrate-sections-transform.d.ts.map +1 -1
  50. package/dist/lib/migrate-sections-transform.js +1 -1
  51. package/dist/lib/registry.d.ts +6 -1
  52. package/dist/lib/registry.d.ts.map +1 -1
  53. package/dist/media/index.js +1 -1
  54. package/dist/schemas/index.js +3 -7
  55. package/dist/schemas/shared.d.ts +0 -17
  56. package/dist/schemas/shared.d.ts.map +1 -1
  57. package/package.json +5 -1
  58. package/src/components/brandguide/ColorSwatchSettings.tsx +1 -1
  59. package/src/components/brandguide/Colors.tsx +1 -1
  60. package/src/components/primitives/IconPicker.tsx +27 -119
  61. package/src/components/sections/Colors/index.tsx +2 -1
  62. package/src/components/sections/Colors/schema.ts +24 -0
  63. package/src/components/sections/DoDontMedia/DoDontMediaBlock.tsx +35 -0
  64. package/src/components/sections/DoDontMedia/index.tsx +84 -0
  65. package/src/components/sections/IconList/DoDontToggle.tsx +76 -0
  66. package/src/components/sections/IconList/IconList.tsx +24 -14
  67. package/src/components/sections/IconList/index.tsx +1 -0
  68. package/src/components/sections/Media/MediaBlock.tsx +10 -11
  69. package/src/components/sections/Media/index.tsx +0 -15
  70. package/src/components/sections/all-sections.ts +7 -35
  71. package/src/components/sections/brand-guide.ts +13 -0
  72. package/src/components/sections/core-sections.ts +26 -0
  73. package/src/components/shell/EditorShell.tsx +7 -5
  74. package/src/components/shell/view-branch.ts +14 -0
  75. package/src/lib/loader.ts +10 -4
  76. package/src/lib/migrate-sections-transform.ts +33 -5
  77. package/src/lib/registry.ts +6 -1
  78. package/src/schemas/shared.ts +0 -18
@@ -1,10 +1,17 @@
1
+ import {
2
+ Checkbox,
3
+ FormLabel,
4
+ Input
5
+ } from "./chunk-5THS4K5D.js";
6
+ import {
7
+ usePages
8
+ } from "./chunk-4E66N6UV.js";
1
9
  import {
2
10
  DeleteIcon,
3
11
  DragHandle,
4
12
  IconButton,
5
- SettingsIcon,
6
- usePages
7
- } from "./chunk-WLMJCNU7.js";
13
+ SettingsIcon
14
+ } from "./chunk-I5737FJY.js";
8
15
  import {
9
16
  cn
10
17
  } from "./chunk-7EOSDFS3.js";
@@ -79,58 +86,12 @@ function SettingsButton({ onClick }) {
79
86
  }
80
87
 
81
88
  // src/components/editor/SettingsForm.tsx
82
- import { useId as useId4, useState as useState2 } from "react";
83
-
84
- // src/components/shared/Input.tsx
85
- import { forwardRef as forwardRef2, useId } from "react";
86
-
87
- // src/components/shared/FormLabel.tsx
88
- import { jsx as jsx5 } from "react/jsx-runtime";
89
- function FormLabel({ htmlFor, children, className }) {
90
- return /* @__PURE__ */ jsx5(
91
- "label",
92
- {
93
- htmlFor,
94
- className: cn("mb-1.5 block text-sm font-medium text-base-contrast", className),
95
- children
96
- }
97
- );
98
- }
99
-
100
- // src/components/shared/Input.tsx
101
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
102
- var Input = forwardRef2(function Input2({ label, value, onChange, type = "text", className, disabled, error, ...rest }, ref) {
103
- const id = useId();
104
- const errorId = `${id}-error`;
105
- return /* @__PURE__ */ jsxs3("div", { className, children: [
106
- /* @__PURE__ */ jsx6(FormLabel, { htmlFor: id, children: label }),
107
- /* @__PURE__ */ jsx6(
108
- "input",
109
- {
110
- ref,
111
- id,
112
- type,
113
- value,
114
- onChange: (e) => onChange(e.target.value),
115
- disabled,
116
- "aria-invalid": error ? true : void 0,
117
- "aria-describedby": error ? errorId : void 0,
118
- className: cn(
119
- "w-full rounded border bg-base px-3 py-2 text-sm text-base-contrast focus:outline-none focus:ring-1",
120
- error ? "border-red-600 focus:border-red-600 focus:ring-red-600" : "border-base-200 focus:border-base-contrast focus:ring-base-contrast",
121
- disabled && "cursor-not-allowed opacity-50"
122
- ),
123
- ...rest
124
- }
125
- ),
126
- error && /* @__PURE__ */ jsx6("p", { id: errorId, className: "mt-1 text-xs text-red-600", children: error })
127
- ] });
128
- });
89
+ import { useId as useId2, useState as useState2 } from "react";
129
90
 
130
91
  // src/components/shared/Select.tsx
131
- import { useId as useId2 } from "react";
92
+ import { useId } from "react";
132
93
  import { ChevronDown } from "lucide-react";
133
- import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
94
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
134
95
  function Select({
135
96
  label,
136
97
  value,
@@ -140,11 +101,11 @@ function Select({
140
101
  className,
141
102
  selectClassName
142
103
  }) {
143
- const id = useId2();
144
- return /* @__PURE__ */ jsxs4("div", { className, children: [
145
- label && /* @__PURE__ */ jsx7(FormLabel, { htmlFor: id, children: label }),
146
- /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
147
- /* @__PURE__ */ jsx7(
104
+ const id = useId();
105
+ return /* @__PURE__ */ jsxs3("div", { className, children: [
106
+ label && /* @__PURE__ */ jsx5(FormLabel, { htmlFor: id, children: label }),
107
+ /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
108
+ /* @__PURE__ */ jsx5(
148
109
  "select",
149
110
  {
150
111
  id,
@@ -157,10 +118,10 @@ function Select({
157
118
  disabled && "cursor-not-allowed opacity-50",
158
119
  selectClassName
159
120
  ),
160
- children: options.map((opt) => /* @__PURE__ */ jsx7("option", { value: opt.value, children: opt.label }, opt.value))
121
+ children: options.map((opt) => /* @__PURE__ */ jsx5("option", { value: opt.value, children: opt.label }, opt.value))
161
122
  }
162
123
  ),
163
- /* @__PURE__ */ jsx7(
124
+ /* @__PURE__ */ jsx5(
164
125
  ChevronDown,
165
126
  {
166
127
  size: 14,
@@ -171,78 +132,8 @@ function Select({
171
132
  ] });
172
133
  }
173
134
 
174
- // src/components/shared/Checkbox.tsx
175
- import { useId as useId3 } from "react";
176
- import { Check } from "lucide-react";
177
- import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
178
- function Checkbox({
179
- checked,
180
- onChange,
181
- label,
182
- description,
183
- disabled,
184
- className,
185
- startAdornment,
186
- align = "start"
187
- }) {
188
- const id = useId3();
189
- return /* @__PURE__ */ jsxs5(
190
- "label",
191
- {
192
- htmlFor: id,
193
- className: cn(
194
- "flex cursor-pointer gap-3 select-none hover:opacity-80",
195
- align === "start" ? "items-start" : "items-center",
196
- disabled && "cursor-not-allowed opacity-50",
197
- className
198
- ),
199
- children: [
200
- /* @__PURE__ */ jsxs5(
201
- "span",
202
- {
203
- className: cn(
204
- "relative flex h-5 w-5 shrink-0 items-center justify-center",
205
- align === "start" && "mt-0.5"
206
- ),
207
- children: [
208
- /* @__PURE__ */ jsx8(
209
- "input",
210
- {
211
- id,
212
- type: "checkbox",
213
- checked,
214
- disabled,
215
- onChange: (e) => onChange(e.target.checked),
216
- className: "sr-only"
217
- }
218
- ),
219
- /* @__PURE__ */ jsx8(
220
- "span",
221
- {
222
- "aria-hidden": "true",
223
- className: cn(
224
- "flex h-5 w-5 items-center justify-center rounded border transition-colors",
225
- checked ? "border-primary bg-primary text-primary-contrast" : "border-base-300 bg-base hover:border-primary",
226
- disabled && "pointer-events-none"
227
- ),
228
- children: checked && /* @__PURE__ */ jsx8(Check, { size: 14, strokeWidth: 3 })
229
- }
230
- )
231
- ]
232
- }
233
- ),
234
- startAdornment,
235
- /* @__PURE__ */ jsxs5("div", { className: "text-sm", children: [
236
- /* @__PURE__ */ jsx8("span", { className: "font-medium text-base-contrast", children: label }),
237
- description && /* @__PURE__ */ jsx8("span", { className: "block text-base-contrast-light", children: description })
238
- ] })
239
- ]
240
- }
241
- );
242
- }
243
-
244
135
  // src/components/shared/LinkField.tsx
245
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
136
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
246
137
  var TARGET_OPTIONS = [
247
138
  { label: "Same tab (_self)", value: "_self" },
248
139
  { label: "New tab (_blank)", value: "_blank" }
@@ -256,9 +147,9 @@ function LinkField({ label, value, onChange }) {
256
147
  }
257
148
  const pageId = isInternal ? value.pageId : "";
258
149
  const headings = pageId ? getPageHeadings(pageId) : [];
259
- return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3", children: [
260
- /* @__PURE__ */ jsx9(FormLabel, { children: label }),
261
- /* @__PURE__ */ jsx9("div", { className: "flex gap-2", role: "tablist", children: ["external", "internal"].map((kind) => /* @__PURE__ */ jsx9(
150
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-3", children: [
151
+ /* @__PURE__ */ jsx6(FormLabel, { children: label }),
152
+ /* @__PURE__ */ jsx6("div", { className: "flex gap-2", role: "tablist", children: ["external", "internal"].map((kind) => /* @__PURE__ */ jsx6(
262
153
  "button",
263
154
  {
264
155
  type: "button",
@@ -273,7 +164,7 @@ function LinkField({ label, value, onChange }) {
273
164
  },
274
165
  kind
275
166
  )) }),
276
- value.kind === "external" ? /* @__PURE__ */ jsx9(
167
+ value.kind === "external" ? /* @__PURE__ */ jsx6(
277
168
  Input,
278
169
  {
279
170
  label: "URL",
@@ -281,8 +172,8 @@ function LinkField({ label, value, onChange }) {
281
172
  placeholder: "https://...",
282
173
  onChange: (href) => onChange({ kind: "external", href, target: value.target })
283
174
  }
284
- ) : /* @__PURE__ */ jsxs6(Fragment2, { children: [
285
- /* @__PURE__ */ jsx9(
175
+ ) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
176
+ /* @__PURE__ */ jsx6(
286
177
  Select,
287
178
  {
288
179
  label: "Page",
@@ -291,7 +182,7 @@ function LinkField({ label, value, onChange }) {
291
182
  onChange: (pid) => onChange({ kind: "internal", pageId: pid, anchorSectionId: null, target: value.target })
292
183
  }
293
184
  ),
294
- /* @__PURE__ */ jsx9(
185
+ /* @__PURE__ */ jsx6(
295
186
  Select,
296
187
  {
297
188
  label: "Section",
@@ -302,7 +193,7 @@ function LinkField({ label, value, onChange }) {
302
193
  }
303
194
  )
304
195
  ] }),
305
- value.kind === "external" && /* @__PURE__ */ jsx9(
196
+ value.kind === "external" && /* @__PURE__ */ jsx6(
306
197
  Select,
307
198
  {
308
199
  label: "Opens in",
@@ -316,7 +207,7 @@ function LinkField({ label, value, onChange }) {
316
207
 
317
208
  // src/components/shared/Tabs.tsx
318
209
  import { useState } from "react";
319
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
210
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
320
211
  function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar }) {
321
212
  const [uncontrolledId, setUncontrolledId] = useState(defaultTabId ?? tabs[0]?.id);
322
213
  const isControlled = activeTabId !== void 0;
@@ -326,8 +217,8 @@ function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar })
326
217
  if (!isControlled) setUncontrolledId(id);
327
218
  onTabChange?.(id);
328
219
  }
329
- return /* @__PURE__ */ jsxs7("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
330
- /* @__PURE__ */ jsx10("div", { className: cn("border-b border-base-200", fullBleedTabBar && "-mx-6 px-6"), children: /* @__PURE__ */ jsx10("div", { className: "flex", role: "tablist", children: tabs.map((tab) => /* @__PURE__ */ jsx10(
220
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
221
+ /* @__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(
331
222
  "button",
332
223
  {
333
224
  type: "button",
@@ -342,12 +233,12 @@ function Tabs({ tabs, defaultTabId, activeTabId, onTabChange, fullBleedTabBar })
342
233
  },
343
234
  tab.id
344
235
  )) }) }),
345
- /* @__PURE__ */ jsx10("div", { role: "tabpanel", children: activeTab?.content })
236
+ /* @__PURE__ */ jsx7("div", { role: "tabpanel", children: activeTab?.content })
346
237
  ] });
347
238
  }
348
239
 
349
240
  // src/components/editor/SettingsForm.tsx
350
- import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
241
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
351
242
  function resolveValues(schema, values) {
352
243
  const resolved = {};
353
244
  for (const [key, field] of Object.entries(schema)) {
@@ -386,10 +277,10 @@ function RangeField({
386
277
  value,
387
278
  onChange
388
279
  }) {
389
- const id = useId4();
390
- return /* @__PURE__ */ jsxs8("div", { children: [
391
- /* @__PURE__ */ jsx11(FormLabel, { htmlFor: id, children: field.label }),
392
- /* @__PURE__ */ jsx11(
280
+ const id = useId2();
281
+ return /* @__PURE__ */ jsxs6("div", { children: [
282
+ /* @__PURE__ */ jsx8(FormLabel, { htmlFor: id, children: field.label }),
283
+ /* @__PURE__ */ jsx8(
393
284
  "input",
394
285
  {
395
286
  id,
@@ -409,7 +300,7 @@ function RangeField({
409
300
  function renderField(key, field, value, handleFieldChange) {
410
301
  switch (field.type) {
411
302
  case "text":
412
- return /* @__PURE__ */ jsx11(
303
+ return /* @__PURE__ */ jsx8(
413
304
  Input,
414
305
  {
415
306
  label: field.label,
@@ -420,7 +311,7 @@ function renderField(key, field, value, handleFieldChange) {
420
311
  key
421
312
  );
422
313
  case "number":
423
- return /* @__PURE__ */ jsx11(
314
+ return /* @__PURE__ */ jsx8(
424
315
  Input,
425
316
  {
426
317
  label: field.label,
@@ -431,7 +322,7 @@ function renderField(key, field, value, handleFieldChange) {
431
322
  key
432
323
  );
433
324
  case "checkbox":
434
- return /* @__PURE__ */ jsx11(
325
+ return /* @__PURE__ */ jsx8(
435
326
  Checkbox,
436
327
  {
437
328
  label: field.label,
@@ -441,7 +332,7 @@ function renderField(key, field, value, handleFieldChange) {
441
332
  key
442
333
  );
443
334
  case "select":
444
- return /* @__PURE__ */ jsx11(
335
+ return /* @__PURE__ */ jsx8(
445
336
  Select,
446
337
  {
447
338
  label: field.label,
@@ -452,7 +343,7 @@ function renderField(key, field, value, handleFieldChange) {
452
343
  key
453
344
  );
454
345
  case "range":
455
- return /* @__PURE__ */ jsx11(
346
+ return /* @__PURE__ */ jsx8(
456
347
  RangeField,
457
348
  {
458
349
  field,
@@ -462,7 +353,7 @@ function renderField(key, field, value, handleFieldChange) {
462
353
  key
463
354
  );
464
355
  case "link":
465
- return /* @__PURE__ */ jsx11(
356
+ return /* @__PURE__ */ jsx8(
466
357
  LinkField,
467
358
  {
468
359
  label: field.label,
@@ -487,12 +378,12 @@ function SettingsForm({ schema, values, onChange, tabs }) {
487
378
  const listed = new Set(tabs.flatMap((t) => t.fields));
488
379
  const otherKeys = Object.keys(schema).filter((key) => !listed.has(key));
489
380
  const tabItems = [
490
- ...tabs.map((t) => ({ id: t.label, label: t.label, content: /* @__PURE__ */ jsx11("div", { className: "flex flex-col gap-4", children: fields(t.fields) }) })),
491
- ...otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: /* @__PURE__ */ jsx11("div", { className: "flex flex-col gap-4", children: fields(otherKeys) }) }] : []
381
+ ...tabs.map((t) => ({ id: t.label, label: t.label, content: /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-4", children: fields(t.fields) }) })),
382
+ ...otherKeys.length > 0 ? [{ id: "__other__", label: "Other", content: /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-4", children: fields(otherKeys) }) }] : []
492
383
  ];
493
- return /* @__PURE__ */ jsx11(Tabs, { tabs: tabItems, fullBleedTabBar: true });
384
+ return /* @__PURE__ */ jsx8(Tabs, { tabs: tabItems, fullBleedTabBar: true });
494
385
  }
495
- return /* @__PURE__ */ jsx11("div", { className: "flex flex-col gap-4", children: Object.entries(schema).map(([key, field]) => renderField(key, field, local[key], handleFieldChange)) });
386
+ return /* @__PURE__ */ jsx8("div", { className: "flex flex-col gap-4", children: Object.entries(schema).map(([key, field]) => renderField(key, field, local[key], handleFieldChange)) });
496
387
  }
497
388
 
498
389
  // src/components/shared/Popover.tsx
@@ -547,7 +438,7 @@ function useFocusTrap(ref, active) {
547
438
  }
548
439
 
549
440
  // src/components/shared/Popover.tsx
550
- import { jsx as jsx12 } from "react/jsx-runtime";
441
+ import { jsx as jsx9 } from "react/jsx-runtime";
551
442
  function Popover({
552
443
  isOpen,
553
444
  onClose,
@@ -597,7 +488,7 @@ function Popover({
597
488
  }, [isOpen, onClose, anchorRef]);
598
489
  if (!isOpen) return null;
599
490
  const effectiveAlign = align === "auto" ? resolvedAlign : align;
600
- return /* @__PURE__ */ jsx12(
491
+ return /* @__PURE__ */ jsx9(
601
492
  "div",
602
493
  {
603
494
  ref: panelRef,
@@ -614,11 +505,11 @@ function Popover({
614
505
  }
615
506
 
616
507
  // src/components/shared/PopoverItem.tsx
617
- import { forwardRef as forwardRef3 } from "react";
618
- import { jsx as jsx13 } from "react/jsx-runtime";
619
- var PopoverItem = forwardRef3(
508
+ import { forwardRef as forwardRef2 } from "react";
509
+ import { jsx as jsx10 } from "react/jsx-runtime";
510
+ var PopoverItem = forwardRef2(
620
511
  function PopoverItem2({ className, children, ...rest }, ref) {
621
- return /* @__PURE__ */ jsx13(
512
+ return /* @__PURE__ */ jsx10(
622
513
  "button",
623
514
  {
624
515
  ref,
@@ -652,9 +543,6 @@ function canDropBlock(source, dropContainerId) {
652
543
  }
653
544
 
654
545
  export {
655
- FormLabel,
656
- Input,
657
- Checkbox,
658
546
  Tooltip,
659
547
  Kbd,
660
548
  DragHandle2 as DragHandle,
@@ -0,0 +1,10 @@
1
+ // src/components/shared/PagesContext.tsx
2
+ import { createContext, useContext } from "react";
3
+ var PagesContext = createContext({ pages: [], getPageHeadings: () => [] });
4
+ function usePages() {
5
+ return useContext(PagesContext);
6
+ }
7
+
8
+ export {
9
+ usePages
10
+ };
@@ -0,0 +1,123 @@
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
+ };
@@ -3,11 +3,31 @@ var RETIRED = /* @__PURE__ */ new Set(["split_content", "media_grid", "do_dont_g
3
3
  function upgradeLegacySection(raw) {
4
4
  if (!raw || typeof raw !== "object") return raw;
5
5
  const section = raw;
6
- if (!RETIRED.has(section.type)) return raw;
7
- if (section.type === "split_content") return upgradeSplitContent(section);
8
- if (section.type === "do_dont") return upgradeDoDont(section);
6
+ const type = section.type;
7
+ if (type === "media" && hasDoDont(section)) return { ...section, type: "dodont_media" };
8
+ if (type === "container") return upgradeContainerChildren(section);
9
+ if (!RETIRED.has(type)) return raw;
10
+ if (type === "split_content") return upgradeSplitContent(section);
11
+ if (type === "do_dont") return upgradeDoDont(section);
9
12
  return upgradeGrid(section);
10
13
  }
14
+ function hasDoDont(section) {
15
+ const content = section.content;
16
+ return !!content && typeof content === "object" && content.dodont != null;
17
+ }
18
+ function upgradeContainerChildren(section) {
19
+ const content = section.content;
20
+ const children = content && Array.isArray(content.children) ? content.children : null;
21
+ if (!children) return section;
22
+ let changed = false;
23
+ const mapped = children.map((child) => {
24
+ const up = upgradeLegacySection(child);
25
+ if (up !== child) changed = true;
26
+ return up;
27
+ });
28
+ if (!changed) return section;
29
+ return { ...section, content: { ...content, children: mapped } };
30
+ }
11
31
  function buildRef(item, forceImage) {
12
32
  const type = forceImage ? "image" : item.type;
13
33
  const ref = { type, imageId: item.imageId ?? "" };
@@ -26,16 +46,20 @@ function buildRef(item, forceImage) {
26
46
  }
27
47
  function mapRefItem(item, parentId, index) {
28
48
  const content = {};
49
+ let type = "media";
29
50
  if (item.type === "linkedImage") {
30
51
  content.ref = buildRef(item, true);
31
52
  content.link = { kind: "external", href: item.href ?? "", target: item.target === "_blank" ? "_blank" : "_self" };
32
53
  } else if (item.type === "doDontImage") {
33
54
  content.ref = buildRef(item, true);
34
- if (item.doDont !== void 0) content.dodont = item.doDont;
55
+ if (item.doDont !== void 0) {
56
+ content.dodont = item.doDont;
57
+ type = "dodont_media";
58
+ }
35
59
  } else {
36
60
  content.ref = buildRef(item, false);
37
61
  }
38
- return { id: `${parentId}__media_${index}`, type: "media", content, options: {} };
62
+ return { id: `${parentId}__media_${index}`, type, content, options: {} };
39
63
  }
40
64
  function upgradeGrid(section) {
41
65
  const id = section.id;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HexColorSchema
3
- } from "./chunk-BT7STGDW.js";
3
+ } from "./chunk-TEYTLQVH.js";
4
4
 
5
5
  // src/schemas/audience.ts
6
6
  import { z } from "zod";