@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,73 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import capitalize from 'lodash/capitalize';
|
|
3
|
-
import {Box} from '@chakra-ui/react';
|
|
4
|
-
|
|
5
|
-
import IconCheck from '@spothero/icons/check';
|
|
6
|
-
|
|
7
|
-
import Component from '../Button';
|
|
8
|
-
import {variants} from '../Button.styles';
|
|
9
|
-
import Text from 'components/Text/Text';
|
|
10
|
-
|
|
11
|
-
const variationsArray = ({baseVariantName, hasDarkBackground}) => {
|
|
12
|
-
const variant = `${baseVariantName}${hasDarkBackground ? 'OnDark' : ''}`;
|
|
13
|
-
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
variant,
|
|
17
|
-
children: variant,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
variant,
|
|
21
|
-
children: `${variant} isDisabled`,
|
|
22
|
-
isDisabled: true,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
variant,
|
|
26
|
-
children: `${variant} isLoading`,
|
|
27
|
-
isLoading: true,
|
|
28
|
-
loadingText: 'loading (optional)',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
variant,
|
|
32
|
-
children: `leftIcon`,
|
|
33
|
-
leftIcon: <IconCheck width="1rem" />,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
variant,
|
|
37
|
-
children: `${variant} asAnchor`,
|
|
38
|
-
asAnchor: true,
|
|
39
|
-
href: '#',
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const OverviewTemplate = (args, {hasDarkBackground}) => (
|
|
45
|
-
<Box>
|
|
46
|
-
{Object.keys(variants)
|
|
47
|
-
.filter(name => !/ondark/i.test(name))
|
|
48
|
-
.map((baseVariantName, index) => (
|
|
49
|
-
<Box key={index} mb={4}>
|
|
50
|
-
<Text
|
|
51
|
-
mb="2"
|
|
52
|
-
color={
|
|
53
|
-
hasDarkBackground
|
|
54
|
-
? 'text.primary.dark'
|
|
55
|
-
: 'text.primary.light'
|
|
56
|
-
}
|
|
57
|
-
>
|
|
58
|
-
{capitalize(baseVariantName)}:
|
|
59
|
-
</Text>
|
|
60
|
-
<Box>
|
|
61
|
-
{variationsArray({
|
|
62
|
-
baseVariantName,
|
|
63
|
-
hasDarkBackground,
|
|
64
|
-
}).map((props, key) => (
|
|
65
|
-
<Component key={key} {...props} mr={4} mb={4} />
|
|
66
|
-
))}
|
|
67
|
-
</Box>
|
|
68
|
-
</Box>
|
|
69
|
-
))}
|
|
70
|
-
</Box>
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
export default OverviewTemplate;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import {Box} from '@chakra-ui/react';
|
|
3
|
-
|
|
4
|
-
const Card = forwardRef((props, ref) => (
|
|
5
|
-
<Box
|
|
6
|
-
position="relative"
|
|
7
|
-
padding={4}
|
|
8
|
-
bgColor="background.white"
|
|
9
|
-
borderRadius="lg"
|
|
10
|
-
boxShadow="md"
|
|
11
|
-
{...props}
|
|
12
|
-
ref={ref}
|
|
13
|
-
/>
|
|
14
|
-
));
|
|
15
|
-
|
|
16
|
-
export default Card;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Box} from '@chakra-ui/react';
|
|
4
|
-
import Component from './Card';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'v2/Card',
|
|
8
|
-
component: Component,
|
|
9
|
-
parameters: {
|
|
10
|
-
removeBaseHtmlClass: true,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/*
|
|
15
|
-
Storybook's background is white so the Card is hard to see.
|
|
16
|
-
The Card is typically displayed against a light gray background.
|
|
17
|
-
*/
|
|
18
|
-
const Template = props => (
|
|
19
|
-
<Box backgroundColor="gray.light" padding={8}>
|
|
20
|
-
<Component {...props} />
|
|
21
|
-
</Box>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
Template.propTypes = {
|
|
25
|
-
children: PropTypes.node,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Card = Template.bind({});
|
|
29
|
-
|
|
30
|
-
Card.args = {
|
|
31
|
-
children:
|
|
32
|
-
'Bonbon lollipop tiramisu cupcake bear claw cupcake. Icing candy canes cookie caramels wafer tootsie roll soufflé halvah. Ice cream tart gummies apple pie chocolate bar. Pastry gummies macaroon fruitcake donut sweet caramels candy. Oat cake marshmallow biscuit carrot cake fruitcake brownie pastry liquorice liquorice. Topping sweet gingerbread. Chupa chups caramels brownie. Icing jujubes chupa chups cookie. Carrot cake gummi bears powder apple pie donut pudding macaroon. Icing jelly cupcake powder jelly croissant pastry. Powder jelly fruitcake gummies sweet tootsie roll candy. Icing cheesecake toffee tart pastry lemon drops lemon drops bonbon wafer. Cheesecake ice cream wafer apple pie candy canes croissant. Sweet croissant pudding carrot cake oat cake chupa chups. Gingerbread lemon drops biscuit oat cake carrot cake. Chocolate cake jelly-o cake cake candy lollipop.',
|
|
33
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {Checkbox as default} from '@chakra-ui/react';
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
|
-
import Component from './Checkbox';
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title: 'v2/Checkbox',
|
|
8
|
-
component: Component,
|
|
9
|
-
parameters: {
|
|
10
|
-
removeBaseHtmlClass: true,
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const CheckboxTemplate = props => <Component {...props} />;
|
|
15
|
-
|
|
16
|
-
CheckboxTemplate.propTypes = {
|
|
17
|
-
isChecked: PropTypes.bool,
|
|
18
|
-
isDisabled: PropTypes.bool,
|
|
19
|
-
isIndeterminate: PropTypes.bool,
|
|
20
|
-
defaultIsChecked: PropTypes.bool,
|
|
21
|
-
size: PropTypes.oneOf(['sm', 'md', 'lg']),
|
|
22
|
-
children: PropTypes.node,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Checkbox = CheckboxTemplate.bind({});
|
|
26
|
-
|
|
27
|
-
Checkbox.argTypes = {
|
|
28
|
-
size: {
|
|
29
|
-
options: ['sm', 'md', 'lg'],
|
|
30
|
-
control: {type: 'select'},
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
Checkbox.args = {
|
|
35
|
-
defaultIsChecked: true,
|
|
36
|
-
isChecked: true,
|
|
37
|
-
isDisabled: false,
|
|
38
|
-
isIndeterminate: false,
|
|
39
|
-
size: 'md',
|
|
40
|
-
children: 'R U Cool',
|
|
41
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from './Checkbox';
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
const baseStyle = {
|
|
5
|
-
control: {
|
|
6
|
-
borderWidth: '2px',
|
|
7
|
-
borderStyle: 'solid',
|
|
8
|
-
borderImage: 'initial',
|
|
9
|
-
borderRadius: 'var(--chakra-radii-sm)',
|
|
10
|
-
borderColor: 'gray.200',
|
|
11
|
-
_hover: {borderColor: 'gray.300'},
|
|
12
|
-
_readOnly: {boxShadow: 'none !important', userSelect: 'all'},
|
|
13
|
-
_disabled: {
|
|
14
|
-
opacity: 0.4,
|
|
15
|
-
cursor: 'not-allowed',
|
|
16
|
-
_hover: {borderColor: 'gray.200'},
|
|
17
|
-
},
|
|
18
|
-
_focus: {
|
|
19
|
-
zIndex: 1,
|
|
20
|
-
borderColor: 'primary.400',
|
|
21
|
-
boxShadow: t => `0 0 0 1px ${t.colors.primary['400']}`,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
label: {
|
|
25
|
-
_disabled: {opacity: 0.4, cursor: 'not-allowed'},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default merge(chakraDefaultTheme.components.Checkbox, {
|
|
30
|
-
baseStyle,
|
|
31
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import {Container as ChakraContainer} from '@chakra-ui/react';
|
|
3
|
-
|
|
4
|
-
import styleProps from './Container.styles';
|
|
5
|
-
|
|
6
|
-
const Container = forwardRef((props, ref) => (
|
|
7
|
-
<ChakraContainer {...styleProps} {...props} ref={ref} />
|
|
8
|
-
));
|
|
9
|
-
|
|
10
|
-
export default Container;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Component from './Container';
|
|
3
|
-
import {useTheme, useToken, useBreakpointValue} from '@chakra-ui/react';
|
|
4
|
-
import {createSelectControl} from 'storybook/utils/create-control';
|
|
5
|
-
import {getAllColors} from 'storybook/utils/get-all-colors';
|
|
6
|
-
import {getAllSizes} from 'storybook/utils/get-all-sizes';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
|
|
9
|
-
import styleProps from './Container.styles';
|
|
10
|
-
|
|
11
|
-
export default {
|
|
12
|
-
title: 'v2/Container',
|
|
13
|
-
component: Component,
|
|
14
|
-
parameters: {
|
|
15
|
-
removeBaseHtmlClass: true,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const ContainerTemplate = props => {
|
|
20
|
-
const {remToPixels} = useTheme();
|
|
21
|
-
const breakpoint = useBreakpointValue(styleProps.maxW);
|
|
22
|
-
const size = useToken('sizes', breakpoint);
|
|
23
|
-
const isMobile = breakpoint?.includes('base');
|
|
24
|
-
const headingText = size
|
|
25
|
-
? `Container: ${size}${isMobile ? '' : ` - ${remToPixels(size)}px`}`
|
|
26
|
-
: '';
|
|
27
|
-
|
|
28
|
-
return <Component {...props}>{headingText}</Component>;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
ContainerTemplate.propTypes = {
|
|
32
|
-
color: PropTypes.oneOf(getAllColors),
|
|
33
|
-
bg: PropTypes.oneOf(getAllColors),
|
|
34
|
-
h: PropTypes.oneOf(getAllSizes),
|
|
35
|
-
centerContent: PropTypes.bool,
|
|
36
|
-
children: PropTypes.node,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Container = ContainerTemplate.bind({});
|
|
40
|
-
|
|
41
|
-
Container.argTypes = {
|
|
42
|
-
...createSelectControl('color', getAllColors),
|
|
43
|
-
...createSelectControl('bg', getAllColors),
|
|
44
|
-
...createSelectControl('h', getAllSizes),
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
Container.args = {
|
|
48
|
-
color: 'white',
|
|
49
|
-
bg: 'secondary.default',
|
|
50
|
-
h: '20',
|
|
51
|
-
centerContent: true,
|
|
52
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Divider as ChakraDivider} from '@chakra-ui/react';
|
|
4
|
-
import {colorScheme} from './Divider.styles';
|
|
5
|
-
|
|
6
|
-
const Divider = forwardRef(
|
|
7
|
-
({variant, colorScheme: borderColor, ...props}, ref) => {
|
|
8
|
-
return (
|
|
9
|
-
<ChakraDivider
|
|
10
|
-
{...colorScheme[borderColor]}
|
|
11
|
-
variant={variant}
|
|
12
|
-
{...props}
|
|
13
|
-
ref={ref}
|
|
14
|
-
/>
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
Divider.propTypes = {
|
|
20
|
-
/** Color scheme used */
|
|
21
|
-
colorScheme: PropTypes.oneOf(['low', 'medium']),
|
|
22
|
-
/** The styling that will be applied to the HR tag */
|
|
23
|
-
variant: PropTypes.oneOf(['solid', 'dashed']),
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
Divider.defaultProps = {
|
|
27
|
-
variant: 'solid',
|
|
28
|
-
colorScheme: 'medium',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export default Divider;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {colorScheme} from './Divider.styles';
|
|
4
|
-
|
|
5
|
-
import Component from './Divider';
|
|
6
|
-
|
|
7
|
-
import {Box, Text} from '@chakra-ui/react';
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
title: 'v2/Divider',
|
|
11
|
-
component: Component,
|
|
12
|
-
argTypes: {
|
|
13
|
-
colorScheme: {
|
|
14
|
-
control: {
|
|
15
|
-
type: 'select',
|
|
16
|
-
options: Object.keys(colorScheme),
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
variant: {
|
|
20
|
-
control: {
|
|
21
|
-
type: 'select',
|
|
22
|
-
options: ['solid', 'dashed'],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const Template = props => (
|
|
29
|
-
<Box>
|
|
30
|
-
<Text>Over HowdyHowdyHowdy</Text>
|
|
31
|
-
<Component {...props} />
|
|
32
|
-
<Text>Under HowdyHowdyHowdy</Text>
|
|
33
|
-
</Box>
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
export const Divider = Template.bind({});
|
|
37
|
-
|
|
38
|
-
Divider.args = {
|
|
39
|
-
variant: 'solid',
|
|
40
|
-
colorScheme: 'medium',
|
|
41
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import merge from 'lodash/merge';
|
|
2
|
-
import chakraDefaultTheme from '@chakra-ui/theme';
|
|
3
|
-
|
|
4
|
-
export const colorScheme = {
|
|
5
|
-
low: {
|
|
6
|
-
borderColor: 'gray.100',
|
|
7
|
-
},
|
|
8
|
-
medium: {
|
|
9
|
-
borderColor: 'gray.200',
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default merge(chakraDefaultTheme.components.Divider, {
|
|
14
|
-
colorScheme,
|
|
15
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {
|
|
4
|
-
FormControl as ChakraFormControl,
|
|
5
|
-
FormHelperText,
|
|
6
|
-
FormLabel,
|
|
7
|
-
FormErrorMessage,
|
|
8
|
-
Text,
|
|
9
|
-
} from '@chakra-ui/react';
|
|
10
|
-
|
|
11
|
-
const FormControl = forwardRef(
|
|
12
|
-
(
|
|
13
|
-
{
|
|
14
|
-
children,
|
|
15
|
-
label,
|
|
16
|
-
inputId,
|
|
17
|
-
helperText,
|
|
18
|
-
errorMessage,
|
|
19
|
-
isFieldset,
|
|
20
|
-
...props
|
|
21
|
-
},
|
|
22
|
-
ref
|
|
23
|
-
) => (
|
|
24
|
-
<ChakraFormControl
|
|
25
|
-
{...props}
|
|
26
|
-
ref={ref}
|
|
27
|
-
as={isFieldset ? 'fieldset' : 'div'}
|
|
28
|
-
borderWidth="0"
|
|
29
|
-
>
|
|
30
|
-
{label && (
|
|
31
|
-
<FormLabel
|
|
32
|
-
color="gray.600"
|
|
33
|
-
fontWeight="semibold"
|
|
34
|
-
marginBottom={helperText ? 0 : 1}
|
|
35
|
-
fontSize="sm"
|
|
36
|
-
htmlFor={inputId}
|
|
37
|
-
as={isFieldset ? 'legend' : 'label'}
|
|
38
|
-
requiredIndicator=""
|
|
39
|
-
optionalIndicator={
|
|
40
|
-
props?.isOptional && !props?.isRequired ? (
|
|
41
|
-
<Text
|
|
42
|
-
marginLeft={1}
|
|
43
|
-
as="span"
|
|
44
|
-
variant="caption"
|
|
45
|
-
color="text.secondary.light"
|
|
46
|
-
>
|
|
47
|
-
Optional
|
|
48
|
-
</Text>
|
|
49
|
-
) : null
|
|
50
|
-
}
|
|
51
|
-
>
|
|
52
|
-
{label}
|
|
53
|
-
</FormLabel>
|
|
54
|
-
)}
|
|
55
|
-
{helperText && (
|
|
56
|
-
<FormHelperText color="gray.600" marginBottom={1} fontSize="xs">
|
|
57
|
-
{helperText}
|
|
58
|
-
</FormHelperText>
|
|
59
|
-
)}
|
|
60
|
-
{children}
|
|
61
|
-
<FormErrorMessage color="error" mt={1} fontSize="xs">
|
|
62
|
-
{errorMessage}
|
|
63
|
-
</FormErrorMessage>
|
|
64
|
-
</ChakraFormControl>
|
|
65
|
-
)
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
FormControl.propTypes = {
|
|
69
|
-
inputId: PropTypes.string.isRequired,
|
|
70
|
-
label: PropTypes.string,
|
|
71
|
-
helperText: PropTypes.string,
|
|
72
|
-
errorMessage: PropTypes.string,
|
|
73
|
-
children: PropTypes.element,
|
|
74
|
-
isFieldset: PropTypes.bool,
|
|
75
|
-
isOptional: PropTypes.bool,
|
|
76
|
-
isRequired: PropTypes.bool,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default FormControl;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Grid as ChakraGrid} from '@chakra-ui/react';
|
|
4
|
-
|
|
5
|
-
import {baseStyles, compactStyles} from './Grid.styles';
|
|
6
|
-
|
|
7
|
-
const Grid = forwardRef(({isCompact, ...props}, ref) => (
|
|
8
|
-
<ChakraGrid
|
|
9
|
-
{...baseStyles}
|
|
10
|
-
{...(isCompact && compactStyles)}
|
|
11
|
-
{...props}
|
|
12
|
-
ref={ref}
|
|
13
|
-
/>
|
|
14
|
-
));
|
|
15
|
-
|
|
16
|
-
Grid.propTypes = {
|
|
17
|
-
/** This will reduce the grid gap by half */
|
|
18
|
-
isCompact: PropTypes.bool,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
Grid.defaultProps = {
|
|
22
|
-
isCompact: false,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export default Grid;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Box} from '@chakra-ui/react';
|
|
4
|
-
|
|
5
|
-
import GridComponent from './Grid';
|
|
6
|
-
|
|
7
|
-
import {GridItem as GridItemComponent, Container} from 'components';
|
|
8
|
-
|
|
9
|
-
const rangeControl = (max, min = 1) => ({
|
|
10
|
-
control: {
|
|
11
|
-
max,
|
|
12
|
-
min,
|
|
13
|
-
step: 1,
|
|
14
|
-
type: 'range',
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const SHARED_CHILD_PROPS = {
|
|
19
|
-
isCompact: PropTypes.bool,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const spanMap = {
|
|
23
|
-
1: 12,
|
|
24
|
-
2: 6,
|
|
25
|
-
3: 4,
|
|
26
|
-
4: 3,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
title: 'v2/Grid',
|
|
31
|
-
component: GridComponent,
|
|
32
|
-
subcomponents: {GridItemComponent},
|
|
33
|
-
parameters: {
|
|
34
|
-
removeBaseHtmlClass: true,
|
|
35
|
-
},
|
|
36
|
-
argTypes: {
|
|
37
|
-
isCompact: {
|
|
38
|
-
control: 'boolean',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
const GridTemplate = (args, {hasDarkBackground}) => (
|
|
43
|
-
<Container>
|
|
44
|
-
<GridComponent
|
|
45
|
-
{...args}
|
|
46
|
-
bg={hasDarkBackground ? 'secondary.700' : 'secondary.default'}
|
|
47
|
-
>
|
|
48
|
-
{Array(12)
|
|
49
|
-
.fill(null)
|
|
50
|
-
.map((Item, index) => (
|
|
51
|
-
<GridItemComponent key={`GridItem-${index}`} colSpan={1}>
|
|
52
|
-
<Box
|
|
53
|
-
h="20rem"
|
|
54
|
-
bg={
|
|
55
|
-
hasDarkBackground
|
|
56
|
-
? 'primary.400'
|
|
57
|
-
: 'primary.default'
|
|
58
|
-
}
|
|
59
|
-
/>
|
|
60
|
-
</GridItemComponent>
|
|
61
|
-
))}
|
|
62
|
-
</GridComponent>
|
|
63
|
-
</Container>
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
export const Grid = GridTemplate.bind({});
|
|
67
|
-
|
|
68
|
-
const GridItemTemplate = ({isCompact, ...args}) => (
|
|
69
|
-
<Container>
|
|
70
|
-
<GridComponent bg="secondary.default" isCompact={isCompact}>
|
|
71
|
-
<GridItemComponent {...args}>
|
|
72
|
-
<Box h="20rem" bg="primary.default" />
|
|
73
|
-
</GridItemComponent>
|
|
74
|
-
</GridComponent>
|
|
75
|
-
</Container>
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
GridItemTemplate.propTypes = SHARED_CHILD_PROPS;
|
|
79
|
-
|
|
80
|
-
export const GridItemSpan = GridItemTemplate.bind({});
|
|
81
|
-
GridItemSpan.storyName = 'GridItem - span prop';
|
|
82
|
-
GridItemSpan.argTypes = {
|
|
83
|
-
colSpan: rangeControl(12),
|
|
84
|
-
};
|
|
85
|
-
GridItemSpan.args = {
|
|
86
|
-
colSpan: 12,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
export const GridItemStartEnd = GridItemTemplate.bind({});
|
|
90
|
-
GridItemStartEnd.storyName = 'GridItem - start/end prop';
|
|
91
|
-
GridItemStartEnd.argTypes = {
|
|
92
|
-
colStart: rangeControl(12),
|
|
93
|
-
colEnd: rangeControl(13, 2),
|
|
94
|
-
};
|
|
95
|
-
GridItemStartEnd.args = {
|
|
96
|
-
colStart: 1,
|
|
97
|
-
colEnd: 2,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const ColumnLayoutTemplate = ({numberOfColumns}) => (
|
|
101
|
-
<Container>
|
|
102
|
-
<GridComponent bg="secondary.default">
|
|
103
|
-
{Array(numberOfColumns)
|
|
104
|
-
.fill(null)
|
|
105
|
-
.map((item, index) => (
|
|
106
|
-
<GridItemComponent
|
|
107
|
-
key={`GridItem-${index}`}
|
|
108
|
-
colSpan={spanMap[numberOfColumns]}
|
|
109
|
-
>
|
|
110
|
-
<Box h="20rem" bg="primary.default" />
|
|
111
|
-
</GridItemComponent>
|
|
112
|
-
))}
|
|
113
|
-
</GridComponent>
|
|
114
|
-
</Container>
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
ColumnLayoutTemplate.propTypes = {
|
|
118
|
-
numberOfColumns: PropTypes.number,
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export const GridColumnLayout = ColumnLayoutTemplate.bind({});
|
|
122
|
-
GridColumnLayout.storyName = 'Grid - MultiColumn Layout';
|
|
123
|
-
GridColumnLayout.argTypes = {
|
|
124
|
-
numberOfColumns: rangeControl(4),
|
|
125
|
-
};
|
|
126
|
-
GridColumnLayout.args = {
|
|
127
|
-
numberOfColumns: 2,
|
|
128
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import {GridItem as ChakraGridItem} from '@chakra-ui/react';
|
|
3
|
-
|
|
4
|
-
import styles from './GridItem.styles';
|
|
5
|
-
|
|
6
|
-
const GridItem = forwardRef((props, ref) => (
|
|
7
|
-
<ChakraGridItem {...styles} {...props} ref={ref} />
|
|
8
|
-
));
|
|
9
|
-
|
|
10
|
-
export default GridItem;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, {forwardRef} from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import {Heading as ChakraHeading} from '@chakra-ui/react';
|
|
4
|
-
|
|
5
|
-
import {variants} from './Heading.styles';
|
|
6
|
-
|
|
7
|
-
const Heading = forwardRef((props, ref) => (
|
|
8
|
-
<ChakraHeading
|
|
9
|
-
{...props}
|
|
10
|
-
ref={ref}
|
|
11
|
-
variant={props.variant || props.as || 'h2'}
|
|
12
|
-
/>
|
|
13
|
-
));
|
|
14
|
-
|
|
15
|
-
Heading.propTypes = {
|
|
16
|
-
/** The React node that will render inside the element */
|
|
17
|
-
children: PropTypes.node,
|
|
18
|
-
/** Controls the underlying level of the html heading tag */
|
|
19
|
-
as: PropTypes.oneOf(Object.keys(variants)),
|
|
20
|
-
/** The styling that will be applied to the component regardless of the underlying html */
|
|
21
|
-
variant: PropTypes.oneOf(Object.keys(variants)),
|
|
22
|
-
};
|
|
23
|
-
export default Heading;
|