@trackunit/react-filter-components 2.4.7-alpha-770d9994af7.0 → 2.4.9-alpha-d0f54ff2967.0

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
@@ -30,7 +30,7 @@ const cvaFilterCustomButton = cssClassVarianceUtilities.cvaMerge(["justify-norma
30
30
  * @param {FilterProps} props - The props for the Filter component
31
31
  * @returns {ReactElement} Filter component
32
32
  */
33
- 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
+ const Filter = ({ title = "", asIcon = undefined, children, popoverProps, isActive = false, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader = false, readOnly = false, visualStyle = "button", size = "small", listItemStopPropagation = true, }) => {
34
34
  const renderButton = () => {
35
35
  if (asIcon) {
36
36
  return (jsxRuntime.jsx(reactComponents.IconButton, { className: className, "data-testid": dataTestId, disabled: readOnly, icon: jsxRuntime.jsx(reactComponents.Icon, { name: asIcon, size: "small" }), size: size, title: title, variant: isActive ? "ghost" : "ghost-neutral" }));
@@ -39,7 +39,7 @@ const Filter = ({ title = "", asIcon = undefined, children, popoverProps, isActi
39
39
  };
40
40
  const renderSubmenuContent = () => children !== undefined ? (jsxRuntime.jsx(reactComponents.MenuContent, { className: cvaMenuShellOverrides({ withStickyHeader }), "data-testid": dataTestId ? dataTestId : undefined, listClassName: cvaMenuListOverrides({ withStickyHeader }), ...menuListProps, children: children })) : (jsxRuntime.jsx(jsxRuntime.Fragment, {}));
41
41
  if (visualStyle === "list-item") {
42
- return (jsxRuntime.jsx(reactComponents.MenuItem, { className: className, "data-testid": dataTestId, disabled: readOnly, submenu: children !== undefined ? renderSubmenuContent() : undefined,
42
+ return (jsxRuntime.jsx(reactComponents.MenuItem, { className: className, "data-testid": dataTestId, disabled: readOnly, stopPropagation: listItemStopPropagation, submenu: children !== undefined ? renderSubmenuContent() : undefined,
43
43
  // See the sizing comment on the button variant's `Popover` below -- same reasoning applies to the
44
44
  // submenu Popover that `MenuItem` renders internally for this visual style.
45
45
  submenuSizing: popoverProps?.sizing ?? { minWidth: 280 }, suffix: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isActive && activeLabel && activeOptionsCount === undefined ? (jsxRuntime.jsx(reactComponents.Badge, { className: "mx-2", compact: true })) : (jsxRuntime.jsx("div", { className: "flex min-w-[30px] shrink-0 items-center justify-center", children: isActive && activeLabel && activeOptionsCount !== undefined ? (jsxRuntime.jsx(reactComponents.Badge, { count: activeOptionsCount, size: "condensed" })) : null })), readOnly ? null : jsxRuntime.jsx(reactComponents.Icon, { ariaHidden: true, color: "neutral", name: "ChevronRight", size: "small" })] }), children: jsxRuntime.jsx("span", { className: "flex-grow truncate", children: title }) }));
package/index.esm.js CHANGED
@@ -28,7 +28,7 @@ const cvaFilterCustomButton = cvaMerge(["justify-normal"], {
28
28
  * @param {FilterProps} props - The props for the Filter component
29
29
  * @returns {ReactElement} Filter component
30
30
  */
31
- const Filter = ({ title = "", asIcon = undefined, children, popoverProps, isActive = false, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader = false, readOnly = false, visualStyle = "button", size = "small", }) => {
31
+ const Filter = ({ title = "", asIcon = undefined, children, popoverProps, isActive = false, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader = false, readOnly = false, visualStyle = "button", size = "small", listItemStopPropagation = true, }) => {
32
32
  const renderButton = () => {
33
33
  if (asIcon) {
34
34
  return (jsx(IconButton, { className: className, "data-testid": dataTestId, disabled: readOnly, icon: jsx(Icon, { name: asIcon, size: "small" }), size: size, title: title, variant: isActive ? "ghost" : "ghost-neutral" }));
@@ -37,7 +37,7 @@ const Filter = ({ title = "", asIcon = undefined, children, popoverProps, isActi
37
37
  };
38
38
  const renderSubmenuContent = () => children !== undefined ? (jsx(MenuContent, { className: cvaMenuShellOverrides({ withStickyHeader }), "data-testid": dataTestId ? dataTestId : undefined, listClassName: cvaMenuListOverrides({ withStickyHeader }), ...menuListProps, children: children })) : (jsx(Fragment, {}));
39
39
  if (visualStyle === "list-item") {
40
- return (jsx(MenuItem, { className: className, "data-testid": dataTestId, disabled: readOnly, submenu: children !== undefined ? renderSubmenuContent() : undefined,
40
+ return (jsx(MenuItem, { className: className, "data-testid": dataTestId, disabled: readOnly, stopPropagation: listItemStopPropagation, submenu: children !== undefined ? renderSubmenuContent() : undefined,
41
41
  // See the sizing comment on the button variant's `Popover` below -- same reasoning applies to the
42
42
  // submenu Popover that `MenuItem` renders internally for this visual style.
43
43
  submenuSizing: popoverProps?.sizing ?? { minWidth: 280 }, suffix: jsxs(Fragment, { children: [isActive && activeLabel && activeOptionsCount === undefined ? (jsx(Badge, { className: "mx-2", compact: true })) : (jsx("div", { className: "flex min-w-[30px] shrink-0 items-center justify-center", children: isActive && activeLabel && activeOptionsCount !== undefined ? (jsx(Badge, { count: activeOptionsCount, size: "condensed" })) : null })), readOnly ? null : jsx(Icon, { ariaHidden: true, color: "neutral", name: "ChevronRight", size: "small" })] }), children: jsx("span", { className: "flex-grow truncate", children: title }) }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-filter-components",
3
- "version": "2.4.7-alpha-770d9994af7.0",
3
+ "version": "2.4.9-alpha-d0f54ff2967.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -8,10 +8,10 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "tailwind-merge": "^2.0.0",
11
- "@trackunit/ui-icons": "1.14.3-alpha-770d9994af7.0",
12
- "@trackunit/css-class-variance-utilities": "1.14.3-alpha-770d9994af7.0",
13
- "@trackunit/react-components": "2.6.2-alpha-770d9994af7.0",
14
- "@trackunit/react-form-components": "2.4.7-alpha-770d9994af7.0"
11
+ "@trackunit/ui-icons": "1.14.4-alpha-d0f54ff2967.0",
12
+ "@trackunit/css-class-variance-utilities": "1.14.4-alpha-d0f54ff2967.0",
13
+ "@trackunit/react-components": "2.6.3-alpha-d0f54ff2967.0",
14
+ "@trackunit/react-form-components": "2.4.8-alpha-d0f54ff2967.0"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@tanstack/react-router": "^1.114.29",
@@ -54,6 +54,15 @@ export interface FilterProps extends ButtonProps {
54
54
  * @default "button"
55
55
  */
56
56
  visualStyle?: FilterVisualStyle;
57
+ /**
58
+ * Only applies to `visualStyle="list-item"`. By default the row stops click propagation like any
59
+ * other `MenuItem`, so opening its own submenu never bubbles up and dismisses a parent menu. Set to
60
+ * `false` only when this row is deliberately composed as the trigger for an *external* popover
61
+ * (e.g. `FilterBarMenuItem`), where the click needs to reach that outer `PopoverTrigger`.
62
+ *
63
+ * @default true
64
+ */
65
+ listItemStopPropagation?: boolean;
57
66
  }
58
67
  /**
59
68
  * The Filter component is the base component used in the manager to filter data.
@@ -67,4 +76,4 @@ export interface FilterProps extends ButtonProps {
67
76
  * @param {FilterProps} props - The props for the Filter component
68
77
  * @returns {ReactElement} Filter component
69
78
  */
70
- export declare const Filter: ({ title, asIcon, children, popoverProps, isActive, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader, readOnly, visualStyle, size, }: FilterProps) => ReactElement;
79
+ export declare const Filter: ({ title, asIcon, children, popoverProps, isActive, activeLabel, activeOptionsCount, menuListProps, className, "data-testid": dataTestId, withStickyHeader, readOnly, visualStyle, size, listItemStopPropagation, }: FilterProps) => ReactElement;