@codezee/sixtify-brahma 0.2.29 → 0.2.30

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.
Files changed (73) hide show
  1. package/package.json +1 -1
  2. package/packages/shared-components/dist/Actions/AddAction.d.ts.map +1 -1
  3. package/packages/shared-components/dist/Actions/AddAction.js +2 -1
  4. package/packages/shared-components/dist/Actions/CalendarAction.d.ts.map +1 -1
  5. package/packages/shared-components/dist/Actions/CalendarAction.js +2 -1
  6. package/packages/shared-components/dist/Actions/ConfigureAction.d.ts.map +1 -1
  7. package/packages/shared-components/dist/Actions/ConfigureAction.js +2 -1
  8. package/packages/shared-components/dist/Actions/DeleteAction.d.ts.map +1 -1
  9. package/packages/shared-components/dist/Actions/DeleteAction.js +2 -1
  10. package/packages/shared-components/dist/Actions/DownloadAction.d.ts.map +1 -1
  11. package/packages/shared-components/dist/Actions/DownloadAction.js +2 -1
  12. package/packages/shared-components/dist/Actions/EditAction.d.ts.map +1 -1
  13. package/packages/shared-components/dist/Actions/EditAction.js +2 -1
  14. package/packages/shared-components/dist/Actions/ExportAction.d.ts +4 -0
  15. package/packages/shared-components/dist/Actions/ExportAction.d.ts.map +1 -0
  16. package/packages/shared-components/dist/Actions/ExportAction.js +11 -0
  17. package/packages/shared-components/dist/Actions/FilterAction.d.ts +4 -0
  18. package/packages/shared-components/dist/Actions/FilterAction.d.ts.map +1 -0
  19. package/packages/shared-components/dist/Actions/FilterAction.js +11 -0
  20. package/packages/shared-components/dist/Actions/HistoryAction.d.ts.map +1 -1
  21. package/packages/shared-components/dist/Actions/HistoryAction.js +2 -1
  22. package/packages/shared-components/dist/Actions/ImportAction.d.ts +4 -0
  23. package/packages/shared-components/dist/Actions/ImportAction.d.ts.map +1 -0
  24. package/packages/shared-components/dist/Actions/ImportAction.js +11 -0
  25. package/packages/shared-components/dist/Actions/ViewAction.d.ts +4 -0
  26. package/packages/shared-components/dist/Actions/ViewAction.d.ts.map +1 -0
  27. package/packages/shared-components/dist/Actions/ViewAction.js +11 -0
  28. package/packages/shared-components/dist/Actions/index.d.ts +4 -0
  29. package/packages/shared-components/dist/Actions/index.d.ts.map +1 -1
  30. package/packages/shared-components/dist/Actions/index.js +4 -0
  31. package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItem.d.ts +2 -1
  32. package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItem.d.ts.map +1 -1
  33. package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItem.js +2 -2
  34. package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItemList.d.ts +1 -0
  35. package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItemList.d.ts.map +1 -1
  36. package/packages/shared-components/dist/Drawer/OpenDrawer/OpenDrawerMenuItemList.js +22 -10
  37. package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.d.ts +14 -0
  38. package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.d.ts.map +1 -0
  39. package/packages/shared-components/dist/FilterList/DateRangePickerPopUp.js +33 -0
  40. package/packages/shared-components/dist/FilterList/FilterList.d.ts.map +1 -1
  41. package/packages/shared-components/dist/FilterList/FilterList.js +8 -8
  42. package/packages/shared-components/dist/FilterList/FilterListV2.d.ts +2 -1
  43. package/packages/shared-components/dist/FilterList/FilterListV2.d.ts.map +1 -1
  44. package/packages/shared-components/dist/FilterList/FilterListV2.js +113 -25
  45. package/packages/shared-components/dist/FilterList/FilterPopup.d.ts +4 -2
  46. package/packages/shared-components/dist/FilterList/FilterPopup.d.ts.map +1 -1
  47. package/packages/shared-components/dist/FilterList/FilterPopup.js +8 -5
  48. package/packages/shared-components/dist/FilterList/FilterPopupWrapper.d.ts +12 -4
  49. package/packages/shared-components/dist/FilterList/FilterPopupWrapper.d.ts.map +1 -1
  50. package/packages/shared-components/dist/FilterList/FilterPopupWrapper.js +11 -24
  51. package/packages/shared-components/dist/FilterList/FilterTypeWrapper.d.ts +3 -1
  52. package/packages/shared-components/dist/FilterList/FilterTypeWrapper.d.ts.map +1 -1
  53. package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.d.ts +5 -0
  54. package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.d.ts.map +1 -0
  55. package/packages/shared-components/dist/FilterList/GetFilterPopupComponent.js +26 -0
  56. package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  57. package/packages/shared-components/dist/FormFields/DateRangePicker/DateRangePicker.js +2 -2
  58. package/packages/shared-components/dist/Layouts/FormRow/FormRow.styled.js +1 -1
  59. package/packages/shared-components/dist/Svgs/SvgExport.d.ts +3 -0
  60. package/packages/shared-components/dist/Svgs/SvgExport.d.ts.map +1 -0
  61. package/packages/shared-components/dist/Svgs/SvgExport.js +8 -0
  62. package/packages/shared-components/dist/Svgs/SvgImport.d.ts +3 -0
  63. package/packages/shared-components/dist/Svgs/SvgImport.d.ts.map +1 -0
  64. package/packages/shared-components/dist/Svgs/SvgImport.js +8 -0
  65. package/packages/shared-components/dist/Svgs/SvgProfile.d.ts +2 -0
  66. package/packages/shared-components/dist/Svgs/SvgProfile.d.ts.map +1 -0
  67. package/packages/shared-components/dist/Svgs/SvgProfile.js +6 -0
  68. package/packages/shared-components/dist/Svgs/SvgView.d.ts +3 -0
  69. package/packages/shared-components/dist/Svgs/SvgView.d.ts.map +1 -0
  70. package/packages/shared-components/dist/Svgs/SvgView.js +6 -0
  71. package/packages/shared-components/dist/Svgs/index.d.ts +4 -0
  72. package/packages/shared-components/dist/Svgs/index.d.ts.map +1 -1
  73. package/packages/shared-components/dist/Svgs/index.js +4 -0
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FilterListV2 = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const zod_1 = require("@hookform/resolvers/zod");
5
6
  const icons_material_1 = require("@mui/icons-material");
