@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.
- 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,98 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import colors from 'theme/base/colors';
|
|
3
|
-
|
|
4
|
-
import {sizes, SIZE_MAP, thicknesses} from './Spinner.styles';
|
|
5
|
-
import {
|
|
6
|
-
createSelectControl,
|
|
7
|
-
createRangeControl,
|
|
8
|
-
} from 'storybook/utils/create-control';
|
|
9
|
-
import disableArgs from 'storybook/utils/disable-args';
|
|
10
|
-
|
|
11
|
-
import Component from './Spinner';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'v2/Spinner',
|
|
15
|
-
component: Component,
|
|
16
|
-
parameters: {
|
|
17
|
-
removeBaseHtmlClass: true,
|
|
18
|
-
importBy: 'Spinner',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const allColors = Object.entries(colors).reduce((acc, [colorName, color]) => {
|
|
23
|
-
if (typeof color === 'string') {
|
|
24
|
-
acc.push(colorName);
|
|
25
|
-
} else {
|
|
26
|
-
Object.keys(color).forEach(stop => {
|
|
27
|
-
acc.push(`${colorName}.${stop}`);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return acc;
|
|
32
|
-
}, []);
|
|
33
|
-
|
|
34
|
-
const colorControl = key => createSelectControl(key, allColors);
|
|
35
|
-
const Template = props => <Component {...props} />;
|
|
36
|
-
|
|
37
|
-
export const Overview = Template.bind({});
|
|
38
|
-
Overview.argTypes = {
|
|
39
|
-
...colorControl('color'),
|
|
40
|
-
...colorControl('emptyColor'),
|
|
41
|
-
...createSelectControl('size', Object.keys(sizes)),
|
|
42
|
-
...createRangeControl({name: 'thickness', min: 1, max: 100}),
|
|
43
|
-
};
|
|
44
|
-
Overview.args = {
|
|
45
|
-
speed: '1s',
|
|
46
|
-
size: SIZE_MAP['2xl'],
|
|
47
|
-
thickness: thicknesses[SIZE_MAP['2xl']],
|
|
48
|
-
color: 'primary.default',
|
|
49
|
-
emptyColor: 'gray.medium',
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const Speed = Template.bind({});
|
|
53
|
-
Speed.argTypes = disableArgs(['size', 'color', 'emptyColor', 'thickness']);
|
|
54
|
-
Speed.args = {
|
|
55
|
-
speed: '1s',
|
|
56
|
-
size: SIZE_MAP['2xl'],
|
|
57
|
-
color: 'primary.default',
|
|
58
|
-
emptyColor: 'gray.medium',
|
|
59
|
-
thickness: thicknesses[SIZE_MAP['2xl']],
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const Size = Template.bind({});
|
|
63
|
-
Size.argTypes = {
|
|
64
|
-
...createSelectControl('size', Object.keys(sizes)),
|
|
65
|
-
...disableArgs(['speed', 'color', 'emptyColor', 'thickness']),
|
|
66
|
-
};
|
|
67
|
-
Size.args = {
|
|
68
|
-
size: SIZE_MAP['2xl'],
|
|
69
|
-
};
|
|
70
|
-
export const Thickness = Template.bind({});
|
|
71
|
-
Thickness.argTypes = {
|
|
72
|
-
...disableArgs(['speed', 'size', 'emptyColor', 'color']),
|
|
73
|
-
...createRangeControl({name: 'thickness', min: 1, max: 100}),
|
|
74
|
-
};
|
|
75
|
-
Thickness.args = {
|
|
76
|
-
thickness: thicknesses[SIZE_MAP['5xl']],
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export const Color = Template.bind({});
|
|
80
|
-
Color.argTypes = {
|
|
81
|
-
...colorControl('color'),
|
|
82
|
-
...disableArgs(['speed', 'size', 'emptyColor', 'thickness']),
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
Color.args = {
|
|
86
|
-
thickness: 6,
|
|
87
|
-
color: 'primary.default',
|
|
88
|
-
};
|
|
89
|
-
export const EmptyColor = Template.bind({});
|
|
90
|
-
EmptyColor.argTypes = {
|
|
91
|
-
...colorControl('emptyColor'),
|
|
92
|
-
...disableArgs(['speed', 'size', 'color', 'thickness']),
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
EmptyColor.args = {
|
|
96
|
-
thickness: 6,
|
|
97
|
-
emptyColor: 'gray.medium',
|
|
98
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
const spinnerStyles = chakraDefaultTheme.components.Spinner;
|
|
5
|
-
|
|
6
|
-
export const SIZE_MAP = {
|
|
7
|
-
xs: 'xs',
|
|
8
|
-
sm: 'sm',
|
|
9
|
-
md: 'md',
|
|
10
|
-
lg: 'lg',
|
|
11
|
-
xl: 'xl',
|
|
12
|
-
'2xl': '2xl',
|
|
13
|
-
'3xl': '3xl',
|
|
14
|
-
'4xl': '4xl',
|
|
15
|
-
'5xl': '5xl',
|
|
16
|
-
'6xl': '6xl',
|
|
17
|
-
'7xl': '7xl',
|
|
18
|
-
'8xl': '8xl',
|
|
19
|
-
'9xl': '9xl',
|
|
20
|
-
'10xl': '10xl',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const sizes = merge(spinnerStyles.sizes, {
|
|
24
|
-
[SIZE_MAP['2xl']]: {w: '4rem', h: '4rem'},
|
|
25
|
-
[SIZE_MAP['3xl']]: {w: '5rem', h: '5rem'},
|
|
26
|
-
[SIZE_MAP['4xl']]: {w: '6rem', h: '6rem'},
|
|
27
|
-
[SIZE_MAP['5xl']]: {w: '7rem', h: '7rem'},
|
|
28
|
-
[SIZE_MAP['6xl']]: {w: '8rem', h: '8rem'},
|
|
29
|
-
[SIZE_MAP['7xl']]: {w: '9rem', h: '9rem'},
|
|
30
|
-
[SIZE_MAP['8xl']]: {w: '10rem', h: '10rem'},
|
|
31
|
-
[SIZE_MAP['9xl']]: {w: '11rem', h: '11rem'},
|
|
32
|
-
[SIZE_MAP['10xl']]: {w: '12rem', h: '12rem'},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const thicknesses = {
|
|
36
|
-
[SIZE_MAP.xl]: 3,
|
|
37
|
-
[SIZE_MAP['2xl']]: 4,
|
|
38
|
-
[SIZE_MAP['3xl']]: 5,
|
|
39
|
-
[SIZE_MAP['4xl']]: 6,
|
|
40
|
-
[SIZE_MAP['5xl']]: 7,
|
|
41
|
-
[SIZE_MAP['6xl']]: 8,
|
|
42
|
-
[SIZE_MAP['7xl']]: 9,
|
|
43
|
-
[SIZE_MAP['8xl']]: 10,
|
|
44
|
-
[SIZE_MAP['9xl']]: 11,
|
|
45
|
-
[SIZE_MAP['10xl']]: 12,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const defaultProps = {
|
|
49
|
-
speed: '2s',
|
|
50
|
-
size: SIZE_MAP['2xl'],
|
|
51
|
-
thickness: thicknesses[SIZE_MAP['2xl']],
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default {
|
|
55
|
-
sizes,
|
|
56
|
-
defaultProps,
|
|
57
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import cn from 'classnames';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
import {Switch as ChakraSwitch} from '@chakra-ui/react';
|
|
6
|
-
|
|
7
|
-
import FormControl from '../FormControl/FormControl';
|
|
8
|
-
|
|
9
|
-
const Switch = forwardRef(
|
|
10
|
-
(
|
|
11
|
-
{
|
|
12
|
-
label,
|
|
13
|
-
helperText,
|
|
14
|
-
errorMessage,
|
|
15
|
-
isInvalid,
|
|
16
|
-
isDisabled,
|
|
17
|
-
isRequired,
|
|
18
|
-
...props
|
|
19
|
-
},
|
|
20
|
-
ref
|
|
21
|
-
) => {
|
|
22
|
-
const classes = cn({'FormElement-contains-error': isInvalid});
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<FormControl
|
|
26
|
-
isInvalid={isInvalid}
|
|
27
|
-
isDisabled={isDisabled}
|
|
28
|
-
isRequired={isRequired}
|
|
29
|
-
errorMessage={errorMessage}
|
|
30
|
-
helperText={helperText}
|
|
31
|
-
label={label}
|
|
32
|
-
inputId={props.id}
|
|
33
|
-
>
|
|
34
|
-
<ChakraSwitch ref={ref} className={classes} {...props} />
|
|
35
|
-
</FormControl>
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
Switch.propTypes = {
|
|
41
|
-
isChecked: PropTypes.bool,
|
|
42
|
-
defaultChecked: PropTypes.bool,
|
|
43
|
-
id: PropTypes.string.isRequired,
|
|
44
|
-
label: PropTypes.string,
|
|
45
|
-
helperText: PropTypes.string,
|
|
46
|
-
errorMessage: PropTypes.string,
|
|
47
|
-
isInvalid: PropTypes.bool,
|
|
48
|
-
isDisabled: PropTypes.bool,
|
|
49
|
-
isRequired: PropTypes.bool,
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default Switch;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import Component from './Switch';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'v2/Switch',
|
|
8
|
-
component: Component,
|
|
9
|
-
parameters: {
|
|
10
|
-
removeBaseHtmlClass: true,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const SwitchTemplate = props => <Component {...props} />;
|
|
15
|
-
|
|
16
|
-
SwitchTemplate.propTypes = {
|
|
17
|
-
isChecked: PropTypes.bool,
|
|
18
|
-
defaultChecked: PropTypes.bool,
|
|
19
|
-
id: PropTypes.string.isRequired,
|
|
20
|
-
label: PropTypes.string,
|
|
21
|
-
helperText: PropTypes.string,
|
|
22
|
-
errorMessage: PropTypes.string,
|
|
23
|
-
isInvalid: PropTypes.bool,
|
|
24
|
-
isDisabled: PropTypes.bool,
|
|
25
|
-
isRequired: PropTypes.bool,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Switch = SwitchTemplate.bind({});
|
|
29
|
-
|
|
30
|
-
Switch.argTypes = {
|
|
31
|
-
isChecked: {
|
|
32
|
-
control: {
|
|
33
|
-
type: 'boolean',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
defaultChecked: {
|
|
37
|
-
control: {
|
|
38
|
-
type: 'boolean',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
id: {
|
|
42
|
-
control: {
|
|
43
|
-
type: 'text',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
label: {
|
|
47
|
-
control: {
|
|
48
|
-
type: 'text',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
helperText: {
|
|
52
|
-
control: {
|
|
53
|
-
type: 'text',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
errorMessage: {
|
|
57
|
-
control: {
|
|
58
|
-
type: 'text',
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
isInvalid: {
|
|
62
|
-
control: {
|
|
63
|
-
type: 'boolean',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
isDisabled: {
|
|
67
|
-
control: {
|
|
68
|
-
type: 'boolean',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
isRequired: {
|
|
72
|
-
control: {
|
|
73
|
-
type: 'boolean',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
Switch.args = {
|
|
79
|
-
isChecked: true,
|
|
80
|
-
defaultChecked: false,
|
|
81
|
-
id: 'Switch_Id',
|
|
82
|
-
label: 'Label',
|
|
83
|
-
helperText: 'Helper Text',
|
|
84
|
-
errorMessage: 'Error Message',
|
|
85
|
-
isInvalid: false,
|
|
86
|
-
isDisabled: false,
|
|
87
|
-
isRequired: false,
|
|
88
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './Switch';
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
const overrides = {
|
|
5
|
-
defaultProps: {
|
|
6
|
-
colorScheme: 'primary',
|
|
7
|
-
size: 'lg',
|
|
8
|
-
},
|
|
9
|
-
baseStyle: props =>
|
|
10
|
-
merge(chakraDefaultTheme.components.Switch.baseStyle(props), {
|
|
11
|
-
track: {
|
|
12
|
-
bg: 'gray.medium',
|
|
13
|
-
},
|
|
14
|
-
}),
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export default {...chakraDefaultTheme.components.Switch, ...overrides};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {Table as default} from '@chakra-ui/react';
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import Component from './Table';
|
|
5
|
-
import {variants} from './Table.styles';
|
|
6
|
-
import {Thead, Tbody, Tr, Th, Td} from './index';
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
title: 'v2/Table',
|
|
10
|
-
parameters: {
|
|
11
|
-
removeBaseHtmlClass: true,
|
|
12
|
-
},
|
|
13
|
-
argTypes: {
|
|
14
|
-
numberOfColumns: {
|
|
15
|
-
table: {
|
|
16
|
-
disable: true,
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
numberOfRows: {
|
|
20
|
-
table: {
|
|
21
|
-
disable: true,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
tableData: {
|
|
25
|
-
table: {
|
|
26
|
-
disable: true,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
tableHeading: {
|
|
30
|
-
table: {
|
|
31
|
-
disable: true,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
variant: {
|
|
35
|
-
control: {
|
|
36
|
-
type: 'select',
|
|
37
|
-
options: Object.keys(variants),
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const TableTemplate = ({
|
|
44
|
-
numberOfColumns,
|
|
45
|
-
numberOfRows,
|
|
46
|
-
tableData,
|
|
47
|
-
tableHeading,
|
|
48
|
-
variant,
|
|
49
|
-
}) => {
|
|
50
|
-
return (
|
|
51
|
-
<Component variant={variant}>
|
|
52
|
-
<Thead>
|
|
53
|
-
<Tr>
|
|
54
|
-
{Array(numberOfColumns)
|
|
55
|
-
.fill(tableHeading)
|
|
56
|
-
.map((heading, index) => (
|
|
57
|
-
<Th key={index}>{heading}</Th>
|
|
58
|
-
))}
|
|
59
|
-
</Tr>
|
|
60
|
-
</Thead>
|
|
61
|
-
<Tbody>
|
|
62
|
-
{Array(numberOfRows)
|
|
63
|
-
.fill(Array(numberOfColumns).fill(tableData))
|
|
64
|
-
.map((row, i) => (
|
|
65
|
-
<Tr key={i}>
|
|
66
|
-
{row.map((data, index) => (
|
|
67
|
-
<Td key={index}>{data}</Td>
|
|
68
|
-
))}
|
|
69
|
-
</Tr>
|
|
70
|
-
))}
|
|
71
|
-
</Tbody>
|
|
72
|
-
</Component>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
TableTemplate.propTypes = {
|
|
77
|
-
numberOfColumns: PropTypes.number,
|
|
78
|
-
numberOfRows: PropTypes.number,
|
|
79
|
-
tableData: PropTypes.string,
|
|
80
|
-
tableHeading: PropTypes.string,
|
|
81
|
-
variant: PropTypes.string,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const Table = TableTemplate.bind({});
|
|
85
|
-
Table.args = {
|
|
86
|
-
numberOfColumns: 3,
|
|
87
|
-
numberOfRows: 3,
|
|
88
|
-
tableData: 'Table cell data',
|
|
89
|
-
tableHeading: 'Column Heading',
|
|
90
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import {variants as headingVariants} from 'components/Heading/Heading.styles';
|
|
2
|
-
|
|
3
|
-
const parts = ['table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption'];
|
|
4
|
-
|
|
5
|
-
const baseStyle = {
|
|
6
|
-
table: {
|
|
7
|
-
borderCollapse: 'collapse',
|
|
8
|
-
color: 'text.primary.light',
|
|
9
|
-
width: '100%',
|
|
10
|
-
},
|
|
11
|
-
thead: {
|
|
12
|
-
borderBottom: '1px',
|
|
13
|
-
borderColor: 'gray.medium',
|
|
14
|
-
},
|
|
15
|
-
th: {
|
|
16
|
-
fontFamily: 'heading',
|
|
17
|
-
fontSize: headingVariants.h4.fontSize,
|
|
18
|
-
fontWeight: 'semibold',
|
|
19
|
-
letterSpacing: 'unset',
|
|
20
|
-
padding: 4,
|
|
21
|
-
textAlign: 'start',
|
|
22
|
-
textTransform: 'none',
|
|
23
|
-
},
|
|
24
|
-
tr: {
|
|
25
|
-
borderBottom: '1px',
|
|
26
|
-
borderColor: 'gray.medium',
|
|
27
|
-
_last: {
|
|
28
|
-
border: 'none',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
td: {
|
|
32
|
-
padding: 4,
|
|
33
|
-
textAlign: 'start',
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const roundedWhiteVariant = {
|
|
38
|
-
table: {
|
|
39
|
-
backgroundColor: 'background.white',
|
|
40
|
-
borderRadius: 6,
|
|
41
|
-
boxShadow: 'md',
|
|
42
|
-
marginBottom: 1,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
const roundedGrayVariant = {
|
|
46
|
-
table: {
|
|
47
|
-
...roundedWhiteVariant.table,
|
|
48
|
-
backgroundColor: 'background.gray',
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const variants = {
|
|
53
|
-
rounded: roundedWhiteVariant,
|
|
54
|
-
roundedGray: roundedGrayVariant,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const defaultProps = {
|
|
58
|
-
variant: 'rounded',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
parts,
|
|
63
|
-
variants,
|
|
64
|
-
baseStyle,
|
|
65
|
-
defaultProps,
|
|
66
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {Tabs as ChakraTabs, forwardRef} from '@chakra-ui/react';
|
|
4
|
-
import combineSizeWithVariant from './combineSizeWithVariant';
|
|
5
|
-
|
|
6
|
-
export const SIZE_SMALL = 'small';
|
|
7
|
-
export const SIZE_BODY = 'body';
|
|
8
|
-
export const SIZE_HEADING = 'heading';
|
|
9
|
-
|
|
10
|
-
const sizeMapping = {
|
|
11
|
-
[SIZE_SMALL]: 'sm',
|
|
12
|
-
[SIZE_BODY]: 'md',
|
|
13
|
-
[SIZE_HEADING]: 'lg',
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const Tabs = forwardRef(({size, ...props}, ref) => {
|
|
17
|
-
return (
|
|
18
|
-
<ChakraTabs
|
|
19
|
-
size={sizeMapping[size]}
|
|
20
|
-
{...props}
|
|
21
|
-
{...combineSizeWithVariant({size})}
|
|
22
|
-
ref={ref}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
Tabs.defaultProps = {
|
|
28
|
-
size: SIZE_BODY,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
Tabs.propTypes = {
|
|
32
|
-
/** The React node that will render inside the element */
|
|
33
|
-
children: PropTypes.node,
|
|
34
|
-
/** Controls the size of Tabs */
|
|
35
|
-
size: PropTypes.oneOf([SIZE_SMALL, SIZE_BODY, SIZE_HEADING]),
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export default Tabs;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import Component, {SIZE_BODY, SIZE_HEADING, SIZE_SMALL} from './Tabs';
|
|
4
|
-
import {TabList, TabPanels, Tab, TabPanel} from './index';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'v2/Tabs',
|
|
8
|
-
parameters: {
|
|
9
|
-
removeBaseHtmlClass: true,
|
|
10
|
-
},
|
|
11
|
-
argTypes: {
|
|
12
|
-
size: {
|
|
13
|
-
control: {
|
|
14
|
-
type: 'select',
|
|
15
|
-
options: [SIZE_SMALL, SIZE_BODY, SIZE_HEADING],
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const TabsTemplate = props => {
|
|
22
|
-
return (
|
|
23
|
-
<Component variant="line" {...props}>
|
|
24
|
-
<TabList>
|
|
25
|
-
<Tab>One</Tab>
|
|
26
|
-
<Tab>Two</Tab>
|
|
27
|
-
<Tab>Three</Tab>
|
|
28
|
-
</TabList>
|
|
29
|
-
|
|
30
|
-
<TabPanels>
|
|
31
|
-
<TabPanel>
|
|
32
|
-
<p>one!</p>
|
|
33
|
-
</TabPanel>
|
|
34
|
-
<TabPanel>
|
|
35
|
-
<p>two!</p>
|
|
36
|
-
</TabPanel>
|
|
37
|
-
<TabPanel>
|
|
38
|
-
<p>three!</p>
|
|
39
|
-
</TabPanel>
|
|
40
|
-
</TabPanels>
|
|
41
|
-
</Component>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
TabsTemplate.propTypes = {};
|
|
46
|
-
|
|
47
|
-
export const Tabs = TabsTemplate.bind({});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import styles from './styles/index';
|
|
2
|
-
import {fontSizes} from 'theme/base/typography';
|
|
3
|
-
import {SIZE_BODY, SIZE_HEADING, SIZE_SMALL} from './Tabs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* ### `combineSizeWithVariant`
|
|
7
|
-
* A function that takes in the `size` value, and the
|
|
8
|
-
* `variant` value. The default-like styling for the `size` prop is merged with the styling from the
|
|
9
|
-
* `variant` and a combined styleProp object is returned.
|
|
10
|
-
*
|
|
11
|
-
* @function combineSizeWithVariant
|
|
12
|
-
* @param {string} args.size - The size of Tabs component
|
|
13
|
-
* @param {string} args.variant - The style variant for the Text component
|
|
14
|
-
* @returns {Object} An object containing the merged styleProps from the `variant` and the `size` props
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const combineSizeWithVariant = ({size, variant = 'line'}) => {
|
|
18
|
-
const fontSizeMapping = {
|
|
19
|
-
[SIZE_SMALL]: fontSizes.xs,
|
|
20
|
-
[SIZE_BODY]: fontSizes.base,
|
|
21
|
-
[SIZE_HEADING]: fontSizes.lg,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const styleProps = styles.variants[`${variant}`];
|
|
25
|
-
|
|
26
|
-
styleProps.tab.fontSize = fontSizeMapping[size];
|
|
27
|
-
|
|
28
|
-
return styleProps;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default combineSizeWithVariant;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
const variants = {
|
|
5
|
-
line: {
|
|
6
|
-
tablist: {
|
|
7
|
-
borderBottom: '2px solid',
|
|
8
|
-
borderColor: 'inherit',
|
|
9
|
-
},
|
|
10
|
-
tab: {
|
|
11
|
-
color: 'gray.600',
|
|
12
|
-
borderBottom: '2px solid',
|
|
13
|
-
borderColor: 'transparent',
|
|
14
|
-
marginBottom: '-2px',
|
|
15
|
-
_selected: {
|
|
16
|
-
color: 'primary.default',
|
|
17
|
-
borderColor: 'primary.default',
|
|
18
|
-
fontWeight: 'semibold',
|
|
19
|
-
},
|
|
20
|
-
_focus: {
|
|
21
|
-
boxShadow: 'none',
|
|
22
|
-
},
|
|
23
|
-
_active: {
|
|
24
|
-
color: 'black',
|
|
25
|
-
bg: 'transparent',
|
|
26
|
-
},
|
|
27
|
-
_disabled: {
|
|
28
|
-
opacity: 0.4,
|
|
29
|
-
cursor: 'not-allowed',
|
|
30
|
-
},
|
|
31
|
-
_hover: {
|
|
32
|
-
color: 'black'
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export default merge(chakraDefaultTheme.components.Tabs, {
|
|
39
|
-
variants,
|
|
40
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import {Text as ChakraText, forwardRef} from '@chakra-ui/react';
|
|
4
|
-
|
|
5
|
-
import asOptions from './options';
|
|
6
|
-
import {variants} from './Text.styles';
|
|
7
|
-
import combineAsWithVariant from './combineAsWithVariant';
|
|
8
|
-
|
|
9
|
-
const Text = forwardRef(({as, variant, ...props}, ref) => {
|
|
10
|
-
return (
|
|
11
|
-
<ChakraText
|
|
12
|
-
variant={variant}
|
|
13
|
-
as={as}
|
|
14
|
-
{...combineAsWithVariant({as, variant})}
|
|
15
|
-
{...props}
|
|
16
|
-
ref={ref}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
Text.defaultProps = {
|
|
22
|
-
as: 'p',
|
|
23
|
-
variant: 'body',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
Text.propTypes = {
|
|
27
|
-
/** The React node that will render inside the element */
|
|
28
|
-
children: PropTypes.node,
|
|
29
|
-
/** Controls the underlying styling of the html heading tag */
|
|
30
|
-
as: PropTypes.oneOf(asOptions),
|
|
31
|
-
/** The styling that will be applied to the component regardless of the underlying html */
|
|
32
|
-
variant: PropTypes.oneOf(Object.keys(variants)),
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export default Text;
|