@sonardigital/carbon-ui 1.1.61 → 1.1.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +13 -3
  2. package/package.json +76 -62
  3. package/src/App.css +17 -17
  4. package/src/components/atoms/alert/Alert.tsx +31 -27
  5. package/src/components/atoms/cursor/Cursor.tsx +10 -6
  6. package/src/components/form/fields/FormDatePicker.tsx +26 -17
  7. package/src/components/form/fields/FormInput.tsx +22 -16
  8. package/src/components/form/fields/FormMultiselect.tsx +40 -38
  9. package/src/components/form/fields/FormPassword.tsx +46 -38
  10. package/src/components/form/fields/FormSelect.tsx +46 -28
  11. package/src/components/form/fields/FormSwitch.tsx +36 -21
  12. package/src/components/form/fields/FormTextArea.tsx +36 -25
  13. package/src/components/form/fields/form-list/FormList.tsx +84 -72
  14. package/src/components/form/fields/form-list/Row.tsx +25 -25
  15. package/src/components/form/layout/FormError.tsx +11 -7
  16. package/src/components/form/layout/FormLabel.tsx +12 -12
  17. package/src/components/inputs/DatePicker.tsx +102 -98
  18. package/src/components/inputs/MultiselectAutocomplete.tsx +92 -75
  19. package/src/components/inputs/SelectAutocomplete.tsx +58 -44
  20. package/src/components/inputs/Switch.tsx +8 -8
  21. package/src/components/layout/bottom-navigation/BottomNavigation.tsx +10 -6
  22. package/src/components/layout/delay/index.tsx +11 -11
  23. package/src/components/layout/drawer/components/DrawerContent.tsx +10 -7
  24. package/src/components/layout/drawer/components/DrawerTrigger.tsx +19 -11
  25. package/src/components/layout/drawer/hooks/useDrawer.ts +16 -16
  26. package/src/components/layout/drawer/hooks/useDrawerContext.ts +5 -5
  27. package/src/components/layout/drawer/provider/DrawerContext.ts +11 -10
  28. package/src/components/layout/drawer/provider/DrawerProvider.tsx +17 -12
  29. package/src/components/layout/dropdown/components/DropdownItem.tsx +12 -0
  30. package/src/components/layout/dropdown/components/DropdownPopover.tsx +27 -0
  31. package/src/components/layout/dropdown/components/DropdownTrigger.tsx +38 -0
  32. package/src/components/layout/dropdown/hooks/useDropdown.ts +22 -0
  33. package/src/components/layout/dropdown/hooks/useDropdownContext.ts +13 -0
  34. package/src/components/layout/dropdown/provider/DropdownContext.ts +22 -0
  35. package/src/components/layout/dropdown/provider/DropdownProvider.tsx +35 -0
  36. package/src/components/layout/error-boundary/index.tsx +40 -40
  37. package/src/components/layout/index.ts +3 -3
  38. package/src/components/layout/modal/components/ModalContent.tsx +47 -0
  39. package/src/components/layout/modal/components/ModalTrigger.tsx +19 -0
  40. package/src/components/layout/modal/hooks/useModal.ts +19 -0
  41. package/src/components/layout/{Modal → modal}/hooks/useModalContext.ts +5 -5
  42. package/src/components/layout/{Modal → modal}/provider/ModalContext.ts +10 -8
  43. package/src/components/layout/{Modal → modal}/provider/ModalProvider.tsx +7 -5
  44. package/src/components/layout/multisteps/components/MultistepsBar.tsx +32 -22
  45. package/src/components/layout/multisteps/components/MultistepsBottomSteps.tsx +12 -8
  46. package/src/components/layout/multisteps/components/MultistepsContent.tsx +6 -6
  47. package/src/components/layout/multisteps/components/MultistepsStep.tsx +22 -20
  48. package/src/components/layout/multisteps/components/MultistepsStepper.tsx +63 -48
  49. package/src/components/layout/multisteps/hooks/useMultisteps.ts +55 -52
  50. package/src/components/layout/multisteps/hooks/useMultistepsContext.ts +12 -7
  51. package/src/components/layout/multisteps/models/index.ts +3 -0
  52. package/src/components/layout/multisteps/provider/MultistepsContext.ts +18 -17
  53. package/src/components/layout/multisteps/provider/MultistepsProvider.tsx +15 -10
  54. package/src/components/layout/scroll-to-top/ScrollToTop.tsx +16 -0
  55. package/src/hooks/useAccordion.ts +7 -7
  56. package/src/index.css +3 -3
  57. package/src/provider/CarbonProvider.tsx +5 -5
  58. package/src/theme/constants/components.ts +475 -475
  59. package/src/theme/constants/palette.ts +39 -39
  60. package/src/theme/constants/typography.ts +44 -44
  61. package/src/theme/theme.ts +7 -7
  62. package/src/components/layout/Dropdown/components/DropdownItem.tsx +0 -8
  63. package/src/components/layout/Dropdown/components/DropdownPopover.tsx +0 -24
  64. package/src/components/layout/Dropdown/components/DropdownTrigger.tsx +0 -35
  65. package/src/components/layout/Dropdown/hooks/useDropdown.ts +0 -22
  66. package/src/components/layout/Dropdown/hooks/useDropdownContext.ts +0 -11
  67. package/src/components/layout/Dropdown/provider/DropdownContext.ts +0 -21
  68. package/src/components/layout/Dropdown/provider/DropdownProvider.tsx +0 -28
  69. package/src/components/layout/Modal/components/ModalContent.tsx +0 -44
  70. package/src/components/layout/Modal/components/ModalTrigger.tsx +0 -17
  71. package/src/components/layout/Modal/hooks/useModal.ts +0 -19
  72. package/src/components/layout/ScrollToTop/ScrollToTop.tsx +0 -12
  73. /package/src/components/layout/{Dropdown → dropdown}/components/index.ts +0 -0
  74. /package/src/components/layout/{Dropdown → dropdown}/hooks/index.ts +0 -0
  75. /package/src/components/layout/{Dropdown → dropdown}/index.ts +0 -0
  76. /package/src/components/layout/{Dropdown → dropdown}/provider/index.ts +0 -0
  77. /package/src/components/layout/{Modal → modal}/components/index.ts +0 -0
  78. /package/src/components/layout/{Modal → modal}/hooks/index.ts +0 -0
  79. /package/src/components/layout/{Modal → modal}/index.ts +0 -0
  80. /package/src/components/layout/{Modal → modal}/provider/index.ts +0 -0
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Carbon-ui
2
2
 
