{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "labels-context",
  "title": "Labels Context",
  "description": "Labels Context from the Get IT Done design system.",
  "dependencies": [],
  "registryDependencies": [
    "https://zero-design.itdone.de/r/labels.json",
    "https://zero-design.itdone.de/r/labels-en.json",
    "https://zero-design.itdone.de/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/ui/labels-context.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\n\nimport { labelsEn } from '@/components/ui/labels-en';\nimport { applyLabelOverrides, type DesignSystemLocale, type LabelOverrides, type Labels } from '@/components/ui/labels';\n\nexport type { DesignSystemLocale } from '@/components/ui/labels';\n\n// Product level look. `default` keeps every component default as shipped; `zero` switches the component defaults (outline button, segment tabs, soft alert, inverse toast, inset sheet, zero card) to the workload.zero look.\nexport type DesignSystemPreset = 'default' | 'zero';\n\nexport interface DesignSystemContextValue {\n  locale: DesignSystemLocale;\n  labels: Labels;\n  preset: DesignSystemPreset;\n}\n\nexport const DesignSystemContext = React.createContext<DesignSystemContextValue>({ locale: 'en', labels: labelsEn, preset: 'default' });\n\n// Built-in texts for the current locale. Pass instance props as `overrides` so they win over the provider.\nexport const useLabels = (overrides?: LabelOverrides): Labels =>\n  applyLabelOverrides(React.useContext(DesignSystemContext).labels, overrides);\n\nexport const usePreset = (): DesignSystemPreset => React.useContext(DesignSystemContext).preset;\n\nexport const useLocale = (): DesignSystemLocale => React.useContext(DesignSystemContext).locale;\n\n// BCP 47 tag for Intl and date formatting.\nexport const intlLocaleOf = (locale: DesignSystemLocale) => (locale === 'de' ? 'de-DE' : 'en-US');\n\n// Overrides single texts for a subtree without touching the locale. Keeps the German dictionary out of the bundle.\nexport const LabelScope = ({ labels, children }: { labels: LabelOverrides; children?: React.ReactNode }) => {\n  const parent = React.useContext(DesignSystemContext);\n  const value = React.useMemo(() => ({ ...parent, labels: applyLabelOverrides(parent.labels, labels) }), [parent, labels]);\n  return <DesignSystemContext.Provider value={value}>{children}</DesignSystemContext.Provider>;\n};\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}