@spothero/ui 15.10.9 → 16.0.0-beta.1
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 +1 -1
- package/babel.config.js +1 -0
- package/dex.config.js +1 -1
- package/jest.config.json +4 -2
- package/package.json +11 -26
- 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/Accordion/Accordion.jsx +0 -1
- package/styles/v2/components/Accordion/Accordion.stories.js +0 -103
- package/styles/v2/components/Accordion/index.js +0 -7
- package/styles/v2/components/Accordion/styles/button.js +0 -16
- package/styles/v2/components/Accordion/styles/container.js +0 -9
- package/styles/v2/components/Accordion/styles/index.js +0 -19
- package/styles/v2/components/Accordion/styles/panel.js +0 -7
- package/styles/v2/components/Alert/Alert.jsx +0 -121
- package/styles/v2/components/Alert/Alert.stories.js +0 -50
- package/styles/v2/components/Alert/index.js +0 -1
- package/styles/v2/components/Alert/styles/index.js +0 -166
- package/styles/v2/components/AutoSuggestSelect/AutoSuggestSelect.jsx +0 -187
- package/styles/v2/components/AutoSuggestSelect/index.js +0 -1
- package/styles/v2/components/Badge/Badge.jsx +0 -1
- package/styles/v2/components/Badge/Badge.stories.js +0 -32
- package/styles/v2/components/Badge/styles/index.js +0 -29
- package/styles/v2/components/Button/Button.jsx +0 -31
- package/styles/v2/components/Button/Button.spec.js +0 -29
- package/styles/v2/components/Button/Button.styles.js +0 -156
- package/styles/v2/components/Button/button-props.js +0 -66
- package/styles/v2/components/Button/index.js +0 -2
- package/styles/v2/components/Button/stories/button.js +0 -59
- package/styles/v2/components/Button/stories/index.stories.js +0 -82
- package/styles/v2/components/Button/stories/overview.js +0 -73
- package/styles/v2/components/Card/Card.jsx +0 -16
- package/styles/v2/components/Card/Card.stories.js +0 -33
- package/styles/v2/components/Checkbox/Checkbox.jsx +0 -1
- package/styles/v2/components/Checkbox/Checkbox.stories.js +0 -41
- package/styles/v2/components/Checkbox/index.js +0 -1
- package/styles/v2/components/Checkbox/styles/index.js +0 -31
- package/styles/v2/components/Container/Container.jsx +0 -10
- package/styles/v2/components/Container/Container.stories.js +0 -52
- package/styles/v2/components/Container/Container.styles.js +0 -11
- package/styles/v2/components/Divider/Divider.jsx +0 -31
- package/styles/v2/components/Divider/Divider.stories.js +0 -41
- package/styles/v2/components/Divider/Divider.styles.js +0 -15
- package/styles/v2/components/FormControl/FormControl.jsx +0 -77
- package/styles/v2/components/Grid/Grid.jsx +0 -25
- package/styles/v2/components/Grid/Grid.stories.js +0 -128
- package/styles/v2/components/Grid/Grid.styles.js +0 -12
- package/styles/v2/components/Grid/GridItem.jsx +0 -10
- package/styles/v2/components/Grid/GridItem.styles.js +0 -8
- package/styles/v2/components/Grid/index.js +0 -2
- package/styles/v2/components/Heading/Heading.jsx +0 -23
- package/styles/v2/components/Heading/Heading.stories.js +0 -40
- package/styles/v2/components/Heading/Heading.styles.js +0 -61
- package/styles/v2/components/Icon/Icon.jsx +0 -1
- package/styles/v2/components/Icon/Icon.stories.js +0 -38
- package/styles/v2/components/Image/Image.jsx +0 -97
- package/styles/v2/components/Image/Image.spec.js +0 -100
- package/styles/v2/components/Image/Image.stories.js +0 -142
- package/styles/v2/components/Input/Input.jsx +0 -51
- package/styles/v2/components/Input/Input.stories.js +0 -60
- package/styles/v2/components/Input/index.js +0 -1
- package/styles/v2/components/Input/styles/index.js +0 -49
- package/styles/v2/components/Link/Link.jsx +0 -1
- package/styles/v2/components/Link/Link.stories.js +0 -82
- package/styles/v2/components/Link/Link.styles.js +0 -38
- package/styles/v2/components/List/List.jsx +0 -57
- package/styles/v2/components/List/List.stories.js +0 -96
- package/styles/v2/components/List/index.js +0 -2
- package/styles/v2/components/List/styles/index.js +0 -12
- package/styles/v2/components/List/styles/item.styles.js +0 -5
- package/styles/v2/components/Loader/Loader.jsx +0 -75
- package/styles/v2/components/Loader/Loader.stories.js +0 -145
- package/styles/v2/components/Modal/Modal.jsx +0 -71
- package/styles/v2/components/Modal/Modal.stories.js +0 -278
- package/styles/v2/components/Modal/index.js +0 -1
- package/styles/v2/components/Modal/styles/body.js +0 -24
- package/styles/v2/components/Modal/styles/closeButton.js +0 -17
- package/styles/v2/components/Modal/styles/dialog.js +0 -10
- package/styles/v2/components/Modal/styles/dialogContainer.js +0 -10
- package/styles/v2/components/Modal/styles/footer.js +0 -5
- package/styles/v2/components/Modal/styles/header.js +0 -7
- package/styles/v2/components/Modal/styles/index.js +0 -47
- package/styles/v2/components/Modal/styles/overlay.js +0 -4
- package/styles/v2/components/Popover/Popover.jsx +0 -28
- package/styles/v2/components/Popover/Popover.stories.js +0 -113
- package/styles/v2/components/Popover/PopoverArrow.jsx +0 -10
- package/styles/v2/components/Popover/PopoverCloseButton.jsx +0 -10
- package/styles/v2/components/Popover/PopoverContent.jsx +0 -41
- package/styles/v2/components/Popover/index.js +0 -3
- package/styles/v2/components/Popover/styles/index.js +0 -21
- package/styles/v2/components/Popover/styles/popover-arrow.js +0 -5
- package/styles/v2/components/Popover/styles/popover-body.js +0 -5
- package/styles/v2/components/Popover/styles/popover-close-button.js +0 -17
- package/styles/v2/components/Popover/styles/popover-content.js +0 -16
- package/styles/v2/components/Popover/styles/popover-header.js +0 -6
- package/styles/v2/components/Popover/styles/popper.js +0 -5
- package/styles/v2/components/Radio/Radio.jsx +0 -50
- package/styles/v2/components/Radio/Radio.stories.js +0 -155
- package/styles/v2/components/Radio/RadioGroup.jsx +0 -69
- package/styles/v2/components/Radio/index.js +0 -2
- package/styles/v2/components/Radio/styles/index.js +0 -52
- package/styles/v2/components/Select/Select.jsx +0 -62
- package/styles/v2/components/Select/Select.stories.js +0 -60
- package/styles/v2/components/Select/index.js +0 -1
- package/styles/v2/components/Select/styles/index.js +0 -29
- package/styles/v2/components/Skeleton/Skeleton.stories.jsx +0 -34
- package/styles/v2/components/Skeleton/Skeleton.styles.js +0 -3
- package/styles/v2/components/Skeleton/index.js +0 -1
- package/styles/v2/components/Spinner/Spinner.jsx +0 -40
- package/styles/v2/components/Spinner/Spinner.stories.js +0 -98
- package/styles/v2/components/Spinner/Spinner.styles.js +0 -57
- package/styles/v2/components/Switch/Switch.jsx +0 -52
- package/styles/v2/components/Switch/Switch.stories.js +0 -88
- package/styles/v2/components/Switch/index.js +0 -1
- package/styles/v2/components/Switch/styles/index.js +0 -17
- package/styles/v2/components/Table/Table.jsx +0 -1
- package/styles/v2/components/Table/Table.stories.js +0 -90
- package/styles/v2/components/Table/Table.styles.js +0 -66
- package/styles/v2/components/Table/index.js +0 -2
- package/styles/v2/components/Tabs/Tabs.jsx +0 -39
- package/styles/v2/components/Tabs/Tabs.stories.js +0 -47
- package/styles/v2/components/Tabs/combineSizeWithVariant.js +0 -29
- package/styles/v2/components/Tabs/index.js +0 -2
- package/styles/v2/components/Tabs/styles/index.js +0 -40
- package/styles/v2/components/Text/Text.jsx +0 -35
- package/styles/v2/components/Text/Text.stories.js +0 -47
- package/styles/v2/components/Text/Text.styles.js +0 -33
- package/styles/v2/components/Text/combineAsWithVariant.js +0 -106
- package/styles/v2/components/Text/options.js +0 -92
- package/styles/v2/components/ThemeProvider/ThemeProvider.jsx +0 -39
- package/styles/v2/components/ThemeProvider/ThemeProvider.stories.js +0 -85
- package/styles/v2/components/index.js +0 -70
- package/styles/v2/components/styles.js +0 -21
- package/styles/v2/theme/base/breakpoints.js +0 -16
- package/styles/v2/theme/base/colors.js +0 -136
- package/styles/v2/theme/base/index.js +0 -5
- package/styles/v2/theme/base/sizes.js +0 -48
- package/styles/v2/theme/base/typography.js +0 -24
- package/styles/v2/theme/base/zindices.js +0 -17
- 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
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
import isNil from 'lodash/isNil';
|
|
2
|
-
import isString from 'lodash/isString';
|
|
3
|
-
import React, {Component} from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import {Collapse} from 'react-collapse';
|
|
7
|
-
import IconChevronDown from '@spothero/icons/chevron-down';
|
|
8
|
-
import IconChevronUp from '@spothero/icons/chevron-up';
|
|
9
|
-
import Button from 'v1/components/Button/Button';
|
|
10
|
-
|
|
11
|
-
import deprecate from 'v1/utils/deprecate';
|
|
12
|
-
|
|
13
|
-
deprecate({
|
|
14
|
-
name: 'Panel',
|
|
15
|
-
newName: 'Accordion',
|
|
16
|
-
changes: [
|
|
17
|
-
'---- Props ----',
|
|
18
|
-
'Use allowMultiple to let multiple items show as expanded at a time',
|
|
19
|
-
'Use allowToggle to allow items within the accordion, so any expanded accordion item can be collapsed again',
|
|
20
|
-
'instead of isOpen now use, defaultIndex, index to achieve the same effect',
|
|
21
|
-
'Use defaultIndex to set the initial index(es) of the expanded accordion item',
|
|
22
|
-
'Use index to set the index(es) of the expanded accordion item',
|
|
23
|
-
'onChange is the callback invoked when accordion items are expanded or collapsed',
|
|
24
|
-
'Use isDisabled to disable an AccordionItem',
|
|
25
|
-
'Use isFocusable to allow an AccordionItem to be focusable',
|
|
26
|
-
'The pseudo style props _expanded, _disabled, _hover can be passed into the AccordionButton to style it',
|
|
27
|
-
'---- Changes in v2 component ----',
|
|
28
|
-
'Accordion (v2) now uses multiple components in order to parody this component',
|
|
29
|
-
'In Accordion (v2), there is no longer the option to pass in a custom icon',
|
|
30
|
-
'In Accordion (v2), the Title and Icon are now placed as children of AccordionButton component to enable the whole row to be clickable',
|
|
31
|
-
'The AccordionButton should be placed within a Heading component for markup and styling (v2/components/Heading)',
|
|
32
|
-
'In Accordion (v2), the Text is now a child of the AccordionPanel component',
|
|
33
|
-
'In order to add styles/markup to the text, it should be placed within a Text component (v2/components/Text)',
|
|
34
|
-
'Both AccordionPanel and AccordionIcon are children of AccordionItem',
|
|
35
|
-
'In Accordion (v2), showTitleToggle has been removed',
|
|
36
|
-
'In Accordion (v2), preview has been removed',
|
|
37
|
-
'onOpen and onClose are no longer needed in the v2 component',
|
|
38
|
-
'---- Additional Information ----',
|
|
39
|
-
'new props are documented at: https://chakra-ui.com/docs/disclosure/accordion',
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
class Panel extends Component {
|
|
44
|
-
static propTypes = {
|
|
45
|
-
/** Additional class(es) to add to the component. */
|
|
46
|
-
className: PropTypes.string,
|
|
47
|
-
/** The content to display in the panel title. */
|
|
48
|
-
title: PropTypes.node.isRequired,
|
|
49
|
-
/** Additional markup to display in the panel title. */
|
|
50
|
-
additionalTitleMarkup: PropTypes.node,
|
|
51
|
-
/** The content preview to display in the when the panel is collapsed. */
|
|
52
|
-
preview: PropTypes.node,
|
|
53
|
-
/** The content to display in the panel dropdown. */
|
|
54
|
-
children: PropTypes.node.isRequired,
|
|
55
|
-
/** Whether or not the panel should be opened. */
|
|
56
|
-
isOpen: PropTypes.bool,
|
|
57
|
-
/** Whether or not the panel title should toggle the panel content open/closed. */
|
|
58
|
-
showTitleToggle: PropTypes.bool,
|
|
59
|
-
/** The icon to show for the panel open action. */
|
|
60
|
-
openIcon: PropTypes.element,
|
|
61
|
-
/** The icon to show for the panel close action. */
|
|
62
|
-
closeIcon: PropTypes.element,
|
|
63
|
-
/** Function to execute on panel open. */
|
|
64
|
-
onOpen: PropTypes.func,
|
|
65
|
-
/** Function to execute on panel close. */
|
|
66
|
-
onClose: PropTypes.func,
|
|
67
|
-
};
|
|
68
|
-
static defaultProps = {
|
|
69
|
-
openIcon: <IconChevronDown className="Icon-chevron-down" />,
|
|
70
|
-
closeIcon: <IconChevronUp className="Icon-chevron-up" />,
|
|
71
|
-
};
|
|
72
|
-
state = {
|
|
73
|
-
isOpen: this.props.isOpen || false,
|
|
74
|
-
prevIsOpen: false,
|
|
75
|
-
heightReady: false,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
static getDerivedStateFromProps(nextProps, prevState) {
|
|
79
|
-
const {
|
|
80
|
-
isOpen: nextIsOpen,
|
|
81
|
-
showTitleToggle: nextShowTitleToggle,
|
|
82
|
-
} = nextProps;
|
|
83
|
-
const {isOpen, prevIsOpen} = prevState;
|
|
84
|
-
const isOpenStateEqualsNextProp = isOpen === nextIsOpen;
|
|
85
|
-
|
|
86
|
-
// when showTitleToggle is true, we don't want Panel controlled externally
|
|
87
|
-
if (
|
|
88
|
-
!nextShowTitleToggle &&
|
|
89
|
-
isOpen !== prevIsOpen &&
|
|
90
|
-
isOpenStateEqualsNextProp
|
|
91
|
-
) {
|
|
92
|
-
// toggled internal state change
|
|
93
|
-
return {
|
|
94
|
-
isOpen,
|
|
95
|
-
prevIsOpen,
|
|
96
|
-
};
|
|
97
|
-
} else if (!nextShowTitleToggle && !isOpenStateEqualsNextProp) {
|
|
98
|
-
// state change happening because of props change by external component
|
|
99
|
-
return {
|
|
100
|
-
isOpen: nextIsOpen,
|
|
101
|
-
prevIsOpen: isOpen,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
componentDidUpdate(prevProps, prevState) {
|
|
109
|
-
const {onOpen, onClose} = this.props;
|
|
110
|
-
const {isOpen} = this.state;
|
|
111
|
-
const {isOpen: prevIsOpen} = prevState;
|
|
112
|
-
|
|
113
|
-
if (onOpen && isOpen && !prevIsOpen) {
|
|
114
|
-
onOpen();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (onClose && !isOpen && prevIsOpen) {
|
|
118
|
-
onClose();
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
_onMeasure = () => {
|
|
123
|
-
this.setState({
|
|
124
|
-
heightReady: true,
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
_onToggle = evt => {
|
|
129
|
-
evt.preventDefault();
|
|
130
|
-
|
|
131
|
-
this.setState((prevState, props) => {
|
|
132
|
-
const {isOpen} = prevState;
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
isOpen: !isOpen,
|
|
136
|
-
prevIsOpen: isOpen,
|
|
137
|
-
};
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
render() {
|
|
142
|
-
const {
|
|
143
|
-
className,
|
|
144
|
-
title,
|
|
145
|
-
children,
|
|
146
|
-
showTitleToggle,
|
|
147
|
-
preview,
|
|
148
|
-
additionalTitleMarkup,
|
|
149
|
-
openIcon,
|
|
150
|
-
closeIcon,
|
|
151
|
-
} = this.props;
|
|
152
|
-
const {isOpen, heightReady} = this.state;
|
|
153
|
-
const classes = classNames(
|
|
154
|
-
'Panel',
|
|
155
|
-
{'Panel-with-preview': preview},
|
|
156
|
-
{'Panel-open': isOpen},
|
|
157
|
-
className
|
|
158
|
-
);
|
|
159
|
-
const contentClasses = classNames('Panel-content', {
|
|
160
|
-
'Panel-content-hidden': !heightReady,
|
|
161
|
-
});
|
|
162
|
-
const showPreview = !isNil(preview) && !isOpen;
|
|
163
|
-
const panelTitle = isString(title) ? (
|
|
164
|
-
<div className="Panel-title-heading">{title}</div>
|
|
165
|
-
) : (
|
|
166
|
-
title
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
return (
|
|
170
|
-
<div className={classes}>
|
|
171
|
-
<div className="Panel-title">
|
|
172
|
-
{showTitleToggle ? (
|
|
173
|
-
<Button
|
|
174
|
-
className="Panel-toggle"
|
|
175
|
-
onClick={this._onToggle}
|
|
176
|
-
>
|
|
177
|
-
{panelTitle}
|
|
178
|
-
{isOpen ? closeIcon : openIcon}
|
|
179
|
-
</Button>
|
|
180
|
-
) : (
|
|
181
|
-
<>
|
|
182
|
-
{panelTitle}
|
|
183
|
-
{additionalTitleMarkup}
|
|
184
|
-
</>
|
|
185
|
-
)}
|
|
186
|
-
</div>
|
|
187
|
-
<Collapse
|
|
188
|
-
isOpened={isOpen || showPreview}
|
|
189
|
-
onMeasure={this._onMeasure}
|
|
190
|
-
springConfig={{stiffness: 300, damping: 25}}
|
|
191
|
-
>
|
|
192
|
-
{isOpen && <div className={contentClasses}>{children}</div>}
|
|
193
|
-
{showPreview && (
|
|
194
|
-
<div className="Panel-preview">{preview}</div>
|
|
195
|
-
)}
|
|
196
|
-
</Collapse>
|
|
197
|
-
</div>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export default Panel;
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {render, screen} from '@testing-library/react';
|
|
3
|
-
import {build, fake} from '@jackfranklin/test-data-bot';
|
|
4
|
-
|
|
5
|
-
import Panel from './Panel';
|
|
6
|
-
|
|
7
|
-
const PanelProps = build('PanelProps', {
|
|
8
|
-
fields: {
|
|
9
|
-
isOpen: true,
|
|
10
|
-
title: fake(f => f.random.words(2)),
|
|
11
|
-
className: fake(f => f.random.words(2)),
|
|
12
|
-
children: fake(f => f.random.words(20)),
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
// const animationTimeout = 300;
|
|
17
|
-
const setup = props => render(<Panel {...props} />);
|
|
18
|
-
|
|
19
|
-
describe('<Panel />', () => {
|
|
20
|
-
describe('Display', () => {
|
|
21
|
-
it('renders component with proper props', () => {
|
|
22
|
-
const props = PanelProps();
|
|
23
|
-
const rendered = setup(props);
|
|
24
|
-
|
|
25
|
-
expect(rendered.container.firstChild.className).toContain(
|
|
26
|
-
props.className
|
|
27
|
-
);
|
|
28
|
-
expect(screen.getByText(props.title)).toBeInTheDocument();
|
|
29
|
-
|
|
30
|
-
expect(screen.getByText(props.children)).toBeInTheDocument();
|
|
31
|
-
|
|
32
|
-
screen.debug();
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
// context('Display', () => {
|
|
36
|
-
// context('With Title Toggle', () => {
|
|
37
|
-
// it('Renders Panel with toggle functionality', () => {
|
|
38
|
-
// cy.visitStory('v1/Panel/Display', 'WithToggle')
|
|
39
|
-
// // alias toggle button
|
|
40
|
-
// .get('.Panel-toggle')
|
|
41
|
-
// .as('buttonToggle')
|
|
42
|
-
// // make sure content is not open
|
|
43
|
-
// .get('.Panel')
|
|
44
|
-
// .should('not.have.class', 'Panel-open')
|
|
45
|
-
// .get('.Panel-content')
|
|
46
|
-
// .should('not.exist')
|
|
47
|
-
// // make sure proper icon is displaying
|
|
48
|
-
// .get('.Icon')
|
|
49
|
-
// .should('have.class', 'Icon-chevron-down')
|
|
50
|
-
// // open content and make sure it renders properly
|
|
51
|
-
// .get('@buttonToggle')
|
|
52
|
-
// .click()
|
|
53
|
-
// .wait(animationTimeout)
|
|
54
|
-
// .get('.Panel-content')
|
|
55
|
-
// .should('exist')
|
|
56
|
-
// .contains('Panel content')
|
|
57
|
-
// // make sure proper icon is displaying
|
|
58
|
-
// .get('.Icon')
|
|
59
|
-
// .should('have.class', 'Icon-chevron-up')
|
|
60
|
-
// // close content again and verify
|
|
61
|
-
// .get('@buttonToggle')
|
|
62
|
-
// .click()
|
|
63
|
-
// .wait(animationTimeout)
|
|
64
|
-
// .get('.Panel-content')
|
|
65
|
-
// .should('not.exist')
|
|
66
|
-
// // make sure proper icon is displaying
|
|
67
|
-
// .get('.Icon')
|
|
68
|
-
// .should('have.class', 'Icon-chevron-down');
|
|
69
|
-
// });
|
|
70
|
-
// });
|
|
71
|
-
// context('With Preview', () => {
|
|
72
|
-
// it('Renders Panel with preview markup', () => {
|
|
73
|
-
// cy.visitStory('v1/Panel/Display', 'WithPreview')
|
|
74
|
-
// // alias toggle button
|
|
75
|
-
// .get('.Panel-toggle')
|
|
76
|
-
// .as('buttonToggle')
|
|
77
|
-
// // make preview markup exists
|
|
78
|
-
// .get('.Panel')
|
|
79
|
-
// .should('not.have.class', 'Panel-open')
|
|
80
|
-
// .get('.Panel-preview')
|
|
81
|
-
// .should('exist')
|
|
82
|
-
// .contains('Panel content preview')
|
|
83
|
-
// // open content and make sure preview disappears
|
|
84
|
-
// .get('@buttonToggle')
|
|
85
|
-
// .click()
|
|
86
|
-
// .wait(animationTimeout)
|
|
87
|
-
// .get('.Panel-preview')
|
|
88
|
-
// .should('not.exist')
|
|
89
|
-
// // close content again and verify preview appears
|
|
90
|
-
// .get('@buttonToggle')
|
|
91
|
-
// .click()
|
|
92
|
-
// .wait(animationTimeout)
|
|
93
|
-
// .get('.Panel-preview')
|
|
94
|
-
// .should('exist');
|
|
95
|
-
// });
|
|
96
|
-
// });
|
|
97
|
-
// context('With Custom Icons', () => {
|
|
98
|
-
// it('Renders Panel with custom open/close icons', () => {
|
|
99
|
-
// cy.visitStory('v1/Panel/Display', 'WithCustomIcons')
|
|
100
|
-
// // alias toggle button
|
|
101
|
-
// .get('.Panel-toggle')
|
|
102
|
-
// .as('buttonToggle')
|
|
103
|
-
// // make sure proper open icon is displaying
|
|
104
|
-
// .get('.Icon')
|
|
105
|
-
// .should('have.class', 'Icon-chevron-right')
|
|
106
|
-
// // open content and make sure icon changes to custom close icon
|
|
107
|
-
// .get('@buttonToggle')
|
|
108
|
-
// .click()
|
|
109
|
-
// .wait(animationTimeout)
|
|
110
|
-
// .get('.Icon')
|
|
111
|
-
// .should('have.class', 'Icon-chevron-left')
|
|
112
|
-
// // close content again and icon changes back
|
|
113
|
-
// .get('@buttonToggle')
|
|
114
|
-
// .click()
|
|
115
|
-
// .wait(animationTimeout)
|
|
116
|
-
// .get('.Icon')
|
|
117
|
-
// .should('have.class', 'Icon-chevron-right');
|
|
118
|
-
// });
|
|
119
|
-
// });
|
|
120
|
-
// context('With Custom Title Element', () => {
|
|
121
|
-
// it('Renders Panel with custom title node', () => {
|
|
122
|
-
// cy.visitStory('v1/Panel/Display', 'CustomTitleElement')
|
|
123
|
-
// .get('.PanelCustomTitleElement-title')
|
|
124
|
-
// .contains('Custom Title Element');
|
|
125
|
-
// });
|
|
126
|
-
// });
|
|
127
|
-
// context('With Additional Title Markup', () => {
|
|
128
|
-
// it('Renders Panel with additional markup in title', () => {
|
|
129
|
-
// cy.visitStory('v1/Panel/Display', 'WithAdditionalTitleMarkup')
|
|
130
|
-
// .get('.Panel-title')
|
|
131
|
-
// .contains('Additional Title Markup');
|
|
132
|
-
// });
|
|
133
|
-
// });
|
|
134
|
-
// });
|
|
135
|
-
// context('Methods', () => {
|
|
136
|
-
// context('OnOpen', () => {
|
|
137
|
-
// it('OnOpen method functions properly', () => {
|
|
138
|
-
// cy.visitStory('v1/Panel/Methods', 'OnOpen', {
|
|
139
|
-
// onBeforeLoad: contentWindow => {
|
|
140
|
-
// contentWindow.onPanelOpen = () => {
|
|
141
|
-
// // eslint-disable-next-line no-console
|
|
142
|
-
// console.log('onPanelOpen');
|
|
143
|
-
// };
|
|
144
|
-
// cy.stub(contentWindow, 'onPanelOpen').as('panelOpen');
|
|
145
|
-
// },
|
|
146
|
-
// })
|
|
147
|
-
// // calls onOpen when panel is opened
|
|
148
|
-
// .get('.Panel-toggle')
|
|
149
|
-
// .click()
|
|
150
|
-
// .wait(animationTimeout)
|
|
151
|
-
// .get('@panelOpen')
|
|
152
|
-
// .should('be.called');
|
|
153
|
-
// });
|
|
154
|
-
// });
|
|
155
|
-
// context('OnClose', () => {
|
|
156
|
-
// it('OnClose method functions properly', () => {
|
|
157
|
-
// cy.visitStory('v1/Panel/Methods', 'OnClose', {
|
|
158
|
-
// onBeforeLoad: contentWindow => {
|
|
159
|
-
// contentWindow.onPanelClose = () => {
|
|
160
|
-
// // eslint-disable-next-line no-console
|
|
161
|
-
// console.log('onPanelClose');
|
|
162
|
-
// };
|
|
163
|
-
// cy.stub(contentWindow, 'onPanelClose').as('panelClose');
|
|
164
|
-
// },
|
|
165
|
-
// })
|
|
166
|
-
// // open panel
|
|
167
|
-
// .get('.Panel-toggle')
|
|
168
|
-
// .click()
|
|
169
|
-
// .wait(animationTimeout)
|
|
170
|
-
// // calls onClose when panel is opened
|
|
171
|
-
// .get('.Panel-toggle')
|
|
172
|
-
// .click()
|
|
173
|
-
// .wait(animationTimeout)
|
|
174
|
-
// .get('@panelClose')
|
|
175
|
-
// .should('be.called');
|
|
176
|
-
// });
|
|
177
|
-
// });
|
|
178
|
-
// context('With External Toggle', () => {
|
|
179
|
-
// it('Renders Panel with external toggle control', () => {
|
|
180
|
-
// cy.visitStory('v1/Panel/Methods', 'TogglePanelExternally')
|
|
181
|
-
// // alias external toggle button
|
|
182
|
-
// .get('.PanelToggleExternally-toggle')
|
|
183
|
-
// .as('externalButtonToggle')
|
|
184
|
-
// // verify button click shows content in only Panel controlled by external toggle
|
|
185
|
-
// .click()
|
|
186
|
-
// .wait(animationTimeout)
|
|
187
|
-
// .get('.Panel-toggle-external .Panel-content')
|
|
188
|
-
// .should('exist')
|
|
189
|
-
// .contains('Panel content - external')
|
|
190
|
-
// // verify internal toggle panel content not shown
|
|
191
|
-
// .get('.Panel-toggle-internal .Panel-content')
|
|
192
|
-
// .should('not.exist');
|
|
193
|
-
// });
|
|
194
|
-
// });
|
|
195
|
-
// });
|
|
196
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
.Panel {
|
|
2
|
-
background-color: $color-white;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.Panel-title {
|
|
6
|
-
position: relative;
|
|
7
|
-
padding: 16px;
|
|
8
|
-
|
|
9
|
-
.Panel-open &,
|
|
10
|
-
.Panel-with-preview & {
|
|
11
|
-
border-bottom: 1px solid $color-dashboard;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.Panel-title-heading {
|
|
16
|
-
font-size: 18px;
|
|
17
|
-
font-weight: $font-weight-semi-bold;
|
|
18
|
-
margin: 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.Panel-toggle {
|
|
22
|
-
width: 100%;
|
|
23
|
-
padding: 0;
|
|
24
|
-
text-align: left;
|
|
25
|
-
position: relative;
|
|
26
|
-
|
|
27
|
-
&::after {
|
|
28
|
-
display: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.Icon {
|
|
32
|
-
width: 20px;
|
|
33
|
-
height: 20px;
|
|
34
|
-
margin: 0;
|
|
35
|
-
position: absolute;
|
|
36
|
-
top: 0;
|
|
37
|
-
right: 0;
|
|
38
|
-
fill: $color-cement;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.Panel-content,
|
|
43
|
-
.Panel-preview {
|
|
44
|
-
padding: 16px;
|
|
45
|
-
overflow-wrap: break-word;
|
|
46
|
-
word-wrap: break-word;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.Panel-content-hidden {
|
|
50
|
-
display: none;
|
|
51
|
-
|
|
52
|
-
.Panel-open & {
|
|
53
|
-
display: block;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import classNames from 'classnames';
|
|
3
|
-
import Panel from 'v1/components/Panel/Panel';
|
|
4
|
-
import IconChevronLeft from '@spothero/icons/chevron-left';
|
|
5
|
-
import IconChevronRight from '@spothero/icons/chevron-right';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
component: Panel,
|
|
9
|
-
title: 'v1/Panel/Display',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const panelText =
|
|
13
|
-
'Panel content - Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur';
|
|
14
|
-
|
|
15
|
-
export const Default = () => {
|
|
16
|
-
const classes = classNames('PanelDefault', 'PanelDefaultTest');
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<Panel className={classes} title="Panel" isOpen>
|
|
20
|
-
{panelText}
|
|
21
|
-
</Panel>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const WithToggle = () => {
|
|
26
|
-
return (
|
|
27
|
-
<Panel title="PanelWithTitleToggle" showTitleToggle>
|
|
28
|
-
{panelText}
|
|
29
|
-
</Panel>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const WithPreview = () => {
|
|
34
|
-
return (
|
|
35
|
-
<Panel
|
|
36
|
-
title="PanelWithPreview"
|
|
37
|
-
preview="Panel content preview - Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt."
|
|
38
|
-
showTitleToggle
|
|
39
|
-
>
|
|
40
|
-
{panelText}
|
|
41
|
-
</Panel>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const WithCustomIcons = () => {
|
|
46
|
-
return (
|
|
47
|
-
<Panel
|
|
48
|
-
title="PanelCustomIcons"
|
|
49
|
-
openIcon={<IconChevronRight className="Icon-chevron-right" />}
|
|
50
|
-
closeIcon={<IconChevronLeft className="Icon-chevron-left" />}
|
|
51
|
-
showTitleToggle
|
|
52
|
-
>
|
|
53
|
-
{panelText}
|
|
54
|
-
</Panel>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const WithAdditionalTitleMarkup = () => {
|
|
59
|
-
return (
|
|
60
|
-
<Panel
|
|
61
|
-
title="PanelWithAdditionalTitleMarkup"
|
|
62
|
-
additionalTitleMarkup="Additional Title Markup"
|
|
63
|
-
isOpen
|
|
64
|
-
>
|
|
65
|
-
{panelText}
|
|
66
|
-
</Panel>
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export const CustomTitleElement = () => {
|
|
71
|
-
const title = (
|
|
72
|
-
<div className="Panel-title-heading PanelCustomTitleElement-title">
|
|
73
|
-
Custom Title Element
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<Panel title={title} showTitleToggle>
|
|
79
|
-
{panelText}
|
|
80
|
-
</Panel>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import Panel from 'v1/components/Panel/Panel';
|
|
3
|
-
import Button from 'v1/components/Button/Button';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
component: Panel,
|
|
7
|
-
title: 'v1/Panel/Methods',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const panelText =
|
|
11
|
-
'Panel content - Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur';
|
|
12
|
-
|
|
13
|
-
export const OnOpen = () => {
|
|
14
|
-
const onPanelOpen = () => {
|
|
15
|
-
if (window.onPanelOpen) {
|
|
16
|
-
window.onPanelOpen();
|
|
17
|
-
} else {
|
|
18
|
-
// eslint-disable-next-line no-console
|
|
19
|
-
console.log('panel opened');
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Panel title="PanelMethods" onOpen={onPanelOpen} showTitleToggle>
|
|
25
|
-
{panelText}
|
|
26
|
-
</Panel>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const OnClose = () => {
|
|
31
|
-
const onPanelClose = () => {
|
|
32
|
-
if (window.onPanelClose) {
|
|
33
|
-
window.onPanelClose();
|
|
34
|
-
} else {
|
|
35
|
-
// eslint-disable-next-line no-console
|
|
36
|
-
console.log('panel closed');
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<Panel title="PanelMethods" onClose={onPanelClose} showTitleToggle>
|
|
42
|
-
{panelText}
|
|
43
|
-
</Panel>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const TogglePanelExternally = () => {
|
|
48
|
-
const [isOpen, setOpen] = useState(false);
|
|
49
|
-
|
|
50
|
-
const onToggleClick = evt => {
|
|
51
|
-
evt.preventDefault();
|
|
52
|
-
|
|
53
|
-
setOpen(prevIsOpen => !prevIsOpen);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<div className="PanelToggleExternally">
|
|
58
|
-
<Panel
|
|
59
|
-
className="Panel-toggle-external"
|
|
60
|
-
title="PanelToggleExternally"
|
|
61
|
-
isOpen={isOpen}
|
|
62
|
-
>
|
|
63
|
-
Panel content - external
|
|
64
|
-
</Panel>
|
|
65
|
-
<br />
|
|
66
|
-
<br />
|
|
67
|
-
<Button
|
|
68
|
-
className="PanelToggleExternally-toggle"
|
|
69
|
-
color="primary"
|
|
70
|
-
onClick={onToggleClick}
|
|
71
|
-
>
|
|
72
|
-
Toggle Panel
|
|
73
|
-
</Button>
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
};
|