@realiizlabs/admin 0.10.2 → 0.11.1

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.
@@ -139,7 +139,7 @@ function readMeta(schema) {
139
139
  const pick = (k) => typeof raw[k] === "string" ? raw[k] : void 0;
140
140
  const rec = raw.recommended;
141
141
  const recommended = Array.isArray(rec) && rec.length === 2 && rec.every((n) => typeof n === "number") ? [rec[0], rec[1]] : void 0;
142
- const INPUTS = ["text", "textarea", "date", "number", "boolean", "select", "tags", "image", "url"];
142
+ const INPUTS = ["text", "textarea", "date", "number", "boolean", "select", "tags", "image", "url", "time"];
143
143
  const input = typeof raw.input === "string" && INPUTS.includes(raw.input) ? raw.input : void 0;
144
144
  return {
145
145
  label: pick("label"),
@@ -238,6 +238,9 @@ function defineContentType(entry) {
238
238
  if (typeof entry.filename !== "function") {
239
239
  throw new TypeError(`${where}: "filename" must be a function (frontmatter) => string`);
240
240
  }
241
+ if (entry.slugFromFilename !== void 0 && typeof entry.slugFromFilename !== "function") {
242
+ throw new TypeError(`${where}: "slugFromFilename" must be a function (fileName) => string | null`);
243
+ }
241
244
  if (entry.body !== null && typeof entry.body !== "string") {
242
245
  throw new TypeError(`${where}: "body" must be a field name or null`);
243
246
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/forms/internals.ts","../../src/forms/checks.ts","../../src/forms/unwrap.ts","../../src/forms/inputs.ts","../../src/forms/labels.ts","../../src/forms/walk.ts","../../src/forms/registry.ts","../../src/forms/nav.ts"],"names":[],"mappings":";;;AAsCO,SAAS,MAAA,CAAO,MAAA,EAAiB,IAAA,GAAO,QAAA,EAAmB;AAChE,EAAA,MAAM,CAAA,GAAI,MAAA;AACV,EAAA,IAAI,CAAC,KAAK,OAAO,CAAA,KAAM,YAAY,CAAC,CAAA,CAAE,IAAA,EAAM,GAAA,EAAK,IAAA,EAAM;AACrD,IAAA,MAAM,IAAI,SAAA,CAAU,CAAA,YAAA,EAAe,IAA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AA,CAAQ,QAAQ,EAAE,CAAA;AAC3D,EAAA,MAAM,IAAA,GAAO,MAAM,OAAA,CAAQ,OAAO,IAAI,OAAA,GAAU,MAAA,CAAO,OAAO,OAAO,CAAA;AACrE,EAAA,OAAO,IAAA,CAAK,IAAI,CAAC,CAAA,MAAO,EAAE,EAAA,EAAI,CAAA,CAAE,IAAI,KAAA,EAAO,CAAA,CAAE,OAAO,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,CAAA,CAAE,EAAE,CAAA,CAAA,EAAI,IAAA,EAAM,CAAA,CAAE,EAAA,EAAG,CAAE,CAAA;AAC5F","file":"index.cjs","sourcesContent":["/**\n * The slice of zod 4's `_zod.def` surface this module reads, typed loosely.\n *\n * Tested against zod 4.5.4. These are semi-public internals (the v4 \"core\"\n * shape), stable across 4.x so far but not covered by semver promises — hence\n * the peer-dep range and the fixture tests. No zod value is imported here.\n */\n\nexport interface ZodCheckDef {\n check?: string;\n format?: string;\n minimum?: number;\n maximum?: number;\n length?: number;\n value?: number;\n inclusive?: boolean;\n pattern?: RegExp;\n error?: string | ((issue: unknown) => string | { message?: string } | undefined);\n}\n\nexport interface ZodDef {\n type: string;\n shape?: Record<string, ZodNode>;\n innerType?: ZodNode;\n in?: ZodNode;\n out?: ZodNode;\n element?: ZodNode;\n entries?: Record<string, string | number>;\n checks?: Array<{ _zod: { def: ZodCheckDef } }>;\n coerce?: boolean;\n}\n\nexport interface ZodNode {\n _zod: { def: ZodDef };\n description?: string;\n}\n\n/** Narrow an unknown schema to the internal node shape, or throw a clear error. */\nexport function asNode(schema: unknown, what = \"schema\"): ZodNode {\n const n = schema as Partial<ZodNode> | null;\n if (!n || typeof n !== \"object\" || !n._zod?.def?.type) {\n throw new TypeError(`walkSchema: ${what} is not a zod 4 schema`);\n }\n return n as ZodNode;\n}\n\n/** Resolve a check's error to a plain string, if it has one. */\nexport function checkMessage(def: ZodCheckDef): string | undefined {\n const e = def.error;\n if (!e) return undefined;\n if (typeof e === \"string\") return e;\n const out = e({});\n if (typeof out === \"string\") return out;\n return out?.message;\n}\n","/**\n * checks[] → constraints + messages.\n *\n * Messages are keyed PER CHECK. The spike's walker wrote `out.message = …` on\n * every check, so a field with min and max kept only the max message and\n * showed the wrong error for a too-short value. Here each check kind gets its\n * own key; a renderer maps a failed issue to its message by that key.\n *\n * Unknown check kinds (e.g. a per-field `.refine`, which is `custom`) are kept\n * as a message when they carry one and otherwise skipped — never fatal.\n */\n\nimport type { Constraints, Messages } from \"./types\";\nimport type { ZodNode } from \"./internals\";\nimport { checkMessage } from \"./internals\";\n\nexport function readChecks(node: ZodNode): { constraints: Constraints; messages: Messages } {\n const constraints: Constraints = {};\n const messages: Messages = {};\n\n for (const c of node._zod.def.checks ?? []) {\n const d = c._zod.def;\n const msg = checkMessage(d);\n let key: string | undefined;\n\n switch (d.check) {\n case \"min_length\":\n constraints.min = d.minimum;\n key = \"min_length\";\n break;\n case \"max_length\":\n constraints.max = d.maximum;\n key = \"max_length\";\n break;\n case \"length_equals\":\n constraints.exact = d.length;\n key = \"length_equals\";\n break;\n case \"greater_than\":\n constraints.min = d.inclusive ? d.value : (d.value ?? 0) + 1;\n key = \"greater_than\";\n break;\n case \"less_than\":\n constraints.max = d.inclusive ? d.value : (d.value ?? 0) - 1;\n key = \"less_than\";\n break;\n case \"string_format\":\n if (d.format === \"regex\" && d.pattern) {\n constraints.pattern = d.pattern.source;\n constraints.format = \"regex\";\n key = \"regex\";\n } else if (d.format === \"url\" || d.format === \"email\") {\n constraints.format = d.format;\n key = d.format;\n } else {\n key = d.format;\n }\n break;\n case \"number_format\":\n if (d.format === \"safeint\" || d.format === \"int32\") {\n constraints.format = \"int\";\n key = \"int\";\n }\n break;\n case \"custom\":\n key = \"custom\";\n break;\n default:\n key = d.check;\n }\n\n if (key && msg) messages[key] = msg;\n }\n\n return { constraints, messages };\n}\n","/**\n * Peel wrapper types off a field until the real type is reached.\n *\n * optional / nullable / default → the field is not required.\n * pipe → follow `out` (older 4.x wrapped z.coerce.date in a pipe; 4.5 marks\n * the date itself with `coerce: true` — both land on the same node here).\n */\n\nimport type { ZodNode } from \"./internals\";\n\nexport interface Unwrapped {\n node: ZodNode;\n type: string;\n required: boolean;\n}\n\nexport function unwrap(start: ZodNode): Unwrapped {\n let node = start;\n let required = true;\n // Bounded so a malformed schema can't loop forever.\n for (let i = 0; i < 16; i++) {\n const def = node._zod.def;\n if (def.type === \"optional\" || def.type === \"nullable\" || def.type === \"default\") {\n required = false;\n if (!def.innerType) break;\n node = def.innerType;\n } else if (def.type === \"pipe\") {\n const next = def.out ?? def.in;\n if (!next) break;\n node = next;\n } else {\n break;\n }\n }\n return { node, type: node._zod.def.type, required };\n}\n","/**\n * zod type → InputKind, plus the extras some kinds carry (enum options, the\n * array item's constraints).\n *\n * Long strings become textareas by a simple rule: a max over 120 chars. That\n * is a heuristic, and the registry can't override it today — if a site needs\n * to, that is a one-line change here, not a per-site branch.\n */\n\nimport type { Constraints, InputKind, Messages } from \"./types\";\nimport type { ZodNode } from \"./internals\";\nimport { readChecks } from \"./checks\";\nimport { unwrap } from \"./unwrap\";\n\nconst TEXTAREA_MIN_MAX = 120;\n\nexport interface InputInfo {\n input: InputKind;\n constraints: Constraints;\n messages: Messages;\n options?: string[];\n}\n\nexport function inputFor(node: ZodNode): InputInfo {\n const def = node._zod.def;\n const { constraints, messages } = readChecks(node);\n\n switch (def.type) {\n case \"string\": {\n if (constraints.format === \"url\") return { input: \"url\", constraints, messages };\n const long = (constraints.max ?? 0) > TEXTAREA_MIN_MAX;\n return { input: long ? \"textarea\" : \"text\", constraints, messages };\n }\n case \"date\":\n return { input: \"date\", constraints, messages };\n case \"number\":\n case \"int\":\n return { input: \"number\", constraints, messages };\n case \"boolean\":\n return { input: \"boolean\", constraints, messages };\n case \"enum\":\n case \"literal\": {\n const options = Object.values(def.entries ?? {}).map(String);\n return { input: \"select\", constraints, messages, options };\n }\n case \"array\": {\n if (def.element) {\n const item = unwrap(def.element);\n const inner = readChecks(item.node);\n constraints.item = inner;\n }\n return { input: \"tags\", constraints, messages };\n }\n default:\n // Anything unrecognised (object, union, …) is presented as text so the\n // value can at least be carried; a renderer may choose to treat it as hidden.\n return { input: \"text\", constraints, messages };\n }\n}\n","/**\n * Labels and placeholders.\n *\n * Precedence (decided 2026-09-08):\n * label: registry.labels[name] → .meta({ label }) → .describe() → titlecase(name)\n * placeholder: registry.placeholders[name] → .meta({ placeholder }) → undefined\n *\n * The registry tier exists for schemas that can't be edited yet (5degrees\n * until its repo transfer). The meta tier is the intended home — one source of\n * truth beside the validation rules. Titlecase is the floor, and it is naive on\n * purpose: an acronym coming out as \"Rsvp url\" is the signal that a real label\n * is missing.\n *\n * Meta is read from zod's global registry via the schema's own `meta()` /\n * `description` accessors, so no zod value is imported here.\n */\n\nimport type { ContentTypeEntry, InputKind } from \"./types\";\n\ninterface MetaBearing {\n meta?: () => Record<string, unknown> | undefined;\n description?: string;\n}\n\ninterface FieldMeta {\n label?: string;\n placeholder?: string;\n description?: string;\n recommended?: [number, number];\n suffix?: string;\n help?: string;\n input?: InputKind;\n}\n\nexport function readMeta(schema: unknown): FieldMeta {\n const s = schema as MetaBearing;\n const raw = typeof s.meta === \"function\" ? (s.meta() ?? {}) : {};\n const pick = (k: keyof FieldMeta) => (typeof raw[k] === \"string\" ? (raw[k] as string) : undefined);\n const rec = raw.recommended;\n const recommended =\n Array.isArray(rec) && rec.length === 2 && rec.every((n) => typeof n === \"number\") ? ([rec[0], rec[1]] as [number, number]) : undefined;\n const INPUTS: InputKind[] = [\"text\", \"textarea\", \"date\", \"number\", \"boolean\", \"select\", \"tags\", \"image\", \"url\"];\n const input = typeof raw.input === \"string\" && (INPUTS as string[]).includes(raw.input) ? (raw.input as InputKind) : undefined;\n return {\n label: pick(\"label\"),\n placeholder: pick(\"placeholder\"),\n description: pick(\"description\") ?? (typeof s.description === \"string\" ? s.description : undefined),\n recommended,\n suffix: pick(\"suffix\"),\n help: pick(\"help\"),\n input,\n };\n}\n\nexport function inputOverrideFor(\n name: string,\n schema: unknown,\n entry?: Pick<ContentTypeEntry, \"inputs\">,\n): InputKind | undefined {\n return entry?.inputs?.[name] ?? readMeta(schema).input;\n}\n\nexport function recommendedFor(\n name: string,\n schema: unknown,\n entry?: Pick<ContentTypeEntry, \"recommended\">,\n): [number, number] | undefined {\n return entry?.recommended?.[name] ?? readMeta(schema).recommended;\n}\n\nexport function titlecase(name: string): string {\n const words = name\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[_-]+/g, \" \")\n .toLowerCase()\n .trim();\n return words.charAt(0).toUpperCase() + words.slice(1);\n}\n\nexport function labelFor(name: string, schema: unknown, entry?: Pick<ContentTypeEntry, \"labels\">): string {\n const fromRegistry = entry?.labels?.[name];\n if (fromRegistry) return fromRegistry;\n const meta = readMeta(schema);\n return meta.label ?? meta.description ?? titlecase(name);\n}\n\nexport function placeholderFor(\n name: string,\n schema: unknown,\n entry?: Pick<ContentTypeEntry, \"placeholders\">,\n): string | undefined {\n return entry?.placeholders?.[name] ?? readMeta(schema).placeholder;\n}\n\nexport function helpFor(name: string, schema: unknown, entry?: Pick<ContentTypeEntry, \"help\">): string | undefined {\n return entry?.help?.[name] ?? readMeta(schema).help;\n}\n","/**\n * walkSchema — a zod object schema (+ optional registry entry) → FieldSpec[].\n *\n * Synchronous and pure. Reads the schema's shape and checks; never parses a\n * value, never calls an options resolver, never imports zod at runtime.\n *\n * Roles from the registry override the schema-derived input kind: a field the\n * entry names as an image is `role: \"image\"` even though zod sees a string.\n * Hidden fields are still emitted so a renderer can carry their values through.\n */\n\nimport type { ContentTypeEntry, FieldRole, FieldSpec } from \"./types\";\nimport type { ZodNode } from \"./internals\";\nimport { asNode } from \"./internals\";\nimport { inputFor } from \"./inputs\";\nimport { helpFor, inputOverrideFor, labelFor, placeholderFor, readMeta, recommendedFor } from \"./labels\";\nimport { unwrap } from \"./unwrap\";\n\ntype Entry = Partial<Omit<ContentTypeEntry, \"schema\" | \"filename\" | \"id\" | \"label\" | \"folder\">>;\n\nexport function walkSchema(schema: unknown, entry: Entry = {}): FieldSpec[] {\n const root = asNode(schema);\n const shape = shapeOf(root);\n const names = Object.keys(shape);\n\n const specs = names.map((name): FieldSpec => {\n const raw = shape[name];\n const { node, required } = unwrap(raw);\n const info = inputFor(node);\n const role = roleFor(name, entry);\n\n return {\n name,\n label: labelFor(name, raw, entry),\n input: role === \"image\" ? \"image\" : (inputOverrideFor(name, raw, entry) ?? info.input),\n required,\n constraints: info.constraints,\n messages: info.messages,\n placeholder: placeholderFor(name, raw, entry),\n recommended: recommendedFor(name, raw, entry),\n suffix: readMeta(raw).suffix,\n help: helpFor(name, raw, entry),\n order: 0,\n role,\n options: entry.options?.[name] ?? info.options,\n };\n });\n\n return applyOrder(specs, entry.order ?? []);\n}\n\n/** `.strict()` and object-level `.refine()` both leave `shape` on the object def. */\nfunction shapeOf(root: ZodNode): Record<string, ZodNode> {\n let node = root;\n for (let i = 0; i < 8 && !node._zod.def.shape; i++) {\n const def = node._zod.def;\n const next = def.innerType ?? def.in;\n if (!next) break;\n node = next;\n }\n const shape = node._zod.def.shape;\n if (!shape) throw new TypeError(`walkSchema: expected an object schema, got \"${root._zod.def.type}\"`);\n return shape;\n}\n\nfunction roleFor(name: string, entry: Entry): FieldRole {\n if (entry.hidden?.includes(name)) return \"hidden\";\n if (entry.body === name) return \"body\";\n if (entry.images?.includes(name)) return \"image\";\n return \"field\";\n}\n\n/** Named fields first in the given order; the rest keep schema key order. */\nfunction applyOrder(specs: FieldSpec[], order: string[]): FieldSpec[] {\n const rank = new Map(order.map((n, i) => [n, i]));\n const named = specs.filter((s) => rank.has(s.name)).sort((a, b) => rank.get(a.name)! - rank.get(b.name)!);\n const rest = specs.filter((s) => !rank.has(s.name));\n return [...named, ...rest].map((s, i) => ({ ...s, order: i }));\n}\n","/**\n * defineContentType — validate a registry entry against the schema it describes.\n *\n * Validation is hand-rolled rather than a zod schema on purpose: this module\n * must not import zod at runtime (the host's instance is the only one that\n * should exist). The checks are small and the errors name the bad key.\n */\n\nimport type { ZodType } from \"zod\";\nimport type { ContentTypeEntry } from \"./types\";\nimport { asNode } from \"./internals\";\n\nexport function defineContentType<S extends ZodType>(entry: ContentTypeEntry<S>): ContentTypeEntry<S> {\n const where = `defineContentType(\"${entry.id}\")`;\n\n for (const key of [\"id\", \"label\", \"folder\"] as const) {\n if (typeof entry[key] !== \"string\" || entry[key].length === 0) {\n throw new TypeError(`${where}: \"${key}\" must be a non-empty string`);\n }\n }\n if (typeof entry.filename !== \"function\") {\n throw new TypeError(`${where}: \"filename\" must be a function (frontmatter) => string`);\n }\n if (entry.body !== null && typeof entry.body !== \"string\") {\n throw new TypeError(`${where}: \"body\" must be a field name or null`);\n }\n\n const root = asNode(entry.schema, `${where}: schema`);\n const shape = findShape(root);\n const known = new Set(Object.keys(shape));\n\n const check = (list: string[] | undefined, key: string) => {\n for (const name of list ?? []) {\n if (!known.has(name)) throw new TypeError(`${where}: ${key} names \"${name}\", which is not a field of the schema`);\n }\n };\n\n if (entry.body !== null) check([entry.body], \"body\");\n check(entry.images, \"images\");\n check(entry.order, \"order\");\n check(entry.hidden, \"hidden\");\n check(Object.keys(entry.labels ?? {}), \"labels\");\n check(Object.keys(entry.placeholders ?? {}), \"placeholders\");\n check(Object.keys(entry.recommended ?? {}), \"recommended\");\n check(Object.keys(entry.inputs ?? {}), \"inputs\");\n check(Object.keys(entry.help ?? {}), \"help\");\n check(Object.keys(entry.options ?? {}), \"options\");\n for (const g of entry.groups ?? []) {\n if (typeof g.label !== \"string\" || g.label.length === 0) throw new TypeError(`${where}: every group needs a label`);\n check(g.fields, `groups[\"${g.label}\"]`);\n }\n\n return entry;\n}\n\nfunction findShape(root: ReturnType<typeof asNode>): Record<string, unknown> {\n let node = root;\n for (let i = 0; i < 8 && !node._zod.def.shape; i++) {\n const next = node._zod.def.innerType ?? node._zod.def.in;\n if (!next) break;\n node = next;\n }\n if (!node._zod.def.shape) throw new TypeError(\"defineContentType: schema must be a zod object\");\n return node._zod.def.shape;\n}\n","/**\n * navFromContentTypes — the sidebar derives from the registry.\n *\n * Adding a content type to a site (one defineContentType entry) puts it in\n * the nav with no shell change. Pure; lives in /forms so the server layout\n * can compute it without importing the client bundle.\n */\n\nimport type { ContentTypeEntry } from \"./types\";\n\nexport interface NavEntry {\n id: string;\n label: string;\n href: string;\n icon: string;\n}\n\nexport function navFromContentTypes(\n entries: Record<string, ContentTypeEntry> | ContentTypeEntry[],\n opts: { basePath?: string } = {},\n): NavEntry[] {\n const base = (opts.basePath ?? \"/admin\").replace(/\\/+$/, \"\");\n const list = Array.isArray(entries) ? entries : Object.values(entries);\n return list.map((e) => ({ id: e.id, label: e.label, href: `${base}/${e.id}`, icon: e.id }));\n}\n"]}
1
+ {"version":3,"sources":["../../src/forms/internals.ts","../../src/forms/checks.ts","../../src/forms/unwrap.ts","../../src/forms/inputs.ts","../../src/forms/labels.ts","../../src/forms/walk.ts","../../src/forms/registry.ts","../../src/forms/nav.ts"],"names":[],"mappings":";;;AAsCO,SAAS,MAAA,CAAO,MAAA,EAAiB,IAAA,GAAO,QAAA,EAAmB;AAChE,EAAA,MAAM,CAAA,GAAI,MAAA;AACV,EAAA,IAAI,CAAC,KAAK,OAAO,CAAA,KAAM,YAAY,CAAC,CAAA,CAAE,IAAA,EAAM,GAAA,EAAK,IAAA,EAAM;AACrD,IAAA,MAAM,IAAI,SAAA,CAAU,CAAA,YAAA,EAAe,IAAI,CAAA,sBAAA,CAAwB,CAAA;AAAA,EACjE;AACA,EAAA,OAAO,CAAA;AACT;AAGO,SAAS,aAAa,GAAA,EAAsC;AACjE,EAAA,MAAM,IAAI,GAAA,CAAI,KAAA;AACd,EAAA,IAAI,CAAC,GAAG,OAAO,MAAA;AACf,EAAA,IAAI,OAAO,CAAA,KAAM,QAAA,EAAU,OAAO,CAAA;AAClC,EAAA,MAAM,GAAA,GAAM,CAAA,CAAE,EAAE,CAAA;AAChB,EAAA,IAAI,OAAO,GAAA,KAAQ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AACrE,EAAA,OAAO,IAAA,CAAK,IAAI,CAAC,CAAA,MAAO,EAAE,EAAA,EAAI,CAAA,CAAE,IAAI,KAAA,EAAO,CAAA,CAAE,OAAO,IAAA,EAAM,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,CAAA,CAAE,EAAE,CAAA,CAAA,EAAI,IAAA,EAAM,CAAA,CAAE,EAAA,EAAG,CAAE,CAAA;AAC5F","file":"index.cjs","sourcesContent":["/**\n * The slice of zod 4's `_zod.def` surface this module reads, typed loosely.\n *\n * Tested against zod 4.5.4. These are semi-public internals (the v4 \"core\"\n * shape), stable across 4.x so far but not covered by semver promises — hence\n * the peer-dep range and the fixture tests. No zod value is imported here.\n */\n\nexport interface ZodCheckDef {\n check?: string;\n format?: string;\n minimum?: number;\n maximum?: number;\n length?: number;\n value?: number;\n inclusive?: boolean;\n pattern?: RegExp;\n error?: string | ((issue: unknown) => string | { message?: string } | undefined);\n}\n\nexport interface ZodDef {\n type: string;\n shape?: Record<string, ZodNode>;\n innerType?: ZodNode;\n in?: ZodNode;\n out?: ZodNode;\n element?: ZodNode;\n entries?: Record<string, string | number>;\n checks?: Array<{ _zod: { def: ZodCheckDef } }>;\n coerce?: boolean;\n}\n\nexport interface ZodNode {\n _zod: { def: ZodDef };\n description?: string;\n}\n\n/** Narrow an unknown schema to the internal node shape, or throw a clear error. */\nexport function asNode(schema: unknown, what = \"schema\"): ZodNode {\n const n = schema as Partial<ZodNode> | null;\n if (!n || typeof n !== \"object\" || !n._zod?.def?.type) {\n throw new TypeError(`walkSchema: ${what} is not a zod 4 schema`);\n }\n return n as ZodNode;\n}\n\n/** Resolve a check's error to a plain string, if it has one. */\nexport function checkMessage(def: ZodCheckDef): string | undefined {\n const e = def.error;\n if (!e) return undefined;\n if (typeof e === \"string\") return e;\n const out = e({});\n if (typeof out === \"string\") return out;\n return out?.message;\n}\n","/**\n * checks[] → constraints + messages.\n *\n * Messages are keyed PER CHECK. The spike's walker wrote `out.message = …` on\n * every check, so a field with min and max kept only the max message and\n * showed the wrong error for a too-short value. Here each check kind gets its\n * own key; a renderer maps a failed issue to its message by that key.\n *\n * Unknown check kinds (e.g. a per-field `.refine`, which is `custom`) are kept\n * as a message when they carry one and otherwise skipped — never fatal.\n */\n\nimport type { Constraints, Messages } from \"./types\";\nimport type { ZodNode } from \"./internals\";\nimport { checkMessage } from \"./internals\";\n\nexport function readChecks(node: ZodNode): { constraints: Constraints; messages: Messages } {\n const constraints: Constraints = {};\n const messages: Messages = {};\n\n for (const c of node._zod.def.checks ?? []) {\n const d = c._zod.def;\n const msg = checkMessage(d);\n let key: string | undefined;\n\n switch (d.check) {\n case \"min_length\":\n constraints.min = d.minimum;\n key = \"min_length\";\n break;\n case \"max_length\":\n constraints.max = d.maximum;\n key = \"max_length\";\n break;\n case \"length_equals\":\n constraints.exact = d.length;\n key = \"length_equals\";\n break;\n case \"greater_than\":\n constraints.min = d.inclusive ? d.value : (d.value ?? 0) + 1;\n key = \"greater_than\";\n break;\n case \"less_than\":\n constraints.max = d.inclusive ? d.value : (d.value ?? 0) - 1;\n key = \"less_than\";\n break;\n case \"string_format\":\n if (d.format === \"regex\" && d.pattern) {\n constraints.pattern = d.pattern.source;\n constraints.format = \"regex\";\n key = \"regex\";\n } else if (d.format === \"url\" || d.format === \"email\") {\n constraints.format = d.format;\n key = d.format;\n } else {\n key = d.format;\n }\n break;\n case \"number_format\":\n if (d.format === \"safeint\" || d.format === \"int32\") {\n constraints.format = \"int\";\n key = \"int\";\n }\n break;\n case \"custom\":\n key = \"custom\";\n break;\n default:\n key = d.check;\n }\n\n if (key && msg) messages[key] = msg;\n }\n\n return { constraints, messages };\n}\n","/**\n * Peel wrapper types off a field until the real type is reached.\n *\n * optional / nullable / default → the field is not required.\n * pipe → follow `out` (older 4.x wrapped z.coerce.date in a pipe; 4.5 marks\n * the date itself with `coerce: true` — both land on the same node here).\n */\n\nimport type { ZodNode } from \"./internals\";\n\nexport interface Unwrapped {\n node: ZodNode;\n type: string;\n required: boolean;\n}\n\nexport function unwrap(start: ZodNode): Unwrapped {\n let node = start;\n let required = true;\n // Bounded so a malformed schema can't loop forever.\n for (let i = 0; i < 16; i++) {\n const def = node._zod.def;\n if (def.type === \"optional\" || def.type === \"nullable\" || def.type === \"default\") {\n required = false;\n if (!def.innerType) break;\n node = def.innerType;\n } else if (def.type === \"pipe\") {\n const next = def.out ?? def.in;\n if (!next) break;\n node = next;\n } else {\n break;\n }\n }\n return { node, type: node._zod.def.type, required };\n}\n","/**\n * zod type → InputKind, plus the extras some kinds carry (enum options, the\n * array item's constraints).\n *\n * Long strings become textareas by a simple rule: a max over 120 chars. That\n * is a heuristic, and the registry can't override it today — if a site needs\n * to, that is a one-line change here, not a per-site branch.\n */\n\nimport type { Constraints, InputKind, Messages } from \"./types\";\nimport type { ZodNode } from \"./internals\";\nimport { readChecks } from \"./checks\";\nimport { unwrap } from \"./unwrap\";\n\nconst TEXTAREA_MIN_MAX = 120;\n\nexport interface InputInfo {\n input: InputKind;\n constraints: Constraints;\n messages: Messages;\n options?: string[];\n}\n\nexport function inputFor(node: ZodNode): InputInfo {\n const def = node._zod.def;\n const { constraints, messages } = readChecks(node);\n\n switch (def.type) {\n case \"string\": {\n if (constraints.format === \"url\") return { input: \"url\", constraints, messages };\n const long = (constraints.max ?? 0) > TEXTAREA_MIN_MAX;\n return { input: long ? \"textarea\" : \"text\", constraints, messages };\n }\n case \"date\":\n return { input: \"date\", constraints, messages };\n case \"number\":\n case \"int\":\n return { input: \"number\", constraints, messages };\n case \"boolean\":\n return { input: \"boolean\", constraints, messages };\n case \"enum\":\n case \"literal\": {\n const options = Object.values(def.entries ?? {}).map(String);\n return { input: \"select\", constraints, messages, options };\n }\n case \"array\": {\n if (def.element) {\n const item = unwrap(def.element);\n const inner = readChecks(item.node);\n constraints.item = inner;\n }\n return { input: \"tags\", constraints, messages };\n }\n default:\n // Anything unrecognised (object, union, …) is presented as text so the\n // value can at least be carried; a renderer may choose to treat it as hidden.\n return { input: \"text\", constraints, messages };\n }\n}\n","/**\n * Labels and placeholders.\n *\n * Precedence (decided 2026-09-08):\n * label: registry.labels[name] → .meta({ label }) → .describe() → titlecase(name)\n * placeholder: registry.placeholders[name] → .meta({ placeholder }) → undefined\n *\n * The registry tier exists for schemas that can't be edited yet (5degrees\n * until its repo transfer). The meta tier is the intended home — one source of\n * truth beside the validation rules. Titlecase is the floor, and it is naive on\n * purpose: an acronym coming out as \"Rsvp url\" is the signal that a real label\n * is missing.\n *\n * Meta is read from zod's global registry via the schema's own `meta()` /\n * `description` accessors, so no zod value is imported here.\n */\n\nimport type { ContentTypeEntry, InputKind } from \"./types\";\n\ninterface MetaBearing {\n meta?: () => Record<string, unknown> | undefined;\n description?: string;\n}\n\ninterface FieldMeta {\n label?: string;\n placeholder?: string;\n description?: string;\n recommended?: [number, number];\n suffix?: string;\n help?: string;\n input?: InputKind;\n}\n\nexport function readMeta(schema: unknown): FieldMeta {\n const s = schema as MetaBearing;\n const raw = typeof s.meta === \"function\" ? (s.meta() ?? {}) : {};\n const pick = (k: keyof FieldMeta) => (typeof raw[k] === \"string\" ? (raw[k] as string) : undefined);\n const rec = raw.recommended;\n const recommended =\n Array.isArray(rec) && rec.length === 2 && rec.every((n) => typeof n === \"number\") ? ([rec[0], rec[1]] as [number, number]) : undefined;\n const INPUTS: InputKind[] = [\"text\", \"textarea\", \"date\", \"number\", \"boolean\", \"select\", \"tags\", \"image\", \"url\", \"time\"];\n const input = typeof raw.input === \"string\" && (INPUTS as string[]).includes(raw.input) ? (raw.input as InputKind) : undefined;\n return {\n label: pick(\"label\"),\n placeholder: pick(\"placeholder\"),\n description: pick(\"description\") ?? (typeof s.description === \"string\" ? s.description : undefined),\n recommended,\n suffix: pick(\"suffix\"),\n help: pick(\"help\"),\n input,\n };\n}\n\nexport function inputOverrideFor(\n name: string,\n schema: unknown,\n entry?: Pick<ContentTypeEntry, \"inputs\">,\n): InputKind | undefined {\n return entry?.inputs?.[name] ?? readMeta(schema).input;\n}\n\nexport function recommendedFor(\n name: string,\n schema: unknown,\n entry?: Pick<ContentTypeEntry, \"recommended\">,\n): [number, number] | undefined {\n return entry?.recommended?.[name] ?? readMeta(schema).recommended;\n}\n\nexport function titlecase(name: string): string {\n const words = name\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .replace(/[_-]+/g, \" \")\n .toLowerCase()\n .trim();\n return words.charAt(0).toUpperCase() + words.slice(1);\n}\n\nexport function labelFor(name: string, schema: unknown, entry?: Pick<ContentTypeEntry, \"labels\">): string {\n const fromRegistry = entry?.labels?.[name];\n if (fromRegistry) return fromRegistry;\n const meta = readMeta(schema);\n return meta.label ?? meta.description ?? titlecase(name);\n}\n\nexport function placeholderFor(\n name: string,\n schema: unknown,\n entry?: Pick<ContentTypeEntry, \"placeholders\">,\n): string | undefined {\n return entry?.placeholders?.[name] ?? readMeta(schema).placeholder;\n}\n\nexport function helpFor(name: string, schema: unknown, entry?: Pick<ContentTypeEntry, \"help\">): string | undefined {\n return entry?.help?.[name] ?? readMeta(schema).help;\n}\n","/**\n * walkSchema — a zod object schema (+ optional registry entry) → FieldSpec[].\n *\n * Synchronous and pure. Reads the schema's shape and checks; never parses a\n * value, never calls an options resolver, never imports zod at runtime.\n *\n * Roles from the registry override the schema-derived input kind: a field the\n * entry names as an image is `role: \"image\"` even though zod sees a string.\n * Hidden fields are still emitted so a renderer can carry their values through.\n */\n\nimport type { ContentTypeEntry, FieldRole, FieldSpec } from \"./types\";\nimport type { ZodNode } from \"./internals\";\nimport { asNode } from \"./internals\";\nimport { inputFor } from \"./inputs\";\nimport { helpFor, inputOverrideFor, labelFor, placeholderFor, readMeta, recommendedFor } from \"./labels\";\nimport { unwrap } from \"./unwrap\";\n\ntype Entry = Partial<Omit<ContentTypeEntry, \"schema\" | \"filename\" | \"id\" | \"label\" | \"folder\">>;\n\nexport function walkSchema(schema: unknown, entry: Entry = {}): FieldSpec[] {\n const root = asNode(schema);\n const shape = shapeOf(root);\n const names = Object.keys(shape);\n\n const specs = names.map((name): FieldSpec => {\n const raw = shape[name];\n const { node, required } = unwrap(raw);\n const info = inputFor(node);\n const role = roleFor(name, entry);\n\n return {\n name,\n label: labelFor(name, raw, entry),\n input: role === \"image\" ? \"image\" : (inputOverrideFor(name, raw, entry) ?? info.input),\n required,\n constraints: info.constraints,\n messages: info.messages,\n placeholder: placeholderFor(name, raw, entry),\n recommended: recommendedFor(name, raw, entry),\n suffix: readMeta(raw).suffix,\n help: helpFor(name, raw, entry),\n order: 0,\n role,\n options: entry.options?.[name] ?? info.options,\n };\n });\n\n return applyOrder(specs, entry.order ?? []);\n}\n\n/** `.strict()` and object-level `.refine()` both leave `shape` on the object def. */\nfunction shapeOf(root: ZodNode): Record<string, ZodNode> {\n let node = root;\n for (let i = 0; i < 8 && !node._zod.def.shape; i++) {\n const def = node._zod.def;\n const next = def.innerType ?? def.in;\n if (!next) break;\n node = next;\n }\n const shape = node._zod.def.shape;\n if (!shape) throw new TypeError(`walkSchema: expected an object schema, got \"${root._zod.def.type}\"`);\n return shape;\n}\n\nfunction roleFor(name: string, entry: Entry): FieldRole {\n if (entry.hidden?.includes(name)) return \"hidden\";\n if (entry.body === name) return \"body\";\n if (entry.images?.includes(name)) return \"image\";\n return \"field\";\n}\n\n/** Named fields first in the given order; the rest keep schema key order. */\nfunction applyOrder(specs: FieldSpec[], order: string[]): FieldSpec[] {\n const rank = new Map(order.map((n, i) => [n, i]));\n const named = specs.filter((s) => rank.has(s.name)).sort((a, b) => rank.get(a.name)! - rank.get(b.name)!);\n const rest = specs.filter((s) => !rank.has(s.name));\n return [...named, ...rest].map((s, i) => ({ ...s, order: i }));\n}\n","/**\n * defineContentType — validate a registry entry against the schema it describes.\n *\n * Validation is hand-rolled rather than a zod schema on purpose: this module\n * must not import zod at runtime (the host's instance is the only one that\n * should exist). The checks are small and the errors name the bad key.\n */\n\nimport type { ZodType } from \"zod\";\nimport type { ContentTypeEntry } from \"./types\";\nimport { asNode } from \"./internals\";\n\nexport function defineContentType<S extends ZodType>(entry: ContentTypeEntry<S>): ContentTypeEntry<S> {\n const where = `defineContentType(\"${entry.id}\")`;\n\n for (const key of [\"id\", \"label\", \"folder\"] as const) {\n if (typeof entry[key] !== \"string\" || entry[key].length === 0) {\n throw new TypeError(`${where}: \"${key}\" must be a non-empty string`);\n }\n }\n if (typeof entry.filename !== \"function\") {\n throw new TypeError(`${where}: \"filename\" must be a function (frontmatter) => string`);\n }\n if (entry.slugFromFilename !== undefined && typeof entry.slugFromFilename !== \"function\") {\n throw new TypeError(`${where}: \"slugFromFilename\" must be a function (fileName) => string | null`);\n }\n if (entry.body !== null && typeof entry.body !== \"string\") {\n throw new TypeError(`${where}: \"body\" must be a field name or null`);\n }\n\n const root = asNode(entry.schema, `${where}: schema`);\n const shape = findShape(root);\n const known = new Set(Object.keys(shape));\n\n const check = (list: string[] | undefined, key: string) => {\n for (const name of list ?? []) {\n if (!known.has(name)) throw new TypeError(`${where}: ${key} names \"${name}\", which is not a field of the schema`);\n }\n };\n\n if (entry.body !== null) check([entry.body], \"body\");\n check(entry.images, \"images\");\n check(entry.order, \"order\");\n check(entry.hidden, \"hidden\");\n check(Object.keys(entry.labels ?? {}), \"labels\");\n check(Object.keys(entry.placeholders ?? {}), \"placeholders\");\n check(Object.keys(entry.recommended ?? {}), \"recommended\");\n check(Object.keys(entry.inputs ?? {}), \"inputs\");\n check(Object.keys(entry.help ?? {}), \"help\");\n check(Object.keys(entry.options ?? {}), \"options\");\n for (const g of entry.groups ?? []) {\n if (typeof g.label !== \"string\" || g.label.length === 0) throw new TypeError(`${where}: every group needs a label`);\n check(g.fields, `groups[\"${g.label}\"]`);\n }\n\n return entry;\n}\n\nfunction findShape(root: ReturnType<typeof asNode>): Record<string, unknown> {\n let node = root;\n for (let i = 0; i < 8 && !node._zod.def.shape; i++) {\n const next = node._zod.def.innerType ?? node._zod.def.in;\n if (!next) break;\n node = next;\n }\n if (!node._zod.def.shape) throw new TypeError(\"defineContentType: schema must be a zod object\");\n return node._zod.def.shape;\n}\n","/**\n * navFromContentTypes — the sidebar derives from the registry.\n *\n * Adding a content type to a site (one defineContentType entry) puts it in\n * the nav with no shell change. Pure; lives in /forms so the server layout\n * can compute it without importing the client bundle.\n */\n\nimport type { ContentTypeEntry } from \"./types\";\n\nexport interface NavEntry {\n id: string;\n label: string;\n href: string;\n icon: string;\n}\n\nexport function navFromContentTypes(\n entries: Record<string, ContentTypeEntry> | ContentTypeEntry[],\n opts: { basePath?: string } = {},\n): NavEntry[] {\n const base = (opts.basePath ?? \"/admin\").replace(/\\/+$/, \"\");\n const list = Array.isArray(entries) ? entries : Object.values(entries);\n return list.map((e) => ({ id: e.id, label: e.label, href: `${base}/${e.id}`, icon: e.id }));\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { C as ContentTypeEntry, F as FieldSpec } from '../types-DyryuIX1.cjs';
2
- export { a as Constraints, b as FieldRole, I as InputKind, M as Messages, O as OptionsSource } from '../types-DyryuIX1.cjs';
1
+ import { C as ContentTypeEntry, F as FieldSpec } from '../types-D46UjOfv.cjs';
2
+ export { a as Constraints, b as FieldRole, I as InputKind, M as Messages, O as OptionsSource } from '../types-D46UjOfv.cjs';
3
3
  import { ZodType } from 'zod';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { C as ContentTypeEntry, F as FieldSpec } from '../types-DyryuIX1.js';
2
- export { a as Constraints, b as FieldRole, I as InputKind, M as Messages, O as OptionsSource } from '../types-DyryuIX1.js';
1
+ import { C as ContentTypeEntry, F as FieldSpec } from '../types-D46UjOfv.js';
2
+ export { a as Constraints, b as FieldRole, I as InputKind, M as Messages, O as OptionsSource } from '../types-D46UjOfv.js';
3
3
  import { ZodType } from 'zod';
4
4
 
5
5
  /**
@@ -1,3 +1,3 @@
1
- export { defineContentType, navFromContentTypes, titlecase, walkSchema } from '../chunk-J6FI73PF.js';
1
+ export { defineContentType, navFromContentTypes, titlecase, walkSchema } from '../chunk-JLR5K6RP.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
@@ -145,7 +145,7 @@ function readMeta(schema) {
145
145
  const pick = (k) => typeof raw[k] === "string" ? raw[k] : void 0;
146
146
  const rec = raw.recommended;
147
147
  const recommended = Array.isArray(rec) && rec.length === 2 && rec.every((n) => typeof n === "number") ? [rec[0], rec[1]] : void 0;
148
- const INPUTS = ["text", "textarea", "date", "number", "boolean", "select", "tags", "image", "url"];
148
+ const INPUTS = ["text", "textarea", "date", "number", "boolean", "select", "tags", "image", "url", "time"];
149
149
  const input = typeof raw.input === "string" && INPUTS.includes(raw.input) ? raw.input : void 0;
150
150
  return {
151
151
  label: pick("label"),
@@ -276,6 +276,128 @@ function ChipsInput({ id, name, value, onChange, onBlur, placeholder, invalid, m
276
276
  ] })
277
277
  ] });
278
278
  }
279
+ function labelFor2(value, labels) {
280
+ if (labels?.[value]) return labels[value];
281
+ return value ? titlecase(value) : "\u2014";
282
+ }
283
+ function SelectInput(p) {
284
+ const [open, setOpen] = react.useState(false);
285
+ const [active, setActive] = react.useState(0);
286
+ const wrap = react.useRef(null);
287
+ const list = react.useRef(null);
288
+ const listId = react.useId();
289
+ const choices = p.allowEmpty ? ["", ...p.options] : p.options;
290
+ const latest = react.useRef({ choices, value: p.value });
291
+ latest.current = { choices, value: p.value };
292
+ react.useEffect(() => {
293
+ if (!open) return;
294
+ setActive(Math.max(0, latest.current.choices.indexOf(latest.current.value)));
295
+ const onDoc = (e) => {
296
+ if (!wrap.current?.contains(e.target)) close();
297
+ };
298
+ document.addEventListener("mousedown", onDoc);
299
+ return () => document.removeEventListener("mousedown", onDoc);
300
+ }, [open]);
301
+ react.useEffect(() => {
302
+ if (!open) return;
303
+ list.current?.querySelectorAll("[role=option]")[active]?.scrollIntoView?.({ block: "nearest" });
304
+ }, [open, active]);
305
+ const close = () => {
306
+ setOpen(false);
307
+ p.onBlur?.();
308
+ };
309
+ const pick = (v) => {
310
+ if (v !== p.value) p.onChange(v);
311
+ close();
312
+ };
313
+ const onKey = (e) => {
314
+ if (!open) {
315
+ if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter" || e.key === " ") {
316
+ e.preventDefault();
317
+ setOpen(true);
318
+ }
319
+ return;
320
+ }
321
+ switch (e.key) {
322
+ case "ArrowDown":
323
+ e.preventDefault();
324
+ setActive((i) => Math.min(choices.length - 1, i + 1));
325
+ break;
326
+ case "ArrowUp":
327
+ e.preventDefault();
328
+ setActive((i) => Math.max(0, i - 1));
329
+ break;
330
+ case "Home":
331
+ e.preventDefault();
332
+ setActive(0);
333
+ break;
334
+ case "End":
335
+ e.preventDefault();
336
+ setActive(choices.length - 1);
337
+ break;
338
+ case "Enter":
339
+ case " ":
340
+ e.preventDefault();
341
+ pick(choices[active] ?? "");
342
+ break;
343
+ case "Escape":
344
+ e.preventDefault();
345
+ close();
346
+ break;
347
+ case "Tab":
348
+ close();
349
+ break;
350
+ default: {
351
+ if (e.key.length === 1 && /\S/.test(e.key)) {
352
+ const k = e.key.toLowerCase();
353
+ const idx = choices.findIndex((c) => labelFor2(c, p.labels).toLowerCase().startsWith(k));
354
+ if (idx >= 0) setActive(idx);
355
+ }
356
+ }
357
+ }
358
+ };
359
+ const cls = ["realiiz-form__control", "realiiz-select__btn", p.invalid && "realiiz-form__control--invalid", open && "realiiz-select__btn--open"].filter(Boolean).join(" ");
360
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: wrap, className: "realiiz-select", onKeyDown: onKey, children: [
361
+ /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name: p.name, value: p.value, readOnly: true }),
362
+ /* @__PURE__ */ jsxRuntime.jsxs(
363
+ "button",
364
+ {
365
+ type: "button",
366
+ id: p.id,
367
+ className: cls,
368
+ role: "combobox",
369
+ "aria-haspopup": "listbox",
370
+ "aria-expanded": open,
371
+ "aria-controls": listId,
372
+ "aria-invalid": p.invalid || void 0,
373
+ "aria-describedby": p.invalid ? `${p.id}-error` : void 0,
374
+ disabled: p.disabled,
375
+ onClick: () => open ? close() : setOpen(true),
376
+ children: [
377
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: p.value ? void 0 : "realiiz-select__placeholder", children: labelFor2(p.value, p.labels) }),
378
+ /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9l6 6 6-6" }) })
379
+ ]
380
+ }
381
+ ),
382
+ open && /* @__PURE__ */ jsxRuntime.jsx("ul", { ref: list, id: listId, className: "realiiz-select__menu", role: "listbox", "aria-labelledby": p.id, tabIndex: -1, children: choices.map((c, i) => /* @__PURE__ */ jsxRuntime.jsxs(
383
+ "li",
384
+ {
385
+ role: "option",
386
+ "aria-selected": c === p.value,
387
+ "data-value": c,
388
+ className: ["realiiz-select__item", i === active && "realiiz-select__item--active", c === p.value && "realiiz-select__item--selected"].filter(Boolean).join(" "),
389
+ onMouseEnter: () => setActive(i),
390
+ onMouseDown: (e) => e.preventDefault(),
391
+ onClick: () => pick(c),
392
+ children: [
393
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "realiiz-select__check", "aria-hidden": "true", children: c === p.value ? "\u2713" : "" }),
394
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: labelFor2(c, p.labels) })
395
+ ]
396
+ },
397
+ c || "__empty"
398
+ )) })
399
+ ] });
400
+ }
279
401
  function Control(p) {
280
402
  const cls = ["realiiz-form__control", p.invalid && "realiiz-form__control--invalid"].filter(Boolean).join(" ");
281
403
  const common = {
@@ -290,10 +412,19 @@ function Control(p) {
290
412
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cls, "aria-busy": "true", style: { color: "var(--_muted)" }, children: "Loading options\u2026" });
291
413
  }