6
7
  const material_1 = require("@mui/material");
7
8
  const icons_1 = require("@mui/x-date-pickers/icons");
@@ -9,36 +10,80 @@ const lodash_1 = require("lodash");
9
10
  const luxon_1 = require("luxon");
10
11
  const react_1 = require("react");
11
12
  const react_hook_form_1 = require("react-hook-form");
13
+ const zod_2 = require("zod");
12
14
  const Button_1 = require("../Button");
13
15
  const FilterPill_1 = require("../Chips/FilterPill");
14
16
  const FormFields_1 = require("../FormFields");
15
17
  const Switch_1 = require("../FormFields/Switch");
16
18
  const PadBox_1 = require("../PadBox");
17
19
  const SvgFilterList_1 = require("../Svgs/SvgFilterList");
20
+ const Toast_1 = require("../Toast");
18
21
  const Tooltip_1 = require("../Tooltip");
19
22
  const FilterPopupWrapper_1 = require("./FilterPopupWrapper");
23
+ const GetFilterPopupComponent_1 = require("./GetFilterPopupComponent");
20
24
  const getFormData_1 = require("./getFormData");
21
25
  const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onApply, onClear, onChange, dateKeys, }) => {
22
26
  const theme = (0, material_1.useTheme)();
23
27
  const { iron, slate } = theme.palette.app.color;
24
28
  const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
25
29
  const filterPopupAnchorElm = (0, react_1.useRef)(null);
30
+ const dateRangeAnchorRef = (0, react_1.useRef)(null);
26
31
  const [openFilterPopup, setOpenFilterPopup] = (0, react_1.useState)(false);
32
+ const [datePickerPopup, setDatePickerPopup] = (0, react_1.useState)(false);
27
33
  const [currentFilter, setCurrentFilter] = (0, react_1.useState)(null);
34
+ const [expandedKeys, setExpandedKeys] = (0, react_1.useState)([]);
28
35
  const handleDateRange = (filter) => {
29
36
  setCurrentFilter(filter);
30
- setOpenFilterPopup(true);
37
+ setDatePickerPopup(true);
31
38
  };
32
39
  const defaultValues = (0, react_1.useMemo)(() => {
33
40
  return filterListItems.reduce((acc, item) => {
34
- acc[item.key] = item.value ?? null;
41
+ if (item.multiSelect || item.type === "dateRange") {
42
+ acc[item.key] = item.value || [];
43
+ }
44
+ else if (item.type === "switch") {
45
+ acc[item.key] = item.value || false;
46
+ }
47
+ else {
48
+ acc[item.key] = item.value || null;
49
+ }
35
50
  return acc;
36
51
  }, {});
37
52
  }, [filterListData]);
38
- const { control, handleSubmit, setValue, reset, formState: { dirtyFields }, watch, } = (0, react_hook_form_1.useForm)({
53
+ const baseSchema = zod_2.z.object((() => {
54
+ const shape = {};
55
+ filterListItems.forEach((item) => {
56
+ if (item.multiSelect || item.type === "dateRange") {
57
+ shape[item.key] = zod_2.z.array(zod_2.z.string()).nullable().optional();
58
+ }
59
+ else if (item.type === "switch") {
60
+ shape[item.key] = zod_2.z.boolean().nullable().optional();
61
+ }
62
+ else {
63
+ shape[item.key] = zod_2.z.string().nullable().optional();
64
+ }
65
+ });
66
+ return shape;
67
+ })());
68
+ const validationSchema = baseSchema.superRefine((data, ctx) => {
69
+ filterListItems.forEach((item) => {
70
+ if (item.required && !data[item.key].length) {
71
+ ctx.addIssue({
72
+ path: [item.key],
73
+ message: `${item.label} is required`,
74
+ code: zod_2.z.ZodIssueCode.custom,
75
+ });
76
+ }
77
+ });
78
+ });
79
+ const { control, handleSubmit, setValue, reset, formState: { errors, dirtyFields }, watch, } = (0, react_hook_form_1.useForm)({
39
80
  values: defaultValues,
81
+ resolver: (0, zod_1.zodResolver)(validationSchema),
82
+ mode: "all",
40
83
  });
41
84
  const company_id = watch("company_id");
85
+ const business_unit_id = watch("business_unit_id");
86
+ const department_id = watch("department_id");
42
87
  const handleClose = () => {
43
88
  setAnchorEl(null);
44
89
  };
@@ -48,6 +93,12 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
48
93
  }
49
94
  setOpenFilterPopup(false);
50
95
  };
96
+ const handleCloseDatePickerPopup = () => {
97
+ if (currentFilter?.key) {
98
+ setValue(`${currentFilter?.key}`, filterListData?.[currentFilter.key]);
99
+ }
100
+ setDatePickerPopup(false);
101
+ };
51
102
  const handlerReset = () => {
52
103
  reset();
53
104
  onClear();
@@ -59,10 +110,26 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
59
110
  const onSubmit = (data) => {
60
111
  setOpenFilterPopup(false);
61
112
  setCurrentFilter(null);
62
- const filteredData = Object.fromEntries(Object.entries(data).filter(([, value]) => value && !(Array.isArray(value) && value.length === 0)));
113
+ const filteredData = Object.fromEntries(Object.entries(data).filter(([, value]) => value && !(Array.isArray(value) && !value.length)));
63
114
  onApply(filteredData, openFilterPopup, currentFilter?.key);
115
+ handleClose();
116
+ };
117
+ const handleDateRangeSubmit = () => {
118
+ setDatePickerPopup(false);
119
+ };
120
+ const onError = (error) => {
121
+ const errorKeys = Object.keys(error);
122
+ const tabsToExpand = filterListItems
123
+ .filter((filter) => filter.required && errorKeys.includes(filter.key))
124
+ .map((filter) => filter.key);
125
+ setExpandedKeys(tabsToExpand);
64
126
  };
65
127
  const handleDelete = (key) => {
128
+ const item = getFilterItem(key);
129
+ if (item?.required)
130
+ return Toast_1.toasts.error({
131
+ title: "This is a required custom filter field and cannot be removed.",
132
+ });
66
133
  setValue(`${key}`, null);
67
134
  const newData = { ...filterListData };
68
135
  delete newData[key];
@@ -70,7 +137,11 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
70
137
  };
71
138
  const formData = (0, react_hook_form_1.useWatch)({ control });
72
139
  const currentFilterValue = currentFilter?.key
73
- ? watch(currentFilter.key)
140
+ ? currentFilter.key === "switch"
141
+ ? watch(currentFilter.key)
142
+ ? "true"
143
+ : "false"
144
+ : watch(currentFilter.key)
74
145
  : null;
75
146
  (0, react_1.useEffect)(() => {
76
147
  onChange(formData, openFilterPopup);
@@ -83,6 +154,17 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
83
154
  setValue("company_id", company_id);
84
155
  }
85
156
  }, [company_id]);
157
+ (0, react_1.useMemo)(() => {
158
+ if (business_unit_id !== filterListData?.business_unit_id &&
159
+ !openFilterPopup) {
160
+ setValue("business_unit_location_id", null);
161
+ }
162
+ }, [business_unit_id]);
163
+ (0, react_1.useMemo)(() => {
164
+ if (department_id !== filterListData?.department_id && !openFilterPopup) {
165
+ setValue("sub_department_id", null);
166
+ }
167
+ }, [department_id]);
86
168
  const getFilterItem = (key) => {
87
169
  return filterListItems.find((item) => item.key === key);
88
170
  };
@@ -93,7 +175,8 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
93
175
  }, [formData, dirtyFields]);
