@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.
Files changed (136) hide show
  1. package/.eslintignore +0 -1
  2. package/babel.config.js +1 -0
  3. package/jest.config.json +3 -0
  4. package/package.json +7 -6
  5. package/v2/index.js +1 -1
  6. package/v2/index.js.map +1 -1
  7. package/styles/components/Accordion/Accordion.jsx +0 -1
  8. package/styles/components/Accordion/Accordion.stories.js +0 -103
  9. package/styles/components/Accordion/index.js +0 -7
  10. package/styles/components/Accordion/styles/button.js +0 -16
  11. package/styles/components/Accordion/styles/container.js +0 -9
  12. package/styles/components/Accordion/styles/index.js +0 -19
  13. package/styles/components/Accordion/styles/panel.js +0 -7
  14. package/styles/components/Alert/Alert.jsx +0 -121
  15. package/styles/components/Alert/Alert.stories.js +0 -50
  16. package/styles/components/Alert/index.js +0 -1
  17. package/styles/components/Alert/styles/index.js +0 -166
  18. package/styles/components/AutoSuggestSelect/AutoSuggestSelect.jsx +0 -194
  19. package/styles/components/AutoSuggestSelect/index.js +0 -1
  20. package/styles/components/Badge/Badge.jsx +0 -1
  21. package/styles/components/Badge/Badge.stories.js +0 -32
  22. package/styles/components/Badge/styles/index.js +0 -29
  23. package/styles/components/Button/Button.jsx +0 -31
  24. package/styles/components/Button/Button.spec.js +0 -29
  25. package/styles/components/Button/Button.styles.js +0 -156
  26. package/styles/components/Button/button-props.js +0 -66
  27. package/styles/components/Button/index.js +0 -2
  28. package/styles/components/Button/stories/button.js +0 -59
  29. package/styles/components/Button/stories/index.stories.js +0 -82
  30. package/styles/components/Button/stories/overview.js +0 -73
  31. package/styles/components/Card/Card.jsx +0 -16
  32. package/styles/components/Card/Card.stories.js +0 -33
  33. package/styles/components/Checkbox/Checkbox.jsx +0 -1
  34. package/styles/components/Checkbox/Checkbox.stories.js +0 -41
  35. package/styles/components/Checkbox/index.js +0 -1
  36. package/styles/components/Checkbox/styles/index.js +0 -31
  37. package/styles/components/Container/Container.jsx +0 -10
  38. package/styles/components/Container/Container.stories.js +0 -52
  39. package/styles/components/Container/Container.styles.js +0 -11
  40. package/styles/components/Divider/Divider.jsx +0 -31
  41. package/styles/components/Divider/Divider.stories.js +0 -41
  42. package/styles/components/Divider/Divider.styles.js +0 -15
  43. package/styles/components/FormControl/FormControl.jsx +0 -79
  44. package/styles/components/Grid/Grid.jsx +0 -25
  45. package/styles/components/Grid/Grid.stories.js +0 -128
  46. package/styles/components/Grid/Grid.styles.js +0 -12
  47. package/styles/components/Grid/GridItem.jsx +0 -10
  48. package/styles/components/Grid/GridItem.styles.js +0 -8
  49. package/styles/components/Grid/index.js +0 -2
  50. package/styles/components/Heading/Heading.jsx +0 -23
  51. package/styles/components/Heading/Heading.stories.js +0 -40
  52. package/styles/components/Heading/Heading.styles.js +0 -61
  53. package/styles/components/Icon/Icon.jsx +0 -1
  54. package/styles/components/Icon/Icon.stories.js +0 -38
  55. package/styles/components/Image/Image.jsx +0 -118
  56. package/styles/components/Image/Image.spec.js +0 -100
  57. package/styles/components/Image/Image.stories.js +0 -142
  58. package/styles/components/Input/Input.jsx +0 -51
  59. package/styles/components/Input/Input.stories.js +0 -60
  60. package/styles/components/Input/index.js +0 -1
  61. package/styles/components/Input/styles/index.js +0 -49
  62. package/styles/components/Link/Link.jsx +0 -1
  63. package/styles/components/Link/Link.stories.js +0 -82
  64. package/styles/components/Link/Link.styles.js +0 -38
  65. package/styles/components/List/List.jsx +0 -57
  66. package/styles/components/List/List.stories.js +0 -96
  67. package/styles/components/List/index.js +0 -2
  68. package/styles/components/List/styles/index.js +0 -12
  69. package/styles/components/List/styles/item.styles.js +0 -5
  70. package/styles/components/Loader/Loader.jsx +0 -75
  71. package/styles/components/Loader/Loader.stories.js +0 -145
  72. package/styles/components/Modal/Modal.jsx +0 -70
  73. package/styles/components/Modal/Modal.stories.js +0 -278
  74. package/styles/components/Modal/index.js +0 -1
  75. package/styles/components/Modal/styles/body.js +0 -24
  76. package/styles/components/Modal/styles/closeButton.js +0 -17
  77. package/styles/components/Modal/styles/dialog.js +0 -10
  78. package/styles/components/Modal/styles/dialogContainer.js +0 -10
  79. package/styles/components/Modal/styles/footer.js +0 -5
  80. package/styles/components/Modal/styles/header.js +0 -7
  81. package/styles/components/Modal/styles/index.js +0 -47
  82. package/styles/components/Modal/styles/overlay.js +0 -4
  83. package/styles/components/Popover/Popover.jsx +0 -28
  84. package/styles/components/Popover/Popover.stories.js +0 -113
  85. package/styles/components/Popover/PopoverArrow.jsx +0 -10
  86. package/styles/components/Popover/PopoverCloseButton.jsx +0 -10
  87. package/styles/components/Popover/PopoverContent.jsx +0 -41
  88. package/styles/components/Popover/index.js +0 -3
  89. package/styles/components/Popover/styles/index.js +0 -21
  90. package/styles/components/Popover/styles/popover-arrow.js +0 -5
  91. package/styles/components/Popover/styles/popover-body.js +0 -5
  92. package/styles/components/Popover/styles/popover-close-button.js +0 -17
  93. package/styles/components/Popover/styles/popover-content.js +0 -16
  94. package/styles/components/Popover/styles/popover-header.js +0 -6
  95. package/styles/components/Popover/styles/popper.js +0 -5
  96. package/styles/components/Radio/Radio.jsx +0 -50
  97. package/styles/components/Radio/Radio.stories.js +0 -155
  98. package/styles/components/Radio/RadioGroup.jsx +0 -69
  99. package/styles/components/Radio/index.js +0 -2
  100. package/styles/components/Radio/styles/index.js +0 -52
  101. package/styles/components/Select/Select.jsx +0 -62
  102. package/styles/components/Select/Select.stories.js +0 -60
  103. package/styles/components/Select/index.js +0 -1
  104. package/styles/components/Select/styles/index.js +0 -29
  105. package/styles/components/Skeleton/Skeleton.stories.jsx +0 -34
  106. package/styles/components/Skeleton/Skeleton.styles.js +0 -3
  107. package/styles/components/Skeleton/index.js +0 -1
  108. package/styles/components/Spinner/Spinner.jsx +0 -40
  109. package/styles/components/Spinner/Spinner.stories.js +0 -98
  110. package/styles/components/Spinner/Spinner.styles.js +0 -57
  111. package/styles/components/Switch/Switch.jsx +0 -52
  112. package/styles/components/Switch/Switch.stories.js +0 -88
  113. package/styles/components/Switch/index.js +0 -1
  114. package/styles/components/Switch/styles/index.js +0 -17
  115. package/styles/components/Table/Table.jsx +0 -1
  116. package/styles/components/Table/Table.stories.js +0 -90
  117. package/styles/components/Table/Table.styles.js +0 -66
  118. package/styles/components/Table/index.js +0 -2
  119. package/styles/components/Tabs/Tabs.jsx +0 -38
  120. package/styles/components/Tabs/Tabs.stories.js +0 -47
  121. package/styles/components/Tabs/combineSizeWithVariant.js +0 -31
  122. package/styles/components/Tabs/index.js +0 -2
  123. package/styles/components/Tabs/styles/index.js +0 -40
  124. package/styles/components/Text/Text.jsx +0 -35
  125. package/styles/components/Text/Text.stories.js +0 -47
  126. package/styles/components/Text/Text.styles.js +0 -33
  127. package/styles/components/Text/combineAsWithVariant.js +0 -106
  128. package/styles/components/Text/options.js +0 -92
  129. package/styles/components/ThemeProvider/ThemeProvider.jsx +0 -39
  130. package/styles/components/ThemeProvider/ThemeProvider.stories.js +0 -85
  131. package/styles/theme/base/breakpoints.js +0 -16
  132. package/styles/theme/base/colors.js +0 -136
  133. package/styles/theme/base/index.js +0 -5
  134. package/styles/theme/base/sizes.js +0 -48
  135. package/styles/theme/base/typography.js +0 -24
  136. package/styles/theme/base/zindices.js +0 -17