3
-
4
-
5
3
  ## Getting started
6
4
 
7
5
  To make it easy for you to get started with GitLab, here's a list of recommended next steps.
@@ -42,7 +40,7 @@ Use the built-in continuous integration in GitLab.
42
40
  - [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
41
  - [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
42
 
45
- ***
43
+ ---
46
44
 
47
45
  # Editing this README
48
46
 
@@ -53,30 +51,39 @@ When you're ready to make this README your own, just edit this file and use the
53
51
  Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
54
52
 
55
53
  ## Name
54
+
56
55
  Choose a self-explaining name for your project.
57
56
 
58
57
  ## Description
58
+
59
59
  Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
60
 
61
61
  ## Badges
62
+
62
63
  On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
63
64
 
64
65
  ## Visuals
66
+
65
67
  Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
66
68
 
67
69
  ## Installation
70
+
68
71
  Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
69
72
 
70
73
  ## Usage
74
+
71
75
  Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
72
76
 
73
77
  ## Support
78
+
74
79
  Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
75
80
 
76
81
  ## Roadmap
82
+
77
83
  If you have ideas for releases in the future, it is a good idea to list them in the README.
78
84
 
79
85
  ## Contributing
86
+
80
87
  State if you are open to contributions and what your requirements are for accepting them.
81
88
 
82
89
  For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
@@ -84,10 +91,13 @@ For people who want to make changes to your project, it's helpful to have some d
84
91
  You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
85
92
 
86
93
  ## Authors and acknowledgment
94
+
87
95
  Show your appreciation to those who have contributed to the project.
88
96
 
89
97
  ## License
98
+
90
99
  For open source projects, say how it is licensed.
91
100
 
92
101
  ## Project status
102
+
93
103
  If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
package/package.json CHANGED
@@ -1,64 +1,78 @@
1
1
  {
2
- "name": "@sonardigital/carbon-ui",
3
- "version": "1.1.61",
4
- "description": "",
5
- "main": "src/index.ts",
6
- "files": [
7
- "src/**/*"
8
- ],
9
- "scripts": {
10
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
11
- "test": "echo \"Error: no test specified\" && exit 1",
12
- "format": "prettier --write './src/**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc",
13
- "prepare": "husky",
14
- "precommit": "npm run format && tsc --noEmit && npm run lint"
15
- },
16
- "keywords": [],
17
- "author": "sonar",
18
- "license": "ISC",
19
- "devDependencies": {
20
- "@tsconfig/recommended": "^1.0.6",
21
- "@types/js-cookie": "^3.0.6",
22
- "@types/react": "^18.3.21",
23
- "globals": "^15.6.0"
24
- },
25
- "lint-staged": {
26
- "*.{js,jsx,ts,tsx}": [
27
- "prettier --write",
28
- "eslint --fix",
29
- "git add"
30
- ],
31
- "*.{html,css,less,ejs,json,md}": [
32
- "prettier --write",
33
- "git add"
34
- ]
35
- },
36
- "dependencies": {
37
- "@emotion/react": "^11.14.0",
38
- "@emotion/styled": "^11.14.1",
39
- "@mui/icons-material": "^7.3.2",
40
- "@mui/material": "^7.3.2",
41
- "@mui/x-date-pickers": "^8.12.0",
42
- "@sonardigital/carbon-ui": "^1.1.18",
43
- "@typescript-eslint/eslint-plugin": "^7.18.0",
44
- "@typescript-eslint/parser": "^7.18.0",
45
- "dayjs": "^1.11.18",
46
- "eslint": "^8.57.0",
47
- "eslint-config-prettier": "^9.1.0",
48
- "eslint-plugin-import": "^2.31.0",
49
- "eslint-plugin-prettier": "^5.4.0",
50
- "eslint-plugin-react": "^7.34.3",
51
- "eslint-plugin-react-hooks": "^4.6.2",
52
- "eslint-plugin-react-refresh": "^0.4.7",
53
- "eslint-plugin-storybook": "^0.8.0",
54
- "husky": "^9.1.7",
55
- "lint-staged": "^16.0.0",
56
- "prettier": "^3.5.3",
57
- "react": "^19.1.0",
58
- "react-hook-form": "^7.63.0",
59
- "react-icons": "^5.5.0",
60
- "react-router": "^7.9.4",
61
- "react-router-dom": "^7.6.0",
62
- "typescript": "^5.4.5"
63
- }
2
+ "name": "@sonardigital/carbon-ui",
3
+ "version": "1.1.67",
4
+ "description": "",
5
+ "main": "src/index.ts",
6
+ "files": [
7
+ "src/**/*"
8
+ ],
9
+ "scripts": {
10
+ "lint": "eslint .",
11
+ "test": "echo \"Error: no test specified\" && exit 1",
12
+ "format": "npx prettier --write .",
13
+ "prepare": "husky",
14
+ "precommit": "npm run format && tsc --noEmit && npm run lint",
15
+ "commit": "git add . && npx cz"
16
+ },
17
+ "keywords": [],
18
+ "author": "sonar",
19
+ "license": "ISC",
20
+ "devDependencies": {
21
+ "@commitlint/cli": "^19.8.1",
22
+ "@commitlint/config-conventional": "^19.8.1",
23
+ "@eslint/js": "^9.39.1",
24
+ "@tsconfig/recommended": "^1.0.6",
25
+ "@types/js-cookie": "^3.0.6",
26
+ "@types/react": "^18.3.21",
27
+ "@typescript-eslint/eslint-plugin": "^8.48.0",
28
+ "@typescript-eslint/parser": "^8.48.0",
29
+ "commitizen": "^4.3.1",
30
+ "cz-conventional-changelog": "^3.3.0",
31
+ "eslint": "^9.39.1",
32
+ "eslint-config-prettier": "^10.1.8",
33
+ "eslint-plugin-import": "^2.32.0",
34
+ "eslint-plugin-prettier": "^5.5.4",
35
+ "eslint-plugin-react-hooks": "^7.0.1",
36
+ "eslint-plugin-react-refresh": "^0.4.24",
37
+ "eslint-plugin-sonardigital": "^1.0.10",
38
+ "globals": "^15.6.0",
39
+ "inquirer": "^8.2.7",
40
+ "prettier": "^3.7.1",
41
+ "typescript-eslint": "^8.48.0"
42
+ },
43
+ "lint-staged": {
44
+ "*.{js,jsx,ts,tsx}": [
45
+ "prettier --write",
46
+ "eslint --fix",
47
+ "git add"
48
+ ],
49
+ "*.{html,css,less,ejs,json,md}": [
50
+ "prettier --write",
51
+ "git add"
52
+ ]
53
+ },
54
+ "dependencies": {
55
+ "@emotion/react": "^11.14.0",
56
+ "@emotion/styled": "^11.14.1",
57
+ "@mui/icons-material": "^7.3.2",
58
+ "@mui/material": "^7.3.2",
59
+ "@mui/x-date-pickers": "^8.12.0",
60
+ "@sonardigital/cli": "^1.6.4",
61
+ "dayjs": "^1.11.18",
62
+ "eslint-plugin-react": "^7.34.3",
63
+ "eslint-plugin-storybook": "^0.8.0",
64
+ "husky": "^9.1.7",
65
+ "lint-staged": "^16.0.0",
66
+ "react": "^19.1.0",
67
+ "react-hook-form": "^7.63.0",
68
+ "react-icons": "^5.5.0",
69
+ "react-router": "^7.9.4",
70
+ "react-router-dom": "^7.6.0",
71
+ "typescript": "^5.4.5"
72
+ },
73
+ "config": {
74
+ "commitizen": {
75
+ "path": "./cz.cjs"
76
+ }
77
+ }
64
78
  }
package/src/App.css CHANGED
@@ -1,34 +1,34 @@
1
1
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');
2
2
 
3
3
  a {
4
- text-decoration: none;
5
- color: inherit;
6
- transition: 0.2s;
4
+ text-decoration: none;
5
+ color: inherit;
6
+ transition: 0.2s;
7
7
  }
8
8
 
9
9
  a:hover {
10
- text-decoration: underline;
10
+ text-decoration: underline;
11
11
  }
12
12
 
13
13
  textarea {
14
- font-family: 'Inter', sans-serif;
15
- font-size: 1.6rem;
16
- line-height: 2.4rem;
17
- padding: 1.6rem;
18
- width: auto;
19
- resize: none;
20
- border: 1px solid #c4c4c4;
21
- border-radius: 0px;
14
+ font-family: 'Inter', sans-serif;
15
+ font-size: 1.6rem;
16
+ line-height: 2.4rem;
17
+ padding: 1.6rem;
18
+ width: auto;
19
+ resize: none;
20
+ border: 1px solid #c4c4c4;
21
+ border-radius: 0px;
22
22
  }
23
23
 
24
24
  textarea:hover {
25
- border-color: #000;
26
- opacity: 0.8;
25
+ border-color: #000;
26
+ opacity: 0.8;
27
27
  }
28
28
 
29
29
  textarea:active,
30
30
  textarea:focus {
31
- border-color: transparent;
32
- outline: 2px solid #000;
33
- opacity: 0.8;
31
+ border-color: transparent;
32
+ outline: 2px solid #000;
33
+ opacity: 0.8;
34
34
  }
@@ -2,34 +2,38 @@ import React from 'react';
2
2
  import { Alert as MuiAlert, Typography, useTheme } from '@mui/material';
3
3
 
4
4
  interface BannerAlertAlertProps {
5
- severity: 'success' | 'info' | 'warning' | 'error';
6
- actions?: React.ReactNode;
7
- children: React.ReactNode;
5
+ severity: 'success' | 'info' | 'warning' | 'error';
6
+ actions?: React.ReactNode;
7
+ children: React.ReactNode;
8
8
  }
9
9
 
10
- export function BannerAlert({ severity, actions, children }: BannerAlertAlertProps): React.ReactElement {
11
- const theme = useTheme();
10
+ export function BannerAlert({
11
+ severity,
12
+ actions,
13
+ children,
14
+ }: BannerAlertAlertProps): React.ReactElement {
15
+ const theme = useTheme();
12
16
 
13
- return (
14
- <MuiAlert
15
- severity={severity}
16
- action={actions}
17
- variant="filled"
18
- icon={false}
19
- sx={{
20
- alignItems: 'center',
21
- minWidth: 350,
22
- boxShadow: 3,
23
- bgcolor: theme.palette?.[severity].light,
24
- }}
25
- >
26
- {typeof children === 'string' ? (
27
- <Typography variant="body2" fontWeight={400} color={severity}>
28
- {children}
29
- </Typography>
30
- ) : (
31
- children
32
- )}
33
- </MuiAlert>
34
- );
17
+ return (
18
+ <MuiAlert
19
+ severity={severity}
20
+ action={actions}
21
+ variant="filled"
22
+ icon={false}
23
+ sx={{
24
+ alignItems: 'center',
25
+ minWidth: 350,
26
+ boxShadow: 3,
27
+ bgcolor: theme.palette?.[severity].light,
28
+ }}
29
+ >
30
+ {typeof children === 'string' ? (
31
+ <Typography variant="body2" fontWeight={400} color={severity}>
32
+ {children}
33
+ </Typography>
34
+ ) : (
35
+ children
36
+ )}
37
+ </MuiAlert>
38
+ );
35
39
  }
@@ -1,10 +1,14 @@
1
1
  import { Stack, StackProps } from '@mui/material';
2
2
  import React from 'react';
3
3
 
4
- export function Cursor({ children, sx, ...props }: StackProps): React.ReactElement {
5
- return (
6
- <Stack sx={{ cursor: 'pointer', ...sx }} {...props}>
7
- {children}
8
- </Stack>
9
- );
4
+ export function Cursor({
5
+ children,
6
+ sx,
7
+ ...props
8
+ }: StackProps): React.ReactElement {
9
+ return (
10
+ <Stack sx={{ cursor: 'pointer', ...sx }} {...props}>
11
+ {children}
12
+ </Stack>
13
+ );
10
14
  }
@@ -4,23 +4,32 @@ import { FormLabel } from '../layout';
4
4
  import { FormError } from '../layout/FormError';
5
5
  import { DatePicker, DatePickerProps } from '../../inputs/DatePicker';
6
6
 
7
- interface FormDatePickerProps extends Omit<DatePickerProps, 'value' | 'onChange'> {
8
- name: string;
9
- label: string;
7
+ interface FormDatePickerProps extends Omit<
8
+ DatePickerProps,
9
+ 'value' | 'onChange'
10
+ > {
11
+ name: string;
12
+ label: string;
10
13
  }
11
14
 
12
- export function FormDatePicker({ name, label, ...props }: FormDatePickerProps): React.ReactElement {
13
- return (
14
- <Controller
15
- name={name}
16
- render={({ field, fieldState }) => (
17
- <FormLabel label={label}>
18
- <Stack gap={0.8}>
19
- <DatePicker {...field} {...props} />
20
- {fieldState.error && <FormError label={fieldState.error?.message ?? ''} />}
21
- </Stack>
22
- </FormLabel>
23
- )}
24
- />
25
- );
15
+ export function FormDatePicker({
16
+ name,
17
+ label,
18
+ ...props
19
+ }: FormDatePickerProps): React.ReactElement {
20
+ return (
21
+ <Controller
22
+ name={name}
23
+ render={({ field, fieldState }) => (
24
+ <FormLabel label={label}>
25
+ <Stack gap={0.8}>
26
+ <DatePicker {...field} {...props} />
27
+ {fieldState.error && (
28
+ <FormError label={fieldState.error?.message ?? ''} />
29
+ )}
30
+ </Stack>
31
+ </FormLabel>
32
+ )}
33
+ />
34
+ );
26
35
  }
@@ -4,22 +4,28 @@ import { FormLabel } from '../layout';
4
4
  import { FormError } from '../layout/FormError';
5
5
 
6
6
  interface FormInputProps extends TextFieldProps<'standard'> {
7
- name: string;
8
- label: string;
7
+ name: string;
8
+ label: string;
9
9
  }
10
10
 
11
- export function FormInput({ name, label, ...props }: FormInputProps): React.ReactElement {
12
- return (
13
- <Controller
14
- name={name}
15
- render={({ field, fieldState }) => (
16
- <FormLabel label={label}>
17
- <Stack gap={0.8}>
18
- <TextField {...field} {...props} />
19
- {fieldState.error && <FormError label={fieldState.error?.message ?? ''} />}
20
- </Stack>
21
- </FormLabel>
22
- )}
23
- />
24
- );
11
+ export function FormInput({
12
+ name,
13
+ label,
14
+ ...props
15
+ }: FormInputProps): React.ReactElement {
16
+ return (
17
+ <Controller
18
+ name={name}
19
+ render={({ field, fieldState }) => (
20
+ <FormLabel label={label}>
21
+ <Stack gap={0.8}>
22
+ <TextField {...field} {...props} />
23
+ {fieldState.error && (
24
+ <FormError label={fieldState.error?.message ?? ''} />
25
+ )}
26
+ </Stack>
27
+ </FormLabel>
28
+ )}
29
+ />
30
+ );
25
31
  }
@@ -4,46 +4,48 @@ import { FormLabel } from '../layout';
4
4
  import { FormError } from '../layout/FormError';
5
5
  import { MultiselectAutocomplete } from '../../inputs';
6
6
 
7
- interface MultiselectAutocompleteProps
8
- extends Omit<
9
- // eslint-disable-next-line
10
- AutocompleteProps<any, false, false, false>,
11
- 'renderInput' | 'options' | 'value' | 'onChange'
12
- > {
13
- name: string;
14
- label: string;
15
- placeholder?: string;
16
- options?: { label: string; value: string | number }[];
17
- helperText?: string;
18
- fetchOptions?: () => Promise<{ label: string; value: string | number }[]>;
7
+ // eslint-disable-next-line
8
+ interface MultiselectAutocompleteProps extends Omit<
9
+ // eslint-disable-next-line
10
+ AutocompleteProps<any, false, false, false>,
11
+ 'renderInput' | 'options' | 'value' | 'onChange'
12
+ > {
13
+ name: string;
14
+ label: string;
15
+ placeholder?: string;
16
+ options?: { label: string; value: string | number }[];
17
+ helperText?: string;
18
+ fetchOptions?: () => Promise<{ label: string; value: string | number }[]>;
19
19
  }
20
20
 
21
21
  export function FormMultiselect({
22
- name,
23
- label,
24
- options,
25
- ...rest
22
+ name,
23
+ label,
24
+ options,
25
+ ...rest
26
26
  }: MultiselectAutocompleteProps): React.ReactElement {
27
- return (
28
- <Controller
29
- name={name}
30
- render={({ field, fieldState }) => {
31
- const { value, onChange } = field;
32
- return (
33
- <FormLabel label={label}>
34
- <Stack gap={0.8}>
35
- <MultiselectAutocomplete
36
- {...field}
37
- {...rest}
38
- options={options}
39
- value={value as (string | number)[]}
40
- onChange={onChange}
41
- />
42
- {fieldState.error && <FormError label={fieldState.error?.message ?? ''} />}
43
- </Stack>
44
- </FormLabel>
45
- );
46
- }}
47
- />
48
- );
27
+ return (
28
+ <Controller
29
+ name={name}
30
+ render={({ field, fieldState }) => {
31
+ const { value, onChange } = field;
32
+ return (
33
+ <FormLabel label={label}>
34
+ <Stack gap={0.8}>
35
+ <MultiselectAutocomplete
36
+ {...field}
37
+ {...rest}
38
+ options={options}
39
+ value={value as (string | number)[]}
40
+ onChange={onChange}
41
+ />
42
+ {fieldState.error && (
43
+ <FormError label={fieldState.error?.message ?? ''} />
44
+ )}
45
+ </Stack>
46
+ </FormLabel>
47
+ );
48
+ }}
49
+ />
50
+ );
49
51
  }
@@ -6,43 +6,51 @@ import { useState } from 'react';
6
6
  import RemoveRedEyeIcon from '@mui/icons-material/RemoveRedEye';
7
7
  import { Cursor } from '../../atoms';
8
8
 
9
- export function FormPassword({ name, label }: { name: string; label: string }): React.ReactElement {
10
- const [isVisible, setIsVisible] = useState(false);
11
- return (
12
- <Controller
13
- name={name}
14
- render={({ field, fieldState }) => (
15
- <FormLabel label={label}>
16
- <Stack gap={0.8}>
17
- <OutlinedInput
18
- sx={{ borderRadius: 1.5, width: '100%', height: 52 }}
19
- type={isVisible ? 'text' : 'password'}
20
- color="secondary"
21
- {...field}
22
- inputProps={{
23
- sx: {
24
- width: '100%',
25
- fontSize: '1.7rem',
26
- borderRadius: 3,
27
- },
28
- }}
29
- endAdornment={
30
- <Cursor>
31
- <RemoveRedEyeIcon
32
- sx={{
33
- width: 24,
34
- height: 24,
35
- opacity: isVisible ? 1 : 0.5,
36
- }}
37
- onClick={() => setIsVisible(!isVisible)}
9
+ export function FormPassword({
10
+ name,
11
+ label,
12
+ }: {
13
+ name: string;
14
+ label: string;
15
+ }): React.ReactElement {
16
+ const [isVisible, setIsVisible] = useState(false);
17
+ return (
18
+ <Controller
19
+ name={name}
20
+ render={({ field, fieldState }) => (
21
+ <FormLabel label={label}>
22
+ <Stack gap={0.8}>
23
+ <OutlinedInput
24
+ sx={{ borderRadius: 1.5, width: '100%', height: 52 }}
25
+ type={isVisible ? 'text' : 'password'}
26
+ color="secondary"
27
+ {...field}
28
+ inputProps={{
29
+ sx: {
30
+ width: '100%',
31
+ fontSize: '1.7rem',
32
+ borderRadius: 3,
33
+ },
34
+ }}
35
+ endAdornment={
36
+ <Cursor>
37
+ <RemoveRedEyeIcon
38
+ sx={{
39
+ width: 24,
40
+ height: 24,
41
+ opacity: isVisible ? 1 : 0.5,
42
+ }}
43
+ onClick={() => setIsVisible(!isVisible)}
44
+ />
45
+ </Cursor>
46
+ }
38
47
  />
39
- </Cursor>
40
- }
41
- />
42
- {fieldState.error && <FormError label={fieldState.error?.message ?? ''} />}
43
- </Stack>
44
- </FormLabel>
45
- )}
46
- />
47
- );
48
+ {fieldState.error && (
49
+ <FormError label={fieldState.error?.message ?? ''} />
50
+ )}
51
+ </Stack>
52
+ </FormLabel>
53
+ )}
54
+ />
55
+ );
48
56
  }