@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,113 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
import { FilterPopup } from "./FilterPopup";
|
|
3
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
4
|
+
import {
|
|
5
|
+
Autocomplete,
|
|
6
|
+
DatePicker,
|
|
7
|
+
DateRangePicker,
|
|
8
|
+
TextField,
|
|
9
|
+
} from "../FormFields";
|
|
10
|
+
import { useTheme, type PopoverProps } from "@mui/material";
|
|
11
|
+
import type { Control, FieldValues } from "react-hook-form";
|
|
12
|
+
import { PadBox } from "../PadBox";
|
|
13
|
+
|
|
14
|
+
type FilterPopupWrapperProp = PropsWithChildren<PopoverProps> & {
|
|
15
|
+
filterItem: FilterListType;
|
|
16
|
+
control: Control<FieldValues>;
|
|
17
|
+
currentFilterValue?: string | string[] | null;
|
|
18
|
+
onApply: () => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type FilterPopupComponentType = {
|
|
22
|
+
autoComplete?: JSX.Element;
|
|
23
|
+
text: JSX.Element;
|
|
24
|
+
date: JSX.Element;
|
|
25
|
+
checkbox?: JSX.Element;
|
|
26
|
+
dateRange?: JSX.Element;
|
|
27
|
+
switch?: JSX.Element;
|
|
28
|
+
radio?: JSX.Element;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const GetFilterPopupComponent = (
|
|
32
|
+
selectedFilter: FilterListType,
|
|
33
|
+
control: Control<FieldValues>
|
|
34
|
+
): FilterPopupComponentType => {
|
|
35
|
+
const theme = useTheme();
|
|
36
|
+
|
|
37
|
+
const { sapphireBlue, black } = theme.palette.app.color;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
autoComplete: selectedFilter.options && (
|
|
41
|
+
<Autocomplete
|
|
42
|
+
disableClearable
|
|
43
|
+
multiple={selectedFilter.multiSelect ?? false}
|
|
44
|
+
placeholder={`Select ${selectedFilter.label}`}
|
|
45
|
+
name={`${selectedFilter.key}`}
|
|
46
|
+
disabled={selectedFilter.isDisabled}
|
|
47
|
+
shouldCloseOnSelect={selectedFilter.multiSelect ?? false}
|
|
48
|
+
control={control}
|
|
49
|
+
options={selectedFilter.options ?? []}
|
|
50
|
+
sx={{
|
|
51
|
+
maxHeight: "250px",
|
|
52
|
+
overflowY: "auto",
|
|
53
|
+
width: "100%",
|
|
54
|
+
"& .MuiAutocomplete-tag": {
|
|
55
|
+
backgroundColor: sapphireBlue[300],
|
|
56
|
+
color: black[900],
|
|
57
|
+
},
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
),
|
|
61
|
+
text: (
|
|
62
|
+
<TextField
|
|
63
|
+
name={selectedFilter.key}
|
|
64
|
+
control={control}
|
|
65
|
+
disabled={selectedFilter.isDisabled}
|
|
66
|
+
placeholder={selectedFilter.label}
|
|
67
|
+
/>
|
|
68
|
+
),
|
|
69
|
+
date: (
|
|
70
|
+
<DatePicker
|
|
71
|
+
name={selectedFilter.key}
|
|
72
|
+
control={control}
|
|
73
|
+
disabled={selectedFilter.isDisabled}
|
|
74
|
+
/>
|
|
75
|
+
),
|
|
76
|
+
dateRange: (
|
|
77
|
+
<DateRangePicker
|
|
78
|
+
name={selectedFilter.key}
|
|
79
|
+
control={control}
|
|
80
|
+
disabled={selectedFilter.isDisabled}
|
|
81
|
+
/>
|
|
82
|
+
),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const FilterPopupWrapper = ({
|
|
87
|
+
open,
|
|
88
|
+
anchorEl,
|
|
89
|
+
filterItem,
|
|
90
|
+
onClose,
|
|
91
|
+
control,
|
|
92
|
+
onApply,
|
|
93
|
+
currentFilterValue,
|
|
94
|
+
}: FilterPopupWrapperProp) => {
|
|
95
|
+
return (
|
|
96
|
+
<FilterPopup
|
|
97
|
+
title={filterItem.label}
|
|
98
|
+
filterItem={filterItem}
|
|
99
|
+
open={open}
|
|
100
|
+
onClose={onClose}
|
|
101
|
+
anchorEl={anchorEl}
|
|
102
|
+
onApply={onApply}
|
|
103
|
+
currentFilterValue={currentFilterValue}
|
|
104
|
+
showFooter
|
|
105
|
+
showDivider
|
|
106
|
+
background
|
|
107
|
+
>
|
|
108
|
+
<PadBox padding={{ padding: "10px" }}>
|
|
109
|
+
{GetFilterPopupComponent(filterItem, control)[filterItem.type]}
|
|
110
|
+
</PadBox>
|
|
111
|
+
</FilterPopup>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ListItemButton, Stack, Typography } from "@mui/material";
|
|
2
|
+
import { Switch } from "../FormFields/Switch";
|
|
3
|
+
import type { Control, FieldValues } from "react-hook-form";
|
|
4
|
+
|
|
5
|
+
export type FilterComponentType =
|
|
6
|
+
| "autoComplete"
|
|
7
|
+
| "text"
|
|
8
|
+
| "date"
|
|
9
|
+
| "dateRange"
|
|
10
|
+
| "checkbox"
|
|
11
|
+
| "radio"
|
|
12
|
+
| "switch";
|
|
13
|
+
|
|
14
|
+
type Options = readonly {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
avatar?: string;
|
|
19
|
+
}[];
|
|
20
|
+
|
|
21
|
+
export type FilterListType = {
|
|
22
|
+
label: string;
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
key: string;
|
|
25
|
+
value: string;
|
|
26
|
+
type: FilterComponentType;
|
|
27
|
+
menuInfo?: string;
|
|
28
|
+
options?: Options;
|
|
29
|
+
multiSelect?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type FilterTypeWrapperProps = {
|
|
32
|
+
filter: FilterListType;
|
|
33
|
+
control: Control<FieldValues>;
|
|
34
|
+
};
|
|
35
|
+
export const FilterTypeWrapper = ({
|
|
36
|
+
filter,
|
|
37
|
+
control,
|
|
38
|
+
}: FilterTypeWrapperProps) => {
|
|
39
|
+
const getFilterByType = (type: FilterComponentType) => {
|
|
40
|
+
return (
|
|
41
|
+
<Stack
|
|
42
|
+
direction="row"
|
|
43
|
+
width="100%"
|
|
44
|
+
justifyContent="space-between"
|
|
45
|
+
alignItems="center"
|
|
46
|
+
>
|
|
47
|
+
<Typography variant="body2">{filter.label}</Typography>
|
|
48
|
+
{type === "switch" ? (
|
|
49
|
+
<Switch control={control} name={filter.key} />
|
|
50
|
+
) : (
|
|
51
|
+
<Typography variant="body2">{filter.menuInfo}</Typography>
|
|
52
|
+
)}
|
|
53
|
+
</Stack>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
return <ListItemButton>{getFilterByType(filter.type)}</ListItemButton>;
|
|
58
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FilterListType } from "./FilterTypeWrapper";
|
|
2
|
+
|
|
3
|
+
export const getFormValue = (value: unknown, item: FilterListType) => {
|
|
4
|
+
let keyValue = value;
|
|
5
|
+
|
|
6
|
+
if (item && item.type === "autoComplete") {
|
|
7
|
+
if (item.multiSelect && Array.isArray(value)) {
|
|
8
|
+
keyValue = item.options
|
|
9
|
+
?.filter((option) => value.includes(option.value))
|
|
10
|
+
.map((option) => option.label)
|
|
11
|
+
.join(", ");
|
|
12
|
+
} else {
|
|
13
|
+
keyValue = item.options
|
|
14
|
+
?.filter((option) => option.value === value)
|
|
15
|
+
.map((option) => option.label)
|
|
16
|
+
.join(", ");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (item.type === "dateRange" && Array.isArray(value) && value.length === 2) {
|
|
21
|
+
const startDate = value[0];
|
|
22
|
+
|
|
23
|
+
const endDate = value[1];
|
|
24
|
+
|
|
25
|
+
keyValue = `${startDate} <= Start Date <= ${endDate}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return keyValue;
|
|
29
|
+
};
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import type { AutocompleteProps as MuiAutocompleteProps } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Avatar,
|
|
5
|
+
Box,
|
|
6
|
+
Checkbox,
|
|
7
|
+
Chip,
|
|
8
|
+
Divider,
|
|
9
|
+
IconButton,
|
|
10
|
+
InputLabel,
|
|
11
|
+
Autocomplete as MuiAutocomplete,
|
|
12
|
+
Paper,
|
|
13
|
+
Popper,
|
|
14
|
+
Stack,
|
|
15
|
+
TextField,
|
|
16
|
+
useTheme,
|
|
17
|
+
} from "@mui/material";
|
|
18
|
+
import { styled } from "@mui/material/styles";
|
|
19
|
+
import { useMemo, useRef, type KeyboardEvent } from "react";
|
|
20
|
+
import {
|
|
21
|
+
type ControllerRenderProps,
|
|
22
|
+
type FieldValues,
|
|
23
|
+
type UseControllerProps,
|
|
24
|
+
useController,
|
|
25
|
+
} from "react-hook-form";
|
|
26
|
+
import { EditAction } from "../../Actions";
|
|
27
|
+
import { Skeleton } from "./Skeleton";
|
|
28
|
+
import { BoxStyled, CheckStyled } from "../CheckBox/CheckBox.styled";
|
|
29
|
+
|
|
30
|
+
export type Option = {
|
|
31
|
+
label: string;
|
|
32
|
+
value: string | number;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
employee_code?: string;
|
|
35
|
+
avatar?: string;
|
|
36
|
+
punch_code?: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type AutocompleteProps<P extends FieldValues> = UseControllerProps<P> &
|
|
40
|
+
Omit<
|
|
41
|
+
Omit<
|
|
42
|
+
MuiAutocompleteProps<
|
|
43
|
+
{
|
|
44
|
+
label: string;
|
|
45
|
+
value: string | number;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
avatar?: string;
|
|
48
|
+
employee_code?: string;
|
|
49
|
+
punch_code?: string;
|
|
50
|
+
},
|
|
51
|
+
boolean,
|
|
52
|
+
boolean,
|
|
53
|
+
boolean
|
|
54
|
+
>,
|
|
55
|
+
"renderInput"
|
|
56
|
+
>,
|
|
57
|
+
keyof ControllerRenderProps<P>
|
|
58
|
+
> & {
|
|
59
|
+
required?: boolean;
|
|
60
|
+
label?: string;
|
|
61
|
+
helperText?: string;
|
|
62
|
+
error?: boolean;
|
|
63
|
+
placeholder?: string;
|
|
64
|
+
isShowAvatar?: boolean;
|
|
65
|
+
shouldCloseOnSelect?: boolean;
|
|
66
|
+
onAction?: () => void;
|
|
67
|
+
isShowSelectAll?: boolean;
|
|
68
|
+
renderOption?: (
|
|
69
|
+
props: React.HTMLProps<HTMLLIElement>,
|
|
70
|
+
option: Option,
|
|
71
|
+
state: { selected: boolean }
|
|
72
|
+
) => JSX.Element;
|
|
73
|
+
getOptionLabel?: (option: string) => string;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export function Autocomplete<P extends FieldValues>({
|
|
77
|
+
control,
|
|
78
|
+
defaultValue,
|
|
79
|
+
name,
|
|
80
|
+
required = false,
|
|
81
|
+
label,
|
|
82
|
+
multiple = false,
|
|
83
|
+
disabled = false,
|
|
84
|
+
options = [],
|
|
85
|
+
rules,
|
|
86
|
+
loading = false,
|
|
87
|
+
helperText,
|
|
88
|
+
error,
|
|
89
|
+
placeholder = "",
|
|
90
|
+
freeSolo,
|
|
91
|
+
isShowSelectAll = true,
|
|
92
|
+
isShowAvatar = false,
|
|
93
|
+
shouldCloseOnSelect = false,
|
|
94
|
+
onAction,
|
|
95
|
+
renderOption,
|
|
96
|
+
getOptionLabel,
|
|
97
|
+
...restProps
|
|
98
|
+
}: AutocompleteProps<P>) {
|
|
99
|
+
const {
|
|
100
|
+
field: { onChange, value, ...restField },
|
|
101
|
+
} = useController({ name, control, defaultValue, rules });
|
|
102
|
+
|
|
103
|
+
const handleSelectAll = (isSelected: boolean) => {
|
|
104
|
+
if (isSelected) {
|
|
105
|
+
const allValues = options.map((option) => option.value);
|
|
106
|
+
|
|
107
|
+
onChange(allValues);
|
|
108
|
+
} else {
|
|
109
|
+
onChange([]);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const highlightedOptionRef = useRef<string | number>("");
|
|
114
|
+
|
|
115
|
+
const isAllSelected = useMemo(() => {
|
|
116
|
+
return (
|
|
117
|
+
multiple &&
|
|
118
|
+
isShowSelectAll &&
|
|
119
|
+
options.length > 0 &&
|
|
120
|
+
value?.length === options.filter((option) => !option.disabled).length
|
|
121
|
+
);
|
|
122
|
+
}, [multiple, isShowSelectAll, options, value]);
|
|
123
|
+
|
|
124
|
+
const memoizedOptions = useMemo(() => {
|
|
125
|
+
return [
|
|
126
|
+
...(multiple && isShowSelectAll && options.length
|
|
127
|
+
? [{ label: "Select All", value: "select-all" }]
|
|
128
|
+
: []),
|
|
129
|
+
...options,
|
|
130
|
+
];
|
|
131
|
+
}, [multiple, isShowSelectAll, options]);
|
|
132
|
+
|
|
133
|
+
// eslint-disable-next-line sonarjs/function-return-type
|
|
134
|
+
const selectedValue = useMemo(() => {
|
|
135
|
+
if (multiple && freeSolo) {
|
|
136
|
+
return (
|
|
137
|
+
value?.map((val: string | number) => {
|
|
138
|
+
const selectedOption = options.find((option) => option.value === val);
|
|
139
|
+
|
|
140
|
+
return selectedOption ? selectedOption.label : val.toString();
|
|
141
|
+
}) || []
|
|
142
|
+
);
|
|
143
|
+
} else if (multiple) {
|
|
144
|
+
return options.filter((option) => value?.includes(option.value));
|
|
145
|
+
} else if (!options.find((option) => option.value === value) && freeSolo) {
|
|
146
|
+
return value;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return options.find((option) => option.value === value) || null;
|
|
150
|
+
}, [multiple, options, value]);
|
|
151
|
+
|
|
152
|
+
const {
|
|
153
|
+
palette: {
|
|
154
|
+
app: { color },
|
|
155
|
+
},
|
|
156
|
+
} = useTheme();
|
|
157
|
+
|
|
158
|
+
const StyledPaper = styled(Paper)(({ theme }) => ({
|
|
159
|
+
"& .MuiAutocomplete-listbox": {
|
|
160
|
+
maxHeight: 200,
|
|
161
|
+
overflowY: "auto",
|
|
162
|
+
marginTop: "10px",
|
|
163
|
+
"&::-webkit-scrollbar": {
|
|
164
|
+
width: "6px",
|
|
165
|
+
},
|
|
166
|
+
"&::-webkit-scrollbar-thumb": {
|
|
167
|
+
backgroundColor: theme.palette.secondary.main,
|
|
168
|
+
borderRadius: "4px",
|
|
169
|
+
},
|
|
170
|
+
"&::-webkit-scrollbar-track": {
|
|
171
|
+
backgroundColor: color.lightBlue[100],
|
|
172
|
+
},
|
|
173
|
+
"& .MuiAutocomplete-option": {
|
|
174
|
+
fontSize: "14px", // Change this to your desired font size
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
if (loading) {
|
|
180
|
+
return <Skeleton label={label} />;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// eslint-disable-next-line sonarjs/cognitive-complexity
|
|
184
|
+
const handleKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
|
|
185
|
+
if (e.code === "Space" && highlightedOptionRef.current) {
|
|
186
|
+
e.preventDefault();
|
|
187
|
+
|
|
188
|
+
if (multiple) {
|
|
189
|
+
if (highlightedOptionRef.current == "select-all") {
|
|
190
|
+
handleSelectAll(!isAllSelected);
|
|
191
|
+
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (selectedValue && Array.isArray(selectedValue)) {
|
|
196
|
+
const valuesArray = selectedValue.map((item) => item.value);
|
|
197
|
+
|
|
198
|
+
if (valuesArray.includes(highlightedOptionRef.current)) {
|
|
199
|
+
onChange(
|
|
200
|
+
valuesArray.filter(
|
|
201
|
+
(value) => value !== highlightedOptionRef.current
|
|
202
|
+
)
|
|
203
|
+
);
|
|
204
|
+
} else {
|
|
205
|
+
onChange([...valuesArray, highlightedOptionRef.current]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
onChange(highlightedOptionRef.current);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
<Stack gap="10px">
|
|
216
|
+
{label && <InputLabel required={required}>{label}</InputLabel>}
|
|
217
|
+
|
|
218
|
+
<Stack
|
|
219
|
+
direction="row"
|
|
220
|
+
justifyContent="space-between"
|
|
221
|
+
gap="10px"
|
|
222
|
+
alignItems="start"
|
|
223
|
+
>
|
|
224
|
+
<MuiAutocomplete
|
|
225
|
+
PopperComponent={Popper}
|
|
226
|
+
PaperComponent={StyledPaper}
|
|
227
|
+
sx={{
|
|
228
|
+
"& .MuiAutocomplete-tag": {
|
|
229
|
+
backgroundColor: color.slate[700],
|
|
230
|
+
color: "black",
|
|
231
|
+
},
|
|
232
|
+
width: "100%",
|
|
233
|
+
}}
|
|
234
|
+
onHighlightChange={(event, option) => {
|
|
235
|
+
if (option) {
|
|
236
|
+
if (highlightedOptionRef.current != option.value) {
|
|
237
|
+
highlightedOptionRef.current = option.value;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}}
|
|
241
|
+
disableCloseOnSelect={shouldCloseOnSelect}
|
|
242
|
+
disabled={disabled}
|
|
243
|
+
freeSolo={freeSolo}
|
|
244
|
+
{...restProps}
|
|
245
|
+
{...restField}
|
|
246
|
+
renderTags={(value: Option[], getTagProps) =>
|
|
247
|
+
value.map((option: Option, index: number) => {
|
|
248
|
+
const { key, ...tagProps } = getTagProps({ index });
|
|
249
|
+
|
|
250
|
+
const label = typeof option === "string" ? option : option.label;
|
|
251
|
+
|
|
252
|
+
let avatarContent = "";
|
|
253
|
+
|
|
254
|
+
let avatar = undefined;
|
|
255
|
+
|
|
256
|
+
if (isShowAvatar) {
|
|
257
|
+
if (!option.avatar) {
|
|
258
|
+
const initials = option.label
|
|
259
|
+
.split(" ")
|
|
260
|
+
.map((word) => word[0]?.toUpperCase())
|
|
261
|
+
.join("");
|
|
262
|
+
|
|
263
|
+
avatarContent = `${initials}`;
|
|
264
|
+
}
|
|
265
|
+
avatar = option.avatar ? (
|
|
266
|
+
<Avatar src={option.avatar} alt={option.label} />
|
|
267
|
+
) : (
|
|
268
|
+
<Avatar>{avatarContent}</Avatar>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
<Chip avatar={avatar} label={label} key={key} {...tagProps} />
|
|
274
|
+
);
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
renderOption={(props, option, { selected }) => {
|
|
278
|
+
if (renderOption) {
|
|
279
|
+
return renderOption(props, option, { selected });
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const { key, ...optionProps } = props;
|
|
283
|
+
|
|
284
|
+
return (
|
|
285
|
+
<li key={key} {...optionProps}>
|
|
286
|
+
<Stack gap="5px">
|
|
287
|
+
<Stack direction="row" gap="10px">
|
|
288
|
+
{multiple && (
|
|
289
|
+
<Checkbox
|
|
290
|
+
icon={<BoxStyled size="small" />}
|
|
291
|
+
checkedIcon={<CheckStyled size="small" />}
|
|
292
|
+
indeterminate={
|
|
293
|
+
!isAllSelected &&
|
|
294
|
+
selectedValue?.length &&
|
|
295
|
+
option.value === "select-all"
|
|
296
|
+
? true
|
|
297
|
+
: false
|
|
298
|
+
}
|
|
299
|
+
checked={isAllSelected ? true : selected}
|
|
300
|
+
sx={{
|
|
301
|
+
marginRight: "8px",
|
|
302
|
+
".MuiCheckbox-indeterminate": {
|
|
303
|
+
borderColor: color.butterflyBlue[900],
|
|
304
|
+
},
|
|
305
|
+
}}
|
|
306
|
+
/>
|
|
307
|
+
)}
|
|
308
|
+
{option.label}
|
|
309
|
+
</Stack>
|
|
310
|
+
{option.value === "select-all" && (
|
|
311
|
+
<Divider sx={{ width: "280px" }} />
|
|
312
|
+
)}
|
|
313
|
+
</Stack>
|
|
314
|
+
</li>
|
|
315
|
+
);
|
|
316
|
+
}}
|
|
317
|
+
renderInput={(params) => {
|
|
318
|
+
let startAdornment = params.InputProps.startAdornment;
|
|
319
|
+
|
|
320
|
+
if (!multiple && selectedValue?.avatar && getOptionLabel) {
|
|
321
|
+
startAdornment = (
|
|
322
|
+
<Box width="20px" marginLeft="10px">
|
|
323
|
+
<Avatar
|
|
324
|
+
src={selectedValue.avatar}
|
|
325
|
+
alt={selectedValue.label}
|
|
326
|
+
sx={{ width: 24, height: 24 }}
|
|
327
|
+
/>
|
|
328
|
+
</Box>
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return (
|
|
333
|
+
<TextField
|
|
334
|
+
{...params}
|
|
335
|
+
placeholder={placeholder || `Select ${label}`}
|
|
336
|
+
error={error}
|
|
337
|
+
helperText={helperText}
|
|
338
|
+
InputProps={{
|
|
339
|
+
...params.InputProps,
|
|
340
|
+
startAdornment,
|
|
341
|
+
}}
|
|
342
|
+
onKeyDown={(e) => handleKeyDown(e)}
|
|
343
|
+
/>
|
|
344
|
+
);
|
|
345
|
+
}}
|
|
346
|
+
multiple={multiple}
|
|
347
|
+
options={memoizedOptions}
|
|
348
|
+
isOptionEqualToValue={(option, value) =>
|
|
349
|
+
freeSolo ? false : option.value === value.value
|
|
350
|
+
}
|
|
351
|
+
getOptionLabel={(option) => {
|
|
352
|
+
if (getOptionLabel) {
|
|
353
|
+
return getOptionLabel(option);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (typeof option === "string") {
|
|
357
|
+
return option;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return option.label;
|
|
361
|
+
}}
|
|
362
|
+
value={selectedValue}
|
|
363
|
+
onChange={(_, newValue) => {
|
|
364
|
+
if (multiple && isShowSelectAll && Array.isArray(newValue)) {
|
|
365
|
+
const isSelectAllIncluded = newValue.some(
|
|
366
|
+
(option) =>
|
|
367
|
+
typeof option !== "string" && option?.value === "select-all"
|
|
368
|
+
);
|
|
369
|
+
|
|
370
|
+
if (isSelectAllIncluded) {
|
|
371
|
+
handleSelectAll(!isAllSelected);
|
|
372
|
+
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (multiple && freeSolo) {
|
|
378
|
+
if (Array.isArray(newValue)) {
|
|
379
|
+
// eslint-disable-next-line sonarjs/function-return-type
|
|
380
|
+
const values = newValue.map((option) => {
|
|
381
|
+
return typeof option === "string" ? option : option.value;
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
return onChange(values);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return onChange(value || []);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (typeof newValue === "string") {
|
|
391
|
+
return onChange(newValue ?? null);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
if (Array.isArray(newValue)) {
|
|
395
|
+
// eslint-disable-next-line sonarjs/function-return-type
|
|
396
|
+
const values = newValue.map((option) => {
|
|
397
|
+
if (typeof option === "string") {
|
|
398
|
+
return newValue;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return option.value;
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
return onChange(values);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
onChange(newValue ? newValue.value : null);
|
|
408
|
+
}}
|
|
409
|
+
getOptionDisabled={(option) => !!option.disabled}
|
|
410
|
+
/>
|
|
411
|
+
|
|
412
|
+
{onAction && (
|
|
413
|
+
<IconButton
|
|
414
|
+
disabled={disabled}
|
|
415
|
+
sx={{
|
|
416
|
+
border: `1px solid ${color.iron[800]}`,
|
|
417
|
+
padding: "0px",
|
|
418
|
+
borderRadius: "5px",
|
|
419
|
+
}}
|
|
420
|
+
onClick={onAction}
|
|
421
|
+
>
|
|
422
|
+
<EditAction />
|
|
423
|
+
</IconButton>
|
|
424
|
+
)}
|
|
425
|
+
</Stack>
|
|
426
|
+
</Stack>
|
|
427
|
+
);
|
|
428
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Skeleton as MuiSkeleton, Stack } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type SkeletonProps = {
|
|
4
|
+
label?: string;
|
|
5
|
+
};
|
|
6
|
+
export const Skeleton = ({ label }: SkeletonProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<Stack gap="10px">
|
|
9
|
+
{label && (
|
|
10
|
+
<MuiSkeleton
|
|
11
|
+
width={120}
|
|
12
|
+
height="23px"
|
|
13
|
+
sx={{
|
|
14
|
+
transform: "scale(1)",
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
)}
|
|
18
|
+
<MuiSkeleton
|
|
19
|
+
height="40px"
|
|
20
|
+
sx={{
|
|
21
|
+
transform: "scale(1)",
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
</Stack>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Autocomplete";
|