@@ -1,82 +0,0 @@
1
- import React from 'react';
2
-
3
- import {Box} from '@chakra-ui/react';
4
- import ShareIcon from '@spothero/icons/share';
5
-
6
- import Text from 'components/Text/Text';
7
- import Component from 'components/Link/Link';
8
-
9
- export default {
10
- title: 'v2/Link',
11
- component: Component,
12
- parameters: {
13
- removeBaseHtmlClass: true,
14
- },
15
- };
16
-
17
- const OverviewTemplate = (props, {hasDarkBackground}) => (
18
- <Box>
19
- <Text
20
- color={
21
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
22
- }
23
- >
24
- A link with{' '}
25
- <Component variant={hasDarkBackground ? 'onDark' : 'standard'}>
26
- no href
27
- </Component>{' '}
28
- is only styled.
29
- </Text>
30
- <Text
31
- color={
32
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
33
- }
34
- >
35
- Links can be linked to{' '}
36
- <Component
37
- href="#"
38
- isExternal
39
- variant={hasDarkBackground ? 'onDark' : 'standard'}
40
- >
41
- External Pages
42
- </Component>{' '}
43
- and will have <code>target=&quot;_blank&quot;</code> and{' '}
44
- <code>rel=&quot;noopener noreferrer&quot;</code> appended to them.
45
- </Text>
46
- <Text
47
- color={
48
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
49
- }
50
- >
51
- Links can have{' '}
52
- <Component
53
- href="#"
54
- variant={hasDarkBackground ? 'onDark' : 'standard'}
55
- >
56
- icons inline <ShareIcon width="1rem" />
57
- </Component>
58
- </Text>
59
- <Text
60
- color={
61
- hasDarkBackground ? 'text.primary.dark' : 'text.primary.light'
62
- }
63
- >
64
- Using the <code>as</code> prop, you can utilize a routing library,
65
- like{' '}
66
- <Component
67
- href="https://chakra-ui.com/docs/navigation/link#usage-with-routing-library"
68
- isExternal
69
- variant={hasDarkBackground ? 'onDark' : 'standard'}
70
- >
71
- React Router
72
- </Component>{' '}
73
- and it will replace the <code>a</code> tag with it&apos;s{' '}
74
- <code>Link</code>.
75
- </Text>
76
- </Box>
77
- );
78
-
79
- export const Overview = OverviewTemplate.bind({});
80
- Overview.parameters = {
81
- importBy: 'Link',
82
- };
@@ -1,38 +0,0 @@
1
- const baseStyle = {
2
- transition: `all 0.15s ease-out`,
3
- color: 'text.link.light',
4
- fontWeight: 'semibold',
5
- _hover: {
6
- color: 'primary.600',
7
- },
8
- _focus: {
9
- boxShadow: 'outline',
10
- },
11
- '& svg': {
12
- d: 'inline-block',
13
- verticalAlign: 'initial',
14
- },
15
- };
16
-
17
- const linkOnDark = {
18
- color: 'text.link.dark',
19
- _hover: {
20
- color: 'text.link.dark',
21
- opacity: '.8',
22
- },
23
- };
24
-
25
- export const variants = {
26
- standard: baseStyle,
27
- onDark: linkOnDark,
28
- };
29
-
30
- const defaultProps = {
31
- variant: 'standard',
32
- };
33
-
34
- export default {
35
- baseStyle,
36
- variants,
37
- defaultProps,
38
- };
@@ -1,57 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, {forwardRef} from 'react';
3
- import {List as ChakraList} from '@chakra-ui/react';
4
-
5
- const unorderedProps = {
6
- as: 'ul',
7
- styleType: 'disc',
8
- };
9
-
10
- const orderedProps = {
11
- as: 'ol',
12
- styleType: 'decimal',
13
- };
14
-
15
- const STYLE_POSITIONS = {
16
- unset: 'unset',
17
- revert: 'revert',
18
- inside: 'inside',
19
- outside: 'outside',
20
- initial: 'initial',
21
- inherit: 'inherit',
22
- };
23
-
24
- const TYPES = {
25
- ordered: 'ordered',
26
- unstyled: 'unstyled',
27
- unordered: 'unordered',
28
- };
29
-
30
- const getListProps = type => {
31
- switch (type) {
32
- case TYPES.ordered:
33
- return orderedProps;
34
- case TYPES.unordered:
35
- return unorderedProps;
36
- default:
37
- return;
38
- }
39
- };
40
-
41
- const List = forwardRef(({type, ...props}, ref) => (
42
- <ChakraList {...getListProps(type)} {...props} ref={ref} />
43
- ));
44
-
45
- List.defaultProps = {
46
- type: TYPES.unstyled,
47
- stylePosition: STYLE_POSITIONS.inside,
48
- };
49
-
50
- List.propTypes = {
51
- /** The position of the list style */
52
- stylePosition: PropTypes.oneOf(Object.keys(STYLE_POSITIONS)),
53
- /** Changes the underlying markdown to be an ordered or unorderd list, (unstyled will render a ul by default) */
54
- type: PropTypes.oneOf(Object.keys(TYPES)),
55
- };
56
-
57
- export default List;
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {build, fake} from '@jackfranklin/test-data-bot';
4
-
5
- import Component from './List';
6
-
7
- import {ListItem} from './index';
8
- import Spaces from 'utils/Spaces';
9
- import Text from 'components/Text/Text';
10
-
11
- import disableArgs from 'storybook/utils/disable-args';
12
-
13
- const DISABLE_TYPE = disableArgs('type');
14
-
15
- const randomListText = build('ListText', {
16
- fields: {
17
- text: fake(f => f.random.words(10)),
18
- },
19
- });
20
-
21
- const Usage = ({type}) => (
22
- <Text>
23
- &lt;List{type ? ` type="${type}"` : ''}&gt;
24
- <br />
25
- <Spaces />
26
- &lt;ListItem&gt;
27
- <br />
28
- <Spaces spaces={6} />
29
- ...
30
- <br />
31
- <Spaces />
32
- &lt;/ListItem&gt;
33
- <br />
34
- <Spaces />
35
- ...
36
- <br />
37
- &lt;/List&gt;
38
- </Text>
39
- );
40
-
41
- Usage.propTypes = {
42
- type: PropTypes.string,
43
- };
44
-
45
- export default {
46
- title: 'v2/List',
47
- component: Component,
48
- subcomponents: {ListItem},
49
- parameters: {
50
- importBy: 'List',
51
- removeBaseHtmlClass: true,
52
- },
53
- };
54
-
55
- const OverviewTemplate = props => (
56
- <Component {...props}>
57
- {Array(10)
58
- .fill(null)
59
- .map((_, index) => (
60
- <ListItem key={index}>{randomListText().text}</ListItem>
61
- ))}
62
- </Component>
63
- );
64
-
65
- export const Overview = OverviewTemplate.bind({});
66
- Overview.parameters = {
67
- usage: [<Usage key={1} />],
68
- };
69
- export const Unordered = OverviewTemplate.bind({});
70
- Unordered.argTypes = DISABLE_TYPE;
71
- Unordered.parameters = {
72
- usage: [<Usage type="unordered" key={1} />],
73
- };
74
- Unordered.args = {
75
- type: 'unordered',
76
- };
77
-
78
- export const Ordered = OverviewTemplate.bind({});
79
- Ordered.argTypes = DISABLE_TYPE;
80
- Ordered.parameters = {
81
- usage: [<Usage type="ordered" key={1} />],
82
- };
83
- Ordered.args = {
84
- type: 'ordered',
85
- };
86
- export const Unstyled = OverviewTemplate.bind({});
87
- Unstyled.parameters = {
88
- usage: [<Usage key={1} />],
89
- };
90
- Unstyled.argTypes = {
91
- ...DISABLE_TYPE,
92
- ...disableArgs('stylePosition'),
93
- };
94
- Unstyled.args = {
95
- type: 'unstyled',
96
- };
@@ -1,2 +0,0 @@
1
- export {default} from './List';
2
- export {ListItem} from '@chakra-ui/react';
@@ -1,12 +0,0 @@
1
- import merge from 'lodash/merge';
2
- import chakraDefaultTheme from '@chakra-ui/theme';
3
-
4
- import item from './item.styles';
5
-
6
- const baseStyle = {
7
- item,
8
- };
9
-
10
- export default merge(chakraDefaultTheme.components.List, {
11
- baseStyle,
12
- });
@@ -1,5 +0,0 @@
1
- const item = {
2
- mb: 2,
3
- };
4
-
5
- export default item;
@@ -1,75 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {CircularProgress as ChakraCircularProgress} from '@chakra-ui/react';
4
-
5
- const Loader = ({
6
- color = 'success',
7
- loaderBackgroundColor = 'transparent',
8
- isInfinite = true,
9
- size = 12,
10
- thickness = 2,
11
- trackColor = 'gray.medium',
12
- value = 0,
13
- ...props
14
- }) => {
15
- /* -------------------------------------------------------------------- *\
16
- Note: Since most of the props for this component control multiple
17
- styles at a time, it was decided that it made the most sense to set
18
- up the default style-related properties here in lou of creating an
19
- overly complex styles file.
20
- \* -------------------------------------------------------------------- */
21
- const loaderDefaultProps = {
22
- color,
23
- isIndeterminate: isInfinite,
24
- size,
25
- thickness,
26
- trackColor,
27
- value,
28
- capIsRound: true,
29
- };
30
-
31
- return (
32
- <ChakraCircularProgress
33
- sx={{
34
- '& svg > circle:first-of-type': {
35
- fill: loaderBackgroundColor,
36
- },
37
- }}
38
- {...loaderDefaultProps}
39
- {...props}
40
- />
41
- );
42
- };
43
-
44
- Loader.propTypes = {
45
- /**
46
- * The color of the Progress bar. Use color names defined within `theme/base/colors`.
47
- */
48
- color: PropTypes.string,
49
- /**
50
- * Determines if Loader spins for an infinite amount of time. If `true` value prop will be ignored.
51
- */
52
- isInfinite: PropTypes.bool,
53
- /**
54
- * Sets the background color of the Loader (inside the circle). Use color names defined within `theme/base/colors`.
55
- */
56
- loaderBackgroundColor: PropTypes.string,
57
- /**
58
- * The size of the Loader. Used as both height and width. Number corresponds to Size token.
59
- */
60
- size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
61
- /**
62
- * The thickness of the Loader. Number is used as pixel width.
63
- */
64
- thickness: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
65
- /**
66
- * The color of the Progress bar track. Use color names defined within `theme/base/colors`.
67
- */
68
- trackColor: PropTypes.string,
69
- /**
70
- * The number passed in corresponds to the percentage "done" of the Loader.
71
- */
72
- value: PropTypes.number,
73
- };
74
-
75
- export default Loader;
@@ -1,145 +0,0 @@
1
- import React from 'react';
2
-
3
- import disableArgs from 'storybook/utils/disable-args';
4
- import {createRangeControl} from 'storybook/utils/create-control';
5
-
6
- import Component from './Loader';
7
-
8
- export default {
9
- title: 'v2/Loader',
10
- component: Component,
11
- parameters: {
12
- removeBaseHtmlClass: true,
13
- importBy: 'Loader',
14
- },
15
- argTypes: {
16
- color: {
17
- options: [
18
- 'primary.default',
19
- 'secondary.default',
20
- 'white',
21
- 'success',
22
- 'warning',
23
- 'error',
24
- ],
25
- control: {
26
- type: 'radio',
27
- labels: {
28
- 'primary.default': 'Primary',
29
- 'secondary.default': 'Secondary',
30
- white: 'White',
31
- success: 'Success',
32
- warning: 'Warning',
33
- error: 'Error',
34
- },
35
- },
36
- },
37
- isInfinite: {
38
- control: {
39
- type: 'boolean',
40
- },
41
- },
42
- loaderBackgroundColor: {
43
- options: [
44
- 'white',
45
- 'gray.light',
46
- 'gray.medium',
47
- 'gray.dark',
48
- 'transparent',
49
- ],
50
- control: {
51
- type: 'radio',
52
- labels: {
53
- white: 'White',
54
- 'primary.default': 'Primary',
55
- 'gray.light': 'Light Gray',
56
- 'gray.medium': 'Medium Gray',
57
- 'gray.dark': 'Dark Gray',
58
- transparent: 'Transparent',
59
- },
60
- },
61
- },
62
- size: {
63
- options: [6, 12, 28, 48],
64
- control: {
65
- type: 'radio',
66
- labels: {
67
- 6: 'Small',
68
- 12: 'Medium',
69
- 28: 'Large',
70
- 48: 'Extra Large',
71
- },
72
- },
73
- },
74
- trackColor: {
75
- options: [
76
- 'primary.default',
77
- 'gray.light',
78
- 'gray.medium',
79
- 'gray.dark',
80
- 'white',
81
- ],
82
- control: {
83
- type: 'radio',
84
- labels: {
85
- 'primary.default': 'Primary',
86
- 'gray.light': 'Light Gray',
87
- 'gray.medium': 'Medium Gray',
88
- 'gray.dark': 'Dark Gray',
89
- white: 'White',
90
- },
91
- },
92
- },
93
- ...createRangeControl({
94
- name: 'thickness',
95
- min: 2,
96
- max: 16,
97
- step: 2,
98
- }),
99
- ...createRangeControl({name: 'value', min: 1, max: 100}),
100
- },
101
- };
102
-
103
- const Template = props => <Component {...props} />;
104
-
105
- export const Overview = Template.bind({});
106
- Overview.args = {
107
- color: 'success',
108
- isInfinite: false,
109
- loaderBackgroundColor: 'transparent',
110
- size: 12,
111
- thickness: 2,
112
- trackColor: 'gray.medium',
113
- value: 35,
114
- };
115
-
116
- export const FiniteLoader = Template.bind({});
117
- FiniteLoader.argTypes = {
118
- ...disableArgs([
119
- 'color',
120
- 'isInfinite',
121
- 'loaderBackgroundColor',
122
- 'size',
123
- 'thickness',
124
- 'trackColor',
125
- ]),
126
- };
127
- FiniteLoader.args = {
128
- isInfinite: false,
129
- value: 35,
130
- };
131
-
132
- export const InfiniteLoader = Template.bind({});
133
- InfiniteLoader.argTypes = {
134
- ...disableArgs([
135
- 'color',
136
- 'loaderBackgroundColor',
137
- 'size',
138
- 'thickness',
139
- 'trackColor',
140
- 'value',
141
- ]),
142
- };
143
- InfiniteLoader.args = {
144
- isInfinite: true,
145
- };
@@ -1,70 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
- import PropTypes from 'prop-types';
3
- import {
4
- Modal as ChakraModal,
5
- ModalOverlay,
6
- ModalContent,
7
- ModalHeader,
8
- ModalFooter,
9
- ModalBody,
10
- ModalCloseButton,
11
- Box,
12
- } from '@chakra-ui/react';
13
- import headerStyles from './styles/header';
14
-
15
- /**
16
- * @param {boolean} isMobile - Whether or not the Modal is opened in a mobile viewport
17
- * @param {boolean} isOpen - Whether or not the Modal is open
18
- * @param {React.ReactNode} children - The header text of the modal
19
- * @param {()=>void} [onClose] - Callback invoked to close the Modal. Not required, but strongly suggested.
20
- * @param {('sm'|'md'|'lg')} [size] - The size of the modal. If unspecified, uses "md" styles.
21
- * @param {React.ReactNode} [header] - The node for the header. Likely just a string.
22
- * @param {React.ReactNode} [footer] - The node for the footer. Likely some control buttons.
23
- * @param {React.ReactNode} [hideCloseButton] - Whether or not to show the close button
24
- * @returns {React.ReactElement} - The Modal component
25
- */
26
- const Modal = forwardRef((props, ref) => {
27
- const {header, footer, children, hideCloseButton, isMobile} = props;
28
-
29
- return (
30
- <ChakraModal
31
- motionPreset={isMobile ? 'slideInBottom' : 'scale'}
32
- {...props}
33
- ref={ref}
34
- >
35
- <ModalOverlay />
36
- <ModalContent>
37
- {header ? (
38
- <ModalHeader>{header}</ModalHeader>
39
- ) : (
40
- <Box {...headerStyles(props)} />
41
- )}
42
- {hideCloseButton ? null : <ModalCloseButton />}
43
- <ModalBody>{children}</ModalBody>
44
-
45
- {footer ? <ModalFooter>{footer}</ModalFooter> : null}
46
- </ModalContent>
47
- </ChakraModal>
48
- );
49
- });
50
-
51
- export default Modal;
52
-
53
- Modal.propTypes = {
54
- /** Whether or not the Modal is opened in a mobile viewport */
55
- isMobile: PropTypes.bool.isRequired,
56
- /** Whether or not the Modal is open */
57
- isOpen: PropTypes.bool.isRequired,
58
- /** React children. Body of the Modal. */
59
- children: PropTypes.node.isRequired,
60
- /** Callback invoked to close the Modal. Not required, but strongly suggested. */
61
- onClose: PropTypes.func,
62
- /** The size of the modal. If unspecified, uses md styles. */
63
- size: PropTypes.oneOf(['sm', 'md', 'lg']),
64
- /** The node for the header. Likely just a string (optional) */
65
- header: PropTypes.node,
66
- /** The node for the footer. Likely some control buttons (optional) */
67
- footer: PropTypes.node,
68
- /** Whether or not to show the close button (optional) */
69
- hideCloseButton: PropTypes.bool,
70
- };