@groupeactual/ui-kit 1.5.2 → 1.6.0-beta.4

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 (75) hide show
  1. package/dist/cjs/index.js +16 -16
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/DesignSystemProvider.d.ts +3 -3
  4. package/dist/cjs/types/components/Accordion/Accordion.d.ts +3 -1
  5. package/dist/cjs/types/components/Chip/Chip.d.ts +3 -3
  6. package/dist/cjs/types/components/Datatable/Datatable.d.ts +1 -1
  7. package/dist/cjs/types/components/Datatable/DatatableCellRender.d.ts +0 -1
  8. package/dist/cjs/types/components/Datatable/datatable.interface.d.ts +1 -1
  9. package/dist/cjs/types/components/Datatable/use-pagination-props.hook.d.ts +1 -1
  10. package/dist/cjs/types/components/EmbbededNotification/EmbeddedNotification.d.ts +1 -1
  11. package/dist/cjs/types/components/Form/DatePicker/DatePicker.d.ts +5 -4
  12. package/dist/cjs/types/components/Form/MultiSelect/MultiSelect.d.ts +9 -4
  13. package/dist/cjs/types/components/Form/Select/Select.d.ts +8 -3
  14. package/dist/cjs/types/components/Form/TextField/TextField.d.ts +5 -4
  15. package/dist/cjs/types/components/IconButton/IconButton.d.ts +4 -1
  16. package/dist/cjs/types/components/IconProvider/IconProvider.d.ts +0 -1
  17. package/dist/cjs/types/components/Modal/Dialog/Dialog.d.ts +1 -1
  18. package/dist/cjs/types/components/Modal/Drawer/Drawer.d.ts +1 -1
  19. package/dist/cjs/types/components/Modal/modal.interface.d.ts +4 -4
  20. package/dist/cjs/types/components/NotistackAdapter/NotistackAdapter.d.ts +1 -2
  21. package/dist/cjs/types/components/UploadDocument/FileUploaderSingle.d.ts +0 -1
  22. package/dist/es/index.d.ts +44 -27
  23. package/dist/es/index.mjs +15 -15
  24. package/dist/es/index.mjs.map +1 -1
  25. package/dist/es/types/DesignSystemProvider.d.ts +3 -3
  26. package/dist/es/types/components/Accordion/Accordion.d.ts +3 -1
  27. package/dist/es/types/components/Chip/Chip.d.ts +3 -3
  28. package/dist/es/types/components/Datatable/Datatable.d.ts +1 -1
  29. package/dist/es/types/components/Datatable/DatatableCellRender.d.ts +0 -1
  30. package/dist/es/types/components/Datatable/datatable.interface.d.ts +1 -1
  31. package/dist/es/types/components/Datatable/use-pagination-props.hook.d.ts +1 -1
  32. package/dist/es/types/components/EmbbededNotification/EmbeddedNotification.d.ts +1 -1
  33. package/dist/es/types/components/Form/DatePicker/DatePicker.d.ts +5 -4
  34. package/dist/es/types/components/Form/MultiSelect/MultiSelect.d.ts +9 -4
  35. package/dist/es/types/components/Form/Select/Select.d.ts +8 -3
  36. package/dist/es/types/components/Form/TextField/TextField.d.ts +5 -4
  37. package/dist/es/types/components/IconButton/IconButton.d.ts +4 -1
  38. package/dist/es/types/components/IconProvider/IconProvider.d.ts +0 -1
  39. package/dist/es/types/components/Modal/Dialog/Dialog.d.ts +1 -1
  40. package/dist/es/types/components/Modal/Drawer/Drawer.d.ts +1 -1
  41. package/dist/es/types/components/Modal/modal.interface.d.ts +4 -4
  42. package/dist/es/types/components/NotistackAdapter/NotistackAdapter.d.ts +1 -2
  43. package/dist/es/types/components/UploadDocument/FileUploaderSingle.d.ts +0 -1
  44. package/package.json +31 -33
  45. package/src/DesignSystemProvider.tsx +3 -8
  46. package/src/components/Accordion/Accordion.tsx +5 -3
  47. package/src/components/BannerNotification/BannerNotification.tsx +2 -3
  48. package/src/components/Breadcrumbs/Breadcrumbs.tsx +3 -3
  49. package/src/components/Button/Button.tsx +6 -6
  50. package/src/components/Chip/Chip.tsx +32 -29
  51. package/src/components/Datatable/Datatable.tsx +4 -4
  52. package/src/components/Datatable/datatable.interface.ts +1 -1
  53. package/src/components/Datatable/use-pagination-props.hook.ts +3 -3
  54. package/src/components/EmbbededNotification/EmbeddedNotification.tsx +8 -7
  55. package/src/components/Form/AutoCompleteMulti/AutoCompleteMulti.tsx +11 -7
  56. package/src/components/Form/AutoCompleteSingle/AutoCompleteSingle.tsx +8 -3
  57. package/src/components/Form/Checkbox/Checkbox.tsx +5 -5
  58. package/src/components/Form/CheckboxGroup/CheckboxGroup.tsx +1 -1
  59. package/src/components/Form/DatePicker/DatePicker.tsx +7 -6
  60. package/src/components/Form/MultiSelect/MultiSelect.tsx +22 -17
  61. package/src/components/Form/RadioGroup/RadioGroup.tsx +6 -6
  62. package/src/components/Form/Select/Select.tsx +21 -18
  63. package/src/components/Form/Switch/Switch.tsx +1 -1
  64. package/src/components/Form/TextField/TextField.tsx +5 -3
  65. package/src/components/IconButton/IconButton.tsx +12 -3
  66. package/src/components/IconProvider/IconProvider.tsx +36 -24
  67. package/src/components/Link/Link.tsx +5 -8
  68. package/src/components/Modal/Drawer/Drawer.tsx +1 -2
  69. package/src/components/Modal/modal.interface.ts +4 -4
  70. package/src/components/NotistackAdapter/NotistackAdapter.tsx +4 -3
  71. package/src/components/Pagination/Pagination.tsx +2 -2
  72. package/src/components/Snackbar/Snackbar.tsx +4 -4
  73. package/src/components/Text/Text.tsx +1 -1
  74. package/src/components/Tooltip/Tooltip.tsx +10 -12
  75. package/src/components/UploadDocument/FileUploaderSingle.tsx +1 -2
