@codezee/sixtify-brahma 0.1.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/.github/workflows/deploy-storybook.yml +40 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +4 -0
- package/.lintstagedrc +5 -0
- package/.prettierignore +11 -0
- package/.prettierrc +22 -0
- package/.vscode/extensions.json +22 -0
- package/.vscode/settings.json +17 -0
- package/README.md +81 -0
- package/apps/docs/.eslintrc.cjs +4 -0
- package/apps/docs/.eslintrc.js +9 -0
- package/apps/docs/.storybook/main.ts +23 -0
- package/apps/docs/.storybook/preview.tsx +27 -0
- package/apps/docs/next-env.d.ts +5 -0
- package/apps/docs/next.config.mjs +4 -0
- package/apps/docs/package.json +38 -0
- package/apps/docs/public/globals.css +25 -0
- package/apps/docs/stories/AgGrid/AgGrid.stories.tsx +69 -0
- package/apps/docs/stories/AppBar/AppBar.stories.tsx +39 -0
- package/apps/docs/stories/Breadcrumbs/Breadcrumbs.stories.tsx +37 -0
- package/apps/docs/stories/Button/ButtonGroup.stories.tsx +99 -0
- package/apps/docs/stories/Button/button.stories.tsx +99 -0
- package/apps/docs/stories/Card/AttendanceCard.stories.tsx +37 -0
- package/apps/docs/stories/Card/Card.stories.tsx +39 -0
- package/apps/docs/stories/Charts/PieChart.stories.tsx +264 -0
- package/apps/docs/stories/Chips/Chip.stories.tsx +141 -0
- package/apps/docs/stories/Chips/ChipWithBorder.stories.tsx +18 -0
- package/apps/docs/stories/Chips/FilterPill.stories.tsx +24 -0
- package/apps/docs/stories/Color/Color.stories.tsx +14 -0
- package/apps/docs/stories/Dialog/ButtomDialog.stories.tsx +47 -0
- package/apps/docs/stories/Dialog/DeleteDialog.stories.tsx +31 -0
- package/apps/docs/stories/Dialog/Dialog.stories.tsx +47 -0
- package/apps/docs/stories/Drawer/Drawer.stories.tsx +94 -0
- package/apps/docs/stories/FilterList/FilterList.stories.tsx +88 -0
- package/apps/docs/stories/FilterList/FilterListV2.stories.tsx +92 -0
- package/apps/docs/stories/FormFields/AutoComplete.stories.tsx +87 -0
- package/apps/docs/stories/FormFields/CheckBox.stories.tsx +61 -0
- package/apps/docs/stories/FormFields/DatePicker.stories.tsx +98 -0
- package/apps/docs/stories/FormFields/DateRangePicker.stories.tsx +37 -0
- package/apps/docs/stories/FormFields/FileUpload.stories.tsx +83 -0
- package/apps/docs/stories/FormFields/ImageUpload.stories.tsx +69 -0
- package/apps/docs/stories/FormFields/ListItemButton.stories.tsx +59 -0
- package/apps/docs/stories/FormFields/RadioGroupField.stories.tsx +170 -0
- package/apps/docs/stories/FormFields/SearchField.stories.tsx +72 -0
- package/apps/docs/stories/FormFields/TextField.stories.tsx +111 -0
- package/apps/docs/stories/FormFields/TimeField.stories.tsx +82 -0
- package/apps/docs/stories/FormFields/TimePicker.stories.tsx +82 -0
- package/apps/docs/stories/Indicator/Indicator.stories.tsx +33 -0
- package/apps/docs/stories/Indicator/SeverityIndicator.stories.tsx +27 -0
- package/apps/docs/stories/Layouts/FormRow.stories.tsx +45 -0
- package/apps/docs/stories/PadBox/PadBox.stories.tsx +49 -0
- package/apps/docs/stories/Stepper/Stepper.stories.tsx +75 -0
- package/apps/docs/stories/Stepper/StepperV2.stories.tsx +44 -0
- package/apps/docs/stories/Timeline/AttendanceStatus.stories.tsx +29 -0
- package/apps/docs/stories/Timeline/Timeline.stories.tsx +38 -0
- package/apps/docs/stories/Tooltip/Tooltip.stories.tsx +30 -0
- package/apps/docs/stories/UserProfileMenu/UserProfileMenu.stories.tsx +112 -0
- package/apps/docs/tsconfig.json +19 -0
- package/commitlint.config.cjs +6 -0
- package/index.ts +1 -0
- package/package.json +74 -0
- package/packages/eslint-config/README.md +3 -0
- package/packages/eslint-config/library.js +88 -0
- package/packages/eslint-config/next.js +85 -0
- package/packages/eslint-config/package.json +19 -0
- package/packages/eslint-config/react-internal.js +89 -0
- package/packages/shared-components/.eslintrc.js +10 -0
- package/packages/shared-components/package.json +22 -0
- package/packages/shared-components/src/Actions/AddAction.tsx +13 -0
- package/packages/shared-components/src/Actions/CalendarAction.tsx +13 -0
- package/packages/shared-components/src/Actions/DeleteAction.tsx +13 -0
- package/packages/shared-components/src/Actions/DownloadAction.tsx +13 -0
- package/packages/shared-components/src/Actions/EditAction.tsx +13 -0
- package/packages/shared-components/src/Actions/HistoryAction.tsx +13 -0
- package/packages/shared-components/src/Actions/index.ts +6 -0
- package/packages/shared-components/src/AgGrid/ActionCell/ActionCell.tsx +55 -0
- package/packages/shared-components/src/AgGrid/ActionCell/Popover.tsx +32 -0
- package/packages/shared-components/src/AgGrid/AgGrid.tsx +87 -0
- package/packages/shared-components/src/AgGrid/LoadingCell.tsx +5 -0
- package/packages/shared-components/src/AgGrid/index.ts +3 -0
- package/packages/shared-components/src/AppBar/AppBar.styled.tsx +25 -0
- package/packages/shared-components/src/AppBar/AppBar.tsx +20 -0
- package/packages/shared-components/src/AppBar/index.ts +1 -0
- package/packages/shared-components/src/Breadcrumbs/Breadcrumbs.tsx +76 -0
- package/packages/shared-components/src/Breadcrumbs/index.ts +1 -0
- package/packages/shared-components/src/Button/ActionButton.tsx +38 -0
- package/packages/shared-components/src/Button/Button.tsx +19 -0
- package/packages/shared-components/src/Button/ButtonGroup.tsx +37 -0
- package/packages/shared-components/src/Button/index.ts +3 -0
- package/packages/shared-components/src/Card/AttendanceCard.tsx +51 -0
- package/packages/shared-components/src/Card/Card.tsx +34 -0
- package/packages/shared-components/src/Card/CardItem/CardItem.tsx +33 -0
- package/packages/shared-components/src/Card/CardItem/CardItemValue.tsx +98 -0
- package/packages/shared-components/src/Card/CardItem/index.ts +2 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCard.tsx +40 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardBody.tsx +53 -0
- package/packages/shared-components/src/Card/ProfileCard/ProfileCardItem/ProfileCardHeader.tsx +96 -0
- package/packages/shared-components/src/Card/index.ts +6 -0
- package/packages/shared-components/src/Charts/PieChart.tsx +69 -0
- package/packages/shared-components/src/Charts/index.ts +1 -0
- package/packages/shared-components/src/Chips/Chip.tsx +26 -0
- package/packages/shared-components/src/Chips/ChipWithBorder.tsx +39 -0
- package/packages/shared-components/src/Chips/FilterPill.tsx +47 -0
- package/packages/shared-components/src/Chips/index.ts +3 -0
- package/packages/shared-components/src/Dialog/BottomDialog.styled.tsx +28 -0
- package/packages/shared-components/src/Dialog/BottomDialog.tsx +37 -0
- package/packages/shared-components/src/Dialog/DeleteDialog.tsx +48 -0
- package/packages/shared-components/src/Dialog/Dialog.tsx +61 -0
- package/packages/shared-components/src/Dialog/index.ts +3 -0
- package/packages/shared-components/src/Drawer/Bullet.tsx +12 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItem.tsx +50 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItemList.tsx +105 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.tsx +125 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/MenuItem.tsx +0 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/Popover.tsx +45 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/Popper.tsx +43 -0
- package/packages/shared-components/src/Drawer/Drawer.styled.tsx +51 -0
- package/packages/shared-components/src/Drawer/Drawer.tsx +55 -0
- package/packages/shared-components/src/Drawer/MenuItem.tsx +69 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerCollapse.tsx +13 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItem.tsx +46 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItemList.tsx +249 -0
- package/packages/shared-components/src/Drawer/index.ts +1 -0
- package/packages/shared-components/src/FilterList/FilterList.tsx +172 -0
- package/packages/shared-components/src/FilterList/FilterListV2.tsx +504 -0
- package/packages/shared-components/src/FilterList/FilterPopup.tsx +148 -0
- package/packages/shared-components/src/FilterList/FilterPopupWrapper.tsx +113 -0
- package/packages/shared-components/src/FilterList/FilterTypeWrapper.tsx +58 -0
- package/packages/shared-components/src/FilterList/getFormData.ts +29 -0
- package/packages/shared-components/src/FilterList/index.ts +3 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Autocomplete.tsx +428 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/Autocomplete/index.ts +1 -0
- package/packages/shared-components/src/FormFields/CheckBox/CheckBox.styled.tsx +67 -0
- package/packages/shared-components/src/FormFields/CheckBox/CheckBox.tsx +44 -0
- package/packages/shared-components/src/FormFields/CheckBox/Skeleton.tsx +12 -0
- package/packages/shared-components/src/FormFields/CheckBox/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DatePicker/DatePicker.tsx +206 -0
- package/packages/shared-components/src/FormFields/DatePicker/Skeleton.tsx +21 -0
- package/packages/shared-components/src/FormFields/DatePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/DateRangePicker.tsx +96 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/Skeleton.tsx +38 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/DateTimePicker.tsx +245 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/DateTimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.styled.tsx +22 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.tsx +197 -0
- package/packages/shared-components/src/FormFields/FileUpload/Skeleton.tsx +21 -0
- package/packages/shared-components/src/FormFields/FileUpload/UploadedFileName.tsx +27 -0
- package/packages/shared-components/src/FormFields/FileUpload/index.ts +1 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.styled.tsx +16 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.tsx +181 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUploadView.tsx +65 -0
- package/packages/shared-components/src/FormFields/ImageUpload/PhotoCaptureDialog.tsx +74 -0
- package/packages/shared-components/src/FormFields/ImageUpload/Skeleton.tsx +31 -0
- package/packages/shared-components/src/FormFields/ImageUpload/index.ts +2 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.styled.tsx +22 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.tsx +37 -0
- package/packages/shared-components/src/FormFields/ListItemButton/index.ts +1 -0
- package/packages/shared-components/src/FormFields/PasswordField/PasswordField.tsx +50 -0
- package/packages/shared-components/src/FormFields/PasswordField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/RadioGroupField.tsx +105 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/RadioGroupField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/SearchField/SearchField.tsx +21 -0
- package/packages/shared-components/src/FormFields/SearchField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/Switch/Skeleton.tsx +12 -0
- package/packages/shared-components/src/FormFields/Switch/Switch.tsx +33 -0
- package/packages/shared-components/src/FormFields/Switch/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TextField/Skeleton.tsx +26 -0
- package/packages/shared-components/src/FormFields/TextField/TextField.tsx +92 -0
- package/packages/shared-components/src/FormFields/TextField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TimeField/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/TimeField/TimeField.tsx +120 -0
- package/packages/shared-components/src/FormFields/TimeField/index.ts +1 -0
- package/packages/shared-components/src/FormFields/TimePicker/Skeleton.tsx +24 -0
- package/packages/shared-components/src/FormFields/TimePicker/TimePicker.tsx +162 -0
- package/packages/shared-components/src/FormFields/TimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/index.ts +13 -0
- package/packages/shared-components/src/Indicator/Indicator.tsx +17 -0
- package/packages/shared-components/src/Indicator/SeverityIndicator.tsx +34 -0
- package/packages/shared-components/src/Indicator/index.ts +2 -0
- package/packages/shared-components/src/Layouts/FormContainer.tsx +6 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.styled.tsx +39 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.tsx +20 -0
- package/packages/shared-components/src/Layouts/FormRow/index.ts +1 -0
- package/packages/shared-components/src/Layouts/FormSection.tsx +22 -0
- package/packages/shared-components/src/Layouts/index.ts +3 -0
- package/packages/shared-components/src/Loader/FacebookCircularProgress.tsx +41 -0
- package/packages/shared-components/src/Loader/index.ts +1 -0
- package/packages/shared-components/src/PadBox/PadBox.tsx +21 -0
- package/packages/shared-components/src/PadBox/index.ts +1 -0
- package/packages/shared-components/src/Stepper/Stepper.tsx +54 -0
- package/packages/shared-components/src/Stepper/StepperV2.tsx +115 -0
- package/packages/shared-components/src/Stepper/StepperV3.tsx +72 -0
- package/packages/shared-components/src/Stepper/index.ts +3 -0
- package/packages/shared-components/src/Svgs/AppLogo/AppLogoMedium.tsx +65 -0
- package/packages/shared-components/src/Svgs/AppLogo/AppLogoSmall.tsx +48 -0
- package/packages/shared-components/src/Svgs/ArrowUp.tsx +11 -0
- package/packages/shared-components/src/Svgs/Company/CompanyBanner.tsx +480 -0
- package/packages/shared-components/src/Svgs/Company/index.ts +1 -0
- package/packages/shared-components/src/Svgs/Drawer/SettingIcon.tsx +51 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsEmployees.tsx +25 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsOrganization.tsx +36 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgsTransaction.tsx +79 -0
- package/packages/shared-components/src/Svgs/Drawer/index.ts +4 -0
- package/packages/shared-components/src/Svgs/FormAction.tsx +118 -0
- package/packages/shared-components/src/Svgs/LogoIcon.tsx +74 -0
- package/packages/shared-components/src/Svgs/SvgAdd.tsx +28 -0
- package/packages/shared-components/src/Svgs/SvgCalendar.tsx +89 -0
- package/packages/shared-components/src/Svgs/SvgDelete.tsx +55 -0
- package/packages/shared-components/src/Svgs/SvgDownload.tsx +20 -0
- package/packages/shared-components/src/Svgs/SvgFilterList.tsx +19 -0
- package/packages/shared-components/src/Svgs/SvgNoLogo.tsx +66 -0
- package/packages/shared-components/src/Svgs/SvgNoSign.tsx +28 -0
- package/packages/shared-components/src/Svgs/SvgsDrop.tsx +44 -0
- package/packages/shared-components/src/Svgs/SvgsEdit.tsx +42 -0
- package/packages/shared-components/src/Svgs/SvgsHistory.tsx +40 -0
- package/packages/shared-components/src/Svgs/SvgsHome.tsx +16 -0
- package/packages/shared-components/src/Svgs/SvgsIndicator.tsx +20 -0
- package/packages/shared-components/src/Svgs/index.ts +12 -0
- package/packages/shared-components/src/Tab/Skeleton.tsx +15 -0
- package/packages/shared-components/src/Tab/Tabs.tsx +64 -0
- package/packages/shared-components/src/Tab/index.ts +1 -0
- package/packages/shared-components/src/Timeline/AttendanceStatus.tsx +56 -0
- package/packages/shared-components/src/Timeline/Timeline.tsx +171 -0
- package/packages/shared-components/src/Timeline/TimelineTrackSegments.tsx +121 -0
- package/packages/shared-components/src/Timeline/index.ts +2 -0
- package/packages/shared-components/src/Toast/Toast.tsx +59 -0
- package/packages/shared-components/src/Toast/ToastBody.tsx +26 -0
- package/packages/shared-components/src/Toast/ToastFooterLink.tsx +19 -0
- package/packages/shared-components/src/Toast/Toaster.styled.tsx +76 -0
- package/packages/shared-components/src/Toast/Toaster.tsx +21 -0
- package/packages/shared-components/src/Toast/index.ts +3 -0
- package/packages/shared-components/src/Toast/toasts.tsx +28 -0
- package/packages/shared-components/src/Toast/types.ts +13 -0
- package/packages/shared-components/src/Tooltip/Tooltip.tsx +36 -0
- package/packages/shared-components/src/Tooltip/index.ts +1 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.styled.tsx +37 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.tsx +107 -0
- package/packages/shared-components/src/UserProfileMenu/index.ts +1 -0
- package/packages/shared-components/src/index.ts +24 -0
- package/packages/shared-components/src/utils/colorVariant.ts +142 -0
- package/packages/shared-components/src/utils/date.ts +11 -0
- package/packages/shared-components/src/utils/file.ts +20 -0
- package/packages/shared-components/src/utils/fileSizeValidate.ts +5 -0
- package/packages/shared-components/src/utils/index.ts +5 -0
- package/packages/shared-components/src/utils/theme/colorPalette.ts +110 -0
- package/packages/shared-components/src/utils/theme/colorPaletteUI.tsx +44 -0
- package/packages/shared-components/src/utils/theme/paletteDark.ts +10 -0
- package/packages/shared-components/src/utils/theme/paletteLight.ts +31 -0
- package/packages/shared-components/src/utils/theme/theme.ts +289 -0
- package/packages/shared-components/src/utils/theme/types.ts +18 -0
- package/packages/shared-components/src/utils/theme/typography.ts +52 -0
- package/packages/shared-components/src/utils/urlToNestedObject.ts +9 -0
- package/packages/shared-components/tsconfig.json +8 -0
- package/packages/shared-components/tsconfig.lint.json +8 -0
- package/packages/shared-components/turbo/generators/config.ts +33 -0
- package/packages/shared-components/turbo/generators/templates/component.hbs +8 -0
- package/packages/typescript-config/base.json +20 -0
- package/packages/typescript-config/nextjs.json +13 -0
- package/packages/typescript-config/package.json +9 -0
- package/packages/typescript-config/react-library.json +8 -0
- package/pnpm-workspace.yaml +3 -0
- package/turbo.json +44 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Check } from "@mui/icons-material";
|
|
2
|
+
import type { CSSObject, CheckboxProps } from "@mui/material";
|
|
3
|
+
import { Box, styled } from "@mui/material";
|
|
4
|
+
|
|
5
|
+
export const BoxStyled = styled(Box)<{ size: CheckboxProps["size"] }>(({
|
|
6
|
+
theme,
|
|
7
|
+
size,
|
|
8
|
+
}) => {
|
|
9
|
+
const { color } = theme.palette.app;
|
|
10
|
+
|
|
11
|
+
const checkBoxSize =
|
|
12
|
+
size === "small"
|
|
13
|
+
? {
|
|
14
|
+
width: "14px",
|
|
15
|
+
height: "14px",
|
|
16
|
+
}
|
|
17
|
+
: {
|
|
18
|
+
width: "20px",
|
|
19
|
+
height: "20px",
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const style: CSSObject = {
|
|
23
|
+
...checkBoxSize,
|
|
24
|
+
borderRadius: "4px",
|
|
25
|
+
border: `2px solid ${color.iron[900]}`,
|
|
26
|
+
"input:hover ~ &": {
|
|
27
|
+
borderColor: color.butterflyBlue[900],
|
|
28
|
+
},
|
|
29
|
+
"input:disabled ~ &": {
|
|
30
|
+
borderColor: color.iron[800],
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return style;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const CheckStyled = styled(Check)<{ size: CheckboxProps["size"] }>(({
|
|
38
|
+
theme,
|
|
39
|
+
size,
|
|
40
|
+
}) => {
|
|
41
|
+
const { color } = theme.palette.app;
|
|
42
|
+
|
|
43
|
+
const checkBoxSize =
|
|
44
|
+
size === "small"
|
|
45
|
+
? {
|
|
46
|
+
width: "14px",
|
|
47
|
+
height: "14px",
|
|
48
|
+
}
|
|
49
|
+
: {
|
|
50
|
+
width: "20px",
|
|
51
|
+
height: "20px",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const style: CSSObject = {
|
|
55
|
+
...checkBoxSize,
|
|
56
|
+
border: `2px solid ${color.butterflyBlue[900]}`,
|
|
57
|
+
borderRadius: "4px",
|
|
58
|
+
color: color.iron[600],
|
|
59
|
+
backgroundColor: color.butterflyBlue[900],
|
|
60
|
+
"input:disabled ~ &": {
|
|
61
|
+
borderColor: color.iron[800],
|
|
62
|
+
backgroundColor: color.iron[800],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return style;
|
|
67
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Checkbox, {
|
|
2
|
+
type CheckboxProps as MuiCheckboxProps,
|
|
3
|
+
} from "@mui/material/Checkbox";
|
|
4
|
+
import {
|
|
5
|
+
useController,
|
|
6
|
+
type ControllerRenderProps,
|
|
7
|
+
type FieldValues,
|
|
8
|
+
type UseControllerProps,
|
|
9
|
+
} from "react-hook-form";
|
|
10
|
+
import { BoxStyled, CheckStyled } from "./CheckBox.styled";
|
|
11
|
+
import { Skeleton } from "./Skeleton";
|
|
12
|
+
|
|
13
|
+
export type CheckBoxProps<P extends FieldValues> = UseControllerProps<P> &
|
|
14
|
+
Omit<Omit<MuiCheckboxProps, "checked">, keyof ControllerRenderProps<P>> & {
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function CheckBox<P extends FieldValues>({
|
|
19
|
+
name,
|
|
20
|
+
rules,
|
|
21
|
+
control,
|
|
22
|
+
defaultValue,
|
|
23
|
+
size,
|
|
24
|
+
loading = false,
|
|
25
|
+
...restCheckBoxProps
|
|
26
|
+
}: CheckBoxProps<P>) {
|
|
27
|
+
const {
|
|
28
|
+
field: { value = false, ...restField },
|
|
29
|
+
} = useController({ name, control, defaultValue, rules });
|
|
30
|
+
|
|
31
|
+
if (loading) {
|
|
32
|
+
return <Skeleton />;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Checkbox
|
|
37
|
+
icon={<BoxStyled size={size} />}
|
|
38
|
+
checkedIcon={<CheckStyled size={size} />}
|
|
39
|
+
checked={value}
|
|
40
|
+
{...restField}
|
|
41
|
+
{...restCheckBoxProps}
|
|
42
|
+
/>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./CheckBox";
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
2
|
+
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
3
|
+
import { InputLabel, Stack, useTheme } from "@mui/material";
|
|
4
|
+
import type { DatePickerProps as MuiDatePickerProps } from "@mui/x-date-pickers/DatePicker";
|
|
5
|
+
import { DatePicker as MuiDatePicker } from "@mui/x-date-pickers/DatePicker";
|
|
6
|
+
import type { PickerValidDate } from "@mui/x-date-pickers/models";
|
|
7
|
+
import { isFunction } from "lodash";
|
|
8
|
+
import { DateTime } from "luxon";
|
|
9
|
+
import React, { useState } from "react";
|
|
10
|
+
import type {
|
|
11
|
+
FieldError,
|
|
12
|
+
FieldValues,
|
|
13
|
+
UseControllerProps,
|
|
14
|
+
} from "react-hook-form";
|
|
15
|
+
import { useController } from "react-hook-form";
|
|
16
|
+
import { CalendarAction } from "../../Actions";
|
|
17
|
+
import { Skeleton } from "./Skeleton";
|
|
18
|
+
|
|
19
|
+
export type DatePickerProps<P extends FieldValues> = UseControllerProps<P> &
|
|
20
|
+
MuiDatePickerProps<PickerValidDate> &
|
|
21
|
+
Partial<{
|
|
22
|
+
label: string;
|
|
23
|
+
required: boolean;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
format: string;
|
|
26
|
+
error: boolean;
|
|
27
|
+
helperText: string;
|
|
28
|
+
loading: boolean;
|
|
29
|
+
clearable?: boolean;
|
|
30
|
+
setError: (
|
|
31
|
+
name: keyof P,
|
|
32
|
+
error: FieldError | { type: string; message?: string }
|
|
33
|
+
) => void;
|
|
34
|
+
}>;
|
|
35
|
+
|
|
36
|
+
export const dateFormats = {
|
|
37
|
+
dateWithISO8601: "yyyy-MM-dd",
|
|
38
|
+
dateWithEuropean: "dd-MM-yyyy",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const LeftArrowIcon: React.FC = () => {
|
|
42
|
+
const theme = useTheme();
|
|
43
|
+
|
|
44
|
+
const { iron } = theme.palette.app.color;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<ChevronLeftIcon
|
|
48
|
+
sx={{
|
|
49
|
+
border: `1px solid ${iron[800]}`,
|
|
50
|
+
borderRadius: "5px",
|
|
51
|
+
p: "4px",
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const RightArrowIcon: React.FC = () => {
|
|
58
|
+
const theme = useTheme();
|
|
59
|
+
|
|
60
|
+
const { iron } = theme.palette.app.color;
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<ChevronRightIcon
|
|
64
|
+
sx={{
|
|
65
|
+
border: `1px solid ${iron[800]}`,
|
|
66
|
+
borderRadius: "5px",
|
|
67
|
+
p: "4px",
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export function DatePicker<P extends FieldValues>({
|
|
74
|
+
setError,
|
|
75
|
+
control,
|
|
76
|
+
defaultValue,
|
|
77
|
+
disabled = false,
|
|
78
|
+
label,
|
|
79
|
+
readOnly = false,
|
|
80
|
+
name,
|
|
81
|
+
error = false,
|
|
82
|
+
helperText,
|
|
83
|
+
loading = false,
|
|
84
|
+
required = false,
|
|
85
|
+
clearable = true,
|
|
86
|
+
rules,
|
|
87
|
+
format = dateFormats.dateWithEuropean,
|
|
88
|
+
...restProps
|
|
89
|
+
}: DatePickerProps<P>) {
|
|
90
|
+
const {
|
|
91
|
+
field: { value, onChange, ...restField },
|
|
92
|
+
} = useController({ name, control, defaultValue, rules });
|
|
93
|
+
|
|
94
|
+
const [open, setOpen] = useState(false);
|
|
95
|
+
|
|
96
|
+
const theme = useTheme();
|
|
97
|
+
|
|
98
|
+
const { iron, butterflyBlue, mirage } = theme.palette.app.color;
|
|
99
|
+
|
|
100
|
+
const finalValue = value ? DateTime.fromISO(value) : null;
|
|
101
|
+
|
|
102
|
+
if (loading) {
|
|
103
|
+
return <Skeleton />;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const EmptyIcon = () => null;
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Stack gap="10px">
|
|
110
|
+
<InputLabel required={required}>{label}</InputLabel>
|
|
111
|
+
|
|
112
|
+
<MuiDatePicker<DateTime>
|
|
113
|
+
{...restField}
|
|
114
|
+
{...restProps}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
format={format}
|
|
117
|
+
value={finalValue}
|
|
118
|
+
readOnly={readOnly}
|
|
119
|
+
open={open && !readOnly}
|
|
120
|
+
onOpen={() => setOpen(true)}
|
|
121
|
+
onClose={() => setOpen(false)}
|
|
122
|
+
slotProps={{
|
|
123
|
+
field: {
|
|
124
|
+
clearable,
|
|
125
|
+
onClear: () => onChange(null),
|
|
126
|
+
},
|
|
127
|
+
textField: {
|
|
128
|
+
disabled,
|
|
129
|
+
helperText,
|
|
130
|
+
error,
|
|
131
|
+
InputProps: {
|
|
132
|
+
endAdornment: (
|
|
133
|
+
<CalendarAction
|
|
134
|
+
disabled={disabled}
|
|
135
|
+
onClick={() => setOpen(true)}
|
|
136
|
+
/>
|
|
137
|
+
),
|
|
138
|
+
sx: {
|
|
139
|
+
"& .MuiInputAdornment-root": {
|
|
140
|
+
width: "30px",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
day: {
|
|
146
|
+
sx: {
|
|
147
|
+
"&.MuiPickersDay-root": {
|
|
148
|
+
borderRadius: "5px",
|
|
149
|
+
borderColor: butterflyBlue[900],
|
|
150
|
+
fontWeight: 500,
|
|
151
|
+
color: mirage[900],
|
|
152
|
+
},
|
|
153
|
+
"&.MuiPickersDay-root.Mui-selected": {
|
|
154
|
+
backgroundColor: butterflyBlue[900],
|
|
155
|
+
color: iron[600],
|
|
156
|
+
},
|
|
157
|
+
"&.MuiPickersDay-today": {
|
|
158
|
+
color: butterflyBlue[900],
|
|
159
|
+
backgroundColor: iron[600],
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
calendarHeader: {
|
|
164
|
+
sx: {
|
|
165
|
+
"& .MuiPickersCalendarHeader-label": {
|
|
166
|
+
fontWeight: "bold",
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
yearButton: {
|
|
171
|
+
sx: {
|
|
172
|
+
"&.MuiPickersYear-yearButton.Mui-selected": {
|
|
173
|
+
backgroundColor: butterflyBlue[900],
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
monthButton: {
|
|
178
|
+
sx: {
|
|
179
|
+
"&.MuiPickersMonth-monthButton.Mui-selected": {
|
|
180
|
+
backgroundColor: butterflyBlue[900],
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
}}
|
|
185
|
+
slots={{
|
|
186
|
+
leftArrowIcon: LeftArrowIcon,
|
|
187
|
+
rightArrowIcon: RightArrowIcon,
|
|
188
|
+
switchViewIcon: EmptyIcon,
|
|
189
|
+
}}
|
|
190
|
+
dayOfWeekFormatter={(weekday) => `${weekday.toFormat("ccc")}`}
|
|
191
|
+
onChange={(value, details) => {
|
|
192
|
+
if (details.validationError) {
|
|
193
|
+
if (isFunction(setError)) {
|
|
194
|
+
setError(name, {
|
|
195
|
+
type: "manual",
|
|
196
|
+
message: "common.date.invalid",
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
} else if (value) {
|
|
200
|
+
onChange(value.toISODate());
|
|
201
|
+
}
|
|
202
|
+
}}
|
|
203
|
+
/>
|
|
204
|
+
</Stack>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Skeleton as MuiSkeleton, Stack } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const Skeleton = () => {
|
|
4
|
+
return (
|
|
5
|
+
<Stack gap="10px">
|
|
6
|
+
<MuiSkeleton
|
|
7
|
+
width={120}
|
|
8
|
+
height="23px"
|
|
9
|
+
sx={{
|
|
10
|
+
transform: "scale(1)",
|
|
11
|
+
}}
|
|
12
|
+
/>
|
|
13
|
+
<MuiSkeleton
|
|
14
|
+
height="40px"
|
|
15
|
+
sx={{
|
|
16
|
+
transform: "scale(1)",
|
|
17
|
+
}}
|
|
18
|
+
/>
|
|
19
|
+
</Stack>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DatePicker";
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { InputLabel, Stack } from "@mui/material";
|
|
2
|
+
import { DateRangePicker as RdrDateRangePicker } from "react-date-range";
|
|
3
|
+
import type { FieldValues, UseControllerProps } from "react-hook-form";
|
|
4
|
+
import { useController } from "react-hook-form";
|
|
5
|
+
import { Skeleton } from "./Skeleton";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
|
|
8
|
+
export type DateRangePickerProps<P extends FieldValues> =
|
|
9
|
+
UseControllerProps<P> & {
|
|
10
|
+
label?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
error?: boolean;
|
|
14
|
+
helperText?: string;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
minDate?: Date;
|
|
17
|
+
maxDate?: Date;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function DateRangePicker<P extends FieldValues>({
|
|
21
|
+
control,
|
|
22
|
+
defaultValue,
|
|
23
|
+
disabled = false,
|
|
24
|
+
label,
|
|
25
|
+
name,
|
|
26
|
+
error = false,
|
|
27
|
+
helperText,
|
|
28
|
+
loading = false,
|
|
29
|
+
required = false,
|
|
30
|
+
rules,
|
|
31
|
+
}: DateRangePickerProps<P>) {
|
|
32
|
+
const {
|
|
33
|
+
field: { onChange },
|
|
34
|
+
} = useController({ name, control, defaultValue, rules });
|
|
35
|
+
|
|
36
|
+
const [range, setRange] = useState([
|
|
37
|
+
{
|
|
38
|
+
startDate: new Date(),
|
|
39
|
+
endDate: new Date(),
|
|
40
|
+
key: "selection",
|
|
41
|
+
},
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
if (loading) {
|
|
45
|
+
return <Skeleton />;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Stack gap="10px">
|
|
50
|
+
{label && (
|
|
51
|
+
<InputLabel required={required} disabled={disabled}>
|
|
52
|
+
{label}
|
|
53
|
+
</InputLabel>
|
|
54
|
+
)}
|
|
55
|
+
|
|
56
|
+
<RdrDateRangePicker
|
|
57
|
+
ranges={range}
|
|
58
|
+
onChange={(ranges) => {
|
|
59
|
+
const selectedRange = ranges.selection;
|
|
60
|
+
|
|
61
|
+
if (
|
|
62
|
+
selectedRange?.endDate &&
|
|
63
|
+
selectedRange?.startDate &&
|
|
64
|
+
selectedRange?.key
|
|
65
|
+
) {
|
|
66
|
+
setRange([
|
|
67
|
+
{
|
|
68
|
+
startDate: selectedRange.startDate,
|
|
69
|
+
endDate: selectedRange.endDate,
|
|
70
|
+
key: selectedRange.key,
|
|
71
|
+
},
|
|
72
|
+
]);
|
|
73
|
+
|
|
74
|
+
const startDate = new Date(
|
|
75
|
+
selectedRange.startDate.toUTCString()
|
|
76
|
+
).toISOString();
|
|
77
|
+
|
|
78
|
+
const endDate = new Date(
|
|
79
|
+
selectedRange.endDate.toUTCString()
|
|
80
|
+
).toISOString();
|
|
81
|
+
|
|
82
|
+
onChange([startDate, endDate]);
|
|
83
|
+
}
|
|
84
|
+
}}
|
|
85
|
+
months={2}
|
|
86
|
+
direction="horizontal"
|
|
87
|
+
calendarFocus="backwards"
|
|
88
|
+
staticRanges={[]}
|
|
89
|
+
inputRanges={[]}
|
|
90
|
+
moveRangeOnFirstSelection={false}
|
|
91
|
+
preventSnapRefocus={true}
|
|
92
|
+
/>
|
|
93
|
+
{error && <span style={{ color: "red" }}>{helperText}</span>}
|
|
94
|
+
</Stack>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Skeleton as MuiSkeleton, Stack } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const Skeleton = () => {
|
|
4
|
+
return (
|
|
5
|
+
<Stack direction="row" gap="10px">
|
|
6
|
+
<Stack gap="10px">
|
|
7
|
+
<MuiSkeleton
|
|
8
|
+
width={120}
|
|
9
|
+
height="23px"
|
|
10
|
+
sx={{
|
|
11
|
+
transform: "scale(1)",
|
|
12
|
+
}}
|
|
13
|
+
/>
|
|
14
|
+
<MuiSkeleton
|
|
15
|
+
height="40px"
|
|
16
|
+
sx={{
|
|
17
|
+
transform: "scale(1)",
|
|
18
|
+
}}
|
|
19
|
+
/>
|
|
20
|
+
</Stack>
|
|
21
|
+
<Stack gap="10px">
|
|
22
|
+
<MuiSkeleton
|
|
23
|
+
width={120}
|
|
24
|
+
height="23px"
|
|
25
|
+
sx={{
|
|
26
|
+
transform: "scale(1)",
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
<MuiSkeleton
|
|
30
|
+
height="40px"
|
|
31
|
+
sx={{
|
|
32
|
+
transform: "scale(1)",
|
|
33
|
+
}}
|
|
34
|
+
/>
|
|
35
|
+
</Stack>
|
|
36
|
+
</Stack>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DateRangePicker";
|