94
176
  const renderChips = (data) => {
95
177
  return Object.entries(data).map(([key, value]) => {
96
- if (!value) {
178
+ const filterKey = key;
179
+ if (typeof value !== "boolean" && !value) {
97
180
  return;
98
181
  }
99
182
  const item = getFilterItem(key);
@@ -101,14 +184,14 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
101
184
  (0, getFormData_1.getFormValue)(dateKeys?.includes(item?.key)
102
185
  ? luxon_1.DateTime.fromISO(value).toFormat(FormFields_1.dateFormats.dateWithEuropean)
103
186
  : value, item);
104
- if (!keyValue) {
187
+ if (typeof value !== "boolean" && !keyValue) {
105
188
  return;
106
189
  }
107
190
  return ((0, jsx_runtime_1.jsx)(FilterPill_1.FilterPill, { ref: filterPopupAnchorElm, label: (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip
108
191
  // eslint-disable-next-line sonarjs/no-base-to-string
109
192
  , {
110
193
  // eslint-disable-next-line sonarjs/no-base-to-string
111
- toolTipLabel: `${keyValue}`, children: `${item?.label}: ${keyValue}` }), onDelete: () => handleDelete(key), onClick: (e) => {
194
+ toolTipLabel: `${keyValue}`, children: `${item?.label}: ${keyValue}` }), onDelete: () => handleDelete(filterKey), onClick: (e) => {
112
195
  setOpenFilterPopup(true);
113
196
  filterPopupAnchorElm.current = e.currentTarget;
114
197
  const item = getFilterItem(key);
@@ -134,8 +217,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
134
217
  if (!shouldFormSubmit) {
135
218
  handleSubmit((data) => {
136
219
  onSubmit(data);
137
- handleClose();
138
- })();
220
+ }, onError)();
139
221
  }
140
222
  }, onKeyDown: (e) => {
141
223
  if (e.key === "Enter") {
@@ -143,8 +225,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
143
225
  if (!shouldFormSubmit) {
144
226
  handleSubmit((data) => {
145
227
  onSubmit(data);
146
- handleClose();
147
- })();
228
+ }, onError)();
148
229
  }
149
230
  }
150
231
  }, children: (0, jsx_runtime_1.jsxs)(material_1.Drawer, { open: open, onClose: (_event, reason) => {
@@ -162,7 +243,11 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
162
243
  }, children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px 30px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", width: "100%", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", children: "Filter" }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: () => {
163
244
  reset();
164
245
  handleClose();
165
- }, children: (0, jsx_runtime_1.jsx)(icons_1.ClearIcon, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, sx: { overflowX: "hidden" }, children: filterListItems.map((filter) => filter.type === "switch" ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "80%", sx: { padding: "10px 5px 10px 20px ", margin: "auto" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), (0, jsx_runtime_1.jsx)(Switch_1.Switch, { control: control, name: filter.key })] }, filter.key)) : ((0, jsx_runtime_1.jsxs)(material_1.Accordion, { defaultExpanded: !!filterListData?.[filter.key], disabled: filter.isDisabled, sx: {
246
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.ClearIcon, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, { flexGrow: 1, sx: { overflowX: "hidden" }, children: filterListItems.map((filter) => filter.type === "switch" ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "80%", sx: { padding: "10px 5px 10px 20px ", margin: "auto" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), (0, jsx_runtime_1.jsx)(Switch_1.Switch, { control: control, name: filter.key })] }, filter.key)) : ((0, jsx_runtime_1.jsxs)(material_1.Accordion, { defaultExpanded: !!filterListData?.[filter.key], disabled: filter.isDisabled, expanded: expandedKeys.includes(filter.key), onChange: () => {
247
+ setExpandedKeys((prev) => prev.includes(filter.key)
248
+ ? prev.filter((k) => k !== filter.key)
249
+ : [...prev, filter.key]);
250
+ }, sx: {
166
251
  "&.MuiAccordion-root.Mui-expanded": {
167
252
  margin: "0 !important",
168
253
  },
@@ -179,7 +264,7 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
179
264
  "& .MuiAccordionSummary-content.Mui-expanded": {
180
265
  margin: "0px",
181
266
  },
182
- }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "90%", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.menuInfo })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { sx: {
267
+ }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", width: "90%", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "5px", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.label }), filter.required && ((0, jsx_runtime_1.jsx)(material_1.Typography, { color: "error", children: "*" }))] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filter.menuInfo })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { sx: {
183
268
  background: slate[600],
184
269
  borderRadius: "5px",
185
270
  padding: "0px",
@@ -189,26 +274,29 @@ const FilterListV2 = ({ filterListItems, isDisabled = false, filterListData, onA
189
274
  paddingRight: "15px",
190
275
  }, children: filter.type === "dateRange" ? ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "10px", onClick: (e) => {
191
276
  handleDateRange(filter);
192
- filterPopupAnchorElm.current = e.currentTarget;
277
+ dateRangeAnchorRef.current = e.currentTarget;
193
278
  }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
194
279
  border: "1px solid black",
195
280
  borderRadius: "5px",
196
281
  width: "150px",
197
282
  p: 1,
198
- }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: (Array.isArray(filterListData?.["dateRange"]) &&
199
- filterListData?.["dateRange"][0]) ||
200
- "Start Date" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: "~" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
283
+ }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: Array.isArray(watch(filter.key)) &&
284
+ watch(filter.key)[0]
285
+ ? luxon_1.DateTime.fromISO(watch(filter.key)[0]).toFormat(FormFields_1.dateFormats.dateWithEuropean)
286
+ : "Start Date" }) }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: "~" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
201
287
  border: "1px solid black",
202
288
  borderRadius: "5px",
203
289
  width: "150px",
204
290
  p: 1,
205
- }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: (Array.isArray(filterListData?.["dateRange"]) &&
206
- filterListData?.["dateRange"][1]) ||
207
- "End Date" }) })] })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, FilterPopupWrapper_1.GetFilterPopupComponent)(filter, control)[filter.type] })) }) })] }, filter.key))) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%", position: "absolute", bottom: "70px" } }), (0, jsx_runtime_1.jsx)(material_1.Stack, { height: "70px", children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", sx: { position: "absolute", bottom: "15px" }, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { type: "submit", disabled: shouldFormSubmit, variant: "contained", onClick: () => {
208
- handleSubmit(onSubmit)();
209
- handleClose();
210
- }, children: "Apply" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "button", onClick: () => handlerReset(), disabled: Object.keys(formData).every((key) => !formData[key]), variant: "outlined", children: "Reset" })] }) }) })] }) }), currentFilter && currentFilter.type !== "switch" && ((0, jsx_runtime_1.jsx)(FilterPopupWrapper_1.FilterPopupWrapper, { open: openFilterPopup, onClose: handleCloseFilterPopup, onApply: () => {
291
+ }, children: (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: Array.isArray(watch(filter.key)) &&
292
+ watch(filter.key)[1]
293
+ ? luxon_1.DateTime.fromISO(watch(filter.key)[1]).toFormat(FormFields_1.dateFormats.dateWithEuropean)
294
+ : "End Date" }) })] })) : ((0, jsx_runtime_1.jsx)(material_1.Box, { children: (0, GetFilterPopupComponent_1.getFilterPopupComponent)(filter, control, errors)[filter.type] })) }) })] }, filter.key))) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%", position: "absolute", bottom: "70px" } }), (0, jsx_runtime_1.jsx)(material_1.Stack, { height: "70px", children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", gap: "10px", sx: { position: "absolute", bottom: "15px" }, children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { type: "submit", disabled: shouldFormSubmit, variant: "contained", onClick: () => {
295
+ handleSubmit(onSubmit, onError)();
296
+ }, children: "Apply" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "button", onClick: () => handlerReset(), disabled: Object.keys(formData).every((key) => !formData[key]), variant: "outlined", children: "Reset" })] }) }) })] }) }), currentFilter && ((0, jsx_runtime_1.jsx)(FilterPopupWrapper_1.FilterPopupWrapper, { open: openFilterPopup, onClose: handleCloseFilterPopup, onApply: () => {
211
297
  handleSubmit(onSubmit)();
212
- }, control: control, anchorEl: filterPopupAnchorElm.current, filterItem: currentFilter, currentFilterValue: currentFilterValue }))] }));
298
+ }, control: control, errors: errors, reset: reset, anchorEl: filterPopupAnchorElm.current, filterItem: currentFilter, currentFilterValue: currentFilterValue })), currentFilter && ((0, jsx_runtime_1.jsx)(FilterPopupWrapper_1.FilterPopUpDateRangeWrapper, { open: datePickerPopup, onClose: handleCloseDatePickerPopup, onApply: () => {
299
+ handleDateRangeSubmit();
300
+ }, control: control, errors: errors, anchorEl: dateRangeAnchorRef.current, filterItem: currentFilter }))] }));
213
301
  };
