@spothero/ui 14.5.0 → 14.5.2-beta.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 CHANGED
@@ -1,3 +1,12 @@
1
+ # 14.5.2-beta.0 - 05/09/2022
2
+
3
+ ## Miscellaneous Updates
4
+ * [[4e10f87](https://github.com/spothero/fe-ui/commit/4e10f87)] - `fix:` Link new Input and Label using htmlFor (Mick Johnson)
5
+
6
+ # 14.5.1 - 05/05/2022
7
+ ## Miscellaneous Updates
8
+ * [[87e838a](https://github.com/spothero/fe-ui/commit/87e838a)] - `feature:` FED 321 secondary button updates, add tertiary and destructive buttons ([#284](https://github.com/spothero/fe-ui/pull/284)) (Mick Johnson)
9
+
1
10
  # 14.5.0 - 05/03/2022
2
11
 
3
12
  ## New Features
package/CHANGELOG.tmp CHANGED
@@ -1,23 +1,5 @@
1
- # 14.5.0 - 05/03/2022
1
+ # 14.5.2-beta.0 - 05/09/2022
2
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>
3
+ ## Miscellaneous Updates
4
+ * [[4e10f87](https://github.com/spothero/fe-ui/commit/4e10f87)] - `fix:` Link new Input and Label using htmlFor (Mick Johnson)
23
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spothero/ui",
3
- "version": "14.5.0",
3
+ "version": "14.5.2-beta.0",
4
4
  "description": "SpotHero's React component UI library.",
5
5
  "main": "v2/index-bundled.cjs.js",
6
6
  "module": "v2/index.js",
@@ -15,6 +15,7 @@ const anchorProps = (isExternal = false) => ({
15
15
  const Button = forwardRef(({asAnchor, isExternal, ...props}, ref) => (
16
16
  <ChakraButton
17
17
  iconSpacing={2}
18
+ sx={{'text-underline-offset': '1px'}}
18
19
  {...props}
19
20
  {...((asAnchor || props.as === 'a') && anchorProps(isExternal))}
20
21
  ref={ref}
@@ -32,6 +32,17 @@ const disabledButtonHoverStyle = {
32
32
  },
33
33
  };
34
34
 
35
+ const destructiveButtonStyles = {
36
+ bg: 'white',
37
+ borderColor: 'red.default',
38
+ color: 'red.default',
39
+ _hover: {
40
+ borderColor: 'red.800',
41
+ color: 'red.800',
42
+ ...disabledButtonHoverStyle,
43
+ },
44
+ };
45
+
35
46
  export const variants = {
36
47
  primary: {
37
48
  bg: 'primary.default',
@@ -63,7 +74,7 @@ export const variants = {
63
74
  borderColor: 'gray.medium',
64
75
  color: 'primary.default',
65
76
  _hover: {
66
- borderColor: 'primary.default',
77
+ borderColor: 'primary.600',
67
78
  color: 'primary.600',
68
79
  ...disabledButtonHoverStyle,
69
80
  },
@@ -125,6 +136,57 @@ export const variants = {
125
136
  },
126
137
  },
127
138
  },
139
+ tertiary: {
140
+ bg: 'none',
141
+ borderWidth: 'none',
142
+ borderRadius: 'unset',
143
+ color: 'primary.default',
144
+ textDecoration: 'underline',
145
+ h: 'unset',
146
+ m: 'unset',
147
+ minW: 'unset',
148
+ p: 'unset',
149
+ lineHeight: 1,
150
+ _disabled: {
151
+ bg: 'none',
152
+ color: 'gray.dark',
153
+ },
154
+ _hover: {
155
+ color: 'primary.600',
156
+ _disabled: {
157
+ color: 'gray.dark',
158
+ },
159
+ },
160
+ },
161
+ tertiaryOnDark: {
162
+ bg: 'none',
163
+ borderRadius: 'unset',
164
+ borderWidth: 'none',
165
+ color: 'white',
166
+ textDecoration: 'underline',
167
+ h: 'unset',
168
+ m: 'unset',
169
+ minW: 'unset',
170
+ p: 'unset',
171
+ _disabled: {
172
+ bg: 'none',
173
+ color: 'white',
174
+ opacity: '.7',
175
+ },
176
+ _hover: {
177
+ color: 'white',
178
+ opacity: '.8',
179
+ _disabled: {
180
+ opacity: '.7',
181
+ },
182
+ },
183
+ },
184
+ destructive: {
185
+ ...destructiveButtonStyles,
186
+ },
187
+ destructiveOnDark: {
188
+ ...destructiveButtonStyles,
189
+ },
128
190
  };
129
191
 
130
192
  const defaultProps = {
@@ -58,8 +58,23 @@ Tertiary.argTypes = {
58
58
  onClick: {action: 'clicked'},
59
59
  };
60
60
  Tertiary.args = {
61
- children: 'textButton',
62
- variant: 'textButton',
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',
63
78
  isDisabled: false,
64
79
  isLoading: false,
65
80
  loadingText: 'Loading',
@@ -8,21 +8,26 @@ import {
8
8
  } from '@chakra-ui/react';
9
9
 
10
10
  const FormControl = forwardRef(
11
- ({children, label, helperText, errorMessage, ...props}, ref) => (
11
+ ({children, label, inputId, helperText, errorMessage, ...props}, ref) => (
12
12
  <ChakraFormControl {...props} ref={ref}>
13
13
  {label && (
14
14
  <FormLabel
15
- color="gray.600"
15
+ color={props.isInvalid ? 'error' : 'gray.600'}
16
16
  fontWeight="semibold"
17
17
  mb={2}
18
18
  fontSize="sm"
19
+ htmlFor={inputId}
19
20
  >
20
21
  {label}
21
22
  </FormLabel>
22
23
  )}
23
24
  {children}
24
25
  {helperText && (
25
- <FormHelperText color="gray.600" mt={1} fontSize="xs">
26
+ <FormHelperText
27
+ color={props.isInvalid ? 'error' : 'gray.600'}
28
+ mt={1}
29
+ fontSize="xs"
30
+ >
26
31
  {helperText}
27
32
  </FormHelperText>
28
33
  )}
@@ -35,6 +40,8 @@ const FormControl = forwardRef(
35
40
 
36
41
  FormControl.propTypes = {
37
42
  label: PropTypes.string,
43
+ isInvalid: PropTypes.bool,
44
+ inputId: PropTypes.string,
38
45
  helperText: PropTypes.string,
39
46
  errorMessage: PropTypes.string,
40
47
  children: PropTypes.node,
@@ -23,6 +23,7 @@ const Input = forwardRef(
23
23
  errorMessage={errorMessage}
24
24
  helperText={helperText}
25
25
  label={label}
26
+ inputId={props.id}
26
27
  >
27
28
  <ChakraInput ref={ref} {...props} />
28
29
  </FormControl>
@@ -30,6 +31,7 @@ const Input = forwardRef(
30
31
  );
31
32
 
32
33
  Input.propTypes = {
34
+ id: PropTypes.string.isRequired,
33
35
  label: PropTypes.string,
34
36
  helperText: PropTypes.string,
35
37
  errorMessage: PropTypes.string,