@groupeactual/ui-kit 0.4.31 → 0.4.33
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/cjs/index.js +1 -56145
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -147
- package/dist/esm/index.js.map +1 -1
- package/package.json +13 -35
- package/src/DesignSystemProvider.tsx +0 -61
- package/src/components/Accordion/Accordion.tsx +0 -72
- package/src/components/Accordion/index.ts +0 -1
- package/src/components/Button/Button.tsx +0 -18
- package/src/components/Button/index.ts +0 -1
- package/src/components/Chip/Chip.tsx +0 -125
- package/src/components/Chip/index.ts +0 -1
- package/src/components/EmbbededNotification/EmbeddedNotification.tsx +0 -95
- package/src/components/EmbbededNotification/index.ts +0 -1
- package/src/components/Form/Checkbox/Checkbox.tsx +0 -86
- package/src/components/Form/Checkbox/index.ts +0 -1
- package/src/components/Form/MultiSelect/MultiSelect.tsx +0 -184
- package/src/components/Form/MultiSelect/index.ts +0 -1
- package/src/components/Form/Select/Select.tsx +0 -154
- package/src/components/Form/Select/index.ts +0 -1
- package/src/components/Form/TextField/TextField.tsx +0 -98
- package/src/components/Form/TextField/index.ts +0 -1
- package/src/components/Icon/Icon.tsx +0 -126
- package/src/components/Icon/index.ts +0 -1
- package/src/components/Link/Link.tsx +0 -11
- package/src/components/Link/index.ts +0 -1
- package/src/components/Pagination/Pagination.tsx +0 -116
- package/src/components/Pagination/index.ts +0 -1
- package/src/components/Text/Text.tsx +0 -26
- package/src/components/Text/index.ts +0 -1
- package/src/components/Tooltip/Tooltip.tsx +0 -33
- package/src/components/Tooltip/index.ts +0 -1
- package/src/components/index.ts +0 -13
- package/src/index.ts +0 -6
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, useState } from 'react';
|
|
2
|
-
import { FormHelperText, InputLabel, MenuItem } from '@mui/material';
|
|
3
|
-
import Box from '@mui/material/Box';
|
|
4
|
-
import FormControl from '@mui/material/FormControl';
|
|
5
|
-
import MuiSelect, {
|
|
6
|
-
SelectChangeEvent,
|
|
7
|
-
SelectProps
|
|
8
|
-
} from '@mui/material/Select';
|
|
9
|
-
import {
|
|
10
|
-
faChevronDown,
|
|
11
|
-
faCheck,
|
|
12
|
-
faTimesCircle
|
|
13
|
-
} from '@fortawesome/pro-solid-svg-icons';
|
|
14
|
-
import Icon from '../../Icon';
|
|
15
|
-
import Chip from '../../Chip/Chip';
|
|
16
|
-
|
|
17
|
-
interface Props<T>
|
|
18
|
-
extends Omit<
|
|
19
|
-
SelectProps<T[]>,
|
|
20
|
-
'value' | 'onChange' | 'defaultValue' | 'color'
|
|
21
|
-
> {
|
|
22
|
-
label: string;
|
|
23
|
-
options: T[];
|
|
24
|
-
helperText?: string;
|
|
25
|
-
color?: 'success';
|
|
26
|
-
getOptionLabel: (option: T) => string;
|
|
27
|
-
onChange: (value: T[]) => void;
|
|
28
|
-
defaultValue?: T[];
|
|
29
|
-
width?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const MultiSelect = <T extends {}>({
|
|
33
|
-
label,
|
|
34
|
-
options,
|
|
35
|
-
color,
|
|
36
|
-
error,
|
|
37
|
-
placeholder,
|
|
38
|
-
width = 200,
|
|
39
|
-
defaultValue = [],
|
|
40
|
-
getOptionLabel,
|
|
41
|
-
helperText,
|
|
42
|
-
onChange,
|
|
43
|
-
onBlur,
|
|
44
|
-
...props
|
|
45
|
-
}: Props<T>) => {
|
|
46
|
-
const [values, setValues] = useState(defaultValue);
|
|
47
|
-
|
|
48
|
-
const handleChange = (event: SelectChangeEvent<typeof options>) => {
|
|
49
|
-
const newValue = event.target.value as T[];
|
|
50
|
-
onChange(newValue);
|
|
51
|
-
setValues(newValue);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const handleDeleteChip = (chipValue: T) => {
|
|
55
|
-
const newValue = values?.filter((val) => val !== chipValue);
|
|
56
|
-
setValues(newValue);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const getFormControlClassName = useMemo(() => {
|
|
60
|
-
const classNames: string[] = ['DsSelect'];
|
|
61
|
-
if (props.disabled) classNames.push('Mui-disabled');
|
|
62
|
-
if (values?.length > 0) classNames.push('Mui-filled');
|
|
63
|
-
|
|
64
|
-
return classNames;
|
|
65
|
-
}, [values, props.disabled]);
|
|
66
|
-
|
|
67
|
-
const getInputLabelClassName = useMemo(() => {
|
|
68
|
-
const classNames: string[] = [];
|
|
69
|
-
if (error) classNames.push('Mui-error');
|
|
70
|
-
if (props.disabled) classNames.push('Mui-disabled');
|
|
71
|
-
|
|
72
|
-
return classNames;
|
|
73
|
-
}, [error, props.disabled]);
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<Box sx={{ width }}>
|
|
77
|
-
<FormControl
|
|
78
|
-
id={label === placeholder ? 'select-mui' : 'select-ds'}
|
|
79
|
-
fullWidth
|
|
80
|
-
color={color}
|
|
81
|
-
className={getFormControlClassName.join(' ')}
|
|
82
|
-
sx={{
|
|
83
|
-
'.MuiOutlinedInput-input': {
|
|
84
|
-
marginTop: values?.length > 0 ? '-4px' : '2px'
|
|
85
|
-
}
|
|
86
|
-
}}
|
|
87
|
-
>
|
|
88
|
-
<InputLabel className={getInputLabelClassName.join(' ')}>
|
|
89
|
-
{label}
|
|
90
|
-
</InputLabel>
|
|
91
|
-
<MuiSelect
|
|
92
|
-
sx={{
|
|
93
|
-
color: color + '! important',
|
|
94
|
-
'& .MuiSelect-select .notranslate::after': placeholder
|
|
95
|
-
? {
|
|
96
|
-
content: `"${placeholder}"`,
|
|
97
|
-
opacity:
|
|
98
|
-
label === placeholder ? '0 !important' : '1 !important'
|
|
99
|
-
}
|
|
100
|
-
: {}
|
|
101
|
-
}}
|
|
102
|
-
multiple
|
|
103
|
-
label={label}
|
|
104
|
-
placeholder={label === placeholder ? '' : placeholder}
|
|
105
|
-
notched={
|
|
106
|
-
/* eslint-disable-next-line no-undefined */
|
|
107
|
-
label === placeholder ? undefined : true
|
|
108
|
-
}
|
|
109
|
-
value={values}
|
|
110
|
-
error={!!error}
|
|
111
|
-
onChange={handleChange}
|
|
112
|
-
onBlur={onBlur}
|
|
113
|
-
renderValue={(selected) => (
|
|
114
|
-
<Box sx={{ display: 'flex', flexWrap: 'nowrap', gap: 0.5 }}>
|
|
115
|
-
{selected?.map((selectedOption: T, i) => (
|
|
116
|
-
<Chip
|
|
117
|
-
key={i}
|
|
118
|
-
disabled={props.disabled}
|
|
119
|
-
variant="filled"
|
|
120
|
-
color="default"
|
|
121
|
-
label={getOptionLabel(selectedOption)}
|
|
122
|
-
suffixIcon={faTimesCircle}
|
|
123
|
-
suffixAction={() =>
|
|
124
|
-
!props.disabled && handleDeleteChip(selectedOption)
|
|
125
|
-
}
|
|
126
|
-
onMouseDown={(event) => {
|
|
127
|
-
event.stopPropagation();
|
|
128
|
-
}}
|
|
129
|
-
/>
|
|
130
|
-
))}
|
|
131
|
-
</Box>
|
|
132
|
-
)}
|
|
133
|
-
IconComponent={({ className }) => (
|
|
134
|
-
<Icon
|
|
135
|
-
className={
|
|
136
|
-
props.disabled ? 'Mui-disabled SelectIcon' : 'SelectIcon'
|
|
137
|
-
}
|
|
138
|
-
icon={color === 'success' ? faCheck : faChevronDown}
|
|
139
|
-
size={color === 'success' ? 'md' : 'sm'}
|
|
140
|
-
sx={{
|
|
141
|
-
marginRight: '12px',
|
|
142
|
-
marginTop: color === 'success' ? '2px' : '0px',
|
|
143
|
-
transform:
|
|
144
|
-
className.toString().includes('iconOpen') &&
|
|
145
|
-
color !== 'success'
|
|
146
|
-
? 'rotate(180deg)'
|
|
147
|
-
: 'none'
|
|
148
|
-
}}
|
|
149
|
-
/>
|
|
150
|
-
)}
|
|
151
|
-
MenuProps={{
|
|
152
|
-
PaperProps: {
|
|
153
|
-
style: {
|
|
154
|
-
width
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}}
|
|
158
|
-
{...props}
|
|
159
|
-
>
|
|
160
|
-
{options?.map((option, i) => (
|
|
161
|
-
<MenuItem
|
|
162
|
-
key={i}
|
|
163
|
-
value={option as any}
|
|
164
|
-
sx={{
|
|
165
|
-
fontWeight: values.indexOf(option) === -1 ? 400 : 500,
|
|
166
|
-
backgroundColor:
|
|
167
|
-
values.indexOf(option) === -1 ? '#ffffff' : '#D3E4F0'
|
|
168
|
-
}}
|
|
169
|
-
>
|
|
170
|
-
{getOptionLabel(option)}
|
|
171
|
-
</MenuItem>
|
|
172
|
-
))}
|
|
173
|
-
</MuiSelect>
|
|
174
|
-
{(error || helperText) && (
|
|
175
|
-
<FormHelperText component="span" className={error ? 'Mui-error' : ''}>
|
|
176
|
-
{error || helperText}
|
|
177
|
-
</FormHelperText>
|
|
178
|
-
)}
|
|
179
|
-
</FormControl>
|
|
180
|
-
</Box>
|
|
181
|
-
);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export default MultiSelect;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MultiSelect';
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import React, { BaseSyntheticEvent, useMemo, useState } from 'react';
|
|
2
|
-
import { FormHelperText, InputLabel, MenuItem } from '@mui/material';
|
|
3
|
-
import Box from '@mui/material/Box';
|
|
4
|
-
import FormControl from '@mui/material/FormControl';
|
|
5
|
-
import MuiSelect, {
|
|
6
|
-
SelectChangeEvent,
|
|
7
|
-
SelectProps
|
|
8
|
-
} from '@mui/material/Select';
|
|
9
|
-
import { faChevronDown, faCheck } from '@fortawesome/pro-solid-svg-icons';
|
|
10
|
-
import Icon from '../../Icon';
|
|
11
|
-
|
|
12
|
-
interface Props<T>
|
|
13
|
-
extends Omit<
|
|
14
|
-
SelectProps<T>,
|
|
15
|
-
'value' | 'onChange' | 'defaultValue' | 'color'
|
|
16
|
-
> {
|
|
17
|
-
label?: string;
|
|
18
|
-
helperText?: string;
|
|
19
|
-
options: T[];
|
|
20
|
-
getOptionLabel?: (option: T) => string;
|
|
21
|
-
color?: 'success';
|
|
22
|
-
onChange: (value: T) => void;
|
|
23
|
-
defaultValue?: T | undefined;
|
|
24
|
-
width?: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const Select = <T extends {}>({
|
|
28
|
-
label = '',
|
|
29
|
-
defaultValue,
|
|
30
|
-
options,
|
|
31
|
-
color,
|
|
32
|
-
error,
|
|
33
|
-
placeholder,
|
|
34
|
-
onChange,
|
|
35
|
-
getOptionLabel,
|
|
36
|
-
helperText,
|
|
37
|
-
onBlur,
|
|
38
|
-
width = 200,
|
|
39
|
-
...props
|
|
40
|
-
}: Props<T>) => {
|
|
41
|
-
const [value, setValue] = useState(defaultValue);
|
|
42
|
-
|
|
43
|
-
const handleChange = (event: SelectChangeEvent<T>) => {
|
|
44
|
-
const newValue = event.target.value as T;
|
|
45
|
-
onChange(newValue);
|
|
46
|
-
setValue(newValue);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const getFormControlClassName = useMemo(() => {
|
|
50
|
-
const classNames: string[] = ['DsSelect'];
|
|
51
|
-
if (props.disabled) classNames.push('Mui-disabled');
|
|
52
|
-
if (value) classNames.push('Mui-filled');
|
|
53
|
-
|
|
54
|
-
return classNames;
|
|
55
|
-
}, [value, props.disabled]);
|
|
56
|
-
|
|
57
|
-
const getInputLabelClassName = useMemo(() => {
|
|
58
|
-
const classNames: string[] = [];
|
|
59
|
-
if (error) classNames.push('Mui-error');
|
|
60
|
-
if (props.disabled) classNames.push('Mui-disabled');
|
|
61
|
-
|
|
62
|
-
return classNames;
|
|
63
|
-
}, [error, props.disabled]);
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<Box sx={{ width }}>
|
|
67
|
-
<FormControl
|
|
68
|
-
id={label === placeholder ? 'select-mui' : 'select-ds'}
|
|
69
|
-
fullWidth
|
|
70
|
-
color={color}
|
|
71
|
-
className={getFormControlClassName.join(' ')}
|
|
72
|
-
sx={{
|
|
73
|
-
'.MuiOutlinedInput-input': {
|
|
74
|
-
marginTop: value ? '0px' : '2px'
|
|
75
|
-
}
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
<InputLabel className={getInputLabelClassName.join(' ')}>
|
|
79
|
-
{label}
|
|
80
|
-
</InputLabel>
|
|
81
|
-
<MuiSelect
|
|
82
|
-
sx={{
|
|
83
|
-
color: color + '! important',
|
|
84
|
-
'& .MuiSelect-select .notranslate::after': placeholder
|
|
85
|
-
? {
|
|
86
|
-
content: `"${placeholder}"`,
|
|
87
|
-
opacity:
|
|
88
|
-
label === placeholder ? '0 !important' : '1 !important'
|
|
89
|
-
}
|
|
90
|
-
: {}
|
|
91
|
-
}}
|
|
92
|
-
label={label}
|
|
93
|
-
placeholder={label === placeholder ? '' : placeholder}
|
|
94
|
-
value={value}
|
|
95
|
-
error={!!error}
|
|
96
|
-
notched={
|
|
97
|
-
/* eslint-disable-next-line no-undefined */
|
|
98
|
-
label === placeholder ? undefined : true
|
|
99
|
-
}
|
|
100
|
-
onChange={handleChange}
|
|
101
|
-
onBlur={onBlur}
|
|
102
|
-
IconComponent={({ className }) => (
|
|
103
|
-
<Icon
|
|
104
|
-
className={
|
|
105
|
-
props.disabled ? 'Mui-disabled SelectIcon' : 'SelectIcon'
|
|
106
|
-
}
|
|
107
|
-
icon={color === 'success' ? faCheck : faChevronDown}
|
|
108
|
-
size={color === 'success' ? 'md' : 'sm'}
|
|
109
|
-
sx={{
|
|
110
|
-
marginRight: '12px',
|
|
111
|
-
marginTop: color === 'success' ? '2px' : '0px',
|
|
112
|
-
transform:
|
|
113
|
-
className.toString().includes('iconOpen') &&
|
|
114
|
-
color !== 'success'
|
|
115
|
-
? 'rotate(180deg)'
|
|
116
|
-
: 'none'
|
|
117
|
-
}}
|
|
118
|
-
/>
|
|
119
|
-
)}
|
|
120
|
-
MenuProps={{
|
|
121
|
-
PaperProps: {
|
|
122
|
-
style: {
|
|
123
|
-
width
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}}
|
|
127
|
-
{...props}
|
|
128
|
-
>
|
|
129
|
-
{options?.map((option, i) => (
|
|
130
|
-
<MenuItem
|
|
131
|
-
key={i}
|
|
132
|
-
value={option as any}
|
|
133
|
-
onMouseEnter={(e: BaseSyntheticEvent) =>
|
|
134
|
-
(e.target.style.backgroundColor = '#D3E4F0')
|
|
135
|
-
}
|
|
136
|
-
onMouseLeave={(e: BaseSyntheticEvent) =>
|
|
137
|
-
(e.target.style.backgroundColor = '#ffffff')
|
|
138
|
-
}
|
|
139
|
-
>
|
|
140
|
-
{getOptionLabel ? getOptionLabel(option) : option['label']}
|
|
141
|
-
</MenuItem>
|
|
142
|
-
))}
|
|
143
|
-
</MuiSelect>
|
|
144
|
-
{(error || helperText) && (
|
|
145
|
-
<FormHelperText component="span" className={error ? 'Mui-error' : ''}>
|
|
146
|
-
{error || helperText}
|
|
147
|
-
</FormHelperText>
|
|
148
|
-
)}
|
|
149
|
-
</FormControl>
|
|
150
|
-
</Box>
|
|
151
|
-
);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
export default Select;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Select';
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
FocusEventHandler,
|
|
3
|
-
ReactNode,
|
|
4
|
-
useEffect,
|
|
5
|
-
useState
|
|
6
|
-
} from 'react';
|
|
7
|
-
|
|
8
|
-
import MuiTextField, { TextFieldProps } from '@mui/material/TextField';
|
|
9
|
-
import { InputProps as StandardInputProps } from '@mui/material/Input/Input';
|
|
10
|
-
|
|
11
|
-
interface Props extends Omit<TextFieldProps, 'error'> {
|
|
12
|
-
error?: string;
|
|
13
|
-
onBlur?: FocusEventHandler<unknown>;
|
|
14
|
-
onChange?: StandardInputProps['onChange'];
|
|
15
|
-
label: string;
|
|
16
|
-
value: string;
|
|
17
|
-
name: string;
|
|
18
|
-
placeholder?: string;
|
|
19
|
-
disabled?: boolean;
|
|
20
|
-
endAdornment?: ReactNode;
|
|
21
|
-
maxLength?: number;
|
|
22
|
-
}
|
|
23
|
-
const TextField = ({
|
|
24
|
-
name,
|
|
25
|
-
value,
|
|
26
|
-
error,
|
|
27
|
-
onBlur,
|
|
28
|
-
onChange,
|
|
29
|
-
label,
|
|
30
|
-
disabled,
|
|
31
|
-
endAdornment,
|
|
32
|
-
placeholder = '',
|
|
33
|
-
maxLength,
|
|
34
|
-
...props
|
|
35
|
-
}: Props) => {
|
|
36
|
-
const [internalValue, setInternalValue] = useState(value);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (value !== internalValue) {
|
|
39
|
-
setInternalValue(value);
|
|
40
|
-
}
|
|
41
|
-
}, [value]);
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<MuiTextField
|
|
45
|
-
id={label === placeholder ? 'text-field-mui' : 'text-field-ds'}
|
|
46
|
-
className="DsTextField"
|
|
47
|
-
variant="outlined"
|
|
48
|
-
name={name}
|
|
49
|
-
label={label}
|
|
50
|
-
value={internalValue}
|
|
51
|
-
placeholder={label === placeholder ? '' : placeholder}
|
|
52
|
-
FormHelperTextProps={{ component: 'div' } as any}
|
|
53
|
-
InputLabelProps={{
|
|
54
|
-
shrink:
|
|
55
|
-
/* eslint-disable-next-line no-undefined */
|
|
56
|
-
label === placeholder ? undefined : true
|
|
57
|
-
}}
|
|
58
|
-
onClick={(e) => e.stopPropagation()}
|
|
59
|
-
onChange={(e) => {
|
|
60
|
-
setInternalValue(e.currentTarget.value);
|
|
61
|
-
if (onChange) {
|
|
62
|
-
onChange(e);
|
|
63
|
-
}
|
|
64
|
-
}}
|
|
65
|
-
onBlur={(e) => {
|
|
66
|
-
if (onBlur) {
|
|
67
|
-
onBlur(e);
|
|
68
|
-
}
|
|
69
|
-
}}
|
|
70
|
-
error={!!error}
|
|
71
|
-
disabled={disabled}
|
|
72
|
-
InputProps={{ endAdornment }}
|
|
73
|
-
inputProps={{ maxLength }}
|
|
74
|
-
{...props}
|
|
75
|
-
helperText={
|
|
76
|
-
<div style={{ display: 'table', width: '100%' }}>
|
|
77
|
-
{(error || props.helperText) && (
|
|
78
|
-
<div
|
|
79
|
-
style={{
|
|
80
|
-
display: maxLength ? 'table-cell' : '',
|
|
81
|
-
float: 'left'
|
|
82
|
-
}}
|
|
83
|
-
>
|
|
84
|
-
{error || props.helperText}
|
|
85
|
-
</div>
|
|
86
|
-
)}
|
|
87
|
-
{maxLength && (
|
|
88
|
-
<div style={{ display: 'table-cell', float: 'right' }}>
|
|
89
|
-
{internalValue.length}/{maxLength} caract.
|
|
90
|
-
</div>
|
|
91
|
-
)}
|
|
92
|
-
</div>
|
|
93
|
-
}
|
|
94
|
-
/>
|
|
95
|
-
);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export default TextField;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './TextField';
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, ReactElement } from 'react';
|
|
2
|
-
import SvgIcon from '@mui/material/SvgIcon';
|
|
3
|
-
import { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
-
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
5
|
-
import Box, { BoxProps } from '@mui/material/Box';
|
|
6
|
-
import { useTheme } from '@mui/system';
|
|
7
|
-
|
|
8
|
-
const FontSizes = {
|
|
9
|
-
xs: 8,
|
|
10
|
-
sm: 12,
|
|
11
|
-
md: 16,
|
|
12
|
-
lg: 24,
|
|
13
|
-
xl: 32,
|
|
14
|
-
xxl: 40,
|
|
15
|
-
xxxl: 72
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
interface Props {
|
|
19
|
-
variant?: 'square' | 'none';
|
|
20
|
-
icon: IconDefinition;
|
|
21
|
-
color?: string;
|
|
22
|
-
size?: number | keyof typeof FontSizes;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
interface FontAwesomeSvgIconProps {
|
|
26
|
-
icon: any;
|
|
27
|
-
fontSize: number | undefined;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// eslint-disable-next-line react/display-name
|
|
31
|
-
const FontAwesomeSvgIcon = forwardRef<SVGSVGElement, FontAwesomeSvgIconProps>(
|
|
32
|
-
({ icon, fontSize }, ref) => {
|
|
33
|
-
const {
|
|
34
|
-
icon: [width, height, , , svgPathData]
|
|
35
|
-
} = icon;
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<SvgIcon
|
|
39
|
-
ref={ref}
|
|
40
|
-
viewBox={`0 0 ${width as string} ${height as string}`}
|
|
41
|
-
sx={{
|
|
42
|
-
fontSize: fontSize ?? '14px'
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
45
|
-
{typeof svgPathData === 'string' ? (
|
|
46
|
-
<path d={svgPathData} />
|
|
47
|
-
) : (
|
|
48
|
-
/**
|
|
49
|
-
* A multi-path Font Awesome icon seems to imply a duotune icon. The 0th path seems to
|
|
50
|
-
* be the faded element (referred to as the "secondary" path in the Font Awesome docs)
|
|
51
|
-
* of a duotone icon. 40% is the default opacity.
|
|
52
|
-
*
|
|
53
|
-
* @see https://fontawesome.com/how-to-use/on-the-web/styling/duotone-icons#changing-opacity
|
|
54
|
-
*/
|
|
55
|
-
svgPathData.map((d: string, i: number) => (
|
|
56
|
-
<path style={{ opacity: i === 0 ? 0.4 : 1 }} d={d} key={i} />
|
|
57
|
-
))
|
|
58
|
-
)}
|
|
59
|
-
</SvgIcon>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
const IconProvider = ({
|
|
65
|
-
variant = 'none',
|
|
66
|
-
icon,
|
|
67
|
-
color = '#136cac', // blueClickable
|
|
68
|
-
size = 16,
|
|
69
|
-
...props
|
|
70
|
-
}: Props & BoxProps): ReactElement => {
|
|
71
|
-
const getStyles = (): SxProps<Theme> => {
|
|
72
|
-
const theme = useTheme();
|
|
73
|
-
const usedColor = theme.palette[color]
|
|
74
|
-
? theme.palette[color]
|
|
75
|
-
: !color || color?.length === 0
|
|
76
|
-
? '#136cac'
|
|
77
|
-
: color;
|
|
78
|
-
|
|
79
|
-
switch (variant) {
|
|
80
|
-
case 'square':
|
|
81
|
-
return {
|
|
82
|
-
color: usedColor,
|
|
83
|
-
backgroundColor: `${usedColor}14`,
|
|
84
|
-
borderRadius: '4px',
|
|
85
|
-
borderColor: '1px solid ' + usedColor,
|
|
86
|
-
overflow: 'visible',
|
|
87
|
-
padding: '10px',
|
|
88
|
-
width: '35px',
|
|
89
|
-
height: '35px',
|
|
90
|
-
display: 'flex',
|
|
91
|
-
justifyContent: 'center',
|
|
92
|
-
alignItems: 'center'
|
|
93
|
-
};
|
|
94
|
-
default:
|
|
95
|
-
return {
|
|
96
|
-
color: usedColor,
|
|
97
|
-
width: usedFontSize,
|
|
98
|
-
height: size,
|
|
99
|
-
display: 'inline-flex',
|
|
100
|
-
alignItems: 'center',
|
|
101
|
-
justifyContent: 'center'
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const isKey = (key: PropertyKey): key is keyof typeof FontSizes => {
|
|
107
|
-
return key in FontSizes;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const usedFontSize: number =
|
|
111
|
-
variant === 'square'
|
|
112
|
-
? 16
|
|
113
|
-
: isKey(size)
|
|
114
|
-
? FontSizes[size]
|
|
115
|
-
: size >= 0
|
|
116
|
-
? size
|
|
117
|
-
: 16;
|
|
118
|
-
|
|
119
|
-
return (
|
|
120
|
-
<Box component="span" sx={getStyles()} {...props}>
|
|
121
|
-
<FontAwesomeSvgIcon icon={icon} fontSize={usedFontSize} />
|
|
122
|
-
</Box>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export default IconProvider;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Icon';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Link as LinkMui, LinkProps } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
interface Props extends Omit<LinkProps, 'variant'> {
|
|
5
|
-
variant?: 'link1' | 'link2';
|
|
6
|
-
component?: any;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const Link = (props: Props) => <LinkMui {...(props as LinkProps)} />;
|
|
10
|
-
|
|
11
|
-
export default Link;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './Link';
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Box,
|
|
4
|
-
Divider,
|
|
5
|
-
Pagination as MUIPagination,
|
|
6
|
-
MenuItem,
|
|
7
|
-
Select
|
|
8
|
-
} from '@mui/material';
|
|
9
|
-
|
|
10
|
-
import Text from '../Text';
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
totalString: string;
|
|
14
|
-
totalPerPageString: string;
|
|
15
|
-
totalPages: number;
|
|
16
|
-
limitsPerPage: number[];
|
|
17
|
-
setLimit?: (limit: number) => void;
|
|
18
|
-
setPage?: (page: number) => void;
|
|
19
|
-
page?: number;
|
|
20
|
-
limit?: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const Pagination = ({
|
|
24
|
-
totalString,
|
|
25
|
-
totalPerPageString,
|
|
26
|
-
totalPages,
|
|
27
|
-
limitsPerPage,
|
|
28
|
-
setLimit,
|
|
29
|
-
setPage,
|
|
30
|
-
page = 1,
|
|
31
|
-
limit
|
|
32
|
-
}: Props) => {
|
|
33
|
-
const [internalPage, setInternalPage] = useState<number>(page);
|
|
34
|
-
const [internalLimit, setInternalLimit] = useState<number>(
|
|
35
|
-
limit ?? limitsPerPage[0]
|
|
36
|
-
);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (page !== internalPage) {
|
|
39
|
-
setInternalPage(page);
|
|
40
|
-
}
|
|
41
|
-
}, [page]);
|
|
42
|
-
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (limit && limit !== internalLimit) {
|
|
45
|
-
setInternalLimit(limit);
|
|
46
|
-
}
|
|
47
|
-
}, [limit]);
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
<Box display="flex">
|
|
52
|
-
<Text color="greyXDark" variant="body1Bold" pt="10px" pr="16px">
|
|
53
|
-
{totalString}
|
|
54
|
-
</Text>
|
|
55
|
-
{totalPages > 1 && (
|
|
56
|
-
<>
|
|
57
|
-
<Divider
|
|
58
|
-
orientation="vertical"
|
|
59
|
-
sx={{ marginRight: '16px', color: 'greyXLight' }}
|
|
60
|
-
/>
|
|
61
|
-
<Select
|
|
62
|
-
sx={{
|
|
63
|
-
// @TODO replace by Select from ui-kit when ready
|
|
64
|
-
height: '32px',
|
|
65
|
-
width: '75px',
|
|
66
|
-
fontSize: '14px',
|
|
67
|
-
fontWeight: 400
|
|
68
|
-
}}
|
|
69
|
-
labelId="select-label"
|
|
70
|
-
id="dac-select-label"
|
|
71
|
-
value={internalLimit}
|
|
72
|
-
onChange={(event) => {
|
|
73
|
-
setInternalLimit(Number(event?.target?.value));
|
|
74
|
-
setLimit && setLimit(Number(event?.target?.value));
|
|
75
|
-
}}
|
|
76
|
-
>
|
|
77
|
-
{limitsPerPage.map((limit, id) => (
|
|
78
|
-
<MenuItem key={id} value={limit}>
|
|
79
|
-
{limit}
|
|
80
|
-
</MenuItem>
|
|
81
|
-
))}
|
|
82
|
-
</Select>
|
|
83
|
-
<Text
|
|
84
|
-
color="greyXDark"
|
|
85
|
-
variant="body1Regular"
|
|
86
|
-
pt="6px"
|
|
87
|
-
pl="6px"
|
|
88
|
-
pr="16px"
|
|
89
|
-
>
|
|
90
|
-
{totalPerPageString}
|
|
91
|
-
</Text>
|
|
92
|
-
<Divider
|
|
93
|
-
orientation="vertical"
|
|
94
|
-
sx={{ marginRight: '16px', color: 'greyXLight' }}
|
|
95
|
-
/>
|
|
96
|
-
</>
|
|
97
|
-
)}
|
|
98
|
-
</Box>
|
|
99
|
-
{totalPages > 1 && (
|
|
100
|
-
<Box display="flex" pr="4px">
|
|
101
|
-
<MUIPagination
|
|
102
|
-
variant="outlined"
|
|
103
|
-
shape="rounded"
|
|
104
|
-
count={totalPages}
|
|
105
|
-
page={internalPage}
|
|
106
|
-
onChange={(event: React.ChangeEvent<unknown>, value: number) => {
|
|
107
|
-
setInternalPage(value);
|
|
108
|
-
setPage && setPage(value);
|
|
109
|
-
}}
|
|
110
|
-
/>
|
|
111
|
-
</Box>
|
|
112
|
-
)}
|
|
113
|
-
</>
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
export default Pagination;
|