@spothero/ui 16.0.0-beta.0 → 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.
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,194 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
- import PropTypes from 'prop-types';
3
- import FormControl from '../FormControl/FormControl';
4
- import AsyncSelect from 'react-select/async';
5
- import {useTheme} from '@chakra-ui/react';
6
- import IconTimesCircle from '@spothero/icons/times-circle';
7
-
8
- const AutoSuggestSelect = forwardRef(
9
- (
10
- {
11
- id,
12
- label,
13
- helperText,
14
- errorMessage,
15
- isInvalid,
16
- isDisabled,
17
- isRequired,
18
- getOptions,
19
- onChange,
20
- iconSrc,
21
- placeholder,
22
- },
23
- ref
24
- ) => {
25
- const {colors, fontSizes, sizes} = useTheme();
26
-
27
- const handleChange = selectedOption => {
28
- onChange(selectedOption);
29
- };
30
-
31
- const icon = (color = 'transparent') => ({
32
- alignItems: 'center',
33
- display: 'flex',
34
-
35
- ':before': {
36
- backgroundColor: color,
37
- content: '" "',
38
- display: 'block',
39
- marginRight: sizes['3'],
40
- height: sizes['4'],
41
- width: sizes['5'],
42
- mask: `url(${iconSrc}) no-repeat 50% 50%`,
43
- maskSize: 'contain',
44
- },
45
- });
46
-
47
- const baseText = {
48
- fontSize: fontSizes.base,
49
- color: colors.black,
50
- };
51
-
52
- /** React Select doesn't use Chakra but it does use Emotion so it's not too difficult to use values from our Chakra theme. Here is the documentation for React Select styling: https://react-select.com/styles */
53
- const customStyles = {
54
- menu: provided => ({
55
- ...provided,
56
- ...baseText,
57
- }),
58
- control: (provided, state) => ({
59
- ...provided,
60
- borderColor: isInvalid
61
- ? colors.error
62
- : state.isFocused
63
- ? colors.primary.default
64
- : colors.gray['200'],
65
- borderWidth: '1px',
66
- boxShadow: 'none',
67
- '&:hover': {
68
- borderColor: isInvalid
69
- ? colors.error
70
- : state.isFocused
71
- ? colors.primary.default
72
- : colors.gray['200'],
73
- },
74
- }),
75
- input: (provided, state) => ({
76
- ...provided,
77
- ...baseText,
78
- padding: sizes['2'],
79
- backgroundColor: state.isDisabled
80
- ? colors.gray['200']
81
- : 'transparent',
82
- ...(iconSrc && icon(colors.gray['600'])),
83
- }),
84
- placeholder: provided => ({
85
- ...provided,
86
- padding: sizes['2'],
87
- fontSize: fontSizes.base,
88
- color: colors.gray['600'],
89
- ...(iconSrc && icon()),
90
- }),
91
- singleValue: provided => ({
92
- ...provided,
93
- ...baseText,
94
- padding: sizes['2'],
95
- ...(iconSrc && icon()),
96
- }),
97
- option: (provided, state) => ({
98
- ...provided,
99
- backgroundColor: state.isSelected
100
- ? colors.gray['200']
101
- : state.isFocused
102
- ? colors.gray['50']
103
- : 'transparent',
104
- color: colors.black,
105
- }),
106
- clearIndicator: provided => ({
107
- ...provided,
108
- color: colors.gray['600'],
109
- }),
110
- dropdownIndicator: provided => ({
111
- ...provided,
112
- color: colors.gray['600'],
113
- }),
114
- };
115
-
116
- const clearIndicatorStyles = {
117
- width: sizes['5'],
118
- display: 'flex',
119
- marginRight: sizes['3'],
120
- color: colors.gray['600'],
121
- cursor: 'pointer',
122
- };
123
-
124
- /** React Select allows you to override the clear indicator with your own custom component: https://react-select.com/components */
125
- const ClearIndicator = ({innerRef, innerProps}) => (
126
- <div style={clearIndicatorStyles} ref={innerRef} {...innerProps}>
127
- <IconTimesCircle />
128
- </div>
129
- );
130
-
131
- return (
132
- <FormControl
133
- errorMessage={errorMessage}
134
- isRequired={isRequired}
135
- helperText={helperText}
136
- label={label}
137
- inputId={id}
138
- >
139
- <AsyncSelect
140
- closeMenuOnSelect
141
- isClearable
142
- cacheOptions
143
- components={{
144
- DropdownIndicator: () => null,
145
- IndicatorSeparator: () => null,
146
- ClearIndicator,
147
- }}
148
- openMenuOnClick={false}
149
- loadOptions={getOptions}
150
- onChange={handleChange}
151
- isDisabled={isDisabled}
152
- id={id}
153
- placeholder={placeholder}
154
- styles={customStyles}
155
- ref={ref}
156
- />
157
- </FormControl>
158
- );
159
- }
160
- );
161
-
162
- AutoSuggestSelect.propTypes = {
163
- /** ID applied to the select and label */
164
- id: PropTypes.string.isRequired,
165
- /** Label that describes the select */
166
- label: PropTypes.string,
167
- /** Text to use as placeholder in the input */
168
- placeholder: PropTypes.string,
169
- /** Optional helper text displayed below the select */
170
- helperText: PropTypes.string,
171
- /** Error message that would display under the select */
172
- errorMessage: PropTypes.string,
173
- /** Boolean that sets whether the select is valid */
174
- isInvalid: PropTypes.bool,
175
- /** Boolean that sets whether the select is disabled */
176
- isDisabled: PropTypes.bool,
177
- /** Boolean that sets whether the select is required */
178
- isRequired: PropTypes.bool,
179
- /** Function that is called with the value typed into the input that returns a list of options for the select */
180
- getOptions: PropTypes.func.isRequired,
181
- /** Function that is called when an option is selected, it returns the label and value of the selection */
182
- onChange: PropTypes.func.isRequired,
183
- /** Optional src to SVG to use as search icon */
184
- iconSrc: PropTypes.string,
185
-
186
- // This prop is added to work around error: 'innerRef' is missing in props validation react/prop-types
187
- // eslint-disable-next-line react/no-unused-prop-types
188
- innerRef: PropTypes.object,
189
- // This prop is added to work around error: 'innerProps' is missing in props validation react/prop-types
190
- // eslint-disable-next-line react/no-unused-prop-types
191
- innerProps: PropTypes.object,
192
- };
193
-
194
- export default AutoSuggestSelect;
@@ -1 +0,0 @@
1
- export {default as AutoSuggestSelect} from './AutoSuggestSelect';
@@ -1 +0,0 @@
1
- export {Badge as default} from '@chakra-ui/react';
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import Component from './Badge';
3
-
4
- export default {
5
- title: 'v2/Badge',
6
- component: Component,
7
- parameters: {
8
- removeBaseHtmlClass: true,
9
- },
10
- };
11
-
12
- const Template = props => (
13
- <>
14
- <Component variant='primary'>
15
- Primary
16
- </Component>
17
- <br/>
18
- <Component variant='warningLight'>
19
- Warning Light
20
- </Component>
21
- <br/>
22
- <Component variant='solid' colorScheme='green'>
23
- Success
24
- </Component>
25
- <br/>
26
- <Component variant='subtle' colorScheme='red'>
27
- Removed
28
- </Component>
29
- </>
30
- );
31
-
32
- export const Badge = Template.bind({});
@@ -1,29 +0,0 @@
1
- import merge from 'lodash/merge';
2
- import chakraDefaultTheme from '@chakra-ui/theme';
3
-
4
- const baseStyle = {
5
- px: 1,
6
- textTransform: 'reset',
7
- fontSize: 'xs',
8
- borderRadius: 'sm',
9
- fontWeight: 'bold',
10
- };
11
-
12
- export const variants = {
13
- primary: {
14
- bg: 'primary.default',
15
- color: 'white',
16
- },
17
- warningLight: {
18
- bg: 'yellow.100',
19
- color: 'black',
20
- },
21
- };
22
-
23
- const defaultProps = {};
24
-
25
- export default merge(chakraDefaultTheme.components.Badge, {
26
- variants,
27
- baseStyle,
28
- defaultProps,
29
- });
@@ -1,31 +0,0 @@
1
- import React, {forwardRef} from 'react';
2
- import {Button as ChakraButton} from '@chakra-ui/react';
3
-
4
- import ButtonProps from './button-props';
5
-
6
- const anchorProps = (isExternal = false) => ({
7
- as: 'a',
8
- type: null,
9
- ...(isExternal && {
10
- target: '_blank',
11
- rel: 'noopener noreferrer',
12
- }),
13
- });
14
-
15
- const Button = forwardRef(({asAnchor, isExternal, ...props}, ref) => (
16
- <ChakraButton
17
- iconSpacing={2}
18
- {...props}
19
- {...((asAnchor || props.as === 'a') && anchorProps(isExternal))}
20
- ref={ref}
21
- />
22
- ));
23
-
24
- Button.propTypes = ButtonProps;
25
-
26
- Button.defaultProps = {
27
- variant: 'primary',
28
- type: 'button',
29
- };
30
-
31
- export default Button;
@@ -1,29 +0,0 @@
1
- import React from 'react';
2
- import {render, screen} from '@testing-library/react';
3
-
4
- import Button from './Button';
5
-
6
- describe('Button', () => {
7
- it('renders the anchor version of the button', () => {
8
- render(
9
- <Button asAnchor href="#">
10
- Button
11
- </Button>
12
- );
13
-
14
- expect(screen.getByRole('link')).toBeInTheDocument();
15
- });
16
-
17
- it('renders with target and rel attributes on external anchor button', () => {
18
- render(
19
- <Button asAnchor isExternal href="#">
20
- Button
21
- </Button>
22
- );
23
-
24
- const link = screen.getByRole('link');
25
-
26
- expect(link).toHaveAttribute('target', '_blank');
27
- expect(link).toHaveAttribute('rel', 'noopener noreferrer');
28
- });
29
- });
@@ -1,156 +0,0 @@
1
- import merge from 'lodash/merge';
2
- import chakraDefaultTheme from '@chakra-ui/theme';
3
-
4
- const baseStyle = {
5
- px: 8,
6
- py: 3,
7
- fontSize: 'base',
8
- fontFamily: 'body',
9
- lineHeight: 0.875,
10
- fontWeight: 'semibold',
11
- borderWidth: '1px',
12
- borderStyle: 'solid',
13
- borderRadius: '1.25rem',
14
- textTransform: 'capitalize',
15
- transition: 'all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94)',
16
- _disabled: {
17
- cursor: 'not-allowed',
18
- opacity: 1,
19
- bg: 'gray.medium',
20
- borderColor: 'gray.medium',
21
- color: 'gray.dark',
22
- },
23
- '& svg': {
24
- display: 'block',
25
- },
26
- };
27
- // TODO: We need an active styling
28
- const disabledButtonHoverStyle = {
29
- _disabled: {
30
- bg: 'gray.medium',
31
- borderColor: 'gray.medium',
32
- color: 'gray.dark',
33
- },
34
- };
35
-
36
- const destructiveButtonStyles = {
37
- bg: 'white',
38
- borderColor: 'red.default',
39
- color: 'red.default',
40
- _hover: {
41
- borderColor: 'red.800',
42
- color: 'red.800',
43
- ...disabledButtonHoverStyle,
44
- },
45
- };
46
-
47
- export const variants = {
48
- primary: {
49
- bg: 'primary.default',
50
- borderColor: 'primary.default',
51
- color: 'white',
52
- _hover: {
53
- bg: 'primary.600',
54
- borderColor: 'primary.600',
55
- color: 'white',
56
- ...disabledButtonHoverStyle,
57
- },
58
- },
59
- primaryOnDark: {
60
- bg: 'yellow.default',
61
- borderColor: 'yellow.default',
62
- color: 'black',
63
- _hover: {
64
- bg: 'yellow.500',
65
- borderColor: 'yellow.500',
66
- color: 'black',
67
- ...disabledButtonHoverStyle,
68
- },
69
- _focus: {
70
- boxShadow: '0 0 0 3px rgba(255, 255, 255, 0.7)',
71
- },
72
- },
73
- secondary: {
74
- bg: 'white',
75
- borderColor: 'gray.medium',
76
- color: 'primary.default',
77
- _hover: {
78
- borderColor: 'primary.600',
79
- color: 'primary.600',
80
- ...disabledButtonHoverStyle,
81
- },
82
- },
83
- secondaryOnDark: {
84
- bg: 'none',
85
- borderColor: 'white',
86
- color: 'white',
87
- _hover: {
88
- bg: 'white',
89
- borderColor: 'white',
90
- color: 'black',
91
- ...disabledButtonHoverStyle,
92
- },
93
- _focus: {
94
- boxShadow: '0 0 0 3px rgba(255, 255, 255, 0.7)',
95
- },
96
- },
97
- tertiary: {
98
- bg: 'none',
99
- borderWidth: 'none',
100
- borderRadius: 'unset',
101
- color: 'primary.default',
102
- h: 'unset',
103
- m: 'unset',
104
- minW: 'unset',
105
- p: 'unset',
106
- lineHeight: 1,
107
- _disabled: {
108
- bg: 'none',
109
- color: 'gray.dark',
110
- },
111
- _hover: {
112
- color: 'primary.600',
113
- _disabled: {
114
- color: 'gray.dark',
115
- },
116
- },
117
- },
118
- tertiaryOnDark: {
119
- bg: 'none',
120
- borderRadius: 'unset',
121
- borderWidth: 'none',
122
- color: 'white',
123
- h: 'unset',
124
- m: 'unset',
125
- minW: 'unset',
126
- p: 'unset',
127
- _disabled: {
128
- bg: 'none',
129
- color: 'white',
130
- opacity: '.7',
131
- },
132
- _hover: {
133
- color: 'white',
134
- opacity: '.8',
135
- _disabled: {
136
- opacity: '.7',
137
- },
138
- },
139
- },
140
- destructive: {
141
- ...destructiveButtonStyles,
142
- },
143
- destructiveOnDark: {
144
- ...destructiveButtonStyles,
145
- },
146
- };
147
-
148
- const defaultProps = {
149
- size: null,
150
- };
151
-
152
- export default merge(chakraDefaultTheme.components.Button, {
153
- variants,
154
- baseStyle,
155
- defaultProps,
156
- });
@@ -1,66 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import {variants} from './Button.styles';
3
-
4
- const props = {
5
- /**
6
- * Alters the underlying html tag
7
- */
8
- as: PropTypes.string,
9
- /**
10
- * If `true`, the button will render as an anchor.
11
- */
12
- asAnchor: PropTypes.bool,
13
- /**
14
- * If `true`, and an anchor button, target="_blank" and rel="noopener noreferrer" will be set on the anchor
15
- * "isExternal" is used to maintain parity with the Link component.
16
- */
17
- isExternal: PropTypes.bool,
18
- /**
19
- * If `true`, the button will show a spinner.
20
- */
21
- isLoading: PropTypes.bool,
22
- /**
23
- * If `true`, the button will be styled in its active state.
24
- */
25
- isActive: PropTypes.bool,
26
- /**
27
- * If `true`, the button will be disabled.
28
- */
29
- isDisabled: PropTypes.bool,
30
- /**
31
- * The label to show in the button when `isLoading` is true
32
- * If no text is passed, it only shows the spinner
33
- */
34
- loadingText: PropTypes.string,
35
- /**
36
- * If `true`, the button will take up the full width of its container.
37
- */
38
- isFullWidth: PropTypes.bool,
39
- /**
40
- * The html button type to use.
41
- */
42
- type: PropTypes.oneOf(['button', 'reset', 'submit']),
43
- /**
44
- * If added, the button will show an icon before the button's label.
45
- * @type PropTypes.node
46
- */
47
- leftIcon: PropTypes.node,
48
- /**
49
- * If added, the button will show an icon after the button's label.
50
- * @type PropTypes.node
51
- */
52
- rightIcon: PropTypes.node,
53
- /**
54
- * The space between the button icon and label.
55
- * @type SystemProps["marginRight"]
56
- */
57
- iconSpacing: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
58
- /**
59
- * Replace the spinner component when `isLoading` is set to `true`
60
- * @type PropTypes.node
61
- */
62
- spinner: PropTypes.node,
63
- variant: PropTypes.oneOf(Object.keys(variants)),
64
- };
65
-
66
- export default props;
@@ -1,2 +0,0 @@
1
- export {default as Button} from './Button';
2
- export {ButtonGroup} from '@chakra-ui/react';
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import capitalize from 'lodash/capitalize';
3
- import {Box, Text} from '@chakra-ui/react';
4
- import IconCheck from '@spothero/icons/check';
5
-
6
- import Component from '../Button';
7
- import ButtonProps from 'components/Button/button-props';
8
-
9
- const ButtonTemplate = (props, {hasDarkBackground}) => {
10
- const variant = `${props.variant}${hasDarkBackground ? 'OnDark' : ''}`;
11
-
12
- return (
13
- <Box>
14
- <Box mb={4}>
15
- <Text
16
- mb="2"
17
- color={
18
- hasDarkBackground
19
- ? 'text.primary.dark'
20
- : 'text.primary.light'
21
- }
22
- >
23
- {capitalize(props.variant)}:
24
- </Text>
25
- <Box>
26
- <Component {...props} variant={variant} mr={4} mb={4}>
27
- {props.variant} Variant
28
- </Component>
29
-
30
- <Component
31
- leftIcon={<IconCheck width="1rem" />}
32
- {...props}
33
- variant={variant}
34
- mr={4}
35
- mb={4}
36
- >
37
- {props.variant} With Icon
38
- </Component>
39
-
40
- <Component
41
- {...props}
42
- variant={variant}
43
- as="a"
44
- href="http://spothero.com"
45
- isExternal={false}
46
- mr={4}
47
- mb={4}
48
- >
49
- As Anchor
50
- </Component>
51
- </Box>
52
- </Box>
53
- </Box>
54
- );
55
- };
56
-
57
- ButtonTemplate.propTypes = ButtonProps;
58
-
59
- export default ButtonTemplate;
@@ -1,82 +0,0 @@
1
- import ButtonTemplate from './button';
2
- import OverviewTemplate from './overview';
3
-
4
- import Button from '../Button';
5
- import disableArgs from 'storybook/utils/disable-args';
6
- import {createSelectControl} from 'storybook/utils/create-control';
7
-
8
- export default {
9
- title: 'v2/Button',
10
- component: {Button},
11
- parameters: {
12
- importBy: 'Button',
13
- removeBaseHtmlClass: true,
14
- chakraLink: 'https://chakra-ui.com/docs/form/button',
15
- },
16
- argTypes: {
17
- ...disableArgs('children'),
18
- onClick: {action: 'clicked'},
19
- },
20
- };
21
-
22
- export const Overview = OverviewTemplate.bind({});
23
-
24
- export const Primary = ButtonTemplate.bind({});
25
- Primary.argTypes = {
26
- ...createSelectControl('type', ['button', 'reset', 'submit']),
27
- ...disableArgs('variant'),
28
- onClick: {action: 'clicked'},
29
- };
30
- Primary.args = {
31
- children: 'Primary',
32
- variant: 'primary',
33
- isDisabled: false,
34
- isLoading: false,
35
- loadingText: 'Loading',
36
- isFullWidth: false,
37
- };
38
-
39
- export const Secondary = ButtonTemplate.bind({});
40
- Secondary.argTypes = {
41
- ...createSelectControl('type', ['button', 'reset', 'submit']),
42
- ...disableArgs('variant'),
43
- onClick: {action: 'clicked'},
44
- };
45
- Secondary.args = {
46
- children: 'Secondary',
47
- variant: 'secondary',
48
- isDisabled: false,
49
- isLoading: false,
50
- loadingText: 'Loading',
51
- isFullWidth: false,
52
- };
53
-
54
- export const Tertiary = ButtonTemplate.bind({});
55
- Tertiary.argTypes = {
56
- ...createSelectControl('type', ['button', 'reset', 'submit']),
57
- ...disableArgs('variant'),
58
- onClick: {action: 'clicked'},
59
- };
60
- Tertiary.args = {
61
- children: 'tertiary',
62
- variant: 'tertiary',
63
- isDisabled: false,
64
- isLoading: false,
65
- loadingText: 'Loading',
66
- isFullWidth: false,
67
- };
68
-
69
- export const Destructive = ButtonTemplate.bind({});
70
- Destructive.argTypes = {
71
- ...createSelectControl('type', ['button', 'reset', 'submit']),
72
- ...disableArgs('variant'),
73
- onClick: {action: 'clicked'},
74
- };
75
- Destructive.args = {
76
- children: 'destructive',
77
- variant: 'destructive',
78
- isDisabled: false,
79
- isLoading: false,
80
- loadingText: 'Loading',
81
- isFullWidth: false,
82
- };