{
  "component": {
    "id": "notification-preferences",
    "name": "Notification preferences",
    "tier": "pro",
    "exampleId": "notification-preferences",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/notification-preferences-demo.tsx",
    "exportName": "NotificationPreferencesDemo",
    "sha256": "8c831c5b71f3151658e552f96412535472bfd731c1b224f70803520c7fc67c68",
    "helperImports": [],
    "directComponentImports": [
      "notification-preferences"
    ],
    "sampleBoundary": "Existing local demo fixture with fictional data and callbacks. No live service, customer data, access key, or Pro source is included."
  },
  "install": {
    "command": "npx shadcn@latest add @tidal-pro/notification-preferences",
    "registryUrl": "https://tidalui.com/r/pro/notification-preferences.json",
    "namespace": "@tidal-pro",
    "access": "pro",
    "sourceDelivery": "server-gated",
    "requiresAuthorization": true,
    "tokenSource": "local-env",
    "tokenEnvName": "TIDALUI_TOKEN",
    "cli": {
      "package": "shadcn",
      "requested": "latest"
    }
  },
  "installPlan": [
    {
      "order": 1,
      "kind": "primary",
      "dependency": "@tidal-pro/notification-preferences",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/notification-preferences",
      "registryUrl": "https://tidalui.com/r/pro/notification-preferences.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/notification-preferences.tsx",
    "exports": [
      "TidalNotificationChannel",
      "TidalNotificationPreferenceGroup",
      "TidalNotificationPreferences"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/notification-preferences.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [],
    "registry": [],
    "additionalRegistry": [],
    "installClosure": [
      "notification-preferences"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/notification-preferences.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/notification-preferences.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/notification-preferences-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "\"use client\";\n\nimport \"./components/ui/tidal.css\";\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { TidalNotificationPreferences, type TidalNotificationChannel, type TidalNotificationPreferenceGroup } from \"./components/ui/notification-preferences\";\n\nimport \"./components/ui/notification-preferences.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .notification-preferences-demo,\\n.tidal-scope .notification-preferences-demo * {\\n  box-sizing: border-box;\\n}\\n\\n.tidal-scope .notification-preferences-demo {\\n  display: grid;\\n  width: min(100%, 1180px);\\n  min-width: 0;\\n  gap: 22px;\\n  margin-inline: auto;\\n  padding: clamp(16px, 4vw, 42px);\\n}\\n\\n@container tidal-preview (max-width: 390px) {\\n  .tidal-scope .notification-preferences-demo {\\n    gap: 16px;\\n    padding: 12px;\\n  }\\n}\";\n\nconst CHANNELS: readonly TidalNotificationChannel[] = [\n  {\n    id: \"in-app\",\n    label: \"In app\",\n    accessibleLabel: \"In app\",\n  },\n  { id: \"email\", label: \"Email\", accessibleLabel: \"Email\" },\n  { id: \"mobile\", label: \"Mobile\", accessibleLabel: \"Mobile\" },\n];\n\nconst INITIAL_VALUES: Readonly<Record<string, boolean>> = {\n  \"assignment:in-app\": true,\n  \"assignment:email\": true,\n  \"assignment:mobile\": false,\n  \"comment:in-app\": true,\n  \"comment:email\": false,\n  \"comment:mobile\": true,\n  \"approval:in-app\": true,\n  \"approval:email\": true,\n  \"approval:mobile\": true,\n  \"weekly:in-app\": false,\n  \"weekly:email\": true,\n};\n\nexport function NotificationPreferencesDemo() {\n  const [values, setValues] = useState<Record<string, boolean>>({\n    ...INITIAL_VALUES,\n  });\n  const [savedValues, setSavedValues] = useState<Record<string, boolean>>({\n    ...INITIAL_VALUES,\n  });\n  const [busy, setBusy] = useState(false);\n  const [status, setStatus] = useState(\"No unsaved changes.\");\n  const timerRef = useRef<number | null>(null);\n\n  useEffect(\n    () => () => {\n      if (timerRef.current !== null) window.clearTimeout(timerRef.current);\n    },\n    [],\n  );\n\n  function cancelPendingSave() {\n    if (timerRef.current !== null) {\n      window.clearTimeout(timerRef.current);\n      timerRef.current = null;\n    }\n    setBusy(false);\n  }\n\n  function updateValue(key: string, checked: boolean) {\n    cancelPendingSave();\n    setValues((current) => ({ ...current, [key]: checked }));\n    setStatus(\"Unsaved changes.\");\n  }\n\n  const groups = useMemo<readonly TidalNotificationPreferenceGroup[]>(\n    () => [\n      {\n        id: \"project\",\n        title: \"Project activity\",\n        description: \"Updates about your work.\",\n        preferences: [\n          {\n            id: \"assignment\",\n            label: \"Task assigned\",\n            accessibleLabel: \"Task assigned\",\n            description: \"When someone assigns you a task.\",\n            controls: CHANNELS.map((channel) => ({\n              channelId: channel.id,\n              checked: values[`assignment:${channel.id}`] ?? false,\n              inputProps: { name: `assignment-${channel.id}` },\n            })),\n          },\n          {\n            id: \"comment\",\n            label: \"New comment\",\n            accessibleLabel: \"New comment\",\n            description: \"When a teammate replies to your work.\",\n            controls: CHANNELS.map((channel) => ({\n              channelId: channel.id,\n              checked: values[`comment:${channel.id}`] ?? false,\n              inputProps: { name: `comment-${channel.id}` },\n            })),\n          },\n          {\n            id: \"approval\",\n            label: \"Review requested\",\n            accessibleLabel: \"Review requested\",\n            description: \"When something needs your approval.\",\n            controls: CHANNELS.map((channel) => ({\n              channelId: channel.id,\n              checked: values[`approval:${channel.id}`] ?? false,\n              inputProps: { name: `approval-${channel.id}` },\n            })),\n          },\n        ],\n      },\n      {\n        id: \"summary\",\n        title: \"Workspace summary\",\n        description: \"A recap of the week.\",\n        preferences: [\n          {\n            id: \"weekly\",\n            label: \"Weekly activity summary\",\n            accessibleLabel: \"Weekly activity summary\",\n            description: \"Your activity, delivered every Monday.\",\n            controls: CHANNELS.filter((channel) => channel.id !== \"mobile\").map(\n              (channel) => ({\n                channelId: channel.id,\n                checked: values[`weekly:${channel.id}`] ?? false,\n                inputProps: { name: `weekly-${channel.id}` },\n              }),\n            ),\n          },\n        ],\n      },\n    ],\n    [values],\n  );\n\n  const dirty = Object.keys(INITIAL_VALUES).some(\n    (key) => values[key] !== savedValues[key],\n  );\n\n  return (\n    <section\n      className=\"notification-preferences-demo\"\n      aria-label=\"Notification preferences preview\"\n    >\n      <TidalNotificationPreferences\n        title=\"Workspace updates\"\n        description=\"Choose where workspace updates appear.\"\n        channels={CHANNELS}\n        groups={groups}\n        busy={busy}\n        onPreferenceChange={(preference, channel, checked) =>\n          updateValue(`${preference.id}:${channel.id}`, checked)\n        }\n        onSave={(event) => {\n          event.preventDefault();\n          if (busy) return;\n          const nextValues = { ...values };\n          setBusy(true);\n          setStatus(\"Saving preferences…\");\n          timerRef.current = window.setTimeout(() => {\n            timerRef.current = null;\n            setSavedValues(nextValues);\n            setBusy(false);\n            setStatus(\"Preferences updated in this preview.\");\n          }, 600);\n        }}\n        action=\"/local-notification-preferences-preview\"\n        method=\"post\"\n        status={\n          <span role=\"status\" aria-live=\"polite\">\n            {status}\n          </span>\n        }\n        resetAction={{\n          label: \"Reset\",\n          disabled: busy,\n          onAction: () => {\n            cancelPendingSave();\n            setValues({ ...INITIAL_VALUES });\n            setSavedValues({ ...INITIAL_VALUES });\n            setStatus(\"Preferences reset.\");\n          },\n        }}\n        saveButtonProps={{\n          \"aria-disabled\": !dirty,\n          formAction: \"/local-notification-preferences-preview\",\n          formMethod: \"post\",\n        }}\n        footer=\"Sample data. Changes stay in this preview.\"\n      />\n    </section>\n  );\n}\n\nexport default function AgentExample() {\n  return (\n    <div className=\"tidal-scope\" data-theme=\"light\" dir=\"ltr\">\n      <style>{tidalExampleStyles}</style>\n      <NotificationPreferencesDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/notification-preferences.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "busy",
      "type": "inferred-from-existing-demo",
      "initial": "false",
      "setter": "setBusy",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onPreferenceChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onSave",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": true,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    }
  ],
  "nativeForm": {
    "participates": true,
    "names": [],
    "expectedFormData": {},
    "submitBehavior": "The existing demo's native form callback receives the submit event.",
    "resetBehavior": "Native reset behavior remains available where the demo renders a resettable control.",
    "disabledBehavior": "Disabled controls remain excluded from successful native form submission.",
    "readOnlyBehavior": "Read-only controls retain their value and remain inspectable by the consumer."
  },
  "accessibility": {
    "labelSource": "Existing demo label or ARIA prop",
    "semantics": "Preserve the component's native element and the semantics demonstrated by the source fixture.",
    "keyboard": [
      "Tab and Shift+Tab",
      "Enter or Space for native activation",
      "Arrow keys where the component exposes a composite control"
    ],
    "focusReturn": "Preserve browser focus order and visible focus.",
    "errorAnnouncement": "The existing error or alert path remains consumer-owned and should be announced by the rendered semantics.",
    "reducedMotion": "Verify prefers-reduced-motion with the existing component transition path.",
    "forcedColors": "Verify visible borders, text, and focus in forced-colors mode."
  },
  "responsive": {
    "widths": [
      320,
      390,
      768,
      1260
    ],
    "shortViewport": "Check the example at a 300px viewport height with keyboard or portal content visible.",
    "overflow": "The page should not gain horizontal overflow; component-local scrolling must remain intentional.",
    "touchTargetMinPx": 44,
    "coarseInputFontPx": 16
  },
  "errors": [
    {
      "fixture": "Exercise the existing demo's error, empty, loading, or invalid fixture.",
      "visibleResult": "The consumer-visible result must remain explicit and must not be replaced by a silent console error.",
      "focusResult": "Focus must remain on the triggering control or move to the announced error according to the native pattern.",
      "ownership": "Consumer-owned sample state only; no network request or customer data is used."
    }
  ],
  "verification": {
    "commands": [
      "npx tsc --noEmit",
      "npx vite build"
    ],
    "lockfile": "Use the consumer project's committed lockfile.",
    "browser": [
      "Chromium 1260x800",
      "Chromium 390x844",
      "Keyboard and reduced-motion pass"
    ]
  },
  "validation": {
    "consumerFixture": {
      "tsc": "pass",
      "viteBuild": "pass",
      "resourceModel": "Generated usage plus only the component files and CSS delivered by the primary item and listed registry dependencies."
    },
    "registryArtifact": "server-gated"
  },
  "exceptions": []
}
