@spothero/ui 15.10.9 → 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}/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/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/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-content.js +0 -0
- /package/styles/{v2/components → components}/Popover/styles/popover-header.js +0 -0
- /package/styles/{v2/components → components}/Popover/styles/popper.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,315 +0,0 @@
|
|
|
1
|
-
import isNumber from 'lodash/isNumber';
|
|
2
|
-
import isString from 'lodash/isString';
|
|
3
|
-
import React, {PureComponent} from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import IconChevronLeft from '@spothero/icons/chevron-left';
|
|
7
|
-
import IconTimes from '@spothero/icons/times';
|
|
8
|
-
import DOMUtils from '@spothero/utils/dom';
|
|
9
|
-
import Button from 'v1/components/Button/Button';
|
|
10
|
-
import Portal from '../../../Portal/Portal';
|
|
11
|
-
|
|
12
|
-
export default class Modal extends PureComponent {
|
|
13
|
-
static propTypes = {
|
|
14
|
-
/** Additional class(es) to add to the component. */
|
|
15
|
-
className: PropTypes.string,
|
|
16
|
-
/** Whether to render the modal to the body tag (otherwise renders to current position in DOM). */
|
|
17
|
-
renderInBody: PropTypes.bool,
|
|
18
|
-
/** Whether to use the background shim. */
|
|
19
|
-
useShim: PropTypes.bool,
|
|
20
|
-
/** Whether to show the close button. */
|
|
21
|
-
showClose: PropTypes.bool,
|
|
22
|
-
/** Whether to animate the Modal showing. */
|
|
23
|
-
animateOnShow: PropTypes.bool,
|
|
24
|
-
/** Whether to close the Modal when the shim is clicked. */
|
|
25
|
-
closeOnShimClick: PropTypes.bool,
|
|
26
|
-
/** The title of the modal. If one isn't provided then the title won't render. */
|
|
27
|
-
title: PropTypes.node,
|
|
28
|
-
/** The width of the modal. (size string, pixel value [integer] or percentage ["100%"]) */
|
|
29
|
-
width: PropTypes.oneOfType([
|
|
30
|
-
PropTypes.oneOf([
|
|
31
|
-
'extra-slim',
|
|
32
|
-
'slim',
|
|
33
|
-
'normal',
|
|
34
|
-
'wide',
|
|
35
|
-
'extra-wide',
|
|
36
|
-
]),
|
|
37
|
-
PropTypes.number,
|
|
38
|
-
PropTypes.string,
|
|
39
|
-
]),
|
|
40
|
-
/** A function to execute after the modal has been shown. */
|
|
41
|
-
onShown: PropTypes.func,
|
|
42
|
-
/**
|
|
43
|
-
* A function to execute after the modal has been hidden. Use this to manage state in a parent component to remove the modal from the DOM (see examples).
|
|
44
|
-
*
|
|
45
|
-
* @param {*} args - Any arguments that were passed to `hide()` to retrieve in the callback.
|
|
46
|
-
*/
|
|
47
|
-
onHidden: PropTypes.func,
|
|
48
|
-
/** A function to execute when the close button or the shim is clicked. */
|
|
49
|
-
onCloseClick: PropTypes.func,
|
|
50
|
-
/** Markup to pass as children to the modal. Pass either one element or an array of elements. */
|
|
51
|
-
children: PropTypes.oneOfType([
|
|
52
|
-
PropTypes.element,
|
|
53
|
-
PropTypes.arrayOf(PropTypes.element),
|
|
54
|
-
PropTypes.node,
|
|
55
|
-
]).isRequired,
|
|
56
|
-
/** Indicates the current index of the content being displayed. Manage this from the ModalContent (see examples) and in the parent component's state. */
|
|
57
|
-
activeContentIndex: PropTypes.number,
|
|
58
|
-
/** A function to execute that helps manage state in a parent component to determine which ModalContent to show. Required when multiple ModalContents are present in the parent. */
|
|
59
|
-
onRemoveIndex: PropTypes.func,
|
|
60
|
-
/** Optional Redux store to pass into the rendered Modal. Required if the Modal uses any data or actions from a Redux store. */
|
|
61
|
-
store: PropTypes.object,
|
|
62
|
-
/** A function to execute at the end of the constructor before the Modal is rendered. */
|
|
63
|
-
onBeforeFirstRender: PropTypes.func,
|
|
64
|
-
/** Whether to expand the Modal to full-width on mobile */
|
|
65
|
-
fullScreenOnMobile: PropTypes.bool,
|
|
66
|
-
/** Optional data-testid to aid with RTL tests */
|
|
67
|
-
'data-testid': PropTypes.string,
|
|
68
|
-
};
|
|
69
|
-
static defaultProps = {
|
|
70
|
-
renderInBody: true,
|
|
71
|
-
useShim: true,
|
|
72
|
-
showClose: true,
|
|
73
|
-
width: 'normal',
|
|
74
|
-
activeContentIndex: 0,
|
|
75
|
-
closeOnShimClick: true,
|
|
76
|
-
animateOnShow: true,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
constructor(props) {
|
|
80
|
-
super(props);
|
|
81
|
-
|
|
82
|
-
const {width, title, onBeforeFirstRender} = this.props;
|
|
83
|
-
|
|
84
|
-
this._isDynamicWidth = isNumber(width) || width.indexOf('%') > 0;
|
|
85
|
-
this._isAnimating = false;
|
|
86
|
-
this._isTitleString = title ? isString(title) : false;
|
|
87
|
-
this._childHistory = [];
|
|
88
|
-
|
|
89
|
-
if (onBeforeFirstRender) {
|
|
90
|
-
onBeforeFirstRender();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
componentDidMount() {
|
|
95
|
-
const {width} = this.props;
|
|
96
|
-
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
// if ModalContent throws an error then the container will not be defined
|
|
99
|
-
if (!this._container) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (this._isDynamicWidth) {
|
|
104
|
-
const newWidth = isNumber(width)
|
|
105
|
-
? `${width}px` // numerical width, set accordingly
|
|
106
|
-
: width; // percentage width, retain and set
|
|
107
|
-
|
|
108
|
-
DOMUtils.addClass(this._container, 'Modal-container-custom');
|
|
109
|
-
|
|
110
|
-
this._container.style.width = newWidth;
|
|
111
|
-
}
|
|
112
|
-
this._show();
|
|
113
|
-
}, 0);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
componentWillUnmount() {
|
|
117
|
-
DOMUtils.removeClass('html', 'Modal-open');
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
_onCloseClick = evt => {
|
|
121
|
-
if (this._isAnimating) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const {onCloseClick} = this.props;
|
|
126
|
-
|
|
127
|
-
this.hide();
|
|
128
|
-
|
|
129
|
-
if (onCloseClick) {
|
|
130
|
-
onCloseClick();
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
_onShimClick = evt => {
|
|
135
|
-
const {useShim, closeOnShimClick} = this.props;
|
|
136
|
-
|
|
137
|
-
if (
|
|
138
|
-
useShim &&
|
|
139
|
-
closeOnShimClick &&
|
|
140
|
-
DOMUtils.hasClass(evt.target, 'Modal-wrapper')
|
|
141
|
-
) {
|
|
142
|
-
this._onCloseClick();
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
_onBackClick = evt => {
|
|
147
|
-
this.props.onRemoveIndex();
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
_show() {
|
|
151
|
-
const {useShim, renderInBody, onShown, animateOnShow} = this.props;
|
|
152
|
-
const node = useShim ? this._modal : this._container;
|
|
153
|
-
const showClass = useShim ? 'Modal-showing' : 'Modal-container-showing';
|
|
154
|
-
|
|
155
|
-
DOMUtils.addClass(node, showClass);
|
|
156
|
-
|
|
157
|
-
if (renderInBody) {
|
|
158
|
-
DOMUtils.addClass('html', 'Modal-open');
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (!useShim) {
|
|
162
|
-
DOMUtils.addClass(this._modal, 'Modal-no-shim');
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if (animateOnShow) {
|
|
166
|
-
this._isAnimating = true;
|
|
167
|
-
|
|
168
|
-
window.transitionEnd?.(node).bind(() => {
|
|
169
|
-
window.transitionEnd(node).unbind();
|
|
170
|
-
|
|
171
|
-
if (onShown) {
|
|
172
|
-
onShown();
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
this._isAnimating = false;
|
|
176
|
-
});
|
|
177
|
-
} else {
|
|
178
|
-
if (onShown) {
|
|
179
|
-
onShown();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
_renderModal() {
|
|
185
|
-
const {
|
|
186
|
-
className,
|
|
187
|
-
renderInBody,
|
|
188
|
-
useShim,
|
|
189
|
-
title,
|
|
190
|
-
showClose,
|
|
191
|
-
children,
|
|
192
|
-
width,
|
|
193
|
-
animateOnShow,
|
|
194
|
-
activeContentIndex,
|
|
195
|
-
fullScreenOnMobile,
|
|
196
|
-
'data-testid': dataTestId,
|
|
197
|
-
} = this.props;
|
|
198
|
-
const classes = classNames(
|
|
199
|
-
'Modal',
|
|
200
|
-
{'Modal-inline': !renderInBody},
|
|
201
|
-
{'Modal-animated': animateOnShow},
|
|
202
|
-
{'Modal-showing': useShim && !animateOnShow},
|
|
203
|
-
className
|
|
204
|
-
);
|
|
205
|
-
const containerClasses = classNames(
|
|
206
|
-
'Modal-container',
|
|
207
|
-
{[`Modal-container-${width}`]: !this._isDynamicWidth},
|
|
208
|
-
{'Modal-container-animated': animateOnShow},
|
|
209
|
-
{'Modal-container-showing': !useShim && !animateOnShow}
|
|
210
|
-
);
|
|
211
|
-
const wrapperClasses = classNames('Modal-wrapper', {
|
|
212
|
-
'Modal-wrapper-full': fullScreenOnMobile,
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
return (
|
|
216
|
-
<div
|
|
217
|
-
ref={node => {
|
|
218
|
-
this._modal = node;
|
|
219
|
-
}}
|
|
220
|
-
className={classes}
|
|
221
|
-
data-testid={dataTestId}
|
|
222
|
-
>
|
|
223
|
-
{useShim && <div className="Modal-shim" />}
|
|
224
|
-
<div className={wrapperClasses} onClick={this._onShimClick}>
|
|
225
|
-
<div
|
|
226
|
-
ref={node => {
|
|
227
|
-
this._container = node;
|
|
228
|
-
}}
|
|
229
|
-
className={containerClasses}
|
|
230
|
-
>
|
|
231
|
-
{title && (
|
|
232
|
-
<div className="Modal-title">
|
|
233
|
-
{this._isTitleString ? <h1>{title}</h1> : title}
|
|
234
|
-
</div>
|
|
235
|
-
)}
|
|
236
|
-
<div className="Modal-ctas">
|
|
237
|
-
{showClose && (
|
|
238
|
-
<Button
|
|
239
|
-
className="Modal-close"
|
|
240
|
-
aria-label="Close Modal"
|
|
241
|
-
onClick={this._onCloseClick}
|
|
242
|
-
>
|
|
243
|
-
<IconTimes />
|
|
244
|
-
</Button>
|
|
245
|
-
)}
|
|
246
|
-
{activeContentIndex > 0 && (
|
|
247
|
-
<Button
|
|
248
|
-
className="Modal-back"
|
|
249
|
-
aria-label="Go Back"
|
|
250
|
-
onClick={this._onBackClick}
|
|
251
|
-
>
|
|
252
|
-
<IconChevronLeft />
|
|
253
|
-
</Button>
|
|
254
|
-
)}
|
|
255
|
-
</div>
|
|
256
|
-
{children}
|
|
257
|
-
</div>
|
|
258
|
-
</div>
|
|
259
|
-
</div>
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* Hides the Modal programmatically.
|
|
265
|
-
*
|
|
266
|
-
* @public
|
|
267
|
-
* @param {*} args - The arguments to pass to the onHidden callback in cases where you may need access to something not available in Modal itself.
|
|
268
|
-
* @returns {void}
|
|
269
|
-
*/
|
|
270
|
-
hide(...args) {
|
|
271
|
-
this._isAnimating = true;
|
|
272
|
-
|
|
273
|
-
const {useShim, renderInBody, onHidden, animateOnShow} = this.props;
|
|
274
|
-
const node = useShim ? this._modal : this._container;
|
|
275
|
-
const showClass = useShim ? 'Modal-showing' : 'Modal-container-showing';
|
|
276
|
-
|
|
277
|
-
if (!animateOnShow) {
|
|
278
|
-
DOMUtils.addClass(node, showClass.replace('showing', 'animated'));
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (!useShim) {
|
|
282
|
-
DOMUtils.removeClass(this._modal, 'Modal-no-shim');
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
DOMUtils.removeClass(node, showClass);
|
|
286
|
-
|
|
287
|
-
if (renderInBody) {
|
|
288
|
-
DOMUtils.removeClass('html', 'Modal-open');
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
window.transitionEnd?.(node).bind(() => {
|
|
292
|
-
window.transitionEnd(node).unbind();
|
|
293
|
-
|
|
294
|
-
this._isAnimating = false;
|
|
295
|
-
|
|
296
|
-
if (!animateOnShow) {
|
|
297
|
-
DOMUtils.removeClass(node, `${showClass}-animated`);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (onHidden) {
|
|
301
|
-
onHidden(...args);
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
render() {
|
|
307
|
-
const {renderInBody, store} = this.props;
|
|
308
|
-
|
|
309
|
-
if (renderInBody) {
|
|
310
|
-
return <Portal store={store}>{this._renderModal()}</Portal>;
|
|
311
|
-
} else {
|
|
312
|
-
return this._renderModal();
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
// THIS TEST HAS A TENDENCY TO FLAKE
|
|
2
|
-
|
|
3
|
-
const animationTimeout = 300;
|
|
4
|
-
|
|
5
|
-
// Do not run flaky tests.
|
|
6
|
-
describe.skip('<Modal />', () => {
|
|
7
|
-
context('Display', () => {
|
|
8
|
-
context('Default', () => {
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
cy.visitStory('v1/Modal/Display', 'Default', {
|
|
11
|
-
onBeforeLoad: contentWindow => {
|
|
12
|
-
contentWindow.onModalShown = evt => {
|
|
13
|
-
console.log('modal shown'); // eslint-disable-line no-console
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
contentWindow.onCloseClick = evt => {
|
|
17
|
-
console.log('close clicked'); // eslint-disable-line no-console
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
cy.stub(contentWindow, 'onModalShown').as(
|
|
21
|
-
'onModalShown'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
cy.stub(contentWindow, 'onCloseClick').as(
|
|
25
|
-
'onCloseClick'
|
|
26
|
-
);
|
|
27
|
-
},
|
|
28
|
-
})
|
|
29
|
-
.get('.Button')
|
|
30
|
-
.click()
|
|
31
|
-
.wait(animationTimeout);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('Renders properly', () => {
|
|
35
|
-
cy.get('@onModalShown')
|
|
36
|
-
.should('be.called')
|
|
37
|
-
.get('.Modal')
|
|
38
|
-
.should('have.class', 'Modal-showing')
|
|
39
|
-
// check to make sure the parent (2 elements up) is the body
|
|
40
|
-
.parent()
|
|
41
|
-
.parent()
|
|
42
|
-
.then($el => {
|
|
43
|
-
expect($el.prop('tagName').toLowerCase()).to.eq('body');
|
|
44
|
-
})
|
|
45
|
-
// confirm other default elements exist
|
|
46
|
-
.get('.Modal-title')
|
|
47
|
-
.get('.Modal-content')
|
|
48
|
-
.get('.Modal-close')
|
|
49
|
-
.get('html')
|
|
50
|
-
.should('have.class', 'Modal-open');
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('Closes when close is clicked', () => {
|
|
54
|
-
cy.get('.Modal-close')
|
|
55
|
-
.click()
|
|
56
|
-
.get('@onCloseClick')
|
|
57
|
-
.should('be.called')
|
|
58
|
-
.wait(animationTimeout)
|
|
59
|
-
.get('.Modal')
|
|
60
|
-
.should('not.exist');
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('Closes when shim is clicked', () => {
|
|
64
|
-
cy.get('.Modal-wrapper')
|
|
65
|
-
.click('topLeft')
|
|
66
|
-
.get('@onCloseClick')
|
|
67
|
-
.should('be.called')
|
|
68
|
-
.wait(animationTimeout)
|
|
69
|
-
.get('.Modal')
|
|
70
|
-
.should('not.exist');
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
context('Inside Element', () => {
|
|
75
|
-
it('Renders inside of an element and not directly in the body', () => {
|
|
76
|
-
cy.visitStory('v1/Modal/Display', 'InsideElement')
|
|
77
|
-
.get('.Button')
|
|
78
|
-
.click()
|
|
79
|
-
.wait(animationTimeout)
|
|
80
|
-
.get('.Modal')
|
|
81
|
-
.parent()
|
|
82
|
-
.should('have.class', 'ModalInElement-container');
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
context('No Close', () => {
|
|
87
|
-
it(`Does not render the close button`, () => {
|
|
88
|
-
cy.visitStory('v1/Modal/Display', 'NoCloseButton')
|
|
89
|
-
.get('.Button')
|
|
90
|
-
.click()
|
|
91
|
-
.wait(animationTimeout)
|
|
92
|
-
.get('.Modal-close')
|
|
93
|
-
.should('not.exist');
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
context('No Title', () => {
|
|
98
|
-
it(`Does not render the title if one isn't provided`, () => {
|
|
99
|
-
cy.visitStory('v1/Modal/Display', 'NoTitle')
|
|
100
|
-
.get('.Button')
|
|
101
|
-
.click()
|
|
102
|
-
.wait(animationTimeout)
|
|
103
|
-
.get('.Modal-title')
|
|
104
|
-
.should('not.exist');
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
context('No Shim', () => {
|
|
109
|
-
it(`Does not render the shim behind the modal`, () => {
|
|
110
|
-
cy.visitStory('v1/Modal/Display', 'NoShim')
|
|
111
|
-
.get('.Button')
|
|
112
|
-
.click()
|
|
113
|
-
.wait(animationTimeout)
|
|
114
|
-
.get('.Modal-shim')
|
|
115
|
-
.should('not.exist')
|
|
116
|
-
// make sure close button still has pointer events and is clickable
|
|
117
|
-
.get('.Modal-close')
|
|
118
|
-
.click()
|
|
119
|
-
.wait(animationTimeout)
|
|
120
|
-
.get('.Modal')
|
|
121
|
-
.should('not.exist');
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
context('Redux', () => {
|
|
126
|
-
it('Passes values through from a Redux store properly', () => {
|
|
127
|
-
cy.visitStory('v1/Modal/Display', 'WithRedux')
|
|
128
|
-
.get('.Button')
|
|
129
|
-
.click()
|
|
130
|
-
.wait(animationTimeout)
|
|
131
|
-
.get('.Modal-content')
|
|
132
|
-
.contains('Redux items here!');
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
context('Mobile Fullscreen', () => {
|
|
137
|
-
it('Renders fullscreen', () => {
|
|
138
|
-
cy.visitStory('v1/Modal/Display', 'FullScreenOnMobile')
|
|
139
|
-
.viewport('iphone-6')
|
|
140
|
-
.wait(animationTimeout)
|
|
141
|
-
.get('.Button')
|
|
142
|
-
.click()
|
|
143
|
-
.get('.Modal-wrapper')
|
|
144
|
-
.should('have.class', 'Modal-wrapper-full');
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
context('Width', () => {
|
|
150
|
-
context('Predefined Size', () => {
|
|
151
|
-
it('Renders with the correct container size class', () => {
|
|
152
|
-
cy.visitStory('v1/Modal/Width', 'SizeWidth')
|
|
153
|
-
.get('.Button')
|
|
154
|
-
.click()
|
|
155
|
-
.wait(animationTimeout)
|
|
156
|
-
.get('.Modal-container')
|
|
157
|
-
.should('have.class', 'Modal-container-extra-wide');
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
context('Custom Pixels', () => {
|
|
162
|
-
it('Renders with the correct container size style', () => {
|
|
163
|
-
cy.visitStory('v1/Modal/Width', 'PixelWidth')
|
|
164
|
-
.get('.Button')
|
|
165
|
-
.click()
|
|
166
|
-
.wait(animationTimeout)
|
|
167
|
-
.get('.Modal-container')
|
|
168
|
-
.should('have.class', 'Modal-container-custom')
|
|
169
|
-
.and('have.attr', 'style', 'width: 300px;');
|
|
170
|
-
});
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
context('Percentage', () => {
|
|
174
|
-
it('Renders with the correct container size as a percentage', () => {
|
|
175
|
-
cy.visitStory('v1/Modal/Width', 'PercentageWidth')
|
|
176
|
-
.get('.Button')
|
|
177
|
-
.click()
|
|
178
|
-
.wait(animationTimeout)
|
|
179
|
-
.get('.Modal-container')
|
|
180
|
-
.should('have.class', 'Modal-container-custom')
|
|
181
|
-
.and('have.attr', 'style', 'width: 75%;');
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
context('Content', () => {
|
|
187
|
-
context('No Padding', () => {
|
|
188
|
-
it('Renders the content with no padding applied', () => {
|
|
189
|
-
cy.visitStory('v1/Modal/Content', 'NoContentPadding')
|
|
190
|
-
.get('.Button')
|
|
191
|
-
.click()
|
|
192
|
-
.wait(animationTimeout)
|
|
193
|
-
.get('.Modal-content')
|
|
194
|
-
.should('have.class', 'Modal-content-flush');
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
context('Maximum Height', () => {
|
|
199
|
-
it('Renders the content with a maximum height', () => {
|
|
200
|
-
cy.visitStory('v1/Modal/Content', 'MaxHeight')
|
|
201
|
-
.get('.Button')
|
|
202
|
-
.click()
|
|
203
|
-
.wait(animationTimeout)
|
|
204
|
-
.get('.Modal-content')
|
|
205
|
-
.should('have.attr', 'style', 'max-height: 400px;');
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
context('Custom Height', () => {
|
|
210
|
-
it('Renders the content with a custom height', () => {
|
|
211
|
-
cy.visitStory('v1/Modal/Content', 'CustomHeight')
|
|
212
|
-
.get('.Button')
|
|
213
|
-
.click()
|
|
214
|
-
.wait(animationTimeout)
|
|
215
|
-
.get('.Modal-content')
|
|
216
|
-
.should('have.class', 'Modal-content-with-height')
|
|
217
|
-
.and('have.attr', 'style', 'max-height: 244px;'); // see component for proper calculation method for this
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
context('Html Content', () => {
|
|
222
|
-
it('Renders an HTML block in the content area', () => {
|
|
223
|
-
cy.visitStory('v1/Modal/Content', 'HtmlContent')
|
|
224
|
-
.get('.Button')
|
|
225
|
-
.click()
|
|
226
|
-
.wait(animationTimeout)
|
|
227
|
-
.get('.Modal-content-wrapper div')
|
|
228
|
-
.contains('This is some HTML modal content.');
|
|
229
|
-
});
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
context('Html Content Error', () => {
|
|
233
|
-
it('Does not render if both the html prop and children are present', async () => {
|
|
234
|
-
await cy
|
|
235
|
-
.visitStory('v1/Modal/Content', 'HtmlContentError')
|
|
236
|
-
.get('.Button')
|
|
237
|
-
.click()
|
|
238
|
-
.wait(animationTimeout)
|
|
239
|
-
.get('.Modal-content')
|
|
240
|
-
.should('not.exist');
|
|
241
|
-
});
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
context('Multiple', () => {
|
|
245
|
-
it('Properly navigates between multiple content items', () => {
|
|
246
|
-
cy.visitStory('v1/Modal/Content', 'MultipleModals')
|
|
247
|
-
.get('.Button')
|
|
248
|
-
.click()
|
|
249
|
-
.wait(animationTimeout)
|
|
250
|
-
.get('.Modal-content')
|
|
251
|
-
.should('have.class', 'ModalContent-0')
|
|
252
|
-
.get('.ModalContent-see-more')
|
|
253
|
-
.click()
|
|
254
|
-
.get('.Modal-content-wrapper')
|
|
255
|
-
.contains('This is content index 1.')
|
|
256
|
-
.get('.Modal-back')
|
|
257
|
-
.click()
|
|
258
|
-
.get('.Modal-content-wrapper')
|
|
259
|
-
.contains('This is content index 0.');
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
context('Start Index', () => {
|
|
264
|
-
it('Displays the correct content item when set', () => {
|
|
265
|
-
cy.visitStory('v1/Modal/Content', 'WithStartIndex')
|
|
266
|
-
.get('.Button')
|
|
267
|
-
.click()
|
|
268
|
-
.wait(animationTimeout)
|
|
269
|
-
.get('.Modal-content')
|
|
270
|
-
.should('have.class', 'ModalContent-1')
|
|
271
|
-
.get('.Modal-content-wrapper')
|
|
272
|
-
.contains('This is content index 1.')
|
|
273
|
-
.get('.Modal-back');
|
|
274
|
-
});
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
context('Methods', () => {
|
|
279
|
-
context('Hide', () => {
|
|
280
|
-
it('Calling hide() will hide the modal', () => {
|
|
281
|
-
cy.visitStory('v1/Modal/Methods', 'OnHide')
|
|
282
|
-
.get('.Button')
|
|
283
|
-
.click()
|
|
284
|
-
.wait(animationTimeout)
|
|
285
|
-
.get('.ModalContent-hide')
|
|
286
|
-
.click()
|
|
287
|
-
.wait(animationTimeout)
|
|
288
|
-
.get('.Modal')
|
|
289
|
-
.should('not.exist');
|
|
290
|
-
});
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
});
|