214
302
  exports.FilterListV2 = FilterListV2;
@@ -1,15 +1,17 @@
1
- import { type PropsWithChildren } from "react";
2
1
  import type { PopoverProps } from "@mui/material";
2
+ import { type PropsWithChildren } from "react";
3
3
  import type { FilterListType } from "./FilterTypeWrapper";
4
4
  type FilterPopupProps = PropsWithChildren<PopoverProps> & {
5
5
  onApply?: () => void;
6
6
  showFooter?: boolean;
7
7
  showDivider?: boolean;
8
8
  title?: string;
9
+ required?: boolean;
9
10
  background?: boolean;
10
11
  filterItem?: FilterListType;
11
12
  currentFilterValue?: string | string[] | null;
13
+ reset?: () => void;
12
14
  };
13
- export declare const FilterPopup: ({ open, anchorEl, onClose, children, onApply, showDivider, showFooter, title, filterItem, background, currentFilterValue, }: FilterPopupProps) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const FilterPopup: ({ open, anchorEl, onClose, children, onApply, showDivider, showFooter, title, required, filterItem, reset, background, currentFilterValue, }: FilterPopupProps) => import("react/jsx-runtime").JSX.Element;
14
16
  export {};
15
17
  //# sourceMappingURL=FilterPopup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterPopup.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterPopup.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAclD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,KAAK,gBAAgB,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;CAC/C,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,6HAYzB,gBAAgB,4CA4GlB,CAAC"}
