@mrshmllw/smores-react 2.3.1 → 2.3.2
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.
@@ -0,0 +1,67 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import styled from 'styled-components';
|
3
|
+
import { Text } from '../Text';
|
4
|
+
import { theme } from '../theme';
|
5
|
+
export const CheckBox = ({ id, checked, children, toggle }) => (React.createElement(BoxContainer, { id: id },
|
6
|
+
React.createElement(Text, { tag: "span", typo: "base" }, children),
|
7
|
+
React.createElement("input", { type: "checkbox", checked: checked, onChange: toggle }),
|
8
|
+
React.createElement(Checkmark, null)));
|
9
|
+
const Checkmark = styled.span `
|
10
|
+
position: absolute;
|
11
|
+
left: 0;
|
12
|
+
width: 24px;
|
13
|
+
height: 24px;
|
14
|
+
border: solid 1px ${theme.colors.secondary};
|
15
|
+
box-sizing: border-box;
|
16
|
+
border-radius: 1px;
|
17
|
+
|
18
|
+
&:after {
|
19
|
+
content: '';
|
20
|
+
position: absolute;
|
21
|
+
display: none;
|
22
|
+
top: 3px;
|
23
|
+
left: 7px;
|
24
|
+
width: 5px;
|
25
|
+
height: 12px;
|
26
|
+
border: solid white;
|
27
|
+
border-width: 0 2px 2px 0;
|
28
|
+
-webkit-transform: rotate(45deg);
|
29
|
+
-ms-transform: rotate(45deg);
|
30
|
+
transform: rotate(45deg);
|
31
|
+
}
|
32
|
+
`;
|
33
|
+
const BoxContainer = styled.label `
|
34
|
+
position: relative;
|
35
|
+
display: flex;
|
36
|
+
align-items: center;
|
37
|
+
padding-left: 32px;
|
38
|
+
user-select: none;
|
39
|
+
cursor: pointer;
|
40
|
+
|
41
|
+
input {
|
42
|
+
position: absolute;
|
43
|
+
opacity: 0;
|
44
|
+
cursor: pointer;
|
45
|
+
|
46
|
+
&:checked ~ ${Checkmark} {
|
47
|
+
background-color: ${theme.colors.secondary};
|
48
|
+
border: solid 1px ${theme.colors.secondary};
|
49
|
+
}
|
50
|
+
|
51
|
+
&:checked ~ ${Checkmark}:after {
|
52
|
+
display: block;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
&:hover {
|
57
|
+
${Checkmark} {
|
58
|
+
background-color: ${theme.colors.background};
|
59
|
+
border: solid 1px ${theme.colors.secondary};
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
@media (min-width: 768px) {
|
64
|
+
padding-left: 32px;
|
65
|
+
}
|
66
|
+
`;
|
67
|
+
//# sourceMappingURL=CheckBox.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"CheckBox.js","sourceRoot":"","sources":["../../src/CheckBoxGroup/CheckBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAA;AAC5C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAShC,MAAM,CAAC,MAAM,QAAQ,GAAc,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACxE,oBAAC,YAAY,IAAC,EAAE,EAAE,EAAE;IAClB,oBAAC,IAAI,IAAC,GAAG,EAAC,MAAM,EAAC,IAAI,EAAC,MAAM,IACzB,QAAQ,CACJ;IAEP,+BAAO,IAAI,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAI;IAC7D,oBAAC,SAAS,OAAG,CACA,CAChB,CAAA;AAED,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAA;;;;;sBAKP,KAAK,CAAC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;CAkB3C,CAAA;AAED,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAA;;;;;;;;;;;;;kBAaf,SAAS;0BACD,KAAK,CAAC,MAAM,CAAC,SAAS;0BACtB,KAAK,CAAC,MAAM,CAAC,SAAS;;;kBAG9B,SAAS;;;;;;MAMrB,SAAS;0BACW,KAAK,CAAC,MAAM,CAAC,UAAU;0BACvB,KAAK,CAAC,MAAM,CAAC,SAAS;;;;;;;CAO/C,CAAA"}
|
@@ -11,6 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
11
11
|
};
|
12
12
|
import React, { forwardRef } from 'react';
|
13
13
|
import styled from 'styled-components';
|
14
|
+
import { darken } from 'polished';
|
14
15
|
import { theme } from '../theme';
|
15
16
|
import { Field } from '../Field';
|
16
17
|
import { useUniqueId } from '../utils/id';
|
@@ -27,6 +28,7 @@ export const TextInput = forwardRef(function TextInput(_a, ref) {
|
|
27
28
|
} }))));
|
28
29
|
});
|
29
30
|
const StyledInput = styled.input `
|
31
|
+
border: none;
|
30
32
|
border-bottom: 1px solid;
|
31
33
|
border-color: ${({ error }) => theme.colors[`${error ? 'error' : 'outline'}`]};
|
32
34
|
background-color: transparent;
|
@@ -37,6 +39,16 @@ const StyledInput = styled.input `
|
|
37
39
|
cursor: ${({ disabled }) => (disabled ? 'not-allowed' : 'initial')};
|
38
40
|
opacity: ${({ disabled }) => (disabled ? '0.5' : '1')};
|
39
41
|
padding: ${({ outlined }) => (outlined ? '17px 14px' : '1px 2px')};
|
42
|
+
&:hover,
|
43
|
+
&:focus-within {
|
44
|
+
border-color: ${({ error }) => error ? theme.colors.error : darken(0.1, theme.colors.outline)};
|
45
|
+
}
|
46
|
+
|
47
|
+
${({ outlined }) => outlined &&
|
48
|
+
`
|
49
|
+
border-radius: 8px;
|
50
|
+
height: auto;
|
51
|
+
`}
|
40
52
|
|
41
53
|
&::placeholder {
|
42
54
|
color: ${theme.colors.subtext};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAgB,MAAM,OAAO,CA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