@trackunit/react-filter-components 1.3.28 → 1.3.32

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
@@ -3,7 +3,6 @@
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var cssClassVarianceUtilities = require('@trackunit/css-class-variance-utilities');
5
5
  var reactComponents = require('@trackunit/react-components');
6
- var react = require('react');
7
6
  var tailwindMerge = require('tailwind-merge');
8
7
  var reactFormComponents = require('@trackunit/react-form-components');
9
8
 
@@ -29,7 +28,7 @@ const cvaFilterCustomButton = cssClassVarianceUtilities.cvaMerge(["justify-norma
29
28
  * To add items to the popover list use the children prop, this is where you build all the filter items and connected logic.
30
29
  *
31
30
  * @param {FilterProps} props - The props for the Filter component
32
- * @returns {JSX.Element} Filter component
31
+ * @returns {ReactElement} Filter component
33
32
  */
34
33
  const Filter = ({ title, children, popoverProps, isActive, activeLabel, menuListProps, className, dataTestId, withStickyHeader = false, readOnly, ...rest }) => {
35
34
  const buttonProps = { ...rest };
@@ -50,11 +49,10 @@ const cvaMenuListOverrides = cssClassVarianceUtilities.cvaMerge(["overflow-x-hid
50
49
  * The reset button will only be visible if the showReset prop is set to true.
51
50
  *
52
51
  * @param {FilterBodyProps} props - The props for the FilterBody component
53
- * @returns {JSX.Element} FilterBody component
54
52
  */
55
- const FilterBody = react.forwardRef(({ children, className, dataTestId, limitSize = false, ...rest }, ref) => {
53
+ const FilterBody = ({ children, className, dataTestId, limitSize = false, ref, ...rest }) => {
56
54
  return (jsxRuntime.jsx("div", { className: cvaFilterBody({ limitSize, className }), ref: ref, ...rest, "data-testid": dataTestId, children: children }));
57
- });
55
+ };
58
56
  FilterBody.displayName = "FilterBody";
59
57
  const cvaFilterBody = cssClassVarianceUtilities.cvaMerge(["grid", "gap-1", "w-full"], {
60
58
  variants: {
@@ -74,7 +72,7 @@ const cvaFilterBody = cssClassVarianceUtilities.cvaMerge(["grid", "gap-1", "w-fu
74
72
  * The reset button will only be visible if the showReset prop is set to true.
75
73
  *
76
74
  * @param {FilterFooterProps} props - The props for the FilterFooter component
77
- * @returns {JSX.Element} FilterFooter component
75
+ * @returns {ReactElement} FilterFooter component
78
76
  */
79
77
  const FilterFooter = ({ className, dataTestId, children, ...rest }) => {
80
78
  return (jsxRuntime.jsx("div", { className: cvaFilterFooter({ className }), "data-testid": dataTestId, ...rest, children: children }));
@@ -87,7 +85,7 @@ const cvaFilterFooter = cssClassVarianceUtilities.cvaMerge(["flex", "justify-end
87
85
  * The reset button will only be visible if the showReset prop is set to true.
88
86
  *
89
87
  * @param {FilterHeaderProps} props - The props for the FilterHeader component
90
- * @returns {JSX.Element} FilterHeader component
88
+ * @returns {ReactElement} FilterHeader component
91
89
  */
92
90
  const FilterHeader = ({ title, resetLabel, showReset, dataTestId, onReset, loading, children, className, ...rest }) => {
93
91
  return (jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge("grid gap-1 border-b-2 p-1", className), ...rest, "data-testid": dataTestId, children: [jsxRuntime.jsxs("div", { className: "flex h-6 items-center justify-between gap-1 pl-1 text-sm font-medium uppercase text-slate-600", children: [jsxRuntime.jsx("h4", { children: title }), loading ? (jsxRuntime.jsx("div", { children: jsxRuntime.jsx(reactComponents.Spinner, { size: "small" }) })) : (jsxRuntime.jsx(reactComponents.Button, { className: cvaFilterHeaderButton({ isVisible: showReset }), "data-testid": `${dataTestId}-reset-button`, onClick: onReset, size: "small", variant: "ghost", children: resetLabel }))] }), children] }));
@@ -109,7 +107,7 @@ const cvaFilterHeaderButton = cssClassVarianceUtilities.cvaMerge([], {
109
107
  * This component in generic and does not have any connection to the data.
110
108
  *
111
109
  * @param {CheckBoxFilterItemProps} props - The props for the FilterItem component
112
- * @returns {JSX.Element} FilterItem component
110
+ * @returns {ReactElement} FilterItem component
113
111
  */
114
112
  const CheckBoxFilterItem = ({ itemCount, className, suffix, dataTestId, label, ...rest }) => {
115
113
  return (jsxRuntime.jsx(reactFormComponents.Checkbox, { className: reactComponents.cvaInteractableItem({
@@ -124,7 +122,7 @@ const CheckBoxFilterItem = ({ itemCount, className, suffix, dataTestId, label, .
124
122
  * This component in generic and does not have any connection to the data.
125
123
  *
126
124
  * @param {RadioFilterItemProps} props - The props for the FilterItem component
127
- * @returns {JSX.Element} FilterItem component
125
+ * @returns {ReactElement} FilterItem component
128
126
  */
129
127
  const RadioFilterItem = ({ value, label, itemCount, selected, dataTestId, suffix, className, ...rest }) => {
130
128
  return (jsxRuntime.jsx(reactFormComponents.RadioItem, { className: reactComponents.cvaInteractableItem({
package/index.esm.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { cvaMerge } from '@trackunit/css-class-variance-utilities';
3
3
  import { Popover, PopoverTrigger, Button, PopoverContent, MenuList, Spinner, cvaInteractableItem, cvaMenuItemSuffix } from '@trackunit/react-components';
4
- import { forwardRef } from 'react';
5
4
  import { twMerge } from 'tailwind-merge';
6
5
  import { Checkbox, RadioItem } from '@trackunit/react-form-components';
7
6
 
@@ -27,7 +26,7 @@ const cvaFilterCustomButton = cvaMerge(["justify-normal"], {
27
26
  * To add items to the popover list use the children prop, this is where you build all the filter items and connected logic.
28
27
  *
29
28
  * @param {FilterProps} props - The props for the Filter component
30
- * @returns {JSX.Element} Filter component
29
+ * @returns {ReactElement} Filter component
31
30
  */
32
31
  const Filter = ({ title, children, popoverProps, isActive, activeLabel, menuListProps, className, dataTestId, withStickyHeader = false, readOnly, ...rest }) => {
33
32
  const buttonProps = { ...rest };
@@ -48,11 +47,10 @@ const cvaMenuListOverrides = cvaMerge(["overflow-x-hidden", "relative", "!max-w-
48
47
  * The reset button will only be visible if the showReset prop is set to true.
49
48
  *
50
49
  * @param {FilterBodyProps} props - The props for the FilterBody component
51
- * @returns {JSX.Element} FilterBody component
52
50
  */
53
- const FilterBody = forwardRef(({ children, className, dataTestId, limitSize = false, ...rest }, ref) => {
51
+ const FilterBody = ({ children, className, dataTestId, limitSize = false, ref, ...rest }) => {
54
52
  return (jsx("div", { className: cvaFilterBody({ limitSize, className }), ref: ref, ...rest, "data-testid": dataTestId, children: children }));
55
- });
53
+ };
56
54
  FilterBody.displayName = "FilterBody";
57
55
  const cvaFilterBody = cvaMerge(["grid", "gap-1", "w-full"], {
58
56
  variants: {
@@ -72,7 +70,7 @@ const cvaFilterBody = cvaMerge(["grid", "gap-1", "w-full"], {
72
70
  * The reset button will only be visible if the showReset prop is set to true.
73
71
  *
74
72
  * @param {FilterFooterProps} props - The props for the FilterFooter component
75
- * @returns {JSX.Element} FilterFooter component
73
+ * @returns {ReactElement} FilterFooter component
76
74
  */
77
75
  const FilterFooter = ({ className, dataTestId, children, ...rest }) => {
78
76
  return (jsx("div", { className: cvaFilterFooter({ className }), "data-testid": dataTestId, ...rest, children: children }));
@@ -85,7 +83,7 @@ const cvaFilterFooter = cvaMerge(["flex", "justify-end", "p-1"]);
85
83
  * The reset button will only be visible if the showReset prop is set to true.
86
84
  *
87
85
  * @param {FilterHeaderProps} props - The props for the FilterHeader component
88
- * @returns {JSX.Element} FilterHeader component
86
+ * @returns {ReactElement} FilterHeader component
89
87
  */
90
88
  const FilterHeader = ({ title, resetLabel, showReset, dataTestId, onReset, loading, children, className, ...rest }) => {
91
89
  return (jsxs("div", { className: twMerge("grid gap-1 border-b-2 p-1", className), ...rest, "data-testid": dataTestId, children: [jsxs("div", { className: "flex h-6 items-center justify-between gap-1 pl-1 text-sm font-medium uppercase text-slate-600", children: [jsx("h4", { children: title }), loading ? (jsx("div", { children: jsx(Spinner, { size: "small" }) })) : (jsx(Button, { className: cvaFilterHeaderButton({ isVisible: showReset }), "data-testid": `${dataTestId}-reset-button`, onClick: onReset, size: "small", variant: "ghost", children: resetLabel }))] }), children] }));
@@ -107,7 +105,7 @@ const cvaFilterHeaderButton = cvaMerge([], {
107
105
  * This component in generic and does not have any connection to the data.
108
106
  *
109
107
  * @param {CheckBoxFilterItemProps} props - The props for the FilterItem component
110
- * @returns {JSX.Element} FilterItem component
108
+ * @returns {ReactElement} FilterItem component
111
109
  */
112
110
  const CheckBoxFilterItem = ({ itemCount, className, suffix, dataTestId, label, ...rest }) => {
113
111
  return (jsx(Checkbox, { className: cvaInteractableItem({
@@ -122,7 +120,7 @@ const CheckBoxFilterItem = ({ itemCount, className, suffix, dataTestId, label, .
122
120
  * This component in generic and does not have any connection to the data.
123
121
  *
124
122
  * @param {RadioFilterItemProps} props - The props for the FilterItem component
125
- * @returns {JSX.Element} FilterItem component
123
+ * @returns {ReactElement} FilterItem component
126
124
  */
127
125
  const RadioFilterItem = ({ value, label, itemCount, selected, dataTestId, suffix, className, ...rest }) => {
128
126
  return (jsx(RadioItem, { className: cvaInteractableItem({
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@trackunit/react-filter-components",
3
- "version": "1.3.28",
3
+ "version": "1.3.32",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=20.x"
8
8
  },
9
9
  "dependencies": {
10
- "react": "18.3.1",
10
+ "react": "19.0.0",
11
11
  "tailwind-merge": "^2.0.0",
12
- "@trackunit/css-class-variance-utilities": "1.3.23",
13
- "@trackunit/react-components": "1.4.23",
14
- "@trackunit/react-form-components": "1.3.28"
12
+ "@trackunit/css-class-variance-utilities": "1.3.27",
13
+ "@trackunit/react-components": "1.4.27",
14
+ "@trackunit/react-form-components": "1.3.32"
15
15
  },
16
16
  "module": "./index.esm.js",
17
17
  "main": "./index.cjs.js",
@@ -1,4 +1,5 @@
1
1
  import { ButtonProps, MenuListProps, PopoverProps } from "@trackunit/react-components";
2
+ import { ReactElement } from "react";
2
3
  export interface FilterProps extends ButtonProps {
3
4
  /**
4
5
  * The title/name of the filter.
@@ -48,6 +49,6 @@ export interface FilterProps extends ButtonProps {
48
49
  * To add items to the popover list use the children prop, this is where you build all the filter items and connected logic.
49
50
  *
50
51
  * @param {FilterProps} props - The props for the Filter component
51
- * @returns {JSX.Element} Filter component
52
+ * @returns {ReactElement} Filter component
52
53
  */
53
- export declare const Filter: ({ title, children, popoverProps, isActive, activeLabel, menuListProps, className, dataTestId, withStickyHeader, readOnly, ...rest }: FilterProps) => JSX.Element;
54
+ export declare const Filter: ({ title, children, popoverProps, isActive, activeLabel, menuListProps, className, dataTestId, withStickyHeader, readOnly, ...rest }: FilterProps) => ReactElement;
@@ -1,5 +1,5 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
- import { ReactNode } from "react";
2
+ import { ReactNode, Ref } from "react";
3
3
  export interface FilterBodyProps extends CommonProps {
4
4
  /**
5
5
  * Children to render in the body of the filter.
@@ -7,6 +7,10 @@ export interface FilterBodyProps extends CommonProps {
7
7
  */
8
8
  children?: ReactNode;
9
9
  limitSize?: boolean;
10
+ /**
11
+ * A ref for the component
12
+ */
13
+ ref?: Ref<HTMLDivElement>;
10
14
  }
11
15
  /**
12
16
  * The FilterBody component is used to display the title of the filter and a reset button.
@@ -14,6 +18,8 @@ export interface FilterBodyProps extends CommonProps {
14
18
  * The reset button will only be visible if the showReset prop is set to true.
15
19
  *
16
20
  * @param {FilterBodyProps} props - The props for the FilterBody component
17
- * @returns {JSX.Element} FilterBody component
18
21
  */
19
- export declare const FilterBody: import("react").ForwardRefExoticComponent<FilterBodyProps & import("react").RefAttributes<HTMLDivElement>>;
22
+ export declare const FilterBody: {
23
+ ({ children, className, dataTestId, limitSize, ref, ...rest }: FilterBodyProps): import("react/jsx-runtime").JSX.Element;
24
+ displayName: string;
25
+ };
@@ -1,9 +1,10 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
+ import { ReactNode } from "react";
2
3
  export interface FilterFooterProps extends CommonProps {
3
4
  /**
4
5
  * Items to render in the filter footer
5
6
  */
6
- children?: React.ReactNode;
7
+ children?: ReactNode;
7
8
  }
8
9
  /**
9
10
  * The FilterFooter component is used to display the title of the filter and a reset button.
@@ -11,7 +12,7 @@ export interface FilterFooterProps extends CommonProps {
11
12
  * The reset button will only be visible if the showReset prop is set to true.
12
13
  *
13
14
  * @param {FilterFooterProps} props - The props for the FilterFooter component
14
- * @returns {JSX.Element} FilterFooter component
15
+ * @returns {ReactElement} FilterFooter component
15
16
  */
16
17
  export declare const FilterFooter: ({ className, dataTestId, children, ...rest }: FilterFooterProps) => import("react/jsx-runtime").JSX.Element;
17
18
  export declare const cvaFilterFooter: (props?: import("class-variance-authority/dist/types").ClassProp | undefined) => string;
@@ -1,4 +1,5 @@
1
1
  import { CommonProps } from "@trackunit/react-components";
2
+ import { ReactNode } from "react";
2
3
  export interface FilterHeaderProps extends CommonProps {
3
4
  /**
4
5
  * The title of the filter will be displayed in the header.
@@ -21,7 +22,7 @@ export interface FilterHeaderProps extends CommonProps {
21
22
  * Optional elements to render blow the title and reset button.
22
23
  * This is intended for use with the search component.
23
24
  */
24
- children?: React.ReactNode;
25
+ children?: ReactNode;
25
26
  }
26
27
  /**
27
28
  * The FilterHeader component is used to display the title of the filter and a reset button.
@@ -29,7 +30,7 @@ export interface FilterHeaderProps extends CommonProps {
29
30
  * The reset button will only be visible if the showReset prop is set to true.
30
31
  *
31
32
  * @param {FilterHeaderProps} props - The props for the FilterHeader component
32
- * @returns {JSX.Element} FilterHeader component
33
+ * @returns {ReactElement} FilterHeader component
33
34
  */
34
35
  export declare const FilterHeader: ({ title, resetLabel, showReset, dataTestId, onReset, loading, children, className, ...rest }: FilterHeaderProps) => import("react/jsx-runtime").JSX.Element;
35
36
  export declare const cvaFilterHeaderButton: (props?: ({
@@ -4,6 +4,6 @@ import { CheckBoxFilterItemProps } from "../types";
4
4
  * This component in generic and does not have any connection to the data.
5
5
  *
6
6
  * @param {CheckBoxFilterItemProps} props - The props for the FilterItem component
7
- * @returns {JSX.Element} FilterItem component
7
+ * @returns {ReactElement} FilterItem component
8
8
  */
9
9
  export declare const CheckBoxFilterItem: ({ itemCount, className, suffix, dataTestId, label, ...rest }: CheckBoxFilterItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -4,6 +4,6 @@ import { RadioFilterItemProps } from "../types";
4
4
  * This component in generic and does not have any connection to the data.
5
5
  *
6
6
  * @param {RadioFilterItemProps} props - The props for the FilterItem component
7
- * @returns {JSX.Element} FilterItem component
7
+ * @returns {ReactElement} FilterItem component
8
8
  */
9
9
  export declare const RadioFilterItem: ({ value, label, itemCount, selected, dataTestId, suffix, className, ...rest }: RadioFilterItemProps) => import("react/jsx-runtime").JSX.Element;