{
  "component": {
    "id": "query-builder",
    "name": "Query builder",
    "tier": "pro",
    "exampleId": "query-builder",
    "access": "pro",
    "requiresAuthorization": true
  },
  "source": {
    "demoModule": "src/query-builder-demo.tsx",
    "exportName": "QueryBuilderDemo",
    "sha256": "f4ecef34ff411a5ac4bcf27ed2481151ad0cf839916fe0fa6a8eb6f3aa5bfbb9",
    "helperImports": [],
    "directComponentImports": [
      "query-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/query-builder",
    "registryUrl": "https://tidalui.com/r/pro/query-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/query-builder",
      "purpose": "component",
      "command": "npx shadcn@latest add @tidal-pro/query-builder",
      "registryUrl": "https://tidalui.com/r/pro/query-builder.json",
      "access": "pro",
      "sourceDelivery": "server-gated",
      "requiresAuthorization": true
    }
  ],
  "imports": {
    "componentPath": "components/ui/query-builder.tsx",
    "exports": [
      "TidalQueryBuilder",
      "TidalQueryField",
      "TidalQueryRule"
    ],
    "stylesheets": [
      "components/ui/tidal.css",
      "components/ui/query-builder.css"
    ],
    "scopeClass": "tidal-scope"
  },
  "dependencies": {
    "npm": [
      "lucide-react"
    ],
    "registry": [],
    "additionalRegistry": [],
    "installClosure": [
      "query-builder"
    ],
    "css": [
      "components/ui/tidal.css",
      "components/ui/query-builder.css"
    ],
    "demoCss": [],
    "consumerOwned": [
      "react",
      "react-dom"
    ]
  },
  "files": {
    "sourceFile": "/examples/query-builder.tsx",
    "demoStyles": [],
    "inlinedDemoStyles": [
      "src/query-builder-demo.css"
    ],
    "assets": []
  },
  "example": {
    "language": "tsx",
    "source": "\"use client\";\n\nimport \"./components/ui/tidal.css\";\n\nimport { useMemo, useRef, useState } from \"react\";\n\nimport { TidalQueryBuilder, type TidalQueryField, type TidalQueryRule } from \"./components/ui/query-builder\";\n\nimport \"./components/ui/query-builder.css\";\n\n\n\nconst tidalExampleStyles = \".query-builder-demo,\\n.query-builder-demo * {\\n  box-sizing: border-box;\\n}\\n\\n.query-builder-demo {\\n  display: grid;\\n  width: min(760px, 100%);\\n  min-width: 0;\\n  gap: 12px;\\n  padding: clamp(12px, 2.4vw, 18px);\\n  border: 1px solid var(--t-border);\\n  border-radius: 18px;\\n  background: var(--t-surface);\\n  box-shadow: 0 18px 54px var(--t-shadow-soft);\\n}\\n\\n.query-builder-demo-footer {\\n  display: flex;\\n  min-width: 0;\\n  align-items: center;\\n  justify-content: space-between;\\n  gap: 12px;\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  line-height: 1.4;\\n}\\n\\n.query-builder-demo-footer > span {\\n  min-width: 0;\\n  overflow-wrap: anywhere;\\n}\\n\\n.query-builder-demo-footer button {\\n  display: inline-flex;\\n  min-width: 64px;\\n  min-height: 44px;\\n  flex: 0 0 auto;\\n  align-items: center;\\n  justify-content: center;\\n  padding: 0 13px;\\n  border: 1px solid var(--t-border);\\n  border-radius: 9px;\\n  background: var(--t-surface);\\n  color: var(--t-ink);\\n  font: inherit;\\n  font-size: 12px;\\n  font-weight: 720;\\n  cursor: pointer;\\n}\\n\\n.query-builder-demo-footer button:hover {\\n  border-color: var(--t-ink);\\n}\\n\\n.query-builder-demo-footer button:focus-visible {\\n  outline: 2px solid var(--t-accent);\\n  outline-offset: 3px;\\n}\\n\\n.query-builder-demo-note {\\n  margin: 0;\\n  color: var(--t-muted);\\n  font-size: 11px;\\n  line-height: 1.45;\\n}\\n\\n@media (prefers-reduced-motion: reduce) {\\n  .query-builder-demo-footer button {\\n    transition: none;\\n  }\\n}\\n\\n@media (forced-colors: active) {\\n  .query-builder-demo,\\n  .query-builder-demo-footer button {\\n    border-color: CanvasText;\\n    box-shadow: none;\\n  }\\n}\";\n\nconst FIELDS: readonly TidalQueryField[] = [\n  {\n    id: \"status\",\n    label: \"Project status\",\n    kind: \"enum\",\n    operators: [\n      { id: \"is\", label: \"is\" },\n      { id: \"is-not\", label: \"is not\" },\n    ],\n    options: [\n      { value: \"active\", label: \"Active\" },\n      { value: \"review\", label: \"In review\" },\n      { value: \"complete\", label: \"Complete\" },\n    ],\n  },\n  {\n    id: \"owner\",\n    label: \"Owner\",\n    kind: \"text\",\n    placeholder: \"Name or team\",\n    operators: [\n      { id: \"contains\", label: \"contains\" },\n      { id: \"is\", label: \"is exactly\" },\n      { id: \"is-empty\", label: \"is empty\", requiresValue: false },\n    ],\n  },\n  {\n    id: \"estimate\",\n    label: \"Estimate\",\n    kind: \"number\",\n    placeholder: \"Hours\",\n    operators: [\n      { id: \"greater\", label: \"is greater than\" },\n      { id: \"less\", label: \"is less than\" },\n      { id: \"equal\", label: \"equals\" },\n    ],\n  },\n];\n\nconst INITIAL_RULES: readonly TidalQueryRule[] = [\n  {\n    id: \"sample-status\",\n    fieldId: \"status\",\n    operatorId: \"is\",\n    value: \"active\",\n  },\n  {\n    id: \"sample-estimate\",\n    fieldId: \"estimate\",\n    operatorId: \"less\",\n    value: \"24\",\n  },\n];\n\nexport function QueryBuilderDemo() {\n  const [rules, setRules] = useState<TidalQueryRule[]>([...INITIAL_RULES]);\n  const [conjunction, setConjunction] = useState<\"and\" | \"or\">(\"and\");\n  const nextId = useRef(1);\n  const errors = useMemo(\n    () =>\n      Object.fromEntries(\n        rules.flatMap((rule) => {\n          const field = FIELDS.find(\n            (candidate) => candidate.id === rule.fieldId,\n          );\n          const operator = field?.operators.find(\n            (candidate) => candidate.id === rule.operatorId,\n          );\n          return operator?.requiresValue !== false && rule.value.trim() === \"\"\n            ? [[rule.id, \"Enter a value for this rule.\"]]\n            : [];\n        }),\n      ),\n    [rules],\n  );\n  const validCount = rules.length - Object.keys(errors).length;\n\n  return (\n    <section className=\"query-builder-demo\" aria-label=\"Project query sample\">\n      <TidalQueryBuilder\n        label=\"Project query\"\n        description=\"Build a local rule set for a saved project view.\"\n        fields={FIELDS}\n        rules={rules}\n        conjunction={conjunction}\n        onConjunctionChange={setConjunction}\n        onRulesChange={(nextRules) => setRules(nextRules)}\n        createRule={() => ({\n          id: `sample-rule-${nextId.current++}`,\n          fieldId: \"owner\",\n          operatorId: \"contains\",\n          value: \"\",\n        })}\n        errors={errors}\n        getRuleControlProps={(rule) => ({\n          fieldSelectProps: { name: `field-${rule.id}` },\n          operatorSelectProps: { name: `operator-${rule.id}` },\n          valueInputProps: { name: `value-${rule.id}` },\n          valueSelectProps: { name: `value-${rule.id}` },\n        })}\n        result={\n          <p>\n            {rules.length === 0\n              ? \"No rules supplied.\"\n              : `${validCount} of ${rules.length} rules ready. The host app decides how to use them.`}\n          </p>\n        }\n      />\n      <div className=\"query-builder-demo-footer\">\n        <span>\n          {conjunction === \"and\" ? \"Match every rule\" : \"Match any rule\"}\n        </span>\n        <button\n          type=\"button\"\n          onClick={() => {\n            setRules([...INITIAL_RULES]);\n            setConjunction(\"and\");\n          }}\n        >\n          Reset\n        </button>\n      </div>\n      <p className=\"query-builder-demo-note\">\n        Sample rules. Nothing is queried or saved.\n      </p>\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      <QueryBuilderDemo />\n    </div>\n  );\n}\n",
    "sourceFile": "/examples/query-builder.tsx",
    "fixtureData": "Existing demo fixture data only; replace with consumer-owned data before production use."
  },
  "controlledState": [
    {
      "prop": "rules",
      "type": "inferred-from-existing-demo",
      "initial": "[...INITIAL_RULES]",
      "setter": "setRules",
      "proposalCanBeRejected": false
    },
    {
      "prop": "conjunction",
      "type": "inferred-from-existing-demo",
      "initial": "\"and\"",
      "setter": "setConjunction",
      "proposalCanBeRejected": false
    }
  ],
  "events": [
    {
      "name": "onClick",
      "nativeType": "React synthetic event or native callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onConjunctionChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "observedResult": "The existing demo callback remains the source of truth; this example does not call a live service."
    },
    {
      "name": "onRulesChange",
      "nativeType": "component callback",
      "callerFirst": true,
      "preventable": false,
      "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": []
}
