@comicrelief/component-library 7.24.0 → 7.24.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.
- package/.github/workflows/main.yml +22 -24
- package/dist/components/Atoms/Button/Button.js +21 -15
- package/dist/components/Atoms/Button/Button.test.js +3 -3
- package/dist/components/Atoms/ButtonWithStates/ButtonWithStates.js +19 -22
- package/dist/components/Atoms/Checkbox/Checkbox.js +42 -26
- package/dist/components/Atoms/Checkbox/Checkbox.test.js +3 -3
- package/dist/components/Atoms/Confetti/Confetti.js +20 -23
- package/dist/components/Atoms/Confetti/_TriggerConfetti.js +4 -11
- package/dist/components/Atoms/ErrorText/ErrorText.js +15 -11
- package/dist/components/Atoms/ErrorText/ErrorText.test.js +3 -3
- package/dist/components/Atoms/Icons/Arrow.js +16 -15
- package/dist/components/Atoms/Icons/AtSign.js +9 -9
- package/dist/components/Atoms/Icons/Chevron.js +16 -15
- package/dist/components/Atoms/Icons/Curve.js +16 -18
- package/dist/components/Atoms/Icons/Download.js +8 -8
- package/dist/components/Atoms/Icons/External.js +8 -8
- package/dist/components/Atoms/Icons/Favourite.js +8 -8
- package/dist/components/Atoms/Icons/Internal.js +8 -8
- package/dist/components/Atoms/Icons/index.js +8 -8
- package/dist/components/Atoms/Input/Input.js +38 -33
- package/dist/components/Atoms/Input/input.test.js +3 -3
- package/dist/components/Atoms/Label/Label.js +28 -23
- package/dist/components/Atoms/Link/Link.js +24 -29
- package/dist/components/Atoms/Link/Link.style.js +51 -40
- package/dist/components/Atoms/Link/Link.test.js +9 -9
- package/dist/components/Atoms/Logo/Logo.js +16 -18
- package/dist/components/Atoms/Logo/Logo.test.js +3 -3
- package/dist/components/Atoms/Pagination/Item/Item.js +7 -7
- package/dist/components/Atoms/Pagination/Item/Item.style.js +35 -28
- package/dist/components/Atoms/Pagination/List/List.js +21 -19
- package/dist/components/Atoms/Pagination/Pagination.js +41 -49
- package/dist/components/Atoms/Pagination/Pagination.test.js +54 -108
- package/dist/components/Atoms/Pagination/Utils/PaginationCalculator.js +15 -15
- package/dist/components/Atoms/Picture/Picture.js +34 -44
- package/dist/components/Atoms/Picture/Picture.test.js +5 -5
- package/dist/components/Atoms/RadioButton/RadioButton.js +35 -23
- package/dist/components/Atoms/RadioButton/RadioButton.test.js +3 -3
- package/dist/components/Atoms/RichText/RichText.js +9 -11
- package/dist/components/Atoms/RichText/RichText.test.js +4 -4
- package/dist/components/Atoms/Select/Select.js +56 -49
- package/dist/components/Atoms/Select/Select.test.js +3 -3
- package/dist/components/Atoms/SocialIcons/Icon/Icon.js +13 -13
- package/dist/components/Atoms/SocialIcons/SocialIcons.js +25 -23
- package/dist/components/Atoms/SocialIcons/SocialIcons.test.js +7 -7
- package/dist/components/Atoms/SocialIcons/Utils/Icons.js +3 -3
- package/dist/components/Atoms/SocialIcons/Utils/Links.js +19 -20
- package/dist/components/Atoms/SocialIcons/assets/X-white-Subtract.svg +3 -0
- package/dist/components/Atoms/Text/Text.js +62 -41
- package/dist/components/Atoms/Text/Text.test.js +11 -11
- package/dist/components/Atoms/TextArea/TextArea.js +18 -17
- package/dist/components/Atoms/TextArea/TextArea.test.js +3 -3
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.js +69 -86
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.style.js +23 -15
- package/dist/components/Atoms/TextInputWithDropdown/TextInputWithDropdown.test.js +15 -19
- package/dist/components/Molecules/Accordion/Accordion.js +35 -32
- package/dist/components/Molecules/Accordion/Accordion.test.js +3 -3
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.js +81 -52
- package/dist/components/Molecules/ArticleTeaser/ArticleTeaser.test.js +5 -5
- package/dist/components/Molecules/Banner/Banner.js +21 -13
- package/dist/components/Molecules/Banner/Banner.test.js +3 -3
- package/dist/components/Molecules/Box/Box.js +33 -27
- package/dist/components/Molecules/Box/Box.test.js +5 -5
- package/dist/components/Molecules/Card/Card.js +22 -22
- package/dist/components/Molecules/Card/Card.test.js +5 -5
- package/dist/components/Molecules/CardDs/CardDs.js +80 -55
- package/dist/components/Molecules/CardDs/CardDs.test.js +3 -3
- package/dist/components/Molecules/Chip/Chip.js +8 -6
- package/dist/components/Molecules/Chip/Chip.style.js +48 -28
- package/dist/components/Molecules/Chip/Chip.test.js +4 -6
- package/dist/components/Molecules/Countdown/Countdown.js +28 -36
- package/dist/components/Molecules/Countdown/Countdown.style.js +3 -3
- package/dist/components/Molecules/Descriptor/Descriptor.js +32 -26
- package/dist/components/Molecules/Descriptor/Descriptor.test.js +5 -5
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.js +6 -4
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.style.js +7 -5
- package/dist/components/Molecules/DoubleCopy/DoubleCopy.test.js +4 -4
- package/dist/components/Molecules/HeroBanner/HeroBanner.js +13 -17
- package/dist/components/Molecules/InfoBanner/InfoBanner.js +22 -18
- package/dist/components/Molecules/InfoBanner/InfoBanner.test.js +10 -10
- package/dist/components/Molecules/Logos/Logos.js +26 -14
- package/dist/components/Molecules/Logos/Logos.md +5 -0
- package/dist/components/Molecules/Lookup/Lookup.js +49 -84
- package/dist/components/Molecules/PartnerLink/PartnerLink.js +10 -11
- package/dist/components/Molecules/PartnerLink/PartnerLink.style.js +15 -9
- package/dist/components/Molecules/PartnerLink/PartnerLink.test.js +3 -3
- package/dist/components/Molecules/Promo/Promo.js +30 -36
- package/dist/components/Molecules/Promo/Promo.style.js +44 -31
- package/dist/components/Molecules/Promo/Promo.test.js +6 -6
- package/dist/components/Molecules/Promo/_ProgressRing.js +13 -19
- package/dist/components/Molecules/Promo/_PromoVideo.js +25 -34
- package/dist/components/Molecules/Promo/_PromoVideoButton.js +7 -7
- package/dist/components/Molecules/Promo/_PromoVideoButton.style.js +68 -41
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.js +29 -52
- package/dist/components/Molecules/SchoolLookup/SchoolLookup.test.js +4 -4
- package/dist/components/Molecules/SearchInput/SearchInput.js +8 -8
- package/dist/components/Molecules/SearchInput/SearchInput.style.js +22 -14
- package/dist/components/Molecules/SearchInput/SearchInput.test.js +4 -4
- package/dist/components/Molecules/SearchResult/SearchResult.js +43 -29
- package/dist/components/Molecules/SearchResult/SearchResult.test.js +9 -9
- package/dist/components/Molecules/ShareButton/ShareButton.js +22 -26
- package/dist/components/Molecules/ShareButton/ShareButton.style.js +5 -5
- package/dist/components/Molecules/ShareButton/ShareButton.test.js +3 -3
- package/dist/components/Molecules/ShareButton/assets/ShareIcons.js +2 -2
- package/dist/components/Molecules/SimpleSchoolLookup/SimpleSchoolLookup.js +28 -55
- package/dist/components/Molecules/SingleMessage/SingleMessage.js +99 -123
- package/dist/components/Molecules/SingleMessage/SingleMessage.style.js +132 -81
- package/dist/components/Molecules/SingleMessage/SingleMessage.test.js +13 -13
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.js +31 -40
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.style.js +85 -49
- package/dist/components/Molecules/SingleMessageDS/SingleMessageDs.test.js +3 -3
- package/dist/components/Molecules/Typeahead/Typeahead.js +47 -84
- package/dist/components/Molecules/Typeahead/Typeahead.test.js +12 -35
- package/dist/components/Molecules/VideoBanner/VideoBanner.js +20 -25
- package/dist/components/Molecules/VideoBanner/VideoBanner.test.js +4 -4
- package/dist/components/Organisms/CookieBanner/CookieBanner.js +7 -5
- package/dist/components/Organisms/CookieBanner/CookieBanner.style.js +21 -13
- package/dist/components/Organisms/CookieBanner/CookieBanner.test.js +5 -5
- package/dist/components/Organisms/Donate/Donate.js +34 -37
- package/dist/components/Organisms/Donate/Donate.style.js +85 -53
- package/dist/components/Organisms/Donate/Donate.test.js +10 -10
- package/dist/components/Organisms/Donate/Form/Form.js +53 -78
- package/dist/components/Organisms/Donate/Form/PopUpComponent.js +25 -30
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.js +11 -13
- package/dist/components/Organisms/Donate/GivingSelector/GivingSelector.style.js +38 -22
- package/dist/components/Organisms/Donate/MoneyBuy/MoneyBuy.js +47 -30
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.style.js +63 -37
- package/dist/components/Organisms/EmailSignUp/EmailSignUp.test.js +12 -12
- package/dist/components/Organisms/EmailSignUp/EmailSignUpForm.js +23 -43
- package/dist/components/Organisms/EmailSignUp/_EmailSignUp.js +25 -21
- package/dist/components/Organisms/EmailSignUp/_EmailSignUpConfig.js +10 -9
- package/dist/components/Organisms/EmailSignUp/_TextInput.js +20 -18
- package/dist/components/Organisms/Footer/Footer.js +10 -10
- package/dist/components/Organisms/Footer/Footer.style.js +27 -21
- package/dist/components/Organisms/Footer/Footer.test.js +3 -3
- package/dist/components/Organisms/Footer/Nav/Nav.js +59 -70
- package/dist/components/Organisms/Footer/Nav/Nav.style.js +77 -43
- package/dist/components/Organisms/Header/Burger/BurgerMenu.js +6 -4
- package/dist/components/Organisms/Header/Burger/BurgerMenu.style.js +37 -21
- package/dist/components/Organisms/Header/Header.js +8 -8
- package/dist/components/Organisms/Header/Header.style.js +27 -19
- package/dist/components/Organisms/Header/Nav/Nav.js +39 -50
- package/dist/components/Organisms/Header/Nav/Nav.style.js +103 -57
- package/dist/components/Organisms/Header/header.test.js +1 -1
- package/dist/components/Organisms/ImpactSlider/ImpactMoneybuys.style.js +32 -29
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.js +19 -22
- package/dist/components/Organisms/ImpactSlider/ImpactSlider.style.js +38 -24
- package/dist/components/Organisms/ImpactSlider/Slider.style.js +8 -14
- package/dist/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +11 -11
- package/dist/components/Organisms/ImpactSlider/_Slider.js +9 -7
- package/dist/components/Organisms/ImpactSlider/_utils.js +11 -11
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDS.style.js +61 -38
- package/dist/components/Organisms/MarketingPreferencesDS/MarketingPreferencesDSForm.js +24 -16
- package/dist/components/Organisms/MarketingPreferencesDS/_AssociatedFields.js +1 -1
- package/dist/components/Organisms/MarketingPreferencesDS/_CheckAnswer.js +20 -16
- package/dist/components/Organisms/MarketingPreferencesDS/_DefaultCopy.js +3 -3
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPreferencesDS.js +46 -36
- package/dist/components/Organisms/MarketingPreferencesDS/_MarketingPrefsConfig.js +21 -34
- package/dist/components/Organisms/MarketingPreferencesDS/_TextInput.js +20 -18
- package/dist/components/Organisms/Membership/Form/Form.js +48 -81
- package/dist/components/Organisms/Membership/Membership.js +17 -15
- package/dist/components/Organisms/Membership/Membership.style.js +81 -51
- package/dist/components/Organisms/Membership/Membership.test.js +4 -4
- package/dist/components/Organisms/Membership/MoneyBox/MoneyBox.js +37 -26
- package/dist/hoc/shallowWithTheme.js +1 -1
- package/dist/index.js +67 -67
- package/dist/styleguide/CRLogo.js +2 -2
- package/dist/styleguide/StyleGuideRenderer.js +9 -7
- package/dist/styleguide/ThemeWrapper.js +5 -3
- package/dist/styleguide/data/data.js +3 -3
- package/dist/theme/crTheme/buttonColors.js +6 -5
- package/dist/theme/crTheme/colors.js +4 -3
- package/dist/theme/crTheme/fontSizes.js +4 -3
- package/dist/theme/crTheme/linkStyles.js +6 -5
- package/dist/theme/crTheme/theme.js +1 -1
- package/dist/theme/shared/breakpoint.js +4 -3
- package/dist/theme/shared/fontFamilies.js +5 -4
- package/dist/theme/shared/hideVisually.js +1 -1
- package/dist/theme/shared/size.js +4 -3
- package/dist/theme/shared/spacing.js +2 -2
- package/dist/theme/shared/zIndex.js +3 -3
- package/dist/theme/srTheme/buttonColors.js +6 -5
- package/dist/theme/srTheme/colors.js +4 -3
- package/dist/theme/srTheme/fontSizes.js +4 -3
- package/dist/theme/srTheme/linkStyles.js +6 -5
- package/dist/theme/srTheme/theme.js +1 -1
- package/dist/utils/Membership.js +30 -27
- package/dist/utils/ShareButton/sharePopUpHelper.js +8 -8
- package/dist/utils/ShareButton/shareTracking.js +1 -1
- package/dist/utils/ShareButton/shareUrlHelper.js +3 -3
- package/dist/utils/allowListed.js +3 -5
- package/dist/utils/allowListed.test.js +3 -3
- package/dist/utils/internalLinkHelper.js +8 -10
- package/dist/utils/navHelper.js +2 -2
- package/package.json +12 -9
- package/playwright/components/atoms/checkbox.spec.js +64 -0
- package/playwright/components/atoms/input.spec.js +158 -0
- package/playwright/components/atoms/label.spec.js +29 -0
- package/playwright/components/atoms/link.spec.js +48 -0
- package/playwright/components/atoms/radioButton.spec.js +30 -0
- package/playwright/components/atoms/select.spec.js +36 -0
- package/playwright/components/atoms/textArea.spec.js +39 -0
- package/playwright/components/atoms/textInputWithDropdown.spec.js +23 -0
- package/playwright/components/molecules/accordian.spec.js +20 -0
- package/playwright/components/molecules/schoolLookup.spec.js +26 -0
- package/playwright/components/molecules/searchInput.spec.js +24 -0
- package/playwright/components/molecules/shareButton.spec.js +32 -0
- package/playwright/components/molecules/simpleSchoolLookUp.spec.js +35 -0
- package/playwright/components/molecules/typeahead.spec.js +27 -0
- package/playwright/components/organisms/donate.spec.js +293 -0
- package/playwright/components/organisms/emailSignUpForm.spec.js +109 -0
- package/playwright/components/organisms/footer.spec.js +67 -0
- package/playwright/components/organisms/header.spec.js +82 -0
- package/playwright/components/organisms/impactSlider.spec.js +292 -0
- package/playwright/components/organisms/marketingPreferences.spec.js +220 -0
- package/playwright/components/organisms/membership.spec.js +47 -0
- package/playwright.config.js +49 -0
- package/src/components/Atoms/SocialIcons/Utils/Icons.js +1 -1
- package/src/components/Atoms/SocialIcons/assets/X-white-Subtract.svg +3 -0
- package/src/components/Molecules/Logos/Logos.js +18 -6
- package/src/components/Molecules/Logos/Logos.md +5 -0
- package/src/components/Organisms/ImpactSlider/_ImpactMoneybuys.js +3 -4
- package/src/components/Organisms/Membership/Membership.test.js +1 -1
- package/cypress/e2e/components/atoms/button.cy.js +0 -102
- package/cypress/e2e/components/atoms/buttonWithStates.cy.js +0 -47
- package/cypress/e2e/components/atoms/checkbox.cy.js +0 -70
- package/cypress/e2e/components/atoms/confetti.cy.js +0 -46
- package/cypress/e2e/components/atoms/errorText.cy.js +0 -45
- package/cypress/e2e/components/atoms/input.cy.js +0 -157
- package/cypress/e2e/components/atoms/label.cy.js +0 -93
- package/cypress/e2e/components/atoms/link.cy.js +0 -190
- package/cypress/e2e/components/atoms/logo.cy.js +0 -132
- package/cypress/e2e/components/atoms/pagination.cy.js +0 -191
- package/cypress/e2e/components/atoms/picture.cy.js +0 -130
- package/cypress/e2e/components/atoms/radioButton.cy.js +0 -76
- package/cypress/e2e/components/atoms/richText.cy.js +0 -70
- package/cypress/e2e/components/atoms/select.cy.js +0 -84
- package/cypress/e2e/components/atoms/socialIcons.cy.js +0 -162
- package/cypress/e2e/components/atoms/text.cy.js +0 -169
- package/cypress/e2e/components/atoms/textArea.cy.js +0 -89
- package/cypress/e2e/components/atoms/textInputWithDrop.cy.js +0 -76
- package/cypress/e2e/components/molecules/accordion.cy.js +0 -67
- package/cypress/e2e/components/molecules/articleTeaser.cy.js +0 -105
- package/cypress/e2e/components/molecules/banner.cy.js +0 -67
- package/cypress/e2e/components/molecules/box.cy.js +0 -104
- package/cypress/e2e/components/molecules/card.cy.js +0 -105
- package/cypress/e2e/components/molecules/cardDs.cy.js +0 -198
- package/cypress/e2e/components/molecules/chip.cy.js +0 -68
- package/cypress/e2e/components/molecules/countdown.cy.js +0 -71
- package/cypress/e2e/components/molecules/descriptor.cy.js +0 -142
- package/cypress/e2e/components/molecules/doubleCopy.cy.js +0 -79
- package/cypress/e2e/components/molecules/heroBanner.cy.js +0 -69
- package/cypress/e2e/components/molecules/infoBanner.cy.js +0 -69
- package/cypress/e2e/components/molecules/partnerLink.cy.js +0 -68
- package/cypress/e2e/components/molecules/promo.cy.js +0 -74
- package/cypress/e2e/components/molecules/schoolLookup.cy.js +0 -83
- package/cypress/e2e/components/molecules/searchInput.cy.js +0 -72
- package/cypress/e2e/components/molecules/searchResult.cy.js +0 -191
- package/cypress/e2e/components/molecules/shareButton.cy.js +0 -76
- package/cypress/e2e/components/molecules/simpleSchoolLookup.cy.js +0 -83
- package/cypress/e2e/components/molecules/singleMessage.cy.js +0 -502
- package/cypress/e2e/components/molecules/singleMessageDs.cy.js +0 -234
- package/cypress/e2e/components/molecules/typeahead.cy.js +0 -97
- package/cypress/e2e/components/molecules/videoBanner.cy.js +0 -132
- package/cypress/e2e/components/organisms/cookieBanner.cy.js +0 -80
- package/cypress/e2e/components/organisms/donate.cy.js +0 -284
- package/cypress/e2e/components/organisms/emailSignUp.cy.js +0 -54
- package/cypress/e2e/components/organisms/footer.cy.js +0 -168
- package/cypress/e2e/components/organisms/header.cy.js +0 -138
- package/cypress/e2e/components/organisms/impactSlider.cy.js +0 -72
- package/cypress/e2e/components/organisms/marketingPreferencesDSForm.cy.js +0 -589
- package/cypress/e2e/components/organisms/membership.cy.js +0 -122
- package/cypress/fixtures/example.json +0 -5
- package/cypress/plugins/index.js +0 -21
- package/cypress/support/commands.js +0 -25
- package/cypress/support/e2e.js +0 -36
- package/cypress.config.js +0 -15
- package/dist/components/Atoms/SocialIcons/assets/x-logo.svg +0 -3
- package/src/components/Atoms/SocialIcons/assets/x-logo.svg +0 -3
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
require("jest-styled-components");
|
|
6
6
|
var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
|
|
7
7
|
var _Pagination = _interopRequireDefault(require("./Pagination"));
|
|
8
|
-
it('renders correctly in minimalist form',
|
|
9
|
-
|
|
8
|
+
it('renders correctly in minimalist form', () => {
|
|
9
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
10
10
|
maxPages: 5,
|
|
11
11
|
totalPages: 5,
|
|
12
12
|
currentPage: 3,
|
|
13
|
-
createURL:
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
onSelect: function onSelect(value) {
|
|
17
|
-
return value;
|
|
18
|
-
},
|
|
13
|
+
createURL: value => "example.com/page/".concat(value),
|
|
14
|
+
onSelect: value => value,
|
|
19
15
|
showFirst: false,
|
|
20
16
|
showPrevious: false,
|
|
21
17
|
showNext: false,
|
|
@@ -24,17 +20,13 @@ it('renders correctly in minimalist form', function () {
|
|
|
24
20
|
})).toJSON();
|
|
25
21
|
expect(tree).toMatchSnapshot();
|
|
26
22
|
});
|
|
27
|
-
it('renders correctly in minimalist form with non-default color',
|
|
28
|
-
|
|
23
|
+
it('renders correctly in minimalist form with non-default color', () => {
|
|
24
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
29
25
|
maxPages: 5,
|
|
30
26
|
totalPages: 5,
|
|
31
27
|
currentPage: 3,
|
|
32
|
-
createURL:
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
onSelect: function onSelect(value) {
|
|
36
|
-
return value;
|
|
37
|
-
},
|
|
28
|
+
createURL: value => "example.com/page/".concat(value),
|
|
29
|
+
onSelect: value => value,
|
|
38
30
|
showFirst: false,
|
|
39
31
|
showPrevious: false,
|
|
40
32
|
showNext: false,
|
|
@@ -44,17 +36,13 @@ it('renders correctly in minimalist form with non-default color', function () {
|
|
|
44
36
|
})).toJSON();
|
|
45
37
|
expect(tree).toMatchSnapshot();
|
|
46
38
|
});
|
|
47
|
-
it('renders correctly in full size with max pages more than total pages',
|
|
48
|
-
|
|
39
|
+
it('renders correctly in full size with max pages more than total pages', () => {
|
|
40
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
49
41
|
maxPages: 10,
|
|
50
42
|
totalPages: 6,
|
|
51
43
|
currentPage: 4,
|
|
52
|
-
createURL:
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
onSelect: function onSelect(value) {
|
|
56
|
-
return value;
|
|
57
|
-
},
|
|
44
|
+
createURL: value => "example.com/page/".concat(value),
|
|
45
|
+
onSelect: value => value,
|
|
58
46
|
showFirst: true,
|
|
59
47
|
showPrevious: true,
|
|
60
48
|
showNext: true,
|
|
@@ -63,17 +51,13 @@ it('renders correctly in full size with max pages more than total pages', functi
|
|
|
63
51
|
})).toJSON();
|
|
64
52
|
expect(tree).toMatchSnapshot();
|
|
65
53
|
});
|
|
66
|
-
it('renders correctly in full size with max pages less than total pages',
|
|
67
|
-
|
|
54
|
+
it('renders correctly in full size with max pages less than total pages', () => {
|
|
55
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
68
56
|
maxPages: 6,
|
|
69
57
|
totalPages: 10,
|
|
70
58
|
currentPage: 2,
|
|
71
|
-
createURL:
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
onSelect: function onSelect(value) {
|
|
75
|
-
return value;
|
|
76
|
-
},
|
|
59
|
+
createURL: value => "example.com/page/".concat(value),
|
|
60
|
+
onSelect: value => value,
|
|
77
61
|
showFirst: true,
|
|
78
62
|
showPrevious: true,
|
|
79
63
|
showNext: true,
|
|
@@ -82,17 +66,13 @@ it('renders correctly in full size with max pages less than total pages', functi
|
|
|
82
66
|
})).toJSON();
|
|
83
67
|
expect(tree).toMatchSnapshot();
|
|
84
68
|
});
|
|
85
|
-
it('renders correctly in full size with max pages less than current page',
|
|
86
|
-
|
|
69
|
+
it('renders correctly in full size with max pages less than current page', () => {
|
|
70
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
87
71
|
maxPages: 5,
|
|
88
72
|
totalPages: 20,
|
|
89
73
|
currentPage: 19,
|
|
90
|
-
createURL:
|
|
91
|
-
|
|
92
|
-
},
|
|
93
|
-
onSelect: function onSelect(value) {
|
|
94
|
-
return value;
|
|
95
|
-
},
|
|
74
|
+
createURL: value => "example.com/page/".concat(value),
|
|
75
|
+
onSelect: value => value,
|
|
96
76
|
showFirst: true,
|
|
97
77
|
showPrevious: true,
|
|
98
78
|
showNext: true,
|
|
@@ -101,17 +81,13 @@ it('renders correctly in full size with max pages less than current page', funct
|
|
|
101
81
|
})).toJSON();
|
|
102
82
|
expect(tree).toMatchSnapshot();
|
|
103
83
|
});
|
|
104
|
-
it('renders correctly in full size with first page selected',
|
|
105
|
-
|
|
84
|
+
it('renders correctly in full size with first page selected', () => {
|
|
85
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
106
86
|
maxPages: 5,
|
|
107
87
|
totalPages: 5,
|
|
108
88
|
currentPage: 1,
|
|
109
|
-
createURL:
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
onSelect: function onSelect(value) {
|
|
113
|
-
return value;
|
|
114
|
-
},
|
|
89
|
+
createURL: value => "example.com/page/".concat(value),
|
|
90
|
+
onSelect: value => value,
|
|
115
91
|
showFirst: true,
|
|
116
92
|
showPrevious: true,
|
|
117
93
|
showNext: true,
|
|
@@ -120,17 +96,13 @@ it('renders correctly in full size with first page selected', function () {
|
|
|
120
96
|
})).toJSON();
|
|
121
97
|
expect(tree).toMatchSnapshot();
|
|
122
98
|
});
|
|
123
|
-
it('renders correctly in full size with last page selected',
|
|
124
|
-
|
|
99
|
+
it('renders correctly in full size with last page selected', () => {
|
|
100
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
125
101
|
maxPages: 5,
|
|
126
102
|
totalPages: 5,
|
|
127
103
|
currentPage: 5,
|
|
128
|
-
createURL:
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
onSelect: function onSelect(value) {
|
|
132
|
-
return value;
|
|
133
|
-
},
|
|
104
|
+
createURL: value => "example.com/page/".concat(value),
|
|
105
|
+
onSelect: value => value,
|
|
134
106
|
showFirst: true,
|
|
135
107
|
showPrevious: true,
|
|
136
108
|
showNext: true,
|
|
@@ -139,17 +111,13 @@ it('renders correctly in full size with last page selected', function () {
|
|
|
139
111
|
})).toJSON();
|
|
140
112
|
expect(tree).toMatchSnapshot();
|
|
141
113
|
});
|
|
142
|
-
it('renders correctly in full size with more on left',
|
|
143
|
-
|
|
114
|
+
it('renders correctly in full size with more on left', () => {
|
|
115
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
144
116
|
maxPages: 5,
|
|
145
117
|
totalPages: 6,
|
|
146
118
|
currentPage: 4,
|
|
147
|
-
createURL:
|
|
148
|
-
|
|
149
|
-
},
|
|
150
|
-
onSelect: function onSelect(value) {
|
|
151
|
-
return value;
|
|
152
|
-
},
|
|
119
|
+
createURL: value => "example.com/page/".concat(value),
|
|
120
|
+
onSelect: value => value,
|
|
153
121
|
showFirst: true,
|
|
154
122
|
showPrevious: true,
|
|
155
123
|
showNext: true,
|
|
@@ -158,17 +126,13 @@ it('renders correctly in full size with more on left', function () {
|
|
|
158
126
|
})).toJSON();
|
|
159
127
|
expect(tree).toMatchSnapshot();
|
|
160
128
|
});
|
|
161
|
-
it('renders correctly in full size with more on right',
|
|
162
|
-
|
|
129
|
+
it('renders correctly in full size with more on right', () => {
|
|
130
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
163
131
|
maxPages: 5,
|
|
164
132
|
totalPages: 6,
|
|
165
133
|
currentPage: 3,
|
|
166
|
-
createURL:
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
onSelect: function onSelect(value) {
|
|
170
|
-
return value;
|
|
171
|
-
},
|
|
134
|
+
createURL: value => "example.com/page/".concat(value),
|
|
135
|
+
onSelect: value => value,
|
|
172
136
|
showFirst: true,
|
|
173
137
|
showPrevious: true,
|
|
174
138
|
showNext: true,
|
|
@@ -177,17 +141,13 @@ it('renders correctly in full size with more on right', function () {
|
|
|
177
141
|
})).toJSON();
|
|
178
142
|
expect(tree).toMatchSnapshot();
|
|
179
143
|
});
|
|
180
|
-
it('renders correctly in full size with more on both sides',
|
|
181
|
-
|
|
144
|
+
it('renders correctly in full size with more on both sides', () => {
|
|
145
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
182
146
|
maxPages: 5,
|
|
183
147
|
totalPages: 7,
|
|
184
148
|
currentPage: 4,
|
|
185
|
-
createURL:
|
|
186
|
-
|
|
187
|
-
},
|
|
188
|
-
onSelect: function onSelect(value) {
|
|
189
|
-
return value;
|
|
190
|
-
},
|
|
149
|
+
createURL: value => "example.com/page/".concat(value),
|
|
150
|
+
onSelect: value => value,
|
|
191
151
|
showFirst: true,
|
|
192
152
|
showPrevious: true,
|
|
193
153
|
showNext: true,
|
|
@@ -196,17 +156,13 @@ it('renders correctly in full size with more on both sides', function () {
|
|
|
196
156
|
})).toJSON();
|
|
197
157
|
expect(tree).toMatchSnapshot();
|
|
198
158
|
});
|
|
199
|
-
it('renders correctly with custom style',
|
|
200
|
-
|
|
159
|
+
it('renders correctly with custom style', () => {
|
|
160
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
201
161
|
maxPages: 5,
|
|
202
162
|
totalPages: 10,
|
|
203
163
|
currentPage: 5,
|
|
204
|
-
createURL:
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
onSelect: function onSelect(value) {
|
|
208
|
-
return value;
|
|
209
|
-
},
|
|
164
|
+
createURL: value => "example.com/page/".concat(value),
|
|
165
|
+
onSelect: value => value,
|
|
210
166
|
showFirst: true,
|
|
211
167
|
showPrevious: true,
|
|
212
168
|
showNext: true,
|
|
@@ -223,17 +179,13 @@ it('renders correctly with custom style', function () {
|
|
|
223
179
|
})).toJSON();
|
|
224
180
|
expect(tree).toMatchSnapshot();
|
|
225
181
|
});
|
|
226
|
-
it('renders correctly with custom labels',
|
|
227
|
-
|
|
182
|
+
it('renders correctly with custom labels', () => {
|
|
183
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
228
184
|
maxPages: 5,
|
|
229
185
|
totalPages: 5,
|
|
230
186
|
currentPage: 3,
|
|
231
|
-
createURL:
|
|
232
|
-
|
|
233
|
-
},
|
|
234
|
-
onSelect: function onSelect(value) {
|
|
235
|
-
return value;
|
|
236
|
-
},
|
|
187
|
+
createURL: value => "example.com/page/".concat(value),
|
|
188
|
+
onSelect: value => value,
|
|
237
189
|
showFirst: true,
|
|
238
190
|
showPrevious: true,
|
|
239
191
|
showNext: true,
|
|
@@ -244,23 +196,17 @@ it('renders correctly with custom labels', function () {
|
|
|
244
196
|
firstLabel: "First",
|
|
245
197
|
lastLabel: "Last",
|
|
246
198
|
moreLabel: "More",
|
|
247
|
-
getPageLabel:
|
|
248
|
-
return "Page ".concat(value);
|
|
249
|
-
}
|
|
199
|
+
getPageLabel: value => "Page ".concat(value)
|
|
250
200
|
})).toJSON();
|
|
251
201
|
expect(tree).toMatchSnapshot();
|
|
252
202
|
});
|
|
253
|
-
it('renders nothing in case of no pages',
|
|
254
|
-
|
|
203
|
+
it('renders nothing in case of no pages', () => {
|
|
204
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
255
205
|
maxPages: 5,
|
|
256
206
|
totalPages: 0,
|
|
257
207
|
currentPage: 2,
|
|
258
|
-
createURL:
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
onSelect: function onSelect(value) {
|
|
262
|
-
return value;
|
|
263
|
-
},
|
|
208
|
+
createURL: value => "example.com/page/".concat(value),
|
|
209
|
+
onSelect: value => value,
|
|
264
210
|
showFirst: true,
|
|
265
211
|
showPrevious: true,
|
|
266
212
|
showNext: true,
|
|
@@ -12,9 +12,7 @@ var _lodash = require("lodash");
|
|
|
12
12
|
* @return {Integer}
|
|
13
13
|
*/
|
|
14
14
|
// Use totalPages as displayed pages if it is less than allowed max number of pages
|
|
15
|
-
|
|
16
|
-
return Math.min(maxPages, totalPages);
|
|
17
|
-
};
|
|
15
|
+
const calculateDisplayedPages = (maxPages, totalPages) => Math.min(maxPages, totalPages);
|
|
18
16
|
|
|
19
17
|
/**
|
|
20
18
|
* Determines the number of displayed pages to the left
|
|
@@ -25,8 +23,9 @@ var calculateDisplayedPages = exports.calculateDisplayedPages = function calcula
|
|
|
25
23
|
* @param {Integer} totalPages
|
|
26
24
|
* @return {Integer}
|
|
27
25
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
exports.calculateDisplayedPages = calculateDisplayedPages;
|
|
27
|
+
const calculatePagesToTheLeft = (currentPage, displayedPages, totalPages) => {
|
|
28
|
+
const oneSidePages = Math.floor(displayedPages / 2);
|
|
30
29
|
// if current page is closer to the start
|
|
31
30
|
// pages to the left will be current page minus one -for the current page item itself-
|
|
32
31
|
if (currentPage <= oneSidePages) {
|
|
@@ -49,9 +48,8 @@ var calculatePagesToTheLeft = exports.calculatePagesToTheLeft = function calcula
|
|
|
49
48
|
* @param {Integer} totalPages
|
|
50
49
|
* @return {Integer}
|
|
51
50
|
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
51
|
+
exports.calculatePagesToTheLeft = calculatePagesToTheLeft;
|
|
52
|
+
const calculatePagesToTheRight = (currentPage, displayedPages, totalPages) => displayedPages - calculatePagesToTheLeft(currentPage, displayedPages, totalPages) - 1;
|
|
55
53
|
|
|
56
54
|
/**
|
|
57
55
|
* Retrieves the correct page range
|
|
@@ -60,15 +58,17 @@ var calculatePagesToTheRight = exports.calculatePagesToTheRight = function calcu
|
|
|
60
58
|
* @param {Integer} totalPages
|
|
61
59
|
* @return {Integer}
|
|
62
60
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
exports.calculatePagesToTheRight = calculatePagesToTheRight;
|
|
62
|
+
const getPages = (currentPage, maxPages, totalPages) => {
|
|
63
|
+
const displayedPages = calculateDisplayedPages(maxPages, totalPages);
|
|
65
64
|
// If all pages are allowed, return the entire page range
|
|
66
65
|
if (displayedPages === totalPages) {
|
|
67
66
|
return (0, _lodash.range)(1, totalPages + 1);
|
|
68
67
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const pagesToTheLeft = calculatePagesToTheLeft(currentPage, displayedPages, totalPages);
|
|
69
|
+
const pagesToTheRight = calculatePagesToTheRight(currentPage, displayedPages, totalPages);
|
|
70
|
+
const first = currentPage - pagesToTheLeft;
|
|
71
|
+
const last = currentPage + pagesToTheRight;
|
|
73
72
|
return (0, _lodash.range)(first, last + 1);
|
|
74
|
-
};
|
|
73
|
+
};
|
|
74
|
+
exports.getPages = getPages;
|
|
@@ -1,70 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
9
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
12
10
|
require("lazysizes");
|
|
13
11
|
require("lazysizes/plugins/blur-up/ls.blur-up");
|
|
14
|
-
var _excluded = ["images", "image", "alt", "width", "height", "objectFit", "imageLow", "isBackgroundImage"];
|
|
15
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n.default = e, t && t.set(e, n), n; }
|
|
17
12
|
// Transparent pixel png
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const IMAGE_FALLBACK = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';
|
|
14
|
+
const Wrapper = _styledComponents.default.div.withConfig({
|
|
20
15
|
displayName: "Picture__Wrapper",
|
|
21
16
|
componentId: "sc-1x3z81z-0"
|
|
22
|
-
})(["", ";display:block;width:", ";height:", ";position:relative;", ";"],
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
})(["", ";display:block;width:", ";height:", ";position:relative;", ";"], _ref => {
|
|
18
|
+
let {
|
|
19
|
+
objFitState,
|
|
20
|
+
nonObjFitImage
|
|
21
|
+
} = _ref;
|
|
25
22
|
return !objFitState && nonObjFitImage && "background-image: url(".concat(nonObjFitImage, "); background-size: cover; background-position: center;");
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, function (_ref2) {
|
|
31
|
-
var isBackgroundImage = _ref2.isBackgroundImage;
|
|
23
|
+
}, props => props.width ? props.width : '100%', props => props.height ? props.height : '100%', _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
isBackgroundImage
|
|
26
|
+
} = _ref2;
|
|
32
27
|
return isBackgroundImage && 'position: absolute; bottom: 0px; left: 0px; right: 0px; height: 100%;';
|
|
33
28
|
});
|
|
34
|
-
|
|
29
|
+
const Image = _styledComponents.default.img.withConfig({
|
|
35
30
|
displayName: "Picture__Image",
|
|
36
31
|
componentId: "sc-1x3z81z-1"
|
|
37
|
-
})(["width:", ";height:", ";display:block;object-fit:", ";", ";"],
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
return props.objectFit === 'none' && 'none' || props.objectFit === 'cover' && 'cover' || props.objectFit === 'contain' && 'contain';
|
|
43
|
-
}, function (_ref3) {
|
|
44
|
-
var objectFit = _ref3.objectFit,
|
|
45
|
-
objFitState = _ref3.objFitState;
|
|
32
|
+
})(["width:", ";height:", ";display:block;object-fit:", ";", ";"], props => props.width ? props.width : '100%', props => props.height ? props.height : 'auto', props => props.objectFit === 'none' && 'none' || props.objectFit === 'cover' && 'cover' || props.objectFit === 'contain' && 'contain', _ref3 => {
|
|
33
|
+
let {
|
|
34
|
+
objectFit,
|
|
35
|
+
objFitState
|
|
36
|
+
} = _ref3;
|
|
46
37
|
return objectFit !== 'none' && !objFitState && 'visibility: hidden;';
|
|
47
38
|
});
|
|
48
39
|
|
|
49
40
|
/** Responsive Picture */
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(0, _react.useEffect)(function () {
|
|
42
|
+
const Picture = _ref4 => {
|
|
43
|
+
let {
|
|
44
|
+
images,
|
|
45
|
+
image,
|
|
46
|
+
alt,
|
|
47
|
+
width,
|
|
48
|
+
height,
|
|
49
|
+
objectFit,
|
|
50
|
+
imageLow,
|
|
51
|
+
isBackgroundImage,
|
|
52
|
+
...rest
|
|
53
|
+
} = _ref4;
|
|
54
|
+
const document = typeof window !== 'undefined' ? window.document : null;
|
|
55
|
+
const [objFitState, setObjFitState] = (0, _react.useState)(true);
|
|
56
|
+
let nonObjFitImage = null;
|
|
57
|
+
(0, _react.useEffect)(() => {
|
|
68
58
|
// Once document is available, determine if this browser supports object-fit
|
|
69
59
|
if ('objectFit' in document.documentElement.style === false) {
|
|
70
60
|
setObjFitState(false);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
require("jest-styled-components");
|
|
6
6
|
var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
|
|
7
7
|
var _Picture = _interopRequireDefault(require("./Picture"));
|
|
8
8
|
var _data = require("../../../styleguide/data/data");
|
|
9
|
-
it('renders correctly',
|
|
10
|
-
|
|
9
|
+
it('renders correctly', () => {
|
|
10
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
11
11
|
images: _data.defaultData.images,
|
|
12
12
|
image: _data.defaultData.image,
|
|
13
13
|
alt: "Test images"
|
|
14
14
|
})).toJSON();
|
|
15
15
|
expect(tree).toMatchInlineSnapshot("\n .c0 {\n display: block;\n width: 100%;\n height: auto;\n position: relative;\n }\n\n .c1 {\n width: 100%;\n height: auto;\n display: block;\n object-fit: none;\n }\n\n <div\n className=\"c0 lazyload\"\n height=\"auto\"\n width=\"100%\"\n >\n <img\n alt=\"Test images\"\n className=\"c1 lazyload\"\n data-lowsrc={null}\n data-sizes=\"auto\"\n data-src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n data-srcset=\"//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=200&h=150&q=50 200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=400&h=300&q=50 400w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=800&h=600&q=50 800w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1200&h=900&q=50 1200w,//images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg?w=1440&h=1080&q=50 1440w\"\n height=\"auto\"\n src=\"http://images.ctfassets.net/zsfivwzfgl3t/Yq59XdwwQgjNOxky93K1Q/17c2d80dce99067b0b3508f33075cbe3/funding_4-3_2x.jpg\"\n srcSet=\"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\"\n width=\"100%\"\n />\n </div>\n ");
|
|
16
16
|
});
|
|
17
|
-
it('renders correctly with custom props',
|
|
18
|
-
|
|
17
|
+
it('renders correctly with custom props', () => {
|
|
18
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_Picture.default, {
|
|
19
19
|
images: _data.defaultData.images,
|
|
20
20
|
image: _data.defaultData.image,
|
|
21
21
|
objectFit: "cover",
|
|
@@ -1,55 +1,67 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
11
|
var _Text = _interopRequireDefault(require("../Text/Text"));
|
|
13
|
-
var _excluded = ["label", "name", "value"];
|
|
14
12
|
/**
|
|
15
13
|
* Input radio component
|
|
16
14
|
*/
|
|
17
|
-
|
|
15
|
+
const StyledRadioInput = _styledComponents.default.input.withConfig({
|
|
18
16
|
displayName: "RadioButton__StyledRadioInput",
|
|
19
17
|
componentId: "sc-2c24wq-0"
|
|
20
|
-
})(["background-color:", ";font-size:", ";z-index:1;top:0;margin:5px 10px;width:30px;height:30px;opacity:0;left:0;right:0;flex-shrink:0;+ span{left:2px;border-radius:30px;background-clip:padding-box;position:absolute;top:0px;width:30px;height:30px;border:1px solid ", ";}:checked + span{background-color:", ";border:1px solid ", ";:before{position:absolute;content:'';top:8px;left:0;right:0;background-color:", ";border-radius:30px;width:12px;height:12px;z-index:1;margin:0 auto;opacity:1;}}"],
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
})(["background-color:", ";font-size:", ";z-index:1;top:0;margin:5px 10px;width:30px;height:30px;opacity:0;left:0;right:0;flex-shrink:0;+ span{left:2px;border-radius:30px;background-clip:padding-box;position:absolute;top:0px;width:30px;height:30px;border:1px solid ", ";}:checked + span{background-color:", ";border:1px solid ", ";:before{position:absolute;content:'';top:8px;left:0;right:0;background-color:", ";border-radius:30px;width:12px;height:12px;z-index:1;margin:0 auto;opacity:1;}}"], _ref => {
|
|
19
|
+
let {
|
|
20
|
+
color,
|
|
21
|
+
theme
|
|
22
|
+
} = _ref;
|
|
23
23
|
return color ? theme.color(color) : theme.color('white');
|
|
24
|
-
},
|
|
25
|
-
|
|
24
|
+
}, _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
theme
|
|
27
|
+
} = _ref2;
|
|
26
28
|
return theme.fontSize('sm');
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
+
}, _ref3 => {
|
|
30
|
+
let {
|
|
31
|
+
theme
|
|
32
|
+
} = _ref3;
|
|
29
33
|
return theme.color('grey_for_forms');
|
|
30
|
-
},
|
|
31
|
-
|
|
34
|
+
}, _ref4 => {
|
|
35
|
+
let {
|
|
36
|
+
theme
|
|
37
|
+
} = _ref4;
|
|
32
38
|
return theme.color('purple');
|
|
33
|
-
},
|
|
34
|
-
|
|
39
|
+
}, _ref5 => {
|
|
40
|
+
let {
|
|
41
|
+
theme
|
|
42
|
+
} = _ref5;
|
|
35
43
|
return theme.color('purple');
|
|
36
|
-
},
|
|
37
|
-
|
|
44
|
+
}, _ref6 => {
|
|
45
|
+
let {
|
|
46
|
+
theme
|
|
47
|
+
} = _ref6;
|
|
38
48
|
return theme.color('white');
|
|
39
49
|
});
|
|
40
50
|
|
|
41
51
|
/**
|
|
42
52
|
* Label component
|
|
43
53
|
*/
|
|
44
|
-
|
|
54
|
+
const Label = _styledComponents.default.label.withConfig({
|
|
45
55
|
displayName: "RadioButton__Label",
|
|
46
56
|
componentId: "sc-2c24wq-1"
|
|
47
57
|
})(["display:flex;align-items:center;position:relative;"]);
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
const RadioButton = /*#__PURE__*/_react.default.forwardRef((_ref7, ref) => {
|
|
59
|
+
let {
|
|
60
|
+
label,
|
|
61
|
+
name,
|
|
62
|
+
value,
|
|
63
|
+
...rest
|
|
64
|
+
} = _ref7;
|
|
53
65
|
return /*#__PURE__*/_react.default.createElement(Label, {
|
|
54
66
|
htmlFor: value
|
|
55
67
|
}, /*#__PURE__*/_react.default.createElement(StyledRadioInput, Object.assign({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
var _react = _interopRequireDefault(require("react"));
|
|
5
5
|
require("jest-styled-components");
|
|
6
6
|
var _shallowWithTheme = _interopRequireDefault(require("../../../hoc/shallowWithTheme"));
|
|
7
7
|
var _RadioButton = _interopRequireDefault(require("./RadioButton"));
|
|
8
|
-
it('renders correctly',
|
|
9
|
-
|
|
8
|
+
it('renders correctly', () => {
|
|
9
|
+
const tree = (0, _shallowWithTheme.default)( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_RadioButton.default, {
|
|
10
10
|
id: "male",
|
|
11
11
|
name: "gender",
|
|
12
12
|
value: "male",
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Inner = void 0;
|
|
8
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
-
|
|
12
|
-
var Inner = exports.Inner = _styledComponents.default.div.withConfig({
|
|
10
|
+
const Inner = exports.Inner = _styledComponents.default.div.withConfig({
|
|
13
11
|
displayName: "RichText__Inner",
|
|
14
12
|
componentId: "sc-sqyfgj-0"
|
|
15
|
-
})(["text-align:", ";"],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
})(["text-align:", ";"], props => props.align);
|
|
14
|
+
const RichText = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
align,
|
|
17
|
+
markup,
|
|
18
|
+
...rest
|
|
19
|
+
} = _ref;
|
|
22
20
|
return /*#__PURE__*/_react.default.createElement(Inner, Object.assign({
|
|
23
21
|
align: align,
|
|
24
22
|
dangerouslySetInnerHTML: {
|