@zesty-io/material 0.2.5 → 0.3.1
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/es/ConfirmDialog/ConfirmDialog.stories.d.ts +6 -0
- package/es/ConfirmDialog/ConfirmDialog.stories.js +24 -0
- package/es/ConfirmDialog/index.d.ts +18 -0
- package/es/ConfirmDialog/index.js +11 -0
- package/es/ConfirmModal/ConfirmModal.stories.d.ts +6 -0
- package/es/ConfirmModal/ConfirmModal.stories.js +24 -0
- package/es/ConfirmModal/index.d.ts +18 -0
- package/es/ConfirmModal/index.js +11 -0
- package/es/CopyButton/CopyButton.stories.d.ts +5 -0
- package/es/CopyButton/CopyButton.stories.js +14 -0
- package/es/CopyButton/index.d.ts +10 -0
- package/es/CopyButton/index.js +26 -0
- package/es/FieldTypeColor/FieldTypeColor.stories.d.ts +5 -0
- package/es/FieldTypeColor/FieldTypeColor.stories.js +21 -0
- package/es/FieldTypeColor/index.d.ts +6 -0
- package/es/FieldTypeColor/index.js +16 -0
- package/es/FieldTypeDate/FieldTypeDate.stories.d.ts +5 -0
- package/es/FieldTypeDate/FieldTypeDate.stories.js +17 -0
- package/es/FieldTypeDate/index.d.ts +9 -0
- package/es/FieldTypeDate/index.js +10 -0
- package/es/FieldTypeDateTime/FieldTypeDateTime.stories.d.ts +5 -0
- package/es/FieldTypeDateTime/FieldTypeDateTime.stories.js +17 -0
- package/es/FieldTypeDateTime/index.d.ts +9 -0
- package/es/FieldTypeDateTime/index.js +10 -0
- package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.d.ts +5 -0
- package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.js +35 -0
- package/es/FieldTypeDropdown/index.d.ts +11 -0
- package/es/FieldTypeDropdown/index.js +10 -0
- package/es/FieldTypeNumber/FieldTypeNumber.stories.d.ts +5 -0
- package/es/FieldTypeNumber/FieldTypeNumber.stories.js +21 -0
- package/es/FieldTypeNumber/index.d.ts +6 -0
- package/es/FieldTypeNumber/index.js +7 -0
- package/es/FieldTypeOneToMany/FieldTypeOneToMany.stories.d.ts +5 -0
- package/es/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +28 -0
- package/es/FieldTypeOneToMany/index.d.ts +32 -0
- package/es/FieldTypeOneToMany/index.js +29 -0
- package/es/FieldTypeOneToOne/FieldTypeOneToOne.stories.d.ts +5 -0
- package/es/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +28 -0
- package/es/FieldTypeOneToOne/index.d.ts +34 -0
- package/es/FieldTypeOneToOne/index.js +33 -0
- package/es/FieldTypeSort/FieldTypeSort.stories.d.ts +5 -0
- package/es/FieldTypeSort/FieldTypeSort.stories.js +22 -0
- package/es/FieldTypeSort/index.d.ts +7 -0
- package/es/FieldTypeSort/index.js +34 -0
- package/es/FieldTypeText/FieldTypeText.stories.d.ts +6 -0
- package/es/FieldTypeText/FieldTypeText.stories.js +29 -0
- package/es/FieldTypeText/index.d.ts +12 -0
- package/es/FieldTypeText/index.js +7 -0
- package/es/FieldTypeUrl/FieldTypeUrl.stories.d.ts +5 -0
- package/es/FieldTypeUrl/FieldTypeUrl.stories.js +21 -0
- package/es/FieldTypeUrl/index.d.ts +12 -0
- package/es/FieldTypeUrl/index.js +14 -0
- package/es/LegacyTheme/index.d.ts +3 -0
- package/es/LegacyTheme/index.js +83 -0
- package/es/LegacyTheme/palette.d.ts +3 -0
- package/es/LegacyTheme/palette.js +23 -0
- package/{src/LegacyTheme/typography.ts → es/LegacyTheme/typography.d.ts} +1 -5
- package/es/LegacyTheme/typography.js +4 -0
- package/es/TextField.stories.d.ts +5 -0
- package/es/TextField.stories.js +18 -0
- package/es/VitualizedAutocomplete/VirtualizedAutocomplete.stories.d.ts +5 -0
- package/es/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +27 -0
- package/es/VitualizedAutocomplete/index.d.ts +28 -0
- package/es/VitualizedAutocomplete/index.js +21 -0
- package/es/icons/FolderGlobal.d.ts +3 -0
- package/es/icons/FolderGlobal.js +3 -0
- package/es/icons/index.d.ts +1 -0
- package/es/icons/index.js +1 -0
- package/{src/index.ts → es/index.d.ts} +4 -3
- package/es/index.js +15 -0
- package/es/stories/Theme.stories.d.ts +4 -0
- package/es/stories/Theme.stories.js +10 -0
- package/es/theme/Theme.stories.d.ts +4 -0
- package/es/theme/Theme.stories.js +10 -0
- package/es/theme/index.d.ts +11 -0
- package/es/theme/index.js +210 -0
- package/es/theme/palette.d.ts +16 -0
- package/es/theme/palette.js +138 -0
- package/es/theme/typography.d.ts +9 -0
- package/es/theme/typography.js +57 -0
- package/es/utils/virtualization.d.ts +2 -0
- package/es/utils/virtualization.js +63 -0
- package/package.json +12 -10
- package/.storybook/main.js +0 -25
- package/.storybook/preview-head.html +0 -1
- package/.storybook/preview.js +0 -15
- package/src/ConfirmDialog/ConfirmDialog.stories.tsx +0 -35
- package/src/ConfirmDialog/index.tsx +0 -50
- package/src/CopyButton/CopyButton.stories.tsx +0 -20
- package/src/CopyButton/index.tsx +0 -55
- package/src/FieldTypeColor/FieldTypeColor.stories.tsx +0 -35
- package/src/FieldTypeColor/index.tsx +0 -43
- package/src/FieldTypeDate/FieldTypeDate.stories.tsx +0 -23
- package/src/FieldTypeDate/index.tsx +0 -35
- package/src/FieldTypeDateTime/FieldTypeDateTime.stories.tsx +0 -23
- package/src/FieldTypeDateTime/index.tsx +0 -36
- package/src/FieldTypeNumber/FieldTypeNumber.stories.tsx +0 -35
- package/src/FieldTypeNumber/index.tsx +0 -22
- package/src/FieldTypeOneToMany/FieldTypeOneToMany.stories.tsx +0 -47
- package/src/FieldTypeOneToMany/index.tsx +0 -90
- package/src/FieldTypeOneToOne/FieldTypeOneToOne.stories.tsx +0 -46
- package/src/FieldTypeOneToOne/index.tsx +0 -96
- package/src/FieldTypeSort/FieldTypeSort.stories.tsx +0 -36
- package/src/FieldTypeSort/index.tsx +0 -70
- package/src/FieldTypeText/FieldTypeText.stories.tsx +0 -45
- package/src/FieldTypeText/index.tsx +0 -35
- package/src/FieldTypeUrl/FieldTypeUrl.stories.tsx +0 -33
- package/src/FieldTypeUrl/index.tsx +0 -44
- package/src/LegacyTheme/index.ts +0 -88
- package/src/LegacyTheme/palette.ts +0 -25
- package/src/VitualizedAutocomplete/VirtualizedAutocomplete.stories.tsx +0 -45
- package/src/VitualizedAutocomplete/index.tsx +0 -69
- package/src/theme/Theme.stories.tsx +0 -16
- package/src/theme/index.ts +0 -53
- package/src/theme/palette.ts +0 -153
- package/src/theme/typography.ts +0 -69
- package/src/utils/virtualization.tsx +0 -107
- package/tsconfig.json +0 -22
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
2
|
-
import MuiTextField, { OutlinedTextFieldProps } from '@mui/material/TextField';
|
|
3
|
-
import { Button, FormControl, FormLabel, InputAdornment } from '@mui/material';
|
|
4
|
-
import AddIcon from '@mui/icons-material/Add';
|
|
5
|
-
import RemoveIcon from '@mui/icons-material/Remove';
|
|
6
|
-
|
|
7
|
-
export interface FieldTypeSortProps extends Omit<OutlinedTextFieldProps, 'variant'> {
|
|
8
|
-
value: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const FieldTypeSort = ({label, value, InputProps, required, onChange, ...props }: FieldTypeSortProps) => {
|
|
12
|
-
return (
|
|
13
|
-
<FormControl fullWidth required={required}>
|
|
14
|
-
<FormLabel>{label}</FormLabel>
|
|
15
|
-
<MuiTextField
|
|
16
|
-
size="small"
|
|
17
|
-
variant='outlined'
|
|
18
|
-
type='number'
|
|
19
|
-
value={value}
|
|
20
|
-
onChange={onChange}
|
|
21
|
-
InputProps={{
|
|
22
|
-
startAdornment: (
|
|
23
|
-
<InputAdornment position="start">
|
|
24
|
-
<Button
|
|
25
|
-
size="small"
|
|
26
|
-
variant="contained"
|
|
27
|
-
onClick={(e) => {
|
|
28
|
-
e.stopPropagation();
|
|
29
|
-
// References input via click event in order to obtain its value
|
|
30
|
-
const input = e.currentTarget?.parentElement?.parentElement?.childNodes?.[1] as HTMLInputElement;
|
|
31
|
-
const newValue = String(+input.value - 1)
|
|
32
|
-
// Updates internal input value in case component is not controlled
|
|
33
|
-
input.value = newValue
|
|
34
|
-
// Mocks an event change
|
|
35
|
-
const event = {target: {value: newValue}}
|
|
36
|
-
onChange && onChange(event as ChangeEvent<HTMLTextAreaElement | HTMLInputElement>);
|
|
37
|
-
}}><RemoveIcon fontSize='small' />
|
|
38
|
-
</Button>
|
|
39
|
-
</InputAdornment>
|
|
40
|
-
),
|
|
41
|
-
endAdornment: (
|
|
42
|
-
<InputAdornment position="end">
|
|
43
|
-
<Button
|
|
44
|
-
size="small"
|
|
45
|
-
variant="contained"
|
|
46
|
-
onClick={(e) => {
|
|
47
|
-
e.stopPropagation();
|
|
48
|
-
// References input via click event in order to obtain its value
|
|
49
|
-
const input = e.currentTarget?.parentElement?.parentElement?.childNodes?.[1] as HTMLInputElement;
|
|
50
|
-
const newValue = String(+input.value + 1)
|
|
51
|
-
// Updates internal input value in case component is not controlled
|
|
52
|
-
input.value = newValue
|
|
53
|
-
// Mocks an event change
|
|
54
|
-
const event = {target: {value: newValue}}
|
|
55
|
-
onChange && onChange(event as ChangeEvent<HTMLTextAreaElement | HTMLInputElement>);
|
|
56
|
-
}}><AddIcon fontSize='small' />
|
|
57
|
-
</Button>
|
|
58
|
-
</InputAdornment>
|
|
59
|
-
),
|
|
60
|
-
// Spread props at the end to allow Input prop overrides
|
|
61
|
-
...InputProps,
|
|
62
|
-
}}
|
|
63
|
-
// Spread props at the end to allow prop overrides
|
|
64
|
-
{...props}
|
|
65
|
-
/>
|
|
66
|
-
</FormControl>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default FieldTypeSort;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, useState } from 'react';
|
|
2
|
-
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
3
|
-
import FieldTypeText, { FieldTypeTextProps } from './';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'FieldTypeText',
|
|
7
|
-
component: FieldTypeText,
|
|
8
|
-
argType: {},
|
|
9
|
-
} as Meta;
|
|
10
|
-
|
|
11
|
-
const Template: Story<FieldTypeTextProps> = (args) => {
|
|
12
|
-
const [value, setValue] = useState('');
|
|
13
|
-
|
|
14
|
-
const handleOnChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
15
|
-
setValue(e.target.value);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<FieldTypeText
|
|
21
|
-
{...args}
|
|
22
|
-
value={value}
|
|
23
|
-
onChange={handleOnChange}
|
|
24
|
-
/>
|
|
25
|
-
</>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const Default = Template.bind({});
|
|
30
|
-
Default.args = {
|
|
31
|
-
placeholder: 'Placeholder Text...',
|
|
32
|
-
label: 'Text label',
|
|
33
|
-
helperText: 'Text helper text',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const TextArea = Template.bind({});
|
|
37
|
-
TextArea.args = {
|
|
38
|
-
multiline: true,
|
|
39
|
-
rows: 4,
|
|
40
|
-
placeholder: 'Placeholder Text...',
|
|
41
|
-
label: 'Text Label',
|
|
42
|
-
helperText: 'Text helper text',
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import MuiTextField, { OutlinedTextFieldProps } from '@mui/material/TextField';
|
|
2
|
-
import { FormControl, FormLabel, Box } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
export interface FieldTypeTextProps extends Omit<OutlinedTextFieldProps, 'variant'> {
|
|
5
|
-
/**
|
|
6
|
-
* Max length of the field
|
|
7
|
-
* @default 150
|
|
8
|
-
*/
|
|
9
|
-
maxLength?: number;
|
|
10
|
-
value: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const FieldTypeText = ({label, maxLength = 150, value, helperText, required, ...props }: FieldTypeTextProps) => {
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<FormControl fullWidth required={required}>
|
|
17
|
-
{/* Sets flex order to make appended required asterisk properly positioned */}
|
|
18
|
-
<FormLabel sx={{display: 'flex', justifyContent: 'space-between', '& .MuiFormLabel-asterisk': {order: 2}}}>
|
|
19
|
-
<Box sx={{ order: 1}}>{label}</Box>
|
|
20
|
-
<Box sx={{ order: 3, flex: 1, textAlign: 'right'}}>{value?.length}/{maxLength}</Box>
|
|
21
|
-
</FormLabel>
|
|
22
|
-
<MuiTextField
|
|
23
|
-
size="small"
|
|
24
|
-
variant='outlined'
|
|
25
|
-
value={value}
|
|
26
|
-
error={value?.length > maxLength}
|
|
27
|
-
helperText={value?.length > maxLength ? 'Your input is over the specified limit' : helperText}
|
|
28
|
-
// Spread props at the end to allow prop overrides
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
</FormControl>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default FieldTypeText;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, useState } from 'react';
|
|
2
|
-
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
3
|
-
import FieldTypeUrl, { FieldTypeUrlProps } from './';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'FieldTypeUrl',
|
|
7
|
-
component: FieldTypeUrl,
|
|
8
|
-
argType: {},
|
|
9
|
-
} as Meta;
|
|
10
|
-
|
|
11
|
-
const Template: Story<FieldTypeUrlProps> = (args) => {
|
|
12
|
-
const [value, setValue] = useState('');
|
|
13
|
-
|
|
14
|
-
const handleOnChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
15
|
-
setValue(e.target.value);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<FieldTypeUrl
|
|
20
|
-
{...args}
|
|
21
|
-
value={value}
|
|
22
|
-
onChange={handleOnChange}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const Default = Template.bind({});
|
|
28
|
-
Default.args = {
|
|
29
|
-
placeholder: 'Placeholder Text...',
|
|
30
|
-
label: 'Some label',
|
|
31
|
-
fullWidth: true,
|
|
32
|
-
};
|
|
33
|
-
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import MuiTextField, { OutlinedTextFieldProps } from '@mui/material/TextField';
|
|
3
|
-
import { FormControl, FormLabel, Box } from '@mui/material';
|
|
4
|
-
|
|
5
|
-
export interface FieldTypeUrlProps extends Omit<OutlinedTextFieldProps, 'variant'> {
|
|
6
|
-
/**
|
|
7
|
-
* Max length of the field
|
|
8
|
-
* @default 2000
|
|
9
|
-
*/
|
|
10
|
-
maxLength?: number;
|
|
11
|
-
value: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const FieldTypeUrl = ({label, maxLength = 2000, value, helperText, required, inputProps, ...props }: FieldTypeUrlProps) => {
|
|
15
|
-
// Use state to hold input reference to re-render once ref changes in case error needs to be shown on mount
|
|
16
|
-
const [inputRef, setInputRef] = useState<HTMLInputElement>();
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<FormControl fullWidth required={required}>
|
|
20
|
-
{/* Sets flex order to make appended required asterisk properly positioned */}
|
|
21
|
-
<FormLabel sx={{display: 'flex', justifyContent: 'space-between', '& .MuiFormLabel-asterisk': {order: 2}}}>
|
|
22
|
-
<Box sx={{ order: 1}}>{label}</Box>
|
|
23
|
-
<Box sx={{ order: 3, flex: 1, textAlign: 'right'}}>{value?.length}/{maxLength}</Box>
|
|
24
|
-
</FormLabel>
|
|
25
|
-
<MuiTextField
|
|
26
|
-
size="small"
|
|
27
|
-
type='url'
|
|
28
|
-
variant='outlined'
|
|
29
|
-
value={value}
|
|
30
|
-
inputProps={{
|
|
31
|
-
ref: (inputRef: HTMLInputElement) => setInputRef(inputRef),
|
|
32
|
-
// Spread props at the end to allow inputProps prop overrides
|
|
33
|
-
...inputProps,
|
|
34
|
-
}}
|
|
35
|
-
error={(value && !inputRef?.validity.valid) || value?.length > maxLength}
|
|
36
|
-
helperText={value?.length > maxLength ? 'Your input is over the specified limit' : (value && !inputRef?.validity.valid) ? 'Your input is not a valid url' : helperText}
|
|
37
|
-
// Spread props at the end to allow prop overrides
|
|
38
|
-
{...props}
|
|
39
|
-
/>
|
|
40
|
-
</FormControl>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export default FieldTypeUrl;
|
package/src/LegacyTheme/index.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import palette from './palette';
|
|
2
|
-
import typography from './typography';
|
|
3
|
-
import { createTheme, Theme } from '@mui/material/styles';
|
|
4
|
-
|
|
5
|
-
let theme: Theme = createTheme({
|
|
6
|
-
palette,
|
|
7
|
-
typography,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
theme = createTheme(theme, {
|
|
11
|
-
components: {
|
|
12
|
-
MuiAccordionSummary: {
|
|
13
|
-
styleOverrides: {
|
|
14
|
-
root: {
|
|
15
|
-
backgroundColor: '#e4e9f1',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
MuiButton: {
|
|
20
|
-
styleOverrides: {
|
|
21
|
-
root: {
|
|
22
|
-
minWidth: 'auto',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
MuiTooltip: {
|
|
27
|
-
styleOverrides: {
|
|
28
|
-
tooltip: {
|
|
29
|
-
color: theme.palette.primary.contrastText,
|
|
30
|
-
backgroundColor: theme.palette.primary.main,
|
|
31
|
-
fontSize: '14px',
|
|
32
|
-
lineHeight: '20px',
|
|
33
|
-
},
|
|
34
|
-
arrow: {
|
|
35
|
-
color: theme.palette.primary.main,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
MuiInputBase: {
|
|
40
|
-
styleOverrides: {
|
|
41
|
-
root: {
|
|
42
|
-
backgroundColor: theme.palette.primary.contrastText,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
MuiFormLabel: {
|
|
47
|
-
styleOverrides: {
|
|
48
|
-
root: {
|
|
49
|
-
color: theme.palette.primary.dark,
|
|
50
|
-
},
|
|
51
|
-
asterisk: {
|
|
52
|
-
color: theme.palette.error.main,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
MuiCard: {
|
|
57
|
-
styleOverrides: {
|
|
58
|
-
root: {
|
|
59
|
-
overflow: 'visible',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
MuiCardHeader: {
|
|
64
|
-
styleOverrides: {
|
|
65
|
-
root: {
|
|
66
|
-
backgroundColor: '#e4e9f1',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
MuiToggleButton: {
|
|
71
|
-
styleOverrides: {
|
|
72
|
-
root: ({ ownerState, theme }: any) => ({
|
|
73
|
-
backgroundColor: `${
|
|
74
|
-
theme.palette[ownerState.color].contrastText
|
|
75
|
-
} !important`,
|
|
76
|
-
...(ownerState.selected && {
|
|
77
|
-
color: `${theme.palette[ownerState.color].contrastText} !important`,
|
|
78
|
-
backgroundColor: `${
|
|
79
|
-
theme.palette[ownerState.color].main
|
|
80
|
-
} !important`,
|
|
81
|
-
}),
|
|
82
|
-
}),
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export default theme;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PaletteOptions } from '@mui/material/styles';
|
|
2
|
-
const palette: PaletteOptions = {
|
|
3
|
-
primary: {
|
|
4
|
-
main: '#404759',
|
|
5
|
-
contrastText: '#ffffff',
|
|
6
|
-
},
|
|
7
|
-
secondary: {
|
|
8
|
-
main: '#497edf',
|
|
9
|
-
contrastText: '#ffffff',
|
|
10
|
-
},
|
|
11
|
-
success: {
|
|
12
|
-
main: '#75bf25',
|
|
13
|
-
contrastText: '#ffffff',
|
|
14
|
-
},
|
|
15
|
-
warning: {
|
|
16
|
-
main: '#f17829',
|
|
17
|
-
contrastText: '#ffffff',
|
|
18
|
-
},
|
|
19
|
-
error: {
|
|
20
|
-
main: '#e53c05',
|
|
21
|
-
contrastText: '#ffffff',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default palette;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ReactNode, SyntheticEvent, useState } from 'react';
|
|
2
|
-
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
3
|
-
import VirtualizedAutocomplete, { VirtualizedAutocompleteProps } from './';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'VirtualizedAutocomplete',
|
|
7
|
-
component: VirtualizedAutocomplete,
|
|
8
|
-
argType: {},
|
|
9
|
-
} as Meta;
|
|
10
|
-
|
|
11
|
-
const Template: Story<VirtualizedAutocompleteProps> = (args) => {
|
|
12
|
-
const [value, setValue] = useState<{component: string | ReactNode, value: string, inputLabel: string}>({component: '- None -', value: '0', inputLabel: '- None -'});
|
|
13
|
-
|
|
14
|
-
const [options, setOptions] = useState<{component: string | ReactNode, value: string, inputLabel: string}[]>([]);
|
|
15
|
-
|
|
16
|
-
const handleOnOpen = async () => {
|
|
17
|
-
const largeArr = new Array(1000).fill(null);
|
|
18
|
-
await new Promise((resolve) => setTimeout(resolve, 3000))
|
|
19
|
-
const data = largeArr.map((_, idx) => ({component: <div>{`Test ${idx}`}</div>, value: String(Math.random()), inputLabel: `Test ${idx}`}));
|
|
20
|
-
setOptions(data);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const handleOnChange = (e: SyntheticEvent<Element, Event>, option: {component: string | ReactNode, value: string, inputLabel: string}) => {
|
|
24
|
-
setValue(option);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<VirtualizedAutocomplete
|
|
29
|
-
{...args}
|
|
30
|
-
value={value}
|
|
31
|
-
onChange={handleOnChange}
|
|
32
|
-
options={options}
|
|
33
|
-
onOpen={handleOnOpen}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Default = Template.bind({});
|
|
39
|
-
Default.args = {
|
|
40
|
-
helperText: 'OneToOne helperText',
|
|
41
|
-
placeholder: 'OneToOne placeholder'
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { ReactNode, useState } from 'react';
|
|
2
|
-
import { AutocompleteProps, Popper, styled, TextField, FormLabel, FormControl, InputAdornment } from '@mui/material';
|
|
3
|
-
import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
4
|
-
import { ListboxComponent } from '../utils/virtualization';
|
|
5
|
-
|
|
6
|
-
export interface VirtualizedAutocompleteProps extends Omit<AutocompleteProps<any, false, false, false>, 'renderInput'> {
|
|
7
|
-
helperText?: string;
|
|
8
|
-
placeholder?: string;
|
|
9
|
-
error?: boolean;
|
|
10
|
-
startAdornment?: ReactNode;
|
|
11
|
-
endAdornment?: ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* Structure for option
|
|
14
|
-
*/
|
|
15
|
-
options: {
|
|
16
|
-
/**
|
|
17
|
-
* Component to be rendered in the dropdown
|
|
18
|
-
*/
|
|
19
|
-
component: ReactNode | string;
|
|
20
|
-
/**
|
|
21
|
-
* Value of option
|
|
22
|
-
*/
|
|
23
|
-
value: string;
|
|
24
|
-
/**
|
|
25
|
-
* Label that should display in the input when selected
|
|
26
|
-
*/
|
|
27
|
-
inputLabel: string;
|
|
28
|
-
}[]
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const VirtualizedAutocomplete = ({helperText, placeholder, error, startAdornment, endAdornment, ...props }: VirtualizedAutocompleteProps) => {
|
|
32
|
-
return (
|
|
33
|
-
<Autocomplete
|
|
34
|
-
fullWidth
|
|
35
|
-
disableListWrap
|
|
36
|
-
size='small'
|
|
37
|
-
PopperComponent={StyledPopper}
|
|
38
|
-
ListboxComponent={ListboxComponent}
|
|
39
|
-
renderInput={(params) => (
|
|
40
|
-
<TextField
|
|
41
|
-
{...params}
|
|
42
|
-
helperText={helperText}
|
|
43
|
-
error={error}
|
|
44
|
-
placeholder={placeholder}
|
|
45
|
-
InputProps={{
|
|
46
|
-
...params.InputProps,
|
|
47
|
-
startAdornment: <InputAdornment position='end'>{startAdornment}</InputAdornment>,
|
|
48
|
-
endAdornment: <>{params.InputProps.endAdornment}<InputAdornment sx={{ position: 'relative', right: '40px'}} position='end'>{endAdornment}</InputAdornment></>
|
|
49
|
-
}}
|
|
50
|
-
/>
|
|
51
|
-
)}
|
|
52
|
-
getOptionLabel={(option) => option.inputLabel}
|
|
53
|
-
renderOption={(props, option) => [props, option.component]}
|
|
54
|
-
{...props}
|
|
55
|
-
/>
|
|
56
|
-
);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default VirtualizedAutocomplete;
|
|
60
|
-
|
|
61
|
-
const StyledPopper = styled(Popper)({
|
|
62
|
-
[`& .${autocompleteClasses.listbox}`]: {
|
|
63
|
-
boxSizing: 'border-box',
|
|
64
|
-
'& ul': {
|
|
65
|
-
padding: 0,
|
|
66
|
-
margin: 0,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import ReactJson from 'react-json-view'
|
|
3
|
-
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
4
|
-
import theme from '.';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'Theme',
|
|
8
|
-
} as Meta;
|
|
9
|
-
|
|
10
|
-
const Template: Story = (args) => {
|
|
11
|
-
return (
|
|
12
|
-
<ReactJson src={theme} />
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const Default = Template.bind({});
|
package/src/theme/index.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import palette from './palette';
|
|
2
|
-
import typography from './typography';
|
|
3
|
-
import { createTheme, Theme } from '@mui/material/styles';
|
|
4
|
-
|
|
5
|
-
let theme: Theme = createTheme({
|
|
6
|
-
palette,
|
|
7
|
-
typography,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
theme = createTheme(theme, {
|
|
11
|
-
components: {
|
|
12
|
-
MuiFormLabel: {
|
|
13
|
-
styleOverrides: {
|
|
14
|
-
root: {
|
|
15
|
-
...theme.typography.body2,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
MuiTab: {
|
|
20
|
-
styleOverrides: {
|
|
21
|
-
root: {
|
|
22
|
-
borderBottom: 2,
|
|
23
|
-
borderColor: theme.palette.grey[100],
|
|
24
|
-
borderStyle: "solid",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
MuiCardHeader: {
|
|
29
|
-
styleOverrides: {
|
|
30
|
-
root: {
|
|
31
|
-
padding: "16px 16px 0px",
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
MuiCardContent: {
|
|
36
|
-
styleOverrides: {
|
|
37
|
-
root: {
|
|
38
|
-
padding: "8px 16px 16px",
|
|
39
|
-
":last-child": {
|
|
40
|
-
paddingBottom: "16px",
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
MuiButton: {
|
|
46
|
-
defaultProps: {
|
|
47
|
-
disableElevation: true,
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export default theme;
|
package/src/theme/palette.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { Color } from '@mui/material';
|
|
2
|
-
import { PaletteOptions } from '@mui/material/styles';
|
|
3
|
-
|
|
4
|
-
// Module augmentation
|
|
5
|
-
declare module '@mui/material/styles' {
|
|
6
|
-
export interface PaletteOptions {
|
|
7
|
-
red?: Partial<Color>;
|
|
8
|
-
deepPurple?: Partial<Color>;
|
|
9
|
-
deepOrange?: Partial<Color>;
|
|
10
|
-
pink?: Partial<Color>;
|
|
11
|
-
blue?: Partial<Color>;
|
|
12
|
-
green?: Partial<Color>;
|
|
13
|
-
purple?: Partial<Color>;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const palette: PaletteOptions = {
|
|
18
|
-
primary: {
|
|
19
|
-
main: "#FF5D03",
|
|
20
|
-
dark: "#EC4A0A",
|
|
21
|
-
light: "#FD853A",
|
|
22
|
-
},
|
|
23
|
-
success: {
|
|
24
|
-
main: "#12B76A",
|
|
25
|
-
dark: "#027A48",
|
|
26
|
-
light: "#D1FADF",
|
|
27
|
-
},
|
|
28
|
-
warning: {
|
|
29
|
-
main: "#F79009",
|
|
30
|
-
dark: "B54708",
|
|
31
|
-
light: "#FEF0C7",
|
|
32
|
-
},
|
|
33
|
-
error: {
|
|
34
|
-
main: "#F04438",
|
|
35
|
-
dark: "#B42318",
|
|
36
|
-
light: "#FECDCA",
|
|
37
|
-
},
|
|
38
|
-
info: {
|
|
39
|
-
main: "#0BA5EC",
|
|
40
|
-
dark: "#026AA2",
|
|
41
|
-
light: "#7CD4FD",
|
|
42
|
-
},
|
|
43
|
-
text: {
|
|
44
|
-
primary: "#101828",
|
|
45
|
-
secondary: "#475467",
|
|
46
|
-
},
|
|
47
|
-
grey: {
|
|
48
|
-
50: "#F9FAFB",
|
|
49
|
-
100: "#F2F4F7",
|
|
50
|
-
200: "#E4E7EC",
|
|
51
|
-
300: "#D0D5DD",
|
|
52
|
-
400: "#98A2B3",
|
|
53
|
-
500: "#667085",
|
|
54
|
-
600: "#475467",
|
|
55
|
-
700: "#344054",
|
|
56
|
-
800: "#1D2939",
|
|
57
|
-
900: "#101828",
|
|
58
|
-
},
|
|
59
|
-
deepPurple: {
|
|
60
|
-
50: '#F8F9FC',
|
|
61
|
-
100: '#EAECF5',
|
|
62
|
-
200: '#C8CCE5',
|
|
63
|
-
300: '#9EA5D1',
|
|
64
|
-
400: "#4E5BA6",
|
|
65
|
-
500: '#4E5BA6',
|
|
66
|
-
600: '#3E4784',
|
|
67
|
-
700: '#363F72',
|
|
68
|
-
800: '#293056',
|
|
69
|
-
900: '#101323'
|
|
70
|
-
},
|
|
71
|
-
deepOrange: {
|
|
72
|
-
50: "#FFF6ED",
|
|
73
|
-
100: "#FFEAD5",
|
|
74
|
-
200: "#FDDCAB",
|
|
75
|
-
300: "#FEB273",
|
|
76
|
-
400: "#FD853A",
|
|
77
|
-
500: "#FF5C08",
|
|
78
|
-
600: "#EC4A0A",
|
|
79
|
-
700: "#C4320A",
|
|
80
|
-
800: "#9C2A10",
|
|
81
|
-
900: "#7E2410",
|
|
82
|
-
},
|
|
83
|
-
red: {
|
|
84
|
-
50: '#FEF3F2',
|
|
85
|
-
100: '#FEE4E2',
|
|
86
|
-
200: '#FECDCA',
|
|
87
|
-
300: '#FDA29B',
|
|
88
|
-
400: '#F97066',
|
|
89
|
-
500: '#F04438',
|
|
90
|
-
600: '#D92D20',
|
|
91
|
-
700: '#B42318',
|
|
92
|
-
800: '#912018',
|
|
93
|
-
900: '#7A271A',
|
|
94
|
-
},
|
|
95
|
-
pink: {
|
|
96
|
-
50: '#FDF2FA',
|
|
97
|
-
100: '#FCE7F6',
|
|
98
|
-
200: '#FCCEEE',
|
|
99
|
-
300: '#FAA7E0',
|
|
100
|
-
400: "#F670C7",
|
|
101
|
-
500: '#EE46BC',
|
|
102
|
-
600: '#DD2590',
|
|
103
|
-
700: '#C11574',
|
|
104
|
-
800: '#9E165F',
|
|
105
|
-
900: '#851651',
|
|
106
|
-
},
|
|
107
|
-
blue: {
|
|
108
|
-
50: '#F0F9FF',
|
|
109
|
-
100: "#E0F2FE",
|
|
110
|
-
200: '#B9E6FE',
|
|
111
|
-
300: '#7CD4FD',
|
|
112
|
-
400: "#36BFFA",
|
|
113
|
-
500: '#0BA5EC',
|
|
114
|
-
600: '#0086C9',
|
|
115
|
-
700: '#026AA2',
|
|
116
|
-
800: '#065986',
|
|
117
|
-
900: '#0B4A6F',
|
|
118
|
-
},
|
|
119
|
-
green: {
|
|
120
|
-
50: '#ECFDF3',
|
|
121
|
-
100: "#D1FADF",
|
|
122
|
-
200: '#A6F4C5',
|
|
123
|
-
300: '#6CE9A6',
|
|
124
|
-
400: "#32D583",
|
|
125
|
-
500: '#12B76A',
|
|
126
|
-
600: '#039855',
|
|
127
|
-
700: '#027A48',
|
|
128
|
-
800: '#05603A',
|
|
129
|
-
900: '#054F31',
|
|
130
|
-
},
|
|
131
|
-
purple: {
|
|
132
|
-
50: '#F3E5F5',
|
|
133
|
-
100: '#E1BEE7',
|
|
134
|
-
200: '#CE93D8',
|
|
135
|
-
300: '#BA68C8',
|
|
136
|
-
400: '#AB47BC',
|
|
137
|
-
500: '#9C27B0',
|
|
138
|
-
600: '#8E24AA',
|
|
139
|
-
700: '#7B1FA2',
|
|
140
|
-
800: '#6A1B9A',
|
|
141
|
-
900: '#4A148C',
|
|
142
|
-
},
|
|
143
|
-
action: {
|
|
144
|
-
active: "rgba(16, 24, 40, 0.40)",
|
|
145
|
-
hover: "rgba(16, 24, 40, 0.04)",
|
|
146
|
-
selected: "rgba(16, 24, 40, 0.08)",
|
|
147
|
-
disabled: "rgba(16, 24, 40, 0.26)",
|
|
148
|
-
disabledBackground: "rgba(16, 24, 40, 0.12)",
|
|
149
|
-
focus: "rgba(16, 24, 40, 0.12)",
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
export default palette;
|