@spothero/ui 16.0.0-beta.0 → 16.0.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 +0 -1
- package/babel.config.js +1 -0
- package/jest.config.json +3 -0
- package/package.json +7 -6
- package/v2/index.js +1 -1
- package/v2/index.js.map +1 -1
- package/styles/components/Accordion/Accordion.jsx +0 -1
- package/styles/components/Accordion/Accordion.stories.js +0 -103
- package/styles/components/Accordion/index.js +0 -7
- package/styles/components/Accordion/styles/button.js +0 -16
- package/styles/components/Accordion/styles/container.js +0 -9
- package/styles/components/Accordion/styles/index.js +0 -19
- package/styles/components/Accordion/styles/panel.js +0 -7
- package/styles/components/Alert/Alert.jsx +0 -121
- package/styles/components/Alert/Alert.stories.js +0 -50
- package/styles/components/Alert/index.js +0 -1
- package/styles/components/Alert/styles/index.js +0 -166
- package/styles/components/AutoSuggestSelect/AutoSuggestSelect.jsx +0 -194
- package/styles/components/AutoSuggestSelect/index.js +0 -1
- package/styles/components/Badge/Badge.jsx +0 -1
- package/styles/components/Badge/Badge.stories.js +0 -32
- package/styles/components/Badge/styles/index.js +0 -29
- package/styles/components/Button/Button.jsx +0 -31
- package/styles/components/Button/Button.spec.js +0 -29
- package/styles/components/Button/Button.styles.js +0 -156
- package/styles/components/Button/button-props.js +0 -66
- package/styles/components/Button/index.js +0 -2
- package/styles/components/Button/stories/button.js +0 -59
- package/styles/components/Button/stories/index.stories.js +0 -82
- package/styles/components/Button/stories/overview.js +0 -73
- package/styles/components/Card/Card.jsx +0 -16
- package/styles/components/Card/Card.stories.js +0 -33
- package/styles/components/Checkbox/Checkbox.jsx +0 -1
- package/styles/components/Checkbox/Checkbox.stories.js +0 -41
- package/styles/components/Checkbox/index.js +0 -1
- package/styles/components/Checkbox/styles/index.js +0 -31
- package/styles/components/Container/Container.jsx +0 -10
- package/styles/components/Container/Container.stories.js +0 -52
- package/styles/components/Container/Container.styles.js +0 -11
- package/styles/components/Divider/Divider.jsx +0 -31
- package/styles/components/Divider/Divider.stories.js +0 -41
- package/styles/components/Divider/Divider.styles.js +0 -15
- package/styles/components/FormControl/FormControl.jsx +0 -79
- package/styles/components/Grid/Grid.jsx +0 -25
- package/styles/components/Grid/Grid.stories.js +0 -128
- package/styles/components/Grid/Grid.styles.js +0 -12
- package/styles/components/Grid/GridItem.jsx +0 -10
- package/styles/components/Grid/GridItem.styles.js +0 -8
- package/styles/components/Grid/index.js +0 -2
- package/styles/components/Heading/Heading.jsx +0 -23
- package/styles/components/Heading/Heading.stories.js +0 -40
- package/styles/components/Heading/Heading.styles.js +0 -61
- package/styles/components/Icon/Icon.jsx +0 -1
- package/styles/components/Icon/Icon.stories.js +0 -38
- package/styles/components/Image/Image.jsx +0 -118
- package/styles/components/Image/Image.spec.js +0 -100
- package/styles/components/Image/Image.stories.js +0 -142
- package/styles/components/Input/Input.jsx +0 -51
- package/styles/components/Input/Input.stories.js +0 -60
- package/styles/components/Input/index.js +0 -1
- package/styles/components/Input/styles/index.js +0 -49
- package/styles/components/Link/Link.jsx +0 -1
- package/styles/components/Link/Link.stories.js +0 -82
- package/styles/components/Link/Link.styles.js +0 -38
- package/styles/components/List/List.jsx +0 -57
- package/styles/components/List/List.stories.js +0 -96
- package/styles/components/List/index.js +0 -2
- package/styles/components/List/styles/index.js +0 -12
- package/styles/components/List/styles/item.styles.js +0 -5
- package/styles/components/Loader/Loader.jsx +0 -75
- package/styles/components/Loader/Loader.stories.js +0 -145
- package/styles/components/Modal/Modal.jsx +0 -70
- package/styles/components/Modal/Modal.stories.js +0 -278
- package/styles/components/Modal/index.js +0 -1
- package/styles/components/Modal/styles/body.js +0 -24
- package/styles/components/Modal/styles/closeButton.js +0 -17
- package/styles/components/Modal/styles/dialog.js +0 -10
- package/styles/components/Modal/styles/dialogContainer.js +0 -10
- package/styles/components/Modal/styles/footer.js +0 -5
- package/styles/components/Modal/styles/header.js +0 -7
- package/styles/components/Modal/styles/index.js +0 -47
- package/styles/components/Modal/styles/overlay.js +0 -4
- package/styles/components/Popover/Popover.jsx +0 -28
- package/styles/components/Popover/Popover.stories.js +0 -113
- package/styles/components/Popover/PopoverArrow.jsx +0 -10
- package/styles/components/Popover/PopoverCloseButton.jsx +0 -10
- package/styles/components/Popover/PopoverContent.jsx +0 -41
- package/styles/components/Popover/index.js +0 -3
- package/styles/components/Popover/styles/index.js +0 -21
- package/styles/components/Popover/styles/popover-arrow.js +0 -5
- package/styles/components/Popover/styles/popover-body.js +0 -5
- package/styles/components/Popover/styles/popover-close-button.js +0 -17
- package/styles/components/Popover/styles/popover-content.js +0 -16
- package/styles/components/Popover/styles/popover-header.js +0 -6
- package/styles/components/Popover/styles/popper.js +0 -5
- package/styles/components/Radio/Radio.jsx +0 -50
- package/styles/components/Radio/Radio.stories.js +0 -155
- package/styles/components/Radio/RadioGroup.jsx +0 -69
- package/styles/components/Radio/index.js +0 -2
- package/styles/components/Radio/styles/index.js +0 -52
- package/styles/components/Select/Select.jsx +0 -62
- package/styles/components/Select/Select.stories.js +0 -60
- package/styles/components/Select/index.js +0 -1
- package/styles/components/Select/styles/index.js +0 -29
- package/styles/components/Skeleton/Skeleton.stories.jsx +0 -34
- package/styles/components/Skeleton/Skeleton.styles.js +0 -3
- package/styles/components/Skeleton/index.js +0 -1
- package/styles/components/Spinner/Spinner.jsx +0 -40
- package/styles/components/Spinner/Spinner.stories.js +0 -98
- package/styles/components/Spinner/Spinner.styles.js +0 -57
- package/styles/components/Switch/Switch.jsx +0 -52
- package/styles/components/Switch/Switch.stories.js +0 -88
- package/styles/components/Switch/index.js +0 -1
- package/styles/components/Switch/styles/index.js +0 -17
- package/styles/components/Table/Table.jsx +0 -1
- package/styles/components/Table/Table.stories.js +0 -90
- package/styles/components/Table/Table.styles.js +0 -66
- package/styles/components/Table/index.js +0 -2
- package/styles/components/Tabs/Tabs.jsx +0 -38
- package/styles/components/Tabs/Tabs.stories.js +0 -47
- package/styles/components/Tabs/combineSizeWithVariant.js +0 -31
- package/styles/components/Tabs/index.js +0 -2
- package/styles/components/Tabs/styles/index.js +0 -40
- package/styles/components/Text/Text.jsx +0 -35
- package/styles/components/Text/Text.stories.js +0 -47
- package/styles/components/Text/Text.styles.js +0 -33
- package/styles/components/Text/combineAsWithVariant.js +0 -106
- package/styles/components/Text/options.js +0 -92
- package/styles/components/ThemeProvider/ThemeProvider.jsx +0 -39
- package/styles/components/ThemeProvider/ThemeProvider.stories.js +0 -85
- package/styles/theme/base/breakpoints.js +0 -16
- package/styles/theme/base/colors.js +0 -136
- package/styles/theme/base/index.js +0 -5
- package/styles/theme/base/sizes.js +0 -48
- package/styles/theme/base/typography.js +0 -24
- package/styles/theme/base/zindices.js +0 -17
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
import React, {useState} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Box, useBreakpointValue} from '@chakra-ui/react';
|
|
4
|
-
import disableArgs from 'storybook/utils/disable-args';
|
|
5
|
-
import {createSelectControl} from 'storybook/utils/create-control';
|
|
6
|
-
|
|
7
|
-
import {Modal} from './index';
|
|
8
|
-
import Button from 'components/Button/Button';
|
|
9
|
-
import Text from 'components/Text/Text';
|
|
10
|
-
import Heading from 'components/Heading/Heading';
|
|
11
|
-
import Accordion, {
|
|
12
|
-
AccordionIcon,
|
|
13
|
-
AccordionItem,
|
|
14
|
-
AccordionPanel,
|
|
15
|
-
AccordionButton,
|
|
16
|
-
} from 'components/Accordion';
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
title: 'v2/Modal',
|
|
20
|
-
component: Modal,
|
|
21
|
-
parameters: {
|
|
22
|
-
importBy: 'Modal',
|
|
23
|
-
removeBaseHtmlClass: true,
|
|
24
|
-
chakraLink: 'https://chakra-ui.com/docs/overlay/Modal',
|
|
25
|
-
},
|
|
26
|
-
argTypes: {
|
|
27
|
-
...createSelectControl('size', ['sm', 'md', 'lg']),
|
|
28
|
-
...disableArgs(['isOpen', 'onClose', 'footer']),
|
|
29
|
-
hideCloseButton: {
|
|
30
|
-
control: {
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
header: {
|
|
35
|
-
control: {type: 'text'},
|
|
36
|
-
},
|
|
37
|
-
children: {
|
|
38
|
-
control: {type: 'text'},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
args: {
|
|
42
|
-
size: 'md',
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const Transactional = props => {
|
|
47
|
-
const [open, setOpen] = useState(false);
|
|
48
|
-
const isMobile = useBreakpointValue({base: true, tablet: false});
|
|
49
|
-
|
|
50
|
-
return (
|
|
51
|
-
<Box>
|
|
52
|
-
<Text marginBottom={2}>
|
|
53
|
-
A "Transactional" modal just refers to one with a{' '}
|
|
54
|
-
<code>footer</code> prop.
|
|
55
|
-
</Text>
|
|
56
|
-
<Button onClick={() => setOpen(true)}>Open Modal</Button>
|
|
57
|
-
|
|
58
|
-
<Modal
|
|
59
|
-
{...props}
|
|
60
|
-
footer={
|
|
61
|
-
<>
|
|
62
|
-
<Button
|
|
63
|
-
onClick={() => setOpen(false)}
|
|
64
|
-
variant="secondary"
|
|
65
|
-
marginRight={4}
|
|
66
|
-
>
|
|
67
|
-
Cancel
|
|
68
|
-
</Button>
|
|
69
|
-
<Button
|
|
70
|
-
onClick={() => setOpen(false)}
|
|
71
|
-
variant="primary"
|
|
72
|
-
>
|
|
73
|
-
Submit
|
|
74
|
-
</Button>
|
|
75
|
-
</>
|
|
76
|
-
}
|
|
77
|
-
isMobile={isMobile}
|
|
78
|
-
isOpen={open}
|
|
79
|
-
onClose={() => setOpen(false)}
|
|
80
|
-
>
|
|
81
|
-
{props.children}
|
|
82
|
-
</Modal>
|
|
83
|
-
</Box>
|
|
84
|
-
);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
Transactional.propTypes = {
|
|
88
|
-
children: PropTypes.string,
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
Transactional.args = {
|
|
92
|
-
header: 'Transactional',
|
|
93
|
-
children:
|
|
94
|
-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tincidunt lectus et mauris viverra, nec tincidunt arcu rhoncus. Duis pellentesque vestibulum orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero. orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero.',
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const Passive = props => {
|
|
98
|
-
const [open, setOpen] = useState(false);
|
|
99
|
-
const isMobile = useBreakpointValue({base: true, tablet: false});
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<Box>
|
|
103
|
-
<Text marginBottom={2}>
|
|
104
|
-
A "Passive" modal just refers to one with no{' '}
|
|
105
|
-
<code>footer</code> prop.
|
|
106
|
-
</Text>
|
|
107
|
-
<Button onClick={() => setOpen(true)}>Open Modal</Button>
|
|
108
|
-
|
|
109
|
-
<Modal {...props} isMobile={isMobile} isOpen={open} onClose={() => setOpen(false)}>
|
|
110
|
-
{props.children}
|
|
111
|
-
</Modal>
|
|
112
|
-
</Box>
|
|
113
|
-
);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
Passive.propTypes = {
|
|
117
|
-
children: PropTypes.string,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
Passive.args = {
|
|
121
|
-
header: 'Passive',
|
|
122
|
-
children:
|
|
123
|
-
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tincidunt lectus et mauris viverra, nec tincidunt arcu rhoncus. Duis pellentesque vestibulum orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero. orci ut mattis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis vel malesuada ligula. Cras dapibus enim sem. Suspendisse potenti. Mauris tempus non tortor eu placerat. Pellentesque faucibus dui vitae purus iaculis, ac convallis turpis gravida. Ut ac massa pretium, finibus quam vitae, aliquet libero.',
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export const TransactionalWithExpandingContent = props => {
|
|
127
|
-
const [open, setOpen] = useState(false);
|
|
128
|
-
const accordionRefs = [React.createRef(), React.createRef()];
|
|
129
|
-
const isMobile = useBreakpointValue({base: true, tablet: false});
|
|
130
|
-
|
|
131
|
-
const handleAccordionChange = index => {
|
|
132
|
-
if (accordionRefs[index]) {
|
|
133
|
-
// Timeout so that scroll doesn't happen until accordion animation complete
|
|
134
|
-
setTimeout(() => {
|
|
135
|
-
accordionRefs[index].current.scrollIntoView({
|
|
136
|
-
behavior: 'smooth',
|
|
137
|
-
block: 'start',
|
|
138
|
-
});
|
|
139
|
-
}, 150);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
return (
|
|
144
|
-
<Box>
|
|
145
|
-
<Text marginBottom={2}>
|
|
146
|
-
When content inside a modal dynamically expands, the modal
|
|
147
|
-
should scroll to that new content.
|
|
148
|
-
</Text>
|
|
149
|
-
<Text marginBottom={2}>
|
|
150
|
-
However, this is something we'll need to implement on a
|
|
151
|
-
case by case basis when it applies.
|
|
152
|
-
</Text>
|
|
153
|
-
<Text marginBottom={2}>
|
|
154
|
-
Feel free to check the code of this demo to see an example of
|
|
155
|
-
how we might do that.
|
|
156
|
-
</Text>
|
|
157
|
-
<Button onClick={() => setOpen(true)}>Open Modal</Button>
|
|
158
|
-
|
|
159
|
-
<Modal
|
|
160
|
-
{...props}
|
|
161
|
-
header="Transactional with Expanding Content"
|
|
162
|
-
footer={
|
|
163
|
-
<>
|
|
164
|
-
<Button
|
|
165
|
-
onClick={() => setOpen(false)}
|
|
166
|
-
variant="secondary"
|
|
167
|
-
marginRight={4}
|
|
168
|
-
>
|
|
169
|
-
Cancel
|
|
170
|
-
</Button>
|
|
171
|
-
<Button variant="primary">Submit</Button>
|
|
172
|
-
</>
|
|
173
|
-
}
|
|
174
|
-
isMobile={isMobile}
|
|
175
|
-
isOpen={open}
|
|
176
|
-
onClose={() => setOpen(false)}
|
|
177
|
-
>
|
|
178
|
-
<Box>
|
|
179
|
-
<Text marginBottom={2}>
|
|
180
|
-
Try opening an Accordion when it is at the very bottom
|
|
181
|
-
of the modal.
|
|
182
|
-
</Text>
|
|
183
|
-
<Text marginBottom={2}>
|
|
184
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
185
|
-
Praesent tincidunt lectus et mauris viverra, nec
|
|
186
|
-
tincidunt arcu rhoncus. Duis pellentesque vestibulum
|
|
187
|
-
orci ut mattis. Class aptent taciti sociosqu ad litora
|
|
188
|
-
torquent per conubia nostra, per inceptos himenaeos.
|
|
189
|
-
Duis vel malesuada ligula. Cras dapibus enim sem.
|
|
190
|
-
Suspendisse potenti. Mauris tempus non tortor eu
|
|
191
|
-
placerat. Pellentesque faucibus dui vitae purus iaculis,
|
|
192
|
-
ac convallis turpis gravida. Ut ac massa pretium,
|
|
193
|
-
finibus quam vitae, aliquet libero. orci ut mattis.
|
|
194
|
-
Class aptent taciti sociosqu ad litora torquent per
|
|
195
|
-
conubia nostra, per inceptos himenaeos. Duis vel
|
|
196
|
-
malesuada ligula. Cras dapibus enim sem. Suspendisse
|
|
197
|
-
potenti. Mauris tempus non tortor eu placerat.
|
|
198
|
-
Pellentesque faucibus dui vitae purus iaculis, ac
|
|
199
|
-
convallis turpis gravida. Ut ac massa pretium, finibus
|
|
200
|
-
quam vitae, aliquet libero.
|
|
201
|
-
</Text>
|
|
202
|
-
<Accordion onChange={handleAccordionChange} allowToggle>
|
|
203
|
-
<AccordionItem ref={accordionRefs[0]}>
|
|
204
|
-
<Heading as="h3">
|
|
205
|
-
<AccordionButton>
|
|
206
|
-
<Box flex="1" textAlign="left">
|
|
207
|
-
Accordion 1
|
|
208
|
-
</Box>
|
|
209
|
-
<AccordionIcon />
|
|
210
|
-
</AccordionButton>
|
|
211
|
-
</Heading>
|
|
212
|
-
<AccordionPanel>
|
|
213
|
-
<Text>
|
|
214
|
-
Lorem ipsum dolor sit amet, consectetur
|
|
215
|
-
adipiscing elit. Praesent tincidunt lectus
|
|
216
|
-
et mauris viverra, nec tincidunt arcu
|
|
217
|
-
rhoncus. Duis pellentesque vestibulum orci
|
|
218
|
-
ut mattis. Class aptent taciti sociosqu ad
|
|
219
|
-
litora torquent per conubia nostra, per
|
|
220
|
-
inceptos himenaeos. Duis vel malesuada
|
|
221
|
-
ligula. Cras dapibus enim sem. Suspendisse
|
|
222
|
-
potenti. Mauris tempus non tortor eu
|
|
223
|
-
placerat. Pellentesque faucibus dui vitae
|
|
224
|
-
purus iaculis, ac convallis turpis gravida.
|
|
225
|
-
Ut ac massa pretium, finibus quam vitae,
|
|
226
|
-
aliquet libero. Aliquam et urna condimentum,
|
|
227
|
-
sagittis nisl hendrerit, elementum velit.
|
|
228
|
-
Nullam quis nisl dictum, suscipit ligula
|
|
229
|
-
nec, elementum libero. Nullam eu lorem
|
|
230
|
-
convallis, dictum nisl in, condimentum dui.
|
|
231
|
-
Lorem ipsum dolor sit amet, consectetur
|
|
232
|
-
adipiscing elit. Viva
|
|
233
|
-
</Text>
|
|
234
|
-
</AccordionPanel>
|
|
235
|
-
</AccordionItem>
|
|
236
|
-
<AccordionItem ref={accordionRefs[1]}>
|
|
237
|
-
<Heading as="h3">
|
|
238
|
-
<AccordionButton>
|
|
239
|
-
<Box flex="1" textAlign="left">
|
|
240
|
-
Accordion 2
|
|
241
|
-
</Box>
|
|
242
|
-
<AccordionIcon />
|
|
243
|
-
</AccordionButton>
|
|
244
|
-
</Heading>
|
|
245
|
-
<AccordionPanel>
|
|
246
|
-
<Text>
|
|
247
|
-
Lorem ipsum dolor sit amet, consectetur
|
|
248
|
-
adipiscing elit. Praesent tincidunt lectus
|
|
249
|
-
et mauris viverra, nec tincidunt arcu
|
|
250
|
-
rhoncus. Duis pellentesque vestibulum orci
|
|
251
|
-
ut mattis. Class aptent taciti sociosqu ad
|
|
252
|
-
litora torquent per conubia nostra, per
|
|
253
|
-
inceptos himenaeos. Duis vel malesuada
|
|
254
|
-
ligula. Cras dapibus enim sem. Suspendisse
|
|
255
|
-
potenti. Mauris tempus non tortor eu
|
|
256
|
-
placerat. Pellentesque faucibus dui vitae
|
|
257
|
-
purus iaculis, ac convallis turpis gravida.
|
|
258
|
-
Ut ac massa pretium, finibus quam vitae,
|
|
259
|
-
aliquet libero. Aliquam et urna condimentum,
|
|
260
|
-
sagittis nisl hendrerit, elementum velit.
|
|
261
|
-
Nullam quis nisl dictum, suscipit ligula
|
|
262
|
-
nec, elementum libero. Nullam eu lorem
|
|
263
|
-
convallis, dictum nisl in, condimentum dui.
|
|
264
|
-
Lorem ipsum dolor sit amet, consectetur
|
|
265
|
-
adipiscing elit. Viva
|
|
266
|
-
</Text>
|
|
267
|
-
</AccordionPanel>
|
|
268
|
-
</AccordionItem>
|
|
269
|
-
</Accordion>
|
|
270
|
-
</Box>
|
|
271
|
-
</Modal>
|
|
272
|
-
</Box>
|
|
273
|
-
);
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
TransactionalWithExpandingContent.argTypes = {
|
|
277
|
-
...disableArgs(['children', 'header']),
|
|
278
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default as Modal} from './Modal';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export default ({footer, header, hideCloseButton}) => {
|
|
2
|
-
const scrollingHeaderStyles =
|
|
3
|
-
header || !hideCloseButton
|
|
4
|
-
? {
|
|
5
|
-
// The following adapted from https://lea.verou.me/2012/04/background-attachment-local/
|
|
6
|
-
background:
|
|
7
|
-
'linear-gradient(white 30%, white), linear-gradient(rgb(0 0 0 / 10%) 0%, white)',
|
|
8
|
-
backgroundRepeat: 'no-repeat',
|
|
9
|
-
backgroundColor: 'white',
|
|
10
|
-
backgroundSize: '100% 30px, 100% 10px',
|
|
11
|
-
backgroundAttachment: 'local, scroll',
|
|
12
|
-
}
|
|
13
|
-
: {};
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
borderBottomRadius: footer ? null : 'md',
|
|
17
|
-
paddingX: 4,
|
|
18
|
-
paddingBottom: 4,
|
|
19
|
-
flex: 1,
|
|
20
|
-
overflow: 'auto',
|
|
21
|
-
display: 'flex',
|
|
22
|
-
...scrollingHeaderStyles,
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default ({header}) => ({
|
|
2
|
-
position: 'absolute',
|
|
3
|
-
top: header ? 4 : 2,
|
|
4
|
-
insetEnd: header ? 4 : 2,
|
|
5
|
-
color: 'gray.dark',
|
|
6
|
-
borderRadius: 'sm',
|
|
7
|
-
width: 8,
|
|
8
|
-
height: 8,
|
|
9
|
-
|
|
10
|
-
_focus: {
|
|
11
|
-
boxShadow: 'outline',
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
_hover: {
|
|
15
|
-
bg: 'gray.50',
|
|
16
|
-
},
|
|
17
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
import overlay from './overlay';
|
|
5
|
-
import dialogContainer from './dialogContainer';
|
|
6
|
-
import dialog from './dialog';
|
|
7
|
-
import header from './header';
|
|
8
|
-
import closeButton from './closeButton';
|
|
9
|
-
import body from './body';
|
|
10
|
-
import footer from './footer';
|
|
11
|
-
|
|
12
|
-
const baseStyle = props => ({
|
|
13
|
-
overlay,
|
|
14
|
-
dialogContainer,
|
|
15
|
-
dialog: dialog(props),
|
|
16
|
-
header: header(props),
|
|
17
|
-
closeButton: closeButton(props),
|
|
18
|
-
body: body(props),
|
|
19
|
-
footer,
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const sizes = {
|
|
23
|
-
sm: {
|
|
24
|
-
dialog: {
|
|
25
|
-
// Would have preferred object syntax here and below, but wasn't working for whatever reason
|
|
26
|
-
maxWidth: ['100%', '100%', '48%', '32%', '24%'],
|
|
27
|
-
maxHeight: ['100%', '100%', '60%', '48%', '32%'],
|
|
28
|
-
minHeight: ['auto', 'auto', '32%', '32%', '24%'],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
md: {
|
|
32
|
-
dialog: {
|
|
33
|
-
maxWidth: ['100%', '100%', '84%', '60%', '48%'],
|
|
34
|
-
maxHeight: ['100%', '100%', '96%', '84%', '60%'],
|
|
35
|
-
minHeight: ['auto', 'auto', '84%', '60%', '48%'],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
lg: {
|
|
39
|
-
dialog: {
|
|
40
|
-
maxWidth: ['100%', '100%', '96%', '84%', '72%'],
|
|
41
|
-
maxHeight: ['100%', '100%', '96%', '96%', '84%'],
|
|
42
|
-
minHeight: ['auto', 'auto', '96%', '84%', '72%'],
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default merge(chakraDefaultTheme.components.Modal, {baseStyle, sizes});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef, cloneElement, Children} from 'react';
|
|
2
|
-
import {Popover as ChakraPopover} from '@chakra-ui/react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
const Popover = forwardRef((props, ref) => {
|
|
6
|
-
const {children, ...rest} = props;
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<ChakraPopover {...rest} ref={ref}>
|
|
10
|
-
{Children.toArray(children).map((child, index) =>
|
|
11
|
-
cloneElement(child, {
|
|
12
|
-
ref,
|
|
13
|
-
variant: props.variant,
|
|
14
|
-
key: `Popover-child-${index}`,
|
|
15
|
-
})
|
|
16
|
-
)}
|
|
17
|
-
</ChakraPopover>
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
Popover.propTypes = {
|
|
22
|
-
/** React children */
|
|
23
|
-
children: PropTypes.node,
|
|
24
|
-
/** Styles the Popover */
|
|
25
|
-
variant: PropTypes.oneOf(['light', 'dark']),
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default Popover;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import disableArgs from 'storybook/utils/disable-args';
|
|
5
|
-
import {createSelectControl} from 'storybook/utils/create-control';
|
|
6
|
-
|
|
7
|
-
import {Popover, PopoverContent, PopoverTrigger} from './index';
|
|
8
|
-
|
|
9
|
-
import {Flex} from '@chakra-ui/react';
|
|
10
|
-
import Button from 'components/Button/Button';
|
|
11
|
-
|
|
12
|
-
export default {
|
|
13
|
-
title: 'v2/Popover',
|
|
14
|
-
component: Popover,
|
|
15
|
-
subcomponents: {
|
|
16
|
-
PopoverContent,
|
|
17
|
-
PopoverTrigger,
|
|
18
|
-
},
|
|
19
|
-
parameters: {
|
|
20
|
-
importBy: 'Popover',
|
|
21
|
-
removeBaseHtmlClass: true,
|
|
22
|
-
chakraLink: 'https://chakra-ui.com/docs/overlay/popover',
|
|
23
|
-
},
|
|
24
|
-
argTypes: {
|
|
25
|
-
...disableArgs('children'),
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const OverviewTemplate = props => (
|
|
30
|
-
<Popover defaultIsOpen {...props}>
|
|
31
|
-
<Flex justifyContent="center" alignItems="center">
|
|
32
|
-
<PopoverTrigger>
|
|
33
|
-
<Button>Trigger</Button>
|
|
34
|
-
</PopoverTrigger>
|
|
35
|
-
</Flex>
|
|
36
|
-
|
|
37
|
-
<PopoverContent header="Confirmation!">
|
|
38
|
-
Are you sure you want to have that milkshake?
|
|
39
|
-
</PopoverContent>
|
|
40
|
-
</Popover>
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
OverviewTemplate.propTypes = {
|
|
44
|
-
variant: PropTypes.oneOf(['light', 'dark']),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const Variant = OverviewTemplate.bind({});
|
|
48
|
-
Variant.argTypes = {
|
|
49
|
-
...createSelectControl('variant', ['light', 'dark']),
|
|
50
|
-
};
|
|
51
|
-
Variant.args = {
|
|
52
|
-
variant: 'light',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export const Placement = OverviewTemplate.bind({});
|
|
56
|
-
Placement.argTypes = {
|
|
57
|
-
...createSelectControl('placement', [
|
|
58
|
-
'top',
|
|
59
|
-
'right',
|
|
60
|
-
'bottom',
|
|
61
|
-
'left',
|
|
62
|
-
'auto',
|
|
63
|
-
'auto-start',
|
|
64
|
-
'auto-end',
|
|
65
|
-
'top-start',
|
|
66
|
-
'top-end',
|
|
67
|
-
'bottom-start',
|
|
68
|
-
'bottom-end',
|
|
69
|
-
'right-start',
|
|
70
|
-
'right-end',
|
|
71
|
-
'left-start',
|
|
72
|
-
'left-end',
|
|
73
|
-
]),
|
|
74
|
-
|
|
75
|
-
...disableArgs('variant'),
|
|
76
|
-
};
|
|
77
|
-
Placement.args = {
|
|
78
|
-
placement: 'bottom',
|
|
79
|
-
};
|
|
80
|
-
const NoHeaderTemplate = props => (
|
|
81
|
-
<Popover defaultIsOpen {...props}>
|
|
82
|
-
<PopoverTrigger>
|
|
83
|
-
<Button>Trigger</Button>
|
|
84
|
-
</PopoverTrigger>
|
|
85
|
-
|
|
86
|
-
<PopoverContent>
|
|
87
|
-
Are you sure you want to have that milkshake?
|
|
88
|
-
</PopoverContent>
|
|
89
|
-
</Popover>
|
|
90
|
-
);
|
|
91
|
-
|
|
92
|
-
export const NoHeader = NoHeaderTemplate.bind({});
|
|
93
|
-
|
|
94
|
-
NoHeader.argTypes = {
|
|
95
|
-
...disableArgs(['variant', 'placement']),
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const NoCloseButtonTemplate = props => (
|
|
99
|
-
<Popover defaultIsOpen {...props}>
|
|
100
|
-
<PopoverTrigger>
|
|
101
|
-
<Button>Trigger</Button>
|
|
102
|
-
</PopoverTrigger>
|
|
103
|
-
|
|
104
|
-
<PopoverContent hideCloseButton header="Confirmation!">
|
|
105
|
-
Are you sure you want to have that milkshake?
|
|
106
|
-
</PopoverContent>
|
|
107
|
-
</Popover>
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
export const NoCloseButton = NoCloseButtonTemplate.bind({});
|
|
111
|
-
NoCloseButton.argTypes = {
|
|
112
|
-
...disableArgs(['variant', 'placement']),
|
|
113
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import {PopoverArrow as ChakraPopoverArrow} from '@chakra-ui/react';
|
|
3
|
-
|
|
4
|
-
import styles from './styles/popover-arrow';
|
|
5
|
-
|
|
6
|
-
const PopoverArrow = forwardRef((props, ref) => {
|
|
7
|
-
return <ChakraPopoverArrow ref={ref} {...props} {...styles(props)} />;
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export default PopoverArrow;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import {PopoverCloseButton as ChakraPopoverCloseButton} from '@chakra-ui/react';
|
|
3
|
-
|
|
4
|
-
import styles from './styles/popover-close-button';
|
|
5
|
-
|
|
6
|
-
const PopoverCloseButton = forwardRef((props, ref) => {
|
|
7
|
-
return <ChakraPopoverCloseButton ref={ref} {...props} {...styles(props)} />;
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export default PopoverCloseButton;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
PopoverBody,
|
|
5
|
-
PopoverHeader,
|
|
6
|
-
PopoverContent as ChakraPopoverContent,
|
|
7
|
-
} from '@chakra-ui/react';
|
|
8
|
-
|
|
9
|
-
import PopoverArrow from './PopoverArrow';
|
|
10
|
-
import PopoverCloseButton from './PopoverCloseButton';
|
|
11
|
-
|
|
12
|
-
const PopoverContent = forwardRef((props, ref) => {
|
|
13
|
-
const {header, variant, children, hideCloseButton, ...rest} = props;
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<ChakraPopoverContent {...rest} ref={ref}>
|
|
17
|
-
<PopoverArrow variant={variant} />
|
|
18
|
-
{hideCloseButton ? null : <PopoverCloseButton variant={variant} />}
|
|
19
|
-
{header ? <PopoverHeader>{header}</PopoverHeader> : null}
|
|
20
|
-
<PopoverBody>{children}</PopoverBody>
|
|
21
|
-
</ChakraPopoverContent>
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
PopoverContent.propTypes = {
|
|
26
|
-
/** React children */
|
|
27
|
-
children: PropTypes.node,
|
|
28
|
-
/** Whether or not to hide the close button */
|
|
29
|
-
hideCloseButton: PropTypes.bool,
|
|
30
|
-
/** Styles the Popover */
|
|
31
|
-
variant: PropTypes.oneOf(['light', 'dark']),
|
|
32
|
-
/** The string or node for the header (optional) */
|
|
33
|
-
header: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
PopoverContent.defaultProps = {
|
|
37
|
-
variant: 'light',
|
|
38
|
-
hideCloseButton: false,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default PopoverContent;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
import popper from './popper';
|
|
5
|
-
import body from './popover-body';
|
|
6
|
-
import header from './popover-header';
|
|
7
|
-
import content from './popover-content';
|
|
8
|
-
|
|
9
|
-
const parts = ['popper', 'content', 'header', 'body'];
|
|
10
|
-
|
|
11
|
-
const baseStyle = props => ({
|
|
12
|
-
header,
|
|
13
|
-
content: content(props),
|
|
14
|
-
body: body(props),
|
|
15
|
-
popper,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export default merge(chakraDefaultTheme.components.Popover, {
|
|
19
|
-
parts,
|
|
20
|
-
baseStyle,
|
|
21
|
-
});
|