1
+ {"version":3,"file":"FilterPopup.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterPopup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAWlD,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,KAAK,gBAAgB,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG;IACxD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,8IAczB,gBAAgB,4CAyHlB,CAAC"}
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FilterPopup = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
8
  const Clear_1 = __importDefault(require("@mui/icons-material/Clear"));
10
9
  const material_1 = require("@mui/material");
10
+ const lodash_1 = require("lodash");
11
+ const react_1 = require("react");
11
12
  const Button_1 = require("../Button");
12
13
  const PadBox_1 = require("../PadBox");
13
- const lodash_1 = require("lodash");
14
- const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider = false, showFooter = true, title, filterItem, background = false, currentFilterValue, }) => {
14
+ const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider = false, showFooter = true, title, required, filterItem, reset, background = false, currentFilterValue, }) => {
15
15
  const theme = (0, material_1.useTheme)();
16
16
  const { slate } = theme.palette.app.color;
17
17
  const [initialValue, setInitialValue] = (0, react_1.useState)(null);
@@ -44,6 +44,9 @@ const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider =
44
44
  };
45
45
  const handleClose = () => {
46
46
  setInitialValue(null);
47
+ if ((0, lodash_1.isFunction)(reset)) {
48
+ reset();
49
+ }
47
50
  if ((0, lodash_1.isFunction)(onClose)) {
48
51
  onClose({}, "backdropClick");
49
52
  }
@@ -53,10 +56,10 @@ const FilterPopup = ({ open, anchorEl, onClose, children, onApply, showDivider =
53
56
  return;
54
57
  }
55
58
  handleClose();
56
- }, sx: { "& .MuiPaper-root": { minWidth: "300px" } }, children: [showDivider && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { alignItems: "flex-end", children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "8px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", width: "100%", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", children: title }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleClose, children: (0, jsx_runtime_1.jsx)(Clear_1.default, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
59
+ }, sx: { "& .MuiPaper-root": { minWidth: "300px" } }, children: [showDivider && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { alignItems: "flex-end", children: [(0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "8px" }, children: (0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", width: "100%", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", alignItems: "center", gap: "5px", children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", children: title }), required && ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "h6", color: "error", children: "*" }))] }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleClose, children: (0, jsx_runtime_1.jsx)(Clear_1.default, {}) })] }) }), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: { width: "100%" } })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
57
60
  background: background ? slate[600] : "transparent",
58
61
  borderRadius: "5px",
59
62
  maxWidth: "300px",
60
- }, children: children }), showFooter && ((0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, jsx_runtime_1.jsx)(material_1.Stack, { direction: "row", justifyContent: "flex-end", children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: handleApply, disabled: isDisabled, variant: "text", sx: { maxWidth: "40px" }, children: "Apply" }) }) }))] }));
63
+ }, children: children }), showFooter && ((0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, jsx_runtime_1.jsx)(material_1.Box, { display: "flex", justifyContent: "flex-end", children: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: handleApply, disabled: isDisabled, variant: "text", sx: { maxWidth: "40px" }, children: "Apply" }) }) }))] }));
61
64
  };
62
65
  exports.FilterPopup = FilterPopup;
@@ -1,12 +1,20 @@
1
+ import { type PopoverProps } from "@mui/material";
1
2
  import { type PropsWithChildren } from "react";
3
+ import type { Control, FieldErrors, FieldValues } from "react-hook-form";
2
4
  import type { FilterListType } from "./FilterTypeWrapper";
3
- import { type PopoverProps } from "@mui/material";
4
- import type { Control, FieldValues } from "react-hook-form";
5
5
  type FilterPopupWrapperProp = PropsWithChildren<PopoverProps> & {
6
6
  filterItem: FilterListType;
7
7
  control: Control<FieldValues>;
8
+ errors: FieldErrors<FieldValues>;
8
9
  currentFilterValue?: string | string[] | null;
9
10
  onApply: () => void;
11
+ reset?: () => void;
12
+ };
13
+ type FilterDateRangePickerWrapperProp = PropsWithChildren<PopoverProps> & {
14
+ filterItem: FilterListType;
15
+ control: Control<FieldValues>;
16
+ errors: FieldErrors<FieldValues>;
17
+ onApply: () => void;
10
18
  };
