@trackunit/filters-filter-bar 0.0.365 → 0.0.366

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
@@ -565,8 +565,10 @@ const DynamicFilterList = ({ rowCount, keyMapper, labelMapper, prefixMapper, onC
565
565
  const [t] = useTranslation();
566
566
  const parentRef = react.useRef(null);
567
567
  const updatedRowCount = react.useMemo(() => (showRequestMoreUseSearch ? rowCount + 1 : rowCount), [rowCount, showRequestMoreUseSearch]);
568
- return (jsxRuntime.jsx(reactFilterComponents.FilterBody, { limitSize: true, ref: parentRef, children: jsxRuntime.jsx(reactComponents.VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "none", children: index => {
569
- return (jsxRuntime.jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxRuntime.jsxs("div", { className: "p-3 pt-2", children: [jsxRuntime.jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsxRuntime.jsx("br", {}), jsxRuntime.jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsxRuntime.jsx(reactFilterComponents.RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsxRuntime.jsx(reactFilterComponents.CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () => onChange === null || onChange === void 0 ? void 0 : onChange(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), showTooltip: showTooltip }, keyMapper(index))) }));
568
+ return (jsxRuntime.jsx(reactFilterComponents.FilterBody, { limitSize: true, ref: parentRef, children: jsxRuntime.jsx(reactComponents.VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "space", children: index => {
569
+ return (jsxRuntime.jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxRuntime.jsxs("div", { className: "p-3 pt-2", children: [jsxRuntime.jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsxRuntime.jsx("br", {}), jsxRuntime.jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsxRuntime.jsx(reactFilterComponents.RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsxRuntime.jsx(reactFilterComponents.CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () => {
570
+ onChange === null || onChange === void 0 ? void 0 : onChange(index);
571
+ }, prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), showTooltip: showTooltip }, keyMapper(index))) }));
570
572
  } }) }));
571
573
  };
572
574
 
@@ -613,7 +615,7 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
613
615
  var _a, _b, _c, _d, _e;
614
616
  const [undefinedCount, setUndefinedCount] = react.useState(null);
615
617
  const { logEvent } = reactCoreHooks.useAnalytics(FilterEvents);
616
- const handleClick = (value) => {
618
+ const handleSetValue = (value) => {
617
619
  logEvent("Filters Applied - V2", {
618
620
  type: filterName !== null && filterName !== void 0 ? filterName : `${sharedUtils.capitalize(filterDefinition.filterKey)}Filter`,
619
621
  value: value.key,
@@ -675,14 +677,14 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
675
677
  }, count: index => { var _a; return (_a = res[index]) === null || _a === void 0 ? void 0 : _a.count; }, keyMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.key) || ""; }, labelMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.label) || ""; }, onChange: index => {
676
678
  const result = res[index];
677
679
  if (result) {
678
- handleClick(result);
680
+ handleSetValue(result);
679
681
  }
680
682
  }, prefixMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.prefix) || ""; }, rowCount: undefinedCount ? res.length - 1 : res.length, showRequestMoreUseSearch: showRequestMoreUseSearch, showTooltip: showTooltip, type: "CheckBox" })) }), showUndefinedOptionWithCountAtBottom && undefinedCount ? (jsxRuntime.jsx(reactFilterComponents.CheckBoxFilterItem, { checked: filterDefinition.type === "valueName"
681
683
  ? filterBarActions.objectArrayIncludesValue(filterDefinition.filterKey, ((_c = results[undefinedCount.index]) === null || _c === void 0 ? void 0 : _c.key) || "")
682
684
  : filterBarActions.arrayIncludesValue(filterDefinition.filterKey, ((_d = results[undefinedCount.index]) === null || _d === void 0 ? void 0 : _d.key) || ""), className: "border-t-2", dataTestId: "dynamic-filter-check-box-undefined", itemCount: undefinedCount.count, label: (_e = results[undefinedCount.index]) === null || _e === void 0 ? void 0 : _e.label, name: "dynamic-filter-check-box-undefined", onChange: () => {
683
685
  const result = results[undefinedCount.index];
684
686
  if (result) {
685
- handleClick(result);
687
+ handleSetValue(result);
686
688
  }
687
689
  } }, "dynamic-filter-check-box-undefined")) : null] }));
688
690
  };
