@trackunit/filters-filter-bar 0.0.1-alpha-d272aa10e1.0 → 0.0.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
@@ -1108,8 +1108,18 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
1108
1108
  } })), jsxRuntime.jsx(FilterResults, { results: customSearch ? options : filteredOptions, loading: loading, children: res => (jsxRuntime.jsx(DynamicFilterList, { type: "CheckBox", showTooltip: showTooltip, rowCount: res.length, count: index => res[index].count, keyMapper: index => res[index].key, labelMapper: index => res[index].label, checked: index => filterBarActions.arrayIncludesValue(filterDefinition.filterKey, res[index].key), onChange: index => handleClick(res[index].key), prefixMapper: index => res[index].prefix })) })] }));
1109
1109
  };
1110
1110
 
1111
+ const formatToJustDate = (date) => {
1112
+ if (date) {
1113
+ const year = date.getFullYear();
1114
+ const month = (date.getMonth() + 1).toString().padStart(2, "0"); // pad single digit months with 0
1115
+ const day = date.getDate().toString().padStart(2, "0"); // pad single digit days with 0
1116
+ return `${year}-${month}-${day}`;
1117
+ }
1118
+ return undefined;
1119
+ };
1111
1120
  /**
1112
1121
  * `DefaultDateRangeFilter` is a React component for handling date range filters.
1122
+ * Formats the date range as YYYY-MM-DD - YYYY-MM-DD
1113
1123
  *
1114
1124
  * @param {DefaultFilterProps<DateRangeValue>} props - The properties required for the `DefaultDateRangeFilter` component.
1115
1125
  */
