{
  "$schema": "https://next.0build.dev/schema/component.v1.json",
  "accessibility": {
    "aria": [],
    "notes": [
      "Controls get `aria-pressed` (or `aria-selected` for `role=\"tab\"`) reflecting whether their configuration is active, and are kept button-accessible.",
      "Hidden items receive both `hidden` and `display: none` so they leave the layout and accessibility tree."
    ]
  },
  "attributes": [
    {
      "default": "''",
      "description": "Selector of the container(s) whose children are filtered. Defaults to owned `[data-filter-target]` descendants; a selector with no internal match falls back to the document, so external lists work too.",
      "from": null,
      "name": "target",
      "property": "target",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Selector seeding the initial state from matching controls (e.g. `.z-active`); `false` disables seeding. Without it, controls carrying the active class seed the state.",
      "from": null,
      "name": "sel-active",
      "property": "selActive",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "'slide'",
      "description": "Transition style when items show/hide: `slide` (FLIP move/resize), `fade`, `delayed-fade` (staggered fade), or `none`/`false`/empty for instant updates.",
      "from": null,
      "name": "animation",
      "property": "animation",
      "reflect": false,
      "tokens": null,
      "type": "FilterAnimation",
      "values": [
        "",
        "slide",
        "fade",
        "delayed-fade",
        "none",
        "false"
      ]
    },
    {
      "default": "false",
      "description": "Disables all transition animation regardless of `animation`.",
      "from": null,
      "name": "no-animation",
      "property": "no-animation",
      "reflect": false,
      "tokens": null,
      "type": "boolean",
      "values": null
    },
    {
      "default": "250",
      "description": "Transition duration in milliseconds (default 250).",
      "from": null,
      "name": "duration",
      "property": "duration",
      "reflect": false,
      "tokens": null,
      "type": "number",
      "values": null
    },
    {
      "default": "''",
      "description": "Adds classes to named parts as `key: classes` pairs; a plain string targets the default part.",
      "from": "Base",
      "name": "cls",
      "property": "cls",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    },
    {
      "default": "''",
      "description": "Adds inline styles to named parts as `key: styles` pairs; a plain string targets the default part.",
      "from": "Base",
      "name": "stl",
      "property": "stl",
      "reflect": false,
      "tokens": null,
      "type": "string",
      "values": null
    }
  ],
  "category": "data",
  "children": [],
  "cssClasses": [],
  "cssVars": [],
  "dataHooks": [
    {
      "appliesTo": "descendant",
      "attribute": "data-filter",
      "description": "On a control: the CSS selector an item must match to stay visible. Empty value shows all items.",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-filter-control",
      "description": "Marks a clickable control. The value is a filter selector, or `filter: …; group: …; sort: …; order: …` options; separate `data-filter`/`data-group`/`data-sort`/`data-order` attributes override the parsed keys.",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-filter-empty",
      "description": "Marks an empty-state element; shown only when no items match.",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-filter-target",
      "description": "Marks a container whose children are filtered when `target` is unset.",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-fn",
      "description": "Marks a deferred `<template>` child whose content is mounted into the container on demand.",
      "from": "Controller",
      "role": "config",
      "values": [
        "template"
      ]
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-group",
      "description": "On a control: names an independent filter group, so several groups can be active at once (AND-combined).",
      "role": "config",
      "values": []
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-order",
      "description": "Sort direction on a sort control: `asc` (default) or `desc`.",
      "role": "trigger",
      "values": [
        "asc",
        "desc"
      ]
    },
    {
      "appliesTo": "descendant",
      "attribute": "data-sort",
      "description": "On a control: the attribute to sort by (`data-<key>` is also checked), or `:text` for text content. Empty value clears sorting. Numeric values sort numerically.",
      "role": "config",
      "values": []
    }
  ],
  "events": [
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires after the state is applied with `state`, `matchingCount`, and `totalCount`.",
      "detail": {
        "fields": [
          {
            "name": "state",
            "type": "FilterState"
          },
          {
            "name": "matchingCount",
            "type": "number"
          },
          {
            "name": "totalCount",
            "type": "number"
          }
        ],
        "type": "{ state: FilterState; matchingCount: number; totalCount: number }"
      },
      "name": "z-filter:after-filter"
    },
    {
      "bubbles": true,
      "cancelable": true,
      "description": "Cancelable; fires before a state change with `state` and `previousState` in detail. `preventDefault()` keeps the current state.",
      "detail": {
        "fields": [
          {
            "name": "state",
            "type": "{ filter: { [x: string]: string; }; sort: string[]; }"
          },
          {
            "name": "previousState",
            "type": "FilterState"
          }
        ],
        "type": "{ state: { filter: { [x: string]: string; }; sort: string[]; }; previousState: FilterState }"
      },
      "name": "z-filter:before-filter"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires after every applied state change, with the same detail as `after-filter`.",
      "detail": {
        "fields": [
          {
            "name": "state",
            "type": "FilterState"
          },
          {
            "name": "matchingCount",
            "type": "number"
          },
          {
            "name": "totalCount",
            "type": "number"
          }
        ],
        "type": "{ state: FilterState; matchingCount: number; totalCount: number }"
      },
      "name": "z-filter:change"
    },
    {
      "bubbles": true,
      "cancelable": false,
      "description": "Fires when deferred template content is mounted into the container.",
      "detail": {
        "fields": [],
        "type": "Record<string, unknown>"
      },
      "from": "Controller",
      "name": "z-filter:mount"
    }
  ],
  "i18n": [],
  "icons": [],
  "id": "filter",
  "inherits": [
    "Controller",
    "Base"
  ],
  "keyboard": [
    {
      "action": "Activates the focused filter control (native buttons/links keep their default behavior).",
      "keys": [
        "Enter",
        "Space"
      ]
    }
  ],
  "kind": "controller",
  "methods": [
    {
      "description": "Applies a control element's configuration (as if it were clicked), optionally without animation.",
      "name": "apply",
      "params": [
        {
          "default": null,
          "name": "controlEl",
          "optional": false,
          "type": "HTMLElement"
        },
        {
          "default": "true",
          "name": "animate",
          "optional": true,
          "type": "boolean"
        }
      ],
      "returns": "Promise<void>",
      "static": false
    },
    {
      "description": "Returns a copy of the current state: `filter` (group → selector map) and `sort` (`[key, order]` or `[]`).",
      "name": "getState",
      "params": [],
      "returns": "FilterState",
      "static": false
    },
    {
      "description": "Re-indexes items, re-syncs control classes/ARIA, and re-applies the current state without events.",
      "name": "refresh",
      "params": [],
      "returns": "void",
      "static": false
    },
    {
      "description": "Clears all filters and sorting (back to the original order).",
      "name": "reset",
      "params": [
        {
          "default": "true",
          "name": "animate",
          "optional": true,
          "type": "boolean"
        }
      ],
      "returns": "Promise<void>",
      "static": false
    },
    {
      "description": "Sets the state directly, firing `before-filter`/`after-filter`/`change`; resolves when transitions finish.",
      "name": "setState",
      "params": [
        {
          "default": null,
          "name": "state",
          "optional": false,
          "type": "Partial<FilterState>"
        },
        {
          "default": "true",
          "name": "animate",
          "optional": true,
          "type": "boolean"
        }
      ],
      "returns": "Promise<void>",
      "static": false
    }
  ],
  "notes": [
    "Sorting reorders the DOM; clearing the sort restores the original item order.",
    "A MutationObserver re-applies the state when items are added or removed, including in external targets.",
    "Items marked `data-filter-empty` and `<template>` children are never treated as filterable items."
  ],
  "parts": {
    "defaultClsTarget": "active",
    "defaultStlTarget": "host-inner",
    "items": [
      {
        "defaultCls": "z-active",
        "description": "Class toggled on controls whose filter/sort configuration matches the current state (default `z-active`).",
        "foundIn": [
          "$cls"
        ],
        "key": "active",
        "supportsCls": true,
        "supportsStl": false
      }
    ]
  },
  "recipes": [],
  "related": [
    "sortable"
  ],
  "schemaVersion": 1,
  "sources": {
    "css": [
      "src/css/kit-components/filter.css"
    ],
    "cssSelectors": [],
    "ts": "src/js/controllers/components/filter.ts"
  },
  "summary": "Filters and sorts a list of items from declarative controls, with animated show/hide, grouped filters, and empty-state handling.",
  "tag": "z-filter",
  "title": "Filter"
}
