@spothero/ui 15.10.8 → 16.0.0-beta.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/.eslintignore +2 -1
- package/dex.config.js +1 -1
- package/jest.config.json +1 -2
- package/package.json +8 -24
- package/styles/{v2/components → components}/Accordion/Accordion.stories.js +2 -2
- package/styles/{v2/components → components}/Accordion/styles/button.js +1 -1
- package/styles/{v2/components → components}/Alert/Alert.jsx +2 -2
- package/styles/{v2/components → components}/AutoSuggestSelect/AutoSuggestSelect.jsx +7 -0
- package/styles/{v2/components → components}/Button/stories/button.js +1 -1
- package/styles/{v2/components → components}/Button/stories/overview.js +1 -1
- package/styles/{v2/components → components}/FormControl/FormControl.jsx +2 -0
- package/styles/{v2/components → components}/Grid/Grid.stories.js +1 -1
- package/styles/{v2/components → components}/Heading/Heading.styles.js +1 -1
- package/styles/{v2/components → components}/Image/Image.jsx +23 -2
- package/styles/{v2/components → components}/Link/Link.stories.js +2 -2
- package/styles/{v2/components → components}/List/List.stories.js +2 -2
- package/styles/{v2/components → components}/Modal/Modal.jsx +0 -1
- package/styles/{v2/components → components}/Modal/Modal.stories.js +4 -4
- package/styles/{v2/components → components}/Popover/Popover.stories.js +1 -1
- package/styles/{v2/components → components}/Popover/styles/index.js +1 -1
- package/styles/{v2/components/Popover/styles/popper.js → components/Popover/styles/popover-content.js} +8 -5
- package/styles/components/Popover/styles/popper.js +5 -0
- package/styles/{v2/components → components}/Skeleton/index.js +1 -1
- package/styles/{v2/components → components}/Spinner/Spinner.stories.js +1 -1
- package/styles/{v2/components → components}/Table/Table.styles.js +1 -1
- package/styles/{v2/components → components}/Tabs/Tabs.jsx +2 -3
- package/styles/{v2/components → components}/Tabs/combineSizeWithVariant.js +5 -3
- package/styles/{v2/components → components}/Text/Text.styles.js +1 -1
- package/styles/{v2/components → components}/Text/combineAsWithVariant.js +1 -1
- package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.jsx +2 -2
- package/styles/{v2/components → components}/ThemeProvider/ThemeProvider.stories.js +2 -2
- package/v2/index.js +1 -1
- package/v2/index.js.map +1 -1
- package/backlog/Alert/Alert.js +0 -37
- package/backlog/AutoSuggestInput/AutoSuggestInput.js +0 -474
- package/backlog/AutoSuggestInput/AutoSuggestItem.js +0 -99
- package/backlog/AutoSuggestInput/AutoSuggestList.js +0 -126
- package/backlog/Badge/Badge.js +0 -28
- package/backlog/Chart/Chart.js +0 -211
- package/backlog/Checkbox/Checkbox.js +0 -167
- package/backlog/DateTime/DatePicker.js +0 -279
- package/backlog/DateTime/DatePickerCalendar.js +0 -199
- package/backlog/DateTime/DatePickerCalendarNavigation.js +0 -102
- package/backlog/DateTime/DatePickerCalendarWithRange.js +0 -241
- package/backlog/DateTime/DateTimePicker.js +0 -216
- package/backlog/DateTime/DateTimeRangePicker.js +0 -530
- package/backlog/DateTime/TimePicker.js +0 -180
- package/backlog/DateTime/date-time-assertions.js +0 -66
- package/backlog/DateTime/index.js +0 -55
- package/backlog/ErrorBoundary/ErrorBoundary.js +0 -125
- package/backlog/Flyout/Flyout.js +0 -198
- package/backlog/Form/Form.js +0 -193
- package/backlog/Form/FormElementError.js +0 -24
- package/backlog/Form/FormGroup.js +0 -30
- package/backlog/Form/FormGroupError.js +0 -28
- package/backlog/Form/index.js +0 -39
- package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +0 -253
- package/backlog/GooglePlacesSearchInput/PoweredByGoogle.js +0 -38
- package/backlog/GooglePlacesSearchInput/index.js +0 -23
- package/backlog/HorizontalRule/HorizontalRule.js +0 -30
- package/backlog/Label/Label.js +0 -31
- package/backlog/Notification/Notification.js +0 -178
- package/backlog/Notification/NotificationContainer.js +0 -131
- package/backlog/Notification/NotificationPropTypes.js +0 -37
- package/backlog/Notification/index.js +0 -23
- package/backlog/PasswordControl/PasswordControl.js +0 -201
- package/backlog/Portal/Portal.js +0 -110
- package/backlog/PulseLoader/PulseLoader.js +0 -62
- package/backlog/Radio/Radio.js +0 -135
- package/backlog/Radio/RadioGroup.js +0 -123
- package/backlog/Radio/index.js +0 -23
- package/backlog/RenderInBody/RenderInBody.js +0 -103
- package/backlog/Select/Select.js +0 -275
- package/backlog/Select/SelectItemPropTypes.js +0 -32
- package/backlog/Select/index.js +0 -23
- package/backlog/SelectControlled/SelectControlled.js +0 -270
- package/backlog/SelectControlled/index.js +0 -15
- package/backlog/Sprite/Sprite.js +0 -24
- package/backlog/Tabs/Tab.js +0 -94
- package/backlog/Tabs/TabContent.js +0 -56
- package/backlog/Tabs/TabNavigation.js +0 -108
- package/backlog/Tabs/TabPanel.js +0 -29
- package/backlog/Tabs/Tabs.js +0 -126
- package/backlog/Tabs/index.js +0 -47
- package/backlog/TextArea/TextArea.js +0 -155
- package/backlog/TextInput/TextInput.js +0 -230
- package/backlog/TextInput/TextInputPropTypes.js +0 -114
- package/backlog/TextInput/index.js +0 -23
- package/backlog/Tooltip/Tooltip.js +0 -249
- package/backlog/index.js +0 -393
- package/backlog/v1/components/Button/Button.js +0 -64
- package/backlog/v1/components/Button/button-props.js +0 -48
- package/backlog/v1/components/Image/Image.js +0 -193
- package/backlog/v1/components/Loader/Loader.js +0 -51
- package/backlog/v1/components/Modal/Modal.js +0 -325
- package/backlog/v1/components/Modal/ModalContent.js +0 -154
- package/backlog/v1/components/Modal/ModalFooter.js +0 -89
- package/backlog/v1/components/Modal/index.js +0 -31
- package/backlog/v1/components/Panel/Panel.js +0 -209
- package/backlog/v1/components/Table/Table.js +0 -336
- package/backlog/v1/components/Table/TableCell.js +0 -28
- package/backlog/v1/components/Table/TableCellPropTypes.js +0 -22
- package/backlog/v1/components/Table/TableControls.js +0 -56
- package/backlog/v1/components/Table/TableFooter.js +0 -63
- package/backlog/v1/components/Table/TableHeading.js +0 -126
- package/backlog/v1/components/Table/TableHeadingPropTypes.js +0 -35
- package/backlog/v1/components/Table/TableSortSelector.js +0 -125
- package/backlog/v1/components/Table/TableSortType.js +0 -11
- package/backlog/v1/components/Table/index.js +0 -47
- package/backlog/v1/components/TextButton/TextButton.js +0 -74
- package/backlog/v1/components/index.js +0 -75
- package/backlog/v1/utils/deprecate.js +0 -61
- package/styles/Alert/_Alert.scss +0 -51
- package/styles/AutoSuggestInput/_AutoSuggestInput.scss +0 -116
- package/styles/Badge/_Badge.scss +0 -33
- package/styles/Chart/_Chart.scss +0 -105
- package/styles/Chart/_chartist-settings.scss +0 -131
- package/styles/Chart/_chartist.scss +0 -295
- package/styles/Checkbox/_Checkbox.scss +0 -173
- package/styles/DateTime/_DatePicker.scss +0 -61
- package/styles/DateTime/_DatePickerCalendar.scss +0 -159
- package/styles/DateTime/_DateTime.scss +0 -4
- package/styles/DateTime/_DateTimePicker.scss +0 -46
- package/styles/DateTime/_TimePicker.scss +0 -30
- package/styles/ErrorBoundary/_ErrorBoundary.scss +0 -18
- package/styles/Flyout/_Flyout.scss +0 -73
- package/styles/Form/_Form.scss +0 -53
- package/styles/GooglePlacesSearchInput/_GooglePlacesSearchInput.scss +0 -3
- package/styles/GooglePlacesSearchInput/_PoweredByGoogle.scss +0 -21
- package/styles/HorizontalRule/_HorizontalRule.scss +0 -48
- package/styles/Label/_Label.scss +0 -6
- package/styles/Notification/_Notification.scss +0 -113
- package/styles/PasswordControl/_PasswordControl.scss +0 -86
- package/styles/PulseLoader/_PulseLoader.scss +0 -60
- package/styles/Radio/_Radio.scss +0 -93
- package/styles/Select/_Select.scss +0 -94
- package/styles/Tabs/_Tabs.scss +0 -57
- package/styles/TextArea/_TextArea.scss +0 -26
- package/styles/TextInput/_TextInput.scss +0 -43
- package/styles/Tooltip/_Tooltip.scss +0 -108
- package/styles/_index.scss +0 -34
- package/styles/common/sass/_control-sizing.scss +0 -5
- package/styles/common/sass/_disable-scrolling.scss +0 -7
- package/styles/common/sass/_forms.scss +0 -72
- package/styles/index.js +0 -50
- package/styles/v1/components/Button/Button.jsx +0 -48
- package/styles/v1/components/Button/Button.spec.js +0 -76
- package/styles/v1/components/Button/_Button.scss +0 -178
- package/styles/v1/components/Button/button-props.js +0 -30
- package/styles/v1/components/Button/stories/button.js +0 -20
- package/styles/v1/components/Button/stories/index.stories.js +0 -92
- package/styles/v1/components/Button/stories/overview.js +0 -87
- package/styles/v1/components/Button/stories/types.js +0 -31
- package/styles/v1/components/Image/Image.jsx +0 -175
- package/styles/v1/components/Image/Image.spec.js +0 -113
- package/styles/v1/components/Image/_Image.scss +0 -24
- package/styles/v1/components/Image/stories/Cloudinary.stories.js +0 -39
- package/styles/v1/components/Image/stories/Display.stories.js +0 -92
- package/styles/v1/components/Loader/Loader.jsx +0 -54
- package/styles/v1/components/Loader/Loader.spec.js +0 -67
- package/styles/v1/components/Loader/_Loader.scss +0 -18
- package/styles/v1/components/Loader/stories/Display.stories.js +0 -55
- package/styles/v1/components/Modal/Modal.jsx +0 -315
- package/styles/v1/components/Modal/Modal.spec.js +0 -293
- package/styles/v1/components/Modal/ModalContent.jsx +0 -126
- package/styles/v1/components/Modal/ModalFooter.jsx +0 -53
- package/styles/v1/components/Modal/_Modal.scss +0 -262
- package/styles/v1/components/Modal/index.js +0 -3
- package/styles/v1/components/Modal/stories/Content.stories.js +0 -314
- package/styles/v1/components/Modal/stories/Display.stories.js +0 -208
- package/styles/v1/components/Modal/stories/Methods.stories.js +0 -44
- package/styles/v1/components/Modal/stories/Width.stories.js +0 -82
- package/styles/v1/components/Modal/stories/helpers/ReduxConsumer.jsx +0 -21
- package/styles/v1/components/Panel/Panel.jsx +0 -202
- package/styles/v1/components/Panel/Panel.spec.js +0 -196
- package/styles/v1/components/Panel/_Panel.scss +0 -55
- package/styles/v1/components/Panel/stories/Display.stories.js +0 -82
- package/styles/v1/components/Panel/stories/Methods.stories.js +0 -76
- package/styles/v1/components/Table/Table.jsx +0 -367
- package/styles/v1/components/Table/Table.spec.js +0 -526
- package/styles/v1/components/Table/TableCell.jsx +0 -17
- package/styles/v1/components/Table/TableCellPropTypes.js +0 -10
- package/styles/v1/components/Table/TableControls.jsx +0 -61
- package/styles/v1/components/Table/TableFooter.jsx +0 -72
- package/styles/v1/components/Table/TableHeading.jsx +0 -58
- package/styles/v1/components/Table/TableHeadingPropTypes.js +0 -20
- package/styles/v1/components/Table/TableSortSelector.jsx +0 -63
- package/styles/v1/components/Table/TableSortType.js +0 -4
- package/styles/v1/components/Table/_Table.scss +0 -263
- package/styles/v1/components/Table/index.js +0 -5
- package/styles/v1/components/Table/stories/Display.stories.js +0 -194
- package/styles/v1/components/Table/stories/Methods.stories.js +0 -141
- package/styles/v1/components/Table/stories/helpers/TableCellEmail.jsx +0 -25
- package/styles/v1/components/Table/stories/helpers/TableCustomRow.jsx +0 -35
- package/styles/v1/components/Table/stories/helpers/TableHeadingEmail.jsx +0 -20
- package/styles/v1/components/Table/stories/helpers/table-data.js +0 -26
- package/styles/v1/components/Table/stories/helpers/table-headers.js +0 -14
- package/styles/v1/components/TextButton/TextButton.jsx +0 -78
- package/styles/v1/components/TextButton/TextButton.spec.js +0 -95
- package/styles/v1/components/TextButton/_TextButton.scss +0 -114
- package/styles/v1/components/TextButton/stories/Display.stories.js +0 -46
- package/styles/v1/components/index.js +0 -7
- package/styles/v1/utils/deprecate.js +0 -45
- package/styles/v2/components/Popover/styles/popover-content.js +0 -8
- package/styles/v2/components/index.js +0 -70
- package/styles/v2/components/styles.js +0 -21
- package/styles/v2/theme/global.js +0 -118
- package/styles/v2/theme/index.js +0 -27
- package/styles/v2/utils/Spaces.js +0 -16
- package/v1/assets-manifest.json +0 -5
- package/v1/index.html +0 -1
- package/v1/index.js +0 -3
- package/v1/index.js.LICENSE.txt +0 -23
- package/v1/index.js.map +0 -1
- /package/styles/{v2/components → components}/Accordion/Accordion.jsx +0 -0
- /package/styles/{v2/components → components}/Accordion/index.js +0 -0
- /package/styles/{v2/components → components}/Accordion/styles/container.js +0 -0
- /package/styles/{v2/components → components}/Accordion/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Accordion/styles/panel.js +0 -0
- /package/styles/{v2/components → components}/Alert/Alert.stories.js +0 -0
- /package/styles/{v2/components → components}/Alert/index.js +0 -0
- /package/styles/{v2/components → components}/Alert/styles/index.js +0 -0
- /package/styles/{v2/components → components}/AutoSuggestSelect/index.js +0 -0
- /package/styles/{v2/components → components}/Badge/Badge.jsx +0 -0
- /package/styles/{v2/components → components}/Badge/Badge.stories.js +0 -0
- /package/styles/{v2/components → components}/Badge/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Button/Button.jsx +0 -0
- /package/styles/{v2/components → components}/Button/Button.spec.js +0 -0
- /package/styles/{v2/components → components}/Button/Button.styles.js +0 -0
- /package/styles/{v2/components → components}/Button/button-props.js +0 -0
- /package/styles/{v2/components → components}/Button/index.js +0 -0
- /package/styles/{v2/components → components}/Button/stories/index.stories.js +0 -0
- /package/styles/{v2/components → components}/Card/Card.jsx +0 -0
- /package/styles/{v2/components → components}/Card/Card.stories.js +0 -0
- /package/styles/{v2/components → components}/Checkbox/Checkbox.jsx +0 -0
- /package/styles/{v2/components → components}/Checkbox/Checkbox.stories.js +0 -0
- /package/styles/{v2/components → components}/Checkbox/index.js +0 -0
- /package/styles/{v2/components → components}/Checkbox/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Container/Container.jsx +0 -0
- /package/styles/{v2/components → components}/Container/Container.stories.js +0 -0
- /package/styles/{v2/components → components}/Container/Container.styles.js +0 -0
- /package/styles/{v2/components → components}/Divider/Divider.jsx +0 -0
- /package/styles/{v2/components → components}/Divider/Divider.stories.js +0 -0
- /package/styles/{v2/components → components}/Divider/Divider.styles.js +0 -0
- /package/styles/{v2/components → components}/Grid/Grid.jsx +0 -0
- /package/styles/{v2/components → components}/Grid/Grid.styles.js +0 -0
- /package/styles/{v2/components → components}/Grid/GridItem.jsx +0 -0
- /package/styles/{v2/components → components}/Grid/GridItem.styles.js +0 -0
- /package/styles/{v2/components → components}/Grid/index.js +0 -0
- /package/styles/{v2/components → components}/Heading/Heading.jsx +0 -0
- /package/styles/{v2/components → components}/Heading/Heading.stories.js +0 -0
- /package/styles/{v2/components → components}/Icon/Icon.jsx +0 -0
- /package/styles/{v2/components → components}/Icon/Icon.stories.js +0 -0
- /package/styles/{v2/components → components}/Image/Image.spec.js +0 -0
- /package/styles/{v2/components → components}/Image/Image.stories.js +0 -0
- /package/styles/{v2/components → components}/Input/Input.jsx +0 -0
- /package/styles/{v2/components → components}/Input/Input.stories.js +0 -0
- /package/styles/{v2/components → components}/Input/index.js +0 -0
- /package/styles/{v2/components → components}/Input/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Link/Link.jsx +0 -0
- /package/styles/{v2/components → components}/Link/Link.styles.js +0 -0
- /package/styles/{v2/components → components}/List/List.jsx +0 -0
- /package/styles/{v2/components → components}/List/index.js +0 -0
- /package/styles/{v2/components → components}/List/styles/index.js +0 -0
- /package/styles/{v2/components → components}/List/styles/item.styles.js +0 -0
- /package/styles/{v2/components → components}/Loader/Loader.jsx +0 -0
- /package/styles/{v2/components → components}/Loader/Loader.stories.js +0 -0
- /package/styles/{v2/components → components}/Modal/index.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/body.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/closeButton.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/dialog.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/dialogContainer.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/footer.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/header.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Modal/styles/overlay.js +0 -0
- /package/styles/{v2/components → components}/Popover/Popover.jsx +0 -0
- /package/styles/{v2/components → components}/Popover/PopoverArrow.jsx +0 -0
- /package/styles/{v2/components → components}/Popover/PopoverCloseButton.jsx +0 -0
- /package/styles/{v2/components → components}/Popover/PopoverContent.jsx +0 -0
- /package/styles/{v2/components → components}/Popover/index.js +0 -0
- /package/styles/{v2/components → components}/Popover/styles/popover-arrow.js +0 -0
- /package/styles/{v2/components → components}/Popover/styles/popover-body.js +0 -0
- /package/styles/{v2/components → components}/Popover/styles/popover-close-button.js +0 -0
- /package/styles/{v2/components → components}/Popover/styles/popover-header.js +0 -0
- /package/styles/{v2/components → components}/Radio/Radio.jsx +0 -0
- /package/styles/{v2/components → components}/Radio/Radio.stories.js +0 -0
- /package/styles/{v2/components → components}/Radio/RadioGroup.jsx +0 -0
- /package/styles/{v2/components → components}/Radio/index.js +0 -0
- /package/styles/{v2/components → components}/Radio/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Select/Select.jsx +0 -0
- /package/styles/{v2/components → components}/Select/Select.stories.js +0 -0
- /package/styles/{v2/components → components}/Select/index.js +0 -0
- /package/styles/{v2/components → components}/Select/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Skeleton/Skeleton.stories.jsx +0 -0
- /package/styles/{v2/components → components}/Skeleton/Skeleton.styles.js +0 -0
- /package/styles/{v2/components → components}/Spinner/Spinner.jsx +0 -0
- /package/styles/{v2/components → components}/Spinner/Spinner.styles.js +0 -0
- /package/styles/{v2/components → components}/Switch/Switch.jsx +0 -0
- /package/styles/{v2/components → components}/Switch/Switch.stories.js +0 -0
- /package/styles/{v2/components → components}/Switch/index.js +0 -0
- /package/styles/{v2/components → components}/Switch/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Table/Table.jsx +0 -0
- /package/styles/{v2/components → components}/Table/Table.stories.js +0 -0
- /package/styles/{v2/components → components}/Table/index.js +0 -0
- /package/styles/{v2/components → components}/Tabs/Tabs.stories.js +0 -0
- /package/styles/{v2/components → components}/Tabs/index.js +0 -0
- /package/styles/{v2/components → components}/Tabs/styles/index.js +0 -0
- /package/styles/{v2/components → components}/Text/Text.jsx +0 -0
- /package/styles/{v2/components → components}/Text/Text.stories.js +0 -0
- /package/styles/{v2/components → components}/Text/options.js +0 -0
- /package/styles/{v2/theme → theme}/base/breakpoints.js +0 -0
- /package/styles/{v2/theme → theme}/base/colors.js +0 -0
- /package/styles/{v2/theme → theme}/base/index.js +0 -0
- /package/styles/{v2/theme → theme}/base/sizes.js +0 -0
- /package/styles/{v2/theme → theme}/base/typography.js +0 -0
- /package/styles/{v2/theme → theme}/base/zindices.js +0 -0
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import omit from 'lodash/omit';
|
|
2
|
-
import template from 'lodash/template';
|
|
3
|
-
import React, {Component} from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import LazyLoad from 'react-lazy-load';
|
|
7
|
-
import EnvironmentUtils from '@spothero/utils/environment';
|
|
8
|
-
import PulseLoader from '../../../PulseLoader/PulseLoader';
|
|
9
|
-
|
|
10
|
-
export default class Image extends Component {
|
|
11
|
-
static propTypes = {
|
|
12
|
-
/** Additional class(es) to add to the component. */
|
|
13
|
-
className: PropTypes.string,
|
|
14
|
-
/** Whether to show the loader before the image is fully loaded. */
|
|
15
|
-
showLoader: PropTypes.bool,
|
|
16
|
-
/** Whether to use lazy loading for this image. */
|
|
17
|
-
lazyLoad: PropTypes.bool,
|
|
18
|
-
/** The offset from the bottom of the screen at which point the image gets lazy loaded when the page is scrolled to. */
|
|
19
|
-
lazyLoadOffsetVertical: PropTypes.number,
|
|
20
|
-
/** The Cloudinary account that this image is stored under. */
|
|
21
|
-
cloudinaryCloudName: PropTypes.string,
|
|
22
|
-
/** The image ID that is stored in Cloudinary for this image. Will be used to replace the source path. */
|
|
23
|
-
cloudinaryImageId: PropTypes.string,
|
|
24
|
-
/** The template URL to use to create the source path from. Replaceable values are {{WIDTH}}, {{HEIGHT}}, and {{QUALITY}}. */
|
|
25
|
-
cloudinaryTemplate: PropTypes.string,
|
|
26
|
-
/** The width of the image. Required if using a Cloudinary ID and highly suggested otherwise to help place the loader properly. */
|
|
27
|
-
width: PropTypes.number,
|
|
28
|
-
/** The height of the image. Required if using a Cloudinary ID and highly suggested otherwise to help place the loader properly. */
|
|
29
|
-
height: PropTypes.number,
|
|
30
|
-
/** The quality setting if this image uses a Cloudinary source ID. */
|
|
31
|
-
quality: PropTypes.number,
|
|
32
|
-
/** Optional function to execute when the image is loaded. */
|
|
33
|
-
onLoad: PropTypes.func,
|
|
34
|
-
};
|
|
35
|
-
static defaultProps = {
|
|
36
|
-
showLoader: true,
|
|
37
|
-
lazyLoadOffsetVertical: 100,
|
|
38
|
-
quality: 50,
|
|
39
|
-
cloudinaryCloudName: 'spothero',
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
constructor(props) {
|
|
43
|
-
super(props);
|
|
44
|
-
|
|
45
|
-
const {cloudinaryImageId, cloudinaryTemplate} = props;
|
|
46
|
-
|
|
47
|
-
this._imageProps = omit(props, [
|
|
48
|
-
'className',
|
|
49
|
-
'showLoader',
|
|
50
|
-
'lazyLoad',
|
|
51
|
-
'lazyLoadOffsetVertical',
|
|
52
|
-
'cloudinaryCloudName',
|
|
53
|
-
'cloudinaryImageId',
|
|
54
|
-
'cloudinaryTemplate',
|
|
55
|
-
'quality',
|
|
56
|
-
'onLoad',
|
|
57
|
-
]);
|
|
58
|
-
|
|
59
|
-
this.state = {
|
|
60
|
-
isLoaded: false,
|
|
61
|
-
hasCloudinarySrc: !(cloudinaryImageId || cloudinaryTemplate),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
componentDidMount() {
|
|
66
|
-
const {
|
|
67
|
-
cloudinaryCloudName,
|
|
68
|
-
cloudinaryTemplate,
|
|
69
|
-
cloudinaryImageId,
|
|
70
|
-
width,
|
|
71
|
-
height,
|
|
72
|
-
quality,
|
|
73
|
-
} = this.props;
|
|
74
|
-
|
|
75
|
-
if (cloudinaryImageId || cloudinaryTemplate) {
|
|
76
|
-
// cloudinary image provided, create the source path
|
|
77
|
-
|
|
78
|
-
if (this.isCloudinaryImageAndInvalid()) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const tmpl = cloudinaryTemplate
|
|
83
|
-
? cloudinaryTemplate
|
|
84
|
-
: `https://res.cloudinary.com/${cloudinaryCloudName}/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,fl_progressive,dpr_${
|
|
85
|
-
EnvironmentUtils.isHighDensityDisplay() ? 2 : 1
|
|
86
|
-
},h_$h,q_$q,w_$w/${cloudinaryImageId}`;
|
|
87
|
-
|
|
88
|
-
this._imageProps.src = template(tmpl, {
|
|
89
|
-
interpolate: /{{([\s\S]+?)}}/g, // matches template vars in the format '{{ var }}' or '{{var}}'
|
|
90
|
-
})({
|
|
91
|
-
WIDTH: width,
|
|
92
|
-
HEIGHT: height,
|
|
93
|
-
QUALITY: quality,
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// eslint-disable-next-line react/no-did-mount-set-state
|
|
97
|
-
this.setState({
|
|
98
|
-
hasCloudinarySrc: true,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
_onLoaded = evt => {
|
|
104
|
-
const {onLoad} = this.props;
|
|
105
|
-
|
|
106
|
-
this.setState({
|
|
107
|
-
isLoaded: true,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
if (onLoad) {
|
|
111
|
-
onLoad(evt);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
isCloudinaryImageAndInvalid = () => {
|
|
116
|
-
const {
|
|
117
|
-
cloudinaryImageId,
|
|
118
|
-
cloudinaryTemplate,
|
|
119
|
-
width,
|
|
120
|
-
height,
|
|
121
|
-
} = this.props;
|
|
122
|
-
|
|
123
|
-
return (cloudinaryImageId || cloudinaryTemplate) && (!width || !height);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
_renderImage() {
|
|
127
|
-
const {className, width, height, showLoader} = this.props;
|
|
128
|
-
const {isLoaded} = this.state;
|
|
129
|
-
const classes = classNames(className, 'Image-container');
|
|
130
|
-
const imgClasses = classNames('Image', {
|
|
131
|
-
'Image-loaded': isLoaded,
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
return (
|
|
135
|
-
<div
|
|
136
|
-
className={classes}
|
|
137
|
-
style={{maxWidth: width, maxHeight: height}}
|
|
138
|
-
>
|
|
139
|
-
{showLoader && !isLoaded && (
|
|
140
|
-
<PulseLoader size={32} borderWidth={2} />
|
|
141
|
-
)}
|
|
142
|
-
<img
|
|
143
|
-
{...this._imageProps}
|
|
144
|
-
className={imgClasses}
|
|
145
|
-
onLoad={this._onLoaded}
|
|
146
|
-
/>
|
|
147
|
-
</div>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
render() {
|
|
152
|
-
const {lazyLoad, lazyLoadOffsetVertical} = this.props;
|
|
153
|
-
const {hasCloudinarySrc} = this.state;
|
|
154
|
-
|
|
155
|
-
// the source is set after component is mounted in the case of Cloudinary images otherwise there are mis-matching
|
|
156
|
-
// DPR attributes in the url since node will always set the DPR to 1 and high density displays will have it set to 2+.
|
|
157
|
-
if (!hasCloudinarySrc) {
|
|
158
|
-
return null;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (this.isCloudinaryImageAndInvalid()) {
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (lazyLoad) {
|
|
166
|
-
return (
|
|
167
|
-
<LazyLoad offsetVertical={lazyLoadOffsetVertical}>
|
|
168
|
-
{this._renderImage()}
|
|
169
|
-
</LazyLoad>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return this._renderImage();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
describe('<Image />', () => {
|
|
2
|
-
context('Display', () => {
|
|
3
|
-
context('Default', () => {
|
|
4
|
-
beforeEach(() => {
|
|
5
|
-
cy.visitStory('v1/Image/Display', 'Default', {
|
|
6
|
-
onBeforeLoad: contentWindow => {
|
|
7
|
-
contentWindow.onImageLoaded = evt => {
|
|
8
|
-
console.log('image loaded'); // eslint-disable-line no-console
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
cy.stub(contentWindow, 'onImageLoaded').as(
|
|
12
|
-
'imageLoaded'
|
|
13
|
-
);
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('Renders properly and passes props through', () => {
|
|
19
|
-
cy.get('.Image')
|
|
20
|
-
.should('have.class', 'Image-loaded')
|
|
21
|
-
.should('have.attr', 'alt', 'Placeholder image');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('Calls onLoad() properly', () => {
|
|
25
|
-
cy.get('@imageLoaded')
|
|
26
|
-
.should('be.called')
|
|
27
|
-
.get('.Image')
|
|
28
|
-
.should('have.class', 'Image-loaded');
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
context('Lazy Load', () => {
|
|
33
|
-
it('Lazy loads when the image comes into view', () => {
|
|
34
|
-
cy.visitStory('v1/Image/Display', 'LazyLoad', {
|
|
35
|
-
onBeforeLoad: contentWindow => {
|
|
36
|
-
contentWindow.onImageLoaded = evt => {
|
|
37
|
-
console.log('image loaded'); // eslint-disable-line no-console
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
cy.stub(contentWindow, 'onImageLoaded').as(
|
|
41
|
-
'imageLoaded'
|
|
42
|
-
);
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
.get('@imageLoaded')
|
|
46
|
-
.should('not.be.called')
|
|
47
|
-
.get('.Image')
|
|
48
|
-
.should('not.exist')
|
|
49
|
-
.get('.LazyLoad')
|
|
50
|
-
.should('not.have.class', 'is-visible')
|
|
51
|
-
.get('.LazyLoad')
|
|
52
|
-
.scrollIntoView()
|
|
53
|
-
.should('have.class', 'is-visible')
|
|
54
|
-
.get('.Image')
|
|
55
|
-
.should('exist')
|
|
56
|
-
.get('@imageLoaded')
|
|
57
|
-
.should('be.called');
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
context('Cloudinary', () => {
|
|
63
|
-
context('Source ID', () => {
|
|
64
|
-
it('Renders properly using a Cloudinary image source ID', () => {
|
|
65
|
-
cy.visitStory('v1/Image/Cloudinary', 'SourceId')
|
|
66
|
-
.get('.Image-container')
|
|
67
|
-
.should('have.class', 'Image-hertz')
|
|
68
|
-
.get('.Image')
|
|
69
|
-
.should('have.class', 'Image-loaded')
|
|
70
|
-
.should('have.attr', 'alt', 'Cloudinary source ID')
|
|
71
|
-
.should('have.attr', 'width', '186')
|
|
72
|
-
.should('have.attr', 'height', '76')
|
|
73
|
-
.should('have.attr', 'src')
|
|
74
|
-
.then(src => {
|
|
75
|
-
expect(src).to.contain('res.cloudinary.com/spothero/');
|
|
76
|
-
expect(src).to.contain('c_fill');
|
|
77
|
-
expect(src).to.contain('f_auto');
|
|
78
|
-
expect(src).to.contain('fl_progressive');
|
|
79
|
-
expect(src).to.contain('q_50');
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
context('Template', () => {
|
|
85
|
-
it('Renders properly using a provided template', () => {
|
|
86
|
-
cy.visitStory('v1/Image/Cloudinary', 'Template')
|
|
87
|
-
.get('.Image')
|
|
88
|
-
.should('have.class', 'Image-loaded')
|
|
89
|
-
.should('have.attr', 'alt', 'Cloudinary template')
|
|
90
|
-
.should('have.attr', 'width', '132')
|
|
91
|
-
.should('have.attr', 'height', '111')
|
|
92
|
-
.should('have.attr', 'src')
|
|
93
|
-
.then(src => {
|
|
94
|
-
expect(src).to.contain('res.cloudinary.com/spothero/');
|
|
95
|
-
expect(src).to.contain('c_fill');
|
|
96
|
-
expect(src).to.contain('f_auto');
|
|
97
|
-
expect(src).to.contain('w_132');
|
|
98
|
-
expect(src).to.contain('h_111');
|
|
99
|
-
expect(src).to.contain('q_100');
|
|
100
|
-
expect(src).to.contain('html-emails/google');
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
context('Dimensions Error', () => {
|
|
106
|
-
it('Does not render if width or height props are not passed', () => {
|
|
107
|
-
cy.visitStory('v1/Image/Cloudinary', 'DimensionsError')
|
|
108
|
-
.get('.Image')
|
|
109
|
-
.should('not.exist');
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
.Image-container {
|
|
2
|
-
position: relative;
|
|
3
|
-
display: inline-block;
|
|
4
|
-
width: 100%;
|
|
5
|
-
height: 100%;
|
|
6
|
-
vertical-align: middle;
|
|
7
|
-
|
|
8
|
-
.PulseLoader {
|
|
9
|
-
position: absolute;
|
|
10
|
-
top: 0;
|
|
11
|
-
left: 0;
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 100%;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.PulseLoader-pulse {
|
|
17
|
-
@include center;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.Image {
|
|
22
|
-
width: 100%;
|
|
23
|
-
height: 100%;
|
|
24
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Image from '../Image';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
component: Image,
|
|
6
|
-
title: 'v1/Image/Cloudinary',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const SourceId = () => {
|
|
10
|
-
return (
|
|
11
|
-
<Image
|
|
12
|
-
className="Image-hertz"
|
|
13
|
-
cloudinaryImageId="html-emails/partner-hertz"
|
|
14
|
-
width={186}
|
|
15
|
-
height={76}
|
|
16
|
-
alt="Cloudinary source ID"
|
|
17
|
-
onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
|
|
18
|
-
/>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Template = () => {
|
|
23
|
-
return (
|
|
24
|
-
<Image
|
|
25
|
-
cloudinaryTemplate="https://res.cloudinary.com/spothero/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,h_$h,q_$q,w_$w/html-emails/google"
|
|
26
|
-
width={132}
|
|
27
|
-
height={111}
|
|
28
|
-
quality={100}
|
|
29
|
-
alt="Cloudinary template"
|
|
30
|
-
onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export const DimensionsError = () => {
|
|
36
|
-
return (
|
|
37
|
-
<Image cloudinaryTemplate="https://res.cloudinary.com/spothero/image/upload/$w_{{WIDTH}},$h_{{HEIGHT}},$q_{{QUALITY}}/c_fill,f_auto,h_$h,q_$q,w_$w/html-emails/google" />
|
|
38
|
-
);
|
|
39
|
-
};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Image from '../Image';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
component: Image,
|
|
6
|
-
title: 'v1/Image/Display',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const Default = () => {
|
|
10
|
-
return (
|
|
11
|
-
<Image
|
|
12
|
-
src="http://placehold.it/350x200"
|
|
13
|
-
width={350}
|
|
14
|
-
height={200}
|
|
15
|
-
alt="Placeholder image"
|
|
16
|
-
onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const LazyLoad = () => {
|
|
22
|
-
return (
|
|
23
|
-
<>
|
|
24
|
-
<p>Scroll down to see lazy loaded image in action...</p>
|
|
25
|
-
<br />
|
|
26
|
-
<br />
|
|
27
|
-
<br />
|
|
28
|
-
<br />
|
|
29
|
-
<br />
|
|
30
|
-
<br />
|
|
31
|
-
<br />
|
|
32
|
-
<br />
|
|
33
|
-
<br />
|
|
34
|
-
<br />
|
|
35
|
-
<br />
|
|
36
|
-
<br />
|
|
37
|
-
<br />
|
|
38
|
-
<br />
|
|
39
|
-
<br />
|
|
40
|
-
<br />
|
|
41
|
-
<br />
|
|
42
|
-
<br />
|
|
43
|
-
<br />
|
|
44
|
-
<br />
|
|
45
|
-
<br />
|
|
46
|
-
<br />
|
|
47
|
-
<br />
|
|
48
|
-
<br />
|
|
49
|
-
<br />
|
|
50
|
-
<br />
|
|
51
|
-
<br />
|
|
52
|
-
<br />
|
|
53
|
-
<br />
|
|
54
|
-
<br />
|
|
55
|
-
<br />
|
|
56
|
-
<br />
|
|
57
|
-
<br />
|
|
58
|
-
<br />
|
|
59
|
-
<br />
|
|
60
|
-
<br />
|
|
61
|
-
<br />
|
|
62
|
-
<br />
|
|
63
|
-
<br />
|
|
64
|
-
<br />
|
|
65
|
-
<br />
|
|
66
|
-
<br />
|
|
67
|
-
<br />
|
|
68
|
-
<br />
|
|
69
|
-
<br />
|
|
70
|
-
<br />
|
|
71
|
-
<br />
|
|
72
|
-
<br />
|
|
73
|
-
<br />
|
|
74
|
-
<br />
|
|
75
|
-
<br />
|
|
76
|
-
<br />
|
|
77
|
-
<br />
|
|
78
|
-
<br />
|
|
79
|
-
<br />
|
|
80
|
-
<br />
|
|
81
|
-
<br />
|
|
82
|
-
<br />
|
|
83
|
-
<br />
|
|
84
|
-
<br />
|
|
85
|
-
<Image
|
|
86
|
-
src="http://placehold.it/350x200"
|
|
87
|
-
lazyLoad
|
|
88
|
-
onLoad={window.onImageLoaded} // eslint-disable-line react/jsx-handler-names
|
|
89
|
-
/>
|
|
90
|
-
</>
|
|
91
|
-
);
|
|
92
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
import deprecate from 'v1/utils/deprecate';
|
|
6
|
-
|
|
7
|
-
deprecate({
|
|
8
|
-
name: 'Loader',
|
|
9
|
-
newName: 'Loader',
|
|
10
|
-
changes: [
|
|
11
|
-
'---- Changes in v2 component ----',
|
|
12
|
-
'`borderWidth` is now `thickness`',
|
|
13
|
-
'`additionalMarkup` is no longer supported within this component',
|
|
14
|
-
'`className` is no longer explicitly supported, but a custom class could still be passed in if needed, but with the move to ChakraUI custom classes are generally not needed',
|
|
15
|
-
'---- Additional Information ----',
|
|
16
|
-
'new props are documented at: https://chakra-ui.com/docs/feedback/circular-progress',
|
|
17
|
-
],
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const Loader = ({className, size, borderWidth, additionalMarkup, ...attrs}) => {
|
|
21
|
-
const classes = classNames('Loader', className);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<div className={classes} {...attrs}>
|
|
25
|
-
<div
|
|
26
|
-
className="Loader-spinner"
|
|
27
|
-
style={{
|
|
28
|
-
width: size,
|
|
29
|
-
height: size,
|
|
30
|
-
borderWidth,
|
|
31
|
-
}}
|
|
32
|
-
/>
|
|
33
|
-
{additionalMarkup}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
Loader.propTypes = {
|
|
39
|
-
/** Additional class(es) to add to the component. */
|
|
40
|
-
className: PropTypes.string,
|
|
41
|
-
/** The diameter of the circle spinner. */
|
|
42
|
-
size: PropTypes.number,
|
|
43
|
-
/** The width of the border of the circle spinner. */
|
|
44
|
-
borderWidth: PropTypes.number,
|
|
45
|
-
/** Additional markup to place below the loading spinner. */
|
|
46
|
-
additionalMarkup: PropTypes.node,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
Loader.defaultProps = {
|
|
50
|
-
size: 80,
|
|
51
|
-
borderWidth: 4,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default Loader;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
describe('<Loader />', () => {
|
|
2
|
-
context('Display', () => {
|
|
3
|
-
context('Default', () => {
|
|
4
|
-
it('Has default size and border-width', () => {
|
|
5
|
-
cy.visitStory('v1/Loader/Display', 'Default')
|
|
6
|
-
.get('.Loader-spinner')
|
|
7
|
-
.should('have.css', 'width', '80px')
|
|
8
|
-
.and('have.css', 'height', '80px')
|
|
9
|
-
.and('have.css', 'border-width', '4px');
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
context('Size', () => {
|
|
14
|
-
it('Has height and width determined by size prop, and default border-width', () => {
|
|
15
|
-
cy.visitStory('v1/Loader/Display', 'Size')
|
|
16
|
-
.get('.Loader-spinner')
|
|
17
|
-
.should('have.css', 'width', '300px')
|
|
18
|
-
.and('have.css', 'height', '300px')
|
|
19
|
-
.and('have.css', 'border-width', '4px');
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
context('Border Width', () => {
|
|
24
|
-
it('Has border-width determined by border-width prop, and default height/width', () => {
|
|
25
|
-
cy.visitStory('v1/Loader/Display', 'BorderWidth')
|
|
26
|
-
.get('.Loader-spinner')
|
|
27
|
-
.should('have.css', 'border-width', '25px')
|
|
28
|
-
.and('have.css', 'width', '80px')
|
|
29
|
-
.and('have.css', 'height', '80px');
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
context('Additional Markup', () => {
|
|
34
|
-
it('Displays additional markup (nodes) that was passed in', () => {
|
|
35
|
-
cy.visitStory('v1/Loader/Display', 'AdditionalMarkup')
|
|
36
|
-
.get('.Loader')
|
|
37
|
-
.contains('Here is some additional markup')
|
|
38
|
-
.get('.Loader')
|
|
39
|
-
.find('h1')
|
|
40
|
-
.find('span');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('Displays additional markup (text) that was passed in', () => {
|
|
44
|
-
cy.visitStory('v1/Loader/Display', 'AdditionalMarkupText')
|
|
45
|
-
.get('.Loader')
|
|
46
|
-
.contains('Just add text!');
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
context('Custom Classes', () => {
|
|
51
|
-
it('Applies custom classes to loader', () => {
|
|
52
|
-
cy.visitStory('v1/Loader/Display', 'CustomClass')
|
|
53
|
-
.get('.Loader')
|
|
54
|
-
.should('have.class', 'custom-class1')
|
|
55
|
-
.and('have.class', 'custom-class2');
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
context('Custom Props', () => {
|
|
60
|
-
it('Applies custom props to loader', () => {
|
|
61
|
-
cy.visitStory('v1/Loader/Display', 'CustomProps')
|
|
62
|
-
.get('.Loader')
|
|
63
|
-
.should('have.attr', 'role', 'status');
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
@keyframes load8 {
|
|
2
|
-
0% {
|
|
3
|
-
transform: rotate(0deg);
|
|
4
|
-
}
|
|
5
|
-
100% {
|
|
6
|
-
transform: rotate(360deg);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.Loader-spinner {
|
|
11
|
-
border-top: 4px solid $color-dashboard;
|
|
12
|
-
border-right: 4px solid $color-dashboard;
|
|
13
|
-
border-bottom: 4px solid $color-go;
|
|
14
|
-
border-left: 4px solid $color-go;
|
|
15
|
-
border-radius: 50%;
|
|
16
|
-
transform: translateZ(0);
|
|
17
|
-
animation: load8 1.1s infinite linear;
|
|
18
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Loader from '../Loader';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
component: Loader,
|
|
6
|
-
title: 'v1/Loader/Display',
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const Default = () => {
|
|
10
|
-
return <Loader />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const AdditionalMarkup = () => {
|
|
14
|
-
return (
|
|
15
|
-
<Loader
|
|
16
|
-
additionalMarkup={
|
|
17
|
-
<h1>
|
|
18
|
-
Here is some <span>additional markup</span>
|
|
19
|
-
</h1>
|
|
20
|
-
}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const AdditionalMarkupText = () => {
|
|
26
|
-
return <Loader additionalMarkup="Just add text!" />;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const BorderWidth = () => {
|
|
30
|
-
return <Loader borderWidth={25} />;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const CustomClass = () => {
|
|
34
|
-
return (
|
|
35
|
-
<Loader
|
|
36
|
-
className="custom-class1 custom-class2"
|
|
37
|
-
size={30}
|
|
38
|
-
borderWidth={5}
|
|
39
|
-
additionalMarkup="I have custom classes"
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const Size = () => {
|
|
45
|
-
return <Loader size={300} />;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const CustomProps = () => {
|
|
49
|
-
return (
|
|
50
|
-
<Loader
|
|
51
|
-
role="status"
|
|
52
|
-
additionalMarkup="I support passing in custom attributes"
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
};
|