@spothero/ui 15.0.0 → 15.1.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.
Files changed (94) hide show
  1. package/package.json +2 -3
  2. package/styles/v2/components/FormControl/FormControl.jsx +20 -2
  3. package/styles/v2/components/Radio/Radio.jsx +50 -0
  4. package/styles/v2/components/Radio/Radio.stories.js +155 -0
  5. package/styles/v2/components/Radio/RadioGroup.jsx +69 -0
  6. package/styles/v2/components/Radio/styles/index.js +52 -0
  7. package/styles/v2/components/index.js +1 -0
  8. package/styles/v2/components/styles.js +1 -0
  9. package/v2/index.js +1 -1
  10. package/v2/index.js.map +1 -1
  11. package/styles/Alert/Alert.jsx +0 -45
  12. package/styles/Alert/Alert.spec.js +0 -85
  13. package/styles/AutoSuggestInput/AutoSuggestInput.jsx +0 -429
  14. package/styles/AutoSuggestInput/AutoSuggestInput.spec.js +0 -132
  15. package/styles/AutoSuggestInput/AutoSuggestItem.jsx +0 -61
  16. package/styles/AutoSuggestInput/AutoSuggestList.jsx +0 -85
  17. package/styles/Badge/Badge.jsx +0 -24
  18. package/styles/Badge/Badge.spec.js +0 -43
  19. package/styles/Chart/Chart.jsx +0 -185
  20. package/styles/Chart/Chart.spec.js +0 -369
  21. package/styles/Checkbox/Checkbox.jsx +0 -159
  22. package/styles/Checkbox/Checkbox.spec.js +0 -142
  23. package/styles/DateTime/DatePicker.jsx +0 -281
  24. package/styles/DateTime/DatePicker.spec.js +0 -186
  25. package/styles/DateTime/DatePickerCalendar.jsx +0 -170
  26. package/styles/DateTime/DatePickerCalendarNavigation.jsx +0 -44
  27. package/styles/DateTime/DatePickerCalendarWithRange.jsx +0 -218
  28. package/styles/DateTime/DateTimePicker.jsx +0 -266
  29. package/styles/DateTime/DateTimePicker.spec.js +0 -60
  30. package/styles/DateTime/DateTimeRangePicker.jsx +0 -629
  31. package/styles/DateTime/DateTimeRangePicker.spec.js +0 -425
  32. package/styles/DateTime/TimePicker.jsx +0 -158
  33. package/styles/DateTime/TimePicker.spec.js +0 -148
  34. package/styles/DateTime/date-time-assertions.js +0 -89
  35. package/styles/DateTime/index.js +0 -6
  36. package/styles/ErrorBoundary/ErrorBoundary.jsx +0 -76
  37. package/styles/ErrorBoundary/ErrorBoundary.spec.js +0 -72
  38. package/styles/Flyout/Flyout.jsx +0 -147
  39. package/styles/Flyout/Flyout.spec.js +0 -117
  40. package/styles/Form/Form.jsx +0 -151
  41. package/styles/Form/Form.spec.js +0 -148
  42. package/styles/Form/FormElementError.jsx +0 -18
  43. package/styles/Form/FormGroup.jsx +0 -32
  44. package/styles/Form/FormGroupError.jsx +0 -24
  45. package/styles/Form/index.js +0 -4
  46. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.jsx +0 -215
  47. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.spec.js +0 -213
  48. package/styles/GooglePlacesSearchInput/PoweredByGoogle.jsx +0 -43
  49. package/styles/GooglePlacesSearchInput/index.js +0 -2
  50. package/styles/HorizontalRule/HorizontalRule.jsx +0 -36
  51. package/styles/HorizontalRule/HorizontalRule.spec.js +0 -94
  52. package/styles/Label/Label.jsx +0 -22
  53. package/styles/Label/Label.spec.js +0 -11
  54. package/styles/Notification/Notification.jsx +0 -117
  55. package/styles/Notification/Notification.spec.js +0 -154
  56. package/styles/Notification/NotificationContainer.jsx +0 -90
  57. package/styles/Notification/NotificationPropTypes.js +0 -20
  58. package/styles/Notification/index.js +0 -2
  59. package/styles/PasswordControl/PasswordControl.jsx +0 -197
  60. package/styles/PasswordControl/PasswordControl.spec.js +0 -236
  61. package/styles/Portal/Portal.jsx +0 -65
  62. package/styles/Portal/Portal.spec.js +0 -45
  63. package/styles/PulseLoader/PulseLoader.jsx +0 -71
  64. package/styles/PulseLoader/PulseLoader.spec.js +0 -63
  65. package/styles/Radio/Radio.jsx +0 -114
  66. package/styles/Radio/Radio.spec.js +0 -128
  67. package/styles/Radio/RadioGroup.jsx +0 -105
  68. package/styles/RenderInBody/RenderInBody.jsx +0 -56
  69. package/styles/RenderInBody/RenderInBody.spec.js +0 -24
  70. package/styles/Select/Select.jsx +0 -251
  71. package/styles/Select/Select.spec.js +0 -254
  72. package/styles/Select/SelectItemPropTypes.js +0 -19
  73. package/styles/Select/index.js +0 -2
  74. package/styles/SelectControlled/SelectControlled.jsx +0 -250
  75. package/styles/SelectControlled/SelectControlled.spec.js +0 -290
  76. package/styles/SelectControlled/index.js +0 -1
  77. package/styles/Sprite/Sprite.jsx +0 -16
  78. package/styles/Sprite/Sprite.spec.js +0 -11
  79. package/styles/Tabs/Tab.jsx +0 -38
  80. package/styles/Tabs/TabContent.jsx +0 -46
  81. package/styles/Tabs/TabNavigation.jsx +0 -64
  82. package/styles/Tabs/TabPanel.jsx +0 -30
  83. package/styles/Tabs/Tabs.jsx +0 -87
  84. package/styles/Tabs/Tabs.spec.js +0 -201
  85. package/styles/Tabs/index.js +0 -5
  86. package/styles/TextArea/TextArea.jsx +0 -137
  87. package/styles/TextArea/TextArea.spec.js +0 -111
  88. package/styles/TextInput/TextInput.jsx +0 -159
  89. package/styles/TextInput/TextInput.spec.js +0 -263
  90. package/styles/TextInput/TextInputPropTypes.js +0 -88
  91. package/styles/TextInput/index.js +0 -2
  92. package/styles/Tooltip/Tooltip.jsx +0 -230
  93. package/styles/Tooltip/Tooltip.spec.js +0 -170
  94. /package/styles/{Radio → v2/components/Radio}/index.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spothero/ui",