292
414
  if (p.options || p.spec.input === "select") {
293
- return /* @__PURE__ */ jsxRuntime.jsxs("select", { ...common, className: cls, value: str, onChange: (e) => p.onChange(e.target.value), children: [
294
- !p.spec.required && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: "\u2014" }),
295
- (p.options ?? []).map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o, children: o }, o))
296
- ] });
415
+ return /* @__PURE__ */ jsxRuntime.jsx(
416
+ SelectInput,
417
+ {
418
+ id: p.id,
419
+ name: p.spec.name,
420
+ value: str,
421
+ options: p.options ?? [],
422
+ allowEmpty: !p.spec.required,
423
+ invalid: p.invalid,
424
+ onChange: p.onChange,
425
+ onBlur: p.onBlur
426
+ }
427
+ );
297
428
  }
298
429
  switch (p.spec.input) {
299
430
  case "textarea":
@@ -329,6 +460,8 @@ function Control(p) {
329
460
  onChange: (e) => p.onChange(e.target.value)
330
461
  }
331
462
  );
463
+ case "time":
464
+ return /* @__PURE__ */ jsxRuntime.jsx("input", { ...common, type: "time", className: cls, value: str, onChange: (e) => p.onChange(e.target.value) });
332
465
  case "url":
333
466
  return /* @__PURE__ */ jsxRuntime.jsx(
334
467
  "input",
@@ -1202,6 +1335,18 @@ var FORM_CSS = `
1202
1335
  .realiiz-form__control--textarea{min-height:110px;resize:vertical}
1203
1336
  .realiiz-form__control--body{min-height:280px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:14px}
1204
1337
  .realiiz-form__control--invalid{border-color:var(--_danger)}
1338
+ .realiiz-select{position:relative}
1339
+ .realiiz-select__btn{display:flex;align-items:center;justify-content:space-between;gap:10px;text-align:left;cursor:pointer;background:#fff}
1340
+ .realiiz-select__btn svg{flex-shrink:0;color:var(--_muted);transition:transform .15s}
1341
+ .realiiz-select__btn--open{border-color:var(--_accent);box-shadow:var(--_ring)}
1342
+ .realiiz-select__btn--open svg{transform:rotate(180deg)}
1343
+ .realiiz-select__btn:disabled{opacity:.6;cursor:default}
1344
+ .realiiz-select__placeholder{color:var(--_muted)}
1345
+ .realiiz-select__menu{position:absolute;left:0;right:0;top:calc(100% + 6px);margin:0;padding:6px 0;list-style:none;background:#fff;border:1px solid var(--_border);border-radius:var(--_radius);box-shadow:0 8px 24px rgba(14,23,38,.14);max-height:260px;overflow:auto;z-index:40}
1346
+ .realiiz-select__item{display:flex;align-items:center;gap:8px;padding:8px 12px;font-size:14px;color:var(--_fg);cursor:pointer}
1347
+ .realiiz-select__item--active{background:var(--realiiz-form-hover,rgba(0,0,0,.05))}
1348
+ .realiiz-select__item--selected{font-weight:600}
1349
+ .realiiz-select__check{width:1em;flex-shrink:0;color:var(--_accent);font-weight:700}
1205
1350
  .realiiz-form__check{display:flex;align-items:center;gap:8px;font-weight:500}
1206
1351
  .realiiz-form__check input{width:18px;height:18px;margin:0}
1207
1352
  .realiiz-form__helper{display:flex;justify-content:space-between;gap:12px;font-size:12px;color:var(--_muted);margin-top:4px;min-height:1em}
@@ -1516,6 +1661,7 @@ exports.IMAGE_HINT = IMAGE_HINT;
1516
1661
  exports.ImageInput = ImageInput;
1517
1662
  exports.LengthGauge = LengthGauge;
1518
1663
  exports.MarkdownEditor = MarkdownEditor;
1664
+ exports.SelectInput = SelectInput;
1519
1665
  exports.TOOLS = TOOLS;
1520
1666
  exports.slugify = slugify;
1521
1667
  //# sourceMappingURL=index.cjs.map