@comicrelief/component-library 8.26.0 → 8.28.0
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/components/Atoms/Button/Button.test.js +62 -1
- package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +4 -1
- package/dist/components/Atoms/Checkbox/Checkbox.js +1 -1
- package/dist/components/Atoms/Checkbox/Checkbox.test.js +160 -1
- package/dist/components/Atoms/Icons/Arrow.js +1 -1
- package/dist/components/Atoms/Icons/Chevron.js +1 -1
- package/dist/components/Atoms/Input/Input.js +3 -3
- package/dist/components/Atoms/Input/input.test.js +238 -2
- package/dist/components/Atoms/Label/Label.js +9 -1
- package/dist/components/Atoms/Link/Link.test.js +219 -4
- package/dist/components/Atoms/Logo/Logo.test.js +36 -1
- package/dist/components/Atoms/Pagination/Item/Item.js +1 -1
- package/dist/components/Atoms/Pagination/List/List.js +1 -1
- package/dist/components/Atoms/Pagination/Pagination.js +1 -1
- package/dist/components/Atoms/Pagination/Pagination.test.js +14 -14
- package/dist/components/Atoms/Picture/Picture.js +9 -2
- package/dist/components/Atoms/Picture/Picture.md +2 -1
- package/dist/components/Atoms/Picture/Picture.test.js +90 -2
- package/dist/components/Atoms/RadioButton/RadioButton.test.js +178 -1
- package/dist/components/Atoms/RichText/RichText.test.js +14 -1
- package/dist/components/Atoms/SocialIcons/Icon/Icon.js +2 -2
- package/dist/components/Atoms/SocialIcons/Utils/Links.js +3 -3
- package/dist/components/Atoms/Text/Text.js +3 -3
- package/dist/components/Atoms/TextArea/TextArea.test.js +90 -1
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js +3 -3
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.js +1 -1
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +479 -2
- package/dist/components/Molecules/Card/Card.style.js +1 -1
- package/dist/components/Molecules/Chip/Chip.test.js +104 -1
- package/dist/components/Molecules/Descriptor/Descriptor.js +1 -1
- package/dist/components/Molecules/Descriptor/Descriptor.test.js +216 -1
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.test.js +55 -1
- package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +148 -1
- package/dist/components/Molecules/Promo/_ProgressRing.js +5 -5
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.js +1 -1
- package/dist/components/Molecules/SearchInput/SearchInput.test.js +190 -1
- package/dist/components/Molecules/SearchResult/SearchResult.js +1 -1
- package/dist/components/Molecules/ShareButton/ShareButton.js +3 -3
- package/dist/components/Molecules/ShareButton/ShareButton.test.js +112 -1
- package/dist/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +1 -1
- package/dist/components/Molecules/SingleMessage/SingleMessage.js +4 -4
- package/dist/components/Molecules/SingleMessage/SingleMessage.style.js +2 -2
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.js +1 -1
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +8 -8
- package/dist/components/Molecules/VideoBanner/VideoBanner.test.js +18 -1
- package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +181 -1
- package/dist/components/Organisms/Donate/Donate.js +1 -1
- package/dist/components/Organisms/Donate/Donate.style.js +3 -1
- package/dist/components/Organisms/Donate/Form/Form.js +8 -8
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +4 -4
- package/dist/components/Organisms/Donate/MoneyBuy/MoneyBuy.js +1 -1
- package/dist/components/Organisms/Footer/Footer.js +1 -1
- package/dist/components/Organisms/Footer/Nav/Nav.js +1 -1
- package/dist/components/Organisms/Header/HeaderNav/HeaderNav.js +2 -2
- package/dist/components/Organisms/Header2025/HeaderNav2025/HeaderNav2025.js +1 -1
- package/dist/components/Organisms/Header2025/HeaderNav2025/HeaderNavItem2025.js +5 -5
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.style.js +1 -1
- package/dist/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +1 -1
- package/dist/components/Organisms/ImpactSlider/_utils.js +2 -2
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS.js +5 -5
- package/dist/components/Organisms/MarketingPreferencesDS/_OptInCheckbox.js +3 -3
- package/dist/components/Organisms/Membership/Form/Form.js +5 -5
- package/dist/components/Organisms/Membership/Membership.style.js +1 -1
- package/dist/components/Organisms/Membership/Membership.test.js +633 -1
- package/dist/components/Organisms/Membership/MoneyBox/MoneyBox.js +1 -1
- package/dist/components/Organisms/RichtextCarousel/RichtextCarousel.test.js +208 -1
- package/dist/components/Organisms/WYMDCarousel/WYMDCarousel.test.js +341 -1
- package/dist/components/Organisms/WYMDCarousel/_utils.js +1 -1
- package/dist/theme/crTheme/colors.js +0 -8
- package/dist/theme/crTheme/linkStyles.js +4 -4
- package/dist/theme/shared/allBreakpoints.js +1 -1
- package/dist/theme/shared/fontFamilies.js +1 -1
- package/dist/utils/Membership.js +2 -2
- package/dist/utils/ShareButton/sharePopUpHelper.js +1 -1
- package/dist/utils/ShareButton/shareUrlHelper.js +2 -2
- package/dist/utils/internalLinkHelper.js +1 -1
- package/package.json +1 -1
- package/src/components/Atoms/Picture/Picture.md +2 -1
- package/src/theme/crTheme/colors.js +0 -8
|
@@ -9,5 +9,66 @@ it("renders a standard styled link correctly", () => {
|
|
|
9
9
|
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
10
10
|
type: "submit"
|
|
11
11
|
}, "A standard link")).toJSON();
|
|
12
|
-
expect(tree).toMatchInlineSnapshot(
|
|
12
|
+
expect(tree).toMatchInlineSnapshot(`
|
|
13
|
+
.c0 {
|
|
14
|
+
display: -webkit-inline-box;
|
|
15
|
+
display: -webkit-inline-flex;
|
|
16
|
+
display: -ms-inline-flexbox;
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
position: relative;
|
|
19
|
+
padding: 0.5rem 1.25rem;
|
|
20
|
+
-webkit-text-decoration: none;
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
font-weight: 700;
|
|
23
|
+
font-size: 1rem;
|
|
24
|
+
border-radius: 2rem;
|
|
25
|
+
-webkit-transition: all 0.3s;
|
|
26
|
+
transition: all 0.3s;
|
|
27
|
+
height: 3.125rem;
|
|
28
|
+
width: 100%;
|
|
29
|
+
-webkit-box-pack: center;
|
|
30
|
+
-webkit-justify-content: center;
|
|
31
|
+
-ms-flex-pack: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
-webkit-align-items: center;
|
|
34
|
+
-webkit-box-align: center;
|
|
35
|
+
-ms-flex-align: center;
|
|
36
|
+
align-items: center;
|
|
37
|
+
border: none;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
background-color: #E52630;
|
|
40
|
+
color: #FFFFFF;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.c0 > a {
|
|
44
|
+
-webkit-text-decoration: none;
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.c0:hover {
|
|
49
|
+
background-color: #890B11;
|
|
50
|
+
color: #FFFFFF;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@media (min-width:740px) {
|
|
54
|
+
.c0 {
|
|
55
|
+
width: auto;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (min-width:1024px) {
|
|
60
|
+
.c0 {
|
|
61
|
+
width: auto;
|
|
62
|
+
padding: 1rem 2rem;
|
|
63
|
+
margin: 0 auto 2rem;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
<button
|
|
68
|
+
className="c0"
|
|
69
|
+
type="submit"
|
|
70
|
+
>
|
|
71
|
+
A standard link
|
|
72
|
+
</button>
|
|
73
|
+
`);
|
|
13
74
|
});
|
|
@@ -22,7 +22,10 @@ const LoaderContainer = _styledComponents.default.div.withConfig({
|
|
|
22
22
|
let {
|
|
23
23
|
withMargin
|
|
24
24
|
} = _ref;
|
|
25
|
-
return withMargin ?
|
|
25
|
+
return withMargin ? `
|
|
26
|
+
margin-top: ${(0, _spacing.default)('xsm')};
|
|
27
|
+
margin-left: ${(0, _spacing.default)('md')};
|
|
28
|
+
` : '';
|
|
26
29
|
});
|
|
27
30
|
|
|
28
31
|
// A button with loading and disabled states.
|
|
@@ -24,7 +24,7 @@ const Label = _styledComponents.default.label.withConfig({
|
|
|
24
24
|
theme,
|
|
25
25
|
labelColour
|
|
26
26
|
} = _ref2;
|
|
27
|
-
return labelColour &&
|
|
27
|
+
return labelColour && `color: ${theme.color(labelColour)}`;
|
|
28
28
|
});
|
|
29
29
|
const StyledCheckboxInput = _styledComponents.default.input.attrs({
|
|
30
30
|
type: 'checkbox'
|
|
@@ -15,5 +15,164 @@ it('renders correctly', () => {
|
|
|
15
15
|
value: "Handball",
|
|
16
16
|
label: "Handball"
|
|
17
17
|
}))).toJSON();
|
|
18
|
-
expect(tree).toMatchInlineSnapshot(
|
|
18
|
+
expect(tree).toMatchInlineSnapshot(`
|
|
19
|
+
Array [
|
|
20
|
+
.c2 {
|
|
21
|
+
font-size: 1rem;
|
|
22
|
+
line-height: 1rem;
|
|
23
|
+
text-transform: inherit;
|
|
24
|
+
font-weight: bold;
|
|
25
|
+
line-height: normal;
|
|
26
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.c0 {
|
|
30
|
+
display: -webkit-box;
|
|
31
|
+
display: -webkit-flex;
|
|
32
|
+
display: -ms-flexbox;
|
|
33
|
+
display: flex;
|
|
34
|
+
-webkit-align-items: center;
|
|
35
|
+
-webkit-box-align: center;
|
|
36
|
+
-ms-flex-align: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
margin-bottom: 8px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.c1 {
|
|
42
|
+
border: 0;
|
|
43
|
+
-webkit-clip: rect(0 0 0 0);
|
|
44
|
+
clip: rect(0 0 0 0);
|
|
45
|
+
height: 1px;
|
|
46
|
+
margin: -1px;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
padding: 0;
|
|
49
|
+
position: absolute;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
width: 1px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.c1 + span {
|
|
55
|
+
margin-right: 12px;
|
|
56
|
+
width: 24px;
|
|
57
|
+
height: 24px;
|
|
58
|
+
border-radius: 4px;
|
|
59
|
+
background-color: #FFFFFF;
|
|
60
|
+
border: 1px solid #969598;
|
|
61
|
+
float: left;
|
|
62
|
+
-webkit-flex-shrink: 0;
|
|
63
|
+
-ms-flex-negative: 0;
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.c1:checked + span {
|
|
68
|
+
background: url(mock.asset) no-repeat center;
|
|
69
|
+
background-size: contain;
|
|
70
|
+
background-color: #E52630;
|
|
71
|
+
border: 1px solid #E52630;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.c1:focus + span {
|
|
75
|
+
border: 1px solid #E52630;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
<label
|
|
79
|
+
className="c0"
|
|
80
|
+
htmlFor="sport1"
|
|
81
|
+
>
|
|
82
|
+
<input
|
|
83
|
+
className="c1"
|
|
84
|
+
id="sport1"
|
|
85
|
+
name="sport1"
|
|
86
|
+
type="checkbox"
|
|
87
|
+
value="Tennis"
|
|
88
|
+
/>
|
|
89
|
+
<span />
|
|
90
|
+
<span
|
|
91
|
+
className="c2"
|
|
92
|
+
color="inherit"
|
|
93
|
+
size="s"
|
|
94
|
+
>
|
|
95
|
+
Tennis
|
|
96
|
+
</span>
|
|
97
|
+
</label>,
|
|
98
|
+
.c2 {
|
|
99
|
+
font-size: 1rem;
|
|
100
|
+
line-height: 1rem;
|
|
101
|
+
text-transform: inherit;
|
|
102
|
+
font-weight: bold;
|
|
103
|
+
line-height: normal;
|
|
104
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.c0 {
|
|
108
|
+
display: -webkit-box;
|
|
109
|
+
display: -webkit-flex;
|
|
110
|
+
display: -ms-flexbox;
|
|
111
|
+
display: flex;
|
|
112
|
+
-webkit-align-items: center;
|
|
113
|
+
-webkit-box-align: center;
|
|
114
|
+
-ms-flex-align: center;
|
|
115
|
+
align-items: center;
|
|
116
|
+
margin-bottom: 8px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.c1 {
|
|
120
|
+
border: 0;
|
|
121
|
+
-webkit-clip: rect(0 0 0 0);
|
|
122
|
+
clip: rect(0 0 0 0);
|
|
123
|
+
height: 1px;
|
|
124
|
+
margin: -1px;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
padding: 0;
|
|
127
|
+
position: absolute;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
width: 1px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.c1 + span {
|
|
133
|
+
margin-right: 12px;
|
|
134
|
+
width: 24px;
|
|
135
|
+
height: 24px;
|
|
136
|
+
border-radius: 4px;
|
|
137
|
+
background-color: #FFFFFF;
|
|
138
|
+
border: 1px solid #969598;
|
|
139
|
+
float: left;
|
|
140
|
+
-webkit-flex-shrink: 0;
|
|
141
|
+
-ms-flex-negative: 0;
|
|
142
|
+
flex-shrink: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.c1:checked + span {
|
|
146
|
+
background: url(mock.asset) no-repeat center;
|
|
147
|
+
background-size: contain;
|
|
148
|
+
background-color: #E52630;
|
|
149
|
+
border: 1px solid #E52630;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.c1:focus + span {
|
|
153
|
+
border: 1px solid #E52630;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
<label
|
|
157
|
+
className="c0"
|
|
158
|
+
htmlFor="sport2"
|
|
159
|
+
>
|
|
160
|
+
<input
|
|
161
|
+
className="c1"
|
|
162
|
+
id="sport2"
|
|
163
|
+
name="sport2"
|
|
164
|
+
type="checkbox"
|
|
165
|
+
value="Handball"
|
|
166
|
+
/>
|
|
167
|
+
<span />
|
|
168
|
+
<span
|
|
169
|
+
className="c2"
|
|
170
|
+
color="inherit"
|
|
171
|
+
size="s"
|
|
172
|
+
>
|
|
173
|
+
Handball
|
|
174
|
+
</span>
|
|
175
|
+
</label>,
|
|
176
|
+
]
|
|
177
|
+
`);
|
|
19
178
|
});
|
|
@@ -15,7 +15,7 @@ var _ErrorText = _interopRequireDefault(require("../ErrorText/ErrorText"));
|
|
|
15
15
|
var _zIndex = _interopRequireDefault(require("../../../theme/shared/zIndex"));
|
|
16
16
|
// This seems to get a decent approximation of the necessary width (without resorting to measuring
|
|
17
17
|
// the element with JS)
|
|
18
|
-
const getPrefixWidth = prefixLength =>
|
|
18
|
+
const getPrefixWidth = prefixLength => `calc(1.5rem + (${prefixLength} * 0.5rem))`;
|
|
19
19
|
const InputWrapper = _styledComponents.default.div.withConfig({
|
|
20
20
|
displayName: "Input__InputWrapper",
|
|
21
21
|
componentId: "sc-bcqy1o-0"
|
|
@@ -39,7 +39,7 @@ const InputFieldContainer = _styledComponents.default.div.withConfig({
|
|
|
39
39
|
maxPxWidthLargeBreakpoint,
|
|
40
40
|
theme
|
|
41
41
|
} = _ref3;
|
|
42
|
-
return (0, _styledComponents.css)(["@media ", "{", "}@media ", "{", "}"], theme.allBreakpoints('M'), maxPxWidthMediumBreakpoint &&
|
|
42
|
+
return (0, _styledComponents.css)(["@media ", "{", "}@media ", "{", "}"], theme.allBreakpoints('M'), maxPxWidthMediumBreakpoint && `max-width: ${maxPxWidthMediumBreakpoint}px;`, theme.allBreakpoints('L'), maxPxWidthLargeBreakpoint && `max-width: ${maxPxWidthLargeBreakpoint}px;`);
|
|
43
43
|
});
|
|
44
44
|
const InputField = _styledComponents.default.input.withConfig({
|
|
45
45
|
displayName: "Input__InputField",
|
|
@@ -50,7 +50,7 @@ const InputField = _styledComponents.default.input.withConfig({
|
|
|
50
50
|
error,
|
|
51
51
|
prefixLength
|
|
52
52
|
} = _ref4;
|
|
53
|
-
return (0, _styledComponents.css)(["position:relative;box-sizing:border-box;width:100%;height:48px;padding:1rem 2.4rem 1rem 1.5rem;", " background-color:", ";border:1px solid;border-color:", ";box-shadow:none;appearance:none;color:", ";border-radius:0.5rem;font-size:inherit;z-index:2;font-family:", ";:focus{border:1px solid ", ";}"], prefixLength > 0 ?
|
|
53
|
+
return (0, _styledComponents.css)(["position:relative;box-sizing:border-box;width:100%;height:48px;padding:1rem 2.4rem 1rem 1.5rem;", " background-color:", ";border:1px solid;border-color:", ";box-shadow:none;appearance:none;color:", ";border-radius:0.5rem;font-size:inherit;z-index:2;font-family:", ";:focus{border:1px solid ", ";}"], prefixLength > 0 ? `padding-left: ${getPrefixWidth(prefixLength)};` : '', theme.color('grey_light'), error ? theme.color('red') : theme.color('grey_medium'), theme.color('black'), theme.fontFamilies(theme.font.regular), theme.color('grey_for_forms'));
|
|
54
54
|
});
|
|
55
55
|
const ErrorIconWrapper = _styledComponents.default.div.withConfig({
|
|
56
56
|
displayName: "Input__ErrorIconWrapper",
|
|
@@ -14,7 +14,123 @@ it('renders correctly', () => {
|
|
|
14
14
|
errorMsg: "",
|
|
15
15
|
id: "Accessibility info go here"
|
|
16
16
|
})).toJSON();
|
|
17
|
-
expect(tree).toMatchInlineSnapshot(
|
|
17
|
+
expect(tree).toMatchInlineSnapshot(`
|
|
18
|
+
.c1 {
|
|
19
|
+
font-size: 1rem;
|
|
20
|
+
line-height: 1rem;
|
|
21
|
+
text-transform: inherit;
|
|
22
|
+
line-height: normal;
|
|
23
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.c0 {
|
|
27
|
+
width: 100%;
|
|
28
|
+
position: relative;
|
|
29
|
+
display: -webkit-box;
|
|
30
|
+
display: -webkit-flex;
|
|
31
|
+
display: -ms-flexbox;
|
|
32
|
+
display: flex;
|
|
33
|
+
-webkit-flex-direction: column;
|
|
34
|
+
-ms-flex-direction: column;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
color: #5C5C5E;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.c2 {
|
|
40
|
+
margin-bottom: 0.5rem;
|
|
41
|
+
font-weight: normal;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.c3 {
|
|
45
|
+
position: relative;
|
|
46
|
+
font-size: 1.25rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.c4 {
|
|
50
|
+
position: relative;
|
|
51
|
+
width: 100%;
|
|
52
|
+
display: -webkit-box;
|
|
53
|
+
display: -webkit-flex;
|
|
54
|
+
display: -ms-flexbox;
|
|
55
|
+
display: flex;
|
|
56
|
+
-webkit-box-pack: end;
|
|
57
|
+
-webkit-justify-content: flex-end;
|
|
58
|
+
-ms-flex-pack: end;
|
|
59
|
+
justify-content: flex-end;
|
|
60
|
+
-webkit-align-items: center;
|
|
61
|
+
-webkit-box-align: center;
|
|
62
|
+
-ms-flex-align: center;
|
|
63
|
+
align-items: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.c5 {
|
|
67
|
+
position: relative;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: 48px;
|
|
71
|
+
padding: 1rem 2.4rem 1rem 1.5rem;
|
|
72
|
+
background-color: #F4F3F5;
|
|
73
|
+
border: 1px solid;
|
|
74
|
+
border-color: #E1E2E3;
|
|
75
|
+
box-shadow: none;
|
|
76
|
+
-webkit-appearance: none;
|
|
77
|
+
-moz-appearance: none;
|
|
78
|
+
appearance: none;
|
|
79
|
+
color: #000000;
|
|
80
|
+
border-radius: 0.5rem;
|
|
81
|
+
font-size: inherit;
|
|
82
|
+
z-index: 2;
|
|
83
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.c5:focus {
|
|
87
|
+
border: 1px solid #666;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media (min-width:740px) {
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media (min-width:1024px) {
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
<label
|
|
99
|
+
className="c0"
|
|
100
|
+
htmlFor="Accessibility info go here"
|
|
101
|
+
>
|
|
102
|
+
<span
|
|
103
|
+
className="c1 c2"
|
|
104
|
+
color="inherit"
|
|
105
|
+
dangerouslySetInnerHTML={
|
|
106
|
+
Object {
|
|
107
|
+
"__html": "Label",
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
size="s"
|
|
111
|
+
/>
|
|
112
|
+
<div
|
|
113
|
+
className="c3"
|
|
114
|
+
>
|
|
115
|
+
|
|
116
|
+
<div
|
|
117
|
+
className="c4"
|
|
118
|
+
>
|
|
119
|
+
<input
|
|
120
|
+
aria-describedby="Accessibility info go here"
|
|
121
|
+
className="c5"
|
|
122
|
+
id="Accessibility info go here"
|
|
123
|
+
name="fullname"
|
|
124
|
+
placeholder="This is the hint text"
|
|
125
|
+
required={false}
|
|
126
|
+
type="text"
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
</label>
|
|
133
|
+
`);
|
|
18
134
|
});
|
|
19
135
|
it('renders with responsive max widths correctly', () => {
|
|
20
136
|
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
@@ -26,5 +142,125 @@ it('renders with responsive max widths correctly', () => {
|
|
|
26
142
|
maxPxWidthMediumBreakpoint: 150,
|
|
27
143
|
maxPxWidthLargeBreakpoint: 250
|
|
28
144
|
})).toJSON();
|
|
29
|
-
expect(tree).toMatchInlineSnapshot(
|
|
145
|
+
expect(tree).toMatchInlineSnapshot(`
|
|
146
|
+
.c1 {
|
|
147
|
+
font-size: 1rem;
|
|
148
|
+
line-height: 1rem;
|
|
149
|
+
text-transform: inherit;
|
|
150
|
+
line-height: normal;
|
|
151
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.c0 {
|
|
155
|
+
width: 100%;
|
|
156
|
+
position: relative;
|
|
157
|
+
display: -webkit-box;
|
|
158
|
+
display: -webkit-flex;
|
|
159
|
+
display: -ms-flexbox;
|
|
160
|
+
display: flex;
|
|
161
|
+
-webkit-flex-direction: column;
|
|
162
|
+
-ms-flex-direction: column;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
color: #5C5C5E;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.c2 {
|
|
168
|
+
margin-bottom: 0.5rem;
|
|
169
|
+
font-weight: normal;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.c3 {
|
|
173
|
+
position: relative;
|
|
174
|
+
font-size: 1.25rem;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.c4 {
|
|
178
|
+
position: relative;
|
|
179
|
+
width: 100%;
|
|
180
|
+
display: -webkit-box;
|
|
181
|
+
display: -webkit-flex;
|
|
182
|
+
display: -ms-flexbox;
|
|
183
|
+
display: flex;
|
|
184
|
+
-webkit-box-pack: end;
|
|
185
|
+
-webkit-justify-content: flex-end;
|
|
186
|
+
-ms-flex-pack: end;
|
|
187
|
+
justify-content: flex-end;
|
|
188
|
+
-webkit-align-items: center;
|
|
189
|
+
-webkit-box-align: center;
|
|
190
|
+
-ms-flex-align: center;
|
|
191
|
+
align-items: center;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.c5 {
|
|
195
|
+
position: relative;
|
|
196
|
+
box-sizing: border-box;
|
|
197
|
+
width: 100%;
|
|
198
|
+
height: 48px;
|
|
199
|
+
padding: 1rem 2.4rem 1rem 1.5rem;
|
|
200
|
+
background-color: #F4F3F5;
|
|
201
|
+
border: 1px solid;
|
|
202
|
+
border-color: #E1E2E3;
|
|
203
|
+
box-shadow: none;
|
|
204
|
+
-webkit-appearance: none;
|
|
205
|
+
-moz-appearance: none;
|
|
206
|
+
appearance: none;
|
|
207
|
+
color: #000000;
|
|
208
|
+
border-radius: 0.5rem;
|
|
209
|
+
font-size: inherit;
|
|
210
|
+
z-index: 2;
|
|
211
|
+
font-family: 'Montserrat',Helvetica,Arial,sans-serif;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.c5:focus {
|
|
215
|
+
border: 1px solid #666;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@media (min-width:740px) {
|
|
219
|
+
.c4 {
|
|
220
|
+
max-width: 150px;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@media (min-width:1024px) {
|
|
225
|
+
.c4 {
|
|
226
|
+
max-width: 250px;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
<label
|
|
231
|
+
className="c0"
|
|
232
|
+
htmlFor="input-example-7"
|
|
233
|
+
>
|
|
234
|
+
<span
|
|
235
|
+
className="c1 c2"
|
|
236
|
+
color="inherit"
|
|
237
|
+
dangerouslySetInnerHTML={
|
|
238
|
+
Object {
|
|
239
|
+
"__html": "Responsive Width Input",
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
size="s"
|
|
243
|
+
/>
|
|
244
|
+
<div
|
|
245
|
+
className="c3"
|
|
246
|
+
>
|
|
247
|
+
|
|
248
|
+
<div
|
|
249
|
+
className="c4"
|
|
250
|
+
>
|
|
251
|
+
<input
|
|
252
|
+
aria-describedby="input-example-7"
|
|
253
|
+
className="c5"
|
|
254
|
+
id="input-example-7"
|
|
255
|
+
name="responsive-width"
|
|
256
|
+
placeholder="This input has responsive max widths"
|
|
257
|
+
required={false}
|
|
258
|
+
type="text"
|
|
259
|
+
/>
|
|
260
|
+
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
</label>
|
|
265
|
+
`);
|
|
30
266
|
});
|
|
@@ -25,7 +25,15 @@ const LabelElement = _styledComponents.default.label.withConfig({
|
|
|
25
25
|
optional,
|
|
26
26
|
theme
|
|
27
27
|
} = _ref2;
|
|
28
|
-
return optional === true &&
|
|
28
|
+
return optional === true && `
|
|
29
|
+
:after {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 0;
|
|
32
|
+
right: 0;
|
|
33
|
+
content: 'Optional';
|
|
34
|
+
font-family: ${theme.fontFamilies(theme.font.regular)};
|
|
35
|
+
font-size: ${theme.fontSize('s')};
|
|
36
|
+
}`;
|
|
29
37
|
});
|
|
30
38
|
const VisibleText = (0, _styledComponents.default)(_Text.default).withConfig({
|
|
31
39
|
displayName: "Label__VisibleText",
|