{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "settings-03",
  "title": "Workspace settings",
  "description": "Name and address, the default role for new members read against who holds each role, and a danger zone where archiving takes a two-second hold and deleting takes the typed name.",
  "dependencies": [
    "@base-ui/react",
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/alert-dialog.json",
    "https://ui.ndekocode.dev/r/animated-size.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/company-mark.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/input.json",
    "https://ui.ndekocode.dev/r/motion-word-roll.json",
    "https://ui.ndekocode.dev/r/radio-group.json",
    "https://ui.ndekocode.dev/r/select.json",
    "https://ui.ndekocode.dev/r/switch.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/settings/settings-03/index.tsx",
      "content": "'use client';\n\nimport { useId, useState } from 'react';\n\nimport {\n  SettingsIcon,\n  TriangleAlertIcon,\n  UsersIcon,\n} from '@/registry/ndeko/lib/icons';\nimport { CompanyMark } from '@/registry/ndeko/ui/company-mark';\n\nimport { DangerZone } from './danger-zone';\nimport {\n  FIELD_SECTION,\n  INITIAL_WORKSPACE,\n  INVITE_POLICIES,\n  ROLE_OPTIONS,\n  SECTION_KEYS,\n  TIME_ZONES,\n  WORKSPACE_HOST,\n  type Role,\n  type SectionId,\n  type WorkspaceField,\n  type WorkspaceValues,\n} from './data';\nimport { RoleChoice } from './role-choice';\nimport {\n  SETTINGS_SURFACE_BASE,\n  SectionPanel,\n  SectionTabs,\n  SelectRow,\n  SettingsPage,\n  SettingsRow,\n  SettingsSection,\n  SwitchRow,\n  TextRow,\n  UnsavedBar,\n  hasChangeIn,\n  useSettingsDraft,\n  type NavItem,\n} from './settings-kit';\n\ntype WorkspaceErrors = Partial<Record<WorkspaceField, string>>;\n\nconst SECTIONS = [\n  { id: 'general', label: 'General', icon: SettingsIcon },\n  { id: 'members', label: 'Members', icon: UsersIcon },\n  { id: 'danger', label: 'Danger zone', icon: TriangleAlertIcon },\n] as const;\n\nconst FIELD_ORDER: WorkspaceField[] = ['name', 'slug', 'allowedDomain'];\n\nconst SLUG_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;\n\nconst DOMAIN_PATTERN = /^[a-z0-9-]+(\\.[a-z0-9-]+)+$/;\n\nfunction errorsOf(values: WorkspaceValues): WorkspaceErrors {\n  const errors: WorkspaceErrors = {};\n  const name = values.name.trim();\n  const domain = values.allowedDomain.trim();\n  const hasDomain = domain.length > 0;\n  const isSlugValid = SLUG_PATTERN.test(values.slug);\n  const isDomainValid = DOMAIN_PATTERN.test(domain);\n  const isDomainMalformed = hasDomain && !isDomainValid;\n  if (name.length === 0) {\n    errors.name = 'Give the workspace a name';\n  }\n  if (!isSlugValid) {\n    errors.slug = 'Use lowercase letters and digits, joined by single hyphens';\n  }\n  if (isDomainMalformed) {\n    errors.allowedDomain =\n      'Enter a domain like tidewell.example, without the @';\n  }\n  return errors;\n}\n\nfunction firstErrorFieldOf(errors: WorkspaceErrors) {\n  const field = FIELD_ORDER.find((candidate) => Boolean(errors[candidate]));\n  if (field) {\n    return field;\n  }\n  return null;\n}\n\nfunction withoutError(errors: WorkspaceErrors, field: WorkspaceField) {\n  if (!errors[field]) {\n    return errors;\n  }\n  const next = { ...errors };\n  delete next[field];\n  return next;\n}\n\nfunction fixMessageOf(errors: WorkspaceErrors) {\n  const messages = Object.values(errors);\n  const count = messages.filter(Boolean).length;\n  if (count === 0) {\n    return undefined;\n  }\n  if (count === 1) {\n    return 'Fix 1 field to save';\n  }\n  return `Fix ${count} fields to save`;\n}\n\nfunction slugLineOf(slug: string) {\n  const address = `${WORKSPACE_HOST}${slug}`;\n  return `${address}, old links redirect for 30 days`;\n}\n\nfunction domainLineOf(domain: string) {\n  const trimmed = domain.trim();\n  if (trimmed.length === 0) {\n    return 'Empty: people join only with an invitation';\n  }\n  return `Anyone with an @${trimmed} address can join`;\n}\n\nfunction fieldIdOf(field: WorkspaceField) {\n  return `workspace-${field}`;\n}\n\nfunction focusField(field: WorkspaceField) {\n  const fieldId = fieldIdOf(field);\n  window.requestAnimationFrame(() => {\n    document.getElementById(fieldId)?.focus();\n  });\n}\n\n/** The workspace has no logo of its own yet, so it wears a mark drawn from the address it was created with: renaming it keeps the mark. */\nfunction WorkspaceTile() {\n  return (\n    <CompanyMark seed={INITIAL_WORKSPACE.slug} className='size-10 rounded-lg' />\n  );\n}\n\nexport default function Settings03() {\n  const settings = useSettingsDraft<WorkspaceValues>(INITIAL_WORKSPACE);\n  const [section, setSection] = useState<SectionId>('general');\n  const [hasSwitched, setHasSwitched] = useState(false);\n  const [shownErrors, setShownErrors] = useState<WorkspaceErrors>({});\n  const roleHeadingId = useId();\n  const draft = settings.draft;\n  const savedName = settings.savedValues.name;\n  const fixMessage = fixMessageOf(shownErrors);\n  const slugLine = slugLineOf(draft.slug);\n  const domainLine = domainLineOf(draft.allowedDomain);\n  const navItems: NavItem<SectionId>[] = SECTIONS.map((item) => ({\n    id: item.id,\n    label: item.label,\n    icon: item.icon,\n    hasChanges: hasChangeIn(settings.changedKeys, SECTION_KEYS[item.id]),\n  }));\n\n  function openSection(nextSection: SectionId) {\n    setSection(nextSection);\n    setHasSwitched(true);\n  }\n\n  function changeField<Field extends WorkspaceField>(\n    field: Field,\n    value: WorkspaceValues[Field]\n  ) {\n    settings.change(field, value);\n    setShownErrors((previous) => withoutError(previous, field));\n  }\n\n  function save() {\n    const errors = errorsOf(draft);\n    const firstField = firstErrorFieldOf(errors);\n    setShownErrors(errors);\n    if (!firstField) {\n      settings.save();\n      return;\n    }\n    const fieldSection = FIELD_SECTION[firstField];\n    if (fieldSection !== section) {\n      openSection(fieldSection);\n    }\n    focusField(firstField);\n  }\n\n  function discard() {\n    settings.discard();\n    setShownErrors({});\n  }\n\n  function changeName(name: string) {\n    changeField('name', name);\n  }\n\n  function changeSlug(slug: string) {\n    const lowered = slug.toLowerCase();\n    changeField('slug', lowered);\n  }\n\n  function changeTimeZone(timeZone: string) {\n    changeField('timeZone', timeZone);\n  }\n\n  function changeRole(role: Role) {\n    changeField('defaultRole', role);\n  }\n\n  function changeInvitePolicy(policy: string) {\n    const option = INVITE_POLICIES.find(\n      (candidate) => candidate.value === policy\n    );\n    if (option) {\n      changeField('invitePolicy', option.value);\n    }\n  }\n\n  function changeApproveJoins(checked: boolean) {\n    changeField('approveJoins', checked);\n  }\n\n  function changeDomain(domain: string) {\n    const lowered = domain.toLowerCase();\n    changeField('allowedDomain', lowered);\n  }\n\n  const bar = (\n    <UnsavedBar\n      isShown={settings.isBarShown}\n      status={settings.status}\n      changeCount={settings.changedKeys.length}\n      message={fixMessage}\n      onDiscard={discard}\n      onSave={save}\n    />\n  );\n\n  return (\n    <SettingsPage\n      title='Workspace'\n      line='The name, the address and who can join Tidewell Studio. Changes here apply to all 14 members.'\n      bar={bar}\n    >\n      <SectionTabs\n        label='Workspace sections'\n        items={navItems}\n        value={section}\n        onValueChange={openSection}\n      >\n        <SectionPanel value='general' animatesIn={hasSwitched}>\n          <SettingsSection\n            title='General'\n            line='How the workspace shows in the sidebar, links and emails'\n          >\n            <SettingsRow\n              label='Workspace tile'\n              line='No logo yet, so the tile shows the first letter of the name'\n            >\n              <WorkspaceTile />\n            </SettingsRow>\n            <TextRow\n              inputId={fieldIdOf('name')}\n              label='Name'\n              line='Shown in the sidebar and in invitations'\n              value={draft.name}\n              error={shownErrors.name}\n              autoComplete='organization'\n              maxLength={48}\n              onValueChange={changeName}\n            />\n            <TextRow\n              inputId={fieldIdOf('slug')}\n              label='Address'\n              line={slugLine}\n              value={draft.slug}\n              error={shownErrors.slug}\n              autoComplete='off'\n              maxLength={40}\n              onValueChange={changeSlug}\n            />\n            <SelectRow\n              label='Time zone'\n              line='Days in reports and timesheets close at midnight here'\n              value={draft.timeZone}\n              options={TIME_ZONES}\n              onValueChange={changeTimeZone}\n            />\n          </SettingsSection>\n        </SectionPanel>\n        <SectionPanel value='members' animatesIn={hasSwitched}>\n          <section\n            aria-labelledby={roleHeadingId}\n            className='flex flex-col gap-3'\n          >\n            <div className='flex flex-col gap-0.5'>\n              <h2 id={roleHeadingId} className='text-sm font-medium'>\n                Default role for new members\n              </h2>\n              <p className='text-muted-foreground text-xs'>\n                Given to everyone who joins from now on; people already in keep\n                their role\n              </p>\n            </div>\n            <div className={SETTINGS_SURFACE_BASE}>\n              <RoleChoice\n                labelledBy={roleHeadingId}\n                options={ROLE_OPTIONS}\n                value={draft.defaultRole}\n                onValueChange={changeRole}\n              />\n            </div>\n          </section>\n          <SettingsSection\n            title='Joining'\n            line='Invitations and the people who can send them'\n          >\n            <SelectRow\n              label='Who can invite'\n              line='Invitations last 7 days'\n              value={draft.invitePolicy}\n              options={INVITE_POLICIES}\n              onValueChange={changeInvitePolicy}\n            />\n            <SwitchRow\n              label='Approve new members'\n              line='People who join with a link wait until an admin lets them in'\n              checked={draft.approveJoins}\n              onCheckedChange={changeApproveJoins}\n            />\n            <TextRow\n              inputId={fieldIdOf('allowedDomain')}\n              label='Allowed email domain'\n              line={domainLine}\n              placeholder='company.com'\n              value={draft.allowedDomain}\n              error={shownErrors.allowedDomain}\n              autoComplete='off'\n              maxLength={64}\n              onValueChange={changeDomain}\n            />\n          </SettingsSection>\n        </SectionPanel>\n        <SectionPanel value='danger' animatesIn={hasSwitched}>\n          <SettingsSection\n            title='Danger zone'\n            line='These apply at once and do not wait for Save'\n          >\n            <DangerZone workspaceName={savedName} />\n          </SettingsSection>\n        </SectionPanel>\n      </SectionTabs>\n    </SettingsPage>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/settings-03/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/settings/settings-03/danger-zone.tsx",
      "content": "'use client';\n\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useEffect, useId, useRef, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport {\n  AlertDialog,\n  AlertDialogAction,\n  AlertDialogCancel,\n  AlertDialogContent,\n  AlertDialogDescription,\n  AlertDialogFooter,\n  AlertDialogHeader,\n  AlertDialogTitle,\n} from '@/registry/ndeko/ui/alert-dialog';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Input } from '@/registry/ndeko/ui/input';\n\nimport { WORKSPACE_FACTS } from './data';\nimport { SettingsRow } from './settings-kit';\n\nconst HOLD_MS = 2000;\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst SWAP_VARIANTS: Variants = {\n  enter: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n};\n\nconst LINE_VARIANTS: Variants = {\n  enter: { opacity: 0, y: 4 },\n  visible: { opacity: 1, y: 0 },\n  exit: { opacity: 0, y: -4 },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1 },\n  exit: { opacity: 0 },\n};\n\nconst COUNT_FORMAT = new Intl.NumberFormat('en');\n\nfunction swapVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SWAP_VARIANTS;\n}\n\nfunction lineVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return LINE_VARIANTS;\n}\n\nfunction clearTimer(timerRef: React.RefObject<number | null>) {\n  if (timerRef.current === null) {\n    return;\n  }\n  window.clearTimeout(timerRef.current);\n  timerRef.current = null;\n}\n\nfunction isHoldKey(event: React.KeyboardEvent) {\n  const isSpace = event.key === ' ';\n  const isEnter = event.key === 'Enter';\n  return isSpace || isEnter;\n}\n\n/**\n * Clip-path moves the fill; with reduced motion the fill fades in over the same two seconds,\n * because the theme drops clip-path transitions in that mode.\n */\nfunction holdFillClassOf(\n  isHolding: boolean,\n  shouldReduceMotion: boolean | null\n) {\n  if (shouldReduceMotion) {\n    return cn(\n      'opacity-0 transition-opacity duration-200',\n      isHolding && 'opacity-100 duration-[2000ms] ease-linear'\n    );\n  }\n  return cn(\n    '[clip-path:inset(0_100%_0_0)] transition-[clip-path] duration-200 ease-(--ease-out-strong)',\n    isHolding && '[clip-path:inset(0_0_0_0)] duration-[2000ms] ease-linear'\n  );\n}\n\nfunction holdLabelOf(isHolding: boolean, label: string) {\n  if (isHolding) {\n    return 'Keep holding';\n  }\n  return label;\n}\n\ntype HoldButtonProps = {\n  label: string;\n  hint: string;\n  onComplete: () => void;\n};\n\n/** A destructive action that asks for intent: the fill crosses the pill while it is pressed and drains on release. */\nfunction HoldButton({ label, hint, onComplete }: HoldButtonProps) {\n  const [isHolding, setIsHolding] = useState(false);\n  const timerRef = useRef<number | null>(null);\n  const hintId = useId();\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = swapVariantsOf(shouldReduceMotion);\n  const fillClass = holdFillClassOf(isHolding, shouldReduceMotion);\n  const shownLabel = holdLabelOf(isHolding, label);\n\n  useEffect(() => {\n    return () => clearTimer(timerRef);\n  }, []);\n\n  function startHold() {\n    if (timerRef.current !== null) {\n      return;\n    }\n    setIsHolding(true);\n    timerRef.current = window.setTimeout(() => {\n      timerRef.current = null;\n      setIsHolding(false);\n      onComplete();\n    }, HOLD_MS);\n  }\n\n  function stopHold() {\n    clearTimer(timerRef);\n    setIsHolding(false);\n  }\n\n  function pressKey(event: React.KeyboardEvent<HTMLButtonElement>) {\n    const isHold = isHoldKey(event);\n    if (!isHold) {\n      return;\n    }\n    event.preventDefault();\n    if (!event.repeat) {\n      startHold();\n    }\n  }\n\n  function releaseKey(event: React.KeyboardEvent<HTMLButtonElement>) {\n    if (isHoldKey(event)) {\n      stopHold();\n    }\n  }\n\n  return (\n    <>\n      <Button\n        variant='outline'\n        aria-describedby={hintId}\n        onPointerDown={startHold}\n        onPointerUp={stopHold}\n        onPointerLeave={stopHold}\n        onPointerCancel={stopHold}\n        onKeyDown={pressKey}\n        onKeyUp={releaseKey}\n        onBlur={stopHold}\n        className='text-destructive-ink touch-none overflow-hidden select-none [-webkit-touch-callout:none]'\n      >\n        <span\n          aria-hidden='true'\n          className={cn('bg-destructive/15 absolute inset-0', fillClass)}\n        />\n        <AnimatedSize as='span' axis='width' contentClassName='relative flex'>\n          <AnimatePresence mode='popLayout' initial={false}>\n            <motion.span\n              key={shownLabel}\n              variants={variants}\n              initial='enter'\n              animate='visible'\n              exit='exit'\n              transition={SWAP_TRANSITION}\n            >\n              {shownLabel}\n            </motion.span>\n          </AnimatePresence>\n        </AnimatedSize>\n      </Button>\n      <span id={hintId} className='sr-only'>\n        {hint}\n      </span>\n    </>\n  );\n}\n\nfunction SwappingLine({ text }: { text: string }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = lineVariantsOf(shouldReduceMotion);\n\n  return (\n    <span className='relative block'>\n      <AnimatePresence mode='popLayout' initial={false}>\n        <motion.span\n          key={text}\n          variants={variants}\n          initial='enter'\n          animate='visible'\n          exit='exit'\n          transition={SWAP_TRANSITION}\n          className='block'\n        >\n          {text}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  );\n}\n\ntype SwapSlotProps = {\n  slotKey: string;\n  children: React.ReactNode;\n};\n\nfunction SwapSlot({ slotKey, children }: SwapSlotProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = swapVariantsOf(shouldReduceMotion);\n\n  return (\n    <AnimatedSize axis='width' contentClassName='relative flex justify-end'>\n      <AnimatePresence mode='popLayout' initial={false}>\n        <motion.span\n          key={slotKey}\n          variants={variants}\n          initial='enter'\n          animate='visible'\n          exit='exit'\n          transition={SWAP_TRANSITION}\n          className='flex'\n        >\n          {children}\n        </motion.span>\n      </AnimatePresence>\n    </AnimatedSize>\n  );\n}\n\nfunction countOf(count: number, singular: string, plural: string) {\n  const digits = COUNT_FORMAT.format(count);\n  if (count === 1) {\n    return `1 ${singular}`;\n  }\n  return `${digits} ${plural}`;\n}\n\nconst MEMBERS_LABEL = countOf(WORKSPACE_FACTS.members, 'member', 'members');\n\nconst PROJECTS_LABEL = countOf(WORKSPACE_FACTS.projects, 'project', 'projects');\n\nconst TASKS_LABEL = countOf(WORKSPACE_FACTS.tasks, 'task', 'tasks');\n\nconst GRACE_LABEL = countOf(WORKSPACE_FACTS.graceDays, 'day', 'days');\n\nfunction accessLineOf(members: number) {\n  if (members === 1) {\n    return '1 member loses access';\n  }\n  return `${MEMBERS_LABEL} lose access`;\n}\n\nconst ACCESS_LINE = accessLineOf(WORKSPACE_FACTS.members);\n\nfunction archiveLineOf(isArchived: boolean) {\n  if (isArchived) {\n    return 'Archived just now. Everyone can read, nobody can edit or track time';\n  }\n  return 'Everyone keeps read access; nobody can edit or track time until you restore it';\n}\n\nfunction deleteLineOf(isScheduled: boolean) {\n  if (isScheduled) {\n    return `Deletion scheduled for ${WORKSPACE_FACTS.deletionDate}. Until then you can cancel it`;\n  }\n  return `After ${GRACE_LABEL}, removes ${MEMBERS_LABEL}, ${PROJECTS_LABEL} and ${TASKS_LABEL}`;\n}\n\ntype DangerZoneProps = {\n  workspaceName: string;\n};\n\n/** Destructive rows apply at once: archive asks for a two-second hold, delete asks for the name. */\nexport function DangerZone({ workspaceName }: DangerZoneProps) {\n  const [isArchived, setIsArchived] = useState(false);\n  const [isDeletionScheduled, setIsDeletionScheduled] = useState(false);\n  const [isDialogOpen, setIsDialogOpen] = useState(false);\n  const [typedName, setTypedName] = useState('');\n  const confirmFieldId = useId();\n  const isNameTyped = typedName.trim() === workspaceName;\n  const archiveLine = archiveLineOf(isArchived);\n  const deleteLine = deleteLineOf(isDeletionScheduled);\n  const archiveSlotKey = String(isArchived);\n  const deleteSlotKey = String(isDeletionScheduled);\n\n  function archive() {\n    setIsArchived(true);\n  }\n\n  function restore() {\n    setIsArchived(false);\n  }\n\n  function openDeletion() {\n    setTypedName('');\n    setIsDialogOpen(true);\n  }\n\n  function changeTypedName(event: React.ChangeEvent<HTMLInputElement>) {\n    setTypedName(event.target.value);\n  }\n\n  function scheduleDeletion() {\n    setIsDeletionScheduled(true);\n  }\n\n  function cancelDeletion() {\n    setIsDeletionScheduled(false);\n  }\n\n  return (\n    <>\n      <SettingsRow\n        label='Archive workspace'\n        line={<SwappingLine text={archiveLine} />}\n      >\n        <SwapSlot slotKey={archiveSlotKey}>\n          {isArchived && (\n            <Button variant='outline' onClick={restore}>\n              Restore workspace\n            </Button>\n          )}\n          {!isArchived && (\n            <HoldButton\n              label='Hold to archive'\n              hint='Press and hold for two seconds to archive the workspace'\n              onComplete={archive}\n            />\n          )}\n        </SwapSlot>\n      </SettingsRow>\n      <SettingsRow\n        label='Delete workspace'\n        line={<SwappingLine text={deleteLine} />}\n      >\n        <SwapSlot slotKey={deleteSlotKey}>\n          {isDeletionScheduled && (\n            <Button variant='outline' onClick={cancelDeletion}>\n              Cancel deletion\n            </Button>\n          )}\n          {!isDeletionScheduled && (\n            <Button\n              variant='outline'\n              onClick={openDeletion}\n              className='text-destructive-ink'\n            >\n              Delete workspace\n            </Button>\n          )}\n        </SwapSlot>\n      </SettingsRow>\n      <AlertDialog open={isDialogOpen} onOpenChange={setIsDialogOpen}>\n        <AlertDialogContent>\n          <AlertDialogHeader>\n            <AlertDialogTitle>{`Delete ${workspaceName}?`}</AlertDialogTitle>\n            <AlertDialogDescription>\n              {`Nothing is removed for ${GRACE_LABEL}. After that it cannot be undone.`}\n            </AlertDialogDescription>\n          </AlertDialogHeader>\n          <ul className='bg-foreground/[0.03] hairline-divide-y divide-border flex flex-col rounded-lg text-[13px]'>\n            <li className='px-3 py-2'>{ACCESS_LINE}</li>\n            <li className='px-3 py-2'>{`${PROJECTS_LABEL} and ${TASKS_LABEL} are deleted`}</li>\n            <li className='px-3 py-2'>\n              Timesheets stay downloadable until the end\n            </li>\n          </ul>\n          <div className='flex flex-col gap-1.5'>\n            <label\n              htmlFor={confirmFieldId}\n              className='text-muted-foreground text-xs'\n            >\n              Type{' '}\n              <span className='text-foreground font-medium'>\n                {workspaceName}\n              </span>{' '}\n              to confirm\n            </label>\n            <Input\n              id={confirmFieldId}\n              value={typedName}\n              autoComplete='off'\n              spellCheck={false}\n              onChange={changeTypedName}\n            />\n          </div>\n          <AlertDialogFooter>\n            <AlertDialogCancel>Keep workspace</AlertDialogCancel>\n            <AlertDialogAction\n              variant='destructive'\n              disabled={!isNameTyped}\n              onClick={scheduleDeletion}\n            >\n              Delete workspace\n            </AlertDialogAction>\n          </AlertDialogFooter>\n        </AlertDialogContent>\n      </AlertDialog>\n    </>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/settings-03/danger-zone.tsx"
    },
    {
      "path": "registry/ndeko/blocks/settings/settings-03/role-choice.tsx",
      "content": "'use client';\n\nimport { RadioGroup, RadioGroupItem } from '@/registry/ndeko/ui/radio-group';\n\nimport type { Role, RoleOption } from './data';\n\nfunction holdersLineOf(holders: number) {\n  if (holders === 1) {\n    return '1 person has this role today';\n  }\n  return `${holders} people have this role today`;\n}\n\ntype RoleChoiceProps = {\n  labelledBy: string;\n  options: RoleOption[];\n  value: Role;\n  onValueChange: (role: Role) => void;\n};\n\n/** A choice that changes what new people can do: each option says what it allows and who holds it now. */\nexport function RoleChoice({\n  labelledBy,\n  options,\n  value,\n  onValueChange,\n}: RoleChoiceProps) {\n  function changeValue(nextValue: unknown) {\n    const option = options.find((candidate) => candidate.value === nextValue);\n    if (option) {\n      onValueChange(option.value);\n    }\n  }\n\n  return (\n    <RadioGroup\n      aria-labelledby={labelledBy}\n      value={value}\n      onValueChange={changeValue}\n      className='hairline-divide-y divide-border gap-0'\n    >\n      {options.map((option) => {\n        const holdersLine = holdersLineOf(option.holders);\n\n        return (\n          <label\n            key={option.value}\n            className='has-data-checked:bg-primary/[0.06] flex cursor-pointer items-start gap-3 px-4 py-3 transition-colors duration-150 first:rounded-t-xl last:rounded-b-xl'\n          >\n            <RadioGroupItem value={option.value} className='mt-0.5' />\n            <span className='flex min-w-0 flex-col gap-0.5'>\n              <span className='text-[13px] font-medium'>{option.label}</span>\n              <span className='text-muted-foreground text-xs'>\n                {option.line}\n              </span>\n              <span className='text-muted-foreground text-xs tabular-nums'>\n                {holdersLine}\n              </span>\n            </span>\n          </label>\n        );\n      })}\n    </RadioGroup>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/settings-03/role-choice.tsx"
    },
    {
      "path": "registry/ndeko/blocks/settings/settings-03/settings-kit.tsx",
      "content": "'use client';\n\nimport { Radio as RadioPrimitive } from '@base-ui/react/radio';\nimport { RadioGroup as RadioGroupPrimitive } from '@base-ui/react/radio-group';\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs';\nimport {\n  AnimatePresence,\n  motion,\n  type Transition,\n  type Variants,\n} from 'motion/react';\nimport { useEffect, useId, useState } from 'react';\n\nimport { WordRoll } from '@/components/core/word-roll';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport {\n  CheckIcon,\n  LoaderCircleIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\nimport { AnimatedSize } from '@/registry/ndeko/ui/animated-size';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Input, type InputProps } from '@/registry/ndeko/ui/input';\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from '@/registry/ndeko/ui/select';\nimport { Switch } from '@/registry/ndeko/ui/switch';\n\nexport const SETTINGS_SURFACE_BASE =\n  'bg-card hairline-ring ring-border rounded-xl shadow-[0_1px_2px_rgb(0_0_0/0.04)] dark:bg-foreground/[0.03]';\n\nexport const SETTINGS_SURFACE = `${SETTINGS_SURFACE_BASE} hairline-divide-y divide-border`;\n\nconst ROW_LABEL = 'text-[13px] font-medium';\n\nconst SAVE_DELAY_MS = 800;\n\nconst SAVED_HOLD_MS = 1100;\n\nconst SWAP_TRANSITION: Transition = { duration: 0.15, ease: [0.2, 0, 0, 1] };\n\nconst THUMB_TRAVEL: Transition = { duration: 0.2, ease: [0.2, 0, 0, 1] };\n\nconst INSTANT: Transition = { duration: 0 };\n\nconst ENTER: Transition = { duration: 0.2, ease: [0.23, 1, 0.32, 1] };\n\nconst LEAVE: Transition = { duration: 0.14, ease: [0.23, 1, 0.32, 1] };\n\nconst SWAP_VARIANTS: Variants = {\n  enter: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n  visible: { opacity: 1, scale: 1, filter: 'blur(0px)' },\n  exit: { opacity: 0, scale: 0.6, filter: 'blur(2px)' },\n};\n\nconst BAR_VARIANTS: Variants = {\n  enter: { opacity: 0, y: 12, scale: 0.98 },\n  visible: { opacity: 1, y: 0, scale: 1, transition: ENTER },\n  exit: { opacity: 0, y: 8, scale: 0.98, transition: LEAVE },\n};\n\nconst PANEL_VARIANTS: Variants = {\n  enter: { opacity: 0, y: 4 },\n  visible: { opacity: 1, y: 0, transition: ENTER },\n};\n\nconst DOT_VARIANTS: Variants = {\n  enter: { opacity: 0, scale: 0.4 },\n  visible: { opacity: 1, scale: 1, transition: ENTER },\n  exit: { opacity: 0, scale: 0.4, transition: LEAVE },\n};\n\nconst ERROR_VARIANTS: Variants = {\n  enter: { height: 0, opacity: 0 },\n  visible: { height: 'auto', opacity: 1, transition: ENTER },\n  exit: { height: 0, opacity: 0, transition: LEAVE },\n};\n\nconst FADE_VARIANTS: Variants = {\n  enter: { opacity: 0 },\n  visible: { opacity: 1, transition: ENTER },\n  exit: { opacity: 0, transition: LEAVE },\n};\n\nfunction swapVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return SWAP_VARIANTS;\n}\n\nfunction barVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return BAR_VARIANTS;\n}\n\nfunction panelVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return PANEL_VARIANTS;\n}\n\nfunction errorVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return ERROR_VARIANTS;\n}\n\nexport function describedByOf(hasError: boolean, errorId: string) {\n  if (hasError) {\n    return errorId;\n  }\n  return undefined;\n}\n\nfunction thumbTravelOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return THUMB_TRAVEL;\n}\n\nfunction dotVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return FADE_VARIANTS;\n  }\n  return DOT_VARIANTS;\n}\n\nexport type SaveStatus = 'idle' | 'saving' | 'saved';\n\ntype SettingsValues = Record<string, unknown>;\n\nfunction changedKeysOf<Values extends SettingsValues>(\n  saved: Values,\n  draft: Values\n) {\n  const keys = Object.keys(saved);\n  return keys.filter((key) => !Object.is(saved[key], draft[key]));\n}\n\n/** An edit made while Saved is still showing starts a new round of changes. */\nfunction statusAfterEditOf(current: SaveStatus): SaveStatus {\n  if (current === 'saved') {\n    return 'idle';\n  }\n  return current;\n}\n\n/**\n * Keeps the saved values and the draft apart. Saving stands in for a request with a fixed\n * delay, then holds the Saved state long enough to be read.\n */\nexport function useSettingsDraft<Values extends SettingsValues>(\n  initialValues: Values\n) {\n  const [savedValues, setSavedValues] = useState(initialValues);\n  const [draft, setDraft] = useState(initialValues);\n  const [pending, setPending] = useState<Values | null>(null);\n  const [status, setStatus] = useState<SaveStatus>('idle');\n  const changedKeys = changedKeysOf(savedValues, draft);\n  const hasChanges = changedKeys.length > 0;\n  const isSettled = status === 'idle';\n  const isBarShown = hasChanges || !isSettled;\n\n  useEffect(() => {\n    if (status !== 'saving') {\n      return;\n    }\n    const timer = window.setTimeout(() => {\n      if (pending) {\n        setSavedValues(pending);\n      }\n      setStatus('saved');\n    }, SAVE_DELAY_MS);\n    return () => window.clearTimeout(timer);\n  }, [status, pending]);\n\n  useEffect(() => {\n    if (status !== 'saved') {\n      return;\n    }\n    const timer = window.setTimeout(() => setStatus('idle'), SAVED_HOLD_MS);\n    return () => window.clearTimeout(timer);\n  }, [status]);\n\n  function change<Key extends keyof Values>(key: Key, value: Values[Key]) {\n    setDraft((previous) => ({ ...previous, [key]: value }));\n    setStatus(statusAfterEditOf);\n  }\n\n  function discard() {\n    setDraft(savedValues);\n  }\n\n  function save() {\n    if (status === 'saving') {\n      return;\n    }\n    setPending(draft);\n    setStatus('saving');\n  }\n\n  return {\n    savedValues,\n    draft,\n    changedKeys,\n    status,\n    isBarShown,\n    change,\n    discard,\n    save,\n  };\n}\n\nexport function hasChangeIn(changedKeys: string[], sectionKeys: string[]) {\n  return sectionKeys.some((key) => changedKeys.includes(key));\n}\n\ntype SettingsPageProps = {\n  title: string;\n  line: string;\n  bar: React.ReactNode;\n  children: React.ReactNode;\n};\n\nexport function SettingsPage({\n  title,\n  line,\n  bar,\n  children,\n}: SettingsPageProps) {\n  return (\n    <div className='bg-background text-foreground flex min-h-dvh w-full flex-col'>\n      <div className='mx-auto flex w-full max-w-4xl flex-1 flex-col gap-6 px-4 py-8 md:gap-8 md:px-6 md:py-10'>\n        <header className='flex flex-col gap-1'>\n          <h1 className='text-2xl font-semibold text-balance sm:text-3xl'>\n            {title}\n          </h1>\n          <p className='text-muted-foreground text-[13px] text-pretty'>\n            {line}\n          </p>\n        </header>\n        {children}\n      </div>\n      {bar}\n    </div>\n  );\n}\n\nexport type NavItem<Id extends string> = {\n  id: Id;\n  label: string;\n  icon: Icon;\n  hasChanges: boolean;\n};\n\nfunction UnsavedDot({ isShown }: { isShown: boolean }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = dotVariantsOf(shouldReduceMotion);\n\n  return (\n    <AnimatePresence initial={false}>\n      {isShown && (\n        <motion.span\n          key='dot'\n          variants={variants}\n          initial='enter'\n          animate='visible'\n          exit='exit'\n          className='bg-primary ml-auto size-1.5 shrink-0 rounded-full'\n        >\n          <span className='sr-only'>Unsaved changes</span>\n        </motion.span>\n      )}\n    </AnimatePresence>\n  );\n}\n\ntype SectionTabsProps<Id extends string> = {\n  label: string;\n  items: NavItem<Id>[];\n  value: Id;\n  onValueChange: (id: Id) => void;\n  children: React.ReactNode;\n};\n\n/** Sections as tabs: a rail beside the column on wide screens, a row above it on phones. One highlight travels between them. */\nexport function SectionTabs<Id extends string>({\n  label,\n  items,\n  value,\n  onValueChange,\n  children,\n}: SectionTabsProps<Id>) {\n  function changeValue(nextValue: unknown) {\n    const item = items.find((candidate) => candidate.id === nextValue);\n    if (item) {\n      onValueChange(item.id);\n    }\n  }\n\n  return (\n    <TabsPrimitive.Root\n      value={value}\n      onValueChange={changeValue}\n      orientation='vertical'\n      className='flex flex-col gap-6 md:grid md:grid-cols-[11rem_minmax(0,42rem)] md:items-start md:gap-10'\n    >\n      <TabsPrimitive.List\n        aria-label={label}\n        className='relative -mx-4 flex gap-1 overflow-x-auto px-4 md:sticky md:top-10 md:mx-0 md:flex-col md:overflow-visible md:px-0'\n      >\n        {items.map((item) => {\n          const ItemIcon = item.icon;\n\n          return (\n            <TabsPrimitive.Tab\n              key={item.id}\n              value={item.id}\n              className='text-muted-foreground hover:text-foreground data-active:text-foreground focus-visible:ring-ring/25 relative z-10 flex h-8 shrink-0 cursor-pointer items-center gap-2 rounded-md px-2.5 text-left text-[13px] font-medium whitespace-nowrap transition-colors duration-150 outline-none focus-visible:ring-[3px] [&_svg]:size-4 [&_svg]:shrink-0'\n            >\n              <ItemIcon />\n              {item.label}\n              <UnsavedDot isShown={item.hasChanges} />\n            </TabsPrimitive.Tab>\n          );\n        })}\n        <TabsPrimitive.Indicator className='bg-foreground/[0.06] pointer-events-none absolute top-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) translate-y-(--active-tab-top) rounded-md transition-[translate,width,height] duration-[250ms] ease-(--ease-in-out-strong)' />\n      </TabsPrimitive.List>\n      {children}\n    </TabsPrimitive.Root>\n  );\n}\n\ntype SectionPanelProps = {\n  value: string;\n  /** False on the section shown at first, so nothing moves on load. */\n  animatesIn: boolean;\n  children: React.ReactNode;\n};\n\nfunction panelInitialOf(animatesIn: boolean) {\n  if (animatesIn) {\n    return 'enter';\n  }\n  return false;\n}\n\nexport function SectionPanel({\n  value,\n  animatesIn,\n  children,\n}: SectionPanelProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = panelVariantsOf(shouldReduceMotion);\n  const initial = panelInitialOf(animatesIn);\n\n  return (\n    <TabsPrimitive.Panel\n      value={value}\n      className='focus-visible:ring-ring/25 rounded-xl outline-none focus-visible:ring-[3px]'\n    >\n      <motion.div\n        variants={variants}\n        initial={initial}\n        animate='visible'\n        className='flex flex-col gap-8'\n      >\n        {children}\n      </motion.div>\n    </TabsPrimitive.Panel>\n  );\n}\n\ntype SettingsSectionProps = {\n  title: string;\n  line?: string;\n  action?: React.ReactNode;\n  children: React.ReactNode;\n};\n\nexport function SettingsSection({\n  title,\n  line,\n  action,\n  children,\n}: SettingsSectionProps) {\n  const headingId = useId();\n\n  return (\n    <section aria-labelledby={headingId} className='flex flex-col gap-3'>\n      <div className='flex items-end justify-between gap-3'>\n        <div className='flex flex-col gap-0.5'>\n          <h2 id={headingId} className='text-sm font-medium'>\n            {title}\n          </h2>\n          {line && <p className='text-muted-foreground text-xs'>{line}</p>}\n        </div>\n        {action}\n      </div>\n      <div className={SETTINGS_SURFACE}>{children}</div>\n    </section>\n  );\n}\n\ntype SettingsRowProps = {\n  label: string;\n  line: React.ReactNode;\n  labelId?: string;\n  lineId?: string;\n  htmlFor?: string;\n  children: React.ReactNode;\n};\n\nexport function SettingsRow({\n  label,\n  line,\n  labelId,\n  lineId,\n  htmlFor,\n  children,\n}: SettingsRowProps) {\n  return (\n    <div className='flex min-h-14 flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-6'>\n      <div className='flex min-w-0 flex-col gap-0.5'>\n        {htmlFor && (\n          <label id={labelId} htmlFor={htmlFor} className={ROW_LABEL}>\n            {label}\n          </label>\n        )}\n        {!htmlFor && (\n          <p id={labelId} className={ROW_LABEL}>\n            {label}\n          </p>\n        )}\n        <p id={lineId} className='text-muted-foreground text-xs'>\n          {line}\n        </p>\n      </div>\n      <div className='flex shrink-0 flex-col sm:items-end'>{children}</div>\n    </div>\n  );\n}\n\nfunction saveLabelOf(status: SaveStatus) {\n  if (status === 'saving') {\n    return 'Saving';\n  }\n  if (status === 'saved') {\n    return 'Saved';\n  }\n  return 'Save changes';\n}\n\nfunction saveGlyphOf(status: SaveStatus) {\n  if (status === 'saving') {\n    return {\n      key: 'saving',\n      icon: <LoaderCircleIcon className='animate-spin' />,\n    };\n  }\n  if (status === 'saved') {\n    return { key: 'saved', icon: <CheckIcon /> };\n  }\n  return null;\n}\n\ntype SaveButtonProps = {\n  status: SaveStatus;\n  onSave: () => void;\n};\n\n/** The label becomes its next state and the pill resizes to it: Save changes, Saving, Saved. */\nfunction SaveButton({ status, onSave }: SaveButtonProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = swapVariantsOf(shouldReduceMotion);\n  const label = saveLabelOf(status);\n  const glyph = saveGlyphOf(status);\n  const isBusy = status !== 'idle';\n\n  return (\n    <Button\n      size='sm'\n      disabled={isBusy}\n      focusableWhenDisabled\n      onClick={onSave}\n      className='data-disabled:opacity-100'\n    >\n      <AnimatedSize\n        as='span'\n        axis='width'\n        contentClassName='relative flex items-center gap-1.5'\n      >\n        <AnimatePresence mode='popLayout' initial={false}>\n          {glyph && (\n            <motion.span\n              key={glyph.key}\n              variants={variants}\n              initial='enter'\n              animate='visible'\n              exit='exit'\n              transition={SWAP_TRANSITION}\n              className='flex'\n            >\n              {glyph.icon}\n            </motion.span>\n          )}\n        </AnimatePresence>\n        <AnimatePresence mode='popLayout' initial={false}>\n          <motion.span\n            key={label}\n            variants={variants}\n            initial='enter'\n            animate='visible'\n            exit='exit'\n            transition={SWAP_TRANSITION}\n          >\n            {label}\n          </motion.span>\n        </AnimatePresence>\n      </AnimatedSize>\n    </Button>\n  );\n}\n\nfunction changeCountLabelOf(count: number) {\n  if (count === 1) {\n    return '1 unsaved change';\n  }\n  return `${count} unsaved changes`;\n}\n\nfunction barMessageOf(status: SaveStatus, changeCount: number) {\n  if (status === 'saved') {\n    return 'All changes saved';\n  }\n  return changeCountLabelOf(changeCount);\n}\n\ntype UnsavedBarProps = {\n  isShown: boolean;\n  status: SaveStatus;\n  changeCount: number;\n  /** Replaces the count, for example to say what blocks the save. */\n  message?: string;\n  onDiscard: () => void;\n  onSave: () => void;\n};\n\nexport function UnsavedBar({\n  isShown,\n  status,\n  changeCount,\n  message,\n  onDiscard,\n  onSave,\n}: UnsavedBarProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = barVariantsOf(shouldReduceMotion);\n  const defaultText = barMessageOf(status, changeCount);\n  const text = message ?? defaultText;\n  const isBusy = status !== 'idle';\n\n  return (\n    <div className='pointer-events-none sticky bottom-0 z-20 flex justify-center px-4 pb-4'>\n      <AnimatePresence initial={false}>\n        {isShown && (\n          <motion.div\n            key='unsaved-bar'\n            role='region'\n            aria-label='Unsaved changes'\n            variants={variants}\n            initial='enter'\n            animate='visible'\n            exit='exit'\n            className='surface-raised pointer-events-auto flex w-full max-w-md items-center gap-2 rounded-full py-1.5 pr-1.5 pl-4'\n          >\n            <p\n              role='status'\n              className='min-w-0 flex-1 truncate text-[13px] tabular-nums'\n            >\n              <WordRoll text={text} value={changeCount} />\n            </p>\n            <Button\n              variant='ghost'\n              size='sm'\n              disabled={isBusy}\n              onClick={onDiscard}\n            >\n              Discard\n            </Button>\n            <SaveButton status={status} onSave={onSave} />\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </div>\n  );\n}\n\nexport type ChoiceOption<Value extends string> = {\n  value: Value;\n  label: string;\n};\n\ntype SegmentedChoiceProps<Value extends string> = {\n  options: ChoiceOption<Value>[];\n  value: Value;\n  labelledBy?: string;\n  describedBy?: string;\n  disabled?: boolean;\n  onValueChange: (value: Value) => void;\n};\n\n/** A setting with two to four values as one segmented radio group. The thumb slides to the picked value. */\nexport function SegmentedChoice<Value extends string>({\n  options,\n  value,\n  labelledBy,\n  describedBy,\n  disabled,\n  onValueChange,\n}: SegmentedChoiceProps<Value>) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const travel = thumbTravelOf(shouldReduceMotion);\n  const thumbId = useId();\n\n  function changeValue(nextValue: unknown) {\n    const option = options.find((candidate) => candidate.value === nextValue);\n    if (option) {\n      onValueChange(option.value);\n    }\n  }\n\n  return (\n    <RadioGroupPrimitive\n      value={value}\n      onValueChange={changeValue}\n      disabled={disabled}\n      aria-labelledby={labelledBy}\n      aria-describedby={describedBy}\n      className='bg-foreground/[0.05] inline-flex w-fit items-center gap-0.5 rounded-lg p-0.5 data-disabled:opacity-50'\n    >\n      {options.map((option) => {\n        const isPicked = option.value === value;\n\n        return (\n          <RadioPrimitive.Root\n            key={option.value}\n            value={option.value}\n            className='text-muted-foreground hover:text-foreground data-checked:text-foreground focus-visible:ring-ring/25 relative inline-flex h-7 cursor-pointer items-center justify-center rounded-md px-3 text-[13px] font-medium whitespace-nowrap transition-colors duration-150 outline-none focus-visible:ring-[3px] data-disabled:cursor-not-allowed'\n          >\n            {isPicked && (\n              <motion.span\n                aria-hidden='true'\n                layoutId={thumbId}\n                transition={travel}\n                className='bg-card hairline-ring ring-foreground/10 dark:bg-foreground/[0.09] absolute inset-0 rounded-md shadow-[0_1px_2px_rgb(0_0_0/0.08)]'\n              />\n            )}\n            <span className='relative'>{option.label}</span>\n          </RadioPrimitive.Root>\n        );\n      })}\n    </RadioGroupPrimitive>\n  );\n}\n\ntype ErrorPresenceProps = {\n  id: string;\n  error?: string | null;\n};\n\n/** A field error that grows in under its control and folds away once the person types again. */\nexport function ErrorPresence({ id, error }: ErrorPresenceProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const variants = errorVariantsOf(shouldReduceMotion);\n\n  return (\n    <AnimatePresence initial={false}>\n      {error && (\n        <motion.p\n          key='error'\n          id={id}\n          variants={variants}\n          initial='enter'\n          animate='visible'\n          exit='exit'\n          className='text-destructive-ink overflow-hidden text-xs sm:max-w-64 sm:text-right'\n        >\n          <span className='block pt-1.5'>{error}</span>\n        </motion.p>\n      )}\n    </AnimatePresence>\n  );\n}\n\ntype TextRowProps = Pick<\n  InputProps,\n  'type' | 'autoComplete' | 'inputMode' | 'placeholder' | 'maxLength'\n> & {\n  label: string;\n  line: string;\n  value: string;\n  error?: string;\n  inputId?: string;\n  onValueChange: (value: string) => void;\n};\n\nexport function TextRow({\n  label,\n  line,\n  value,\n  error,\n  inputId,\n  onValueChange,\n  ...inputProps\n}: TextRowProps) {\n  const generatedId = useId();\n  const errorId = useId();\n  const id = inputId ?? generatedId;\n  const hasError = Boolean(error);\n  const describedBy = describedByOf(hasError, errorId);\n\n  function changeValue(event: React.ChangeEvent<HTMLInputElement>) {\n    onValueChange(event.target.value);\n  }\n\n  return (\n    <SettingsRow label={label} line={line} htmlFor={id}>\n      <Input\n        id={id}\n        value={value}\n        aria-invalid={hasError}\n        aria-describedby={describedBy}\n        onChange={changeValue}\n        className='w-full sm:w-64'\n        {...inputProps}\n      />\n      <ErrorPresence id={errorId} error={error} />\n    </SettingsRow>\n  );\n}\n\ntype SwitchRowProps = {\n  label: string;\n  line: React.ReactNode;\n  checked: boolean;\n  disabled?: boolean;\n  onCheckedChange: (checked: boolean) => void;\n};\n\nexport function SwitchRow({\n  label,\n  line,\n  checked,\n  disabled,\n  onCheckedChange,\n}: SwitchRowProps) {\n  const labelId = useId();\n  const lineId = useId();\n\n  return (\n    <SettingsRow label={label} line={line} labelId={labelId} lineId={lineId}>\n      <Switch\n        checked={checked}\n        disabled={disabled}\n        onCheckedChange={onCheckedChange}\n        aria-labelledby={labelId}\n        aria-describedby={lineId}\n      />\n    </SettingsRow>\n  );\n}\n\ntype SelectOption = { value: string; label: string };\n\ntype SelectRowProps = {\n  label: string;\n  line: React.ReactNode;\n  value: string;\n  options: SelectOption[];\n  disabled?: boolean;\n  onValueChange: (value: string) => void;\n};\n\nexport function SelectRow({\n  label,\n  line,\n  value,\n  options,\n  disabled,\n  onValueChange,\n}: SelectRowProps) {\n  const labelId = useId();\n\n  function changeValue(nextValue: unknown) {\n    const option = options.find((candidate) => candidate.value === nextValue);\n    if (option) {\n      onValueChange(option.value);\n    }\n  }\n\n  return (\n    <SettingsRow label={label} line={line} labelId={labelId}>\n      <Select\n        items={options}\n        value={value}\n        disabled={disabled}\n        onValueChange={changeValue}\n      >\n        <SelectTrigger aria-labelledby={labelId} className='w-full sm:w-64'>\n          <SelectValue />\n        </SelectTrigger>\n        <SelectContent align='end'>\n          {options.map((option) => (\n            <SelectItem key={option.value} value={option.value}>\n              {option.label}\n            </SelectItem>\n          ))}\n        </SelectContent>\n      </Select>\n    </SettingsRow>\n  );\n}\n\ntype ChoiceRowProps<Value extends string> = {\n  label: string;\n  line: React.ReactNode;\n  value: Value;\n  options: ChoiceOption<Value>[];\n  disabled?: boolean;\n  onValueChange: (value: Value) => void;\n};\n\nexport function ChoiceRow<Value extends string>({\n  label,\n  line,\n  value,\n  options,\n  disabled,\n  onValueChange,\n}: ChoiceRowProps<Value>) {\n  const labelId = useId();\n  const lineId = useId();\n\n  return (\n    <SettingsRow label={label} line={line} labelId={labelId} lineId={lineId}>\n      <SegmentedChoice\n        options={options}\n        value={value}\n        labelledBy={labelId}\n        describedBy={lineId}\n        disabled={disabled}\n        onValueChange={onValueChange}\n      />\n    </SettingsRow>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/settings-03/settings-kit.tsx"
    },
    {
      "path": "registry/ndeko/blocks/settings/settings-03/data.ts",
      "content": "export type SectionId = 'general' | 'members' | 'danger';\n\nexport type Role = 'member' | 'viewer' | 'guest';\n\nexport type InvitePolicy = 'admins' | 'admins-members';\n\nexport type WorkspaceValues = {\n  name: string;\n  slug: string;\n  timeZone: string;\n  defaultRole: Role;\n  invitePolicy: InvitePolicy;\n  approveJoins: boolean;\n  allowedDomain: string;\n};\n\nexport type WorkspaceField = keyof WorkspaceValues;\n\nexport type RoleOption = {\n  value: Role;\n  label: string;\n  line: string;\n  /** How many people hold the role today, so the choice reads against real numbers. */\n  holders: number;\n};\n\nexport const INITIAL_WORKSPACE: WorkspaceValues = {\n  name: 'Tidewell Studio',\n  slug: 'tidewell-studio',\n  timeZone: 'africa-lagos',\n  defaultRole: 'member',\n  invitePolicy: 'admins-members',\n  approveJoins: true,\n  allowedDomain: 'tidewell.example',\n};\n\nexport const WORKSPACE_HOST = 'app.tidewell.example/';\n\nexport const WORKSPACE_FACTS = {\n  members: 14,\n  projects: 6,\n  tasks: 1284,\n  graceDays: 14,\n  deletionDate: '19 November 2026',\n};\n\nexport const SECTION_KEYS: Record<SectionId, WorkspaceField[]> = {\n  general: ['name', 'slug', 'timeZone'],\n  members: ['defaultRole', 'invitePolicy', 'approveJoins', 'allowedDomain'],\n  danger: [],\n};\n\nexport const FIELD_SECTION: Record<WorkspaceField, SectionId> = {\n  name: 'general',\n  slug: 'general',\n  timeZone: 'general',\n  defaultRole: 'members',\n  invitePolicy: 'members',\n  approveJoins: 'members',\n  allowedDomain: 'members',\n};\n\nexport const ROLE_OPTIONS: RoleOption[] = [\n  {\n    value: 'member',\n    label: 'Member',\n    line: 'Creates and edits tasks, tracks time, sees every project',\n    holders: 11,\n  },\n  {\n    value: 'viewer',\n    label: 'Viewer',\n    line: 'Reads and comments, cannot track time or edit',\n    holders: 2,\n  },\n  {\n    value: 'guest',\n    label: 'Guest',\n    line: 'Sees only the projects someone invites them to',\n    holders: 1,\n  },\n];\n\nexport const INVITE_POLICIES: { value: InvitePolicy; label: string }[] = [\n  { value: 'admins', label: 'Admins only' },\n  { value: 'admins-members', label: 'Admins and members' },\n];\n\nexport const TIME_ZONES = [\n  { value: 'africa-lagos', label: 'Lagos, West Africa Time' },\n  { value: 'africa-kinshasa', label: 'Kinshasa, West Africa Time' },\n  { value: 'europe-london', label: 'London, Greenwich Mean Time' },\n  { value: 'europe-paris', label: 'Paris, Central European Time' },\n  { value: 'america-new-york', label: 'New York, Eastern Time' },\n  { value: 'asia-tokyo', label: 'Tokyo, Japan Standard Time' },\n];\n",
      "type": "registry:component",
      "target": "components/blocks/settings-03/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "settings"
  ],
  "type": "registry:block"
}