package/index.esm.js CHANGED
@@ -557,8 +557,10 @@ const DynamicFilterList = ({ rowCount, keyMapper, labelMapper, prefixMapper, onC
557
557
  const [t] = useTranslation();
558
558
  const parentRef = useRef(null);
559
559
  const updatedRowCount = useMemo(() => (showRequestMoreUseSearch ? rowCount + 1 : rowCount), [rowCount, showRequestMoreUseSearch]);
560
- return (jsx(FilterBody, { limitSize: true, ref: parentRef, children: jsx(VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "none", children: index => {
561
- return (jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxs("div", { className: "p-3 pt-2", children: [jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsx("br", {}), jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsx(RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsx(CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () => onChange === null || onChange === void 0 ? void 0 : onChange(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), showTooltip: showTooltip }, keyMapper(index))) }));
560
+ return (jsx(FilterBody, { limitSize: true, ref: parentRef, children: jsx(VirtualizedList, { count: updatedRowCount, rowHeight: 40, separator: "space", children: index => {
561
+ return (jsx("div", { children: showRequestMoreUseSearch && index === rowCount ? (jsxs("div", { className: "p-3 pt-2", children: [jsx("span", { className: "text-sm text-gray-600", children: t("filter.more.options.if.you.search.title", { count: rowCount }) }), jsx("br", {}), jsx("span", { className: "text-sm italic text-gray-400", children: t("filter.more.options.if.you.search.description") })] })) : type === "Radio" ? (jsx(RadioFilterItem, { dataTestId: "dynamic-filter-radio-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), selected: checked(index), value: keyMapper(index) }, keyMapper(index))) : (jsx(CheckBoxFilterItem, { checked: checked(index), dataTestId: "dynamic-filter-check-box-" + keyMapper(index), itemCount: count(index), label: labelMapper(index), name: keyMapper(index), onChange: () => {
562
+ onChange === null || onChange === void 0 ? void 0 : onChange(index);
563
+ }, prefix: prefixMapper === null || prefixMapper === void 0 ? void 0 : prefixMapper(index), showTooltip: showTooltip }, keyMapper(index))) }));
562
564
  } }) }));
563
565
  };
564
566
 
@@ -605,7 +607,7 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
605
607
  var _a, _b, _c, _d, _e;
606
608
  const [undefinedCount, setUndefinedCount] = useState(null);
607
609
  const { logEvent } = useAnalytics(FilterEvents);
608
- const handleClick = (value) => {
610
+ const handleSetValue = (value) => {
609
611
  logEvent("Filters Applied - V2", {
610
612
  type: filterName !== null && filterName !== void 0 ? filterName : `${capitalize$1(filterDefinition.filterKey)}Filter`,
611
613
  value: value.key,
@@ -667,14 +669,14 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
667
669
  }, count: index => { var _a; return (_a = res[index]) === null || _a === void 0 ? void 0 : _a.count; }, keyMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.key) || ""; }, labelMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.label) || ""; }, onChange: index => {
668
670
  const result = res[index];
669
671
  if (result) {
670
- handleClick(result);
672
+ handleSetValue(result);
671
673
  }
672
674
  }, prefixMapper: index => { var _a; return ((_a = res[index]) === null || _a === void 0 ? void 0 : _a.prefix) || ""; }, rowCount: undefinedCount ? res.length - 1 : res.length, showRequestMoreUseSearch: showRequestMoreUseSearch, showTooltip: showTooltip, type: "CheckBox" })) }), showUndefinedOptionWithCountAtBottom && undefinedCount ? (jsx(CheckBoxFilterItem, { checked: filterDefinition.type === "valueName"
673
675
  ? filterBarActions.objectArrayIncludesValue(filterDefinition.filterKey, ((_c = results[undefinedCount.index]) === null || _c === void 0 ? void 0 : _c.key) || "")
674
676
  : filterBarActions.arrayIncludesValue(filterDefinition.filterKey, ((_d = results[undefinedCount.index]) === null || _d === void 0 ? void 0 : _d.key) || ""), className: "border-t-2", dataTestId: "dynamic-filter-check-box-undefined", itemCount: undefinedCount.count, label: (_e = results[undefinedCount.index]) === null || _e === void 0 ? void 0 : _e.label, name: "dynamic-filter-check-box-undefined", onChange: () => {
675
677
  const result = results[undefinedCount.index];
676
678
  if (result) {
677
- handleClick(result);
679
+ handleSetValue(result);
678
680
  }
679
681
  } }, "dynamic-filter-check-box-undefined")) : null] }));
680
682
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/filters-filter-bar",
3
- "version": "0.0.365",
3
+ "version": "0.0.366",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {