{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cta-offer",
  "type": "registry:block",
  "title": "CTA, offer",
  "description": "The offer of the week as one block: what you get in three to five points, how fast (text), this week's limit (text), and one primary action that is either a link or a one-field form. No countdown, no clock: swapping the offer is editing text.",
  "categories": [
    "cta"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/button.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/input.json",
    "https://ui.klarhimmel.com/r/kit-form.json"
  ],
  "files": [
    {
      "path": "src/blocks/cta-offer/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/cta-offer/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, formErrors, formFields, formStatus, req, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60).optional(),\n  title: req(120),\n  description: t(300).optional(),\n  /** What the person gets. Three to five short points. */\n  points: z.array(t(120)).min(3).max(5),\n  pointsTitle: t(60),\n  /** How fast, as text: \"Within 24 hours\". Never a clock or a countdown. */\n  turnaround: t(60),\n  turnaroundLabel: t(40),\n  /** This week's limit, as text: \"Five reviews this week\". Change it by editing the text. */\n  limit: t(60),\n  limitLabel: t(40),\n  /** link: one button to somewhere else. form: one short field and a button, posting through the form props below. The field type domain takes what owners type (yourcompany.se or a full address). */\n  mode: z.enum(['link', 'form']),\n  link: z.object({ label: req(40), href: t(300) }),\n  form: z.object({ fieldLabel: req(60), fieldType: z.enum(['domain', 'url', 'email', 'text']),\n    /** The field's form name. Default \"message\", so a backend that stores email + message keeps working. */\n    fieldName: t(40).optional(), submit: req(40), note: t(160).optional() }),\n  ...formFields,\n  ...formStatus,\n  /** What the field says under itself when the browser's own validation fails (see formErrors). Optional: English defaults. */\n  errors: formErrors,\n});\n\nexport const spec = defineSpec({\n  type: 'cta-offer',\n  aliases: ['cta/offer'],\n  name: 'CTA, offer',\n  category: 'cta',\n  role: 'body',\n  description: 'The offer of the week as one block: what you get in three to five points, how fast (text), this week\\'s limit (text), and one primary action that is either a link or a one-field form. No countdown, no clock: swapping the offer is editing text.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the section',\n    title: 'Say what the visitor gets',\n    description: 'Say in one or two sentences what you do for the visitor and how you hand it over.',\n    pointsTitle: 'Name the list',\n    points: ['Say the first thing they get, in a line', 'Say the second thing they get, in a line and how it is delivered', 'Say the third thing they get, in a line'],\n    turnaroundLabel: 'Name the time',\n    turnaround: 'Say how long it takes',\n    limitLabel: 'Name the limit',\n    limit: 'Say how many are available',\n    mode: 'form',\n    link: { label: 'Main action', href: '#review' },\n    errors: { required: 'Say what to fill in', email: 'Say how to write a valid email address, with an example', url: 'Say how to write a valid web address, with an example', domain: 'Say how to write a valid site address' },\n    messages: { sent: 'Thank the visitor and say what happens next and when it happens', error: 'Say that it failed and what to try next' },\n    form: { fieldLabel: 'Your web address', fieldType: 'domain', submit: 'Send the request', note: 'Say how the address is used and nothing more' },\n  },\n});\n"
    },
    {
      "path": "src/blocks/cta-offer/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/cta-offer/index.tsx",
      "content": "import { useId } from 'react';\nimport { Check } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { Button, ButtonLink } from '../../ui/button';\nimport { Input } from '../../ui/input';\nimport { DOMAIN_PATTERN, EMAIL_PATTERN, ERROR_WORDS, FieldError, FormExtras, FormStatus, URL_PATTERN, useFieldErrors, useFormProps } from '../_shared/form-kit';\nimport { Container, Eyebrow, Opt, Section, useEditing } from '../_shared/kit';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\nfunction CtaOffer({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  const formProps = useFormProps(props);\n  const asForm = props.mode === 'form';\n  const words = { ...ERROR_WORDS, ...props.errors };\n  const kind = props.form.fieldType === 'domain' || props.form.fieldType === 'url' || props.form.fieldType === 'email' ? props.form.fieldType : 'text';\n  const { errs, fieldProps } = useFieldErrors(words, (n) => `${id}-${n}`);\n  const sent = props.status === 'sent' && !editing;\n  return (\n    <Section labelledBy={id}>\n      <Container width=\"narrow\">\n        <div className=\"rounded-kh-xl border border-kh-line-strong bg-kh-surface p-6 shadow-kh-2 @xl:p-10\">\n          <Eyebrow path={['eyebrow']} value={props.eyebrow} />\n          <div id={id}>\n            <Text path={['title']} value={props.title} as=\"h2\" className=\"text-kh-title font-semibold\" />\n          </div>\n          <Opt path={['description']} value={props.description} className=\"mt-3 text-kh-lead text-kh-muted\" placeholder=\"Description\" />\n          <Text path={['pointsTitle']} value={props.pointsTitle} as=\"h3\" className=\"mt-8 text-kh-heading font-semibold\" />\n          <ul className=\"mt-3 flex flex-col gap-2.5\">\n            {props.points.map((p, i) => (\n              <li key={i} className=\"flex gap-3 text-kh-body\">\n                <Check aria-hidden strokeWidth={2.25} className=\"mt-1 size-4 shrink-0 text-kh-accent-ink\" />\n                <Text path={['points', i]} value={p} as=\"span\" />\n              </li>\n            ))}\n          </ul>\n          <dl className=\"mt-8 grid gap-4 border-y border-kh-line py-5 @md:grid-cols-2\">\n            <div>\n              <dt className=\"text-kh-caption font-medium uppercase tracking-widest text-kh-muted\">\n                <Text path={['turnaroundLabel']} value={props.turnaroundLabel} as=\"span\" />\n              </dt>\n              <dd className=\"mt-1 text-kh-body font-medium\">\n                <Text path={['turnaround']} value={props.turnaround} as=\"span\" />\n              </dd>\n            </div>\n            <div>\n              <dt className=\"text-kh-caption font-medium uppercase tracking-widest text-kh-muted\">\n                <Text path={['limitLabel']} value={props.limitLabel} as=\"span\" />\n              </dt>\n              <dd className=\"mt-1 text-kh-body font-medium\">\n                <Text path={['limit']} value={props.limit} as=\"span\" />\n              </dd>\n            </div>\n          </dl>\n          <div hidden={!asForm && !editing} className=\"mt-8\">\n            <form {...formProps} hidden={!asForm && !editing} className=\"flex flex-col gap-4\">\n              <FormStatus status={props.status} messages={props.messages} />\n              <div hidden={sent} className=\"flex flex-col gap-4\">\n              <div>\n                <label htmlFor={`${id}-f`} className=\"mb-1.5 block text-kh-small font-medium\">\n                  <Text path={['form', 'fieldLabel']} value={props.form.fieldLabel} as=\"span\" />\n                </label>\n                <Input\n                  id={`${id}-f`}\n                  name={props.form.fieldName || 'message'}\n                  type={kind === 'domain' ? 'text' : kind}\n                  required\n                  {...(kind === 'domain' ? { pattern: DOMAIN_PATTERN, title: words.domain, inputMode: 'url' as const, autoComplete: 'url', autoCapitalize: 'none', spellCheck: false } : kind === 'url' ? { pattern: URL_PATTERN, title: words.url, inputMode: 'url' as const, autoComplete: 'url', autoCapitalize: 'none', spellCheck: false } : kind === 'email' ? { pattern: EMAIL_PATTERN, title: words.email, autoComplete: 'email', autoCapitalize: 'none', spellCheck: false } : {})}\n                  {...fieldProps('f', kind)}\n                />\n                <FieldError id={`${id}-f`} text={errs.f} />\n                {editing && (\n                  <p className=\"mt-1 text-kh-caption text-kh-muted\">\n                    <Text path={['errors', 'required']} value={words.required} as=\"span\" /> · <Text path={['errors', 'email']} value={words.email} as=\"span\" /> · <Text path={['errors', 'url']} value={words.url} as=\"span\" /> · <Text path={['errors', 'domain']} value={words.domain} as=\"span\" />\n                  </p>\n                )}\n              </div>\n              <FormExtras {...props} />\n              <Button type=\"submit\" size=\"lg\">\n                <Text path={['form', 'submit']} value={props.form.submit} as=\"span\" />\n              </Button>\n              <Opt path={['form', 'note']} value={props.form.note} className=\"text-kh-small text-kh-muted\" placeholder=\"Note\" />\n              </div>\n            </form>\n          </div>\n          <div hidden={asForm && !editing} className=\"mt-8\">\n            <ButtonLink href={props.link.href} size=\"lg\">\n              <Text path={['link', 'label']} value={props.link.label} as=\"span\" />\n            </ButtonLink>\n          </div>\n        </div>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(CtaOffer);\n"
    }
  ]
}
