@trackunit/react-filter-components 1.25.4 → 1.26.1

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
@@ -31,21 +31,21 @@ const cvaFilterCustomButton = cssClassVarianceUtilities.cvaMerge(["justify-norma
31
31
  * @param {FilterProps} props - The props for the Filter component
32
32
  * @returns {ReactElement} Filter component
33
33
  */
34
- const Filter = ({ title, asIcon = undefined, children, popoverProps, isActive = false, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader = false, readOnly = false, visualStyle = "button", size = "small", }) => {
34
+ const Filter = ({ title = "", asIcon = undefined, children, popoverProps, isActive = false, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader = false, readOnly = false, visualStyle = "button", size = "small", }) => {
35
35
  const handleClick = react.useCallback((event) => {
36
36
  event.stopPropagation();
37
37
  }, []);
38
38
  const renderButton = () => {
39
39
  if (asIcon) {
40
- return (jsxRuntime.jsx(reactComponents.IconButton, { className: className, "data-testid": dataTestId, disabled: readOnly, icon: jsxRuntime.jsx(reactComponents.Icon, { name: asIcon, size: "small" }), onClick: handleClick, size: size, title: "TODO: localize", variant: isActive ? "ghost" : "ghost-neutral" }));
40
+ return (jsxRuntime.jsx(reactComponents.IconButton, { className: className, "data-testid": dataTestId, disabled: readOnly, icon: jsxRuntime.jsx(reactComponents.Icon, { name: asIcon, size: "small" }), onClick: handleClick, size: size, title: title, variant: isActive ? "ghost" : "ghost-neutral" }));
41
41
  }
42
42
  return (jsxRuntime.jsxs(reactComponents.Button, { className: cvaFilterCustomButton({ isActive, className }), "data-testid": dataTestId, disabled: readOnly, onClick: handleClick, size: size, variant: "secondary", children: [title, isActive ? (jsxRuntime.jsx("div", { className: "grid overflow-hidden text-ellipsis whitespace-nowrap", children: jsxRuntime.jsx("span", { className: "text-primary-600 truncate", children: activeLabel }) })) : null] }));
43
43
  };
44
- return (jsxRuntime.jsx(reactComponents.Popover, { "data-testid": dataTestId ? `${dataTestId}-popover` : undefined, placement: "top-start", ...popoverProps, dismissal: { ancestorScroll: true }, onOpenStateChange: open => {
44
+ return (jsxRuntime.jsx(reactComponents.Popover, { ...popoverProps, "data-testid": dataTestId ? `${dataTestId}-popover` : undefined, dismissal: { ancestorScroll: true }, onOpenStateChange: open => {
45
45
  if (!open) {
46
46
  document.getElementById("starred-filters-menu-popover")?.focus();
47
47
  }
48
- }, children: modalState => {
48
+ }, placement: "top-start", children: modalState => {
49
49
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { children: visualStyle === "list-item" ? (jsxRuntime.jsxs("li", { className: reactComponents.cvaInteractableItem({
50
50
  disabled: readOnly,
51
51
  selection: modalState.isOpen ? "selected" : "unselected",
package/index.esm.js CHANGED
@@ -29,21 +29,21 @@ const cvaFilterCustomButton = cvaMerge(["justify-normal"], {
29
29
  * @param {FilterProps} props - The props for the Filter component
30
30
  * @returns {ReactElement} Filter component
31
31
  */
32
- const Filter = ({ title, asIcon = undefined, children, popoverProps, isActive = false, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader = false, readOnly = false, visualStyle = "button", size = "small", }) => {
32
+ const Filter = ({ title = "", asIcon = undefined, children, popoverProps, isActive = false, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader = false, readOnly = false, visualStyle = "button", size = "small", }) => {
33
33
  const handleClick = useCallback((event) => {
34
34
  event.stopPropagation();
35
35
  }, []);
36
36
  const renderButton = () => {
37
37
  if (asIcon) {
38
- return (jsx(IconButton, { className: className, "data-testid": dataTestId, disabled: readOnly, icon: jsx(Icon, { name: asIcon, size: "small" }), onClick: handleClick, size: size, title: "TODO: localize", variant: isActive ? "ghost" : "ghost-neutral" }));
38
+ return (jsx(IconButton, { className: className, "data-testid": dataTestId, disabled: readOnly, icon: jsx(Icon, { name: asIcon, size: "small" }), onClick: handleClick, size: size, title: title, variant: isActive ? "ghost" : "ghost-neutral" }));
39
39
  }
40
40
  return (jsxs(Button, { className: cvaFilterCustomButton({ isActive, className }), "data-testid": dataTestId, disabled: readOnly, onClick: handleClick, size: size, variant: "secondary", children: [title, isActive ? (jsx("div", { className: "grid overflow-hidden text-ellipsis whitespace-nowrap", children: jsx("span", { className: "text-primary-600 truncate", children: activeLabel }) })) : null] }));
41
41
  };
42
- return (jsx(Popover, { "data-testid": dataTestId ? `${dataTestId}-popover` : undefined, placement: "top-start", ...popoverProps, dismissal: { ancestorScroll: true }, onOpenStateChange: open => {
42
+ return (jsx(Popover, { ...popoverProps, "data-testid": dataTestId ? `${dataTestId}-popover` : undefined, dismissal: { ancestorScroll: true }, onOpenStateChange: open => {
43
43
  if (!open) {
44
44
  document.getElementById("starred-filters-menu-popover")?.focus();
45
45
  }
46
- }, children: modalState => {
46
+ }, placement: "top-start", children: modalState => {
47
47
  return (jsxs(Fragment, { children: [jsx(PopoverTrigger, { children: visualStyle === "list-item" ? (jsxs("li", { className: cvaInteractableItem({
48
48
  disabled: readOnly,
49
49
  selection: modalState.isOpen ? "selected" : "unselected",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-filter-components",
3
- "version": "1.25.4",
3
+ "version": "1.26.1",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -10,8 +10,8 @@
10
10
  "tailwind-merge": "^2.0.0",
11
11
  "@trackunit/ui-icons": "1.13.6",
12
12
  "@trackunit/css-class-variance-utilities": "1.13.6",
13
- "@trackunit/react-components": "1.25.4",
14
- "@trackunit/react-form-components": "1.26.4"
13
+ "@trackunit/react-components": "1.26.1",
14
+ "@trackunit/react-form-components": "1.27.1"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@tanstack/react-router": "^1.114.29",