@codezee/sixtify-brahma 0.0.0
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/check-build.yml +41 -0
- package/.github/workflows/deploy-on-npm.yml +43 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +4 -0
- package/.husky/pre-push +6 -0
- package/.lintstagedrc +5 -0
- package/.prettierignore +12 -0
- package/.prettierrc +22 -0
- package/.vscode/extensions.json +22 -0
- package/.vscode/settings.json +17 -0
- package/README.md +90 -0
- package/apps/docs/.eslintrc.cjs +9 -0
- package/apps/docs/.storybook/main.ts +23 -0
- package/apps/docs/.storybook/manager.ts +6 -0
- package/apps/docs/.storybook/preview.tsx +27 -0
- package/apps/docs/.storybook/theme.ts +8 -0
- package/apps/docs/next-env.d.ts +5 -0
- package/apps/docs/next.config.mjs +4 -0
- package/apps/docs/package.json +43 -0
- package/apps/docs/public/globals.css +26 -0
- package/apps/docs/stories/Actions/Actions.stories.tsx +49 -0
- package/apps/docs/stories/AgGrid/AgGrid.stories.tsx +70 -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 +120 -0
- package/apps/docs/stories/Button/button.stories.tsx +99 -0
- package/apps/docs/stories/Card/AttendanceCard.stories.tsx +36 -0
- package/apps/docs/stories/Card/Card.stories.tsx +39 -0
- package/apps/docs/stories/Charts/PieChart.stories.tsx +265 -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 +48 -0
- package/apps/docs/stories/Dialog/DeleteDialog.stories.tsx +32 -0
- package/apps/docs/stories/Dialog/Dialog.stories.tsx +48 -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 +90 -0
- package/apps/docs/stories/FormFields/CheckBox.stories.tsx +64 -0
- package/apps/docs/stories/FormFields/DatePicker.stories.tsx +100 -0
- package/apps/docs/stories/FormFields/DateRangePicker.stories.tsx +39 -0
- package/apps/docs/stories/FormFields/DateTimePicker.stories.tsx +39 -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/PhoneInputField.stories.tsx +84 -0
- package/apps/docs/stories/FormFields/RadioGroupField.stories.tsx +172 -0
- package/apps/docs/stories/FormFields/SearchField.stories.tsx +74 -0
- package/apps/docs/stories/FormFields/TextField.stories.tsx +141 -0
- package/apps/docs/stories/FormFields/TimeField.stories.tsx +84 -0
- package/apps/docs/stories/FormFields/TimePicker.stories.tsx +84 -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 +110 -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 +28 -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 +85 -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 +51 -0
- package/packages/shared-components/src/Actions/AddAction.tsx +16 -0
- package/packages/shared-components/src/Actions/CalendarAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ConfigureAction.tsx +16 -0
- package/packages/shared-components/src/Actions/DeleteAction.tsx +16 -0
- package/packages/shared-components/src/Actions/DownloadAction.tsx +16 -0
- package/packages/shared-components/src/Actions/EditAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ExportAction.tsx +16 -0
- package/packages/shared-components/src/Actions/FilterAction.tsx +16 -0
- package/packages/shared-components/src/Actions/HistoryAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ImportAction.tsx +16 -0
- package/packages/shared-components/src/Actions/ViewAction.tsx +16 -0
- package/packages/shared-components/src/Actions/index.ts +11 -0
- package/packages/shared-components/src/AgGrid/ActionCell/ActionCell.tsx +57 -0
- package/packages/shared-components/src/AgGrid/ActionCell/Popover.tsx +32 -0
- package/packages/shared-components/src/AgGrid/AgGrid.tsx +93 -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 +33 -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 +94 -0
- package/packages/shared-components/src/Card/index.ts +6 -0
- package/packages/shared-components/src/Charts/PieChart.tsx +81 -0
- package/packages/shared-components/src/Charts/Skeleton.tsx +36 -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 +57 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerMenuItemList.tsx +109 -0
- package/packages/shared-components/src/Drawer/CloseDrawer/CloseDrawerSubMenuItemList.tsx +128 -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 +63 -0
- package/packages/shared-components/src/Drawer/Drawer.tsx +56 -0
- package/packages/shared-components/src/Drawer/MenuItem.tsx +75 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerCollapse.tsx +13 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItem.tsx +48 -0
- package/packages/shared-components/src/Drawer/OpenDrawer/OpenDrawerMenuItemList.tsx +232 -0
- package/packages/shared-components/src/Drawer/index.ts +1 -0
- package/packages/shared-components/src/FilterList/DateRangePickerPopUp.tsx +123 -0
- package/packages/shared-components/src/FilterList/FilterList.tsx +180 -0
- package/packages/shared-components/src/FilterList/FilterListV2.tsx +661 -0
- package/packages/shared-components/src/FilterList/FilterPopup.tsx +165 -0
- package/packages/shared-components/src/FilterList/FilterPopupWrapper.tsx +110 -0
- package/packages/shared-components/src/FilterList/FilterTypeWrapper.tsx +60 -0
- package/packages/shared-components/src/FilterList/GetFilterPopupComponent.tsx +76 -0
- package/packages/shared-components/src/FilterList/getFormData.ts +29 -0
- package/packages/shared-components/src/FilterList/index.ts +6 -0
- package/packages/shared-components/src/FormFields/Autocomplete/Autocomplete.tsx +509 -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 +76 -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 +217 -0
- package/packages/shared-components/src/FormFields/DatePicker/Skeleton.tsx +28 -0
- package/packages/shared-components/src/FormFields/DatePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/DateRangePicker/DateRangePicker.tsx +97 -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 +253 -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/FileNames.tsx +32 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.styled.tsx +31 -0
- package/packages/shared-components/src/FormFields/FileUpload/FileUpload.tsx +160 -0
- package/packages/shared-components/src/FormFields/FileUpload/Skeleton.tsx +21 -0
- package/packages/shared-components/src/FormFields/FileUpload/index.ts +2 -0
- package/packages/shared-components/src/FormFields/ImageUpload/ImageUpload.styled.tsx +20 -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 +25 -0
- package/packages/shared-components/src/FormFields/ListItemButton/ListItemButton.tsx +52 -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/PhoneInputField/PhoneInputField.tsx +108 -0
- package/packages/shared-components/src/FormFields/PhoneInputField/Skeleton.tsx +31 -0
- package/packages/shared-components/src/FormFields/PhoneInputField/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 +31 -0
- package/packages/shared-components/src/FormFields/TextField/TextField.tsx +167 -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 +168 -0
- package/packages/shared-components/src/FormFields/TimePicker/index.ts +1 -0
- package/packages/shared-components/src/FormFields/index.ts +16 -0
- package/packages/shared-components/src/Indicator/Indicator.tsx +18 -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/FormGridLayout.tsx +27 -0
- package/packages/shared-components/src/Layouts/FormRow/FormRow.styled.tsx +47 -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 +4 -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/Pagination/Pagination.tsx +42 -0
- package/packages/shared-components/src/Pagination/index.ts +1 -0
- package/packages/shared-components/src/Stepper/Stepper.tsx +88 -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 +31 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgBankConfig.tsx +36 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgConfiguration.tsx +16 -0
- package/packages/shared-components/src/Svgs/Drawer/SvgPayroll.tsx +32 -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 +81 -0
- package/packages/shared-components/src/Svgs/Drawer/index.ts +7 -0
- package/packages/shared-components/src/Svgs/FormAction.tsx +118 -0
- package/packages/shared-components/src/Svgs/ImportExcelSuccessIcon.tsx +54 -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/SvgConfigure.tsx +51 -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/SvgEmail.tsx +27 -0
- package/packages/shared-components/src/Svgs/SvgExport.tsx +33 -0
- package/packages/shared-components/src/Svgs/SvgFilterList.tsx +22 -0
- package/packages/shared-components/src/Svgs/SvgImport.tsx +43 -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/SvgPhone.tsx +19 -0
- package/packages/shared-components/src/Svgs/SvgProfile.tsx +33 -0
- package/packages/shared-components/src/Svgs/SvgView.tsx +16 -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 +18 -0
- package/packages/shared-components/src/Svgs/SvgsIndicator.tsx +24 -0
- package/packages/shared-components/src/Svgs/index.ts +18 -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 +159 -0
- package/packages/shared-components/src/Timeline/TimelineTrackSegments.tsx +130 -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 +80 -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 +42 -0
- package/packages/shared-components/src/UserProfileMenu/UserProfileMenu.tsx +168 -0
- package/packages/shared-components/src/UserProfileMenu/index.ts +1 -0
- package/packages/shared-components/src/index.ts +25 -0
- package/packages/shared-components/src/utils/colorVariant.ts +162 -0
- package/packages/shared-components/src/utils/date.ts +25 -0
- package/packages/shared-components/src/utils/file.ts +22 -0
- package/packages/shared-components/src/utils/index.ts +11 -0
- package/packages/shared-components/src/utils/theme/colorPalette.ts +112 -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 +297 -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/webpack/cjs.js +20 -0
- package/packages/shared-components/webpack/common.js +36 -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 +42 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { LockOutlined } from "@mui/icons-material";
|
|
2
|
+
import VisibilityOffOutlinedIcon from "@mui/icons-material/VisibilityOffOutlined";
|
|
3
|
+
import VisibilityOutlinedIcon from "@mui/icons-material/VisibilityOutlined";
|
|
4
|
+
import { IconButton, InputAdornment } from "@mui/material";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { type FieldValues } from "react-hook-form";
|
|
7
|
+
import { TextField, type TextFieldProps } from "../TextField";
|
|
8
|
+
|
|
9
|
+
type PasswordFieldProps<P extends FieldValues> = Readonly<
|
|
10
|
+
Omit<TextFieldProps<P>, "InputProps">
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
export function PasswordField<P extends FieldValues>(
|
|
14
|
+
props: PasswordFieldProps<P>
|
|
15
|
+
) {
|
|
16
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
17
|
+
|
|
18
|
+
const togglePasswordVisibility = () => {
|
|
19
|
+
setIsPasswordVisible((prevState) => !prevState);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<TextField
|
|
24
|
+
type={isPasswordVisible ? "text" : "password"}
|
|
25
|
+
InputProps={{
|
|
26
|
+
startAdornment: (
|
|
27
|
+
<InputAdornment position="start">
|
|
28
|
+
<LockOutlined fontSize="small" />
|
|
29
|
+
</InputAdornment>
|
|
30
|
+
),
|
|
31
|
+
endAdornment: (
|
|
32
|
+
<InputAdornment position="end">
|
|
33
|
+
<IconButton
|
|
34
|
+
aria-label="toggle password visibility"
|
|
35
|
+
onClick={togglePasswordVisibility}
|
|
36
|
+
edge="end"
|
|
37
|
+
>
|
|
38
|
+
{isPasswordVisible ? (
|
|
39
|
+
<VisibilityOffOutlinedIcon fontSize="small" />
|
|
40
|
+
) : (
|
|
41
|
+
<VisibilityOutlinedIcon fontSize="small" />
|
|
42
|
+
)}
|
|
43
|
+
</IconButton>
|
|
44
|
+
</InputAdornment>
|
|
45
|
+
),
|
|
46
|
+
}}
|
|
47
|
+
{...props}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PasswordField";
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/* eslint-disable sonarjs/no-nested-conditional */
|
|
2
|
+
import { InputLabel, Stack, Typography, useTheme } from "@mui/material";
|
|
3
|
+
import {
|
|
4
|
+
useController,
|
|
5
|
+
type ControllerRenderProps,
|
|
6
|
+
type FieldValues,
|
|
7
|
+
type UseControllerProps,
|
|
8
|
+
} from "react-hook-form";
|
|
9
|
+
import type { PhoneInputProps } from "react-phone-input-2";
|
|
10
|
+
import PhoneInput from "react-phone-input-2";
|
|
11
|
+
import { Skeleton } from "./Skeleton";
|
|
12
|
+
|
|
13
|
+
export type PhoneInputFieldProps<P extends FieldValues> =
|
|
14
|
+
UseControllerProps<P> &
|
|
15
|
+
Omit<PhoneInputProps, keyof ControllerRenderProps<P>> & {
|
|
16
|
+
label?: string;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
rows?: number;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
error?: boolean;
|
|
21
|
+
helperText?: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function PhoneInputField<P extends FieldValues>({
|
|
25
|
+
control,
|
|
26
|
+
name,
|
|
27
|
+
defaultValue,
|
|
28
|
+
rules,
|
|
29
|
+
label,
|
|
30
|
+
disabled = false,
|
|
31
|
+
required,
|
|
32
|
+
rows,
|
|
33
|
+
loading = false,
|
|
34
|
+
placeholder = "",
|
|
35
|
+
error,
|
|
36
|
+
helperText,
|
|
37
|
+
...phoneInputProps
|
|
38
|
+
}: PhoneInputFieldProps<P>) {
|
|
39
|
+
const theme = useTheme();
|
|
40
|
+
|
|
41
|
+
const { iron, red } = theme.palette.app.color;
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
field: { value, onChange, ...restField },
|
|
45
|
+
} = useController({
|
|
46
|
+
name,
|
|
47
|
+
control,
|
|
48
|
+
defaultValue,
|
|
49
|
+
rules,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (loading) {
|
|
53
|
+
return <Skeleton label={label} rows={rows} />;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Stack gap="4px">
|
|
58
|
+
<Stack gap="10px">
|
|
59
|
+
{label && <InputLabel required={required}>{label}</InputLabel>}
|
|
60
|
+
|
|
61
|
+
<PhoneInput
|
|
62
|
+
country="in"
|
|
63
|
+
enableSearch={true}
|
|
64
|
+
disabled={disabled}
|
|
65
|
+
placeholder={placeholder || label}
|
|
66
|
+
onChange={(phone) => {
|
|
67
|
+
onChange(phone);
|
|
68
|
+
}}
|
|
69
|
+
value={value}
|
|
70
|
+
containerStyle={{
|
|
71
|
+
width: "100%",
|
|
72
|
+
border: error
|
|
73
|
+
? `1px solid ${red[900]}`
|
|
74
|
+
: disabled
|
|
75
|
+
? `1px solid ${iron[700]}`
|
|
76
|
+
: `1px solid ${iron[800]}`,
|
|
77
|
+
borderRadius: "4px",
|
|
78
|
+
}}
|
|
79
|
+
inputStyle={{
|
|
80
|
+
width: "100%",
|
|
81
|
+
paddingTop: "19px",
|
|
82
|
+
paddingBottom: "19px",
|
|
83
|
+
fontSize: "16px",
|
|
84
|
+
border: "none",
|
|
85
|
+
}}
|
|
86
|
+
buttonStyle={{
|
|
87
|
+
border: "none",
|
|
88
|
+
}}
|
|
89
|
+
inputProps={{ ...restField }}
|
|
90
|
+
{...phoneInputProps}
|
|
91
|
+
/>
|
|
92
|
+
</Stack>
|
|
93
|
+
|
|
94
|
+
{error && (
|
|
95
|
+
<Typography
|
|
96
|
+
variant="caption"
|
|
97
|
+
sx={{
|
|
98
|
+
color: "red",
|
|
99
|
+
whiteSpace: "pre",
|
|
100
|
+
textWrap: "wrap",
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
{helperText}
|
|
104
|
+
</Typography>
|
|
105
|
+
)}
|
|
106
|
+
</Stack>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Skeleton as MuiSkeleton, Stack } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type SkeletonProps = {
|
|
4
|
+
rows?: number;
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Skeleton = ({ rows, label }: SkeletonProps) => {
|
|
9
|
+
const height: number = rows === undefined ? 40 : rows * 23;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Stack gap="10px">
|
|
13
|
+
{label && (
|
|
14
|
+
<MuiSkeleton
|
|
15
|
+
width={120}
|
|
16
|
+
height="23px"
|
|
17
|
+
sx={{
|
|
18
|
+
transform: "scale(1)",
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
)}
|
|
22
|
+
|
|
23
|
+
<MuiSkeleton
|
|
24
|
+
height={`${height}px`}
|
|
25
|
+
sx={{
|
|
26
|
+
transform: "scale(1)",
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
</Stack>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PhoneInputField";
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormControlLabel,
|
|
3
|
+
InputLabel,
|
|
4
|
+
RadioGroup,
|
|
5
|
+
Stack,
|
|
6
|
+
Box,
|
|
7
|
+
type StackOwnProps,
|
|
8
|
+
type SxProps,
|
|
9
|
+
} from "@mui/material";
|
|
10
|
+
import Radio, { type RadioProps as MuiRadioProps } from "@mui/material/Radio";
|
|
11
|
+
import {
|
|
12
|
+
useController,
|
|
13
|
+
type ControllerRenderProps,
|
|
14
|
+
type FieldValues,
|
|
15
|
+
type UseControllerProps,
|
|
16
|
+
} from "react-hook-form";
|
|
17
|
+
import { Skeleton } from "./Skeleton";
|
|
18
|
+
import type { ReactNode } from "react";
|
|
19
|
+
|
|
20
|
+
type Options = {
|
|
21
|
+
values: boolean | string;
|
|
22
|
+
label?: ReactNode;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
direction?: StackOwnProps["direction"];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type RadioGroupFieldProps<P extends FieldValues> =
|
|
28
|
+
UseControllerProps<P> &
|
|
29
|
+
Omit<Omit<MuiRadioProps, "checked">, keyof ControllerRenderProps<P>> & {
|
|
30
|
+
label?: string;
|
|
31
|
+
options: Options[];
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
direction?: StackOwnProps["direction"];
|
|
34
|
+
sx?: SxProps;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function RadioGroupField<P extends FieldValues>({
|
|
38
|
+
name,
|
|
39
|
+
rules,
|
|
40
|
+
label,
|
|
41
|
+
control,
|
|
42
|
+
options,
|
|
43
|
+
defaultValue,
|
|
44
|
+
size = "small",
|
|
45
|
+
color = "secondary",
|
|
46
|
+
loading = false,
|
|
47
|
+
direction = "row",
|
|
48
|
+
sx = {},
|
|
49
|
+
...restRadioButtonProps
|
|
50
|
+
}: RadioGroupFieldProps<P>) {
|
|
51
|
+
const {
|
|
52
|
+
field: { value, onChange, ...restField },
|
|
53
|
+
} = useController({ name, control, defaultValue, rules });
|
|
54
|
+
|
|
55
|
+
if (loading) {
|
|
56
|
+
return <Skeleton />;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<Stack gap="5px">
|
|
61
|
+
{label && <InputLabel>{label}</InputLabel>}
|
|
62
|
+
|
|
63
|
+
<RadioGroup
|
|
64
|
+
name={name}
|
|
65
|
+
value={value}
|
|
66
|
+
onChange={(_, event) => {
|
|
67
|
+
if (event === "true") {
|
|
68
|
+
onChange(true);
|
|
69
|
+
} else if (event === "false") {
|
|
70
|
+
onChange(false);
|
|
71
|
+
} else {
|
|
72
|
+
onChange(event);
|
|
73
|
+
}
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<Stack
|
|
77
|
+
gap={direction === "column" ? "5px" : "45px"}
|
|
78
|
+
direction={direction}
|
|
79
|
+
>
|
|
80
|
+
{options?.map(({ label, values, disabled }, index) => {
|
|
81
|
+
return (
|
|
82
|
+
// eslint-disable-next-line sonarjs/no-array-index-key
|
|
83
|
+
<Box key={index} width="max-content">
|
|
84
|
+
<FormControlLabel
|
|
85
|
+
value={values}
|
|
86
|
+
control={
|
|
87
|
+
<Radio
|
|
88
|
+
{...restField}
|
|
89
|
+
{...restRadioButtonProps}
|
|
90
|
+
color={color}
|
|
91
|
+
size={size}
|
|
92
|
+
/>
|
|
93
|
+
}
|
|
94
|
+
disabled={disabled}
|
|
95
|
+
label={label}
|
|
96
|
+
sx={sx}
|
|
97
|
+
/>
|
|
98
|
+
</Box>
|
|
99
|
+
);
|
|
100
|
+
})}
|
|
101
|
+
</Stack>
|
|
102
|
+
</RadioGroup>
|
|
103
|
+
</Stack>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Skeleton as MuiSkeleton, Stack } from "@mui/material";
|
|
2
|
+
export const Skeleton = () => {
|
|
3
|
+
return (
|
|
4
|
+
<Stack gap="10px">
|
|
5
|
+
<MuiSkeleton height="20px" width="70px" sx={{ transform: "scale(1)" }} />
|
|
6
|
+
<Stack direction="row" alignItems="center" gap="50px">
|
|
7
|
+
<Stack gap="10px" direction="row" alignItems="center">
|
|
8
|
+
<MuiSkeleton variant="circular" height="25px" width="25px" />
|
|
9
|
+
<MuiSkeleton
|
|
10
|
+
height="23px"
|
|
11
|
+
width="38px"
|
|
12
|
+
sx={{ transform: "scale(1)" }}
|
|
13
|
+
/>
|
|
14
|
+
</Stack>
|
|
15
|
+
<Stack gap="10px" direction="row" alignItems="center">
|
|
16
|
+
<MuiSkeleton variant="circular" height="25px" width="25px" />
|
|
17
|
+
<MuiSkeleton
|
|
18
|
+
height="23px"
|
|
19
|
+
width="38px"
|
|
20
|
+
sx={{ transform: "scale(1)" }}
|
|
21
|
+
/>
|
|
22
|
+
</Stack>
|
|
23
|
+
</Stack>
|
|
24
|
+
</Stack>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./RadioGroupField";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InputAdornment } from "@mui/material";
|
|
2
|
+
import type { FieldValues } from "react-hook-form";
|
|
3
|
+
import SearchOutlinedIcon from "@mui/icons-material/SearchOutlined";
|
|
4
|
+
import type { TextFieldProps } from "../TextField";
|
|
5
|
+
import { TextField } from "../TextField";
|
|
6
|
+
|
|
7
|
+
export function SearchField<P extends FieldValues>(props: TextFieldProps<P>) {
|
|
8
|
+
return (
|
|
9
|
+
<TextField
|
|
10
|
+
placeholder="Search"
|
|
11
|
+
InputProps={{
|
|
12
|
+
startAdornment: (
|
|
13
|
+
<InputAdornment position="start">
|
|
14
|
+
<SearchOutlinedIcon fontSize="small" />
|
|
15
|
+
</InputAdornment>
|
|
16
|
+
),
|
|
17
|
+
}}
|
|
18
|
+
{...props}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./SearchField";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useController,
|
|
3
|
+
type ControllerRenderProps,
|
|
4
|
+
type FieldValues,
|
|
5
|
+
type UseControllerProps,
|
|
6
|
+
} from "react-hook-form";
|
|
7
|
+
import type { SwitchProps } from "@mui/material";
|
|
8
|
+
import { Switch as MuiSwitch } from "@mui/material";
|
|
9
|
+
import { Skeleton } from "./Skeleton";
|
|
10
|
+
|
|
11
|
+
export type SwitchFieldProps<P extends FieldValues> = UseControllerProps<P> &
|
|
12
|
+
Omit<Omit<SwitchProps, "checked">, keyof ControllerRenderProps<P>> & {
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function Switch<P extends FieldValues>({
|
|
17
|
+
name,
|
|
18
|
+
rules,
|
|
19
|
+
control,
|
|
20
|
+
defaultValue,
|
|
21
|
+
loading = false,
|
|
22
|
+
...restSwitchProps
|
|
23
|
+
}: SwitchFieldProps<P>) {
|
|
24
|
+
const {
|
|
25
|
+
field: { value = false, ...restField },
|
|
26
|
+
} = useController({ name, control, defaultValue, rules });
|
|
27
|
+
|
|
28
|
+
if (loading) {
|
|
29
|
+
return <Skeleton />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return <MuiSwitch checked={value} {...restField} {...restSwitchProps} />;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Switch";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Skeleton as MuiSkeleton, Stack } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
type SkeletonProps = {
|
|
4
|
+
rows?: number;
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const Skeleton = ({ rows, label }: SkeletonProps) => {
|
|
9
|
+
const height: number = rows === undefined ? 40 : rows * 23;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<Stack gap="10px">
|
|
13
|
+
{label && (
|
|
14
|
+
<MuiSkeleton
|
|
15
|
+
width={120}
|
|
16
|
+
height="23px"
|
|
17
|
+
sx={{
|
|
18
|
+
transform: "scale(1)",
|
|
19
|
+
}}
|
|
20
|
+
/>
|
|
21
|
+
)}
|
|
22
|
+
|
|
23
|
+
<MuiSkeleton
|
|
24
|
+
height={`${height}px`}
|
|
25
|
+
sx={{
|
|
26
|
+
transform: "scale(1)",
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
</Stack>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
InputLabel,
|
|
3
|
+
TextField as MuiTextField,
|
|
4
|
+
Stack,
|
|
5
|
+
type TextFieldProps as MuiTextFieldProps,
|
|
6
|
+
} from "@mui/material";
|
|
7
|
+
import type { KeyboardEvent } from "react";
|
|
8
|
+
import {
|
|
9
|
+
useController,
|
|
10
|
+
type ControllerRenderProps,
|
|
11
|
+
type FieldError,
|
|
12
|
+
type FieldValues,
|
|
13
|
+
type UseControllerProps,
|
|
14
|
+
} from "react-hook-form";
|
|
15
|
+
import { Skeleton } from "./Skeleton";
|
|
16
|
+
|
|
17
|
+
type AllowedCharacterType =
|
|
18
|
+
| "string"
|
|
19
|
+
| "string-number"
|
|
20
|
+
| "string-number-special";
|
|
21
|
+
|
|
22
|
+
type LetterCase = "uppercase" | "lowercase" | "mixed";
|
|
23
|
+
|
|
24
|
+
const characterTypeMessages: Record<AllowedCharacterType, string> = {
|
|
25
|
+
string: "Only alphabetic characters are allowed.",
|
|
26
|
+
"string-number": "Only letters and numbers are allowed.",
|
|
27
|
+
"string-number-special": "Special characters are allowed.",
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type TextFieldProps<P extends FieldValues> = UseControllerProps<P> &
|
|
31
|
+
Omit<MuiTextFieldProps, keyof ControllerRenderProps<P>> & {
|
|
32
|
+
label?: string;
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
rows?: number;
|
|
35
|
+
isCapitalize?: boolean;
|
|
36
|
+
isTrimStartDisabled?: boolean;
|
|
37
|
+
characterType?: AllowedCharacterType;
|
|
38
|
+
letterCase?: LetterCase;
|
|
39
|
+
setError?: (
|
|
40
|
+
name: keyof P,
|
|
41
|
+
error: FieldError | { type: string; message?: string }
|
|
42
|
+
) => void;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export function TextField<P extends FieldValues>({
|
|
46
|
+
control,
|
|
47
|
+
name,
|
|
48
|
+
defaultValue,
|
|
49
|
+
label = "",
|
|
50
|
+
rules,
|
|
51
|
+
type,
|
|
52
|
+
required,
|
|
53
|
+
disabled,
|
|
54
|
+
loading = false,
|
|
55
|
+
placeholder = "",
|
|
56
|
+
isCapitalize = false,
|
|
57
|
+
isTrimStartDisabled = false,
|
|
58
|
+
rows,
|
|
59
|
+
characterType = "string-number-special",
|
|
60
|
+
letterCase = "mixed",
|
|
61
|
+
setError,
|
|
62
|
+
...inputFieldProps
|
|
63
|
+
}: TextFieldProps<P>) {
|
|
64
|
+
const {
|
|
65
|
+
field: { value, onChange, ...restField },
|
|
66
|
+
fieldState: { error },
|
|
67
|
+
} = useController({ name, control, defaultValue, rules });
|
|
68
|
+
|
|
69
|
+
const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {
|
|
70
|
+
if (event.key === "-" && type === "number") {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const getCharacterRegex = (type: AllowedCharacterType) => {
|
|
76
|
+
switch (type) {
|
|
77
|
+
case "string":
|
|
78
|
+
return /^[A-Za-z\s]*$/;
|
|
79
|
+
|
|
80
|
+
case "string-number":
|
|
81
|
+
return /^[A-Za-z0-9\s]*$/;
|
|
82
|
+
|
|
83
|
+
case "string-number-special":
|
|
84
|
+
return /^[\s\S]*$/;
|
|
85
|
+
|
|
86
|
+
default:
|
|
87
|
+
return /^[\s\S]*$/;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const cleanInput = (input: string) => {
|
|
92
|
+
let result = input;
|
|
93
|
+
|
|
94
|
+
const regex = getCharacterRegex(characterType);
|
|
95
|
+
|
|
96
|
+
if (!regex.test(result)) {
|
|
97
|
+
result = result
|
|
98
|
+
.split("")
|
|
99
|
+
.filter((char) => regex.test(char))
|
|
100
|
+
.join("");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (letterCase === "uppercase") {
|
|
104
|
+
result = result.toUpperCase();
|
|
105
|
+
} else if (letterCase === "lowercase") {
|
|
106
|
+
result = result.toLowerCase();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return result;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
if (loading) {
|
|
113
|
+
return <Skeleton label={label} rows={rows} />;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Stack gap="10px">
|
|
118
|
+
{label && <InputLabel required={required}>{label}</InputLabel>}
|
|
119
|
+
|
|
120
|
+
<MuiTextField
|
|
121
|
+
disabled={disabled}
|
|
122
|
+
required={required}
|
|
123
|
+
fullWidth
|
|
124
|
+
onKeyDown={handleKeyDown}
|
|
125
|
+
placeholder={placeholder || label}
|
|
126
|
+
type={type}
|
|
127
|
+
inputProps={{
|
|
128
|
+
min: 0,
|
|
129
|
+
}}
|
|
130
|
+
error={Boolean(error)}
|
|
131
|
+
helperText={error?.message}
|
|
132
|
+
onChange={(event) => {
|
|
133
|
+
let value = event.target.value || null;
|
|
134
|
+
|
|
135
|
+
if (typeof value === "string" && value.trim() === "") {
|
|
136
|
+
value = null;
|
|
137
|
+
} else if (!isTrimStartDisabled && typeof value === "string") {
|
|
138
|
+
value = value.trimStart();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const cleanedVal = value && cleanInput(value);
|
|
142
|
+
|
|
143
|
+
if (value !== cleanedVal) {
|
|
144
|
+
const errorMessage = characterTypeMessages[characterType];
|
|
145
|
+
|
|
146
|
+
if (setError) {
|
|
147
|
+
setError(name, { type: "manual", message: errorMessage });
|
|
148
|
+
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (value && type === "number") {
|
|
154
|
+
onChange(Number(value));
|
|
155
|
+
} else if (isCapitalize) {
|
|
156
|
+
onChange(cleanedVal ? cleanedVal.toUpperCase() : null);
|
|
157
|
+
} else {
|
|
158
|
+
onChange(cleanedVal);
|
|
159
|
+
}
|
|
160
|
+
}}
|
|
161
|
+
value={typeof value === "string" ? value.trimStart() : (value ?? "")}
|
|
162
|
+
{...restField}
|
|
163
|
+
{...inputFieldProps}
|
|
164
|
+
/>
|
|
165
|
+
</Stack>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TextField";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Skeleton as MuiSkeleton, Stack } from "@mui/material";
|
|
2
|
+
|
|
3
|
+
export const Skeleton = ({ label }: { label?: string }) => {
|
|
4
|
+
return (
|
|
5
|
+
<Stack gap="10px" flex={1}>
|
|
6
|
+
{label && (
|
|
7
|
+
<MuiSkeleton
|
|
8
|
+
width={120}
|
|
9
|
+
height="23px"
|
|
10
|
+
sx={{
|
|
11
|
+
transform: "scale(1)",
|
|
12
|
+
}}
|
|
13
|
+
/>
|
|
14
|
+
)}
|
|
15
|
+
<MuiSkeleton
|
|
16
|
+
height="40px"
|
|
17
|
+
width="100%"
|
|
18
|
+
sx={{
|
|
19
|
+
transform: "scale(1)",
|
|
20
|
+
}}
|
|
21
|
+
/>
|
|
22
|
+
</Stack>
|
|
23
|
+
);
|
|
24
|
+
};
|