@groupeactual/ui-kit 0.4.13 → 0.4.15

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/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import * as react from 'react';
5
5
  import { FocusEventHandler, ChangeEventHandler, ReactNode, PropsWithChildren } from 'react';
6
6
  import { TextFieldProps } from '@mui/material/TextField';
7
7
  import { CheckboxProps } from '@mui/material/Checkbox';
8
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
8
+ import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
9
9
 
10
10
  interface Props$7 extends Omit<TypographyProps, 'variant'> {
11
11
  variant?: 'bigNumber' | 'body1Regular' | 'body1Medium' | 'body1Bold' | 'body2Regular' | 'body2Medium' | 'body2Bold' | 'caption' | 'buttonNotif' | 'header1' | 'header2' | 'header3' | 'header4';
@@ -58,12 +58,12 @@ interface Props$2 {
58
58
  declare const ActAccordion: ({ icon, title, content, summaryHeight }: Props$2) => JSX.Element;
59
59
 
60
60
  interface Props$1 {
61
- variant?: 'roundedIcon' | 'smallRoundedIcon';
62
- icon: IconProp;
61
+ variant?: 'square' | 'none';
62
+ icon: IconDefinition;
63
63
  color?: string;
64
- size?: 'xxs' | 'xs' | 'sm' | 'm' | 'lg' | 'xl' | 'xxl';
64
+ fontSize?: number;
65
65
  }
66
- declare const IconProvider: ({ variant, icon, color, size }: Props$1) => JSX.Element;
66
+ declare const Icon: ({ variant, icon, color, fontSize }: Props$1) => JSX.Element;
67
67
 
68
68
  type Theme = 'Default' | 'Ep';
69
69
  interface DesignSystemContextValues {
@@ -77,4 +77,4 @@ interface Props {
77
77
  }
78
78
  declare const DesignSystemProvider: ({ children, name: themeName }: PropsWithChildren<Props>) => JSX.Element;
79
79
 
80
- export { ActAccordion as Accordion, Button, Checkbox, DesignSystemContext, DesignSystemContextValues, DesignSystemProvider, IconProvider, Link, Text, TextField };
80
+ export { ActAccordion as Accordion, Button, Checkbox, DesignSystemContext, DesignSystemContextValues, DesignSystemProvider, Icon as IconProvider, Link, Text, TextField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@groupeactual/ui-kit",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
4
4
  "description": "A simple template for a custom React component library",
5
5
  "devDependencies": {
6
6
  "@babel/core": "^7.20.5",
@@ -49,7 +49,8 @@
49
49
  "@emotion/is-prop-valid": "^1.2.0",
50
50
  "@emotion/react": "^11.10.5",
51
51
  "@emotion/styled": "^11.10.5",
52
- "@fortawesome/fontawesome-svg-core": "^6.2.1",
52
+ "@fortawesome/fontawesome-svg-core": "^6.3.0",
53
+ "@fortawesome/fontawesome-common-types": "^6.3.0",
53
54
  "@groupeactual/design-tokens": "^0.3.0",
54
55
  "@mui/base": "^5.0.0-alpha.108",
55
56
  "@mui/material": "^5.10.16",
@@ -41,7 +41,7 @@ const Checkbox = ({
41
41
  <Box>
42
42
  <CheckboxMUI
43
43
  name={name}
44
- sx={{ marginTop: -0.5 }}
44
+ sx={{ marginTop: '-2px' }}
45
45
  checked={internalValue}
46
46
  color="primary"
47
47
  onChange={(e) => {
@@ -57,6 +57,8 @@ const Checkbox = ({
57
57
  component="span"
58
58
  sx={{
59
59
  fontSize: '14px',
60
+ marginLeft: '-3px',
61
+ marginTop: '2px',
60
62
  fontWeight: 400,
61
63
  color: error ? '#B80025' : '#000'
62
64
  }}
@@ -68,7 +70,7 @@ const Checkbox = ({
68
70
  {error && (
69
71
  <Typography
70
72
  sx={{
71
- marginTop: -1,
73
+ marginTop: -0.5,
72
74
  color: '#B80025',
73
75
  fontWeight: 400,
74
76
  fontSize: '10px'
@@ -44,13 +44,14 @@ const TextField = ({
44
44
 
45
45
  return (
46
46
  <MuiTextField
47
+ id={label === placeholder ? 'text-field-mui' : 'test-field-ds'}
47
48
  variant="outlined"
48
49
  name={name}
49
50
  label={label}
50
51
  value={internalValue}
51
- placeholder={placeholder}
52
+ placeholder={label === placeholder ? undefined : placeholder}
52
53
  FormHelperTextProps={{ component: 'div' } as any}
53
- InputLabelProps={{ shrink: true }}
54
+ InputLabelProps={{ shrink: label === placeholder ? undefined : true }}
54
55
  onClick={(e) => e.stopPropagation()}
55
56
  onChange={(e) => {
56
57
  setInternalValue(e.currentTarget.value);
@@ -1,18 +1,19 @@
1
1
  import SvgIcon from '@mui/material/SvgIcon';
2
2
  import { forwardRef } from 'react';
3
3
  import { SxProps, Theme } from '@mui/material/styles';
4
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
4
+ import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
5
5
  import Box from '@mui/material/Box';
6
+ import { useTheme } from '@mui/system';
6
7
  interface Props {
7
- variant?: 'roundedIcon' | 'smallRoundedIcon';
8
- icon: IconProp;
8
+ variant?: 'square' | 'none';
9
+ icon: IconDefinition;
9
10
  color?: string;
10
- size?: 'xxs' | 'xs' | 'sm' | 'm' | 'lg' | 'xl' | 'xxl';
11
+ fontSize?: number;
11
12
  }
12
13
 
13
14
  interface FontAwesomeSvgIconProps {
14
15
  icon: any;
15
- fontSize: string;
16
+ fontSize: number | undefined;
16
17
  }
17
18
 
18
19
  // eslint-disable-next-line react/display-name
@@ -27,7 +28,7 @@ const FontAwesomeSvgIcon = forwardRef<SVGSVGElement, FontAwesomeSvgIconProps>(
27
28
  ref={ref}
28
29
  viewBox={`0 0 ${width as string} ${height as string}`}
29
30
  sx={{
30
- fontSize
31
+ fontSize: fontSize ?? '14px'
31
32
  }}
32
33
  >
33
34
  {typeof svgPathData === 'string' ? (
@@ -49,64 +50,40 @@ const FontAwesomeSvgIcon = forwardRef<SVGSVGElement, FontAwesomeSvgIconProps>(
49
50
  }
50
51
  );
51
52
 
52
- const IconProvider = ({ variant, icon, color, size }: Props) => {
53
- const getFontSize = (): string => {
54
- if (variant === 'roundedIcon') {
55
- return '1.5rem';
56
- }
57
- if (variant === 'smallRoundedIcon') {
58
- return '0.9rem';
59
- }
60
- switch (size) {
61
- case 'xxs':
62
- return '.8rem';
63
- case 'xs':
64
- return '1rem';
65
- case 'm':
66
- return '1.5rem';
67
- case 'lg':
68
- return '1.8rem';
69
- case 'xl':
70
- return '2.2rem';
71
- case 'xxl':
72
- return '4rem';
73
- default:
74
- return '1.2rem';
75
- }
76
- };
77
-
53
+ const Icon = ({
54
+ variant = 'none',
55
+ icon,
56
+ color = '#136cac',
57
+ fontSize = 16
58
+ }: Props) => {
78
59
  const getStyles = (): SxProps<Theme> => {
60
+ const theme = useTheme();
61
+ let defaultColor = theme.palette[color]
62
+ ? theme.palette[color]
63
+ : !color || color?.length === 0
64
+ ? '#136cac'
65
+ : color;
66
+
79
67
  switch (variant) {
80
- case 'roundedIcon':
81
- return {
82
- color: 'actual.main',
83
- backgroundColor: 'actual.light',
84
- borderRadius: '100px',
85
- overflow: 'visible',
86
- height: 50,
87
- width: 50,
88
- display: 'flex',
89
- fontSize: '1.5rem',
90
- justifyContent: 'center',
91
- alignItems: 'center'
92
- };
93
- case 'smallRoundedIcon':
68
+ case 'square':
94
69
  return {
95
- color: 'actual.main',
96
- backgroundColor: 'actual.light',
97
- borderRadius: '100px',
70
+ color: defaultColor,
71
+ backgroundColor: `${defaultColor}14`,
72
+ borderRadius: '4px',
73
+ borderColor: '1px solid ' + defaultColor,
98
74
  overflow: 'visible',
99
- height: 30,
100
- width: 30,
75
+ padding: '10px',
76
+ width: fontSize,
77
+ height: fontSize,
101
78
  display: 'flex',
102
79
  justifyContent: 'center',
103
80
  alignItems: 'center'
104
81
  };
105
82
  default:
106
83
  return {
107
- color: color ?? 'primary.main',
108
- width: getFontSize(),
109
- height: getFontSize(),
84
+ color: defaultColor,
85
+ width: fontSize,
86
+ height: fontSize,
110
87
  display: 'inline-flex',
111
88
  alignItems: 'center',
112
89
  justifyContent: 'center'
@@ -115,9 +92,9 @@ const IconProvider = ({ variant, icon, color, size }: Props) => {
115
92
  };
116
93
  return (
117
94
  <Box component="span" sx={getStyles()}>
118
- <FontAwesomeSvgIcon icon={icon} fontSize={getFontSize()} />
95
+ <FontAwesomeSvgIcon icon={icon} fontSize={fontSize} />
119
96
  </Box>
120
97
  );
121
98
  };
122
99
 
123
- export default IconProvider;
100
+ export default Icon;
@@ -1 +1 @@
1
- export { default } from './IconProvider';
1
+ export { default } from './Icon';
@@ -18,6 +18,8 @@ interface Props extends Omit<TypographyProps, 'variant'> {
18
18
  component?: any;
19
19
  }
20
20
 
21
- const Text = (props: Props) => <Typography {...(props as TypographyProps)} />;
21
+ const Text = (props: Props) => (
22
+ <Typography color="greyXDark" {...(props as TypographyProps)} />
23
+ );
22
24
 
23
25
  export default Text;
@@ -4,4 +4,4 @@ export { default as Button } from './Button';
4
4
  export { default as TextField } from './Form/TextField';
5
5
  export { default as Checkbox } from './Form/Checkbox';
6
6
  export { default as Accordion } from './Accordion';
7
- export { default as IconProvider } from './Icon/IconProvider';
7
+ export { default as IconProvider } from './Icon/Icon';
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
3
- interface Props {
4
- variant?: 'roundedIcon' | 'smallRoundedIcon';
5
- icon: IconProp;
6
- color?: string;
7
- size?: 'xxs' | 'xs' | 'sm' | 'm' | 'lg' | 'xl' | 'xxl';
8
- }
9
- declare const IconProvider: ({ variant, icon, color, size }: Props) => JSX.Element;
10
- export default IconProvider;
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
3
- interface Props {
4
- variant?: 'roundedIcon' | 'smallRoundedIcon';
5
- icon: IconProp;
6
- color?: string;
7
- size?: 'xxs' | 'xs' | 'sm' | 'm' | 'lg' | 'xl' | 'xxl';
8
- }
9
- declare const IconProvider: ({ variant, icon, color, size }: Props) => JSX.Element;
10
- export default IconProvider;