@punch-in/buffet-modern 3.3.11
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/.stylelintignore +1 -0
- package/README.md +50 -0
- package/babel.config.js +18 -0
- package/build/18ea3062c6e779649b89c301e4d65a7c.ttf +0 -0
- package/build/1d2ca94dfba6f8d87cfda33b32f0febc.woff +0 -0
- package/build/21b3848a32fce5b0f5014948186f6964.woff2 +0 -0
- package/build/6cfa65c63939188f33ef0e3a68d09306.woff +0 -0
- package/build/6d20cff5b3255dd0078f935c34e2b882.woff2 +0 -0
- package/build/75614cfcfedd509b1f7ac1c26c53bb7f.woff2 +0 -0
- package/build/89b618086a797a8be0f4549489bb2993.woff +0 -0
- package/build/8acc961684668b6e28e961e26afc2af9.ttf +0 -0
- package/build/a6069540692725c247f13984a9598a92.woff2 +0 -0
- package/build/bb14dc80e8b5d860fe9cb2362987d630.ttf +0 -0
- package/build/bundle.development.js +951 -0
- package/build/bundle.production.js +1 -0
- package/build/c66465590541129e82d3d6f725c5658b.woff +0 -0
- package/build/c7687ac11011d85e040e2ce14d5bf6eb.ttf +0 -0
- package/build/esm/assets/fonts/lato/Lato-Black.ttf +0 -0
- package/build/esm/assets/fonts/lato/Lato-Black.woff +0 -0
- package/build/esm/assets/fonts/lato/Lato-Black.woff2 +0 -0
- package/build/esm/assets/fonts/lato/Lato-Bold.ttf +0 -0
- package/build/esm/assets/fonts/lato/Lato-Bold.woff +0 -0
- package/build/esm/assets/fonts/lato/Lato-Bold.woff2 +0 -0
- package/build/esm/assets/fonts/lato/Lato-Regular.ttf +0 -0
- package/build/esm/assets/fonts/lato/Lato-Regular.woff +0 -0
- package/build/esm/assets/fonts/lato/Lato-Regular.woff2 +0 -0
- package/build/esm/assets/fonts/lato/Lato-SemiBold.ttf +0 -0
- package/build/esm/assets/fonts/lato/Lato-SemiBold.woff +0 -0
- package/build/esm/assets/fonts/lato/Lato-SemiBold.woff2 +0 -0
- package/build/esm/assets/icons/icon_select.svg +1 -0
- package/build/esm/assets/icons/icon_trash.svg +1 -0
- package/build/esm/assets/styles/colors.js +84 -0
- package/build/esm/assets/styles/mixins.js +28 -0
- package/build/esm/assets/styles/sizes.js +77 -0
- package/build/esm/components/Button/PrefixIcon.js +7 -0
- package/build/esm/components/Button/index.js +34 -0
- package/build/esm/components/Card/index.js +23 -0
- package/build/esm/components/Checkbox/index.js +25 -0
- package/build/esm/components/CheckboxWrapper/index.js +36 -0
- package/build/esm/components/CustomRow/index.js +12 -0
- package/build/esm/components/DatePicker/index.js +24 -0
- package/build/esm/components/Description/index.js +12 -0
- package/build/esm/components/Enumeration/index.js +25 -0
- package/build/esm/components/EnumerationWrapper/index.js +13 -0
- package/build/esm/components/ErrorMessage/index.js +13 -0
- package/build/esm/components/Fonts/index.js +31 -0
- package/build/esm/components/GlobalStyle/index.js +7 -0
- package/build/esm/components/Header/index.js +13 -0
- package/build/esm/components/HeaderActions/index.js +12 -0
- package/build/esm/components/HeaderTitle/index.js +13 -0
- package/build/esm/components/Icon/index.js +16 -0
- package/build/esm/components/IconText/index.js +9 -0
- package/build/esm/components/IconWrapper/index.js +16 -0
- package/build/esm/components/InputNumber/index.js +14 -0
- package/build/esm/components/InputText/index.js +24 -0
- package/build/esm/components/InputWrapper/index.js +13 -0
- package/build/esm/components/Label/index.js +13 -0
- package/build/esm/components/Links/index.js +13 -0
- package/build/esm/components/List/index.js +13 -0
- package/build/esm/components/ListHeader/index.js +11 -0
- package/build/esm/components/ListRow/index.js +11 -0
- package/build/esm/components/ListSubtitle/index.js +12 -0
- package/build/esm/components/ListTitle/index.js +13 -0
- package/build/esm/components/LoadingBar/index.js +14 -0
- package/build/esm/components/LoadingIndicator/index.js +69 -0
- package/build/esm/components/Option/index.js +37 -0
- package/build/esm/components/Paging/index.js +13 -0
- package/build/esm/components/Select/index.js +14 -0
- package/build/esm/components/Tab/index.js +30 -0
- package/build/esm/components/Table/index.js +13 -0
- package/build/esm/components/TableRowEmpty/index.js +13 -0
- package/build/esm/components/Textarea/index.js +13 -0
- package/build/esm/components/TimeList/index.js +13 -0
- package/build/esm/components/TimePicker/index.js +20 -0
- package/build/esm/components/TimePickerWrapper/index.js +13 -0
- package/build/esm/components/Toggle/index.js +25 -0
- package/build/esm/components/ToggleWrapper/index.js +13 -0
- package/build/esm/components/Tooltip/index.js +28 -0
- package/build/esm/index.js +46 -0
- package/build/index.js +8 -0
- package/package.json +113 -0
- package/src/assets/fonts/lato/Lato-Black.ttf +0 -0
- package/src/assets/fonts/lato/Lato-Black.woff +0 -0
- package/src/assets/fonts/lato/Lato-Black.woff2 +0 -0
- package/src/assets/fonts/lato/Lato-Bold.ttf +0 -0
- package/src/assets/fonts/lato/Lato-Bold.woff +0 -0
- package/src/assets/fonts/lato/Lato-Bold.woff2 +0 -0
- package/src/assets/fonts/lato/Lato-Regular.ttf +0 -0
- package/src/assets/fonts/lato/Lato-Regular.woff +0 -0
- package/src/assets/fonts/lato/Lato-Regular.woff2 +0 -0
- package/src/assets/fonts/lato/Lato-SemiBold.ttf +0 -0
- package/src/assets/fonts/lato/Lato-SemiBold.woff +0 -0
- package/src/assets/fonts/lato/Lato-SemiBold.woff2 +0 -0
- package/src/assets/icons/icon_select.svg +1 -0
- package/src/assets/icons/icon_trash.svg +1 -0
- package/src/assets/styles/colors.js +92 -0
- package/src/assets/styles/mixins.js +45 -0
- package/src/assets/styles/sizes.js +87 -0
- package/src/components/Button/PrefixIcon.js +11 -0
- package/src/components/Button/index.js +122 -0
- package/src/components/Button/tests/__snapshots__/index.test.js.snap +169 -0
- package/src/components/Button/tests/index.test.js +91 -0
- package/src/components/Card/index.js +73 -0
- package/src/components/Checkbox/index.js +141 -0
- package/src/components/Checkbox/tests/Checkbox.test.js +19 -0
- package/src/components/Checkbox/tests/__snapshots__/Checkbox.test.js.snap +71 -0
- package/src/components/CheckboxWrapper/index.js +100 -0
- package/src/components/CustomRow/index.js +21 -0
- package/src/components/DatePicker/index.js +280 -0
- package/src/components/DatePicker/tests/Datepicker.test.js +12 -0
- package/src/components/Description/index.js +17 -0
- package/src/components/Enumeration/index.js +40 -0
- package/src/components/Enumeration/tests/Enumeration.test.js +12 -0
- package/src/components/EnumerationWrapper/index.js +47 -0
- package/src/components/ErrorMessage/index.js +18 -0
- package/src/components/Fonts/index.js +83 -0
- package/src/components/GlobalStyle/index.js +68 -0
- package/src/components/Header/index.js +73 -0
- package/src/components/Header/tests/__snapshots__/index.test.js.snap +75 -0
- package/src/components/Header/tests/index.test.js +18 -0
- package/src/components/HeaderActions/index.js +30 -0
- package/src/components/HeaderActions/tests/__snapshots__/index.test.js.snap +34 -0
- package/src/components/HeaderActions/tests/index.test.js +19 -0
- package/src/components/HeaderTitle/index.js +47 -0
- package/src/components/HeaderTitle/tests/__snapshots__/index.test.js.snap +39 -0
- package/src/components/HeaderTitle/tests/index.test.js +19 -0
- package/src/components/Icon/index.js +17 -0
- package/src/components/IconText/index.js +18 -0
- package/src/components/IconWrapper/index.js +29 -0
- package/src/components/InputNumber/index.js +209 -0
- package/src/components/InputNumber/tests/index.test.js +12 -0
- package/src/components/InputText/index.js +70 -0
- package/src/components/InputText/tests/index.test.js +39 -0
- package/src/components/InputWrapper/index.js +57 -0
- package/src/components/Label/index.js +18 -0
- package/src/components/Label/tests/index.test.js +12 -0
- package/src/components/Links/index.js +35 -0
- package/src/components/List/index.js +85 -0
- package/src/components/ListHeader/index.js +13 -0
- package/src/components/ListHeader/tests/index.test.js +12 -0
- package/src/components/ListRow/index.js +17 -0
- package/src/components/ListRow/tests/index.test.js +12 -0
- package/src/components/ListSubtitle/index.js +17 -0
- package/src/components/ListSubtitle/tests/index.test.js +12 -0
- package/src/components/ListTitle/index.js +20 -0
- package/src/components/ListTitle/tests/index.test.js +12 -0
- package/src/components/LoadingBar/index.js +41 -0
- package/src/components/LoadingBar/tests/index.test.js +19 -0
- package/src/components/LoadingIndicator/index.js +81 -0
- package/src/components/Option/index.js +39 -0
- package/src/components/Option/tests/__snapshots__/index.test.js.snap +29 -0
- package/src/components/Option/tests/index.test.js +16 -0
- package/src/components/Paging/index.js +68 -0
- package/src/components/Select/index.js +54 -0
- package/src/components/Select/tests/index.test.js +12 -0
- package/src/components/Tab/index.js +78 -0
- package/src/components/Table/index.js +147 -0
- package/src/components/TableRowEmpty/index.js +28 -0
- package/src/components/Textarea/index.js +50 -0
- package/src/components/Textarea/tests/__snapshots__/index.test.js.snap +71 -0
- package/src/components/Textarea/tests/index.test.js +33 -0
- package/src/components/TimeList/index.js +78 -0
- package/src/components/TimePicker/index.js +59 -0
- package/src/components/TimePickerWrapper/index.js +57 -0
- package/src/components/Toggle/index.js +82 -0
- package/src/components/Toggle/tests/index.test.js +12 -0
- package/src/components/ToggleWrapper/index.js +36 -0
- package/src/components/Tooltip/index.js +34 -0
- package/src/index.js +47 -0
- package/webfonts/Lato-Black.ttf +0 -0
- package/webfonts/Lato-Black.woff +0 -0
- package/webfonts/Lato-Black.woff2 +0 -0
- package/webfonts/Lato-Bold.ttf +0 -0
- package/webfonts/Lato-Bold.woff +0 -0
- package/webfonts/Lato-Bold.woff2 +0 -0
- package/webfonts/Lato-Regular.ttf +0 -0
- package/webfonts/Lato-Regular.woff +0 -0
- package/webfonts/Lato-Regular.woff2 +0 -0
- package/webfonts/Lato-SemiBold.ttf +0 -0
- package/webfonts/Lato-SemiBold.woff +0 -0
- package/webfonts/Lato-SemiBold.woff2 +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Button
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import colors from '../../assets/styles/colors';
|
|
10
|
+
import sizes from '../../assets/styles/sizes';
|
|
11
|
+
import mixins from '../../assets/styles/mixins';
|
|
12
|
+
|
|
13
|
+
const Button = styled.button`
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
height: ${sizes.button.height.large};
|
|
18
|
+
padding: 0 ${sizes.button.padding.leftRight};
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
font-size: 1.4rem;
|
|
21
|
+
border-radius: ${sizes.borderRadiusLg};
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
outline: 0;
|
|
24
|
+
background-color: ${colors.white};
|
|
25
|
+
transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
|
|
26
|
+
border: 1px solid transparent;
|
|
27
|
+
position: relative;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
|
|
30
|
+
&:hover:not(:disabled) {
|
|
31
|
+
transform: translateY(-1px);
|
|
32
|
+
${mixins(colors.lightGreyAlpha).bshadow};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:active:not(:disabled) {
|
|
36
|
+
transform: translateY(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:focus-visible {
|
|
40
|
+
outline: none;
|
|
41
|
+
box-shadow: 0 0 0 3px ${colors.blueFocusRing};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
${({ color }) =>
|
|
45
|
+
color !== 'none' &&
|
|
46
|
+
`
|
|
47
|
+
background-color: ${colors.button[color].backgroundColor};
|
|
48
|
+
border: 1px solid ${colors.button[color].borderColor};
|
|
49
|
+
color: ${colors.button[color].color};
|
|
50
|
+
|
|
51
|
+
&:hover:not(:disabled) {
|
|
52
|
+
background-color: ${colors.button[color].hoverBg ||
|
|
53
|
+
colors.button[color].backgroundColor};
|
|
54
|
+
border-color: ${colors.button[color].hoverBg ||
|
|
55
|
+
colors.button[color].borderColor};
|
|
56
|
+
}
|
|
57
|
+
`}
|
|
58
|
+
|
|
59
|
+
${({ disabled }) =>
|
|
60
|
+
disabled &&
|
|
61
|
+
`
|
|
62
|
+
background-color: ${colors.button.disabled.backgroundColor};
|
|
63
|
+
border-color: ${colors.button.disabled.borderColor};
|
|
64
|
+
color: ${colors.button.disabled.color};
|
|
65
|
+
cursor: not-allowed;
|
|
66
|
+
transform: none;
|
|
67
|
+
|
|
68
|
+
&:hover {
|
|
69
|
+
box-shadow: none;
|
|
70
|
+
transform: none;
|
|
71
|
+
background-color: ${colors.button.disabled.backgroundColor};
|
|
72
|
+
border-color: ${colors.button.disabled.borderColor};
|
|
73
|
+
}
|
|
74
|
+
`}
|
|
75
|
+
|
|
76
|
+
${({ color }) =>
|
|
77
|
+
color === 'success' &&
|
|
78
|
+
`
|
|
79
|
+
min-width: ${sizes.button.minWidth};
|
|
80
|
+
`}
|
|
81
|
+
|
|
82
|
+
> span svg {
|
|
83
|
+
font-size: 1.2rem;
|
|
84
|
+
margin-right: 8px;
|
|
85
|
+
position: relative;
|
|
86
|
+
top: -1px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
> svg {
|
|
90
|
+
height: 1.2rem;
|
|
91
|
+
width: auto;
|
|
92
|
+
margin-right: 8px;
|
|
93
|
+
position: relative;
|
|
94
|
+
top: -1px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[aria-busy="true"] {
|
|
98
|
+
opacity: 0.7;
|
|
99
|
+
cursor: wait;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
Button.defaultProps = {
|
|
104
|
+
color: 'primary',
|
|
105
|
+
disabled: false,
|
|
106
|
+
type: 'button',
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
Button.propTypes = {
|
|
110
|
+
color: PropTypes.oneOf([
|
|
111
|
+
'primary',
|
|
112
|
+
'secondary',
|
|
113
|
+
'cancel',
|
|
114
|
+
'success',
|
|
115
|
+
'delete',
|
|
116
|
+
'none',
|
|
117
|
+
]),
|
|
118
|
+
disabled: PropTypes.bool,
|
|
119
|
+
type: PropTypes.string,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export default Button;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Button /> <Button /> icons should render a custom icon 1`] = `
|
|
4
|
+
.c0 {
|
|
5
|
+
display: -webkit-inline-box;
|
|
6
|
+
display: -webkit-inline-flex;
|
|
7
|
+
display: -ms-inline-flexbox;
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
-webkit-align-items: center;
|
|
10
|
+
-webkit-box-align: center;
|
|
11
|
+
-ms-flex-align: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
-webkit-box-pack: center;
|
|
14
|
+
-webkit-justify-content: center;
|
|
15
|
+
-ms-flex-pack: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
height: 30px;
|
|
18
|
+
padding: 0 15px;
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
font-size: 1.3rem;
|
|
21
|
+
border-radius: 2px;
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
outline: 0;
|
|
24
|
+
background-color: #ffffff;
|
|
25
|
+
background-color: #007EFF;
|
|
26
|
+
border: 1px solid #007EFF;
|
|
27
|
+
color: #ffffff;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.c0:hover,
|
|
31
|
+
.c0:active {
|
|
32
|
+
-webkit-box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
|
|
33
|
+
-moz-box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
|
|
34
|
+
box-shadow: inset 0 0 30px [object Object];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.c0:focus {
|
|
38
|
+
outline: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.c0 > span svg {
|
|
42
|
+
font-size: 10px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.c0 > svg {
|
|
46
|
+
height: 10px;
|
|
47
|
+
width: auto;
|
|
48
|
+
margin-right: 10px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
<button
|
|
52
|
+
className="c0"
|
|
53
|
+
color="primary"
|
|
54
|
+
disabled={false}
|
|
55
|
+
type="button"
|
|
56
|
+
/>
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
exports[`<Button /> <Button /> icons should render the add icon 1`] = `
|
|
60
|
+
.c0 {
|
|
61
|
+
display: -webkit-inline-box;
|
|
62
|
+
display: -webkit-inline-flex;
|
|
63
|
+
display: -ms-inline-flexbox;
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
-webkit-align-items: center;
|
|
66
|
+
-webkit-box-align: center;
|
|
67
|
+
-ms-flex-align: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
-webkit-box-pack: center;
|
|
70
|
+
-webkit-justify-content: center;
|
|
71
|
+
-ms-flex-pack: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
height: 30px;
|
|
74
|
+
padding: 0 15px;
|
|
75
|
+
font-weight: 600;
|
|
76
|
+
font-size: 1.3rem;
|
|
77
|
+
border-radius: 2px;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
outline: 0;
|
|
80
|
+
background-color: #ffffff;
|
|
81
|
+
background-color: #007EFF;
|
|
82
|
+
border: 1px solid #007EFF;
|
|
83
|
+
color: #ffffff;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.c0:hover,
|
|
87
|
+
.c0:active {
|
|
88
|
+
-webkit-box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
|
|
89
|
+
-moz-box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
|
|
90
|
+
box-shadow: inset 0 0 30px [object Object];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.c0:focus {
|
|
94
|
+
outline: 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.c0 > span svg {
|
|
98
|
+
font-size: 10px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.c0 > svg {
|
|
102
|
+
height: 10px;
|
|
103
|
+
width: auto;
|
|
104
|
+
margin-right: 10px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
<button
|
|
108
|
+
className="c0"
|
|
109
|
+
color="primary"
|
|
110
|
+
disabled={false}
|
|
111
|
+
type="button"
|
|
112
|
+
/>
|
|
113
|
+
`;
|
|
114
|
+
|
|
115
|
+
exports[`<Button /> <Button /> icons should render the add trash 1`] = `
|
|
116
|
+
.c0 {
|
|
117
|
+
display: -webkit-inline-box;
|
|
118
|
+
display: -webkit-inline-flex;
|
|
119
|
+
display: -ms-inline-flexbox;
|
|
120
|
+
display: inline-flex;
|
|
121
|
+
-webkit-align-items: center;
|
|
122
|
+
-webkit-box-align: center;
|
|
123
|
+
-ms-flex-align: center;
|
|
124
|
+
align-items: center;
|
|
125
|
+
-webkit-box-pack: center;
|
|
126
|
+
-webkit-justify-content: center;
|
|
127
|
+
-ms-flex-pack: center;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
height: 30px;
|
|
130
|
+
padding: 0 15px;
|
|
131
|
+
font-weight: 600;
|
|
132
|
+
font-size: 1.3rem;
|
|
133
|
+
border-radius: 2px;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
outline: 0;
|
|
136
|
+
background-color: #ffffff;
|
|
137
|
+
background-color: #007EFF;
|
|
138
|
+
border: 1px solid #007EFF;
|
|
139
|
+
color: #ffffff;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.c0:hover,
|
|
143
|
+
.c0:active {
|
|
144
|
+
-webkit-box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
|
|
145
|
+
-moz-box-shadow: inset 0 0 30px rgba(0,0,0,0.1);
|
|
146
|
+
box-shadow: inset 0 0 30px [object Object];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.c0:focus {
|
|
150
|
+
outline: 0;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.c0 > span svg {
|
|
154
|
+
font-size: 10px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.c0 > svg {
|
|
158
|
+
height: 10px;
|
|
159
|
+
width: auto;
|
|
160
|
+
margin-right: 10px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
<button
|
|
164
|
+
className="c0"
|
|
165
|
+
color="primary"
|
|
166
|
+
disabled={false}
|
|
167
|
+
type="button"
|
|
168
|
+
/>
|
|
169
|
+
`;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mount } from 'enzyme';
|
|
3
|
+
import { enzymeFind } from 'styled-components/test-utils';
|
|
4
|
+
import renderer from 'react-test-renderer';
|
|
5
|
+
import 'jest-styled-components';
|
|
6
|
+
|
|
7
|
+
import Button from '../index';
|
|
8
|
+
import colors from '../../../assets/styles/colors';
|
|
9
|
+
|
|
10
|
+
describe('<Button />', () => {
|
|
11
|
+
describe('<Button /> attributes', () => {
|
|
12
|
+
it('should render an <button> tag', () => {
|
|
13
|
+
const wrapper = mount(<Button />);
|
|
14
|
+
const renderedComponent = enzymeFind(wrapper, Button);
|
|
15
|
+
expect(renderedComponent.type()).toEqual('button');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should have a className attribute', () => {
|
|
19
|
+
const wrapper = mount(<Button />);
|
|
20
|
+
const renderedComponent = enzymeFind(wrapper, Button);
|
|
21
|
+
expect(renderedComponent.prop('className')).toBeDefined();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should adopt a valid attribute', () => {
|
|
25
|
+
const id = 'test';
|
|
26
|
+
const wrapper = mount(<Button id={id} />);
|
|
27
|
+
const renderedComponent = enzymeFind(wrapper, Button);
|
|
28
|
+
expect(renderedComponent.prop('id')).toEqual(id);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should not adopt an invalid attribute', () => {
|
|
32
|
+
const wrapper = mount(<Button attribute="test" />);
|
|
33
|
+
const renderedComponent = enzymeFind(wrapper, Button);
|
|
34
|
+
expect(renderedComponent.prop('attribute')).toBeUndefined();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should adopt a default type button', () => {
|
|
38
|
+
const wrapper = mount(<Button />);
|
|
39
|
+
const renderedComponent = enzymeFind(wrapper, Button);
|
|
40
|
+
expect(renderedComponent.prop('type')).toEqual('button');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should adopt a type submit', () => {
|
|
44
|
+
const wrapper = mount(<Button type="submit" />);
|
|
45
|
+
const renderedComponent = enzymeFind(wrapper, Button);
|
|
46
|
+
expect(renderedComponent.prop('type')).toEqual('submit');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe('<Button /> icons', () => {
|
|
51
|
+
it('should render the add icon', () => {
|
|
52
|
+
const tree = renderer.create(<Button icon="add" />).toJSON();
|
|
53
|
+
expect(tree).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should render a custom icon', () => {
|
|
57
|
+
const tree = renderer.create(<Button icon={<p>Icon</p>} />).toJSON();
|
|
58
|
+
expect(tree).toMatchSnapshot();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('should render the add trash', () => {
|
|
62
|
+
const tree = renderer.create(<Button icon="trash" />).toJSON();
|
|
63
|
+
expect(tree).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should render the primary style', () => {
|
|
67
|
+
const tree = renderer.create(<Button color="primary" />).toJSON();
|
|
68
|
+
expect(tree).toHaveStyleRule('color', colors.white);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('should render the secondary style', () => {
|
|
72
|
+
const tree = renderer.create(<Button color="secondary" />).toJSON();
|
|
73
|
+
expect(tree).toHaveStyleRule('color', colors.blue);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should render the cancel style', () => {
|
|
77
|
+
const tree = renderer.create(<Button color="cancel" />).toJSON();
|
|
78
|
+
expect(tree).toHaveStyleRule('color', colors.brightGrey);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should render the success style', () => {
|
|
82
|
+
const tree = renderer.create(<Button color="success" />).toJSON();
|
|
83
|
+
expect(tree).toHaveStyleRule('color', colors.white);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('should render the delete style', () => {
|
|
87
|
+
const tree = renderer.create(<Button color="delete" />).toJSON();
|
|
88
|
+
expect(tree).toHaveStyleRule('color', colors.white);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Card
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import sizes from '../../assets/styles/sizes';
|
|
9
|
+
import colors from '../../assets/styles/colors';
|
|
10
|
+
|
|
11
|
+
const Card = styled.div`
|
|
12
|
+
background: ${colors.white};
|
|
13
|
+
font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
14
|
+
sans-serif;
|
|
15
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
|
|
16
|
+
position: relative;
|
|
17
|
+
border-radius: ${({ radius }) => radius || sizes.borderRadiusLg};
|
|
18
|
+
transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
border: 1px solid rgba(0, 0, 0, 0.04);
|
|
21
|
+
|
|
22
|
+
&:hover {
|
|
23
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
|
24
|
+
transform: translateY(-2px);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.table-wrapper {
|
|
28
|
+
width: 100%;
|
|
29
|
+
overflow-x: auto;
|
|
30
|
+
-webkit-overflow-scrolling: touch;
|
|
31
|
+
-ms-overflow-style: -ms-autohiding-scrollbar;
|
|
32
|
+
scrollbar-width: thin;
|
|
33
|
+
|
|
34
|
+
&::-webkit-scrollbar {
|
|
35
|
+
height: 6px;
|
|
36
|
+
width: 6px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&::-webkit-scrollbar-track {
|
|
40
|
+
background: rgba(0, 0, 0, 0.04);
|
|
41
|
+
border-radius: 3px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&::-webkit-scrollbar-thumb {
|
|
45
|
+
background: rgba(0, 0, 0, 0.15);
|
|
46
|
+
border-radius: 3px;
|
|
47
|
+
|
|
48
|
+
&:hover {
|
|
49
|
+
background: rgba(0, 0, 0, 0.25);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (min-width: ${sizes.tablet}) {
|
|
55
|
+
.table-wrapper {
|
|
56
|
+
overflow-x: visible;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
padding: ${({ noPadding }) => (noPadding ? '0' : '1.5rem')};
|
|
61
|
+
|
|
62
|
+
&[aria-busy='true'] {
|
|
63
|
+
opacity: 0.7;
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
Card.defaultProps = {
|
|
69
|
+
radius: undefined,
|
|
70
|
+
noPadding: false,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export default Card;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Checkbox
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import colors from '../../assets/styles/colors';
|
|
10
|
+
import sizes from '../../assets/styles/sizes';
|
|
11
|
+
|
|
12
|
+
const Checkbox = styled.input`
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
margin: 0;
|
|
15
|
+
position: relative;
|
|
16
|
+
width: ${sizes.checkbox.width};
|
|
17
|
+
height: ${sizes.checkbox.height};
|
|
18
|
+
opacity: 0;
|
|
19
|
+
z-index: 2;
|
|
20
|
+
|
|
21
|
+
&:focus,
|
|
22
|
+
&:active {
|
|
23
|
+
outline: 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:before {
|
|
27
|
+
content: '';
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 0;
|
|
30
|
+
top: 50%;
|
|
31
|
+
margin-top: calc(-${sizes.checkbox.width} / 2);
|
|
32
|
+
width: ${sizes.checkbox.width};
|
|
33
|
+
height: ${sizes.checkbox.height};
|
|
34
|
+
border: 2px solid ${colors.lightGrey};
|
|
35
|
+
background-color: ${colors.white};
|
|
36
|
+
border-radius: ${sizes.borderRadiusSm};
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
transition: border-color 0.2s ease, background-color 0.2s ease,
|
|
39
|
+
transform 0.2s ease;
|
|
40
|
+
z-index: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:after {
|
|
44
|
+
content: '';
|
|
45
|
+
position: absolute;
|
|
46
|
+
left: 0;
|
|
47
|
+
top: 50%;
|
|
48
|
+
margin-top: calc(-${sizes.checkbox.width} / 2);
|
|
49
|
+
width: ${sizes.checkbox.width};
|
|
50
|
+
height: ${sizes.checkbox.height};
|
|
51
|
+
background-repeat: no-repeat;
|
|
52
|
+
background-position: center;
|
|
53
|
+
background-size: 60%;
|
|
54
|
+
transition: opacity 0.2s cubic-bezier(0.4, 0, 0.23, 1);
|
|
55
|
+
opacity: 0;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&:checked {
|
|
60
|
+
&:before {
|
|
61
|
+
border-color: ${colors.darkBlue};
|
|
62
|
+
background-color: ${colors.darkBlue};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:after {
|
|
66
|
+
opacity: 1;
|
|
67
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
${({ someChecked }) =>
|
|
72
|
+
someChecked &&
|
|
73
|
+
`
|
|
74
|
+
&:before {
|
|
75
|
+
border-color: ${colors.darkBlue};
|
|
76
|
+
background-color: ${colors.darkBlue};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:after {
|
|
80
|
+
opacity: 1;
|
|
81
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'%3E%3C/line%3E%3C/svg%3E");
|
|
82
|
+
}
|
|
83
|
+
`}
|
|
84
|
+
|
|
85
|
+
&:not(:disabled):hover:before {
|
|
86
|
+
border-color: ${colors.darkBlue};
|
|
87
|
+
transform: scale(1.05);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&:focus-visible:before {
|
|
91
|
+
box-shadow: 0 0 0 3px ${colors.blueFocusRing};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&:disabled {
|
|
95
|
+
cursor: not-allowed;
|
|
96
|
+
|
|
97
|
+
&:before {
|
|
98
|
+
background-color: ${colors.greyIconBkgd};
|
|
99
|
+
border-color: ${colors.greyIconBkgd};
|
|
100
|
+
opacity: 0.6;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:after {
|
|
104
|
+
opacity: 0.5;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
& + label {
|
|
109
|
+
display: inline-block;
|
|
110
|
+
margin-left: ${sizes.spacing.sm}px;
|
|
111
|
+
font-weight: ${sizes.fontWeight.semiBold};
|
|
112
|
+
font-size: ${sizes.input.fontSize};
|
|
113
|
+
line-height: ${sizes.checkbox.height};
|
|
114
|
+
vertical-align: top;
|
|
115
|
+
cursor: pointer;
|
|
116
|
+
user-select: none;
|
|
117
|
+
color: ${colors.blueTxt};
|
|
118
|
+
transition: opacity 0.2s ease;
|
|
119
|
+
|
|
120
|
+
&:hover {
|
|
121
|
+
opacity: 0.85;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&:disabled + label {
|
|
126
|
+
cursor: not-allowed;
|
|
127
|
+
opacity: 0.6;
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
|
|
131
|
+
Checkbox.defaultProps = {
|
|
132
|
+
someChecked: false,
|
|
133
|
+
type: 'checkbox',
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
Checkbox.propTypes = {
|
|
137
|
+
someChecked: PropTypes.bool,
|
|
138
|
+
type: PropTypes.string,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export default Checkbox;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import Checkbox from '../index';
|
|
6
|
+
|
|
7
|
+
const renderComponent = () => shallow(<Checkbox />);
|
|
8
|
+
|
|
9
|
+
describe('<Checkbox />', () => {
|
|
10
|
+
it('should not crash', () => {
|
|
11
|
+
renderComponent();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should match snapshot', () => {
|
|
15
|
+
const { asFragment } = render(<Checkbox />);
|
|
16
|
+
|
|
17
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<Checkbox /> should match snapshot 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
.c0 {
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
margin: 0;
|
|
8
|
+
position: relative;
|
|
9
|
+
width: 14px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.c0:focus,
|
|
13
|
+
.c0:active {
|
|
14
|
+
outline: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.c0:before {
|
|
18
|
+
content: '';
|
|
19
|
+
position: absolute;
|
|
20
|
+
left: 0;
|
|
21
|
+
top: 50%;
|
|
22
|
+
margin-top: calc(-14px / 2);
|
|
23
|
+
width: 14px;
|
|
24
|
+
height: 14px;
|
|
25
|
+
border: 1px solid rgba(16,22,34,0.15);
|
|
26
|
+
background-color: #fdfdfd;
|
|
27
|
+
border-radius: 3px;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.c0:after {
|
|
32
|
+
display: none;
|
|
33
|
+
content: '\\f00c';
|
|
34
|
+
font-family: 'FontAwesome';
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: 0;
|
|
37
|
+
top: 55%;
|
|
38
|
+
margin-top: calc(-14px / 2);
|
|
39
|
+
width: 14px;
|
|
40
|
+
height: 14px;
|
|
41
|
+
text-align: center;
|
|
42
|
+
font-size: 9px;
|
|
43
|
+
color: #1C5DE7;
|
|
44
|
+
line-height: 14px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.c0:checked:after {
|
|
48
|
+
display: block;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.c0:disabled {
|
|
52
|
+
background-color: #FAFAFB;
|
|
53
|
+
cursor: initial;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.c0:disabled:after {
|
|
57
|
+
color: #9ea7b8;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.c0 + label {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
font-weight: 500;
|
|
63
|
+
font-size: 1.3rem;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
<input
|
|
67
|
+
class="c0"
|
|
68
|
+
type="checkbox"
|
|
69
|
+
/>
|
|
70
|
+
</DocumentFragment>
|
|
71
|
+
`;
|