@campxdev/react-blueprint 1.5.9 → 1.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "1.5.9",
3
+ "version": "1.6.0",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -26,9 +26,9 @@ export const RightIcon = ({ size = 16 }) => {
26
26
  d="M0,5.363,2.682,2.682,0,0"
27
27
  transform="translate(8.045)"
28
28
  fill="none"
29
- stroke-linecap="round"
30
- stroke-linejoin="round"
31
- stroke-width="1.5"
29
+ strokeLinecap="round"
30
+ strokeLinejoin="round"
31
+ strokeWidth="1.5"
32
32
  />
33
33
  <path
34
34
  id="Vector-2"
@@ -36,9 +36,9 @@ export const RightIcon = ({ size = 16 }) => {
36
36
  d="M0,0H10.653"
37
37
  transform="translate(0 2.682)"
38
38
  fill="none"
39
- stroke-linecap="round"
40
- stroke-linejoin="round"
41
- stroke-width="1.5"
39
+ strokeLinecap="round"
40
+ strokeLinejoin="round"
41
+ strokeWidth="1.5"
42
42
  />
43
43
  </g>
44
44
  <path
@@ -47,9 +47,9 @@ export const RightIcon = ({ size = 16 }) => {
47
47
  d="M0,16.76A8.015,8.015,0,0,0,8.38,8.38,8.015,8.015,0,0,0,0,0"
48
48
  transform="translate(12.246 3.62)"
49
49
  fill="none"
50
- stroke-linecap="round"
51
- stroke-linejoin="round"
52
- stroke-width="1.5"
50
+ strokeLinecap="round"
51
+ strokeLinejoin="round"
52
+ strokeWidth="1.5"
53
53
  />
54
54
  <path
55
55
  id="Vector-4"
@@ -160,6 +160,7 @@ export const Card = ({
160
160
  <StyledButton
161
161
  variant="text"
162
162
  onClick={handleClick}
163
+ sx={footer.buttonProps}
163
164
  endIcon={footer?.endIcon ?? <ChevronRight />}
164
165
  >
165
166
  {footer?.buttonText ?? 'View'}
@@ -16,12 +16,7 @@ import { v4 } from 'uuid';
16
16
  import { DataTable, DataTableProps, Icons } from '../../export';
17
17
 
18
18
  export type EditableDataTableProps = {
19
- limit?: number;
20
- offset?: number;
21
- totalCount?: number;
22
19
  hideDelete?: boolean;
23
- onPageChange?: (page: number) => void;
24
- onLimitChange?: (limit: number) => void;
25
20
  onChange: (rows: GridValidRowModel) => void;
26
21
  onSave?: (params: any) => void;
27
22
  onDelete?: (params: any) => void;
@@ -40,11 +40,10 @@ function FormActions({
40
40
  return (
41
41
  <Stack
42
42
  direction="row"
43
- padding={2}
44
- gap={2.5}
45
43
  borderTop={
46
44
  showTopBorder ? `1px solid ${theme.palette.border.primary}` : 'none'
47
45
  }
46
+ sx={{ p: '12px 16px' }}
48
47
  {...stackProps}
49
48
  >
50
49
  {defaultSubmitProps.show && (
@@ -1,10 +1,11 @@
1
+ import { Stack } from '@mui/material';
1
2
  import { TextFieldProps } from '@mui/material/TextField';
2
3
  import React, { ReactElement, ReactNode, isValidElement } from 'react';
3
- import { Control, Controller } from 'react-hook-form';
4
+ import { Control, Controller, FieldValues, Path } from 'react-hook-form';
4
5
  import FormActions, { FormActionsProps } from '../FormActions/FormActions';
5
6
 
6
- interface FormControlWrapperProps {
7
- control: Control<any>;
7
+ interface FormControlWrapperProps<T extends FieldValues = FieldValues> {
8
+ control: Control<T>;
8
9
  children: ReactNode;
9
10
  formActionProps?: FormActionsProps;
10
11
  }
@@ -14,19 +15,19 @@ type FormElementProps = {
14
15
  loading?: boolean;
15
16
  } & TextFieldProps;
16
17
 
17
- type ControlledElementProps = {
18
- name: string;
18
+ type ControlledElementProps<T extends FieldValues = FieldValues> = {
19
+ name: Path<T>;
19
20
  error?: boolean;
20
21
  helperText?: ReactNode;
21
22
  children?: ReactNode;
22
23
  [key: string]: any;
23
24
  } & TextFieldProps;
24
25
 
25
- export function FormControlWrapper({
26
+ export function FormControlWrapper<T extends FieldValues = FieldValues>({
26
27
  control,
27
28
  children,
28
29
  formActionProps,
29
- }: FormControlWrapperProps) {
30
+ }: FormControlWrapperProps<T>) {
30
31
  const wrapWithController = (
31
32
  element: ReactElement<any>,
32
33
  ): ReactElement<any> => {
@@ -36,7 +37,7 @@ export function FormControlWrapper({
36
37
  name,
37
38
  children: childElements,
38
39
  ...restProps
39
- } = element.props as ControlledElementProps;
40
+ } = element.props as ControlledElementProps<T>;
40
41
 
41
42
  if (name) {
42
43
  return (
@@ -77,8 +78,9 @@ export function FormControlWrapper({
77
78
 
78
79
  return (
79
80
  <>
80
- {React.Children.map(children as any, wrapWithController) || null}
81
-
81
+ <Stack sx={{ m: '8px' }}>
82
+ {React.Children.map(children as any, wrapWithController) || null}
83
+ </Stack>
82
84
  {formActionProps && <FormActions {...formActionProps} showTopBorder />}
83
85
  </>
84
86
  );
@@ -50,7 +50,7 @@ export type SingleSelectProps = {
50
50
  isFloat?: boolean;
51
51
  };
52
52
  dbLabelProps?: { labelKey: string; subLabelKey?: string };
53
- onChange: (value: any) => void;
53
+ onChange?: (value: any) => void;
54
54
  error?: any;
55
55
  helperText?: string;
56
56
  } & Omit<
@@ -423,6 +423,11 @@ export const SingleSelect = ({
423
423
  />
424
424
  );
425
425
  }
426
+
427
+ if (!onChange) {
428
+ return <Typography>onChange Missing</Typography>;
429
+ }
430
+
426
431
  return (
427
432
  <MuiAutocomplete
428
433
  {...restProps}
@@ -1,10 +1,9 @@
1
1
  import { Avatar, Box, Stack, Typography, useTheme } from '@mui/material';
2
2
  import { ReactNode } from 'react';
3
- import DialogButton from '../../../Navigation/DialogButton/DialogButton';
4
3
  import { DropdownMenu } from '../../../Navigation/DropDownMenu/DropDownMenu';
5
4
  import { DropdownMenuItem } from '../../../Navigation/DropDownMenu/DropdownMenuItem';
6
5
  import { StyledMenuItem } from '../../../Navigation/DropDownMenu/styles';
7
- import { Icons } from '../../../export';
6
+ import { DialogButton, Icons } from '../../../export';
8
7
  import SwitchInstitution from './SwitchInstitution';
9
8
 
10
9
  const getStartingLetters = (text: string) => {
@@ -30,7 +30,7 @@ export const Breadcrumbs = ({ pathTrimCount, ...rest }: BreadcrumbsProps) => {
30
30
  {currentPathArray?.map((item, index) => {
31
31
  basePath = basePath + `/${item}`;
32
32
  return index === currentPathArray.length - 1 ? (
33
- <Typography variant="subtitle2">
33
+ <Typography key={index} variant="subtitle2">
34
34
  {_.startCase(decodeURIComponent(item).split(specialCharacter)[0])}
35
35
  </Typography>
36
36
  ) : (
@@ -18,12 +18,12 @@ export type DialogButtonProps = {
18
18
  onDialogClose?: () => void;
19
19
  } & Omit<DialogProps, 'open' | 'onClose'>;
20
20
 
21
- export default function DialogButton({
21
+ export const DialogButton = ({
22
22
  onDialogClose,
23
23
  onDialogOpen,
24
24
  anchor,
25
25
  ...props
26
- }: DialogButtonProps) {
26
+ }: DialogButtonProps) => {
27
27
  const [open, setOpen] = useState(false);
28
28
 
29
29
  const onClose = () => {
@@ -49,4 +49,4 @@ export default function DialogButton({
49
49
  />
50
50
  </>
51
51
  );
52
- }
52
+ };
@@ -1,6 +1,7 @@
1
1
  import { Box, Button, Typography } from '@mui/material';
2
2
  import { Meta, StoryObj } from '@storybook/react/*';
3
- import DialogButton, {
3
+ import {
4
+ DialogButton,
4
5
  DialogButtonProps,
5
6
  } from '../../components/Navigation/DialogButton/DialogButton';
6
7
 
@@ -148,7 +148,6 @@ export const getCommonTheme = (mode: Theme) => {
148
148
  styleOverrides: {
149
149
  root: {
150
150
  padding: '0px',
151
- margin: '16px',
152
151
  },
153
152
  },
154
153
  },
@@ -263,6 +262,7 @@ export const getCommonTheme = (mode: Theme) => {
263
262
  root: {
264
263
  textTransform: 'none',
265
264
  padding: '10px 20px ',
265
+ minWidth: '120px ',
266
266
  maxHeight: '40px ',
267
267
  borderRadius: '5px ',
268
268
  boxShadow: 'none ',