{
  "component": {
    "id": "rule-builder",
    "name": "Rule builder",
    "tier": "pro",
    "exampleId": "rule-builder",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/rule-builder-demo.tsx",
    "exportName": "RuleBuilderDemo",
    "sha256": "e436e2a414ffcbf93285d3f817286ccb24ec1fd786fafacbe573d5e9f67b2145",
    "helperImports": [],
    "directComponentImports": [
      "query-builder",
      "rule-builder"
    ],
    "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/rule-builder",
    "registryUrl": "https://tidalui.com/r/pro/rule-builder.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/rule-builder",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/rule-builder",
      "registryUrl": "https://tidalui.com/r/pro/rule-builder.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/rule-builder.tsx",
    "exports": [
      "TidalQueryConjunction",
      "TidalQueryField",
      "TidalQueryRule",
      "TidalRuleAction",
      "TidalRuleActionDefinition",
      "TidalRuleBuilder"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/rule-builder.css",
      "components/ui/query-builder.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [
      "lucide-react"
    ],
    "registry": [
      "@tidal-pro/query-builder"
    ],
    "additionalRegistry": [],
    "installClosure": [
      "query-builder",
      "rule-builder"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/rule-builder.css",
      "components/ui/query-builder.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/rule-builder.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/rule-builder-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "import \"./components/ui/tidal.css\";\n\nimport { useId, useRef, useState, type FormEvent } from \"react\";\n\nimport { TidalRuleBuilder, type TidalRuleAction, type TidalRuleActionDefinition } from \"./components/ui/rule-builder\";\n\nimport type { TidalQueryField, TidalQueryRule, TidalQueryConjunction } from \"./components/ui/query-builder\";\n\nimport \"./components/ui/rule-builder.css\";\n\nimport \"./components/ui/query-builder.css\";\n\n\n\nconst tidalExampleStyles = \".tidal-scope .rule-builder-demo {\\n  display: grid;\\n  width: min(100%, 920px);\\n  min-width: 0;\\n  gap: 12px;\\n}\\n\\n.tidal-scope .rule-builder-demo-status,\\n.tidal-scope .rule-builder-demo-note {\\n  min-width: 0;\\n  margin: 0;\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  line-height: 1.5;\\n  overflow-wrap: anywhere;\\n}\\n\\n.tidal-scope .rule-builder-demo-status {\\n  padding-inline-start: 2px;\\n  color: var(--t-ink);\\n  font-weight: 650;\\n}\\n\\n.tidal-scope .rule-builder-demo-note {\\n  padding-block-start: 10px;\\n  border-block-start: 1px solid var(--t-border);\\n}\";\n\nconst fields: readonly TidalQueryField[] = [\n  {\n    id: \"plan\",\n    label: \"Plan\",\n    kind: \"enum\",\n    operators: [\n      { id: \"is\", label: \"is\" },\n      { id: \"is-not\", label: \"is not\" },\n    ],\n    options: [\n      { value: \"starter\", label: \"Starter\" },\n      { value: \"team\", label: \"Team\" },\n      { value: \"scale\", label: \"Scale\" },\n    ],\n  },\n  {\n    id: \"open-tasks\",\n    label: \"Open tasks\",\n    kind: \"number\",\n    operators: [\n      { id: \"above\", label: \"is above\" },\n      { id: \"below\", label: \"is below\" },\n      { id: \"equal\", label: \"equals\" },\n    ],\n    placeholder: \"0\",\n  },\n  {\n    id: \"project-name\",\n    label: \"Project name\",\n    kind: \"text\",\n    operators: [\n      { id: \"contains\", label: \"contains\" },\n      { id: \"starts\", label: \"starts with\" },\n    ],\n    placeholder: \"Launch\",\n  },\n];\n\nconst definitions: readonly TidalRuleActionDefinition[] = [\n  {\n    id: \"assign\",\n    label: \"Assign owner\",\n    kind: \"enum\",\n    options: [\n      { value: \"ava\", label: \"Ava Chen\" },\n      { value: \"noah\", label: \"Noah Patel\" },\n      { value: \"mila\", label: \"Mila Santos\" },\n    ],\n  },\n  {\n    id: \"label\",\n    label: \"Add label\",\n    kind: \"text\",\n    placeholder: \"Needs review\",\n  },\n  {\n    id: \"priority\",\n    label: \"Set priority\",\n    kind: \"enum\",\n    options: [\n      { value: \"normal\", label: \"Normal\" },\n      { value: \"high\", label: \"High\" },\n      { value: \"urgent\", label: \"Urgent\" },\n    ],\n  },\n  { id: \"pause\", label: \"Pause intake\", kind: \"none\" },\n];\n\nconst initialRules: readonly TidalQueryRule[] = [\n  { id: \"plan-team\", fieldId: \"plan\", operatorId: \"is\", value: \"team\" },\n  {\n    id: \"tasks-above\",\n    fieldId: \"open-tasks\",\n    operatorId: \"above\",\n    value: \"8\",\n  },\n];\n\nconst initialActions: readonly TidalRuleAction[] = [\n  { id: \"owner\", definitionId: \"assign\", value: \"ava\" },\n  { id: \"review\", definitionId: \"label\", value: \"Needs review\" },\n];\n\nexport function RuleBuilderDemo() {\n  const base = useId().replace(/:/g, \"\");\n  const nextRule = useRef(0);\n  const nextAction = useRef(0);\n  const [rules, setRules] = useState<readonly TidalQueryRule[]>(initialRules);\n  const [actions, setActions] =\n    useState<readonly TidalRuleAction[]>(initialActions);\n  const [conjunction, setConjunction] = useState<TidalQueryConjunction>(\"and\");\n  const [status, setStatus] = useState(\n    \"Adjust the conditions and ordered actions, then save the local draft.\",\n  );\n\n  function save(event: FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    const data = new FormData(event.currentTarget);\n    const actionTypes = [...data.entries()].filter(([name]) =>\n      name.endsWith(\".type\"),\n    ).length;\n    setStatus(\n      `Draft saved locally with ${rules.length} conditions and ${actionTypes} actions. Nothing was run.`,\n    );\n  }\n\n  return (\n    <div className=\"rule-builder-demo\">\n      <TidalRuleBuilder\n        title=\"Routing rule\"\n        description=\"Define the conditions, then order the actions that should follow.\"\n        namePrefix=\"routing\"\n        conditions={{\n          fields,\n          rules,\n          conjunction,\n          onConjunctionChange: (next) => setConjunction(next),\n          onRulesChange: (next) => setRules(next),\n          createRule: () => ({\n            id: `${base}-condition-${++nextRule.current}`,\n            fieldId: \"plan\",\n            operatorId: \"is\",\n            value: \"starter\",\n          }),\n        }}\n        actionDefinitions={definitions}\n        actions={actions}\n        onActionsChange={(next) => setActions(next)}\n        createAction={() => ({\n          id: `${base}-action-${++nextAction.current}`,\n          definitionId: \"assign\",\n          value: \"noah\",\n        })}\n        summary={\n          <p>\n            <strong>Draft:</strong> Match{\" \"}\n            {conjunction === \"and\" ? \"all\" : \"any\"} of {rules.length}{\" \"}\n            conditions, then run {actions.length} ordered actions.\n          </p>\n        }\n        submitLabel=\"Save rule draft\"\n        onSubmit={save}\n      />\n      <output className=\"rule-builder-demo-status\" aria-live=\"polite\">\n        {status}\n      </output>\n      <p className=\"rule-builder-demo-note\">\n        Sample data. Changes stay in this preview and no automation runs.\n      </p>\n    </div>\n  );\n}\n\nexport default function AgentExample() {\n  return (\n    <div className=\"tidal-scope\" data-theme=\"light\" dir=\"ltr\">\n      <style>{tidalExampleStyles}</style>\n      <RuleBuilderDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/rule-builder.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "actions",
      "type": "inferred-from-existing-demo",
      "initial": "initialActions",
      "setter": "setActions",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onActionsChange",
      "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": "onSubmit",
      "nativeType": "React synthetic event or native 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": "Consumer-provided label remains required where the component API requires one.",
    "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": []
}
