@codezee/sixtify-brahma 0.2.6 → 0.2.7

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 (279) hide show
  1. package/package.json +7 -2
  2. package/.github/workflows/deploy-storybook.yml +0 -40
  3. package/.husky/commit-msg +0 -4
  4. package/.husky/pre-commit +0 -4
  5. package/.husky/pre-push +0 -4
  6. package/.lintstagedrc +0 -5
  7. package/.prettierignore +0 -11
  8. package/.prettierrc +0 -22
  9. package/.vscode/extensions.json +0 -22
  10. package/.vscode/settings.json +0 -17
  11. package/apps/docs/.eslintrc.cjs +0 -4
  12. package/apps/docs/.eslintrc.js +0 -9
  13. package/apps/docs/.storybook/main.ts +0 -23
  14. package/apps/docs/.storybook/preview.tsx +0 -27
  15. package/apps/docs/next-env.d.ts +0 -5
  16. package/apps/docs/next.config.mjs +0 -4
  17. package/apps/docs/package.json +0 -38
  18. package/apps/docs/public/globals.css +0 -25
  19. package/apps/docs/stories/AgGrid/AgGrid.stories.tsx +0 -69
  20. package/apps/docs/stories/AppBar/AppBar.stories.tsx +0 -39
  21. package/apps/docs/stories/Breadcrumbs/Breadcrumbs.stories.tsx +0 -37
  22. package/apps/docs/stories/Button/ButtonGroup.stories.tsx +0 -99
  23. package/apps/docs/stories/Button/button.stories.tsx +0 -99
  24. package/apps/docs/stories/Card/AttendanceCard.stories.tsx +0 -37
  25. package/apps/docs/stories/Card/Card.stories.tsx +0 -39
  26. package/apps/docs/stories/Charts/PieChart.stories.tsx +0 -264
  27. package/apps/docs/stories/Chips/Chip.stories.tsx +0 -141
  28. package/apps/docs/stories/Chips/ChipWithBorder.stories.tsx +0 -18
  29. package/apps/docs/stories/Chips/FilterPill.stories.tsx +0 -24
  30. package/apps/docs/stories/Color/Color.stories.tsx +0 -14
  31. package/apps/docs/stories/Dialog/ButtomDialog.stories.tsx +0 -47
  32. package/apps/docs/stories/Dialog/DeleteDialog.stories.tsx +0 -31
  33. package/apps/docs/stories/Dialog/Dialog.stories.tsx +0 -47
  34. package/apps/docs/stories/Drawer/Drawer.stories.tsx +0 -94
  35. package/apps/docs/stories/FilterList/FilterList.stories.tsx +0 -88
  36. package/apps/docs/stories/FilterList/FilterListV2.stories.tsx +0 -92
  37. package/apps/docs/stories/FormFields/AutoComplete.stories.tsx +0 -87
  38. package/apps/docs/stories/FormFields/CheckBox.stories.tsx +0 -61
  39. package/apps/docs/stories/FormFields/DatePicker.stories.tsx +0 -98
  40. package/apps/docs/stories/FormFields/DateRangePicker.stories.tsx +0 -37
  41. package/apps/docs/stories/FormFields/FileUpload.stories.tsx +0 -83
  42. package/apps/docs/stories/FormFields/ImageUpload.stories.tsx +0 -69
  43. package/apps/docs/stories/FormFields/ListItemButton.stories.tsx +0 -59
  44. package/apps/docs/stories/FormFields/RadioGroupField.stories.tsx +0 -170
  45. package/apps/docs/stories/FormFields/SearchField.stories.tsx +0 -72
  46. package/apps/docs/stories/FormFields/TextField.stories.tsx +0 -111
  47. package/apps/docs/stories/FormFields/TimeField.stories.tsx +0 -82
  48. package/apps/docs/stories/FormFields/TimePicker.stories.tsx +0 -82
  49. package/apps/docs/stories/Indicator/Indicator.stories.tsx +0 -33
  50. package/apps/docs/stories/Indicator/SeverityIndicator.stories.tsx +0 -27
  51. package/apps/docs/stories/Layouts/FormRow.stories.tsx +0 -45
  52. package/apps/docs/stories/PadBox/PadBox.stories.tsx +0 -49
  53. package/apps/docs/stories/Stepper/Stepper.stories.tsx +0 -75
  54. package/apps/docs/stories/Stepper/StepperV2.stories.tsx +0 -44
  55. package/apps/docs/stories/Timeline/AttendanceStatus.stories.tsx +0 -29
  56. package/apps/docs/stories/Timeline/Timeline.stories.tsx +0 -38
  57. package/apps/docs/stories/Tooltip/Tooltip.stories.tsx +0 -30
  58. package/apps/docs/stories/UserProfileMenu/UserProfileMenu.stories.tsx +0 -112
  59. package/apps/docs/tsconfig.json +0 -19
  60. package/commitlint.config.cjs +0 -6
  61. package/index.ts +0 -1
  62. package/packages/eslint-config/README.md +0 -3
  63. package/packages/eslint-config/library.js +0 -88
  64. package/packages/eslint-config/next.js +0 -85
  65. package/packages/eslint-config/package.json +0 -19
  66. package/packages/eslint-config/react-internal.js +0 -89
  67. package/packages/shared-components/.eslintrc.js +0 -10
  68. package/packages/shared-components/package.json +0 -22
  69. package/packages/shared-components/src/Actions/AddAction.tsx +0 -13
  70. package/packages/shared-components/src/Actions/CalendarAction.tsx +0 -13
  71. package/packages/shared-components/src/Actions/ConfigureAction.tsx +0 -13
  72. package/packages/shared-components/src/Actions/DeleteAction.tsx +0 -13
  73. package/packages/shared-components/src/Actions/DownloadAction.tsx +0 -13
  74. package/packages/shared-components/src/Actions/EditAction.tsx +0 -13
  75. package/packages/shared-components/src/Actions/HistoryAction.tsx +0 -13
  76. package/packages/shared-components/src/Actions/index.ts +0 -7
  77. package/packages/shared-components/src/AgGrid/ActionCell/ActionCell.tsx +0 -57
  78. package/packages/shared-components/src/AgGrid/ActionCell/Popover.tsx +0 -32
  79. package/packages/shared-components/src/AgGrid/AgGrid.tsx +0 -93
  80. package/packages/shared-components/src/AgGrid/LoadingCell.tsx +0 -5
  81. package/packages/shared-components/src/AgGrid/index.ts +0 -3
  82. package/packages/shared-components/src/AppBar/AppBar.styled.tsx +0 -25
  83. package/packages/shared-components/src/AppBar/AppBar.tsx +0 -20
  84. package/packages/shared-components/src/AppBar/index.ts +0 -1
  85. package/packages/shared-components/src/Breadcrumbs/Breadcrumbs.tsx +0 -76
  86. package/packages/shared-components/src/Breadcrumbs/index.ts +0 -1
  87. package/packages/shared-components/src/Button/ActionButton.tsx +0 -38
  88. package/packages/shared-components/src/Button/Button.tsx +0 -19
  89. package/packages/shared-components/src/Button/ButtonGroup.tsx +0 -37
  90. package/packages/shared-components/src/Button/index.ts +0 -3
  91. package/packages/shared-components/src/Card/AttendanceCard.tsx +0 -51
  92. package/packages/shared-components/src/Card/Card.tsx +0 -34
  93. package/packages/shared-components/src/Card/CardItem/CardItem.tsx +0 -33
  94. package/packages/shared-components/src/Card/CardItem/CardItemValue.tsx +0 -98
  95. package/packages/shared-components/src/Card/CardItem/index.ts +0 -2
  96. package/packages/shared-components/src/Card/ProfileCard/ProfileCard.tsx +0 -40
  97. package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardBody.tsx +0 -53
  98. package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardHeader.tsx +0 -96
  99. package/packages/shared-components/src/Card/index.ts +0 -6
  100. package/packages/shared-components/src/Charts/PieChart.tsx +0 -81
  101. package/packages/shared-components/src/Charts/Skeleton.tsx +0 -36
  102. package/packages/shared-components/src/Charts/index.ts +0 -1
  103. package/packages/shared-components/src/Chips/Chip.tsx +0 -26
  104. package/packages/shared-components/src/Chips/ChipWithBorder.tsx +0 -39
  105. package/packages/shared-components/src/Chips/FilterPill.tsx +0 -47
  106. package/packages/shared-components/src/Chips/index.ts +0 -3
  107. package/packages/shared-components/src/Dialog/BottomDialog.styled.tsx +0 -28
  108. package/packages/shared-components/src/Dialog/BottomDialog.tsx +0 -37
  109. package/packages/shared-components/src/Dialog/DeleteDialog.tsx +0 -48
  110. package/packages/shared-components/src/Dialog/Dialog.tsx +0 -61
  111. package/packages/shared-components/src/Dialog/index.ts +0 -3
  112. package/packages/shared-components/src/Drawer/Bullet.tsx +0 -12
  113. package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItem.tsx +0 -57
  114. package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItemList.tsx +0 -109
  115. package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.tsx +0 -124
  116. package/packages/shared-components/src/Drawer/CloseDrawer/MenuItem.tsx +0 -0
  117. package/packages/shared-components/src/Drawer/CloseDrawer/Popover.tsx +0 -45
  118. package/packages/shared-components/src/Drawer/CloseDrawer/Popper.tsx +0 -43
  119. package/packages/shared-components/src/Drawer/Drawer.styled.tsx +0 -51
  120. package/packages/shared-components/src/Drawer/Drawer.tsx +0 -55
  121. package/packages/shared-components/src/Drawer/MenuItem.tsx +0 -75
  122. package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerCollapse.tsx +0 -13
  123. package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItem.tsx +0 -46
  124. package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItemList.tsx +0 -197
  125. package/packages/shared-components/src/Drawer/index.ts +0 -1
  126. package/packages/shared-components/src/FilterList/FilterList.tsx +0 -172
  127. package/packages/shared-components/src/FilterList/FilterListV2.tsx +0 -515
  128. package/packages/shared-components/src/FilterList/FilterPopup.tsx +0 -148
  129. package/packages/shared-components/src/FilterList/FilterPopupWrapper.tsx +0 -113
  130. package/packages/shared-components/src/FilterList/FilterTypeWrapper.tsx +0 -58
  131. package/packages/shared-components/src/FilterList/getFormData.ts +0 -29
  132. package/packages/shared-components/src/FilterList/index.ts +0 -5
  133. package/packages/shared-components/src/FormFields/Autocomplete/Autocomplete.tsx +0 -510
  134. package/packages/shared-components/src/FormFields/Autocomplete/Skeleton.tsx +0 -26
  135. package/packages/shared-components/src/FormFields/Autocomplete/index.ts +0 -1
  136. package/packages/shared-components/src/FormFields/CheckBox/CheckBox.styled.tsx +0 -67
  137. package/packages/shared-components/src/FormFields/CheckBox/CheckBox.tsx +0 -44
  138. package/packages/shared-components/src/FormFields/CheckBox/Skeleton.tsx +0 -12
  139. package/packages/shared-components/src/FormFields/CheckBox/index.ts +0 -1
  140. package/packages/shared-components/src/FormFields/DatePicker/DatePicker.tsx +0 -217
  141. package/packages/shared-components/src/FormFields/DatePicker/Skeleton.tsx +0 -28
  142. package/packages/shared-components/src/FormFields/DatePicker/index.ts +0 -1
  143. package/packages/shared-components/src/FormFields/DateRangePicker/DateRangePicker.tsx +0 -96
  144. package/packages/shared-components/src/FormFields/DateRangePicker/Skeleton.tsx +0 -38
  145. package/packages/shared-components/src/FormFields/DateRangePicker/index.ts +0 -1
  146. package/packages/shared-components/src/FormFields/DateTimePicker/DateTimePicker.tsx +0 -250
  147. package/packages/shared-components/src/FormFields/DateTimePicker/Skeleton.tsx +0 -24
  148. package/packages/shared-components/src/FormFields/DateTimePicker/index.ts +0 -1
  149. package/packages/shared-components/src/FormFields/FileUpload/FileNames.tsx +0 -32
  150. package/packages/shared-components/src/FormFields/FileUpload/FileUpload.styled.tsx +0 -22
  151. package/packages/shared-components/src/FormFields/FileUpload/FileUpload.tsx +0 -157
  152. package/packages/shared-components/src/FormFields/FileUpload/Skeleton.tsx +0 -21
  153. package/packages/shared-components/src/FormFields/FileUpload/UploadedFileName.tsx +0 -27
  154. package/packages/shared-components/src/FormFields/FileUpload/index.ts +0 -2
  155. package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.styled.tsx +0 -16
  156. package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.tsx +0 -181
  157. package/packages/shared-components/src/FormFields/ImageUpload/ImageUploadView.tsx +0 -65
  158. package/packages/shared-components/src/FormFields/ImageUpload/PhotoCaptureDialog.tsx +0 -74
  159. package/packages/shared-components/src/FormFields/ImageUpload/Skeleton.tsx +0 -31
  160. package/packages/shared-components/src/FormFields/ImageUpload/index.ts +0 -2
  161. package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.styled.tsx +0 -22
  162. package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.tsx +0 -52
  163. package/packages/shared-components/src/FormFields/ListItemButton/index.ts +0 -1
  164. package/packages/shared-components/src/FormFields/PasswordField/PasswordField.tsx +0 -50
  165. package/packages/shared-components/src/FormFields/PasswordField/index.ts +0 -1
  166. package/packages/shared-components/src/FormFields/RadioGroupField/RadioGroupField.tsx +0 -105
  167. package/packages/shared-components/src/FormFields/RadioGroupField/Skeleton.tsx +0 -26
  168. package/packages/shared-components/src/FormFields/RadioGroupField/index.ts +0 -1
  169. package/packages/shared-components/src/FormFields/SearchField/SearchField.tsx +0 -21
  170. package/packages/shared-components/src/FormFields/SearchField/index.ts +0 -1
  171. package/packages/shared-components/src/FormFields/Switch/Skeleton.tsx +0 -12
  172. package/packages/shared-components/src/FormFields/Switch/Switch.tsx +0 -33
  173. package/packages/shared-components/src/FormFields/Switch/index.ts +0 -1
  174. package/packages/shared-components/src/FormFields/TextField/Skeleton.tsx +0 -31
  175. package/packages/shared-components/src/FormFields/TextField/TextField.tsx +0 -92
  176. package/packages/shared-components/src/FormFields/TextField/index.ts +0 -1
  177. package/packages/shared-components/src/FormFields/TimeField/Skeleton.tsx +0 -24
  178. package/packages/shared-components/src/FormFields/TimeField/TimeField.tsx +0 -120
  179. package/packages/shared-components/src/FormFields/TimeField/index.ts +0 -1
  180. package/packages/shared-components/src/FormFields/TimePicker/Skeleton.tsx +0 -24
  181. package/packages/shared-components/src/FormFields/TimePicker/TimePicker.tsx +0 -168
  182. package/packages/shared-components/src/FormFields/TimePicker/index.ts +0 -1
  183. package/packages/shared-components/src/FormFields/index.ts +0 -13
  184. package/packages/shared-components/src/Indicator/Indicator.tsx +0 -18
  185. package/packages/shared-components/src/Indicator/SeverityIndicator.tsx +0 -34
  186. package/packages/shared-components/src/Indicator/index.ts +0 -2
  187. package/packages/shared-components/src/Layouts/FormContainer.tsx +0 -6
  188. package/packages/shared-components/src/Layouts/FormGridLayout.tsx +0 -27
  189. package/packages/shared-components/src/Layouts/FormRow/FormRow.styled.tsx +0 -39
  190. package/packages/shared-components/src/Layouts/FormRow/FormRow.tsx +0 -20
  191. package/packages/shared-components/src/Layouts/FormRow/index.ts +0 -1
  192. package/packages/shared-components/src/Layouts/FormSection.tsx +0 -22
  193. package/packages/shared-components/src/Layouts/index.ts +0 -4
  194. package/packages/shared-components/src/Loader/FacebookCircularProgress.tsx +0 -41
  195. package/packages/shared-components/src/Loader/index.ts +0 -1
  196. package/packages/shared-components/src/PadBox/PadBox.tsx +0 -21
  197. package/packages/shared-components/src/PadBox/index.ts +0 -1
  198. package/packages/shared-components/src/Pagination/Pagination.tsx +0 -42
  199. package/packages/shared-components/src/Pagination/index.ts +0 -1
  200. package/packages/shared-components/src/Stepper/Stepper.tsx +0 -54
  201. package/packages/shared-components/src/Stepper/StepperV2.tsx +0 -115
  202. package/packages/shared-components/src/Stepper/StepperV3.tsx +0 -72
  203. package/packages/shared-components/src/Stepper/index.ts +0 -3
  204. package/packages/shared-components/src/Svgs/AppLogo/AppLogoMedium.tsx +0 -65
  205. package/packages/shared-components/src/Svgs/AppLogo/AppLogoSmall.tsx +0 -48
  206. package/packages/shared-components/src/Svgs/ArrowUp.tsx +0 -11
  207. package/packages/shared-components/src/Svgs/Company/CompanyBanner.tsx +0 -480
  208. package/packages/shared-components/src/Svgs/Company/index.ts +0 -1
  209. package/packages/shared-components/src/Svgs/Drawer/SettingIcon.tsx +0 -31
  210. package/packages/shared-components/src/Svgs/Drawer/SvgBankConfig.tsx +0 -36
  211. package/packages/shared-components/src/Svgs/Drawer/SvgConfiguration.tsx +0 -16
  212. package/packages/shared-components/src/Svgs/Drawer/SvgPayroll.tsx +0 -32
  213. package/packages/shared-components/src/Svgs/Drawer/SvgsEmployees.tsx +0 -25
  214. package/packages/shared-components/src/Svgs/Drawer/SvgsOrganization.tsx +0 -36
  215. package/packages/shared-components/src/Svgs/Drawer/SvgsTransaction.tsx +0 -81
  216. package/packages/shared-components/src/Svgs/Drawer/index.ts +0 -7
  217. package/packages/shared-components/src/Svgs/FormAction.tsx +0 -118
  218. package/packages/shared-components/src/Svgs/ImportExcelSuccessIcon.tsx +0 -54
  219. package/packages/shared-components/src/Svgs/LogoIcon.tsx +0 -74
  220. package/packages/shared-components/src/Svgs/SvgAdd.tsx +0 -28
  221. package/packages/shared-components/src/Svgs/SvgCalendar.tsx +0 -89
  222. package/packages/shared-components/src/Svgs/SvgConfigure.tsx +0 -51
  223. package/packages/shared-components/src/Svgs/SvgDelete.tsx +0 -55
  224. package/packages/shared-components/src/Svgs/SvgDownload.tsx +0 -20
  225. package/packages/shared-components/src/Svgs/SvgEmail.tsx +0 -24
  226. package/packages/shared-components/src/Svgs/SvgFilterList.tsx +0 -19
  227. package/packages/shared-components/src/Svgs/SvgNoLogo.tsx +0 -66
  228. package/packages/shared-components/src/Svgs/SvgNoSign.tsx +0 -28
  229. package/packages/shared-components/src/Svgs/SvgPhone.tsx +0 -16
  230. package/packages/shared-components/src/Svgs/SvgsDrop.tsx +0 -44
  231. package/packages/shared-components/src/Svgs/SvgsEdit.tsx +0 -42
  232. package/packages/shared-components/src/Svgs/SvgsHistory.tsx +0 -40
  233. package/packages/shared-components/src/Svgs/SvgsHome.tsx +0 -18
  234. package/packages/shared-components/src/Svgs/SvgsIndicator.tsx +0 -24
  235. package/packages/shared-components/src/Svgs/index.ts +0 -14
  236. package/packages/shared-components/src/Tab/Skeleton.tsx +0 -15
  237. package/packages/shared-components/src/Tab/Tabs.tsx +0 -64
  238. package/packages/shared-components/src/Tab/index.ts +0 -1
  239. package/packages/shared-components/src/Timeline/AttendanceStatus.tsx +0 -56
  240. package/packages/shared-components/src/Timeline/Timeline.tsx +0 -171
  241. package/packages/shared-components/src/Timeline/TimelineTrackSegments.tsx +0 -130
  242. package/packages/shared-components/src/Timeline/index.ts +0 -2
  243. package/packages/shared-components/src/Toast/Toast.tsx +0 -59
  244. package/packages/shared-components/src/Toast/ToastBody.tsx +0 -26
  245. package/packages/shared-components/src/Toast/ToastFooterLink.tsx +0 -19
  246. package/packages/shared-components/src/Toast/Toaster.styled.tsx +0 -76
  247. package/packages/shared-components/src/Toast/Toaster.tsx +0 -21
  248. package/packages/shared-components/src/Toast/index.ts +0 -3
  249. package/packages/shared-components/src/Toast/toasts.tsx +0 -28
  250. package/packages/shared-components/src/Toast/types.ts +0 -13
  251. package/packages/shared-components/src/Tooltip/Tooltip.tsx +0 -36
  252. package/packages/shared-components/src/Tooltip/index.ts +0 -1
  253. package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.styled.tsx +0 -33
  254. package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.tsx +0 -168
  255. package/packages/shared-components/src/UserProfileMenu/index.ts +0 -1
  256. package/packages/shared-components/src/index.ts +0 -25
  257. package/packages/shared-components/src/utils/colorVariant.ts +0 -162
  258. package/packages/shared-components/src/utils/date.ts +0 -25
  259. package/packages/shared-components/src/utils/file.ts +0 -20
  260. package/packages/shared-components/src/utils/fileSizeValidate.ts +0 -5
  261. package/packages/shared-components/src/utils/index.ts +0 -9
  262. package/packages/shared-components/src/utils/theme/colorPalette.ts +0 -112
  263. package/packages/shared-components/src/utils/theme/colorPaletteUI.tsx +0 -44
  264. package/packages/shared-components/src/utils/theme/paletteDark.ts +0 -10
  265. package/packages/shared-components/src/utils/theme/paletteLight.ts +0 -31
  266. package/packages/shared-components/src/utils/theme/theme.ts +0 -297
  267. package/packages/shared-components/src/utils/theme/types.ts +0 -18
  268. package/packages/shared-components/src/utils/theme/typography.ts +0 -52
  269. package/packages/shared-components/src/utils/urlToNestedObject.ts +0 -9
  270. package/packages/shared-components/tsconfig.json +0 -8
  271. package/packages/shared-components/tsconfig.lint.json +0 -8
  272. package/packages/shared-components/turbo/generators/config.ts +0 -33
  273. package/packages/shared-components/turbo/generators/templates/component.hbs +0 -8
  274. package/packages/typescript-config/base.json +0 -20
  275. package/packages/typescript-config/nextjs.json +0 -13
  276. package/packages/typescript-config/package.json +0 -9
  277. package/packages/typescript-config/react-library.json +0 -8
  278. package/pnpm-workspace.yaml +0 -3
  279. package/turbo.json +0 -44