11
19
  export type FilterPopupComponentType = {
12
20
  autoComplete?: JSX.Element;
@@ -17,7 +25,7 @@ export type FilterPopupComponentType = {
17
25
  switch?: JSX.Element;
18
26
  radio?: JSX.Element;
19
27
  };
20
- export declare const GetFilterPopupComponent: (selectedFilter: FilterListType, control: Control<FieldValues>) => FilterPopupComponentType;
21
- export declare const FilterPopupWrapper: ({ open, anchorEl, filterItem, onClose, control, onApply, currentFilterValue, }: FilterPopupWrapperProp) => import("react/jsx-runtime").JSX.Element;
28
+ export declare const FilterPopupWrapper: ({ open, anchorEl, filterItem, onClose, control, errors, onApply, currentFilterValue, reset, }: FilterPopupWrapperProp) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const FilterPopUpDateRangeWrapper: ({ open, anchorEl, filterItem, onClose, control, errors, onApply, }: FilterDateRangePickerWrapperProp) => import("react/jsx-runtime").JSX.Element;
22
30
  export {};
23
31
  //# sourceMappingURL=FilterPopupWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FilterPopupWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterPopupWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAO1D,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG5D,KAAK,sBAAsB,GAAG,iBAAiB,CAAC,YAAY,CAAC,GAAG;IAC9D,UAAU,EAAE,cAAc,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC9C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,YAAY,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,gBAA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C;IAClB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,+FAUhC,sBAAsB,4CAmCxB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,oEAQzC,gCAAgC,4CAkBlC,CAAC"}
@@ -1,31 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FilterPopupWrapper = exports.GetFilterPopupComponent = void 0;
3
+ exports.FilterPopUpDateRangeWrapper = exports.FilterPopupWrapper = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const FilterPopup_1 = require("./FilterPopup");
6
- const FormFields_1 = require("../FormFields");
7
5
  const material_1 = require("@mui/material");
6
+ const FormFields_1 = require("../FormFields");
8
7
  const PadBox_1 = require("../PadBox");
9
- const GetFilterPopupComponent = (selectedFilter, control) => {
10
- const theme = (0, material_1.useTheme)();
11
- const { sapphireBlue, black } = theme.palette.app.color;
12
- return {
13
- autoComplete: selectedFilter.options && ((0, jsx_runtime_1.jsx)(FormFields_1.Autocomplete, { disableClearable: true, multiple: selectedFilter.multiSelect ?? false, placeholder: `Select ${selectedFilter.label}`, name: `${selectedFilter.key}`, disabled: selectedFilter.isDisabled, shouldCloseOnSelect: selectedFilter.multiSelect ?? false, control: control, options: selectedFilter.options ?? [], sx: {
14
- maxHeight: "250px",
15
- overflowY: "auto",
16
- width: "100%",
17
- "& .MuiAutocomplete-tag": {
18
- backgroundColor: sapphireBlue[300],
19
- color: black[900],
20
- },
21
- } })),
22
- text: ((0, jsx_runtime_1.jsx)(FormFields_1.TextField, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, placeholder: selectedFilter.label })),
23
- date: ((0, jsx_runtime_1.jsx)(FormFields_1.DatePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled })),
24
- dateRange: ((0, jsx_runtime_1.jsx)(FormFields_1.DateRangePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled })),
25
- };
26
- };
27
- exports.GetFilterPopupComponent = GetFilterPopupComponent;
28
- const FilterPopupWrapper = ({ open, anchorEl, filterItem, onClose, control, onApply, currentFilterValue, }) => {
29
- return ((0, jsx_runtime_1.jsx)(FilterPopup_1.FilterPopup, { title: filterItem.label, filterItem: filterItem, open: open, onClose: onClose, anchorEl: anchorEl, onApply: onApply, currentFilterValue: currentFilterValue, showFooter: true, showDivider: true, background: true, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, exports.GetFilterPopupComponent)(filterItem, control)[filterItem.type] }) }));
8
+ const DateRangePickerPopUp_1 = require("./DateRangePickerPopUp");
9
+ const FilterPopup_1 = require("./FilterPopup");
10
+ const GetFilterPopupComponent_1 = require("./GetFilterPopupComponent");
11
+ const FilterPopupWrapper = ({ open, anchorEl, filterItem, onClose, control, errors, onApply, currentFilterValue, reset, }) => {
12
+ return ((0, jsx_runtime_1.jsx)(FilterPopup_1.FilterPopup, { title: filterItem.label, required: filterItem.required, filterItem: filterItem, open: open, onClose: onClose, anchorEl: anchorEl, onApply: onApply, currentFilterValue: currentFilterValue, reset: reset, showFooter: true, showDivider: true, background: true, children: (0, jsx_runtime_1.jsxs)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: [(0, GetFilterPopupComponent_1.getFilterPopupComponent)(filterItem, control, errors)[filterItem.type], filterItem.type === "switch" && ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { padding: "10px 5px 10px 20px", margin: "auto" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", children: filterItem.label }), (0, jsx_runtime_1.jsx)(FormFields_1.Switch, { control: control, name: filterItem.key })] }, filterItem.key))] }) }));
30
13
  };
31
14
  exports.FilterPopupWrapper = FilterPopupWrapper;
15
+ const FilterPopUpDateRangeWrapper = ({ open, anchorEl, filterItem, onClose, control, errors, onApply, }) => {
16
+ return ((0, jsx_runtime_1.jsx)(DateRangePickerPopUp_1.DateRangePickerPopUp, { title: filterItem.label, required: filterItem.required, open: open, onClose: onClose, anchorEl: anchorEl, onApply: onApply, showFooter: true, showDivider: true, background: true, children: (0, jsx_runtime_1.jsx)(PadBox_1.PadBox, { padding: { padding: "10px" }, children: (0, GetFilterPopupComponent_1.getFilterPopupComponent)(filterItem, control, errors)[filterItem.type] }) }));
17
+ };
18
+ exports.FilterPopUpDateRangeWrapper = FilterPopUpDateRangeWrapper;
@@ -1,4 +1,5 @@
1
1
  import type { Control, FieldValues } from "react-hook-form";
2
+ import { FilterKeys } from "./FilterListV2";
2
3
  export type FilterComponentType = "autoComplete" | "text" | "date" | "dateRange" | "checkbox" | "radio" | "switch";
3
4
  type Options = readonly {
4
5
  label: string;
@@ -9,12 +10,13 @@ type Options = readonly {
9
10
  export type FilterListType = {
10
11
  label: string;
11
12
  isDisabled?: boolean;
12
- key: string;
13
+ key: FilterKeys;
13
14
  value: string;
14
15
  type: FilterComponentType;
15
16
  menuInfo?: string;
16
17
  options?: Options;
17
18
  multiSelect?: boolean;
19
+ required?: boolean;
18
20
  };
19
21
  type FilterTypeWrapperProps = {
20
22
  filter: FilterListType;
@@ -1 +1 @@
1
- {"version":3,"file":"FilterTypeWrapper.d.ts","sourceRoot":"","sources":["../../src/FilterList/FilterTypeWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,MAAM,GACN,MAAM,GACN,WAAW,GACX,UAAU,GACV,OAAO,GACP,QAAQ,CAAC;AAEb,KAAK,OAAO,GAAG,SAAS;IACtB,KAAK,EAAE,M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rB,GAAG,EAAE,UAAU,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAC/B,CAAC;AACF,eAAO,MAAM,iBAAiB,GAAI,sBAG/B,sBAAsB,4CAqBxB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Control, FieldErrors, FieldValues } from "react-hook-form";
2
+ import { FilterPopupComponentType } from "./FilterPopupWrapper";
3
+ import { FilterListType } from "./FilterTypeWrapper";
4
+ export declare const getFilterPopupComponent: (selectedFilter: FilterListType, control: Control<FieldValues>, errors: FieldErrors<FieldValues>) => FilterPopupComponentType;
5
+ //# sourceMappingURL=GetFilterPopupComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetFilterPopupComponent.d.ts","sourceRoot":"","sources":["../../src/FilterList/GetFilterPopupComponent.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,eAAO,MAAM,uBAAuB,GAClC,gBAAgB,cAAc,EAC9B,SAAS,OAAO,CAAC,WAAW,CAAC,EAC7B,QAAQ,WAAW,CAAC,WAAW,CAAC,KAC/B,wBA4DF,CAAC"}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFilterPopupComponent = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const FormFields_1 = require("../FormFields");
7
+ const getFilterPopupComponent = (selectedFilter, control, errors) => {
8
+ const theme = (0, material_1.useTheme)();
9
+ const { sapphireBlue, black } = theme.palette.app.color;
10
+ const errorSelectedKey = errors[selectedFilter.key];
11
+ return {
12
+ autoComplete: selectedFilter.options && ((0, jsx_runtime_1.jsx)(FormFields_1.Autocomplete, { disableClearable: true, multiple: selectedFilter.multiSelect ?? false, placeholder: `Select ${selectedFilter.label}`, name: `${selectedFilter.key}`, disabled: selectedFilter.isDisabled, shouldCloseOnSelect: selectedFilter.multiSelect ?? false, control: control, options: selectedFilter.options ?? [], sx: {
13
+ maxHeight: "250px",
14
+ overflowY: "auto",
15
+ width: "100%",
16
+ "& .MuiAutocomplete-tag": {
17
+ backgroundColor: sapphireBlue[300],
18
+ color: black[900],
19
+ },
20
+ }, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
21
+ text: ((0, jsx_runtime_1.jsx)(FormFields_1.TextField, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, placeholder: selectedFilter.label, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
22
+ date: ((0, jsx_runtime_1.jsx)(FormFields_1.DatePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
23
+ dateRange: ((0, jsx_runtime_1.jsx)(FormFields_1.DateRangePicker, { name: selectedFilter.key, control: control, disabled: selectedFilter.isDisabled, error: !!errorSelectedKey, helperText: errorSelectedKey?.message })),
24
+ };
25
+ };
26
+ exports.getFilterPopupComponent = getFilterPopupComponent;
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/FormFields/DateRangePicker/DateRangePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;A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EACP,YAAY,EACZ,QAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAa,EACb,UAAU,EACV,OAAe,EACf,QAAgB,EAChB,KAAK,GACN,EAAE,oBAAoB,CAAC,CAAC,CAAC,2CAkEzB"}
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DateRangePicker = DateRangePicker;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
+ const react_1 = require("react");
6
7
  const react_date_range_1 = require("react-date-range");
7
8
  const react_hook_form_1 = require("react-hook-form");
8
9
  const Skeleton_1 = require("./Skeleton");
9
- const react_1 = require("react");
10
10
  function DateRangePicker({ control, defaultValue, disabled = false, label, name, error = false, helperText, loading = false, required = false, rules, }) {
11
11
  const { field: { onChange }, } = (0, react_hook_form_1.useController)({ name, control, defaultValue, rules });
12
12
  const [range, setRange] = (0, react_1.useState)([
@@ -35,5 +35,5 @@ function DateRangePicker({ control, defaultValue, disabled = false, label, name,
35
35
  const endDate = new Date(selectedRange.endDate.toUTCString()).toISOString();
36
36
  onChange([startDate, endDate]);
37
37
  }
38
- }, months: 2, direction: "horizontal", calendarFocus: "backwards", staticRanges: [], inputRanges: [], moveRangeOnFirstSelection: false, preventSnapRefocus: true }), error && (0, jsx_runtime_1.jsx)("span", { style: { color: "red" }, children: helperText })] }));
38
+ }, months: 1, direction: "horizontal", calendarFocus: "backwards", staticRanges: [], inputRanges: [], moveRangeOnFirstSelection: false, preventSnapRefocus: true }), error && (0, jsx_runtime_1.jsx)(material_1.Typography, { color: "red", children: helperText })] }));
39
39
  }
@@ -15,7 +15,7 @@ function calculateWidth(childrenCount, fullWidth, maxColumn) {
15
15
  }
16
16
  exports.RowContainerStyled = (0, styles_1.styled)(material_1.Stack, {
17
17
  shouldForwardProp(prop) {
18
- return prop !== "fullWidth";
18
+ return prop !== "fullWidth" && prop !== "maxColumn";
19
19
  },
20
20
  })(({ children, fullWidth, maxColumn, }) => {
21
21
  const childrenCount = react_1.Children.toArray(children).length;
@@ -0,0 +1,3 @@
1
+ import type { SvgIconProps } from "@mui/material";
2
+ export declare const SvgExport: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=SvgExport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SvgExport.d.ts","sourceRoot":"","sources":["../../src/Svgs/SvgExport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,eAAO,MAAM,SAAS,GAAI,OAAO,YAAY,4CA8B5C,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SvgExport = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const SvgExport = (props) => {
6
+ return ((0, jsx_runtime_1.jsx)("svg", { width: "34", height: "34", viewBox: "0 0 34 34", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: (0, jsx_runtime_1.jsxs)("g", { id: "Communication / Share_iOS_Export", children: [(0, jsx_runtime_1.jsx)("rect", { x: "0.5", y: "0.5", width: "33", height: "33", rx: "3.5", stroke: "#BCBFC2" }), (0, jsx_runtime_1.jsx)("path", { id: "Vector", d: "M14 11L17 8M17 8L20 11M17 8V18M12.0002 15C11.0683 15 10.6024 15 10.2349 15.1522C9.74481 15.3552 9.35523 15.7448 9.15224 16.2349C9 16.6024 9 17.0681 9 18V22.8C9 23.9201 9 24.4798 9.21799 24.9076C9.40973 25.2839 9.71547 25.5905 10.0918 25.7822C10.5192 26 11.079 26 12.1969 26H21.8036C22.9215 26 23.4805 26 23.9079 25.7822C24.2842 25.5905 24.5905 25.2839 24.7822 24.9076C25 24.4802 25 23.921 25 22.8031V18C25 17.0681 24.9999 16.6024 24.8477 16.2349C24.6447 15.7448 24.2554 15.3552 23.7654 15.1522C23.3978 15 22.9319 15 22 15", stroke: "#4C5D70", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })] }) }));
7
+ };
8
+ exports.SvgExport = SvgExport;
@@ -0,0 +1,3 @@
1
+ import type { SvgIconProps } from "@mui/material";
2
+ export declare const SvgImport: (props: SvgIconProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=SvgImport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SvgImport.d.ts","sourceRoot":"","sources":["../../src/Svgs/SvgImport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,eAAO,MAAM,SAAS,GAAI,OAAO,YAAY,4CAwC5C,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SvgImport = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const SvgImport = (props) => {
6
+ return ((0, jsx_runtime_1.jsx)("svg", { width: "34", height: "34", viewBox: "0 0 34 34", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: (0, jsx_runtime_1.jsxs)("g", { id: "Communication / Share_iOS_Export", children: [(0, jsx_runtime_1.jsx)("rect", { x: "0.5", y: "0.5", width: "33", height: "33", rx: "3.5", stroke: "#BCBFC2" }), (0, jsx_runtime_1.jsxs)("g", { id: "Group 5", children: [(0, jsx_runtime_1.jsx)("path", { id: "Vector", d: "M12.0002 12.75C11.0683 12.75 10.6024 12.75 10.2349 12.9022C9.74481 13.1052 9.35523 13.4948 9.15224 13.9849C9 14.3524 9 14.8181 9 15.75V21.55C9 22.6701 9 23.2298 9.21799 23.6576C9.40973 24.0339 9.71547 24.3405 10.0918 24.5322C10.5192 24.75 11.079 24.75 12.1969 24.75H21.8036C22.9215 24.75 23.4805 24.75 23.9079 24.5322C24.2842 24.3405 24.5905 24.0339 24.7822 23.6576C25 23.2302 25 22.671 25 21.5531V15.75C25 14.8181 24.9999 14.3524 24.8477 13.9849C24.6447 13.4948 24.2554 13.1052 23.7654 12.9022C23.3978 12.75 22.9319 12.75 22 12.75", stroke: "#4C5D70", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }), (0, jsx_runtime_1.jsx)("path", { id: "Vector_2", d: "M20 16.25L17 19.25M17 19.25L14 16.25M17 19.25L17 9.25", stroke: "#4C5D70", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })] })] }) }));
7
+ };
8
+ exports.SvgImport = SvgImport;
@@ -0,0 +1,2 @@
1
+ export declare const SvgProfile: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=SvgProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SvgProfile.d.ts","sourceRoot":"","sources":["../../src/Svgs/SvgProfile.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,+CA6BtB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SvgProfile = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const SvgProfile = () => ((0, jsx_runtime_1.jsxs)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsxs)("g", { "clip-path": "url(#clip0_8728_7975)", children: [(0, jsx_runtime_1.jsx)("path", { d: "M10.7224 0.0587158C11.281 0.136841 11.7302 0.277466 12.2536 0.543091C13.9919 1.41809 15.0114 3.37122 14.8122 5.4259C14.6911 6.64856 14.2888 7.6134 13.5153 8.53528C13.0778 9.05871 12.4021 9.55871 11.7731 9.82043C9.6794 10.6954 7.38643 9.96106 6.06612 7.9884C5.02315 6.43372 4.87471 4.29309 5.69112 2.64075C6.61299 0.77356 8.58565 -0.238159 10.7224 0.0587158ZM9.10909 1.58606C8.22237 1.80872 7.42159 2.44934 7.01534 3.26965C6.73018 3.84778 6.63252 4.28918 6.63643 4.98059C6.64424 6.05871 7.03096 7.03137 7.73409 7.7384C8.06221 8.07043 8.26534 8.21887 8.65596 8.41418C9.4958 8.82825 10.5036 8.82825 11.3435 8.41418C11.7341 8.21887 11.9372 8.07043 12.2653 7.7384C13.7419 6.25012 13.738 3.59778 12.2575 2.28528C11.4333 1.55872 10.2614 1.297 9.10909 1.58606Z", fill: "#93AABE" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.7811 11.293C13.7655 11.418 16.121 12.3438 17.5272 13.9453C18.6093 15.1758 19.1913 16.7305 19.2929 18.6562C19.3397 19.5352 19.2694 19.75 18.8866 19.9258C18.7343 19.9961 18.4061 20 9.9999 20C1.59365 20 1.26553 19.9961 1.11318 19.9258C0.73037 19.75 0.660057 19.5352 0.706932 18.6562C0.933495 14.3594 3.61318 11.8086 8.37881 11.3516C9.16787 11.2773 9.95693 11.2578 10.7811 11.293ZM8.7499 12.7734C5.96474 13.0234 4.16787 13.8945 3.11709 15.5039C2.64053 16.2344 2.28506 17.3008 2.20303 18.2305L2.17568 18.5547H9.9999H17.8241L17.7968 18.2344C17.7811 18.0547 17.7265 17.7148 17.6757 17.4805C17.2851 15.668 16.2929 14.3867 14.6718 13.6094C13.7694 13.1758 12.7851 12.9258 11.4452 12.793C10.8358 12.7305 9.34756 12.7227 8.7499 12.7734Z", fill: "#93AABE" })] }), (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: "clip0_8728_7975", children: (0, jsx_runtime_1.jsx)("rect", { width: "20", height: "20", fill: "white", transform: "matrix(-1 0 0 1 20 0)" }) }) })] }));
6
+ exports.SvgProfile = SvgProfile;