@spothero/ui 14.4.0 → 14.5.0
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/CHANGELOG.md +23 -0
- package/CHANGELOG.tmp +21 -3
- package/package.json +1 -1
- package/styles/v2/components/FormControl/FormControl.jsx +43 -0
- package/styles/v2/components/Input/Input.jsx +41 -0
- package/styles/v2/components/Input/Input.stories.js +53 -0
- package/styles/v2/components/Input/index.js +1 -0
- package/styles/v2/components/Input/styles/index.js +35 -0
- package/styles/v2/components/index.js +1 -0
- package/styles/v2/components/styles.js +1 -0
- package/v2/index-bundled.cjs.js +3 -3
- package/v2/index-bundled.cjs.js.map +1 -1
- package/v2/index-bundled.esm.js +3 -3
- package/v2/index-bundled.esm.js.map +1 -1
- package/v2/index-unbundled.cjs.js +956 -472
- package/v2/index-unbundled.cjs.js.map +1 -1
- package/v2/index-unbundled.esm.js +944 -461
- package/v2/index-unbundled.esm.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# 14.5.0 - 05/03/2022
|
|
2
|
+
|
|
3
|
+
## New Features
|
|
4
|
+
* [[173526f](https://github.com/spothero/fe-ui/commit/173526f)] - FED-354 feat: adds Input component ([#283](https://github.com/spothero/fe-ui/pull/283)) (annaliarosed)
|
|
5
|
+
* `feat:` Set up TextInput component
|
|
6
|
+
* `refactor:` Rename component and set up styles
|
|
7
|
+
* `feat:` Unlabeled, placeholder styles added
|
|
8
|
+
* `feat:` Unlabeled, value styles added
|
|
9
|
+
* `feat:` Unlabeled, focus styles added
|
|
10
|
+
* `feat:` Unlabeled, error and disabled styles added
|
|
11
|
+
* `feat:` Add label prop and styles
|
|
12
|
+
* `feat:` Add helperText prop and styles
|
|
13
|
+
* `feat:` Add errorMessage prop and styles
|
|
14
|
+
* `feat:` Add isReadOnly prop to stories
|
|
15
|
+
* `fix:` Clean up
|
|
16
|
+
* `fix:` Change value color when isInvalid
|
|
17
|
+
* `fix:` Add missing ref
|
|
18
|
+
* `refactor:` Extract FormControl
|
|
19
|
+
* `fix:` Remove imported interfaces
|
|
20
|
+
* `fix:` Pass only isInvalid prop to FormControl
|
|
21
|
+
* `fix:` Pass only isDisabled and isRequired prop to FormControl
|
|
22
|
+
* `fix:` Pass forgotten propsCo-authored-by: Annalia Destefano <annalia.destefano@spothero.com>
|
|
23
|
+
|
|
1
24
|
# 14.4.0 - 04/21/2022
|
|
2
25
|
|
|
3
26
|
## Dependency Updates
|
package/CHANGELOG.tmp
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
# 14.
|
|
1
|
+
# 14.5.0 - 05/03/2022
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
* [[
|
|
3
|
+
## New Features
|
|
4
|
+
* [[173526f](https://github.com/spothero/fe-ui/commit/173526f)] - FED-354 feat: adds Input component ([#283](https://github.com/spothero/fe-ui/pull/283)) (annaliarosed)
|
|
5
|
+
* `feat:` Set up TextInput component
|
|
6
|
+
* `refactor:` Rename component and set up styles
|
|
7
|
+
* `feat:` Unlabeled, placeholder styles added
|
|
8
|
+
* `feat:` Unlabeled, value styles added
|
|
9
|
+
* `feat:` Unlabeled, focus styles added
|
|
10
|
+
* `feat:` Unlabeled, error and disabled styles added
|
|
11
|
+
* `feat:` Add label prop and styles
|
|
12
|
+
* `feat:` Add helperText prop and styles
|
|
13
|
+
* `feat:` Add errorMessage prop and styles
|
|
14
|
+
* `feat:` Add isReadOnly prop to stories
|
|
15
|
+
* `fix:` Clean up
|
|
16
|
+
* `fix:` Change value color when isInvalid
|
|
17
|
+
* `fix:` Add missing ref
|
|
18
|
+
* `refactor:` Extract FormControl
|
|
19
|
+
* `fix:` Remove imported interfaces
|
|
20
|
+
* `fix:` Pass only isInvalid prop to FormControl
|
|
21
|
+
* `fix:` Pass only isDisabled and isRequired prop to FormControl
|
|
22
|
+
* `fix:` Pass forgotten propsCo-authored-by: Annalia Destefano <annalia.destefano@spothero.com>
|
|
5
23
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
} from '@chakra-ui/react';
|
|
9
|
+
|
|
10
|
+
const FormControl = forwardRef(
|
|
11
|
+
({children, label, helperText, errorMessage, ...props}, ref) => (
|
|
12
|
+
<ChakraFormControl {...props} ref={ref}>
|
|
13
|
+
{label && (
|
|
14
|
+
<FormLabel
|
|
15
|
+
color="gray.600"
|
|
16
|
+
fontWeight="semibold"
|
|
17
|
+
mb={2}
|
|
18
|
+
fontSize="sm"
|
|
19
|
+
>
|
|
20
|
+
{label}
|
|
21
|
+
</FormLabel>
|
|
22
|
+
)}
|
|
23
|
+
{children}
|
|
24
|
+
{helperText && (
|
|
25
|
+
<FormHelperText color="gray.600" mt={1} fontSize="xs">
|
|
26
|
+
{helperText}
|
|
27
|
+
</FormHelperText>
|
|
28
|
+
)}
|
|
29
|
+
<FormErrorMessage color="error" mt={1} fontSize="xs">
|
|
30
|
+
{errorMessage}
|
|
31
|
+
</FormErrorMessage>
|
|
32
|
+
</ChakraFormControl>
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
FormControl.propTypes = {
|
|
37
|
+
label: PropTypes.string,
|
|
38
|
+
helperText: PropTypes.string,
|
|
39
|
+
errorMessage: PropTypes.string,
|
|
40
|
+
children: PropTypes.node,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default FormControl;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, {forwardRef} from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {Input as ChakraInput} from '@chakra-ui/react';
|
|
4
|
+
import FormControl from '../FormControl/FormControl';
|
|
5
|
+
|
|
6
|
+
const Input = forwardRef(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
label,
|
|
10
|
+
helperText,
|
|
11
|
+
errorMessage,
|
|
12
|
+
isInvalid,
|
|
13
|
+
isDisabled,
|
|
14
|
+
isRequired,
|
|
15
|
+
...props
|
|
16
|
+
},
|
|
17
|
+
ref
|
|
18
|
+
) => (
|
|
19
|
+
<FormControl
|
|
20
|
+
isInvalid={isInvalid}
|
|
21
|
+
isDisabled={isDisabled}
|
|
22
|
+
isRequired={isRequired}
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
helperText={helperText}
|
|
25
|
+
label={label}
|
|
26
|
+
>
|
|
27
|
+
<ChakraInput ref={ref} {...props} />
|
|
28
|
+
</FormControl>
|
|
29
|
+
)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
Input.propTypes = {
|
|
33
|
+
label: PropTypes.string,
|
|
34
|
+
helperText: PropTypes.string,
|
|
35
|
+
errorMessage: PropTypes.string,
|
|
36
|
+
isInvalid: PropTypes.bool,
|
|
37
|
+
isDisabled: PropTypes.bool,
|
|
38
|
+
isRequired: PropTypes.bool,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Input;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import Component from './Input';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'v2/Input',
|
|
8
|
+
component: Component,
|
|
9
|
+
parameters: {
|
|
10
|
+
removeBaseHtmlClass: true,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const InputTemplate = props => (
|
|
15
|
+
<Component variant="outline" maxWidth="200px" {...props} />
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
InputTemplate.propTypes = {
|
|
19
|
+
placeholder: PropTypes.string,
|
|
20
|
+
label: PropTypes.string,
|
|
21
|
+
helperText: PropTypes.string,
|
|
22
|
+
errorMessage: PropTypes.string,
|
|
23
|
+
isInvalid: PropTypes.bool,
|
|
24
|
+
isDisabled: PropTypes.bool,
|
|
25
|
+
isReadOnly: PropTypes.bool,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Input = InputTemplate.bind({});
|
|
29
|
+
|
|
30
|
+
Input.argTypes = {
|
|
31
|
+
placeholder: {
|
|
32
|
+
control: {type: 'text'},
|
|
33
|
+
},
|
|
34
|
+
label: {
|
|
35
|
+
control: {type: 'text'},
|
|
36
|
+
},
|
|
37
|
+
helperText: {
|
|
38
|
+
control: {type: 'text'},
|
|
39
|
+
},
|
|
40
|
+
errorMessage: {
|
|
41
|
+
control: {type: 'text'},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
Input.args = {
|
|
46
|
+
placeholder: 'Placeholder text',
|
|
47
|
+
label: 'Label',
|
|
48
|
+
helperText: 'Helper text',
|
|
49
|
+
errorMessage: 'Error message',
|
|
50
|
+
isInvalid: false,
|
|
51
|
+
isDisabled: false,
|
|
52
|
+
isReadOnly: false,
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default} from './Input';
|
|
@@ -0,0 +1,35 @@
|
|
|
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: 'gray.200',
|
|
9
|
+
fontSize: 'base',
|
|
10
|
+
paddingLeft: 3,
|
|
11
|
+
paddingRight: 3,
|
|
12
|
+
bg: 'inherit',
|
|
13
|
+
fontWeight: 'semibold',
|
|
14
|
+
boxShadow: 'none !important',
|
|
15
|
+
_placeholder: {color: 'gray.600', fontWeight: 'normal'},
|
|
16
|
+
_focus: {
|
|
17
|
+
borderColor: 'brandBlue',
|
|
18
|
+
},
|
|
19
|
+
_hover: {borderColor: 'gray.300'},
|
|
20
|
+
_readOnly: {boxShadow: 'none !important', userSelect: 'all'},
|
|
21
|
+
_disabled: {
|
|
22
|
+
backgroundColor: 'gray.50',
|
|
23
|
+
opacity: 0.4,
|
|
24
|
+
cursor: 'not-allowed',
|
|
25
|
+
},
|
|
26
|
+
_invalid: {
|
|
27
|
+
borderColor: 'error',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default merge(chakraDefaultTheme.components.Input, {
|
|
34
|
+
variants,
|
|
35
|
+
});
|
|
@@ -22,6 +22,7 @@ export {default as Icon} from './Icon/Icon';
|
|
|
22
22
|
export {default as Image} from './Image/Image';
|
|
23
23
|
export {default as Loader} from './Loader/Loader';
|
|
24
24
|
export {default as Checkbox} from './Checkbox';
|
|
25
|
+
export {default as Input} from './Input';
|
|
25
26
|
export {Popover, PopoverTrigger, PopoverContent} from './Popover';
|
|
26
27
|
|
|
27
28
|
// generic chakra reexports
|