@drawnagency/primitives 0.1.55 → 0.1.57
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/auth/cookies.d.ts.map +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/{chunk-24SUF2BC.js → chunk-ICLXLWQ5.js} +13 -74
- package/dist/chunk-NSCT3AMV.js +32 -0
- package/dist/{chunk-KDGYHU36.js → chunk-PRKUXM7E.js} +35 -10
- package/dist/{chunk-PUNXQK4M.js → chunk-PYWS3MOJ.js} +12 -2
- package/dist/chunk-TG43X7JO.js +123 -0
- package/dist/chunk-VKAGMEKE.js +90 -0
- package/dist/{chunk-B5VYSTPB.js → chunk-XTK4BR27.js} +1 -1
- package/dist/components/editor/ChildBlockWrapper.d.ts +19 -0
- package/dist/components/editor/ChildBlockWrapper.d.ts.map +1 -0
- package/dist/components/editor/ColSpanControl.d.ts +9 -0
- package/dist/components/editor/ColSpanControl.d.ts.map +1 -0
- package/dist/components/editor/SectionWrapper.d.ts +1 -1
- package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
- package/dist/components/editor/SettingsForm.d.ts +5 -1
- package/dist/components/editor/SettingsForm.d.ts.map +1 -1
- package/dist/components/primitives/EditableGrid.d.ts.map +1 -1
- package/dist/components/primitives/IconPicker.d.ts +7 -1
- package/dist/components/primitives/IconPicker.d.ts.map +1 -1
- package/dist/components/sections/Container/Container.d.ts +20 -0
- package/dist/components/sections/Container/Container.d.ts.map +1 -0
- package/dist/components/sections/Container/ContainerSettingsForm.d.ts +17 -0
- package/dist/components/sections/Container/ContainerSettingsForm.d.ts.map +1 -0
- package/dist/components/sections/Container/index.d.ts +11 -0
- package/dist/components/sections/Container/index.d.ts.map +1 -0
- package/dist/components/sections/IconList/IconList.d.ts +1 -0
- package/dist/components/sections/IconList/IconList.d.ts.map +1 -1
- package/dist/components/sections/IconList/IconListSettings.d.ts +3 -4
- package/dist/components/sections/IconList/IconListSettings.d.ts.map +1 -1
- package/dist/components/sections/IconList/index.d.ts +1 -0
- package/dist/components/sections/IconList/index.d.ts.map +1 -1
- package/dist/components/sections/Media/MediaBlock.d.ts +19 -0
- package/dist/components/sections/Media/MediaBlock.d.ts.map +1 -0
- package/dist/components/sections/{MediaGrid → Media}/index.d.ts +15 -25
- package/dist/components/sections/Media/index.d.ts.map +1 -0
- package/dist/components/sections/Prose/index.d.ts.map +1 -1
- package/dist/components/sections/Spacer/Spacer.d.ts +2 -0
- package/dist/components/sections/Spacer/Spacer.d.ts.map +1 -0
- package/dist/components/sections/Spacer/index.d.ts +6 -0
- package/dist/components/sections/Spacer/index.d.ts.map +1 -0
- package/dist/components/sections/all-sections.d.ts +140 -0
- package/dist/components/sections/all-sections.d.ts.map +1 -0
- package/dist/components/sections/register-schemas.d.ts.map +1 -1
- package/dist/components/sections/register.d.ts.map +1 -1
- package/dist/components/shared/Tabs.d.ts +24 -0
- package/dist/components/shared/Tabs.d.ts.map +1 -0
- package/dist/components/shell/EditorShell.d.ts +2 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsModal.d.ts.map +1 -1
- package/dist/components/shell/blockMoveDispatch.d.ts +21 -0
- package/dist/components/shell/blockMoveDispatch.d.ts.map +1 -0
- package/dist/hooks/useBlockDnd.d.ts +48 -0
- package/dist/hooks/useBlockDnd.d.ts.map +1 -0
- package/dist/hooks/useEditorPublish.d.ts +2 -1
- package/dist/hooks/useEditorPublish.d.ts.map +1 -1
- package/dist/index.js +69 -48
- package/dist/lib/block-dnd.d.ts +42 -0
- package/dist/lib/block-dnd.d.ts.map +1 -0
- package/dist/lib/block-move.d.ts +31 -0
- package/dist/lib/block-move.d.ts.map +1 -0
- package/dist/lib/container-grid.d.ts +29 -0
- package/dist/lib/container-grid.d.ts.map +1 -0
- package/dist/lib/container-ops.d.ts +44 -0
- package/dist/lib/container-ops.d.ts.map +1 -0
- package/dist/lib/dexie.d.ts +12 -1
- package/dist/lib/dexie.d.ts.map +1 -1
- package/dist/lib/dexie.js +28 -3
- package/dist/lib/index.js +10 -7
- package/dist/lib/loader.d.ts.map +1 -1
- package/dist/lib/migrate-sections-transform.d.ts +12 -0
- package/dist/lib/migrate-sections-transform.d.ts.map +1 -0
- package/dist/lib/migrate-sections-transform.js +6 -0
- package/dist/lib/registry.d.ts +39 -2
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/lib/registry.js +26 -0
- package/dist/lib/sanitize.d.ts.map +1 -1
- package/dist/schemas/block.d.ts +20 -0
- package/dist/schemas/block.d.ts.map +1 -0
- package/dist/schemas/block.js +14 -0
- package/dist/schemas/index.js +10 -2
- package/dist/schemas/link.d.ts +7 -0
- package/dist/schemas/link.d.ts.map +1 -1
- package/dist/schemas/rich-text.d.ts +9 -0
- package/dist/schemas/rich-text.d.ts.map +1 -0
- package/dist/schemas/sections.d.ts +2 -0
- package/dist/schemas/sections.d.ts.map +1 -1
- package/dist/schemas/shared.d.ts +31 -0
- package/dist/schemas/shared.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/types.d.ts +13 -1
- package/dist/storage/types.d.ts.map +1 -1
- package/package.json +13 -1
- package/src/auth/cookies.ts +6 -1
- package/src/components/brandguide/Colors.tsx +35 -33
- package/src/components/editor/ChildBlockWrapper.tsx +108 -0
- package/src/components/editor/ColSpanControl.tsx +56 -0
- package/src/components/editor/SectionWrapper.tsx +44 -20
- package/src/components/editor/SettingsForm.tsx +100 -73
- package/src/components/primitives/EditableGrid.tsx +40 -36
- package/src/components/primitives/IconPicker.tsx +116 -26
- package/src/components/sections/Container/Container.tsx +354 -0
- package/src/components/sections/Container/ContainerSettingsForm.tsx +113 -0
- package/src/components/sections/Container/index.tsx +51 -0
- package/src/components/sections/IconList/IconList.tsx +113 -43
- package/src/components/sections/IconList/IconListSettings.tsx +2 -2
- package/src/components/sections/IconList/index.tsx +1 -1
- package/src/components/sections/Media/MediaBlock.tsx +103 -0
- package/src/components/sections/Media/index.tsx +85 -0
- package/src/components/sections/Prose/index.tsx +1 -0
- package/src/components/sections/Spacer/Spacer.tsx +6 -0
- package/src/components/sections/Spacer/index.tsx +18 -0
- package/src/components/sections/all-sections.ts +40 -0
- package/src/components/sections/register-schemas.ts +13 -18
- package/src/components/sections/register.ts +3 -17
- package/src/components/shared/Tabs.tsx +63 -0
- package/src/components/shell/EditorShell.tsx +147 -18
- package/src/components/shell/SiteSettingsModal.tsx +41 -51
- package/src/components/shell/blockMoveDispatch.ts +40 -0
- package/src/hooks/useBlockDnd.ts +144 -0
- package/src/hooks/useEditorPublish.ts +17 -4
- package/src/lib/block-dnd.ts +58 -0
- package/src/lib/block-move.ts +236 -0
- package/src/lib/container-grid.ts +58 -0
- package/src/lib/container-ops.ts +159 -0
- package/src/lib/dexie.ts +47 -0
- package/src/lib/loader.ts +16 -4
- package/src/lib/migrate-sections-transform.ts +147 -0
- package/src/lib/registry.ts +48 -2
- package/src/lib/sanitize.ts +22 -1
- package/src/schemas/block.ts +40 -0
- package/src/schemas/link.ts +19 -1
- package/src/schemas/rich-text.ts +11 -0
- package/src/schemas/sections.ts +5 -1
- package/src/schemas/shared.ts +16 -0
- package/src/schemas/site-config.ts +3 -3
- package/src/storage/index.ts +1 -0
- package/src/storage/types.ts +17 -0
- package/dist/components/brandguide/DoDontList.d.ts +0 -16
- package/dist/components/brandguide/DoDontList.d.ts.map +0 -1
- package/dist/components/brandguide/DoDontMediaGrid.d.ts +0 -16
- package/dist/components/brandguide/DoDontMediaGrid.d.ts.map +0 -1
- package/dist/components/primitives/MediaSettingsForms.d.ts +0 -23
- package/dist/components/primitives/MediaSettingsForms.d.ts.map +0 -1
- package/dist/components/sections/DoDontList/index.d.ts +0 -21
- package/dist/components/sections/DoDontList/index.d.ts.map +0 -1
- package/dist/components/sections/DoDontMediaGrid/index.d.ts +0 -55
- package/dist/components/sections/DoDontMediaGrid/index.d.ts.map +0 -1
- package/dist/components/sections/MediaGrid/MediaGrid.d.ts +0 -17
- package/dist/components/sections/MediaGrid/MediaGrid.d.ts.map +0 -1
- package/dist/components/sections/MediaGrid/index.d.ts.map +0 -1
- package/dist/components/sections/SplitContent/SplitContent.d.ts +0 -14
- package/dist/components/sections/SplitContent/SplitContent.d.ts.map +0 -1
- package/dist/components/sections/SplitContent/index.d.ts +0 -13
- package/dist/components/sections/SplitContent/index.d.ts.map +0 -1
- package/src/components/brandguide/DoDontList.d.ts.map +0 -1
- package/src/components/brandguide/DoDontList.tsx +0 -67
- package/src/components/brandguide/DoDontMediaGrid.d.ts.map +0 -1
- package/src/components/brandguide/DoDontMediaGrid.tsx +0 -19
- package/src/components/primitives/MediaSettingsForms.tsx +0 -128
- package/src/components/sections/DoDontList/index.d.ts.map +0 -1
- package/src/components/sections/DoDontList/index.tsx +0 -45
- package/src/components/sections/DoDontMediaGrid/index.d.ts.map +0 -1
- package/src/components/sections/DoDontMediaGrid/index.tsx +0 -63
- package/src/components/sections/MediaGrid/MediaGrid.d.ts.map +0 -1
- package/src/components/sections/MediaGrid/MediaGrid.tsx +0 -239
- package/src/components/sections/MediaGrid/index.d.ts.map +0 -1
- package/src/components/sections/MediaGrid/index.tsx +0 -57
- package/src/components/sections/SplitContent/SplitContent.d.ts.map +0 -1
- package/src/components/sections/SplitContent/SplitContent.tsx +0 -84
- package/src/components/sections/SplitContent/index.d.ts.map +0 -1
- package/src/components/sections/SplitContent/index.tsx +0 -55
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Marks a schema field as HTML rich text. Readability marker only — the runtime
|
|
5
|
+
* source of truth for sanitization is each block definition's `richTextFields`
|
|
6
|
+
* list (see registry). Kept as a helper so schemas read self-documentingly
|
|
7
|
+
* (`body: richText()`) and a future Zod version could make it introspectable.
|
|
8
|
+
*/
|
|
9
|
+
export function richText() {
|
|
10
|
+
return z.string();
|
|
11
|
+
}
|
package/src/schemas/sections.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getAllSchemas } from "../lib/registry";
|
|
3
|
+
import { LayoutEnvelopeSchema, type LayoutEnvelope } from "./block";
|
|
3
4
|
|
|
4
5
|
export interface SectionContent<C = Record<string, unknown>> {
|
|
5
6
|
type: string;
|
|
@@ -9,6 +10,7 @@ export interface SectionContent<C = Record<string, unknown>> {
|
|
|
9
10
|
|
|
10
11
|
export interface Section<C = Record<string, unknown>> extends SectionContent<C> {
|
|
11
12
|
id: string;
|
|
13
|
+
layout?: LayoutEnvelope;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export function getSectionContentSchema(): z.ZodType<SectionContent> {
|
|
@@ -20,5 +22,7 @@ export function getSectionContentSchema(): z.ZodType<SectionContent> {
|
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export function getSectionSchema(): z.ZodType<Section> {
|
|
23
|
-
return z
|
|
25
|
+
return z
|
|
26
|
+
.object({ id: z.string(), layout: LayoutEnvelopeSchema.optional() })
|
|
27
|
+
.and(getSectionContentSchema()) as z.ZodType<Section>;
|
|
24
28
|
}
|
package/src/schemas/shared.ts
CHANGED
|
@@ -71,11 +71,27 @@ export const MediaReferenceSchema = z.discriminatedUnion("type", [
|
|
|
71
71
|
|
|
72
72
|
export type MediaReference = z.infer<typeof MediaReferenceSchema>;
|
|
73
73
|
|
|
74
|
+
/** A single image or video reference — for the standalone `media` block
|
|
75
|
+
* (excludes the grid-only doDontImage/linkedImage variants). */
|
|
76
|
+
export const SingleMediaReferenceSchema = z.discriminatedUnion("type", [ImageRef, VideoRef]);
|
|
77
|
+
|
|
78
|
+
export type SingleMediaReference = z.infer<typeof SingleMediaReferenceSchema>;
|
|
79
|
+
|
|
74
80
|
// --- Colors ---
|
|
75
81
|
export const HexColorSchema = z
|
|
76
82
|
.string()
|
|
77
83
|
.regex(/^#[0-9a-fA-F]{6}$/, "must be a 6-digit hex color");
|
|
78
84
|
|
|
85
|
+
// Font-family names are interpolated raw into the `style` attribute on <html>
|
|
86
|
+
// (`--font-heading: ${headingFont}, ...`). Astro HTML-escapes the attribute, so
|
|
87
|
+
// the residual risk is CSS-declaration injection via `;`/`{}`. Allow only the
|
|
88
|
+
// characters legitimate font names use (letters, digits, spaces, commas for
|
|
89
|
+
// fallback lists, quotes for quoted names, hyphens) and bound the length.
|
|
90
|
+
export const FontNameSchema = z
|
|
91
|
+
.string()
|
|
92
|
+
.max(120)
|
|
93
|
+
.regex(/^[a-zA-Z0-9 ,'"-]+$/, "contains invalid font-name characters");
|
|
94
|
+
|
|
79
95
|
export const ColorSpaceSchema = z.object({
|
|
80
96
|
hex: HexColorSchema.optional(),
|
|
81
97
|
rgb: z.string().optional(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { MediaConfigSchema } from "./media";
|
|
3
|
-
import { HexColorSchema } from "./shared";
|
|
3
|
+
import { HexColorSchema, FontNameSchema } from "./shared";
|
|
4
4
|
|
|
5
5
|
const StatusSchema = z.enum(["draft", "live", "archived", "published"]).transform(
|
|
6
6
|
(val) => val === "published" ? "live" as const : val,
|
|
@@ -137,8 +137,8 @@ export const SiteConfigSchema = z.object({
|
|
|
137
137
|
primaryColor: HexColorSchema.default("#009ca6"),
|
|
138
138
|
primaryContrast: HexColorSchema.default("#f0f0f0"),
|
|
139
139
|
darkMode: z.enum(["light", "dark", "optional"]).default("light"),
|
|
140
|
-
headingFont:
|
|
141
|
-
bodyFont:
|
|
140
|
+
headingFont: FontNameSchema.default("system-ui"),
|
|
141
|
+
bodyFont: FontNameSchema.default("system-ui"),
|
|
142
142
|
uppercaseHeadings: z.boolean().default(true),
|
|
143
143
|
uppercaseSubheadings: z.boolean().default(true),
|
|
144
144
|
uppercaseNavHeadings: z.boolean().default(true),
|
package/src/storage/index.ts
CHANGED
package/src/storage/types.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by `writeFiles` when `options.baseVersion` no longer matches the
|
|
3
|
+
* draft's current version — i.e. another editor (or the same user on another
|
|
4
|
+
* device) committed since this editor loaded. Callers should surface a 409 and
|
|
5
|
+
* prompt a reload rather than clobbering the concurrent work (last-write-wins).
|
|
6
|
+
*/
|
|
7
|
+
export class StorageConflictError extends Error {
|
|
8
|
+
constructor(public readonly currentVersion: string | null) {
|
|
9
|
+
super("Draft has been modified since it was loaded");
|
|
10
|
+
this.name = "StorageConflictError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
1
14
|
export interface StorageProvider {
|
|
2
15
|
writeFiles(
|
|
3
16
|
files: FileWrite[],
|
|
4
17
|
message: string,
|
|
18
|
+
// `baseVersion` is the draft version the edits were based on. When present,
|
|
19
|
+
// the write is rejected with StorageConflictError if the draft has moved
|
|
20
|
+
// since (null means "expected no draft to exist yet").
|
|
21
|
+
options?: { baseVersion?: string | null },
|
|
5
22
|
): Promise<{ version: string }>;
|
|
6
23
|
|
|
7
24
|
readFile(
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { SectionContent } from "../../schemas/sections";
|
|
2
|
-
interface DoDontItem {
|
|
3
|
-
label: string;
|
|
4
|
-
text: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
}
|
|
7
|
-
interface Props {
|
|
8
|
-
doItems: DoDontItem[];
|
|
9
|
-
dontItems: DoDontItem[];
|
|
10
|
-
showLabel?: boolean;
|
|
11
|
-
stackText?: boolean;
|
|
12
|
-
onChange?: (content: SectionContent) => void;
|
|
13
|
-
}
|
|
14
|
-
export default function DoDontList({ doItems, dontItems, showLabel, stackText, onChange, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=DoDontList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DoDontList.d.ts","sourceRoot":"","sources":["../../../src/components/brandguide/DoDontList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,KAAK;IACb,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,UAAU,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,OAAO,EACP,SAAS,EACT,SAAgB,EAChB,SAAiB,EACjB,QAAQ,GACT,EAAE,KAAK,2CA0CP"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { MediaReference } from "../../schemas/shared";
|
|
3
|
-
import type { SectionContent } from "../../schemas/sections";
|
|
4
|
-
interface Props {
|
|
5
|
-
media: MediaReference[];
|
|
6
|
-
columns: number;
|
|
7
|
-
square?: boolean;
|
|
8
|
-
border?: boolean;
|
|
9
|
-
crop?: boolean;
|
|
10
|
-
showCaptions?: boolean;
|
|
11
|
-
onChange?: (content: SectionContent) => void;
|
|
12
|
-
openModal?: (title: string, content: ReactNode) => void;
|
|
13
|
-
}
|
|
14
|
-
export default function DoDontMediaGrid(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=DoDontMediaGrid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DoDontMediaGrid.d.ts","sourceRoot":"","sources":["../../../src/components/brandguide/DoDontMediaGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,UAAU,KAAK;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,KAAK,2CAEnD"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare function ImageSettingsForm({ border, objectFit, invertFrom: initialInvertFrom, onChange, }: {
|
|
2
|
-
border?: boolean;
|
|
3
|
-
objectFit?: "cover" | "contain";
|
|
4
|
-
invertFrom?: string;
|
|
5
|
-
onChange: (update: {
|
|
6
|
-
border?: boolean;
|
|
7
|
-
objectFit?: "cover" | "contain";
|
|
8
|
-
invertFrom?: string;
|
|
9
|
-
}) => void;
|
|
10
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare function DoDontImageSettingsForm({ border, objectFit, invertFrom, doDont: initialDoDont, onChange, }: {
|
|
12
|
-
border?: boolean;
|
|
13
|
-
objectFit?: "cover" | "contain";
|
|
14
|
-
invertFrom?: string;
|
|
15
|
-
doDont: "do" | "dont";
|
|
16
|
-
onChange: (update: {
|
|
17
|
-
border?: boolean;
|
|
18
|
-
objectFit?: "cover" | "contain";
|
|
19
|
-
invertFrom?: string;
|
|
20
|
-
doDont: "do" | "dont";
|
|
21
|
-
}) => void;
|
|
22
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
//# sourceMappingURL=MediaSettingsForms.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MediaSettingsForms.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/MediaSettingsForms.tsx"],"names":[],"mappings":"AAMA,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,SAAS,EACT,UAAU,EAAE,iBAAiB,EAC7B,QAAQ,GACT,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACxG,2CA6CA;AAED,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,SAAS,EACT,UAAU,EACV,MAAM,EAAE,aAAa,EACrB,QAAQ,GACT,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/H,2CAoDA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
declare const _default: import("../../..").SectionDefinition<{
|
|
2
|
-
type: "do_dont";
|
|
3
|
-
content: {
|
|
4
|
-
doItems: {
|
|
5
|
-
label: string;
|
|
6
|
-
text: string;
|
|
7
|
-
icon?: string | undefined;
|
|
8
|
-
}[];
|
|
9
|
-
dontItems: {
|
|
10
|
-
label: string;
|
|
11
|
-
text: string;
|
|
12
|
-
icon?: string | undefined;
|
|
13
|
-
}[];
|
|
14
|
-
};
|
|
15
|
-
options?: {
|
|
16
|
-
showLabel?: boolean | undefined;
|
|
17
|
-
stackText?: boolean | undefined;
|
|
18
|
-
} | undefined;
|
|
19
|
-
}>;
|
|
20
|
-
export default _default;
|
|
21
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/DoDontList/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,wBAyBG"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
declare const _default: import("../../..").SectionDefinition<{
|
|
2
|
-
type: "do_dont_grid";
|
|
3
|
-
content: {
|
|
4
|
-
columns: number;
|
|
5
|
-
media: ({
|
|
6
|
-
imageId: string;
|
|
7
|
-
type: "image";
|
|
8
|
-
caption?: string | string[] | undefined;
|
|
9
|
-
background?: string | undefined;
|
|
10
|
-
invertFrom?: string | undefined;
|
|
11
|
-
border?: boolean | undefined;
|
|
12
|
-
objectFit?: "cover" | "contain" | undefined;
|
|
13
|
-
} | {
|
|
14
|
-
imageId: string;
|
|
15
|
-
type: "video";
|
|
16
|
-
caption?: string | string[] | undefined;
|
|
17
|
-
background?: string | undefined;
|
|
18
|
-
invertFrom?: string | undefined;
|
|
19
|
-
border?: boolean | undefined;
|
|
20
|
-
objectFit?: "cover" | "contain" | undefined;
|
|
21
|
-
poster?: string | undefined;
|
|
22
|
-
autoplay?: boolean | undefined;
|
|
23
|
-
loop?: boolean | undefined;
|
|
24
|
-
muted?: boolean | undefined;
|
|
25
|
-
} | {
|
|
26
|
-
imageId: string;
|
|
27
|
-
type: "doDontImage";
|
|
28
|
-
doDont: "do" | "dont";
|
|
29
|
-
caption?: string | string[] | undefined;
|
|
30
|
-
background?: string | undefined;
|
|
31
|
-
invertFrom?: string | undefined;
|
|
32
|
-
border?: boolean | undefined;
|
|
33
|
-
objectFit?: "cover" | "contain" | undefined;
|
|
34
|
-
} | {
|
|
35
|
-
imageId: string;
|
|
36
|
-
type: "linkedImage";
|
|
37
|
-
href: string;
|
|
38
|
-
caption?: string | string[] | undefined;
|
|
39
|
-
background?: string | undefined;
|
|
40
|
-
invertFrom?: string | undefined;
|
|
41
|
-
border?: boolean | undefined;
|
|
42
|
-
objectFit?: "cover" | "contain" | undefined;
|
|
43
|
-
target?: string | undefined;
|
|
44
|
-
linkText?: string | undefined;
|
|
45
|
-
})[];
|
|
46
|
-
};
|
|
47
|
-
options: {
|
|
48
|
-
square?: boolean | undefined;
|
|
49
|
-
border?: boolean | undefined;
|
|
50
|
-
crop?: boolean | undefined;
|
|
51
|
-
showCaptions?: boolean | undefined;
|
|
52
|
-
};
|
|
53
|
-
}>;
|
|
54
|
-
export default _default;
|
|
55
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/DoDontMediaGrid/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,wBA8CG"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { MediaReference } from "../../../schemas/shared";
|
|
2
|
-
import type { SectionContent } from "../../../schemas/sections";
|
|
3
|
-
import type { ReactNode } from "react";
|
|
4
|
-
interface Props {
|
|
5
|
-
media: MediaReference[];
|
|
6
|
-
columns: number;
|
|
7
|
-
square?: boolean;
|
|
8
|
-
border?: boolean;
|
|
9
|
-
crop?: boolean;
|
|
10
|
-
showCaptions?: boolean;
|
|
11
|
-
sectionType?: string;
|
|
12
|
-
onChange?: (content: SectionContent) => void;
|
|
13
|
-
openModal?: (title: string, content: ReactNode) => void;
|
|
14
|
-
}
|
|
15
|
-
export default function MediaGrid({ media, columns, square, border, crop, showCaptions, sectionType, onChange, openModal }: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=MediaGrid.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MediaGrid.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/MediaGrid/MediaGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAOhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,UAAU,KAAK;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,2CAgChI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/MediaGrid/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,wBAwCG"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { SectionContent } from "../../../schemas/sections";
|
|
2
|
-
interface Props {
|
|
3
|
-
imageId: string | undefined;
|
|
4
|
-
src?: string;
|
|
5
|
-
srcset?: string;
|
|
6
|
-
alt?: string;
|
|
7
|
-
body: string;
|
|
8
|
-
border?: boolean;
|
|
9
|
-
imagePosition?: "left" | "right";
|
|
10
|
-
onChange?: (content: SectionContent) => void;
|
|
11
|
-
}
|
|
12
|
-
export default function SplitContent({ imageId, src, srcset, alt, body, border, imagePosition, onChange }: Props): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=SplitContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SplitContent.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/SplitContent/SplitContent.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAIhE,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,aAAsB,EAAE,QAAQ,EAAE,EAAE,KAAK,2CA8DxH"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const _default: import("../../..").SectionDefinition<{
|
|
2
|
-
type: "split_content";
|
|
3
|
-
content: {
|
|
4
|
-
body: string;
|
|
5
|
-
imageId?: string | undefined;
|
|
6
|
-
};
|
|
7
|
-
options?: {
|
|
8
|
-
border?: boolean | undefined;
|
|
9
|
-
imagePosition?: "left" | "right" | undefined;
|
|
10
|
-
} | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
export default _default;
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/SplitContent/index.tsx"],"names":[],"mappings":";;;;;;;;;;;AAkBA,wBAoCG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DoDontList.d.ts","sourceRoot":"","sources":["DoDontList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,KAAK;IACb,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,SAAS,EAAE,UAAU,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CAC9C;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,OAAO,EACP,SAAS,EACT,SAAgB,EAChB,SAAiB,EACjB,QAAQ,GACT,EAAE,KAAK,2CA0CP"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from "react";
|
|
2
|
-
import type { SectionContent } from "../../schemas/sections";
|
|
3
|
-
import IconList from "../sections/IconList/IconList";
|
|
4
|
-
|
|
5
|
-
interface DoDontItem {
|
|
6
|
-
label: string;
|
|
7
|
-
text: string;
|
|
8
|
-
icon?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
doItems: DoDontItem[];
|
|
13
|
-
dontItems: DoDontItem[];
|
|
14
|
-
showLabel?: boolean;
|
|
15
|
-
stackText?: boolean;
|
|
16
|
-
onChange?: (content: SectionContent) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default function DoDontList({
|
|
20
|
-
doItems,
|
|
21
|
-
dontItems,
|
|
22
|
-
showLabel = true,
|
|
23
|
-
stackText = false,
|
|
24
|
-
onChange,
|
|
25
|
-
}: Props) {
|
|
26
|
-
const doRef = useRef(doItems);
|
|
27
|
-
const dontRef = useRef(dontItems);
|
|
28
|
-
useEffect(() => { doRef.current = doItems; }, [doItems]);
|
|
29
|
-
useEffect(() => { dontRef.current = dontItems; }, [dontItems]);
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<div className="grid items-start gap-16 lg:grid-cols-2">
|
|
33
|
-
<IconList
|
|
34
|
-
items={doItems}
|
|
35
|
-
icon="check"
|
|
36
|
-
showLabel={showLabel}
|
|
37
|
-
stackText={stackText}
|
|
38
|
-
labelClassName="font-bold text-base-contrast"
|
|
39
|
-
textClassName="text-base-contrast"
|
|
40
|
-
iconClassName="text-green-600"
|
|
41
|
-
onItemsChange={onChange ? (items) => {
|
|
42
|
-
onChange({
|
|
43
|
-
type: "do_dont",
|
|
44
|
-
content: { doItems: items as DoDontItem[], dontItems: dontRef.current },
|
|
45
|
-
options: { showLabel, stackText },
|
|
46
|
-
});
|
|
47
|
-
} : undefined}
|
|
48
|
-
/>
|
|
49
|
-
<IconList
|
|
50
|
-
items={dontItems}
|
|
51
|
-
icon="x"
|
|
52
|
-
showLabel={showLabel}
|
|
53
|
-
stackText={stackText}
|
|
54
|
-
labelClassName="font-bold text-base-contrast"
|
|
55
|
-
textClassName="text-base-contrast"
|
|
56
|
-
iconClassName="text-red-600"
|
|
57
|
-
onItemsChange={onChange ? (items) => {
|
|
58
|
-
onChange({
|
|
59
|
-
type: "do_dont",
|
|
60
|
-
content: { doItems: doRef.current, dontItems: items as DoDontItem[] },
|
|
61
|
-
options: { showLabel, stackText },
|
|
62
|
-
});
|
|
63
|
-
} : undefined}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DoDontMediaGrid.d.ts","sourceRoot":"","sources":["DoDontMediaGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG7D,UAAU,KAAK;IACb,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,KAAK,EAAE,KAAK,2CAEnD"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
2
|
-
import type { MediaReference } from "../../schemas/shared";
|
|
3
|
-
import type { SectionContent } from "../../schemas/sections";
|
|
4
|
-
import MediaGrid from "../sections/MediaGrid/MediaGrid";
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
media: MediaReference[];
|
|
8
|
-
columns: number;
|
|
9
|
-
square?: boolean;
|
|
10
|
-
border?: boolean;
|
|
11
|
-
crop?: boolean;
|
|
12
|
-
showCaptions?: boolean;
|
|
13
|
-
onChange?: (content: SectionContent) => void;
|
|
14
|
-
openModal?: (title: string, content: ReactNode) => void;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default function DoDontMediaGrid(props: Props) {
|
|
18
|
-
return <MediaGrid {...props} sectionType="do_dont_grid" />;
|
|
19
|
-
}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { useState, useRef } from "react";
|
|
2
|
-
import { cn } from "../../lib/cn";
|
|
3
|
-
import { Check, X } from "lucide-react";
|
|
4
|
-
import { Checkbox } from "../shared/Checkbox";
|
|
5
|
-
import { Select } from "../shared/Select";
|
|
6
|
-
|
|
7
|
-
export function ImageSettingsForm({
|
|
8
|
-
border,
|
|
9
|
-
objectFit,
|
|
10
|
-
invertFrom: initialInvertFrom,
|
|
11
|
-
onChange,
|
|
12
|
-
}: {
|
|
13
|
-
border?: boolean;
|
|
14
|
-
objectFit?: "cover" | "contain";
|
|
15
|
-
invertFrom?: string;
|
|
16
|
-
onChange: (update: { border?: boolean; objectFit?: "cover" | "contain"; invertFrom?: string }) => void;
|
|
17
|
-
}) {
|
|
18
|
-
const [itemBorder, setItemBorder] = useState(border);
|
|
19
|
-
const [fit, setFit] = useState(objectFit);
|
|
20
|
-
const [invertFrom, setInvertFrom] = useState(initialInvertFrom ?? "");
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="space-y-4">
|
|
24
|
-
<Select
|
|
25
|
-
label="Object fit"
|
|
26
|
-
value={fit ?? ""}
|
|
27
|
-
onChange={(v) => {
|
|
28
|
-
const val = (v || undefined) as "cover" | "contain" | undefined;
|
|
29
|
-
setFit(val);
|
|
30
|
-
onChange({ border: itemBorder, objectFit: val, invertFrom: invertFrom || undefined });
|
|
31
|
-
}}
|
|
32
|
-
options={[
|
|
33
|
-
{ value: "", label: "Default (inherit from grid)" },
|
|
34
|
-
{ value: "contain", label: "Contain" },
|
|
35
|
-
{ value: "cover", label: "Crop to fill" },
|
|
36
|
-
]}
|
|
37
|
-
/>
|
|
38
|
-
<Select
|
|
39
|
-
label="Invert colors"
|
|
40
|
-
value={invertFrom}
|
|
41
|
-
onChange={(v) => {
|
|
42
|
-
setInvertFrom(v);
|
|
43
|
-
onChange({ border: itemBorder, objectFit: fit, invertFrom: v || undefined });
|
|
44
|
-
}}
|
|
45
|
-
options={[
|
|
46
|
-
{ value: "", label: "None" },
|
|
47
|
-
{ value: "light", label: "Invert on light theme" },
|
|
48
|
-
{ value: "dark", label: "Invert on dark theme" },
|
|
49
|
-
]}
|
|
50
|
-
/>
|
|
51
|
-
<Checkbox
|
|
52
|
-
checked={itemBorder ?? false}
|
|
53
|
-
onChange={(v) => {
|
|
54
|
-
const val = v || undefined;
|
|
55
|
-
setItemBorder(val);
|
|
56
|
-
onChange({ border: val, objectFit: fit, invertFrom: invertFrom || undefined });
|
|
57
|
-
}}
|
|
58
|
-
label="Override border settings"
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export function DoDontImageSettingsForm({
|
|
65
|
-
border,
|
|
66
|
-
objectFit,
|
|
67
|
-
invertFrom,
|
|
68
|
-
doDont: initialDoDont,
|
|
69
|
-
onChange,
|
|
70
|
-
}: {
|
|
71
|
-
border?: boolean;
|
|
72
|
-
objectFit?: "cover" | "contain";
|
|
73
|
-
invertFrom?: string;
|
|
74
|
-
doDont: "do" | "dont";
|
|
75
|
-
onChange: (update: { border?: boolean; objectFit?: "cover" | "contain"; invertFrom?: string; doDont: "do" | "dont" }) => void;
|
|
76
|
-
}) {
|
|
77
|
-
const [doDont, setDoDont] = useState<"do" | "dont">(initialDoDont);
|
|
78
|
-
const latestRef = useRef<{ border?: boolean; objectFit?: "cover" | "contain"; invertFrom?: string }>({ border, objectFit, invertFrom });
|
|
79
|
-
|
|
80
|
-
const handleBaseChange = (updated: { border?: boolean; objectFit?: "cover" | "contain"; invertFrom?: string }) => {
|
|
81
|
-
latestRef.current = updated;
|
|
82
|
-
onChange({ ...updated, doDont });
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<div className="space-y-4">
|
|
87
|
-
<ImageSettingsForm
|
|
88
|
-
border={border}
|
|
89
|
-
objectFit={objectFit}
|
|
90
|
-
invertFrom={invertFrom}
|
|
91
|
-
onChange={handleBaseChange}
|
|
92
|
-
/>
|
|
93
|
-
<hr className="border-base-200" />
|
|
94
|
-
<div className="space-y-2">
|
|
95
|
-
<button
|
|
96
|
-
className={cn(
|
|
97
|
-
"cursor-pointer flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-sm transition-colors",
|
|
98
|
-
doDont === "do"
|
|
99
|
-
? "border-green-600 bg-base-accent text-base-contrast"
|
|
100
|
-
: "border-base-200 text-base-contrast-light hover:bg-base-accent",
|
|
101
|
-
)}
|
|
102
|
-
onClick={() => {
|
|
103
|
-
setDoDont("do");
|
|
104
|
-
onChange({ ...latestRef.current, doDont: "do" });
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<Check size={16} className="text-green-600" />
|
|
108
|
-
Do
|
|
109
|
-
</button>
|
|
110
|
-
<button
|
|
111
|
-
className={cn(
|
|
112
|
-
"cursor-pointer flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-sm transition-colors",
|
|
113
|
-
doDont === "dont"
|
|
114
|
-
? "border-red-600 bg-base-accent text-base-contrast"
|
|
115
|
-
: "border-base-200 text-base-contrast-light hover:bg-base-accent",
|
|
116
|
-
)}
|
|
117
|
-
onClick={() => {
|
|
118
|
-
setDoDont("dont");
|
|
119
|
-
onChange({ ...latestRef.current, doDont: "dont" });
|
|
120
|
-
}}
|
|
121
|
-
>
|
|
122
|
-
<X size={16} className="text-red-600" />
|
|
123
|
-
Don't
|
|
124
|
-
</button>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
);
|
|
128
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,wBAwBG"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { defineSection } from "../../../lib/registry";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { ListChecks } from "lucide-react";
|
|
4
|
-
import DoDontList from "../../brandguide/DoDontList";
|
|
5
|
-
|
|
6
|
-
const DoDontItemSchema = z.object({ label: z.string(), text: z.string(), icon: z.string().optional() });
|
|
7
|
-
|
|
8
|
-
const schema = z.object({
|
|
9
|
-
type: z.literal("do_dont"),
|
|
10
|
-
content: z.object({
|
|
11
|
-
doItems: z.array(DoDontItemSchema),
|
|
12
|
-
dontItems: z.array(DoDontItemSchema),
|
|
13
|
-
}),
|
|
14
|
-
options: z.object({
|
|
15
|
-
showLabel: z.boolean().optional(),
|
|
16
|
-
stackText: z.boolean().optional(),
|
|
17
|
-
}).optional(),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export default defineSection({
|
|
21
|
-
type: "do_dont",
|
|
22
|
-
label: "Do / Don't",
|
|
23
|
-
icon: <ListChecks size={18} />,
|
|
24
|
-
schema,
|
|
25
|
-
component: ({ content, options, onChange }) => (
|
|
26
|
-
<DoDontList
|
|
27
|
-
doItems={content.content.doItems}
|
|
28
|
-
dontItems={content.content.dontItems}
|
|
29
|
-
showLabel={options?.showLabel as boolean}
|
|
30
|
-
stackText={options?.stackText as boolean}
|
|
31
|
-
onChange={onChange ? (c) => onChange(c as typeof content) : undefined}
|
|
32
|
-
/>
|
|
33
|
-
),
|
|
34
|
-
defaults: () => ({
|
|
35
|
-
type: "do_dont" as const,
|
|
36
|
-
content: {
|
|
37
|
-
doItems: [{ label: "Do", text: "" }],
|
|
38
|
-
dontItems: [{ label: "Don't", text: "" }],
|
|
39
|
-
},
|
|
40
|
-
}),
|
|
41
|
-
settings: {
|
|
42
|
-
showLabel: { type: "checkbox", label: "Show labels", default: true },
|
|
43
|
-
stackText: { type: "checkbox", label: "Stack label above text", default: false },
|
|
44
|
-
},
|
|
45
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,wBAqCG"}
|