@@ -1150,9 +1160,8 @@ const DefaultDateRangeFilter = ({ filterDefinition, filterName, value, setValue,
1150
1160
  setValue(() => ({ from: fromDateValue, to: toDateValue }));
1151
1161
  };
1152
1162
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(reactFilterComponents.FilterHeader, { title: filterDefinition.title, resetLabel: t("filtersBar.resetFilter"), showReset: hasSelection, onReset: reset }), jsxRuntime.jsxs(reactFilterComponents.FilterBody, { children: [jsxRuntime.jsx("div", { className: "flex gap-4 px-1", children: jsxRuntime.jsx(reactComponents.DayRangePicker, { language: "en", onRangeSelect: dateRange => {
1153
- var _a, _b;
1154
- setFromDateValue((_a = dateRange === null || dateRange === void 0 ? void 0 : dateRange.from) === null || _a === void 0 ? void 0 : _a.toISOString());
1155
- setToDateValue((_b = dateRange === null || dateRange === void 0 ? void 0 : dateRange.to) === null || _b === void 0 ? void 0 : _b.toISOString());
1163
+ setFromDateValue(formatToJustDate(dateRange === null || dateRange === void 0 ? void 0 : dateRange.from));
1164
+ setToDateValue(formatToJustDate(dateRange === null || dateRange === void 0 ? void 0 : dateRange.to));
1156
1165
  }, selectedDays: {
1157
1166
  from: fromDateValue ? new Date(fromDateValue) : undefined,
1158
1167
  to: toDateValue ? new Date(toDateValue) : undefined,
package/index.esm.js CHANGED
@@ -1100,8 +1100,18 @@ const DefaultCheckboxFilter = ({ filterDefinition, filterBarActions, options, lo
1100
1100
  } })), jsx(FilterResults, { results: customSearch ? options : filteredOptions, loading: loading, children: res => (jsx(DynamicFilterList, { type: "CheckBox", showTooltip: showTooltip, rowCount: res.length, count: index => res[index].count, keyMapper: index => res[index].key, labelMapper: index => res[index].label, checked: index => filterBarActions.arrayIncludesValue(filterDefinition.filterKey, res[index].key), onChange: index => handleClick(res[index].key), prefixMapper: index => res[index].prefix })) })] }));
1101
1101
  };
1102
1102
 
1103
+ const formatToJustDate = (date) => {
1104
+ if (date) {
1105
+ const year = date.getFullYear();
1106
+ const month = (date.getMonth() + 1).toString().padStart(2, "0"); // pad single digit months with 0
1107
+ const day = date.getDate().toString().padStart(2, "0"); // pad single digit days with 0
1108
+ return `${year}-${month}-${day}`;
1109
+ }
1110
+ return undefined;
1111
+ };
1103
1112
  /**
1104
1113
  * `DefaultDateRangeFilter` is a React component for handling date range filters.
1114
+ * Formats the date range as YYYY-MM-DD - YYYY-MM-DD
1105
1115
  *
1106
1116
  * @param {DefaultFilterProps<DateRangeValue>} props - The properties required for the `DefaultDateRangeFilter` component.
1107
1117
  */
@@ -1142,9 +1152,8 @@ const DefaultDateRangeFilter = ({ filterDefinition, filterName, value, setValue,
1142
1152
  setValue(() => ({ from: fromDateValue, to: toDateValue }));
1143
1153
  };
1144
1154
  return (jsxs(Fragment, { children: [jsx(FilterHeader$1, { title: filterDefinition.title, resetLabel: t("filtersBar.resetFilter"), showReset: hasSelection, onReset: reset }), jsxs(FilterBody, { children: [jsx("div", { className: "flex gap-4 px-1", children: jsx(DayRangePicker, { language: "en", onRangeSelect: dateRange => {
1145
- var _a, _b;
1146
- setFromDateValue((_a = dateRange === null || dateRange === void 0 ? void 0 : dateRange.from) === null || _a === void 0 ? void 0 : _a.toISOString());
1147
- setToDateValue((_b = dateRange === null || dateRange === void 0 ? void 0 : dateRange.to) === null || _b === void 0 ? void 0 : _b.toISOString());
1155
+ setFromDateValue(formatToJustDate(dateRange === null || dateRange === void 0 ? void 0 : dateRange.from));
1156
+ setToDateValue(formatToJustDate(dateRange === null || dateRange === void 0 ? void 0 : dateRange.to));
1148
1157
  }, selectedDays: {
1149
1158
  from: fromDateValue ? new Date(fromDateValue) : undefined,
1150
1159
  to: toDateValue ? new Date(toDateValue) : undefined,
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "@trackunit/filters-filter-bar",
3
- "version": "0.0.1-alpha-d272aa10e1.0",
3
+ "version": "0.0.1",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=18.x"
8
8
  },
9
9
  "dependencies": {
10
- "@trackunit/i18n-library-translation": "0.0.80-alpha-d272aa10e1.0",
11
- "@trackunit/iris-app-api": "0.0.118-alpha-d272aa10e1.0",
12
- "@trackunit/iris-app-runtime-core-api": "0.3.73-alpha-d272aa10e1.0",
13
- "@trackunit/react-components": "0.1.166-alpha-d272aa10e1.0",
14
- "@trackunit/react-core-contexts-api": "0.2.61-alpha-d272aa10e1.0",
15
- "@trackunit/react-core-contexts-test": "0.1.114-alpha-d272aa10e1.0",
16
- "@trackunit/react-core-hooks": "0.2.100-alpha-d272aa10e1.0",
17
- "@trackunit/react-filter-components": "0.0.213-alpha-d272aa10e1.0",
18
- "@trackunit/react-form-components": "0.0.155-alpha-d272aa10e1.0",
19
- "@trackunit/shared-utils": "0.0.10-alpha-d272aa10e1.0",
10
+ "@trackunit/i18n-library-translation": "0.0.80",
11
+ "@trackunit/iris-app-api": "0.0.118",
12
+ "@trackunit/iris-app-runtime-core-api": "0.3.72",
13
+ "@trackunit/react-components": "0.1.167",
14
+ "@trackunit/react-core-contexts-api": "0.2.60",
15
+ "@trackunit/react-core-contexts-test": "0.1.114",
16
+ "@trackunit/react-core-hooks": "0.2.99",
17
+ "@trackunit/react-filter-components": "0.0.217",
18
+ "@trackunit/react-form-components": "0.0.158",
19
+ "@trackunit/shared-utils": "0.0.9",
20
20
  "dequal": "2.0.3",
21
21
  "lodash": "4.17.21",
22
22
  "react": "18.2.0",
@@ -15,6 +15,8 @@ interface FilterBarProps<TFilterBarDefinition extends FilterBarDefinition> {
15
15
  filterBarDefinition: TFilterBarDefinition;
16
16
  /**
17
17
  * Configuration and actions for the filter bar
18
+ *
19
+ * @see FilterBarConfig
18
20
  */
19
21
  filterBarConfig: FilterBarConfig<TFilterBarDefinition> & FilterMapActions & FilterMapGetter;
20
22
  }
@@ -3,6 +3,7 @@ import { DateRangeValue } from "../types/FilterTypes";
3
3
  import { DefaultFilterProps } from "./DefaultFilterTypes";
4
4
  /**
5
5
  * `DefaultDateRangeFilter` is a React component for handling date range filters.
6
+ * Formats the date range as YYYY-MM-DD - YYYY-MM-DD
6
7
  *
7
8
  * @param {DefaultFilterProps<DateRangeValue>} props - The properties required for the `DefaultDateRangeFilter` component.
8
9
  */
@@ -2,8 +2,7 @@
2
2
  import { FilterBarConfig, FilterBarDefinition, FilterMapActions, FilterMapGetter } from "../types/FilterTypes";
3
3
  interface StarredFiltersProps<TFilterBarDefinition extends FilterBarDefinition> {
4
4
  /**
5
- * Configuration for the filter bar, including actions and getters.
6
- * This is parameterized by the specific filter bar definition type.
5
+ * Configuration for the filter bar.
7
6
  */
8
7
  filterBarConfig: FilterBarConfig<TFilterBarDefinition> & FilterMapActions & FilterMapGetter;
9
8
  /**