@trackunit/filters-filter-bar 1.14.29 → 1.14.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -1380,7 +1380,42 @@ const HierarchicalCheckboxFilter = ({ filterDefinition, filterBarActions, option
1380
1380
  };
1381
1381
 
1382
1382
  /**
1383
- * The FilterBar component serves as a wrapper for managing filters.
1383
+ * FilterBar renders a horizontal bar of user-configurable filters. Each filter is defined via a `FilterBarDefinition`
1384
+ * record (mapping filter keys to filter definitions such as checkbox, radio, date range, or min/max), and the bar's
1385
+ * state is managed by the `useFilterBar` hook which returns the required `filterBarConfig` and `filterBarDefinition` props.
1386
+ *
1387
+ * Filters can be grouped into categories, starred for quick access, shown directly in the bar, or hidden programmatically.
1388
+ * Filter state is automatically persisted to local storage.
1389
+ *
1390
+ * ### When to use
1391
+ * Use FilterBar when a page needs user-driven filtering over a data set — for example, filtering an asset list by brand, model, status, or date range.
1392
+ *
1393
+ * ### When not to use
1394
+ * Do not use FilterBar for a single search input — use `Search`.
1395
+ * Do not use FilterBar for sorting controls — use the `Table` component's built-in sort functionality.
1396
+ *
1397
+ * @example Basic filter bar setup
1398
+ * ```tsx
1399
+ * import { FilterBar, useFilterBar, FilterBarDefinition } from "@trackunit/filters-filter-bar";
1400
+ *
1401
+ * const filterBarDefinition = {
1402
+ * brand: {
1403
+ * filterKey: "brand",
1404
+ * type: "stringArray",
1405
+ * group: "METADATA",
1406
+ * title: "Brand",
1407
+ * valueAsText: (values) => values,
1408
+ * component: (props) => <DefaultCheckboxFilter {...props} loading={false} options={brandOptions} />,
1409
+ * },
1410
+ * } satisfies FilterBarDefinition;
1411
+ *
1412
+ * const AssetFilters = () => {
1413
+ * const filterBar = useFilterBar({ name: "assetFilters", filterBarDefinition });
1414
+ * return <FilterBar {...filterBar} />;
1415
+ * };
1416
+ * ```
1417
+ * @param {FilterBarProps} props - The props for the FilterBar component
1418
+ * @returns {ReactElement} FilterBar component
1384
1419
  */
1385
1420
  const FilterBar = ({ hiddenFilters, className, filterBarDefinition, filterBarConfig, compact = true, allowShowFiltersDirectly = true, title, }) => {
1386
1421
  return (jsxRuntime.jsx(FiltersMenu, { allowShowFiltersDirectly: allowShowFiltersDirectly, className: className, compact: compact, "data-testid": `${filterBarConfig.name}-filterbar`, filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters, title: title }));
package/index.esm.js CHANGED
@@ -1378,7 +1378,42 @@ const HierarchicalCheckboxFilter = ({ filterDefinition, filterBarActions, option
1378
1378
  };
1379
1379
 
1380
1380
  /**
1381
- * The FilterBar component serves as a wrapper for managing filters.
1381
+ * FilterBar renders a horizontal bar of user-configurable filters. Each filter is defined via a `FilterBarDefinition`
1382
+ * record (mapping filter keys to filter definitions such as checkbox, radio, date range, or min/max), and the bar's
1383
+ * state is managed by the `useFilterBar` hook which returns the required `filterBarConfig` and `filterBarDefinition` props.
1384
+ *
1385
+ * Filters can be grouped into categories, starred for quick access, shown directly in the bar, or hidden programmatically.
1386
+ * Filter state is automatically persisted to local storage.
1387
+ *
1388
+ * ### When to use
1389
+ * Use FilterBar when a page needs user-driven filtering over a data set — for example, filtering an asset list by brand, model, status, or date range.
1390
+ *
1391
+ * ### When not to use
1392
+ * Do not use FilterBar for a single search input — use `Search`.
1393
+ * Do not use FilterBar for sorting controls — use the `Table` component's built-in sort functionality.
1394
+ *
1395
+ * @example Basic filter bar setup
1396
+ * ```tsx
1397
+ * import { FilterBar, useFilterBar, FilterBarDefinition } from "@trackunit/filters-filter-bar";
1398
+ *
1399
+ * const filterBarDefinition = {
1400
+ * brand: {
1401
+ * filterKey: "brand",
1402
+ * type: "stringArray",
1403
+ * group: "METADATA",
1404
+ * title: "Brand",
1405
+ * valueAsText: (values) => values,
1406
+ * component: (props) => <DefaultCheckboxFilter {...props} loading={false} options={brandOptions} />,
1407
+ * },
1408
+ * } satisfies FilterBarDefinition;
1409
+ *
1410
+ * const AssetFilters = () => {
1411
+ * const filterBar = useFilterBar({ name: "assetFilters", filterBarDefinition });
1412
+ * return <FilterBar {...filterBar} />;
1413
+ * };
1414
+ * ```
1415
+ * @param {FilterBarProps} props - The props for the FilterBar component
1416
+ * @returns {ReactElement} FilterBar component
1382
1417
  */
1383
1418
  const FilterBar = ({ hiddenFilters, className, filterBarDefinition, filterBarConfig, compact = true, allowShowFiltersDirectly = true, title, }) => {
1384
1419
  return (jsx(FiltersMenu, { allowShowFiltersDirectly: allowShowFiltersDirectly, className: className, compact: compact, "data-testid": `${filterBarConfig.name}-filterbar`, filterBarConfig: filterBarConfig, filterBarDefinition: filterBarDefinition, hiddenFilters: hiddenFilters, title: title }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/filters-filter-bar",
3
- "version": "1.14.29",
3
+ "version": "1.14.31",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -14,15 +14,15 @@
14
14
  "zod": "^3.23.8",
15
15
  "@trackunit/iris-app-api": "1.14.43",
16
16
  "@trackunit/react-core-hooks": "1.12.27",
17
- "@trackunit/react-filter-components": "1.13.28",
18
- "@trackunit/react-date-and-time-components": "1.16.28",
17
+ "@trackunit/react-filter-components": "1.13.30",
18
+ "@trackunit/react-date-and-time-components": "1.16.30",
19
19
  "@trackunit/shared-utils": "1.13.43",
20
- "@trackunit/react-form-components": "1.14.25",
20
+ "@trackunit/react-form-components": "1.14.27",
21
21
  "@trackunit/iris-app-runtime-core-api": "1.12.24",
22
22
  "@trackunit/geo-json-utils": "1.11.43",
23
23
  "@trackunit/i18n-library-translation": "1.12.28",
24
24
  "@trackunit/css-class-variance-utilities": "1.11.43",
25
- "@trackunit/react-components": "1.17.22",
25
+ "@trackunit/react-components": "1.17.24",
26
26
  "@tanstack/react-router": "1.114.29"
27
27
  },
28
28
  "module": "./index.esm.js",
@@ -33,7 +33,42 @@ interface FilterBarProps<TFilterBarDefinition extends FilterBarDefinition> {
33
33
  allowShowFiltersDirectly?: boolean;
34
34
  }
35
35
  /**
36
- * The FilterBar component serves as a wrapper for managing filters.
36
+ * FilterBar renders a horizontal bar of user-configurable filters. Each filter is defined via a `FilterBarDefinition`
37
+ * record (mapping filter keys to filter definitions such as checkbox, radio, date range, or min/max), and the bar's
38
+ * state is managed by the `useFilterBar` hook which returns the required `filterBarConfig` and `filterBarDefinition` props.
39
+ *
40
+ * Filters can be grouped into categories, starred for quick access, shown directly in the bar, or hidden programmatically.
41
+ * Filter state is automatically persisted to local storage.
42
+ *
43
+ * ### When to use
44
+ * Use FilterBar when a page needs user-driven filtering over a data set — for example, filtering an asset list by brand, model, status, or date range.
45
+ *
46
+ * ### When not to use
47
+ * Do not use FilterBar for a single search input — use `Search`.
48
+ * Do not use FilterBar for sorting controls — use the `Table` component's built-in sort functionality.
49
+ *
50
+ * @example Basic filter bar setup
51
+ * ```tsx
52
+ * import { FilterBar, useFilterBar, FilterBarDefinition } from "@trackunit/filters-filter-bar";
53
+ *
54
+ * const filterBarDefinition = {
55
+ * brand: {
56
+ * filterKey: "brand",
57
+ * type: "stringArray",
58
+ * group: "METADATA",
59
+ * title: "Brand",
60
+ * valueAsText: (values) => values,
61
+ * component: (props) => <DefaultCheckboxFilter {...props} loading={false} options={brandOptions} />,
62
+ * },
63
+ * } satisfies FilterBarDefinition;
64
+ *
65
+ * const AssetFilters = () => {
66
+ * const filterBar = useFilterBar({ name: "assetFilters", filterBarDefinition });
67
+ * return <FilterBar {...filterBar} />;
68
+ * };
69
+ * ```
70
+ * @param {FilterBarProps} props - The props for the FilterBar component
71
+ * @returns {ReactElement} FilterBar component
37
72
  */
38
73
  export declare const FilterBar: <TFilterBarDefinition extends FilterBarDefinition>({ hiddenFilters, className, filterBarDefinition, filterBarConfig, compact, allowShowFiltersDirectly, title, }: FilterBarProps<TFilterBarDefinition>) => ReactElement;
39
74
  export {};