@@ -1,13 +1,13 @@
1
- import React, { PropsWithChildren } from 'react';
1
+ import { PropsWithChildren } from 'react';
2
2
  type Theme = 'Default' | 'Ep';
3
3
  export interface DesignSystemContextValues {
4
4
  isDarkTheme: boolean;
5
5
  themeName: Theme;
6
6
  toggleDarkTheme: () => void;
7
7
  }
8
- export declare const DesignSystemContext: React.Context<DesignSystemContextValues>;
8
+ export declare const DesignSystemContext: import("react").Context<DesignSystemContextValues>;
9
9
  interface Props {
10
10
  name?: Theme;
11
11
  }
12
- declare const DesignSystemProvider: ({ children, name: themeName }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
12
+ declare const DesignSystemProvider: ({ children, name: themeName, }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
13
13
  export default DesignSystemProvider;
@@ -1,9 +1,11 @@
1
- import { MouseEventHandler } from 'react';
1
+ import { MouseEventHandler, ReactNode } from 'react';
2
2
  import { AccordionProps } from '@mui/material';
3
3
  interface Props extends AccordionProps {
4
4
  title?: string;
5
5
  summaryHeight?: number;
6
6
  expanded?: boolean;
7
+ children: NonNullable<ReactNode>;
8
+ disabled?: boolean;
7
9
  onClick?: MouseEventHandler;
8
10
  }
9
11
  declare const Accordion: {
@@ -1,12 +1,12 @@
1
- import React from 'react';
2
- import { ChipProps as ChipPropsMUI } from '@mui/material';
1
+ import { MouseEvent } from 'react';
3
2
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
3
+ import { ChipProps as ChipPropsMUI } from '@mui/material';
4
4
  interface Props extends Omit<ChipPropsMUI, 'suffix' | 'prefix' | 'onDelete' | 'onDeleteIcon' | 'variant'> {
5
5
  variant: 'filled' | 'outlined' | 'status' | 'statusFilled';
6
6
  label: string;
7
7
  prefixIcon?: IconDefinition;
8
8
  suffixIcon?: IconDefinition;
9
- suffixAction?: (e: React.MouseEvent) => void;
9
+ suffixAction?: (e: MouseEvent) => void;
10
10
  suffixTooltip?: string;
11
11
  tooltip?: string;
12
12
  maxWidth?: string | number;
@@ -1,3 +1,3 @@
1
1
  import { Props } from './datatable.interface';
2
- declare const Datatable: <T extends {}>({ onLoad, onSort, sortInfo, withHeader, withPagination, columns, ...props }: Props<T>) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Datatable: <T extends object>({ onLoad, onSort, sortInfo, withHeader, withPagination, columns, ...props }: Props<T>) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Datatable;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  declare const DatatableCellRender: ({ data }: {
3
2
  data: string;
4
3
  }) => JSX.Element;
@@ -49,5 +49,5 @@ type WithDetailsProps<T, D> = {
49
49
  type WithoutDetailsProps<T> = {
50
50
  onLoad: () => Promise<DatatableDataSet<T>>;
51
51
  };
52
- export type Props<T extends {}> = BaseProps<T> & (WithoutPaginationProps | PaginationProps) & (WithDetailsProps<T, RowDetail> | WithoutDetailsProps<T>);
52
+ export type Props<T extends object> = BaseProps<T> & (WithoutPaginationProps | PaginationProps) & (WithDetailsProps<T, RowDetail> | WithoutDetailsProps<T>);
53
53
  export {};
@@ -1,3 +1,3 @@
1
1
  import { PaginationProps, Props } from './datatable.interface';
2
- declare const usePaginationProps: <T extends {}>(props: {} | Props<T>) => Omit<PaginationProps, 'withPagination'>;
2
+ declare const usePaginationProps: <T extends object>(props: Props<T> | object) => Omit<PaginationProps, "withPagination">;
3
3
  export default usePaginationProps;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { BoxProps } from '@mui/material';
2
+ import { BoxProps } from '@mui/system';
3
3
  interface Props extends BoxProps {
4
4
  variant: 'warning' | 'error' | 'success' | 'infos';
5
5
  title: string;
@@ -1,13 +1,14 @@
1
1
  import { DatePickerProps } from '@mui/x-date-pickers-pro';
2
+ import { Dayjs } from 'dayjs';
2
3
  import 'dayjs/locale/fr';
3
- interface Props<T> extends Omit<DatePickerProps<T>, 'onChange' | 'width'> {
4
- value: T;
5
- onChange: (value: T | null) => void;
4
+ interface Props<T extends Dayjs> extends Omit<DatePickerProps<Dayjs>, 'onChange' | 'width'> {
5
+ value: T | null;
6
+ onChange: (value: Dayjs | null) => void;
6
7
  error?: string;
7
8
  success?: boolean;
8
9
  helperText?: string;
9
10
  width?: string;
10
11
  locale?: 'fr' | 'en';
11
12
  }
12
- declare const DatePicker: <T extends {} | undefined>({ value, onChange, error, success, helperText, width, locale, ...props }: Props<T>) => import("react/jsx-runtime").JSX.Element;
13
+ declare const DatePicker: <T extends Dayjs>({ value, onChange, error, success, helperText, width, locale, ...props }: Props<T>) => import("react/jsx-runtime").JSX.Element;
13
14
  export default DatePicker;
@@ -1,18 +1,23 @@
1
+ import { FocusEventHandler } from 'react';
1
2
  import { SelectProps } from '@mui/material';
2
3
  interface Props<T> extends Omit<SelectProps<T[]>, 'value' | 'onChange' | 'value' | 'color' | 'error'> {
3
4
  label: string;
4
5
  options: T[] | [];
5
6
  helperText?: string;
6
7
  color?: 'success';
7
- onChange: (value: T[]) => void;
8
- getRenderValue: (option: T) => string;
9
- getKeyValue: (option: T) => string;
10
8
  value: T[];
11
9
  width?: number | string;
12
10
  error?: string;
11
+ placeholder?: string;
12
+ disabled?: boolean;
13
+ className?: string;
14
+ onBlur?: FocusEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
15
+ onChange: (value: T[]) => void;
16
+ getRenderValue: (option: T) => string;
17
+ getKeyValue: (option: T) => string;
13
18
  }
14
19
  declare const MultiSelect: {
15
- <T>({ value, label, options, color, error, placeholder, helperText, width, getRenderValue, getKeyValue, onChange, onBlur, disabled, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
20
+ <T>({ value, label, options, color, error, placeholder, helperText, width, getRenderValue, getKeyValue, onChange, disabled, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
16
21
  displayName: string;
17
22
  };
18
23
  export default MultiSelect;
@@ -1,17 +1,22 @@
1
+ import { BaseSyntheticEvent } from 'react';
1
2
  import { SelectProps } from '@mui/material';
2
3
  interface Props<T> extends Omit<SelectProps<T>, 'value' | 'onChange' | 'color' | 'error'> {
3
4
  options: T[];
4
- getRenderValue: (option: T) => string;
5
- onChange: (value: T) => void;
5
+ placeholder?: string;
6
+ disabled?: boolean;
6
7
  label: string;
7
8
  helperText?: string;
8
9
  color?: 'success';
9
10
  value: T | undefined;
10
11
  width?: number | string;
11
12
  error?: string;
13
+ className?: string;
14
+ getRenderValue: (option: T) => string;
15
+ onChange: (value: T) => void;
16
+ onBlur?: (event: BaseSyntheticEvent) => void;
12
17
  }
13
18
  declare const Select: {
14
- <T>({ value, label, options, color, error, placeholder, onChange, getRenderValue, helperText, onBlur, width, disabled, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
19
+ <T>({ value, label, options, color, error, placeholder, helperText, width, disabled, onChange, getRenderValue, ...props }: Props<T>): import("react/jsx-runtime").JSX.Element;
15
20
  displayName: string;
16
21
  };
17
22
  export default Select;
@@ -1,9 +1,7 @@
1
- import { FocusEventHandler, ReactNode } from 'react';
2
- import { InputProps as StandardInputProps, TextFieldProps } from '@mui/material';
1
+ import React, { FocusEventHandler, ReactNode } from 'react';
2
+ import { TextFieldProps } from '@mui/material';
3
3
  interface Props extends Omit<TextFieldProps, 'error'> {
4
4
  error?: string;
5
- onBlur?: FocusEventHandler<unknown>;
6
- onChange?: StandardInputProps['onChange'];
7
5
  label: string;
8
6
  value?: string | unknown;
9
7
  name?: string;
@@ -12,6 +10,9 @@ interface Props extends Omit<TextFieldProps, 'error'> {
12
10
  endAdornment?: ReactNode;
13
11
  maxLength?: number;
14
12
  width?: number | string;
13
+ className?: string;
14
+ onBlur?: FocusEventHandler<unknown>;
15
+ onChange?: (e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
15
16
  }
16
17
  declare const TextField: {
17
18
  ({ name, value, error, onBlur, onChange, label, disabled, width, endAdornment, placeholder, maxLength, ...props }: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
2
- import { IconButtonProps } from '@mui/material';
2
+ import { IconButtonProps, SxProps, Theme } from '@mui/material';
3
3
  import { Placement } from '../Tooltip/tooltip.interface';
4
4
  interface Props extends IconButtonProps {
5
5
  icon: IconDefinition;
@@ -7,6 +7,9 @@ interface Props extends IconButtonProps {
7
7
  positionGroup?: 'left' | 'middle' | 'right';
8
8
  tooltipText?: string;
9
9
  tooltipPosition?: Placement;
10
+ size?: 'small' | 'medium';
11
+ sx?: SxProps<Theme>;
12
+ onClick?: () => void;
10
13
  }
11
14
  declare const IconButton: {
12
15
  ({ icon, variant, positionGroup, tooltipText, tooltipPosition, size, ...iconButtonProps }: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
3
2
  import { BoxProps } from '@mui/material';
4
3
  declare const FontSizes: {
@@ -1,3 +1,3 @@
1
1
  import { ModalProps } from '../modal.interface';
2
- declare const Dialog: ({ title, open, onClose, component, icon, ...props }: Omit<ModalProps, 'footer' | 'cardProps' | 'size'>) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Dialog: ({ title, open, onClose, component, icon, ...props }: Omit<ModalProps, "footer" | "cardProps" | "size">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Dialog;
@@ -1,3 +1,3 @@
1
1
  import { ModalProps } from '../modal.interface';
2
- declare const Drawer: ({ title, open, onClose, component, footer, cardProps, size, ...props }: Omit<ModalProps, 'withHeaderDivider' | 'icon'>) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Drawer: ({ title, open, onClose, component, footer, cardProps, size, ...props }: Omit<ModalProps, "withHeaderDivider" | "icon">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Drawer;
@@ -1,4 +1,4 @@
1
- import { ReactElement } from 'react';
1
+ import { ReactNode } from 'react';
2
2
  import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
3
3
  import { CardProps } from '@mui/material';
4
4
  import { ModalProps as ModalPropsMUI } from '@mui/material/Modal';
@@ -10,15 +10,15 @@ export interface ModalProps extends Omit<ModalPropsMUI, 'component' | 'open' | '
10
10
  open: boolean;
11
11
  title?: string;
12
12
  size?: 'small' | 'large';
13
- component: ReactElement<any> | null;
14
- footer?: ReactElement<any> | null;
13
+ component: ReactNode | null;
14
+ footer?: ReactNode | null;
15
15
  cardProps?: Partial<CardProps>;
16
16
  className?: string;
17
17
  icon?: IconDefinition;
18
18
  onClose?: () => void;
19
19
  }
20
20
  export type DialogTitleProps<T extends OverridableTypeMap> = DefaultComponentProps<T> & {
21
- children?: React.ReactNode;
21
+ children?: ReactNode;
22
22
  icon?: IconDefinition | null;
23
23
  onClose: () => void;
24
24
  };
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { CustomContentProps } from 'notistack';
3
- declare const NotistackAdapter: React.ForwardRefExoticComponent<CustomContentProps & React.RefAttributes<HTMLDivElement>>;
2
+ declare const NotistackAdapter: import("react").ForwardRefExoticComponent<CustomContentProps & import("react").RefAttributes<HTMLDivElement>>;
4
3
  export default NotistackAdapter;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface Props {
3
2
  setFile: (file: File | null) => void;
4
3
  removeExistingFile: () => void;
package/package.json CHANGED
@@ -1,35 +1,33 @@
1
1
  {
2
2
  "name": "@groupeactual/ui-kit",
3
- "version": "1.5.2",
3
+ "version": "1.6.0-beta.4",
4
4
  "type": "module",
5
5
  "description": "A simple template for a custom React component library",
6
6
  "devDependencies": {
7
- "@babel/core": "^7.24.4",
8
- "@babel/preset-env": "^7.24.4",
9
- "@babel/preset-react": "^7.24.1",
10
- "@babel/preset-typescript": "^7.24.1",
11
- "@groupeactual/code-quality-front": "^1.1.1",
7
+ "@groupeactual/code-quality-front": "1.2.0-beta.5",
8
+ "@babel/core": "^7.25.2",
9
+ "@babel/preset-env": "^7.25.3",
10
+ "@babel/preset-react": "^7.24.7",
11
+ "@babel/preset-typescript": "^7.24.7",
12
12
  "@mdx-js/react": "^3.0.1",
13
- "@types/lodash": "^4.17.0",
14
- "@types/react": "^18.2.75",
13
+ "@types/lodash": "^4.17.7",
14
+ "@types/react": "^18.3.4",
15
15
  "@types/styled-components": "^5.1.34",
16
16
  "babel-loader": "^9.1.3",
17
- "clsx": "^2.1.0",
18
- "css-loader": "^7.1.1",
19
- "framer-motion": "^11.0.27",
20
- "html-webpack-plugin": "^5.6.0",
17
+ "clsx": "^2.1.1",
18
+ "css-loader": "^7.1.2",
19
+ "framer-motion": "^11.3.28",
21
20
  "identity-obj-proxy": "^3.0.0",
22
21
  "lodash": "^4.17.21",
23
- "postcss": "^8.4.38",
24
- "prettier": "^3.2.5",
22
+ "postcss": "^8.4.41",
23
+ "prettier": "^3.3.3",
25
24
  "prop-types": "^15.8.1",
26
- "sass": "^1.74.1",
27
- "sass-loader": "^14.1.1",
25
+ "sass": "^1.77.8",
26
+ "sass-loader": "^16.0.1",
28
27
  "style-loader": "^4.0.0",
29
- "styled-components": "^6.1.8",
30
- "tslib": "^2.6.2",
31
- "typescript": "^4.9.5",
32
- "webpack": "^5.91.0"
28
+ "styled-components": "^6.1.12",
29
+ "tslib": "^2.6.3",
30
+ "typescript": "^5.5.4"
33
31
  },
34
32
  "main": "dist/cjs/index.js",
35
33
  "module": "dist/es/index.mjs",
@@ -39,22 +37,22 @@
39
37
  ],
40
38
  "types": "dist/es/types/index.d.ts",
41
39
  "dependencies": {
42
- "@emotion/is-prop-valid": "^1.2.2",
43
- "@emotion/react": "^11.11.4",
44
- "@emotion/serialize": "^1.1.4",
45
- "@emotion/styled": "^11.11.5",
46
- "@fortawesome/fontawesome-svg-core": "^6.4.2",
40
+ "@emotion/is-prop-valid": "^1.3.0",
41
+ "@emotion/react": "^11.13.0",
42
+ "@emotion/serialize": "^1.3.0",
43
+ "@emotion/styled": "^11.13.0",
44
+ "@fortawesome/fontawesome-svg-core": "^6.6.0",
47
45
  "@fortawesome/pro-regular-svg-icons": "git+https://github.com/actualtysoft/pro-regular-svg-icons.git#6.4.2",
48
46
  "@fortawesome/pro-solid-svg-icons": "git+https://github.com/actualtysoft/pro-solid-svg-icons.git#6.4.2",
49
- "@mui/material": "^5.15.15",
50
- "@mui/system": "^5.15.15",
51
- "@mui/x-date-pickers": "^6.11.0",
52
- "@mui/x-date-pickers-pro": "^6.11.0",
53
- "dayjs": "^1.11.10",
47
+ "@mui/material": "^5.16.7",
48
+ "@mui/system": "^5.16.7",
49
+ "@mui/x-date-pickers": "^7.13.0",
50
+ "@mui/x-date-pickers-pro": "^7.13.0",
51
+ "dayjs": "^1.11.12",
54
52
  "notistack": "^3.0.1",
55
- "react": "^18.2.0",
56
- "react-dom": "^18.2.0",
57
- "@groupeactual/design-tokens": "1.5.2"
53
+ "react": "^18.3.1",
54
+ "react-dom": "^18.3.1",
55
+ "@groupeactual/design-tokens": "1.6.0-beta.4"
58
56
  },
59
57
  "peerDependencies": {
60
58
  "react": "^18.2.0",
@@ -1,9 +1,4 @@
1
- import React, {
2
- PropsWithChildren,
3
- createContext,
4
- useContext,
5
- useState
6
- } from 'react';
1
+ import { PropsWithChildren, createContext, useContext, useState } from 'react';
7
2
 
8
3
  import { useMaterialThemeTokens } from '@groupeactual/design-tokens';
9
4
  import { ThemeProvider, createTheme } from '@mui/material';
@@ -24,7 +19,7 @@ export const DesignSystemContext = createContext<DesignSystemContextValues>({
24
19
  themeName: 'Default',
25
20
  toggleDarkTheme: () => {
26
21
  return;
27
- }
22
+ },
28
23
  });
29
24
 
30
25
  interface Props {
@@ -42,7 +37,7 @@ const MaterialThemeProvider = ({ children }: PropsWithChildren<unknown>) => {
42
37
 
43
38
  const DesignSystemProvider = ({
44
39
  children,
45
- name: themeName = 'Default'
40
+ name: themeName = 'Default',
46
41
  }: PropsWithChildren<Props>) => {
47
42
  const [isDarkTheme, setIsDarkTheme] = useState(false);
48
43
 
@@ -1,4 +1,4 @@
1
- import React, {
1
+ import {
2
2
  MouseEventHandler,
3
3
  ReactNode,
4
4
  useEffect,
@@ -23,6 +23,8 @@ interface Props extends AccordionProps {
23
23
  title?: string;
24
24
  summaryHeight?: number;
25
25
  expanded?: boolean;
26
+ children: NonNullable<ReactNode>;
27
+ disabled?: boolean;
26
28
  onClick?: MouseEventHandler;
27
29
  }
28
30
 
@@ -74,9 +76,9 @@ const Accordion = ({
74
76
  </AccordionSummary>
75
77
  <AccordionDetails
76
78
  sx={{
77
- backgroundColor: 'greyXLight',
79
+ backgroundColor: theme.palette.greyXLight,
78
80
  borderTop: '1px solid',
79
- borderColor: 'greyLightDefaultBorder',
81
+ borderColor: theme.palette.greyLightDefaultBorder,
80
82
  }}
81
83
  >
82
84
  {children}
@@ -2,8 +2,7 @@ import { useMemo } from 'react';
2
2
 
3
3
  import { faBell, faTimes } from '@fortawesome/pro-solid-svg-icons';
4
4
  import { BannerNotificationStyle } from '@groupeactual/design-tokens';
5
- import { Alert, AlertProps, styled } from '@mui/material';
6
- import { useTheme } from '@mui/material';
5
+ import { Alert, AlertProps, styled, useTheme } from '@mui/material';
7
6
 
8
7
  import IconProvider from '../IconProvider/IconProvider';
9
8
 
@@ -17,7 +16,7 @@ const BannerNotification = ({ text, severity, onClose }: Props) => {
17
16
 
18
17
  const StyledBannerNotification = useMemo(
19
18
  () => styled(Alert)(BannerNotificationStyle(theme)),
20
- []
19
+ [],
21
20
  );
22
21
 
23
22
  return (
@@ -1,11 +1,11 @@
1
- import React, { useMemo } from 'react';
1
+ import { useMemo } from 'react';
2
2
 
3
3
  import { BreadcrumbsStyle } from '@groupeactual/design-tokens';
4
4
  import {
5
5
  Breadcrumbs as BreadcrumbsMui,
6
6
  BreadcrumbsProps,
7
7
  styled,
8
- useTheme
8
+ useTheme,
9
9
  } from '@mui/material';
10
10
 
11
11
  import Link from '../Link';
@@ -25,7 +25,7 @@ const Breadcrumbs = ({ PageName, links, ...props }: Props) => {
25
25
  const theme = useTheme();
26
26
  const StyledBreadcrumbs = useMemo(
27
27
  () => styled(BreadcrumbsMui)(BreadcrumbsStyle(theme)),
28
- [theme]
28
+ [theme],
29
29
  );
30
30
 
31
31
  return (
@@ -1,13 +1,13 @@
1
- import React, { ReactNode, useMemo } from 'react';
1
+ import { ReactNode, useMemo } from 'react';
2
+
3
+ import { ButtonStyle } from '@groupeactual/design-tokens';
2
4
  import {
3
5
  Button as ButtonMUI,
4
- styled,
5
6
  ButtonProps,
6
- useTheme
7
+ styled,
8
+ useTheme,
7
9
  } from '@mui/material';
8
10
 
9
- import { ButtonStyle } from '@groupeactual/design-tokens';
10
-
11
11
  interface Props extends Omit<ButtonProps, 'variant' | 'children'> {
12
12
  variant?: 'primary' | 'secondary';
13
13
  children?: ReactNode;
@@ -17,7 +17,7 @@ const Button = ({ variant, children, ...props }: Props) => {
17
17
  const theme = useTheme();
18
18
  const StyledButton = useMemo(
19
19
  () => styled(ButtonMUI)(ButtonStyle(theme)),
20
- [theme]
20
+ [theme],
21
21
  );
22
22
 
23
23
  return (
@@ -1,15 +1,15 @@
1
- import React, { useEffect, useMemo, useRef, useState } from 'react';
1
+ import { MouseEvent, useMemo, useRef, useState } from 'react';
2
+
3
+ import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
4
+ import { ChipStyle } from '@groupeactual/design-tokens';
2
5
  import {
3
6
  Box,
4
7
  Chip as ChipMUI,
8
+ ChipProps as ChipPropsMUI,
5
9
  Tooltip,
6
10
  styled,
7
- ChipProps as ChipPropsMUI,
8
- useTheme
11
+ useTheme,
9
12
  } from '@mui/material';
10
- import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
11
-
12
- import { ChipStyle } from '@groupeactual/design-tokens';
13
13
 
14
14
  import IconProvider from '../IconProvider';
15
15
 
@@ -22,7 +22,7 @@ interface Props
22
22
  label: string;
23
23
  prefixIcon?: IconDefinition;
24
24
  suffixIcon?: IconDefinition;
25
- suffixAction?: (e: React.MouseEvent) => void;
25
+ suffixAction?: (e: MouseEvent) => void;
26
26
  suffixTooltip?: string;
27
27
  tooltip?: string;
28
28
  maxWidth?: string | number;
@@ -48,19 +48,22 @@ const Chip = ({
48
48
 
49
49
  const ref = useRef<HTMLDivElement>(null);
50
50
 
51
- let backgroundColor: string =
52
- props.color && theme.palette[props.color]
53
- ? typeof theme.palette[props.color] === 'object'
54
- ? theme.palette[props.color]['main']
55
- : theme.palette[props.color]
56
- : props.color ?? 'white';
51
+ const backgroundColor: string = useMemo(() => {
52
+ if (props.color && theme.palette[props.color]) {
53
+ if (typeof theme.palette[props.color] === 'object') {
54
+ return theme.palette[props.color]['main'];
55
+ } else {
56
+ return theme.palette[props.color] as string;
57
+ }
58
+ } else if (props.color || variant === 'status') {
59
+ return 'white';
60
+ } else if (variant === 'filled' || variant === 'statusFilled') {
61
+ // opacity 0.08
62
+ return `${backgroundColor}14`;
63
+ }
57
64
 
58
- if (variant === 'filled' || variant === 'statusFilled') {
59
- // opacity 0.08
60
- backgroundColor = `${backgroundColor}14`;
61
- } else if (variant === 'status') {
62
- backgroundColor = 'white';
63
- }
65
+ return '';
66
+ }, [props.color, theme.palette]);
64
67
 
65
68
  return (
66
69
  <Tooltip title={tooltip} placement="right-start" open={isTooltipOpen}>
@@ -88,24 +91,24 @@ const Chip = ({
88
91
  '&:hover': {
89
92
  borderColor: '#004f88 !important',
90
93
  '.MuiChip-deleteIcon': {
91
- color: '#004f88 !important'
92
- }
93
- }
94
+ color: '#004f88 !important',
95
+ },
96
+ },
94
97
  },
95
98
  '&.MuiChip-colorPrimary': suffixIcon &&
96
99
  suffixAction && {
97
100
  '&:hover': {
98
- backgroundColor: '#004f88 !important'
99
- }
101
+ backgroundColor: '#004f88 !important',
102
+ },
100
103
  },
101
104
  '&.MuiChip-colorDefault': suffixIcon &&
102
105
  suffixAction && {
103
106
  '&:hover': {
104
107
  '.MuiChip-deleteIcon': {
105
- color: '#004f88 !important'
106
- }
107
- }
108
- }
108
+ color: '#004f88 !important',
109
+ },
110
+ },
111
+ },
109
112
  }}
110
113
  avatar={
111
114
  prefixIcon ? <IconProvider icon={prefixIcon} size="sm" /> : <></>
@@ -127,7 +130,7 @@ const Chip = ({
127
130
  }
128
131
  }}
129
132
  sx={{
130
- cursor: suffixAction ? 'pointer !important' : 'default'
133
+ cursor: suffixAction ? 'pointer !important' : 'default',
131
134
  }}
132
135
  size="sm"
133
136
  />
@@ -24,7 +24,7 @@ import Text from '../Text';
24
24
  import { RowDetail as D, Props } from './datatable.interface';
25
25
  import usePaginationProps from './use-pagination-props.hook';
26
26
 
27
- const Datatable = <T extends {}>({
27
+ const Datatable = <T extends object>({
28
28
  onLoad,
29
29
  onSort = () => undefined,
30
30
  sortInfo = null,
@@ -102,10 +102,10 @@ const Datatable = <T extends {}>({
102
102
  <TableCell
103
103
  key={name}
104
104
  variant="head"
105
- height={hasTopTitle ? '55px' : 'inherit'}
106
105
  sx={{
107
106
  width: width,
108
107
  maxWidth: width,
108
+ height: hasTopTitle ? '55px' : 'inherit',
109
109
  }}
110
110
  >
111
111
  {hasTopTitle && (
@@ -140,7 +140,7 @@ const Datatable = <T extends {}>({
140
140
  icon={isAsc ? faArrowUpLong : faArrowDownLong}
141
141
  variant="table"
142
142
  size="small"
143
- style={{
143
+ sx={{
144
144
  visibility:
145
145
  sortActive || hover === name
146
146
  ? 'visible'
@@ -184,7 +184,7 @@ const Datatable = <T extends {}>({
184
184
  </TableRow>
185
185
  {'details' in record && record.details && (
186
186
  <TableRow>
187
- <TableCell colSpan={columns.length}>
187
+ <TableCell sx={{ columnSpan: columns.length }}>
188
188
  {record.details}
189
189
  </TableCell>
190
190
  </TableRow>
@@ -61,6 +61,6 @@ type WithoutDetailsProps<T> = {
61
61
  onLoad: () => Promise<DatatableDataSet<T>>;
62
62
  };
63
63
 
64
- export type Props<T extends {}> = BaseProps<T> &
64
+ export type Props<T extends object> = BaseProps<T> &
65
65
  (WithoutPaginationProps | PaginationProps) &
66
66
  (WithDetailsProps<T, RowDetail> | WithoutDetailsProps<T>);