@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,17 +0,0 @@
|
|
|
1
|
-
const pseudoStyles = variant => ({
|
|
2
|
-
bgColor: variant === 'dark' ? 'gray.600' : 'gray.50',
|
|
3
|
-
});
|
|
4
|
-
|
|
5
|
-
const closeButtonStyles = ({variant}) => ({
|
|
6
|
-
color: variant === 'dark' ? 'white' : 'black',
|
|
7
|
-
fontSize: '0.5rem',
|
|
8
|
-
position: 'absolute',
|
|
9
|
-
top: 0,
|
|
10
|
-
right: 0,
|
|
11
|
-
padding: 4,
|
|
12
|
-
borderTopRightRadius: 4,
|
|
13
|
-
_hover: pseudoStyles(variant),
|
|
14
|
-
_focus: pseudoStyles(variant),
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export default closeButtonStyles;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const popoverContentStyles = ({variant}) => ({
|
|
2
|
-
padding: 4,
|
|
3
|
-
marginBottom: 0,
|
|
4
|
-
maxWidth: '20rem',
|
|
5
|
-
borderRadius: 'base',
|
|
6
|
-
background: variant === 'dark' ? 'secondary.default' : 'white',
|
|
7
|
-
boxShadow: '2px 2px 4px 0 rgba(0,45,91,0.1)',
|
|
8
|
-
color: variant === 'dark' ? 'white' : 'black',
|
|
9
|
-
borderColor: 'gray.100',
|
|
10
|
-
borderWidth: '1px',
|
|
11
|
-
borderStyle: 'solid',
|
|
12
|
-
'--popper-arrow-shadow-color': t => t.colors.gray['100'],
|
|
13
|
-
zIndex: 'layer10',
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export default popoverContentStyles;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Box, Radio as ChakraRadio} from '@chakra-ui/react';
|
|
4
|
-
|
|
5
|
-
const Radio = forwardRef(
|
|
6
|
-
(
|
|
7
|
-
{
|
|
8
|
-
defaultChecked,
|
|
9
|
-
isChecked,
|
|
10
|
-
isDisabled,
|
|
11
|
-
value,
|
|
12
|
-
helperText,
|
|
13
|
-
children,
|
|
14
|
-
...props
|
|
15
|
-
},
|
|
16
|
-
ref
|
|
17
|
-
) => {
|
|
18
|
-
return (
|
|
19
|
-
<ChakraRadio
|
|
20
|
-
ref={ref}
|
|
21
|
-
defaultChecked={defaultChecked}
|
|
22
|
-
isChecked={isChecked}
|
|
23
|
-
isDisabled={isDisabled}
|
|
24
|
-
isFocusable={!isDisabled}
|
|
25
|
-
value={value}
|
|
26
|
-
alignItems="start"
|
|
27
|
-
{...props}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
{helperText && (
|
|
31
|
-
<Box color="gray.600" fontSize="xs">
|
|
32
|
-
{helperText}
|
|
33
|
-
</Box>
|
|
34
|
-
)}
|
|
35
|
-
</ChakraRadio>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
Radio.propTypes = {
|
|
41
|
-
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
|
|
42
|
-
.isRequired,
|
|
43
|
-
defaultChecked: PropTypes.bool,
|
|
44
|
-
isChecked: PropTypes.bool,
|
|
45
|
-
isDisabled: PropTypes.bool,
|
|
46
|
-
value: PropTypes.string.isRequired,
|
|
47
|
-
helperText: PropTypes.string,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export default Radio;
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import Radio from './Radio';
|
|
4
|
-
import RadioGroup from './RadioGroup';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'v2/Radio',
|
|
8
|
-
component: Radio,
|
|
9
|
-
parameters: {
|
|
10
|
-
importBy: 'Radio',
|
|
11
|
-
removeBaseHtmlClass: true,
|
|
12
|
-
chakraLink: 'https://chakra-ui.com/docs/components/radio',
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const Individual = props => {
|
|
17
|
-
return (
|
|
18
|
-
<Radio value="1" {...props}>
|
|
19
|
-
Option 1
|
|
20
|
-
</Radio>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
Individual.argTypes = {
|
|
25
|
-
helperText: {
|
|
26
|
-
control: {type: 'text'},
|
|
27
|
-
},
|
|
28
|
-
isDisabled: {
|
|
29
|
-
control: {
|
|
30
|
-
type: 'boolean',
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
isChecked: {
|
|
34
|
-
control: {
|
|
35
|
-
type: 'boolean',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
children: {
|
|
39
|
-
table: {
|
|
40
|
-
disable: true,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
defaultChecked: {
|
|
44
|
-
table: {
|
|
45
|
-
disable: true,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
value: {
|
|
49
|
-
table: {
|
|
50
|
-
disable: true,
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
Individual.args = {
|
|
56
|
-
helperText: 'Helper text',
|
|
57
|
-
isDisabled: false,
|
|
58
|
-
isChecked: false,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
Individual.propTypes = {
|
|
62
|
-
children: PropTypes.oneOfType([PropTypes.string, PropTypes.element])
|
|
63
|
-
.isRequired,
|
|
64
|
-
defaultChecked: PropTypes.bool,
|
|
65
|
-
isChecked: PropTypes.bool,
|
|
66
|
-
isDisabled: PropTypes.bool,
|
|
67
|
-
value: PropTypes.string.isRequired,
|
|
68
|
-
helperText: PropTypes.string,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const Group = props => {
|
|
72
|
-
return (
|
|
73
|
-
<RadioGroup
|
|
74
|
-
name="example1"
|
|
75
|
-
defaultValue="3"
|
|
76
|
-
id="example1"
|
|
77
|
-
label="Which option?"
|
|
78
|
-
{...props}
|
|
79
|
-
>
|
|
80
|
-
<Radio value="1">Option 1</Radio>
|
|
81
|
-
<Radio value="2">Option 2</Radio>
|
|
82
|
-
<Radio value="3">Option 3</Radio>
|
|
83
|
-
<Radio value="4">Option 4</Radio>
|
|
84
|
-
</RadioGroup>
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
Group.title = 'v2/RadioGroup';
|
|
89
|
-
Group.component = RadioGroup;
|
|
90
|
-
Group.parameters = {
|
|
91
|
-
importBy: 'RadioGroup',
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
Group.argTypes = {
|
|
95
|
-
direction: {
|
|
96
|
-
options: ['column', 'row'],
|
|
97
|
-
control: {
|
|
98
|
-
type: 'radio',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
isDisabled: {
|
|
102
|
-
control: {
|
|
103
|
-
type: 'boolean',
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
children: {
|
|
107
|
-
table: {
|
|
108
|
-
disable: true,
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
defaultChecked: {
|
|
112
|
-
table: {
|
|
113
|
-
disable: true,
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
value: {
|
|
117
|
-
table: {
|
|
118
|
-
disable: true,
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
isChecked: {
|
|
122
|
-
table: {
|
|
123
|
-
disable: true,
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
helperText: {
|
|
127
|
-
table: {
|
|
128
|
-
disable: true,
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
Group.args = {
|
|
134
|
-
direction: 'column',
|
|
135
|
-
isDisabled: false,
|
|
136
|
-
isInvalid: false,
|
|
137
|
-
isRequired: false,
|
|
138
|
-
label: 'Label',
|
|
139
|
-
errorMessage: 'Error message',
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
Group.propTypes = {
|
|
143
|
-
children: PropTypes.node,
|
|
144
|
-
defaultValue: PropTypes.string,
|
|
145
|
-
id: PropTypes.string.isRequired,
|
|
146
|
-
label: PropTypes.string,
|
|
147
|
-
errorMessage: PropTypes.string,
|
|
148
|
-
isDisabled: PropTypes.bool,
|
|
149
|
-
isInvalid: PropTypes.bool,
|
|
150
|
-
isRequired: PropTypes.bool,
|
|
151
|
-
name: PropTypes.string,
|
|
152
|
-
onChange: PropTypes.func,
|
|
153
|
-
value: PropTypes.string,
|
|
154
|
-
direction: PropTypes.oneOf(['row', 'column']),
|
|
155
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {RadioGroup as ChakraRadioGroup, Stack} from '@chakra-ui/react';
|
|
4
|
-
import FormControl from '../FormControl/FormControl';
|
|
5
|
-
|
|
6
|
-
const RadioGroup = forwardRef(
|
|
7
|
-
(
|
|
8
|
-
{
|
|
9
|
-
label,
|
|
10
|
-
errorMessage,
|
|
11
|
-
defaultValue,
|
|
12
|
-
isDisabled,
|
|
13
|
-
isInvalid,
|
|
14
|
-
isRequired,
|
|
15
|
-
name,
|
|
16
|
-
onChange,
|
|
17
|
-
value,
|
|
18
|
-
children,
|
|
19
|
-
direction,
|
|
20
|
-
...props
|
|
21
|
-
},
|
|
22
|
-
ref
|
|
23
|
-
) => {
|
|
24
|
-
return (
|
|
25
|
-
<FormControl
|
|
26
|
-
isInvalid={isInvalid}
|
|
27
|
-
isDisabled={isDisabled}
|
|
28
|
-
isRequired={isRequired}
|
|
29
|
-
errorMessage={errorMessage}
|
|
30
|
-
label={label}
|
|
31
|
-
inputId={props.id}
|
|
32
|
-
isFieldset
|
|
33
|
-
>
|
|
34
|
-
<ChakraRadioGroup
|
|
35
|
-
ref={ref}
|
|
36
|
-
defaultValue={defaultValue}
|
|
37
|
-
name={name}
|
|
38
|
-
onChange={onChange}
|
|
39
|
-
value={value}
|
|
40
|
-
{...props}
|
|
41
|
-
>
|
|
42
|
-
<Stack
|
|
43
|
-
direction={direction ? direction : 'column'}
|
|
44
|
-
spacing={direction === 'row' ? 8 : 4}
|
|
45
|
-
>
|
|
46
|
-
{children}
|
|
47
|
-
</Stack>
|
|
48
|
-
</ChakraRadioGroup>
|
|
49
|
-
</FormControl>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
RadioGroup.propTypes = {
|
|
55
|
-
children: PropTypes.node,
|
|
56
|
-
defaultValue: PropTypes.string,
|
|
57
|
-
id: PropTypes.string.isRequired,
|
|
58
|
-
label: PropTypes.string,
|
|
59
|
-
errorMessage: PropTypes.string,
|
|
60
|
-
isDisabled: PropTypes.bool,
|
|
61
|
-
isInvalid: PropTypes.bool,
|
|
62
|
-
isRequired: PropTypes.bool,
|
|
63
|
-
name: PropTypes.string,
|
|
64
|
-
onChange: PropTypes.func,
|
|
65
|
-
value: PropTypes.string,
|
|
66
|
-
direction: PropTypes.oneOf(['row', 'column']),
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default RadioGroup;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
const parts = ['control', 'label'];
|
|
5
|
-
|
|
6
|
-
const baseStyle = {
|
|
7
|
-
control: {
|
|
8
|
-
borderRadius: '50%',
|
|
9
|
-
borderWidth: '1px',
|
|
10
|
-
borderColor: 'gray.dark',
|
|
11
|
-
backgroundColor: 'white',
|
|
12
|
-
minWidth: 5,
|
|
13
|
-
minHeight: 5,
|
|
14
|
-
marginTop: 1,
|
|
15
|
-
_checked: {
|
|
16
|
-
borderWidth: 0,
|
|
17
|
-
color: 'white',
|
|
18
|
-
backgroundColor: 'primary.default',
|
|
19
|
-
_before: {
|
|
20
|
-
content: '""',
|
|
21
|
-
display: 'inline-block',
|
|
22
|
-
position: 'relative',
|
|
23
|
-
width: 2,
|
|
24
|
-
height: 2,
|
|
25
|
-
borderRadius: '50%',
|
|
26
|
-
background: 'currentcolor',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
_focus: {
|
|
30
|
-
boxShadow: t => `0 0 1px 2px ${t.colors.primary['300']}`,
|
|
31
|
-
},
|
|
32
|
-
_disabled: {
|
|
33
|
-
borderColor: 'gray.200',
|
|
34
|
-
_checked: {
|
|
35
|
-
backgroundColor: 'gray.200',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
label: {
|
|
40
|
-
fontSize: 'base',
|
|
41
|
-
color: 'black',
|
|
42
|
-
marginLeft: 3,
|
|
43
|
-
_disabled: {
|
|
44
|
-
color: 'gray.200',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default merge(chakraDefaultTheme.components.Radio, {
|
|
50
|
-
parts,
|
|
51
|
-
baseStyle,
|
|
52
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import cn from 'classnames';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import React, {forwardRef} from 'react';
|
|
4
|
-
import {Select as ChakraSelect} from '@chakra-ui/react';
|
|
5
|
-
import IconChevronDown from '@spothero/icons/chevron-down';
|
|
6
|
-
|
|
7
|
-
import Icon from '../Icon/Icon';
|
|
8
|
-
import FormControl from '../FormControl/FormControl';
|
|
9
|
-
|
|
10
|
-
const Select = forwardRef(
|
|
11
|
-
(
|
|
12
|
-
{
|
|
13
|
-
label,
|
|
14
|
-
helperText,
|
|
15
|
-
errorMessage,
|
|
16
|
-
isInvalid,
|
|
17
|
-
isDisabled,
|
|
18
|
-
isRequired,
|
|
19
|
-
isOptional,
|
|
20
|
-
...props
|
|
21
|
-
},
|
|
22
|
-
ref
|
|
23
|
-
) => {
|
|
24
|
-
const classes = cn({'FormElement-contains-error': isInvalid});
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<FormControl
|
|
28
|
-
isInvalid={isInvalid}
|
|
29
|
-
isDisabled={isDisabled}
|
|
30
|
-
isRequired={isRequired}
|
|
31
|
-
errorMessage={errorMessage}
|
|
32
|
-
isOptional={isOptional}
|
|
33
|
-
helperText={helperText}
|
|
34
|
-
label={label}
|
|
35
|
-
inputId={props.id}
|
|
36
|
-
>
|
|
37
|
-
<ChakraSelect
|
|
38
|
-
icon={<Icon as={IconChevronDown} />}
|
|
39
|
-
iconSize={12}
|
|
40
|
-
fontWeight="regular"
|
|
41
|
-
fontSize="sm"
|
|
42
|
-
ref={ref}
|
|
43
|
-
className={classes}
|
|
44
|
-
{...props}
|
|
45
|
-
/>
|
|
46
|
-
</FormControl>
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
Select.propTypes = {
|
|
52
|
-
id: PropTypes.string.isRequired,
|
|
53
|
-
label: PropTypes.string,
|
|
54
|
-
helperText: PropTypes.string,
|
|
55
|
-
errorMessage: PropTypes.string,
|
|
56
|
-
isInvalid: PropTypes.bool,
|
|
57
|
-
isDisabled: PropTypes.bool,
|
|
58
|
-
isRequired: PropTypes.bool,
|
|
59
|
-
isOptional: PropTypes.bool,
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export default Select;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import Component from './Select';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'v2/Select',
|
|
8
|
-
component: Component,
|
|
9
|
-
parameters: {
|
|
10
|
-
removeBaseHtmlClass: true,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const SelectTemplate = props => (
|
|
15
|
-
<Component variant="outline" maxWidth="200px" {...props}>
|
|
16
|
-
<option value="one">One</option>
|
|
17
|
-
<option value="two">Two</option>
|
|
18
|
-
<option value="three">Three</option>
|
|
19
|
-
<option value="four">Four</option>
|
|
20
|
-
</Component>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
SelectTemplate.propTypes = {
|
|
24
|
-
placeholder: PropTypes.string,
|
|
25
|
-
label: PropTypes.string,
|
|
26
|
-
helperText: PropTypes.string,
|
|
27
|
-
errorMessage: PropTypes.string,
|
|
28
|
-
isInvalid: PropTypes.bool,
|
|
29
|
-
isDisabled: PropTypes.bool,
|
|
30
|
-
isReadOnly: PropTypes.bool,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export const Select = SelectTemplate.bind({});
|
|
34
|
-
|
|
35
|
-
Select.argTypes = {
|
|
36
|
-
placeholder: {
|
|
37
|
-
control: {type: 'text'},
|
|
38
|
-
},
|
|
39
|
-
label: {
|
|
40
|
-
control: {type: 'text'},
|
|
41
|
-
},
|
|
42
|
-
helperText: {
|
|
43
|
-
control: {type: 'text'},
|
|
44
|
-
},
|
|
45
|
-
errorMessage: {
|
|
46
|
-
control: {type: 'text'},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
Select.args = {
|
|
51
|
-
placeholder: 'Placeholder text',
|
|
52
|
-
label: 'Label',
|
|
53
|
-
helperText: 'Helper text',
|
|
54
|
-
errorMessage: 'Error message',
|
|
55
|
-
isInvalid: false,
|
|
56
|
-
isDisabled: false,
|
|
57
|
-
isReadOnly: false,
|
|
58
|
-
isRequired: false,
|
|
59
|
-
isOptional: false,
|
|
60
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './Select';
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
const variants = {
|
|
5
|
-
outline: {
|
|
6
|
-
field: {
|
|
7
|
-
border: '1px solid',
|
|
8
|
-
borderColor: 'inherit',
|
|
9
|
-
bg: 'inherit',
|
|
10
|
-
_hover: {borderColor: 'gray.300'},
|
|
11
|
-
_readOnly: {boxShadow: 'none !important', userSelect: 'all'},
|
|
12
|
-
_disabled: {opacity: 0.4, cursor: 'not-allowed'},
|
|
13
|
-
_invalid: {
|
|
14
|
-
borderColor: 'error',
|
|
15
|
-
boxShadow: t => `0 0 0 1px ${t.colors.error}`,
|
|
16
|
-
},
|
|
17
|
-
_focus: {
|
|
18
|
-
zIndex: 1,
|
|
19
|
-
borderColor: 'primary.400',
|
|
20
|
-
boxShadow: t => `0 0 0 1px ${t.colors.primary['400']}`,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
addon: {border: '1px solid', borderColor: 'inherit', bg: 'gray.100'},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default merge(chakraDefaultTheme.components.Select, {
|
|
28
|
-
variants,
|
|
29
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {Skeleton as Component, SkeletonCircle as CircleSkeleton, SkeletonText as TextSkeleton} from './index';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'v2/Skeleton',
|
|
7
|
-
component: Component,
|
|
8
|
-
parameters: {
|
|
9
|
-
removeBaseHtmlClass: true,
|
|
10
|
-
chakraLink: 'https://chakra-ui.com/docs/components/skeleton/',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const SkeletonTemplate = props => (
|
|
15
|
-
<Component {...props}>
|
|
16
|
-
Text
|
|
17
|
-
</Component>
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const SkeletonCircleTemplate = props => (
|
|
21
|
-
<CircleSkeleton>
|
|
22
|
-
Text
|
|
23
|
-
</CircleSkeleton>
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
const SkeletonTextTemplate = props => (
|
|
27
|
-
<TextSkeleton>
|
|
28
|
-
Text
|
|
29
|
-
</TextSkeleton>
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
export const Skeleton = SkeletonTemplate.bind({});
|
|
33
|
-
export const SkeletonCircle = SkeletonCircleTemplate.bind({})
|
|
34
|
-
export const SkeletonText = SkeletonTextTemplate.bind({})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {Skeleton, SkeletonCircle, SkeletonText} from '@chakra-ui/react';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Spinner as ChakraSpinner} from '@chakra-ui/react';
|
|
4
|
-
|
|
5
|
-
import {thicknesses, SIZE_MAP} from './Spinner.styles';
|
|
6
|
-
|
|
7
|
-
const Spinner = forwardRef(({size, thickness, ...props}, ref) => {
|
|
8
|
-
const thicknessString = thickness
|
|
9
|
-
? `${thickness}px`
|
|
10
|
-
: thicknesses[size]
|
|
11
|
-
? `${thicknesses[size]}px`
|
|
12
|
-
: '2px';
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<ChakraSpinner
|
|
16
|
-
ref={ref}
|
|
17
|
-
role="status"
|
|
18
|
-
color="primary.default"
|
|
19
|
-
emptyColor="gray.medium"
|
|
20
|
-
thickness={thicknessString}
|
|
21
|
-
size={size || SIZE_MAP['2xl']}
|
|
22
|
-
{...props}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
Spinner.propTypes = {
|
|
28
|
-
/** The main fill color of the spinner */
|
|
29
|
-
color: PropTypes.string,
|
|
30
|
-
/** The diameter of the spinner ring in pixels */
|
|
31
|
-
thickness: PropTypes.number,
|
|
32
|
-
/** The empty color of the spinner */
|
|
33
|
-
emptyColor: PropTypes.string,
|
|
34
|
-
/** The size of the spinner */
|
|
35
|
-
size: PropTypes.oneOf(Object.keys(SIZE_MAP)),
|
|
36
|
-
/** The speed of the spinner, ex: 10s, 0.1s, 250ms */
|
|
37
|
-
speed: PropTypes.string,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export default Spinner;
|