@spothero/ui 14.8.3 → 14.8.4
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/CHANGELOG.md +18 -0
- package/CHANGELOG.tmp +16 -4
- package/backlog/index.js +3 -3
- package/backlog/{Modal → v1/components/Modal}/Modal.js +2 -2
- package/backlog/v1/components/index.js +24 -1
- package/package.json +1 -1
- package/styles/_index.scss +1 -1
- package/styles/index.js +1 -1
- package/styles/{Modal → v1/components/Modal}/Modal.jsx +1 -1
- package/styles/v1/components/Modal/stories/Content.stories.js +314 -0
- package/styles/v1/components/Modal/stories/Display.stories.js +208 -0
- package/styles/v1/components/Modal/stories/Methods.stories.js +44 -0
- package/styles/v1/components/Modal/stories/Width.stories.js +82 -0
- package/styles/v1/components/Modal/stories/helpers/ReduxConsumer.jsx +21 -0
- package/styles/v1/components/index.js +1 -0
- package/styles/v2/components/Modal/Modal.jsx +69 -0
- package/styles/v2/components/Modal/Modal.stories.js +273 -0
- package/styles/v2/components/Modal/index.js +1 -0
- package/styles/v2/components/Modal/styles/body.js +23 -0
- package/styles/v2/components/Modal/styles/closeButton.js +17 -0
- package/styles/v2/components/Modal/styles/dialog.js +10 -0
- package/styles/v2/components/Modal/styles/dialogContainer.js +7 -0
- package/styles/v2/components/Modal/styles/footer.js +5 -0
- package/styles/v2/components/Modal/styles/header.js +7 -0
- package/styles/v2/components/Modal/styles/index.js +47 -0
- package/styles/v2/components/Modal/styles/overlay.js +4 -0
- package/styles/v2/components/index.js +1 -0
- package/styles/v2/components/styles.js +1 -0
- package/v1/index.js +1 -1
- package/v1/index.js.LICENSE.txt +18 -0
- package/v1/index.js.map +1 -1
- package/v2/index.js +1 -1
- package/v2/index.js.map +1 -1
- /package/backlog/{Modal → v1/components/Modal}/ModalContent.js +0 -0
- /package/backlog/{Modal → v1/components/Modal}/ModalFooter.js +0 -0
- /package/backlog/{Modal → v1/components/Modal}/index.js +0 -0
- /package/styles/{Modal → v1/components/Modal}/Modal.spec.js +0 -0
- /package/styles/{Modal → v1/components/Modal}/ModalContent.jsx +0 -0
- /package/styles/{Modal → v1/components/Modal}/ModalFooter.jsx +0 -0
- /package/styles/{Modal → v1/components/Modal}/_Modal.scss +0 -0
- /package/styles/{Modal → v1/components/Modal}/index.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
# 14.8.4 - 06/21/2022
|
|
2
|
+
## Miscellaneous Updates
|
|
3
|
+
* [[2809609](https://github.com/spothero/fe-ui/commit/2809609)] - `feature:` Add Modal to V2 ([#299](https://github.com/spothero/fe-ui/pull/299)) (Mick Johnson)
|
|
4
|
+
* `squash:` Add new Modal component
|
|
5
|
+
* `squash:` More specific styling and scroll behavior
|
|
6
|
+
* `squash:` Mobile styling
|
|
7
|
+
* `squash:` Add Accordion Story
|
|
8
|
+
* `squash:` Cleanup stories and add focus state to close button
|
|
9
|
+
* `squash:` Story name cleanup
|
|
10
|
+
* `squash:` Design review feedback
|
|
11
|
+
* `squash:` Add jsdoc comments
|
|
12
|
+
* `squash:` Move v1 Modal to right place and export the subcomponents
|
|
13
|
+
* `squash:` Fix stylesheet import
|
|
14
|
+
* `squash:` Add hideCloseButton Prop, Render Box with header styles if header not passed in, Adjust visuals based on presence of header and close button
|
|
15
|
+
* `squash:` Proptypes type
|
|
16
|
+
* `squash:` Fixing the old modal export
|
|
17
|
+
* `squash:` Make onClose not required, tweak header styling
|
|
18
|
+
|
|
1
19
|
# 14.8.3 - 06/21/2022
|
|
2
20
|
|
|
3
21
|
## Miscellaneous Updates
|
package/CHANGELOG.tmp
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
# 14.8.
|
|
2
|
-
|
|
1
|
+
# 14.8.4 - 06/21/2022
|
|
3
2
|
## Miscellaneous Updates
|
|
4
|
-
* [[
|
|
5
|
-
*
|
|
3
|
+
* [[2809609](https://github.com/spothero/fe-ui/commit/2809609)] - `feature:` Add Modal to V2 ([#299](https://github.com/spothero/fe-ui/pull/299)) (Mick Johnson)
|
|
4
|
+
* `squash:` Add new Modal component
|
|
5
|
+
* `squash:` More specific styling and scroll behavior
|
|
6
|
+
* `squash:` Mobile styling
|
|
7
|
+
* `squash:` Add Accordion Story
|
|
8
|
+
* `squash:` Cleanup stories and add focus state to close button
|
|
9
|
+
* `squash:` Story name cleanup
|
|
10
|
+
* `squash:` Design review feedback
|
|
11
|
+
* `squash:` Add jsdoc comments
|
|
12
|
+
* `squash:` Move v1 Modal to right place and export the subcomponents
|
|
13
|
+
* `squash:` Fix stylesheet import
|
|
14
|
+
* `squash:` Add hideCloseButton Prop, Render Box with header styles if header not passed in, Adjust visuals based on presence of header and close button
|
|
15
|
+
* `squash:` Proptypes type
|
|
16
|
+
* `squash:` Fixing the old modal export
|
|
17
|
+
* `squash:` Make onClose not required, tweak header styling
|
|
6
18
|
|
package/backlog/index.js
CHANGED
|
@@ -410,8 +410,6 @@ var _Checkbox = _interopRequireDefault(require("./Checkbox/Checkbox"));
|
|
|
410
410
|
|
|
411
411
|
var _TextArea = _interopRequireDefault(require("./TextArea/TextArea"));
|
|
412
412
|
|
|
413
|
-
var _Modal = require("./Modal");
|
|
414
|
-
|
|
415
413
|
var _TextInput = require("./TextInput");
|
|
416
414
|
|
|
417
415
|
var _PulseLoader = _interopRequireDefault(require("./PulseLoader/PulseLoader"));
|
|
@@ -446,4 +444,6 @@ var _TextButton = _interopRequireDefault(require("./v1/components/TextButton/Tex
|
|
|
446
444
|
|
|
447
445
|
var _Image = _interopRequireDefault(require("./v1/components/Image/Image"));
|
|
448
446
|
|
|
449
|
-
var _Loader = _interopRequireDefault(require("./v1/components/Loader/Loader"));
|
|
447
|
+
var _Loader = _interopRequireDefault(require("./v1/components/Loader/Loader"));
|
|
448
|
+
|
|
449
|
+
var _Modal = require("./v1/components/Modal");
|
|
@@ -52,9 +52,9 @@ var _times = _interopRequireDefault(require("@spothero/icons/times"));
|
|
|
52
52
|
|
|
53
53
|
var _dom = _interopRequireDefault(require("@spothero/utils/dom"));
|
|
54
54
|
|
|
55
|
-
var _Button = _interopRequireDefault(require("../
|
|
55
|
+
var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
56
56
|
|
|
57
|
-
var _Portal = _interopRequireDefault(require("
|
|
57
|
+
var _Portal = _interopRequireDefault(require("Portal/Portal"));
|
|
58
58
|
|
|
59
59
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
60
60
|
|
|
@@ -29,6 +29,27 @@ _Object$defineProperty(exports, "Loader", {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
_Object$defineProperty(exports, "Modal", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _Modal.Modal;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
_Object$defineProperty(exports, "ModalContent", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function get() {
|
|
42
|
+
return _Modal.ModalContent;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
_Object$defineProperty(exports, "ModalFooter", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function get() {
|
|
49
|
+
return _Modal.ModalFooter;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
32
53
|
_Object$defineProperty(exports, "Panel", {
|
|
33
54
|
enumerable: true,
|
|
34
55
|
get: function get() {
|
|
@@ -60,4 +81,6 @@ var _TextButton = _interopRequireDefault(require("./TextButton/TextButton"));
|
|
|
60
81
|
|
|
61
82
|
var _Image = _interopRequireDefault(require("./Image/Image"));
|
|
62
83
|
|
|
63
|
-
var _Loader = _interopRequireDefault(require("./Loader/Loader"));
|
|
84
|
+
var _Loader = _interopRequireDefault(require("./Loader/Loader"));
|
|
85
|
+
|
|
86
|
+
var _Modal = require("./Modal");
|
package/package.json
CHANGED
package/styles/_index.scss
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
@import "v1/components/Image/Image";
|
|
15
15
|
@import "Label/Label";
|
|
16
16
|
@import "v1/components/Loader/Loader";
|
|
17
|
-
@import "Modal/Modal";
|
|
17
|
+
@import "v1/components/Modal/Modal";
|
|
18
18
|
@import "Notification/Notification";
|
|
19
19
|
@import "v1/components/Panel/Panel";
|
|
20
20
|
@import "PulseLoader/PulseLoader";
|
package/styles/index.js
CHANGED
|
@@ -10,7 +10,6 @@ export {default as Tooltip} from './Tooltip/Tooltip';
|
|
|
10
10
|
export {Select, SelectItemPropTypes} from './Select';
|
|
11
11
|
export {default as Checkbox} from './Checkbox/Checkbox';
|
|
12
12
|
export {default as TextArea} from './TextArea/TextArea';
|
|
13
|
-
export {Modal, ModalContent, ModalFooter} from './Modal';
|
|
14
13
|
export {TextInput, TextInputPropTypes} from './TextInput';
|
|
15
14
|
export {default as PulseLoader} from './PulseLoader/PulseLoader';
|
|
16
15
|
export {default as RenderInBody} from './RenderInBody/RenderInBody';
|
|
@@ -48,3 +47,4 @@ export {default as Button} from './v1/components/Button/Button';
|
|
|
48
47
|
export {default as TextButton} from './v1/components/TextButton/TextButton';
|
|
49
48
|
export {default as Image} from './v1/components/Image/Image';
|
|
50
49
|
export {default as Loader} from './v1/components/Loader/Loader';
|
|
50
|
+
export {Modal, ModalContent, ModalFooter} from './v1/components/Modal';
|
|
@@ -7,7 +7,7 @@ import IconChevronLeft from '@spothero/icons/chevron-left';
|
|
|
7
7
|
import IconTimes from '@spothero/icons/times';
|
|
8
8
|
import DOMUtils from '@spothero/utils/dom';
|
|
9
9
|
import Button from 'v1/components/Button/Button';
|
|
10
|
-
import Portal from '
|
|
10
|
+
import Portal from 'Portal/Portal';
|
|
11
11
|
|
|
12
12
|
export default class Modal extends PureComponent {
|
|
13
13
|
static propTypes = {
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import Button from 'v1/components/Button/Button';
|
|
3
|
+
import Modal from '../Modal';
|
|
4
|
+
import ModalContent from '../ModalContent';
|
|
5
|
+
import ErrorBoundary from 'ErrorBoundary/ErrorBoundary';
|
|
6
|
+
import DOMUtils from '@spothero/utils/dom';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
component: Modal,
|
|
10
|
+
title: 'v1/Modal/Content',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const CustomHeight = () => {
|
|
14
|
+
const [isOpen, setOpen] = useState(false);
|
|
15
|
+
|
|
16
|
+
const onToggle = () => {
|
|
17
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div className="ModalCustomHeight">
|
|
22
|
+
<Button color="primary" onClick={onToggle}>
|
|
23
|
+
Open Modal with Custom Height
|
|
24
|
+
</Button>
|
|
25
|
+
{isOpen && (
|
|
26
|
+
<Modal title="Modal Title" onHidden={onToggle}>
|
|
27
|
+
<ModalContent contentAreaHeight={300}>
|
|
28
|
+
<p>
|
|
29
|
+
This modal has a height of 300. And if the height is
|
|
30
|
+
taller there will be a scrollbar.
|
|
31
|
+
</p>
|
|
32
|
+
<p>
|
|
33
|
+
Nulla quis lorem quis nulla auctor congue.
|
|
34
|
+
Pellentesque volutpat eget libero nec volutpat.
|
|
35
|
+
Donec malesuada metus odio, nec scelerisque libero
|
|
36
|
+
convallis eu. Morbi vitae pellentesque lorem, a
|
|
37
|
+
porta elit. Nulla nibh mi, hendrerit id urna in,
|
|
38
|
+
commodo pellentesque dui. Nullam pellentesque neque
|
|
39
|
+
vel nisi venenatis, ac dignissim sapien condimentum.
|
|
40
|
+
Aenean ornare, ante non auctor facilisis, est libero
|
|
41
|
+
commodo nulla, euismod vehicula massa enim efficitur
|
|
42
|
+
orci.
|
|
43
|
+
</p>
|
|
44
|
+
<p>
|
|
45
|
+
Morbi vitae pellentesque lorem, a porta elit. Nulla
|
|
46
|
+
nibh mi, hendrerit id urna in, commodo pellentesque
|
|
47
|
+
dui. Nullam pellentesque neque vel nisi venenatis,
|
|
48
|
+
ac dignissim sapien condimentum. Aenean ornare, ante
|
|
49
|
+
non auctor facilisis, est libero commodo nulla,
|
|
50
|
+
euismod vehicula massa enim efficitur orci. Nulla
|
|
51
|
+
quis lorem quis nulla auctor congue. Pellentesque
|
|
52
|
+
volutpat eget libero nec volutpat. Donec malesuada
|
|
53
|
+
metus odio, nec scelerisque libero convallis eu.
|
|
54
|
+
</p>
|
|
55
|
+
</ModalContent>
|
|
56
|
+
</Modal>
|
|
57
|
+
)}
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const MaxHeight = () => {
|
|
63
|
+
const [isOpen, setOpen] = useState(false);
|
|
64
|
+
|
|
65
|
+
const onToggle = () => {
|
|
66
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div className="ModalMaxHeight">
|
|
71
|
+
<Button color="primary" onClick={onToggle}>
|
|
72
|
+
Open Modal with Max Height
|
|
73
|
+
</Button>
|
|
74
|
+
{isOpen && (
|
|
75
|
+
<Modal title="Modal Title" onHidden={onToggle}>
|
|
76
|
+
<ModalContent maxHeight={400}>
|
|
77
|
+
<p>
|
|
78
|
+
This modal has a max height of 400. And if the
|
|
79
|
+
height is taller there will be a scrollbar.
|
|
80
|
+
</p>
|
|
81
|
+
<p>
|
|
82
|
+
Nulla quis lorem quis nulla auctor congue.
|
|
83
|
+
Pellentesque volutpat eget libero nec volutpat.
|
|
84
|
+
Donec malesuada metus odio, nec scelerisque libero
|
|
85
|
+
convallis eu. Morbi vitae pellentesque lorem, a
|
|
86
|
+
porta elit. Nulla nibh mi, hendrerit id urna in,
|
|
87
|
+
commodo pellentesque dui. Nullam pellentesque neque
|
|
88
|
+
vel nisi venenatis, ac dignissim sapien condimentum.
|
|
89
|
+
Aenean ornare, ante non auctor facilisis, est libero
|
|
90
|
+
commodo nulla, euismod vehicula massa enim efficitur
|
|
91
|
+
orci.
|
|
92
|
+
</p>
|
|
93
|
+
<p>
|
|
94
|
+
Morbi vitae pellentesque lorem, a porta elit. Nulla
|
|
95
|
+
nibh mi, hendrerit id urna in, commodo pellentesque
|
|
96
|
+
dui. Nullam pellentesque neque vel nisi venenatis,
|
|
97
|
+
ac dignissim sapien condimentum. Aenean ornare, ante
|
|
98
|
+
non auctor facilisis, est libero commodo nulla,
|
|
99
|
+
euismod vehicula massa enim efficitur orci. Nulla
|
|
100
|
+
quis lorem quis nulla auctor congue. Pellentesque
|
|
101
|
+
volutpat eget libero nec volutpat. Donec malesuada
|
|
102
|
+
metus odio, nec scelerisque libero convallis eu.
|
|
103
|
+
</p>
|
|
104
|
+
<p>
|
|
105
|
+
Nulla quis lorem quis nulla auctor congue.
|
|
106
|
+
Pellentesque volutpat eget libero nec volutpat.
|
|
107
|
+
Donec malesuada metus odio, nec scelerisque libero
|
|
108
|
+
convallis eu. Morbi vitae pellentesque lorem, a
|
|
109
|
+
porta elit. Nulla nibh mi, hendrerit id urna in,
|
|
110
|
+
commodo pellentesque dui. Nullam pellentesque neque
|
|
111
|
+
vel nisi venenatis, ac dignissim sapien condimentum.
|
|
112
|
+
Aenean ornare, ante non auctor facilisis, est libero
|
|
113
|
+
commodo nulla, euismod vehicula massa enim efficitur
|
|
114
|
+
orci.
|
|
115
|
+
</p>
|
|
116
|
+
</ModalContent>
|
|
117
|
+
</Modal>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const NoContentPadding = () => {
|
|
124
|
+
const [isOpen, setOpen] = useState(false);
|
|
125
|
+
|
|
126
|
+
const onToggle = () => {
|
|
127
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<div className="ModalNoContentPadding">
|
|
132
|
+
<Button color="primary" onClick={onToggle}>
|
|
133
|
+
Open Modal with No Content Padding
|
|
134
|
+
</Button>
|
|
135
|
+
{isOpen && (
|
|
136
|
+
<Modal title="Modal Title" onHidden={onToggle}>
|
|
137
|
+
<ModalContent noPadding>
|
|
138
|
+
<p>This is the modal has no content padding.</p>
|
|
139
|
+
</ModalContent>
|
|
140
|
+
</Modal>
|
|
141
|
+
)}
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const HtmlContent = () => {
|
|
147
|
+
const [isOpen, setOpen] = useState(false);
|
|
148
|
+
|
|
149
|
+
const onToggle = () => {
|
|
150
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<div className="ModalHtml">
|
|
155
|
+
<Button color="primary" onClick={onToggle}>
|
|
156
|
+
Open Modal with HTML
|
|
157
|
+
</Button>
|
|
158
|
+
{isOpen && (
|
|
159
|
+
<Modal title="Modal Title" onHidden={onToggle}>
|
|
160
|
+
<ModalContent html="<p>This is some HTML modal content.</p>" />
|
|
161
|
+
</Modal>
|
|
162
|
+
)}
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const HtmlContentError = () => {
|
|
168
|
+
const [isOpen, setOpen] = useState(false);
|
|
169
|
+
|
|
170
|
+
const onToggle = () => {
|
|
171
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
<div className="ModalHtmlError">
|
|
176
|
+
<Button color="primary" onClick={onToggle}>
|
|
177
|
+
Open Modal with HTML Error
|
|
178
|
+
</Button>
|
|
179
|
+
{isOpen && (
|
|
180
|
+
<Modal title="Modal Title" onHidden={onToggle}>
|
|
181
|
+
<ErrorBoundary>
|
|
182
|
+
<ModalContent html="<p>This is some HTML modal content.</p>">
|
|
183
|
+
<p>This is the modal content.</p>
|
|
184
|
+
</ModalContent>
|
|
185
|
+
</ErrorBoundary>
|
|
186
|
+
</Modal>
|
|
187
|
+
)}
|
|
188
|
+
</div>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const MultipleModals = () => {
|
|
193
|
+
const [isOpen, setOpen] = useState(false);
|
|
194
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
195
|
+
|
|
196
|
+
const onToggle = () => {
|
|
197
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const onRemoveIndex = () => {
|
|
201
|
+
setActiveIndex(0);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const onIndexSelected = evt => {
|
|
205
|
+
const newIndex = parseInt(DOMUtils.attr(evt.target, 'data-next'), 10);
|
|
206
|
+
|
|
207
|
+
setActiveIndex(newIndex);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
return (
|
|
211
|
+
<div className="ModalMultiple">
|
|
212
|
+
<Button color="primary" onClick={onToggle}>
|
|
213
|
+
Open Multi-Content Modal
|
|
214
|
+
</Button>
|
|
215
|
+
{isOpen && (
|
|
216
|
+
<Modal
|
|
217
|
+
title="Modal Title"
|
|
218
|
+
activeContentIndex={activeIndex}
|
|
219
|
+
onRemoveIndex={onRemoveIndex}
|
|
220
|
+
onHidden={onToggle}
|
|
221
|
+
>
|
|
222
|
+
{activeIndex === 0 ? (
|
|
223
|
+
<ModalContent className="ModalContent-0">
|
|
224
|
+
<p>This is content index 0.</p>
|
|
225
|
+
<Button
|
|
226
|
+
className="ModalContent-see-more"
|
|
227
|
+
color="primary"
|
|
228
|
+
data-next={1}
|
|
229
|
+
onClick={onIndexSelected}
|
|
230
|
+
>
|
|
231
|
+
See More Content
|
|
232
|
+
</Button>
|
|
233
|
+
</ModalContent>
|
|
234
|
+
) : null}
|
|
235
|
+
{activeIndex === 1 ? (
|
|
236
|
+
<ModalContent className="ModalContent-1">
|
|
237
|
+
<p>This is content index 1.</p>
|
|
238
|
+
<Button
|
|
239
|
+
className="ModalContent-back"
|
|
240
|
+
color="primary"
|
|
241
|
+
data-next={0}
|
|
242
|
+
onClick={onIndexSelected}
|
|
243
|
+
>
|
|
244
|
+
Go Back
|
|
245
|
+
</Button>
|
|
246
|
+
</ModalContent>
|
|
247
|
+
) : null}
|
|
248
|
+
</Modal>
|
|
249
|
+
)}
|
|
250
|
+
</div>
|
|
251
|
+
);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export const WithStartIndex = () => {
|
|
255
|
+
const [isOpen, setOpen] = useState(false);
|
|
256
|
+
const [activeIndex, setActiveIndex] = useState(1);
|
|
257
|
+
|
|
258
|
+
const onToggle = () => {
|
|
259
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
const onRemoveIndex = () => {
|
|
263
|
+
setActiveIndex(0);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const onIndexSelected = evt => {
|
|
267
|
+
const newIndex = parseInt(DOMUtils.attr(evt.target, 'data-next'), 10);
|
|
268
|
+
|
|
269
|
+
setActiveIndex(newIndex);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
return (
|
|
273
|
+
<div className="ModalStartIndex">
|
|
274
|
+
<Button color="primary" onClick={onToggle}>
|
|
275
|
+
Open Multi-Content Modal with Start Index
|
|
276
|
+
</Button>
|
|
277
|
+
{isOpen && (
|
|
278
|
+
<Modal
|
|
279
|
+
title="Modal Title"
|
|
280
|
+
activeContentIndex={activeIndex}
|
|
281
|
+
onRemoveIndex={onRemoveIndex}
|
|
282
|
+
onHidden={onToggle}
|
|
283
|
+
>
|
|
284
|
+
{activeIndex === 0 ? (
|
|
285
|
+
<ModalContent className="ModalContent-0">
|
|
286
|
+
<p>This is content index 0.</p>
|
|
287
|
+
<Button
|
|
288
|
+
className="ModalContent-see-more"
|
|
289
|
+
color="primary"
|
|
290
|
+
data-next={1}
|
|
291
|
+
onClick={onIndexSelected}
|
|
292
|
+
>
|
|
293
|
+
See More Content
|
|
294
|
+
</Button>
|
|
295
|
+
</ModalContent>
|
|
296
|
+
) : null}
|
|
297
|
+
{activeIndex === 1 ? (
|
|
298
|
+
<ModalContent className="ModalContent-1">
|
|
299
|
+
<p>This is content index 1.</p>
|
|
300
|
+
<Button
|
|
301
|
+
className="ModalContent-back"
|
|
302
|
+
color="primary"
|
|
303
|
+
data-next={0}
|
|
304
|
+
onClick={onIndexSelected}
|
|
305
|
+
>
|
|
306
|
+
Go Back
|
|
307
|
+
</Button>
|
|
308
|
+
</ModalContent>
|
|
309
|
+
) : null}
|
|
310
|
+
</Modal>
|
|
311
|
+
)}
|
|
312
|
+
</div>
|
|
313
|
+
);
|
|
314
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import React, {useState} from 'react';
|
|
2
|
+
import Button from 'v1/components/Button/Button';
|
|
3
|
+
import Modal from '../Modal';
|
|
4
|
+
import ModalContent from '../ModalContent';
|
|
5
|
+
import ReduxConsumer from './helpers/ReduxConsumer';
|
|
6
|
+
import {createStore} from 'redux';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
component: Modal,
|
|
10
|
+
title: 'v1/Modal/Display',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const initialState = {
|
|
14
|
+
items: 'Redux items here!',
|
|
15
|
+
};
|
|
16
|
+
const items = (state = initialState) => {
|
|
17
|
+
return state;
|
|
18
|
+
};
|
|
19
|
+
const store = createStore(items);
|
|
20
|
+
|
|
21
|
+
export const Default = () => {
|
|
22
|
+
const [isOpen, setOpen] = useState(false);
|
|
23
|
+
|
|
24
|
+
const onToggle = () => {
|
|
25
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div className="ModalDefault">
|
|
30
|
+
<Button color="primary" onClick={onToggle}>
|
|
31
|
+
Open Modal
|
|
32
|
+
</Button>
|
|
33
|
+
{isOpen && (
|
|
34
|
+
<Modal
|
|
35
|
+
title="Modal Title"
|
|
36
|
+
onHidden={onToggle}
|
|
37
|
+
// eslint-disable-next-line react/jsx-handler-names
|
|
38
|
+
onShown={window.onModalShown}
|
|
39
|
+
// eslint-disable-next-line react/jsx-handler-names
|
|
40
|
+
onCloseClick={window.onCloseClick}
|
|
41
|
+
>
|
|
42
|
+
<ModalContent>
|
|
43
|
+
<p>This is the modal content.</p>
|
|
44
|
+
</ModalContent>
|
|
45
|
+
</Modal>
|
|
46
|
+
)}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const InsideElement = () => {
|
|
52
|
+
const [isOpen, setOpen] = useState(false);
|
|
53
|
+
|
|
54
|
+
const onToggle = () => {
|
|
55
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<div className="ModalInElement">
|
|
60
|
+
<Button color="primary" onClick={onToggle}>
|
|
61
|
+
Open Modal Inside of Element
|
|
62
|
+
</Button>
|
|
63
|
+
<div className="ModalInElement-container">
|
|
64
|
+
{isOpen && (
|
|
65
|
+
<Modal
|
|
66
|
+
title="Modal Title"
|
|
67
|
+
renderInBody={false}
|
|
68
|
+
onHidden={onToggle}
|
|
69
|
+
>
|
|
70
|
+
<ModalContent>
|
|
71
|
+
<p>
|
|
72
|
+
This modal is inside of an element and not on
|
|
73
|
+
the body.
|
|
74
|
+
</p>
|
|
75
|
+
</ModalContent>
|
|
76
|
+
</Modal>
|
|
77
|
+
)}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const NoTitle = () => {
|
|
84
|
+
const [isOpen, setOpen] = useState(false);
|
|
85
|
+
|
|
86
|
+
const onToggle = () => {
|
|
87
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div className="ModalNoTitle">
|
|
92
|
+
<Button color="primary" onClick={onToggle}>
|
|
93
|
+
Open Modal with No Title
|
|
94
|
+
</Button>
|
|
95
|
+
{isOpen && (
|
|
96
|
+
<Modal onHidden={onToggle}>
|
|
97
|
+
<ModalContent>
|
|
98
|
+
<p>This modal has no title.</p>
|
|
99
|
+
</ModalContent>
|
|
100
|
+
</Modal>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const NoCloseButton = () => {
|
|
107
|
+
const [isOpen, setOpen] = useState(false);
|
|
108
|
+
|
|
109
|
+
const onToggle = () => {
|
|
110
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<div className="ModalNoClose">
|
|
115
|
+
<Button color="primary" onClick={onToggle}>
|
|
116
|
+
Open Modal with No Close Button
|
|
117
|
+
</Button>
|
|
118
|
+
{isOpen && (
|
|
119
|
+
<Modal
|
|
120
|
+
title="Modal Title"
|
|
121
|
+
showClose={false}
|
|
122
|
+
onHidden={onToggle}
|
|
123
|
+
>
|
|
124
|
+
<ModalContent>
|
|
125
|
+
<p>This modal has no close button.</p>
|
|
126
|
+
</ModalContent>
|
|
127
|
+
</Modal>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const NoShim = () => {
|
|
134
|
+
const [isOpen, setOpen] = useState(false);
|
|
135
|
+
|
|
136
|
+
const onToggle = () => {
|
|
137
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<div className="ModalNoShim">
|
|
142
|
+
<Button color="primary" onClick={onToggle}>
|
|
143
|
+
Open Modal with No Shim
|
|
144
|
+
</Button>
|
|
145
|
+
{isOpen && (
|
|
146
|
+
<Modal title="Modal Title" useShim={false} onHidden={onToggle}>
|
|
147
|
+
<ModalContent>
|
|
148
|
+
<p>This modal has no shim.</p>
|
|
149
|
+
</ModalContent>
|
|
150
|
+
</Modal>
|
|
151
|
+
)}
|
|
152
|
+
</div>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const WithRedux = () => {
|
|
157
|
+
const [isOpen, setOpen] = useState(false);
|
|
158
|
+
|
|
159
|
+
const onToggle = () => {
|
|
160
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<div className="ModalRedux">
|
|
165
|
+
<Button color="primary" onClick={onToggle}>
|
|
166
|
+
Open Modal with Redux
|
|
167
|
+
</Button>
|
|
168
|
+
{isOpen && (
|
|
169
|
+
<Modal title="Redux Modal" store={store} onHidden={onToggle}>
|
|
170
|
+
<ModalContent>
|
|
171
|
+
<ReduxConsumer />
|
|
172
|
+
</ModalContent>
|
|
173
|
+
</Modal>
|
|
174
|
+
)}
|
|
175
|
+
</div>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const FullScreenOnMobile = () => {
|
|
180
|
+
const [isOpen, setOpen] = useState(false);
|
|
181
|
+
|
|
182
|
+
const onToggle = () => {
|
|
183
|
+
setOpen(prevIsOpen => !prevIsOpen);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<div className="ModalDefault">
|
|
188
|
+
<Button color="primary" onClick={onToggle}>
|
|
189
|
+
Open Modal
|
|
190
|
+
</Button>
|
|
191
|
+
{isOpen && (
|
|
192
|
+
<Modal
|
|
193
|
+
title="Modal Title"
|
|
194
|
+
fullScreenOnMobile
|
|
195
|
+
onHidden={onToggle}
|
|
196
|
+
// eslint-disable-next-line react/jsx-handler-names
|
|
197
|
+
onShown={window.onModalShown}
|
|
198
|
+
// eslint-disable-next-line react/jsx-handler-names
|
|
199
|
+
onCloseClick={window.onCloseClick}
|
|
200
|
+
>
|
|
201
|
+
<ModalContent>
|
|
202
|
+
<p>This is the modal content.</p>
|
|
203
|
+
</ModalContent>
|
|
204
|
+
</Modal>
|
|
205
|
+
)}
|
|
206
|
+
</div>
|
|
207
|
+
);
|
|
208
|
+
};
|