3
- "version": "15.0.0",
3
+ "version": "15.1.1",
4
4
  "description": "SpotHero's React component UI library.",
5
5
  "main": "v2/index.js",
6
6
  "repository": "https://github.com/spothero/fe-monorepo",
@@ -66,9 +66,8 @@
66
66
  "build:backlog": "NODE_ENV=production babel src -d backlog --ignore \"**/*.spec.js\",\"**/stories/**\",\"**/v2/**\"",
67
67
  "build": "npm run clean && npm run clone:styles && npm run build:backlog && npm run build:v1 && npm run build:v2",
68
68
  "build:storybook": "build-storybook -o ./docs",
69
- "prepublishOnly": "npm run build",
70
69
  "release": "npm-release",
71
- "release:storybook": "npm run build:storybook && push-dir --dir=docs --branch=gh-pages --allow-unclean"
70
+ "publish-storybook": "npm run build:storybook && push-dir --dir=docs --branch=gh-pages --allow-unclean"
72
71
  },
73
72
  "engines": {
74
73
  "node": ">=16.14.2",
@@ -8,8 +8,24 @@ import {
8
8
  } from '@chakra-ui/react';
9
9
 
10
10
  const FormControl = forwardRef(
11
- ({children, label, inputId, helperText, errorMessage, ...props}, ref) => (
12
- <ChakraFormControl {...props} ref={ref}>
11
+ (
12
+ {
13
+ children,
14
+ label,
15
+ inputId,
16
+ helperText,
17
+ errorMessage,
18
+ isFieldset,
19
+ ...props
20
+ },
21
+ ref
22
+ ) => (
23
+ <ChakraFormControl
24
+ {...props}
25
+ ref={ref}
26
+ as={isFieldset ? 'fieldset' : 'div'}
27
+ borderWidth="0"
28
+ >
13
29
  {label && (
14
30
  <FormLabel
15
31
  color="gray.600"
@@ -17,6 +33,7 @@ const FormControl = forwardRef(
17
33
  mb={2}
18
34
  fontSize="sm"
19
35
  htmlFor={inputId}
36
+ as={isFieldset ? 'legend' : 'label'}
20
37
  >
21
38
  {label}
22
39
  </FormLabel>
@@ -40,6 +57,7 @@ FormControl.propTypes = {
40
57
  helperText: PropTypes.string,
41
58
  errorMessage: PropTypes.string,
42
59
  children: PropTypes.element,
60
+ isFieldset: PropTypes.bool,
43
61
  };
44
62
 
45
63
  export default FormControl;
@@ -0,0 +1,50 @@
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
+ {...props}
27
+ alignItems="start"
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;
@@ -0,0 +1,155 @@
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
+ };
@@ -0,0 +1,69 @@
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
+ isRadio
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;
@@ -0,0 +1,52 @@
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
+ });
@@ -25,6 +25,7 @@ export {default as Checkbox} from './Checkbox';
25
25
  export {default as Input} from './Input';
26
26
  export {Popover, PopoverTrigger, PopoverContent} from './Popover';
27
27
  export {Modal} from './Modal';
28
+ export {Radio, RadioGroup} from './Radio';
28
29
 
29
30
  // generic chakra reexports
30
31
  export {
@@ -13,3 +13,4 @@ export {default as Checkbox} from './Checkbox/styles';
13
13
  export {default as Popover} from './Popover/styles';
14
14
  export {default as Input} from './Input/styles';
15
15
  export {default as Modal} from './Modal/styles';
16
+ export {default as Radio} from './Radio/styles';