@groupeactual/ui-kit 1.7.9 → 1.7.10

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.
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { ModalProps } from '@/components/Modal/modal.interface';
3
- declare const Drawer: ({ title, open, onClose, component, footer, cardProps, size, ...props }: Omit<ModalProps, "withHeaderDivider" | "icon">) => React.JSX.Element;
2
+ import { DrawerProps } from '@/components/Modal/modal.interface';
3
+ declare const Drawer: ({ title, open, hideCloseButton, titleLeftComponent, footer, cardProps, size, children, onClose, ...props }: DrawerProps) => React.JSX.Element;
4
4
  export default Drawer;
@@ -10,13 +10,16 @@ export interface ModalProps extends Omit<ModalPropsMUI, 'component' | 'open' | '
10
10
  open: boolean;
11
11
  title?: string;
12
12
  size?: 'small' | 'large';
13
- component: ReactNode | null;
14
13
  footer?: ReactNode | null;
15
14
  cardProps?: Partial<CardProps>;
16
15
  className?: string;
17
16
  icon?: IconDefinition;
18
17
  onClose?: () => void;
19
18
  }
19
+ export interface DrawerProps extends Omit<ModalProps, 'icon'> {
20
+ titleLeftComponent?: ReactNode;
21
+ hideCloseButton?: boolean;
22
+ }
20
23
  export type DialogTitleProps<T extends OverridableTypeMap> = DefaultComponentProps<T> & {
21
24
  children?: ReactNode;
22
25
  icon?: IconDefinition | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groupeactual/ui-kit",
3
- "version": "1.7.9",
3
+ "version": "1.7.10",
4
4
  "type": "module",
5
5
  "description": "A simple template for a custom React component library",
6
6
  "main": "dist/cjs/index.js",
@@ -33,7 +33,7 @@
33
33
  "@mui/x-date-pickers": "7.15.0",
34
34
  "@mui/x-date-pickers-pro": "7.15.0",
35
35
  "styled-components": "^6.1.13",
36
- "@groupeactual/design-tokens": "1.7.9"
36
+ "@groupeactual/design-tokens": "1.7.10"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "rollup -c",
@@ -10,18 +10,20 @@ import {
10
10
  } from '@mui/material';
11
11
 
12
12
  import IconButton from '@/components/IconButton';
13
- import { ModalProps } from '@/components/Modal/modal.interface';
13
+ import { DrawerProps } from '@/components/Modal/modal.interface';
14
14
 
15
15
  const Drawer = ({
16
16
  title,
17
17
  open,
18
- onClose,
19
- component,
18
+ hideCloseButton,
19
+ titleLeftComponent,
20
20
  footer,
21
21
  cardProps,
22
22
  size = 'small',
23
+ children,
24
+ onClose,
23
25
  ...props
24
- }: Omit<ModalProps, 'withHeaderDivider' | 'icon'>) => {
26
+ }: DrawerProps) => {
25
27
  return (
26
28
  <DrawerMUI
27
29
  anchor="right"
@@ -55,19 +57,24 @@ const Drawer = ({
55
57
  >
56
58
  <CardHeader
57
59
  action={
58
- <IconButton
59
- aria-label="close"
60
- data-testid="close-button"
61
- onClick={() => onClose?.()}
62
- variant="table"
63
- size="medium"
64
- icon={faClose}
65
- />
60
+ !hideCloseButton ? (
61
+ <IconButton
62
+ aria-label="close"
63
+ data-testid="close-button"
64
+ onClick={() => onClose?.()}
65
+ variant="table"
66
+ size="medium"
67
+ icon={faClose}
68
+ />
69
+ ) : null
66
70
  }
67
71
  title={
68
72
  title ? (
69
73
  <Box display="flex">
70
- <Box mt="2px">{title}</Box>
74
+ <Box mt="2px">
75
+ {titleLeftComponent}
76
+ {title}
77
+ </Box>
71
78
  </Box>
72
79
  ) : (
73
80
  ''
@@ -76,7 +83,7 @@ const Drawer = ({
76
83
  subheader=""
77
84
  />
78
85
  <CardContent>
79
- <Box pb={footer ? '94px !important' : 0}>{component}</Box>
86
+ <Box pb={footer ? '94px !important' : 0}>{children}</Box>
80
87
  </CardContent>
81
88
  {footer}
82
89
  </Card>
@@ -17,13 +17,16 @@ export interface ModalProps
17
17
  open: boolean;
18
18
  title?: string;
19
19
  size?: 'small' | 'large';
20
- component: ReactNode | null;
21
20
  footer?: ReactNode | null;
22
21
  cardProps?: Partial<CardProps>;
23
22
  className?: string;
24
23
  icon?: IconDefinition;
25
24
  onClose?: () => void;
26
25
  }
26
+ export interface DrawerProps extends Omit<ModalProps, 'icon'> {
27
+ titleLeftComponent?: ReactNode;
28
+ hideCloseButton?: boolean;
29
+ }
27
30
 
28
31
  export type DialogTitleProps<T extends OverridableTypeMap> =
29
32
  DefaultComponentProps<T> & {