norma-library 0.6.2 → 0.6.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.
- package/.babelrc.json +18 -18
- package/.prettierignore +10 -10
- package/.prettierrc.json +20 -20
- package/.storybook/main.ts +20 -20
- package/.storybook/preview.ts +15 -15
- package/README.md +43 -43
- package/commitlint.config.js +1 -1
- package/dist/esm/components/UncontrolledTable/components/header/index.js +3 -1
- package/dist/esm/components/UncontrolledTable/components/header/index.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/components/header/styles.js +1 -1
- package/dist/esm/components/UncontrolledTable/components/header/styles.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/index.js +1 -1
- package/dist/esm/components/UncontrolledTable/index.js.map +1 -1
- package/dist/esm/components/UncontrolledTable/interface.d.ts +2 -0
- package/docs/index.md +118 -118
- package/package.json +136 -136
- package/src/components/Accordion.tsx +39 -39
- package/src/components/Avatar.tsx +17 -17
- package/src/components/Badge.tsx +14 -14
- package/src/components/Box/index.tsx +12 -12
- package/src/components/Box/interfaces.ts +3 -3
- package/src/components/Box/styles.tsx +22 -22
- package/src/components/Breadcrumb/index.tsx +27 -27
- package/src/components/Breadcrumb/interface.ts +8 -8
- package/src/components/Breadcrumb/styles.tsx +32 -32
- package/src/components/Button.tsx +26 -26
- package/src/components/Card.tsx +37 -37
- package/src/components/ChatMessage.tsx +87 -87
- package/src/components/ChatMessageBalloon/ChatMessageBalloon.style.ts +56 -56
- package/src/components/ChatMessageBalloon/ChatMessageBalloon.tsx +55 -55
- package/src/components/CheckBox.tsx +21 -21
- package/src/components/DateInput/index.tsx +34 -34
- package/src/components/DateInput/interface.ts +13 -13
- package/src/components/DateInput/styles.tsx +27 -27
- package/src/components/DatePicker.tsx +67 -67
- package/src/components/DropDown.tsx +24 -24
- package/src/components/IconButton.tsx +37 -37
- package/src/components/Icons.tsx +82 -82
- package/src/components/Modal.tsx +103 -103
- package/src/components/MultiSelectInput/components/MultiValue/index.tsx +44 -44
- package/src/components/MultiSelectInput/components/Option/index.tsx +62 -62
- package/src/components/MultiSelectInput/components/Option/styles.tsx +8 -8
- package/src/components/MultiSelectInput/index.tsx +60 -60
- package/src/components/MultiSelectInput/interfaces.ts +15 -15
- package/src/components/MultiSelectInput/styles.tsx +43 -43
- package/src/components/Paper.tsx +12 -12
- package/src/components/ProgressBar.tsx +71 -71
- package/src/components/RadioGroup.tsx +43 -43
- package/src/components/RangerSlider.tsx +65 -65
- package/src/components/Select.tsx +74 -74
- package/src/components/SelectInput/components/Option/index.tsx +61 -61
- package/src/components/SelectInput/components/Option/styles.tsx +8 -8
- package/src/components/SelectInput/index.tsx +45 -45
- package/src/components/SelectInput/interfaces.ts +15 -15
- package/src/components/SelectInput/styles.tsx +31 -31
- package/src/components/StatusModal/StatusModal.style.tsx +75 -75
- package/src/components/StatusModal/StatusModal.tsx +58 -58
- package/src/components/Svgs.tsx +506 -506
- package/src/components/Table/components/header/index.tsx +86 -86
- package/src/components/Table/components/header/styles.tsx +59 -59
- package/src/components/Table/components/index.tsx +8 -8
- package/src/components/Table/components/pagination/index.tsx +39 -39
- package/src/components/Table/components/pagination/styles.tsx +28 -28
- package/src/components/Table/components/tbody/index.tsx +30 -30
- package/src/components/Table/components/tbody/styles.tsx +4 -4
- package/src/components/Table/index.tsx +317 -317
- package/src/components/Table/interface.ts +23 -23
- package/src/components/Table/styles.tsx +117 -117
- package/src/components/Tabs.tsx +105 -105
- package/src/components/Tag.tsx +33 -33
- package/src/components/TextField.tsx +19 -19
- package/src/components/TextInput/index.tsx +37 -37
- package/src/components/TextInput/interface.ts +9 -9
- package/src/components/TextInput/styles.tsx +23 -23
- package/src/components/TimeLine.tsx +89 -89
- package/src/components/TimePicker.tsx +78 -78
- package/src/components/Typography/Text/index.tsx +20 -20
- package/src/components/Typography/Text/interfaces.ts +5 -5
- package/src/components/Typography/Text/styles.tsx +40 -40
- package/src/components/Typography/Title/index.tsx +22 -22
- package/src/components/Typography/Title/interfaces.ts +6 -6
- package/src/components/Typography/Title/styles.tsx +40 -40
- package/src/components/Typography/index.tsx +6 -6
- package/src/components/UncontrolledTable/components/header/index.tsx +72 -65
- package/src/components/UncontrolledTable/components/header/styles.tsx +65 -63
- package/src/components/UncontrolledTable/components/index.tsx +8 -8
- package/src/components/UncontrolledTable/components/pagination/index.tsx +43 -43
- package/src/components/UncontrolledTable/components/pagination/styles.tsx +28 -28
- package/src/components/UncontrolledTable/components/tbody/index.tsx +33 -33
- package/src/components/UncontrolledTable/components/tbody/styles.tsx +32 -32
- package/src/components/UncontrolledTable/index.tsx +222 -221
- package/src/components/UncontrolledTable/interface.ts +44 -43
- package/src/components/UncontrolledTable/styles.tsx +123 -123
- package/src/components/UncontrolledTabs/UncontrolledTabs.style.tsx +56 -56
- package/src/components/UncontrolledTabs/UncontrolledTabs.tsx +68 -68
- package/src/components/index.ts +24 -24
- package/src/helpers/alignments.ts +14 -14
- package/src/helpers/borders.ts +18 -18
- package/src/helpers/colors.ts +258 -258
- package/src/helpers/index.ts +5 -5
- package/src/helpers/radios.ts +24 -24
- package/src/helpers/sizes.ts +72 -72
- package/src/hooks/useClickOutside.tsx +18 -18
- package/src/index.ts +70 -70
- package/src/interfaces/Accordion.ts +12 -12
- package/src/interfaces/Avatar.tsx +15 -15
- package/src/interfaces/Badge.ts +19 -19
- package/src/interfaces/Button.ts +22 -22
- package/src/interfaces/Card.ts +11 -11
- package/src/interfaces/ChatMessage.ts +12 -12
- package/src/interfaces/ChatMessageBalloon.ts +17 -17
- package/src/interfaces/CheckBox.ts +27 -27
- package/src/interfaces/DatePicker.ts +13 -13
- package/src/interfaces/DropDown.ts +14 -14
- package/src/interfaces/IconButton.ts +22 -22
- package/src/interfaces/Icons.ts +17 -17
- package/src/interfaces/Modal.ts +18 -18
- package/src/interfaces/Paper.ts +12 -12
- package/src/interfaces/ProgressBar.ts +29 -29
- package/src/interfaces/RadioGroup.ts +23 -23
- package/src/interfaces/RangerSlider.ts +21 -21
- package/src/interfaces/Select.ts +17 -17
- package/src/interfaces/Tabs.ts +19 -19
- package/src/interfaces/Tag.ts +17 -17
- package/src/interfaces/TextField.ts +44 -44
- package/src/interfaces/TimeLine.ts +11 -11
- package/src/interfaces/TimePicker.ts +13 -13
- package/src/interfaces/index.ts +23 -23
- package/src/providers/NormaProvider.tsx +13 -13
- package/src/sample-data-2.json +178 -178
- package/src/sample-data.json +177 -177
- package/src/stories/Accordion.stories.tsx +65 -65
- package/src/stories/Avatar.stories.tsx +123 -123
- package/src/stories/Badge.stories.tsx +39 -39
- package/src/stories/Box.stories.tsx +35 -35
- package/src/stories/Breadcrumb.stories.tsx +44 -44
- package/src/stories/Button.stories.tsx +93 -93
- package/src/stories/Card.stories.tsx +39 -39
- package/src/stories/ChatMessage.stories.tsx +84 -84
- package/src/stories/ChatMessageBalloon.stories.tsx +108 -108
- package/src/stories/CheckBox.stories.tsx +88 -88
- package/src/stories/DateInput.stories.tsx +51 -51
- package/src/stories/DatePicker.stories.tsx +50 -50
- package/src/stories/DropDown.stories.tsx +57 -57
- package/src/stories/IconButton.stories.tsx +78 -78
- package/src/stories/Modal.stories.tsx +246 -246
- package/src/stories/ModalStatus.stories.tsx +46 -46
- package/src/stories/MultiSelectInput.stories.tsx +90 -90
- package/src/stories/Paper.stories.tsx +53 -53
- package/src/stories/ProgressBar.stories.tsx +116 -116
- package/src/stories/RadioGroup.stories.tsx +87 -87
- package/src/stories/RangerSlider.stories.tsx +149 -149
- package/src/stories/Select.stories.tsx +100 -100
- package/src/stories/SelectInput.stories.tsx +78 -78
- package/src/stories/Table.stories.tsx +372 -372
- package/src/stories/Tabs.stories.tsx +61 -61
- package/src/stories/Tag.stories.tsx +56 -56
- package/src/stories/Text.stories.tsx +37 -37
- package/src/stories/TextField.stories.tsx +310 -310
- package/src/stories/TextInput.stories.tsx +52 -52
- package/src/stories/TimeLine.stories.tsx +35 -35
- package/src/stories/TimePicker.stories.tsx +87 -87
- package/src/stories/Title.stories.tsx +43 -43
- package/src/stories/UncontrolledTable.stories.tsx +315 -305
- package/src/stories/UncontrolledTabs.stories.tsx +63 -63
- package/src/styles/globals.scss +17 -17
- package/src/types/index.ts +207 -207
- package/src/utils/styledBreakpoints.ts +25 -25
- package/vite.config.ts +15 -15
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
import { breakpoints } from '../../utils/styledBreakpoints';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
|
|
4
|
-
export const Container = styled.div`
|
|
5
|
-
background-color: #fff;
|
|
6
|
-
`;
|
|
7
|
-
|
|
8
|
-
export const Table = styled.table`
|
|
9
|
-
display: table;
|
|
10
|
-
width: 100%;
|
|
11
|
-
border-collapse: collapse;
|
|
12
|
-
border-spacing: 0;
|
|
13
|
-
min-width: 650px;
|
|
14
|
-
border: none;
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
const StickyStyles = `
|
|
18
|
-
position: sticky;
|
|
19
|
-
top: 0;
|
|
20
|
-
z-index: 99;
|
|
21
|
-
background: #fff;
|
|
22
|
-
`;
|
|
23
|
-
|
|
24
|
-
export const Thead = styled.thead<{ $sticky?: boolean }>`
|
|
25
|
-
display: table-header-group;
|
|
26
|
-
${props => props.$sticky && StickyStyles}
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export const TableRow = styled.tr`
|
|
30
|
-
color: inherit;
|
|
31
|
-
display: table-row;
|
|
32
|
-
vertical-align: middle;
|
|
33
|
-
outline: 0;
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
export const Th = styled.th`
|
|
37
|
-
font-weight: 500;
|
|
38
|
-
font-size: 0.875rem;
|
|
39
|
-
line-height: 1.5rem;
|
|
40
|
-
letter-spacing: 0.01071em;
|
|
41
|
-
display: table-cell;
|
|
42
|
-
vertical-align: inherit;
|
|
43
|
-
border-bottom: 1px solid rgba(224, 224, 224, 1);
|
|
44
|
-
text-align: left;
|
|
45
|
-
padding: 16px;
|
|
46
|
-
${breakpoints({
|
|
47
|
-
cssProp: 'padding',
|
|
48
|
-
cssPropUnits: 'px',
|
|
49
|
-
values: [{ 1440: 8 }],
|
|
50
|
-
mediaQueryType: 'max-width',
|
|
51
|
-
})};
|
|
52
|
-
color: rgba(0, 0, 0, 0.87);
|
|
53
|
-
color: #666666;
|
|
54
|
-
font-size: 0.875rem;
|
|
55
|
-
font-weight: 700;
|
|
56
|
-
`;
|
|
57
|
-
|
|
58
|
-
export const ColumnContent = styled.div`
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
gap: 5px;
|
|
62
|
-
`;
|
|
63
|
-
|
|
64
|
-
export const TextColumn = styled.span``;
|
|
65
|
-
|
|
66
|
-
export const IconFilterDialog = styled.div`
|
|
67
|
-
height: 20px;
|
|
68
|
-
width: 20px;
|
|
69
|
-
`;
|
|
70
|
-
|
|
71
|
-
export const FilterDialog = styled.div`
|
|
72
|
-
position: absolute;
|
|
73
|
-
padding: 10px 0;
|
|
74
|
-
margin: 6px 0px 0 0;
|
|
75
|
-
width: max-content;
|
|
76
|
-
background: #fff;
|
|
77
|
-
box-shadow: 0px 3px 6px #00000029;
|
|
78
|
-
border: 1px solid #e0e0e0;
|
|
79
|
-
z-index: 99;
|
|
80
|
-
`;
|
|
81
|
-
|
|
82
|
-
export const ListFilterDialog = styled.div`
|
|
83
|
-
display: flex;
|
|
84
|
-
flex-direction: column;
|
|
85
|
-
.label {
|
|
86
|
-
margin: 0 0 8px 0;
|
|
87
|
-
color: #666666;
|
|
88
|
-
font-size: 14px;
|
|
89
|
-
font-weight: 400;
|
|
90
|
-
text-align: left;
|
|
91
|
-
}
|
|
92
|
-
.select {
|
|
93
|
-
border: 1px solid #e0e0e0;
|
|
94
|
-
padding: 8px 12px;
|
|
95
|
-
}
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
export const OptionFilterDialog = styled.div`
|
|
99
|
-
display: flex;
|
|
100
|
-
gap: 16px;
|
|
101
|
-
align-items: center;
|
|
102
|
-
padding: 6px 15px;
|
|
103
|
-
cursor: pointer;
|
|
104
|
-
&:hover {
|
|
105
|
-
background: rgba(0, 0, 0, 0.04);
|
|
106
|
-
}
|
|
107
|
-
.icon {
|
|
108
|
-
color: #666;
|
|
109
|
-
}
|
|
110
|
-
.rotate {
|
|
111
|
-
rotate: 180deg;
|
|
112
|
-
}
|
|
113
|
-
div {
|
|
114
|
-
width: 20px;
|
|
115
|
-
height: 20px;
|
|
116
|
-
}
|
|
117
|
-
p {
|
|
118
|
-
margin: 0;
|
|
119
|
-
color: #666666;
|
|
120
|
-
font-size: 16px;
|
|
121
|
-
font-weight: 400;
|
|
122
|
-
}
|
|
123
|
-
`;
|
|
1
|
+
import { breakpoints } from '../../utils/styledBreakpoints';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
export const Container = styled.div`
|
|
5
|
+
background-color: #fff;
|
|
6
|
+
`;
|
|
7
|
+
|
|
8
|
+
export const Table = styled.table`
|
|
9
|
+
display: table;
|
|
10
|
+
width: 100%;
|
|
11
|
+
border-collapse: collapse;
|
|
12
|
+
border-spacing: 0;
|
|
13
|
+
min-width: 650px;
|
|
14
|
+
border: none;
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const StickyStyles = `
|
|
18
|
+
position: sticky;
|
|
19
|
+
top: 0;
|
|
20
|
+
z-index: 99;
|
|
21
|
+
background: #fff;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const Thead = styled.thead<{ $sticky?: boolean }>`
|
|
25
|
+
display: table-header-group;
|
|
26
|
+
${props => props.$sticky && StickyStyles}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
export const TableRow = styled.tr`
|
|
30
|
+
color: inherit;
|
|
31
|
+
display: table-row;
|
|
32
|
+
vertical-align: middle;
|
|
33
|
+
outline: 0;
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const Th = styled.th`
|
|
37
|
+
font-weight: 500;
|
|
38
|
+
font-size: 0.875rem;
|
|
39
|
+
line-height: 1.5rem;
|
|
40
|
+
letter-spacing: 0.01071em;
|
|
41
|
+
display: table-cell;
|
|
42
|
+
vertical-align: inherit;
|
|
43
|
+
border-bottom: 1px solid rgba(224, 224, 224, 1);
|
|
44
|
+
text-align: left;
|
|
45
|
+
padding: 16px;
|
|
46
|
+
${breakpoints({
|
|
47
|
+
cssProp: 'padding',
|
|
48
|
+
cssPropUnits: 'px',
|
|
49
|
+
values: [{ 1440: 8 }],
|
|
50
|
+
mediaQueryType: 'max-width',
|
|
51
|
+
})};
|
|
52
|
+
color: rgba(0, 0, 0, 0.87);
|
|
53
|
+
color: #666666;
|
|
54
|
+
font-size: 0.875rem;
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
export const ColumnContent = styled.div`
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 5px;
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export const TextColumn = styled.span``;
|
|
65
|
+
|
|
66
|
+
export const IconFilterDialog = styled.div`
|
|
67
|
+
height: 20px;
|
|
68
|
+
width: 20px;
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export const FilterDialog = styled.div`
|
|
72
|
+
position: absolute;
|
|
73
|
+
padding: 10px 0;
|
|
74
|
+
margin: 6px 0px 0 0;
|
|
75
|
+
width: max-content;
|
|
76
|
+
background: #fff;
|
|
77
|
+
box-shadow: 0px 3px 6px #00000029;
|
|
78
|
+
border: 1px solid #e0e0e0;
|
|
79
|
+
z-index: 99;
|
|
80
|
+
`;
|
|
81
|
+
|
|
82
|
+
export const ListFilterDialog = styled.div`
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
.label {
|
|
86
|
+
margin: 0 0 8px 0;
|
|
87
|
+
color: #666666;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
font-weight: 400;
|
|
90
|
+
text-align: left;
|
|
91
|
+
}
|
|
92
|
+
.select {
|
|
93
|
+
border: 1px solid #e0e0e0;
|
|
94
|
+
padding: 8px 12px;
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
export const OptionFilterDialog = styled.div`
|
|
99
|
+
display: flex;
|
|
100
|
+
gap: 16px;
|
|
101
|
+
align-items: center;
|
|
102
|
+
padding: 6px 15px;
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
&:hover {
|
|
105
|
+
background: rgba(0, 0, 0, 0.04);
|
|
106
|
+
}
|
|
107
|
+
.icon {
|
|
108
|
+
color: #666;
|
|
109
|
+
}
|
|
110
|
+
.rotate {
|
|
111
|
+
rotate: 180deg;
|
|
112
|
+
}
|
|
113
|
+
div {
|
|
114
|
+
width: 20px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
}
|
|
117
|
+
p {
|
|
118
|
+
margin: 0;
|
|
119
|
+
color: #666666;
|
|
120
|
+
font-size: 16px;
|
|
121
|
+
font-weight: 400;
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
-
import { TabsProps } from '@mui/material/Tabs';
|
|
4
|
-
|
|
5
|
-
import { Tab, Tabs } from '@mui/material';
|
|
6
|
-
import { ColorVariant } from '@/types';
|
|
7
|
-
import { palette } from '../../helpers';
|
|
8
|
-
|
|
9
|
-
const colorMap: Record<ColorVariant, string> = {
|
|
10
|
-
inherit: palette.inherit,
|
|
11
|
-
primary: palette.primary,
|
|
12
|
-
secondary: palette.secondary,
|
|
13
|
-
error: palette.error,
|
|
14
|
-
warning: palette.warning,
|
|
15
|
-
info: palette.info,
|
|
16
|
-
success: palette.success,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
interface StyledTabProps {
|
|
20
|
-
label: string;
|
|
21
|
-
color: ColorVariant;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const NormaTabs: React.ComponentType<TabsProps & { color: ColorVariant }> = styled(Tabs)<{
|
|
25
|
-
color: ColorVariant;
|
|
26
|
-
}>(({ color }) => ({
|
|
27
|
-
borderBottom: '1px solid #e8e8e8',
|
|
28
|
-
'& .Mui-selected': {
|
|
29
|
-
color: colorMap[color],
|
|
30
|
-
},
|
|
31
|
-
'& .MuiTabs-indicator': {
|
|
32
|
-
backgroundColor: colorMap[color],
|
|
33
|
-
},
|
|
34
|
-
'& .MuiButtonBase-root': {
|
|
35
|
-
textTransform: 'none',
|
|
36
|
-
},
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
export const NormaTab: React.ComponentType<StyledTabProps> = styled((props: StyledTabProps) => (
|
|
40
|
-
<Tab disableRipple {...props} />
|
|
41
|
-
))(({ theme, color }) => ({
|
|
42
|
-
textTransform: 'none',
|
|
43
|
-
fontWeight: theme.typography.fontWeightRegular,
|
|
44
|
-
fontSize: theme.typography.pxToRem(15),
|
|
45
|
-
marginRight: theme.spacing(1),
|
|
46
|
-
color: '#666666',
|
|
47
|
-
padding: '5px 15px',
|
|
48
|
-
top: '5px',
|
|
49
|
-
minWidth: '60px',
|
|
50
|
-
'&.Mui-selected': {
|
|
51
|
-
color: colorMap[color],
|
|
52
|
-
},
|
|
53
|
-
'&.Mui-focusVisible': {
|
|
54
|
-
backgroundColor: 'rgba(100, 95, 228, 0.32)',
|
|
55
|
-
},
|
|
56
|
-
}));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { TabsProps } from '@mui/material/Tabs';
|
|
4
|
+
|
|
5
|
+
import { Tab, Tabs } from '@mui/material';
|
|
6
|
+
import { ColorVariant } from '@/types';
|
|
7
|
+
import { palette } from '../../helpers';
|
|
8
|
+
|
|
9
|
+
const colorMap: Record<ColorVariant, string> = {
|
|
10
|
+
inherit: palette.inherit,
|
|
11
|
+
primary: palette.primary,
|
|
12
|
+
secondary: palette.secondary,
|
|
13
|
+
error: palette.error,
|
|
14
|
+
warning: palette.warning,
|
|
15
|
+
info: palette.info,
|
|
16
|
+
success: palette.success,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
interface StyledTabProps {
|
|
20
|
+
label: string;
|
|
21
|
+
color: ColorVariant;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const NormaTabs: React.ComponentType<TabsProps & { color: ColorVariant }> = styled(Tabs)<{
|
|
25
|
+
color: ColorVariant;
|
|
26
|
+
}>(({ color }) => ({
|
|
27
|
+
borderBottom: '1px solid #e8e8e8',
|
|
28
|
+
'& .Mui-selected': {
|
|
29
|
+
color: colorMap[color],
|
|
30
|
+
},
|
|
31
|
+
'& .MuiTabs-indicator': {
|
|
32
|
+
backgroundColor: colorMap[color],
|
|
33
|
+
},
|
|
34
|
+
'& .MuiButtonBase-root': {
|
|
35
|
+
textTransform: 'none',
|
|
36
|
+
},
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
export const NormaTab: React.ComponentType<StyledTabProps> = styled((props: StyledTabProps) => (
|
|
40
|
+
<Tab disableRipple {...props} />
|
|
41
|
+
))(({ theme, color }) => ({
|
|
42
|
+
textTransform: 'none',
|
|
43
|
+
fontWeight: theme.typography.fontWeightRegular,
|
|
44
|
+
fontSize: theme.typography.pxToRem(15),
|
|
45
|
+
marginRight: theme.spacing(1),
|
|
46
|
+
color: '#666666',
|
|
47
|
+
padding: '5px 15px',
|
|
48
|
+
top: '5px',
|
|
49
|
+
minWidth: '60px',
|
|
50
|
+
'&.Mui-selected': {
|
|
51
|
+
color: colorMap[color],
|
|
52
|
+
},
|
|
53
|
+
'&.Mui-focusVisible': {
|
|
54
|
+
backgroundColor: 'rgba(100, 95, 228, 0.32)',
|
|
55
|
+
},
|
|
56
|
+
}));
|
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
import React, { SyntheticEvent } from 'react';
|
|
2
|
-
import { Box, SxProps } from '@mui/material';
|
|
3
|
-
import { ColorVariant, DataTabs, MuiTabsBaseProps, TabsVariant } from '@/types';
|
|
4
|
-
import { NormaTab, NormaTabs } from './UncontrolledTabs.style';
|
|
5
|
-
import { Theme } from '@emotion/react';
|
|
6
|
-
|
|
7
|
-
interface Props extends MuiTabsBaseProps {
|
|
8
|
-
sx?: SxProps<Theme>;
|
|
9
|
-
tabs: DataTabs[];
|
|
10
|
-
tab: number;
|
|
11
|
-
onTabChange: (event: SyntheticEvent, tab: number) => void;
|
|
12
|
-
color?: ColorVariant;
|
|
13
|
-
variant?: TabsVariant;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface TabPanelProps {
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
index: number;
|
|
19
|
-
value: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function TabPanel(props: TabPanelProps) {
|
|
23
|
-
const { children, value, index, ...other } = props;
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div
|
|
27
|
-
role="tabpanel"
|
|
28
|
-
hidden={value !== index}
|
|
29
|
-
id={`simple-tabpanel-${index}`}
|
|
30
|
-
aria-labelledby={`simple-tab-${index}`}
|
|
31
|
-
{...other}
|
|
32
|
-
>
|
|
33
|
-
{value === index && <Box sx={{ p: 3 }}>{children}</Box>}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function a11yProps(index: number) {
|
|
39
|
-
return {
|
|
40
|
-
id: `simple-tab-${index}`,
|
|
41
|
-
'aria-controls': `simple-tabpanel-${index}`,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const UncontrolledTabs = ({ tabs, tab, color = 'primary', onTabChange, ...props }: Props) => {
|
|
46
|
-
const handleChange = (event: SyntheticEvent, newValue: number) => {
|
|
47
|
-
onTabChange(event, newValue);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Box sx={{ width: '100%' }}>
|
|
52
|
-
<Box>
|
|
53
|
-
<NormaTabs value={tab} color={color} onChange={handleChange} aria-label="tabs" {...props}>
|
|
54
|
-
{tabs.map((item, key) => (
|
|
55
|
-
<NormaTab key={key} label={item.label} color={color} {...a11yProps(key)} />
|
|
56
|
-
))}
|
|
57
|
-
</NormaTabs>
|
|
58
|
-
</Box>
|
|
59
|
-
{tabs.map((item, key) => (
|
|
60
|
-
<TabPanel {...item.tabPanel?.props} key={key} value={tab} index={key}>
|
|
61
|
-
{item.children}
|
|
62
|
-
</TabPanel>
|
|
63
|
-
))}
|
|
64
|
-
</Box>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default UncontrolledTabs;
|
|
1
|
+
import React, { SyntheticEvent } from 'react';
|
|
2
|
+
import { Box, SxProps } from '@mui/material';
|
|
3
|
+
import { ColorVariant, DataTabs, MuiTabsBaseProps, TabsVariant } from '@/types';
|
|
4
|
+
import { NormaTab, NormaTabs } from './UncontrolledTabs.style';
|
|
5
|
+
import { Theme } from '@emotion/react';
|
|
6
|
+
|
|
7
|
+
interface Props extends MuiTabsBaseProps {
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
tabs: DataTabs[];
|
|
10
|
+
tab: number;
|
|
11
|
+
onTabChange: (event: SyntheticEvent, tab: number) => void;
|
|
12
|
+
color?: ColorVariant;
|
|
13
|
+
variant?: TabsVariant;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface TabPanelProps {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
index: number;
|
|
19
|
+
value: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function TabPanel(props: TabPanelProps) {
|
|
23
|
+
const { children, value, index, ...other } = props;
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div
|
|
27
|
+
role="tabpanel"
|
|
28
|
+
hidden={value !== index}
|
|
29
|
+
id={`simple-tabpanel-${index}`}
|
|
30
|
+
aria-labelledby={`simple-tab-${index}`}
|
|
31
|
+
{...other}
|
|
32
|
+
>
|
|
33
|
+
{value === index && <Box sx={{ p: 3 }}>{children}</Box>}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function a11yProps(index: number) {
|
|
39
|
+
return {
|
|
40
|
+
id: `simple-tab-${index}`,
|
|
41
|
+
'aria-controls': `simple-tabpanel-${index}`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const UncontrolledTabs = ({ tabs, tab, color = 'primary', onTabChange, ...props }: Props) => {
|
|
46
|
+
const handleChange = (event: SyntheticEvent, newValue: number) => {
|
|
47
|
+
onTabChange(event, newValue);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<Box sx={{ width: '100%' }}>
|
|
52
|
+
<Box>
|
|
53
|
+
<NormaTabs value={tab} color={color} onChange={handleChange} aria-label="tabs" {...props}>
|
|
54
|
+
{tabs.map((item, key) => (
|
|
55
|
+
<NormaTab key={key} label={item.label} color={color} {...a11yProps(key)} />
|
|
56
|
+
))}
|
|
57
|
+
</NormaTabs>
|
|
58
|
+
</Box>
|
|
59
|
+
{tabs.map((item, key) => (
|
|
60
|
+
<TabPanel {...item.tabPanel?.props} key={key} value={tab} index={key}>
|
|
61
|
+
{item.children}
|
|
62
|
+
</TabPanel>
|
|
63
|
+
))}
|
|
64
|
+
</Box>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default UncontrolledTabs;
|
package/src/components/index.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export * from './Accordion';
|
|
2
|
-
export * from './Avatar';
|
|
3
|
-
export * from './Badge';
|
|
4
|
-
export * from './Button';
|
|
5
|
-
export * from './Card';
|
|
6
|
-
export * from './ChatMessage';
|
|
7
|
-
export * from './ChatMessageBalloon/ChatMessageBalloon';
|
|
8
|
-
export * from './CheckBox';
|
|
9
|
-
export * from './DatePicker';
|
|
10
|
-
export * from './DropDown';
|
|
11
|
-
export * from './IconButton';
|
|
12
|
-
export * from './Icons';
|
|
13
|
-
export * from './Modal';
|
|
14
|
-
export * from './Paper';
|
|
15
|
-
export * from './ProgressBar';
|
|
16
|
-
export * from './RadioGroup';
|
|
17
|
-
export * from './RangerSlider';
|
|
18
|
-
export * from './Select';
|
|
19
|
-
export * from './Tabs';
|
|
20
|
-
export * from './Tag';
|
|
21
|
-
export * from './Table';
|
|
22
|
-
export * from './TextField';
|
|
23
|
-
export * from './TimeLine';
|
|
24
|
-
export * from './TimePicker';
|
|
1
|
+
export * from './Accordion';
|
|
2
|
+
export * from './Avatar';
|
|
3
|
+
export * from './Badge';
|
|
4
|
+
export * from './Button';
|
|
5
|
+
export * from './Card';
|
|
6
|
+
export * from './ChatMessage';
|
|
7
|
+
export * from './ChatMessageBalloon/ChatMessageBalloon';
|
|
8
|
+
export * from './CheckBox';
|
|
9
|
+
export * from './DatePicker';
|
|
10
|
+
export * from './DropDown';
|
|
11
|
+
export * from './IconButton';
|
|
12
|
+
export * from './Icons';
|
|
13
|
+
export * from './Modal';
|
|
14
|
+
export * from './Paper';
|
|
15
|
+
export * from './ProgressBar';
|
|
16
|
+
export * from './RadioGroup';
|
|
17
|
+
export * from './RangerSlider';
|
|
18
|
+
export * from './Select';
|
|
19
|
+
export * from './Tabs';
|
|
20
|
+
export * from './Tag';
|
|
21
|
+
export * from './Table';
|
|
22
|
+
export * from './TextField';
|
|
23
|
+
export * from './TimeLine';
|
|
24
|
+
export * from './TimePicker';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function getAlign(border: string) {
|
|
2
|
-
switch (border) {
|
|
3
|
-
case 'left':
|
|
4
|
-
return 'text-start justify-items-start';
|
|
5
|
-
case 'center':
|
|
6
|
-
return 'justify-items-center';
|
|
7
|
-
case 'right':
|
|
8
|
-
return 'text-end justify-items-end';
|
|
9
|
-
default:
|
|
10
|
-
return 'text-center inline-flex';
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { getAlign };
|
|
1
|
+
function getAlign(border: string) {
|
|
2
|
+
switch (border) {
|
|
3
|
+
case 'left':
|
|
4
|
+
return 'text-start justify-items-start';
|
|
5
|
+
case 'center':
|
|
6
|
+
return 'justify-items-center';
|
|
7
|
+
case 'right':
|
|
8
|
+
return 'text-end justify-items-end';
|
|
9
|
+
default:
|
|
10
|
+
return 'text-center inline-flex';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { getAlign };
|
package/src/helpers/borders.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
function getBorderSize(size: number) {
|
|
2
|
-
switch (size.toString()) {
|
|
3
|
-
case '0':
|
|
4
|
-
return 'border-0';
|
|
5
|
-
case '1':
|
|
6
|
-
return 'border border-[0.05rem]';
|
|
7
|
-
case '2':
|
|
8
|
-
return 'border border-2';
|
|
9
|
-
case '4':
|
|
10
|
-
return 'border border-4';
|
|
11
|
-
case '8':
|
|
12
|
-
return 'border border-8';
|
|
13
|
-
default:
|
|
14
|
-
return 'border border-2';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { getBorderSize };
|
|
1
|
+
function getBorderSize(size: number) {
|
|
2
|
+
switch (size.toString()) {
|
|
3
|
+
case '0':
|
|
4
|
+
return 'border-0';
|
|
5
|
+
case '1':
|
|
6
|
+
return 'border border-[0.05rem]';
|
|
7
|
+
case '2':
|
|
8
|
+
return 'border border-2';
|
|
9
|
+
case '4':
|
|
10
|
+
return 'border border-4';
|
|
11
|
+
case '8':
|
|
12
|
+
return 'border border-8';
|
|
13
|
+
default:
|
|
14
|
+
return 'border border-2';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { getBorderSize };
|