norma-library 0.5.3 → 0.5.50
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/esm/components/Accordion.js +7 -11
- package/dist/esm/components/Accordion.js.map +1 -1
- package/dist/esm/components/Avatar.js +3 -7
- package/dist/esm/components/Avatar.js.map +1 -1
- package/dist/esm/components/Badge.js +3 -7
- package/dist/esm/components/Badge.js.map +1 -1
- package/dist/esm/components/Button.js +5 -9
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Card.js +4 -7
- package/dist/esm/components/Card.js.map +1 -1
- package/dist/esm/components/CheckBox.js +3 -6
- package/dist/esm/components/CheckBox.js.map +1 -1
- package/dist/esm/components/DataGrid/index.js +29 -33
- package/dist/esm/components/DataGrid/index.js.map +1 -1
- package/dist/esm/components/DatePicker.js +6 -11
- package/dist/esm/components/DatePicker.js.map +1 -1
- package/dist/esm/components/DropDown.js +5 -10
- package/dist/esm/components/DropDown.js.map +1 -1
- package/dist/esm/components/IconButton.js +4 -7
- package/dist/esm/components/IconButton.js.map +1 -1
- package/dist/esm/components/Modal.js +11 -15
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Paper.js +3 -7
- package/dist/esm/components/Paper.js.map +1 -1
- package/dist/esm/components/ProgressBar.js +11 -15
- package/dist/esm/components/ProgressBar.js.map +1 -1
- package/dist/esm/components/RadioGroup.js +6 -10
- package/dist/esm/components/RadioGroup.js.map +1 -1
- package/dist/esm/components/RangerSlider.js +4 -7
- package/dist/esm/components/RangerSlider.js.map +1 -1
- package/dist/esm/components/Select.js +10 -14
- package/dist/esm/components/Select.js.map +1 -1
- package/dist/esm/components/Tabs.js +8 -11
- package/dist/esm/components/Tabs.js.map +1 -1
- package/dist/esm/components/Tag.js +8 -11
- package/dist/esm/components/Tag.js.map +1 -1
- package/dist/esm/components/TextField.js +4 -8
- package/dist/esm/components/TextField.js.map +1 -1
- package/dist/esm/components/TimeLine.js +4 -7
- package/dist/esm/components/TimeLine.js.map +1 -1
- package/dist/esm/components/TimePicker.js +6 -11
- package/dist/esm/components/TimePicker.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/NormaProvider.d.ts +3 -0
- package/dist/esm/providers/NormaProvider.js +7 -0
- package/dist/esm/providers/NormaProvider.js.map +1 -0
- package/package.json +1 -1
- package/src/components/Accordion.tsx +17 -25
- package/src/components/Avatar.tsx +3 -8
- package/src/components/Badge.tsx +3 -8
- package/src/components/Button.tsx +11 -16
- package/src/components/Card.tsx +7 -12
- package/src/components/CheckBox.tsx +5 -8
- package/src/components/DataGrid/index.tsx +87 -94
- package/src/components/DatePicker.tsx +9 -15
- package/src/components/DropDown.tsx +15 -22
- package/src/components/IconButton.tsx +7 -11
- package/src/components/Modal.tsx +40 -45
- package/src/components/Paper.tsx +3 -10
- package/src/components/ProgressBar.tsx +12 -19
- package/src/components/RadioGroup.tsx +21 -28
- package/src/components/RangerSlider.tsx +4 -9
- package/src/components/Select.tsx +34 -42
- package/src/components/Tabs.tsx +15 -20
- package/src/components/Tag.tsx +13 -17
- package/src/components/TextField.tsx +5 -10
- package/src/components/TimeLine.tsx +5 -9
- package/src/components/TimePicker.tsx +8 -14
- package/src/index.ts +2 -0
- package/src/providers/NormaProvider.tsx +13 -0
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { FormControlLabel, Checkbox as MuiCheckbox
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormControlLabel, Checkbox as MuiCheckbox } from '@mui/material';
|
|
3
3
|
|
|
4
4
|
import { CheckBoxBaseProps } from '../interfaces';
|
|
5
5
|
|
|
6
|
-
import { themes } from '../helpers';
|
|
7
6
|
import { styled } from '@mui/material/styles';
|
|
8
7
|
|
|
9
8
|
const CheckBoxStyled = styled(MuiCheckbox)({});
|
|
10
9
|
|
|
11
10
|
export const CheckBox = ({ ...props }: CheckBoxBaseProps) => {
|
|
12
|
-
|
|
13
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
14
|
-
|
|
11
|
+
|
|
15
12
|
return (
|
|
16
|
-
|
|
13
|
+
<>
|
|
17
14
|
{props.label ? (
|
|
18
15
|
<FormControlLabel control={<CheckBoxStyled {...props} />} label={props.label} />
|
|
19
16
|
) : (
|
|
20
17
|
<CheckBoxStyled {...props} />
|
|
21
18
|
)}
|
|
22
|
-
|
|
19
|
+
</>
|
|
23
20
|
);
|
|
24
21
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useEffect,
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Box, Stack,
|
|
3
|
+
import { Box, Stack, Paper } from '@mui/material';
|
|
4
4
|
|
|
5
5
|
import Table from '@mui/material/Table';
|
|
6
6
|
import TableBody from '@mui/material/TableBody';
|
|
@@ -14,8 +14,6 @@ import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
|
14
14
|
|
|
15
15
|
import { DataGridBaseProps, DataSourceItem } from '../../interfaces';
|
|
16
16
|
|
|
17
|
-
import { themes } from '../../helpers';
|
|
18
|
-
|
|
19
17
|
import DropdownFilter from './base/dropdown';
|
|
20
18
|
import { Pagination as MuiPagination } from '@mui/material';
|
|
21
19
|
|
|
@@ -66,9 +64,6 @@ export function Cog6ToothIcon(props: any) {
|
|
|
66
64
|
const dataSource = generateRandomDataSource(30);
|
|
67
65
|
|
|
68
66
|
export const DataGrid: React.FC<DataGridBaseProps> = ({ data = [] }) => {
|
|
69
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
|
70
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.light), [prefersDarkMode]);
|
|
71
|
-
|
|
72
67
|
const pageSize = 10;
|
|
73
68
|
const columns = data[0].columns;
|
|
74
69
|
|
|
@@ -162,93 +157,91 @@ export const DataGrid: React.FC<DataGridBaseProps> = ({ data = [] }) => {
|
|
|
162
157
|
}, [selectedItems]);
|
|
163
158
|
|
|
164
159
|
return (
|
|
165
|
-
<
|
|
166
|
-
<
|
|
167
|
-
<
|
|
168
|
-
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
<
|
|
174
|
-
<
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
>
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
</TableCellStyled>
|
|
216
|
-
))}
|
|
217
|
-
</TableRow>
|
|
218
|
-
</TableHead>
|
|
219
|
-
<TableBody>
|
|
220
|
-
{newDataSource &&
|
|
221
|
-
newDataSource.map((item: DataSourceItem, key: number) => (
|
|
222
|
-
<TableRowStyled key={key} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}>
|
|
223
|
-
{Object.keys(item).map(columnKey => (
|
|
224
|
-
<TableCell component="th" scope="row" key={columnKey}>
|
|
225
|
-
{item[columnKey]}
|
|
226
|
-
</TableCell>
|
|
227
|
-
))}
|
|
228
|
-
</TableRowStyled>
|
|
160
|
+
<Box sx={{ width: '100%', minHeight: 480 }}>
|
|
161
|
+
<DataGridHeaderStyled>
|
|
162
|
+
<TotalRecordsStyled>{totalRecords} results found for this search</TotalRecordsStyled>
|
|
163
|
+
<HeaderCogStyled type="button">
|
|
164
|
+
<Cog6ToothIcon width={24} height={24} />
|
|
165
|
+
</HeaderCogStyled>
|
|
166
|
+
</DataGridHeaderStyled>
|
|
167
|
+
<TableContainer component={Paper} sx={{ overflowX: 'inherit' }}>
|
|
168
|
+
<Table sx={{ minWidth: 650, width: '100%' }} aria-label="a dense table">
|
|
169
|
+
<TableHead>
|
|
170
|
+
<TableRow>
|
|
171
|
+
{columns &&
|
|
172
|
+
columns.map((item: any, key: any) => (
|
|
173
|
+
<TableCellStyled
|
|
174
|
+
key={key}
|
|
175
|
+
ref={ref => (sortRefs.current[key] = ref as React.RefObject<HTMLTableCellElement> | null)}
|
|
176
|
+
>
|
|
177
|
+
<Stack direction="row" spacing={2} sx={{ position: 'relative' }}>
|
|
178
|
+
<ButtonStyled
|
|
179
|
+
variant="text"
|
|
180
|
+
size="small"
|
|
181
|
+
color={currentActiveSorting === item.field ? 'primary' : 'inherit'}
|
|
182
|
+
endIcon={
|
|
183
|
+
currentActiveSorting === item.field && sorting === 'up' ? (
|
|
184
|
+
<ArrowDropUpIcon />
|
|
185
|
+
) : (
|
|
186
|
+
<ArrowDropDownIcon />
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
onClick={() => {
|
|
190
|
+
handleDropDown(item.field);
|
|
191
|
+
}}
|
|
192
|
+
>
|
|
193
|
+
{item.headerText}
|
|
194
|
+
</ButtonStyled>
|
|
195
|
+
{currentDropDownActive && currentDropDownActive === item.field && (
|
|
196
|
+
<DropdownFilter
|
|
197
|
+
format={item.format}
|
|
198
|
+
onOrder={handleSorting}
|
|
199
|
+
onFilter={handleFilter}
|
|
200
|
+
onSelected={handleItemSelected}
|
|
201
|
+
itemsSelected={selectedItems}
|
|
202
|
+
onFilterSelected={handleFilterSelected}
|
|
203
|
+
onChecketAll={setSelectAll}
|
|
204
|
+
onSelectAll={selectAll}
|
|
205
|
+
data={groupByDataSource(dataSource, item.field)}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
208
|
+
</Stack>
|
|
209
|
+
</TableCellStyled>
|
|
229
210
|
))}
|
|
230
|
-
</
|
|
231
|
-
</
|
|
232
|
-
<
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
211
|
+
</TableRow>
|
|
212
|
+
</TableHead>
|
|
213
|
+
<TableBody>
|
|
214
|
+
{newDataSource &&
|
|
215
|
+
newDataSource.map((item: DataSourceItem, key: number) => (
|
|
216
|
+
<TableRowStyled key={key} sx={{ '&:last-child td, &:last-child th': { border: 0 } }}>
|
|
217
|
+
{Object.keys(item).map(columnKey => (
|
|
218
|
+
<TableCell component="th" scope="row" key={columnKey}>
|
|
219
|
+
{item[columnKey]}
|
|
220
|
+
</TableCell>
|
|
221
|
+
))}
|
|
222
|
+
</TableRowStyled>
|
|
223
|
+
))}
|
|
224
|
+
</TableBody>
|
|
225
|
+
</Table>
|
|
226
|
+
<Stack
|
|
227
|
+
spacing={2}
|
|
228
|
+
sx={{
|
|
229
|
+
display: 'flex',
|
|
230
|
+
justifyContent: 'center',
|
|
231
|
+
alignItems: 'center',
|
|
232
|
+
borderTop: '1px solid #ccc',
|
|
233
|
+
padding: 2,
|
|
234
|
+
}}
|
|
235
|
+
>
|
|
236
|
+
<MuiPagination
|
|
237
|
+
variant="outlined"
|
|
238
|
+
shape="rounded"
|
|
239
|
+
count={totalPages}
|
|
240
|
+
page={currentPage}
|
|
241
|
+
onChange={(_event, page) => handleChangePage(page)}
|
|
242
|
+
/>
|
|
243
|
+
</Stack>
|
|
244
|
+
</TableContainer>
|
|
245
|
+
</Box>
|
|
253
246
|
);
|
|
254
247
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { ThemeProvider, useMediaQuery } from '@mui/material';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import { DemoContainer } from '@mui/x-date-pickers/internals/demo';
|
|
4
3
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
5
4
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
@@ -7,7 +6,6 @@ import { DatePicker as MuiDatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
|
7
6
|
import { MobileDatePicker as MuiMobileDatePicker } from '@mui/x-date-pickers/MobileDatePicker';
|
|
8
7
|
import { DesktopDatePicker as MuiDesktopDatePicker } from '@mui/x-date-pickers/DesktopDatePicker';
|
|
9
8
|
import { DatePickerBaseProps } from '../interfaces';
|
|
10
|
-
import { themes } from '../helpers';
|
|
11
9
|
import { styled } from '@mui/material/styles';
|
|
12
10
|
|
|
13
11
|
import 'dayjs/locale/pt-br';
|
|
@@ -56,18 +54,14 @@ export const DatePicker = ({
|
|
|
56
54
|
language = 'pt-br',
|
|
57
55
|
variant = 'desktop',
|
|
58
56
|
}: DatePickerBaseProps) => {
|
|
59
|
-
|
|
60
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
61
|
-
|
|
57
|
+
|
|
62
58
|
return (
|
|
63
|
-
<
|
|
64
|
-
<
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</LocalizationProvider>
|
|
71
|
-
</ThemeProvider>
|
|
59
|
+
<LocalizationProvider dateAdapter={AdapterDayjs} adapterLocale={language}>
|
|
60
|
+
<DemoContainer components={['TimePicker', 'MobileTimePicker', 'DesktopTimePicker']}>
|
|
61
|
+
{variant === 'responsive' && <MuiDatePickerStyled label={label} format={format} />}
|
|
62
|
+
{variant === 'mobile' && <MuiMobileDatePickerStyled label={label} format={format} />}
|
|
63
|
+
{variant === 'desktop' && <MuiDesktopDatePickerStyled label={label} format={format} />}
|
|
64
|
+
</DemoContainer>
|
|
65
|
+
</LocalizationProvider>
|
|
72
66
|
);
|
|
73
67
|
};
|
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Menu as MuiDropDown
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Menu as MuiDropDown } from '@mui/material';
|
|
3
3
|
import { DropDownBaseProps } from '../interfaces';
|
|
4
|
-
import { themes } from '../helpers';
|
|
5
4
|
import { styled } from '@mui/material/styles';
|
|
6
5
|
|
|
7
6
|
const DropDownStyled = styled(MuiDropDown)({});
|
|
8
7
|
|
|
9
8
|
export const DropDown = ({ open, children, ...props }: DropDownBaseProps) => {
|
|
10
|
-
|
|
11
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
12
|
-
|
|
9
|
+
|
|
13
10
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{children}
|
|
27
|
-
</DropDownStyled>
|
|
28
|
-
</>
|
|
29
|
-
</ThemeProvider>
|
|
11
|
+
<DropDownStyled
|
|
12
|
+
open
|
|
13
|
+
id="basic-menu"
|
|
14
|
+
anchorEl={props.anchorEl}
|
|
15
|
+
onClose={props.onClose}
|
|
16
|
+
MenuListProps={{
|
|
17
|
+
'aria-labelledby': 'basic-button',
|
|
18
|
+
}}
|
|
19
|
+
{...props}
|
|
20
|
+
>
|
|
21
|
+
{children}
|
|
22
|
+
</DropDownStyled>
|
|
30
23
|
);
|
|
31
24
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { IconButton as MuiIconButton
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconButton as MuiIconButton } from '@mui/material';
|
|
3
3
|
import { IconButtonBaseProps } from '../interfaces';
|
|
4
|
-
import { palette
|
|
4
|
+
import { palette } from '../helpers';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { ButtonVariant, ColorVariant } from '@/types';
|
|
7
7
|
|
|
@@ -28,14 +28,10 @@ const IconButtonStyled = styled(MuiIconButton)<{
|
|
|
28
28
|
}));
|
|
29
29
|
|
|
30
30
|
export const IconButton = ({ circle = false, children, ...props }: IconButtonBaseProps) => {
|
|
31
|
-
|
|
32
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.dark : themes.light), [prefersDarkMode]);
|
|
33
|
-
|
|
31
|
+
|
|
34
32
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</IconButtonStyled>
|
|
39
|
-
</ThemeProvider>
|
|
33
|
+
<IconButtonStyled circle={circle} color="primary" variant="text" cursor="default" {...props}>
|
|
34
|
+
{children}
|
|
35
|
+
</IconButtonStyled>
|
|
40
36
|
);
|
|
41
37
|
};
|
package/src/components/Modal.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Modal as MuiModal, Paper, Box
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal as MuiModal, Paper, Box } from '@mui/material';
|
|
3
3
|
import { ModalBaseProps } from '../interfaces';
|
|
4
|
-
import { themes } from '../helpers';
|
|
5
4
|
import { styled } from '@mui/material/styles';
|
|
6
5
|
import { IconButton } from './IconButton';
|
|
7
6
|
import { Button } from './Button';
|
|
@@ -67,48 +66,44 @@ export function Close() {
|
|
|
67
66
|
}
|
|
68
67
|
|
|
69
68
|
export const Modal = ({ open, children, ...props }: ModalBaseProps) => {
|
|
70
|
-
|
|
71
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
72
|
-
|
|
69
|
+
|
|
73
70
|
return (
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
</ModalStyled>
|
|
112
|
-
</ThemeProvider>
|
|
71
|
+
<ModalStyled open {...props}>
|
|
72
|
+
<ModalContentStyled>
|
|
73
|
+
{props.title && (
|
|
74
|
+
<ModalHeaderStyled>
|
|
75
|
+
<>
|
|
76
|
+
<h2>{props.title}</h2>
|
|
77
|
+
<IconButton
|
|
78
|
+
onClick={props.onClose}
|
|
79
|
+
size="small"
|
|
80
|
+
color="inherit"
|
|
81
|
+
variant="text"
|
|
82
|
+
cursor="pointer"
|
|
83
|
+
sx={{ position: 'absolute', right: 0, top: 5 }}
|
|
84
|
+
>
|
|
85
|
+
<Close />
|
|
86
|
+
</IconButton>
|
|
87
|
+
</>
|
|
88
|
+
</ModalHeaderStyled>
|
|
89
|
+
)}
|
|
90
|
+
{children}
|
|
91
|
+
{props.action && (
|
|
92
|
+
<ModalFooterStyled>
|
|
93
|
+
{props.action.map((item, key) => (
|
|
94
|
+
<Button
|
|
95
|
+
color={item.color}
|
|
96
|
+
variant={item.variant}
|
|
97
|
+
key={key}
|
|
98
|
+
onClick={item.action}
|
|
99
|
+
style={{ marginLeft: 10 }}
|
|
100
|
+
>
|
|
101
|
+
{item.label}
|
|
102
|
+
</Button>
|
|
103
|
+
))}
|
|
104
|
+
</ModalFooterStyled>
|
|
105
|
+
)}
|
|
106
|
+
</ModalContentStyled>
|
|
107
|
+
</ModalStyled>
|
|
113
108
|
);
|
|
114
109
|
};
|
package/src/components/Paper.tsx
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Paper as MuiPaper
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Paper as MuiPaper } from '@mui/material';
|
|
3
3
|
import { PaperBaseProps } from '../interfaces';
|
|
4
|
-
import { themes } from '../helpers';
|
|
5
4
|
import { styled } from '@mui/material/styles';
|
|
6
5
|
|
|
7
6
|
const PaperStyled = styled(MuiPaper)({});
|
|
8
7
|
|
|
9
8
|
export const Paper = ({ children, ...props }: PaperBaseProps & {}) => {
|
|
10
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
|
11
|
-
|
|
12
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
13
|
-
|
|
14
9
|
return (
|
|
15
|
-
<
|
|
16
|
-
<PaperStyled {...props}>{children}</PaperStyled>
|
|
17
|
-
</ThemeProvider>
|
|
10
|
+
<PaperStyled {...props}>{children}</PaperStyled>
|
|
18
11
|
);
|
|
19
12
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
LinearProgress as MuiProgressBar,
|
|
4
4
|
linearProgressClasses,
|
|
5
|
-
ThemeProvider,
|
|
6
|
-
useMediaQuery,
|
|
7
5
|
Typography,
|
|
8
6
|
} from '@mui/material';
|
|
9
7
|
|
|
10
8
|
import { ProgressBarBaseProps } from '../interfaces';
|
|
11
|
-
import { themes } from '../helpers';
|
|
12
9
|
import { styled } from '@mui/material/styles';
|
|
13
10
|
|
|
14
11
|
const ProgressBarStyled = styled(MuiProgressBar)({
|
|
@@ -32,23 +29,19 @@ const ProgressBarLabelStyled = styled(Typography)`
|
|
|
32
29
|
`;
|
|
33
30
|
|
|
34
31
|
export const ProgressBar = ({ value = 0, label, variant = 'determinate', total, ...props }: ProgressBarBaseProps) => {
|
|
35
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
|
36
32
|
const percentage = value && total ? (value / total) * 100 : 0;
|
|
37
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
38
33
|
|
|
39
34
|
return (
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</div>
|
|
52
|
-
</ThemeProvider>
|
|
35
|
+
<div style={{ minWidth: '100px' }}>
|
|
36
|
+
{label && (
|
|
37
|
+
<ProgressBarLabelStyled>
|
|
38
|
+
{label}
|
|
39
|
+
<span style={{ right: 0 }}>
|
|
40
|
+
{total} ({percentage.toFixed(2)}%)
|
|
41
|
+
</span>
|
|
42
|
+
</ProgressBarLabelStyled>
|
|
43
|
+
)}
|
|
44
|
+
<ProgressBarStyled value={value} variant={variant} {...props} />
|
|
45
|
+
</div>
|
|
53
46
|
);
|
|
54
47
|
};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
FormControl,
|
|
4
4
|
FormControlLabel,
|
|
5
5
|
FormLabel,
|
|
6
6
|
Radio as MuiRadio,
|
|
7
7
|
RadioGroup as MuiRadioGroup,
|
|
8
|
-
ThemeProvider,
|
|
9
|
-
useMediaQuery,
|
|
10
8
|
} from '@mui/material';
|
|
11
9
|
|
|
12
|
-
import { themes } from '../helpers';
|
|
13
10
|
import { styled } from '@mui/material/styles';
|
|
14
11
|
import { RadioBaseProps } from '../interfaces/RadioGroup';
|
|
15
12
|
import { TextFieldSizeVariant } from '../types';
|
|
@@ -18,30 +15,26 @@ const RadioStyled = styled(MuiRadio)({});
|
|
|
18
15
|
const sizes: TextFieldSizeVariant[] = ['small', 'medium'];
|
|
19
16
|
|
|
20
17
|
export const RadioGroup = ({ ...props }: RadioBaseProps) => {
|
|
21
|
-
|
|
22
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
23
|
-
|
|
18
|
+
|
|
24
19
|
return (
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
</FormControl>
|
|
45
|
-
</ThemeProvider>
|
|
20
|
+
<FormControl>
|
|
21
|
+
<FormLabel id={props.id}>{props.label}</FormLabel>
|
|
22
|
+
<MuiRadioGroup
|
|
23
|
+
aria-labelledby={props.id}
|
|
24
|
+
defaultValue={props.checked}
|
|
25
|
+
name="radio-buttons-group"
|
|
26
|
+
row={props.direction === 'horizontal' ? true : false}
|
|
27
|
+
>
|
|
28
|
+
{props.options &&
|
|
29
|
+
props.options.map((item, key) => (
|
|
30
|
+
<FormControlLabel
|
|
31
|
+
value={item.value}
|
|
32
|
+
control={<RadioStyled color={props.color} size={item.size ? item.size : sizes[1]} />}
|
|
33
|
+
label={item.label}
|
|
34
|
+
key={key}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
</MuiRadioGroup>
|
|
38
|
+
</FormControl>
|
|
46
39
|
);
|
|
47
40
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { Slider as MuiSlider
|
|
3
|
-
import { palette
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Slider as MuiSlider } from '@mui/material';
|
|
3
|
+
import { palette } from '../helpers';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { ColorVariant } from '@/types';
|
|
6
6
|
import { RangerSliderBaseProps } from '@/interfaces/RangerSlider';
|
|
@@ -59,12 +59,7 @@ const RangerSliderStyled = styled(MuiSlider)(() => ({
|
|
|
59
59
|
}));
|
|
60
60
|
|
|
61
61
|
export const RangerSlider = ({ defaultValue = 50, color = 'primary', ...props }: RangerSliderBaseProps) => {
|
|
62
|
-
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
|
|
63
|
-
const theme = useMemo(() => (prefersDarkMode ? themes.light : themes.dark), [prefersDarkMode]);
|
|
64
|
-
|
|
65
62
|
return (
|
|
66
|
-
<
|
|
67
|
-
<RangerSliderStyled aria-label="Default" color={color} {...props} />
|
|
68
|
-
</ThemeProvider>
|
|
63
|
+
<RangerSliderStyled aria-label="Default" color={color} {...props} />
|
|
69
64
|
);
|
|
70
65
|
};
|