@@ -1,515 +0,0 @@
1
- import { ExpandMore } from "@mui/icons-material";
2
- import {
3
- Accordion,
4
- AccordionDetails,
5
- AccordionSummary,
6
- Box,
7
- Divider,
8
- Drawer,
9
- IconButton,
10
- Stack,
11
- Typography,
12
- useTheme,
13
- } from "@mui/material";
14
- import { ClearIcon } from "@mui/x-date-pickers/icons";
15
- import { isEmpty } from "lodash";
16
- import { DateTime } from "luxon";
17
- import React, { useEffect, useMemo, useRef, useState } from "react";
18
- import type { FieldValues } from "react-hook-form";
19
- import { useForm, useWatch } from "react-hook-form";
20
- import { Button } from "../Button";
21
- import { FilterPill } from "../Chips/FilterPill";
22
- import { dateFormats } from "../FormFields";
23
- import { Switch } from "../FormFields/Switch";
24
- import { PadBox } from "../PadBox";
25
- import { SvgFilterList } from "../Svgs/SvgFilterList";
26
- import { Tooltip } from "../Tooltip";
27
- import {
28
- FilterPopupWrapper,
29
- GetFilterPopupComponent,
30
- } from "./FilterPopupWrapper";
31
- import type { FilterListType } from "./FilterTypeWrapper";
32
- import { getFormValue } from "./getFormData";
33
-
34
- export type FilterListV2Props = {
35
- filterListItems: FilterListType[];
36
- isDisabled?: boolean;
37
- filterListData?: FieldValues;
38
- onApply: (data: FieldValues, isPopup?: boolean, key?: string) => void;
39
- onChange: (data: FieldValues, isPopup: boolean) => void;
40
- onClear: () => void;
41
- resetFormBasedOnFields?: string;
42
- dateKeys?: string[];
43
- };
44
- export const FilterListV2 = ({
45
- filterListItems,
46
- isDisabled = false,
47
- filterListData,
48
- onApply,
49
- onClear,
50
- onChange,
51
- dateKeys,
52
- }: FilterListV2Props) => {
53
- const theme = useTheme();
54
-
55
- const { iron, slate } = theme.palette.app.color;
56
-
57
- const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null);
58
-
59
- const filterPopupAnchorElm = useRef<HTMLDivElement | null>(null);
60
-
61
- const [openFilterPopup, setOpenFilterPopup] = useState(false);
62
-
63
- const [currentFilter, setCurrentFilter] = useState<null | FilterListType>(
64
- null
65
- );
66
-
67
- const handleDateRange = (filter: FilterListType) => {
68
- setCurrentFilter(filter);
69
- setOpenFilterPopup(true);
70
- };
71
-
72
- const defaultValues: FieldValues = useMemo(() => {
73
- return filterListItems.reduce<FieldValues>((acc, item) => {
74
- acc[item.key] = item.value ?? null;
75
-
76
- return acc;
77
- }, {});
78
- }, [filterListData]);
79
-
80
- const {
81
- control,
82
- handleSubmit,
83
- setValue,
84
- reset,
85
- formState: { dirtyFields },
86
- watch,
87
- } = useForm({
88
- values: defaultValues,
89
- });
90
-
91
- const company_id = watch("company_id");
92
-
93
- const handleClose = () => {
94
- setAnchorEl(null);
95
- };
96
-
97
- const handleCloseFilterPopup = () => {
98
- if (currentFilter?.key) {
99
- setValue(`${currentFilter?.key}`, filterListData?.[currentFilter.key]);
100
- }
101
- setOpenFilterPopup(false);
102
- };
103
-
104
- const handlerReset = () => {
105
- reset();
106
- onClear();
107
- handleClose();
108
- };
109
-
110
- const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
111
- setAnchorEl(event.currentTarget);
112
- };
113
-
114
- const onSubmit = (data: FieldValues) => {
115
- setOpenFilterPopup(false);
116
- setCurrentFilter(null);
117
-
118
- const filteredData = Object.fromEntries(
119
- Object.entries(data).filter(
120
- ([, value]) => value && !(Array.isArray(value) && value.length === 0)
121
- )
122
- );
123
-
124
- onApply(filteredData, openFilterPopup, currentFilter?.key);
125
- };
126
-
127
- const handleDelete = (key: string) => {
128
- setValue(`${key}`, null);
129
-
130
- const newData = { ...filterListData };
131
-
132
- delete newData[key];
133
-
134
- onApply(newData, true, key);
135
- };
136
-
137
- const formData = useWatch({ control });
138
-
139
- const currentFilterValue = currentFilter?.key
140
- ? watch(currentFilter.key)
141
- : null;
142
-
143
- useEffect(() => {
144
- onChange(formData, openFilterPopup);
145
- }, [formData, onChange]);
146
-
147
- useMemo(() => {
148
- if (company_id !== filterListData?.company_id && !openFilterPopup) {
149
- filterListItems.forEach((item) => {
150
- setValue(`${item.key}`, null);
151
- });
152
- setValue("company_id", company_id);
153
- }
154
- }, [company_id]);
155
-
156
- const getFilterItem = (key: string) => {
157
- return filterListItems.find((item) => item.key === key);
158
- };
159
-
160
- const open = Boolean(anchorEl);
161
-
162
- const shouldFormSubmit = useMemo(() => {
163
- return (
164
- isEmpty(dirtyFields) ||
165
- Object.keys(formData).every((key) => !formData[key])
166
- );
167
- }, [formData, dirtyFields]);
168
-
169
- const renderChips = (data: FieldValues) => {
170
- return Object.entries(data).map(([key, value]) => {
171
- if (!value) {
172
- return;
173
- }
174
-
175
- const item = getFilterItem(key);
176
-
177
- const keyValue =
178
- item &&
179
- getFormValue(
180
- dateKeys?.includes(item?.key)
181
- ? DateTime.fromISO(value).toFormat(dateFormats.dateWithEuropean)
182
- : value,
183
- item
184
- );
185
-
186
- if (!keyValue) {
187
- return;
188
- }
189
-
190
- return (
191
- <FilterPill
192
- ref={filterPopupAnchorElm}
193
- key={key}
194
- label={
195
- <Tooltip
196
- // eslint-disable-next-line sonarjs/no-base-to-string
197
- toolTipLabel={`${keyValue}`}
198
- // eslint-disable-next-line sonarjs/no-base-to-string
199
- >{`${item?.label}: ${keyValue}`}</Tooltip>
200
- }
201
- onDelete={() => handleDelete(key)}
202
- onClick={(e: { currentTarget: HTMLDivElement | null }) => {
203
- setOpenFilterPopup(true);
204
- filterPopupAnchorElm.current = e.currentTarget;
205
-
206
- const item = getFilterItem(key);
207
-
208
- if (item) {
209
- setCurrentFilter(item);
210
- }
211
- }}
212
- />
213
- );
214
- });
215
- };
216
-
217
- return (
218
- <Box sx={{ flexGrow: 1 }}>
219
- <Stack
220
- direction="row"
221
- spacing={1}
222
- alignItems="flex-start"
223
- justifyContent="space-between"
224
- >
225
- <Stack
226
- direction="row"
227
- alignItems="flex-start"
228
- sx={{
229
- maxWidth: {
230
- xs: "40vw",
231
- md: "45vw",
232
- lg: "57vw",
233
- },
234
- }}
235
- >
236
- {filterListData &&
237
- Object.values(filterListData).some((value) => value) && (
238
- <>
239
- <Typography
240
- variant="body1"
241
- sx={{
242
- minWidth: "60px",
243
- marginTop: "8px",
244
- }}
245
- >
246
- Filters:
247
- </Typography>
248
- <Stack
249
- direction="row"
250
- gap="5px"
251
- marginTop="3px"
252
- alignItems="center"
253
- sx={{ flexWrap: "wrap", maxWidth: "100%" }}
254
- >
255
- {renderChips(filterListData)}
256
- </Stack>
257
- </>
258
- )}
259
- </Stack>
260
- <Stack direction="row">
261
- {filterListData &&
262
- Object.values(filterListData).some((value) => value) && (
263
- <Button onClick={() => handlerReset()} variant="text">
264
- Clear Filter
265
- </Button>
266
- )}
267
- {!isDisabled && (
268
- <IconButton onClick={handleClick} sx={{ height: "40px" }}>
269
- <SvgFilterList />
270
- </IconButton>
271
- )}
272
- </Stack>
273
- </Stack>
274
- <form
275
- onSubmit={(e) => {
276
- e.preventDefault();
277
-
278
- if (!shouldFormSubmit) {
279
- handleSubmit((data) => {
280
- onSubmit(data);
281
- handleClose();
282
- })();
283
- }
284
- }}
285
- onKeyDown={(e) => {
286
- if (e.key === "Enter") {
287
- e.preventDefault();
288
-
289
- if (!shouldFormSubmit) {
290
- handleSubmit((data) => {
291
- onSubmit(data);
292
- handleClose();
293
- })();
294
- }
295
- }
296
- }}
297
- >
298
- <Drawer
299
- open={open}
300
- onClose={(_event, reason) => {
301
- if (reason === "backdropClick") {
302
- return;
303
- }
304
- handleClose();
305
- }}
306
- anchor="right"
307
- sx={{
308
- zIndex: theme.zIndex.drawer + 2,
309
- "& .MuiPaper-root": {
310
- width: "350px",
311
- },
312
- }}
313
- >
314
- <Stack
315
- alignItems="flex-end"
316
- sx={{
317
- background: iron[600],
318
- }}
319
- >
320
- <PadBox padding={{ padding: "10px 30px" }}>
321
- <Stack
322
- direction="row"
323
- justifyContent="space-between"
324
- width="100%"
325
- alignItems="center"
326
- >
327
- <Typography variant="h6">Filter</Typography>
328
- <IconButton
329
- onClick={() => {
330
- reset();
331
- handleClose();
332
- }}
333
- >
334
- <ClearIcon />
335
- </IconButton>
336
- </Stack>
337
- </PadBox>
338
- <Divider sx={{ width: "100%" }} />
339
- </Stack>
340
- <Stack flexGrow={1} sx={{ overflowX: "hidden" }}>
341
- {filterListItems.map((filter) =>
342
- filter.type === "switch" ? (
343
- <Stack
344
- key={filter.key}
345
- direction="row"
346
- justifyContent="space-between"
347
- alignItems="center"
348
- width="80%"
349
- sx={{ padding: "10px 5px 10px 20px ", margin: "auto" }}
350
- >
351
- <Typography variant="body2">{filter.label}</Typography>
352
- <Switch control={control} name={filter.key} />
353
- </Stack>
354
- ) : (
355
- <Accordion
356
- defaultExpanded={!!filterListData?.[filter.key]}
357
- disabled={filter.isDisabled}
358
- key={filter.key}
359
- sx={{
360
- "&.MuiAccordion-root.Mui-expanded": {
361
- margin: "0 !important",
362
- },
363
- }}
364
- >
365
- <AccordionSummary
366
- expandIcon={<ExpandMore />}
367
- aria-controls="panel1a-content"
368
- id="panel1a-header"
369
- sx={{
370
- flexDirection: "row-reverse",
371
- "& MuiAccordionSummary-root.Mui-expanded": {
372
- marginRight: "10px",
373
- transform: "rotate(-90deg)",
374
- },
375
- "&.Mui-expanded": {
376
- minHeight: "40px",
377
- paddingY: "5px",
378
- },
379
- "& .MuiAccordionSummary-content.Mui-expanded": {
380
- margin: "0px",
381
- },
382
- }}
383
- >
384
- <Stack
385
- direction="row"
386
- justifyContent="space-between"
387
- alignItems="center"
388
- width="90%"
389
- >
390
- <Typography variant="body2">{filter.label}</Typography>
391
- <Typography variant="body2">{filter.menuInfo}</Typography>
392
- </Stack>
393
- </AccordionSummary>
394
- <AccordionDetails
395
- sx={{
396
- background: slate[600],
397
- borderRadius: "5px",
398
- padding: "0px",
399
- }}
400
- >
401
- <PadBox
402
- padding={{
403
- paddingLeft: "15px",
404
- paddingY: "5px",
405
- paddingRight: "15px",
406
- }}
407
- >
408
- {filter.type === "dateRange" ? (
409
- <Stack
410
- direction="row"
411
- alignItems="center"
412
- gap="10px"
413
- onClick={(e) => {
414
- handleDateRange(filter);
415
- filterPopupAnchorElm.current = e.currentTarget;
416
- }}
417
- >
418
- <Box
419
- sx={{
420
- border: "1px solid black",
421
- borderRadius: "5px",
422
- width: "150px",
423
- p: 1,
424
- }}
425
- >
426
- <Typography variant="body2">
427
- {(Array.isArray(filterListData?.["dateRange"]) &&
428
- filterListData?.["dateRange"][0]) ||
429
- "Start Date"}
430
- </Typography>
431
- </Box>
432
- <Typography>~</Typography>
433
- <Box
434
- sx={{
435
- border: "1px solid black",
436
- borderRadius: "5px",
437
- width: "150px",
438
- p: 1,
439
- }}
440
- >
441
- <Typography variant="body2">
442
- {(Array.isArray(filterListData?.["dateRange"]) &&
443
- filterListData?.["dateRange"][1]) ||
444
- "End Date"}
445
- </Typography>
446
- </Box>
447
- </Stack>
448
- ) : (
449
- <Box>
450
- {
451
- GetFilterPopupComponent(filter, control)[
452
- filter.type
453
- ]
454
- }
455
- </Box>
456
- )}
457
- </PadBox>
458
- </AccordionDetails>
459
- </Accordion>
460
- )
461
- )}
462
- </Stack>
463
-
464
- <Divider
465
- sx={{ width: "100%", position: "absolute", bottom: "70px" }}
466
- />
467
- <Stack height="70px">
468
- <PadBox padding={{ padding: "10px" }}>
469
- <Stack
470
- direction="row"
471
- gap="10px"
472
- sx={{ position: "absolute", bottom: "15px" }}
473
- >
474
- <Button
475
- type="submit"
476
- disabled={shouldFormSubmit}
477
- variant="contained"
478
- onClick={() => {
479
- handleSubmit(onSubmit)();
480
- handleClose();
481
- }}
482
- >
483
- Apply
484
- </Button>
485
- <Button
486
- type="button"
487
- onClick={() => handlerReset()}
488
- disabled={Object.keys(formData).every(
489
- (key) => !formData[key]
490
- )}
491
- variant="outlined"
492
- >
493
- Reset
494
- </Button>
495
- </Stack>
496
- </PadBox>
497
- </Stack>
498
- </Drawer>
499
- </form>
500
- {currentFilter && currentFilter.type !== "switch" && (
501
- <FilterPopupWrapper
502
- open={openFilterPopup}
503
- onClose={handleCloseFilterPopup}
504
- onApply={() => {
505
- handleSubmit(onSubmit)();
506
- }}
507
- control={control}
508
- anchorEl={filterPopupAnchorElm.current}
509
- filterItem={currentFilter}
510
- currentFilterValue={currentFilterValue}
511
- />
512
- )}
513
- </Box>
514
- );
515
- };
@@ -1,148 +0,0 @@
1
- import { useEffect, useState, type PropsWithChildren } from "react";
2
- import type { PopoverProps } from "@mui/material";
3
- import ClearIcon from "@mui/icons-material/Clear";
4
- import {
5
- Box,
6
- Divider,
7
- IconButton,
8
- Popover,
9
- Stack,
10
- Typography,
11
- useTheme,
12
- } from "@mui/material";
13
- import { Button } from "../Button";
14
- import { PadBox } from "../PadBox";
15
- import { isFunction, sortBy } from "lodash";
16
- import type { FilterListType } from "./FilterTypeWrapper";
17
-
18
- type FilterPopupProps = PropsWithChildren<PopoverProps> & {
19
- onApply?: () => void;
20
- showFooter?: boolean;
21
- showDivider?: boolean;
22
- title?: string;
23
- background?: boolean;
24
- filterItem?: FilterListType;
25
- currentFilterValue?: string | string[] | null;
26
- };
27
-
28
- export const FilterPopup = ({
29
- open,
30
- anchorEl,
31
- onClose,
32
- children,
33
- onApply,
34
- showDivider = false,
35
- showFooter = true,
36
- title,
37
- filterItem,
38
- background = false,
39
- currentFilterValue,
40
- }: FilterPopupProps) => {
41
- const theme = useTheme();
42
-
43
- const { slate } = theme.palette.app.color;
44
-
45
- const [initialValue, setInitialValue] = useState<string | string[] | null>(
46
- null
47
- );
48
-
49
- const [isDisabled, setIsDisabled] = useState(true);
50
-
51
- useEffect(() => {
52
- if (open) {
53
- if (!initialValue && !!currentFilterValue) {
54
- const changedValue = filterItem?.multiSelect
55
- ? sortBy(currentFilterValue)
56
- : currentFilterValue;
57
-
58
- setInitialValue(changedValue);
59
- }
60
- } else {
61
- setInitialValue(null);
62
- }
63
-
64
- if (!!currentFilterValue && !!initialValue) {
65
- const isChanged = filterItem?.multiSelect
66
- ? JSON.stringify(sortBy(currentFilterValue)) !==
67
- JSON.stringify(initialValue)
68
- : currentFilterValue !== initialValue;
69
-
70
- setIsDisabled(!isChanged);
71
- }
72
- }, [open, currentFilterValue, initialValue, filterItem?.multiSelect]);
73
-
74
- const handleApply = () => {
75
- setInitialValue(null);
76
-
77
- if (isFunction(onApply)) {
78
- onApply();
79
- }
80
- };
81
-
82
- const handleClose = () => {
83
- setInitialValue(null);
84
-
85
- if (isFunction(onClose)) {
86
- onClose({}, "backdropClick");
87
- }
88
- };
89
-
90
- return (
91
- <Popover
92
- open={open}
93
- anchorEl={anchorEl}
94
- anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
95
- onClose={(_event, reason) => {
96
- if (reason === "backdropClick") {
97
- return;
98
- }
99
- handleClose();
100
- }}
101
- sx={{ "& .MuiPaper-root": { minWidth: "300px" } }}
102
- >
103
- {showDivider && (
104
- <Stack alignItems="flex-end">
105
- <PadBox padding={{ padding: "8px" }}>
106
- <Stack
107
- direction="row"
108
- justifyContent="space-between"
109
- width="100%"
110
- alignItems="center"
111
- >
112
- <Typography variant="h6">{title}</Typography>
113
- <IconButton onClick={handleClose}>
114
- <ClearIcon />
115
- </IconButton>
116
- </Stack>
117
- </PadBox>
118
- <Divider sx={{ width: "100%" }} />
119
- </Stack>
120
- )}
121
-
122
- <Box
123
- sx={{
124
- background: background ? slate[600] : "transparent",
125
- borderRadius: "5px",
126
- maxWidth: "300px",
127
- }}
128
- >
129
- {children}
130
- </Box>
131
-
132
- {showFooter && (
133
- <PadBox padding={{ padding: "10px" }}>
134
- <Stack direction="row" justifyContent="flex-end">
135
- <Button
136
- onClick={handleApply}
137
- disabled={isDisabled}
138
- variant="text"
139
- sx={{ maxWidth: "40px" }}
140
- >
141
- Apply
142
- </Button>
143
- </Stack>
144
- </PadBox>
145
- )}
146
- </Popover>
147
- );
148
- };