@spothero/ui 13.9.0-beta.0 → 13.9.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/CHANGELOG.tmp +2 -2
  3. package/backlog/GooglePlacesSearchInput/GooglePlacesSearchInput.js +3 -12
  4. package/package.json +1 -1
  5. package/styles/GooglePlacesSearchInput/GooglePlacesSearchInput.jsx +1 -17
  6. package/styles/v2/components/ImageCarousel/ImageCarousel.jsx +9 -3
  7. package/styles/v2/components/Popover/Popover.jsx +28 -0
  8. package/styles/v2/components/Popover/Popover.stories.js +113 -0
  9. package/styles/v2/components/Popover/PopoverArrow.jsx +10 -0
  10. package/styles/v2/components/Popover/PopoverCloseButton.jsx +10 -0
  11. package/styles/v2/components/Popover/PopoverContent.jsx +41 -0
  12. package/styles/v2/components/Popover/index.js +3 -0
  13. package/styles/v2/components/Popover/styles/index.js +21 -0
  14. package/styles/v2/components/Popover/styles/popover-arrow.js +5 -0
  15. package/styles/v2/components/Popover/styles/popover-body.js +5 -0
  16. package/styles/v2/components/Popover/styles/popover-close-button.js +17 -0
  17. package/styles/v2/components/Popover/styles/popover-content.js +5 -0
  18. package/styles/v2/components/Popover/styles/popover-header.js +6 -0
  19. package/styles/v2/components/Popover/styles/popper.js +12 -0
  20. package/styles/v2/components/index.js +1 -0
  21. package/styles/v2/components/styles.js +1 -0
  22. package/v1/index-bundled-cjs/index.js +1 -1
  23. package/v1/index-bundled-cjs/index.js.map +1 -1
  24. package/v1/index-bundled-esm/index.js +1 -1
  25. package/v1/index-bundled-esm/index.js.map +1 -1
  26. package/v1/index-unbundled-cjs/index.js +35 -35
  27. package/v1/index-unbundled-esm/index.js +35 -35
  28. package/v2/index-bundled-cjs/ImageCarousel-c8dddbb1.js +2 -0
  29. package/v2/index-bundled-cjs/ImageCarousel-c8dddbb1.js.map +1 -0
  30. package/v2/index-bundled-cjs/index-7c73c07d.js +25 -0
  31. package/v2/index-bundled-cjs/index-7c73c07d.js.map +1 -0
  32. package/v2/index-bundled-cjs/index.js +1 -1
  33. package/v2/index-bundled-esm/ImageCarousel-dc224d64.js +2 -0
  34. package/v2/index-bundled-esm/ImageCarousel-dc224d64.js.map +1 -0
  35. package/v2/index-bundled-esm/index-7ef77e69.js +24 -0
  36. package/v2/index-bundled-esm/index-7ef77e69.js.map +1 -0
  37. package/v2/index-bundled-esm/index.js +1 -1
  38. package/v2/index-unbundled-cjs/{ImageCarousel-faf73c8f.js → ImageCarousel-325df0c4.js} +5 -32
  39. package/v2/index-unbundled-cjs/ImageCarousel-325df0c4.js.map +1 -0
  40. package/v2/index-unbundled-cjs/{index-6faea84f.js → index-093f8806.js} +4766 -1038
  41. package/v2/index-unbundled-cjs/index-093f8806.js.map +1 -0
  42. package/v2/index-unbundled-cjs/index.js +4 -1
  43. package/v2/index-unbundled-cjs/index.js.map +1 -1
  44. package/v2/index-unbundled-esm/{ImageCarousel-98a6f276.js → ImageCarousel-653f3259.js} +4 -31
  45. package/v2/index-unbundled-esm/ImageCarousel-653f3259.js.map +1 -0
  46. package/v2/index-unbundled-esm/{index-0ffe7573.js → index-1c95808d.js} +4751 -1026
  47. package/v2/index-unbundled-esm/index-1c95808d.js.map +1 -0
  48. package/v2/index-unbundled-esm/index.js +1 -1
  49. package/v2/index-bundled-cjs/ImageCarousel-27b16e10.js +0 -2
  50. package/v2/index-bundled-cjs/ImageCarousel-27b16e10.js.map +0 -1
  51. package/v2/index-bundled-cjs/index-707d3bd2.js +0 -25
  52. package/v2/index-bundled-cjs/index-707d3bd2.js.map +0 -1
  53. package/v2/index-bundled-esm/ImageCarousel-c171c392.js +0 -2
  54. package/v2/index-bundled-esm/ImageCarousel-c171c392.js.map +0 -1
  55. package/v2/index-bundled-esm/index-403b1b51.js +0 -24
  56. package/v2/index-bundled-esm/index-403b1b51.js.map +0 -1
  57. package/v2/index-unbundled-cjs/ImageCarousel-faf73c8f.js.map +0 -1
  58. package/v2/index-unbundled-cjs/index-6faea84f.js.map +0 -1
  59. package/v2/index-unbundled-esm/ImageCarousel-98a6f276.js.map +0 -1
  60. package/v2/index-unbundled-esm/index-0ffe7573.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
- # 13.9.0-beta.0 - 02/15/2022
1
+ # 13.9.0 - 02/17/2022
2
2
 
3
3
  ## New Features
4
- * [[4193a26](https://github.com/spothero/fe-ui/commit/4193a26)] - Updated Autocomplete to accept biasing options (Nathan)
4
+ * [[5229309](https://github.com/spothero/fe-ui/commit/5229309)] - Adds Popover component ([#270](https://github.com/spothero/fe-ui/pull/270)) (Tyler Williams)
5
5
 
6
6
  # 13.8.0 - 01/26/2022
7
7
 
package/CHANGELOG.tmp CHANGED
@@ -1,5 +1,5 @@
1
- # 13.9.0-beta.0 - 02/15/2022
1
+ # 13.9.0 - 02/17/2022
2
2
 
3
3
  ## New Features
4
- * [[4193a26](https://github.com/spothero/fe-ui/commit/4193a26)] - Updated Autocomplete to accept biasing options (Nathan)
4
+ * [[5229309](https://github.com/spothero/fe-ui/commit/5229309)] - Adds Popover component ([#270](https://github.com/spothero/fe-ui/pull/270)) (Tyler Williams)
5
5
 
@@ -148,13 +148,10 @@ var GooglePlacesSearchInput = /*#__PURE__*/function (_Component) {
148
148
  var _this$props = _this.props,
149
149
  country = _this$props.country,
150
150
  types = _this$props.types,
151
- bounds = _this$props.bounds,
152
- _this$props$biasOptio = _this$props.biasOptions,
153
- location = _this$props$biasOptio.location,
154
- radius = _this$props$biasOptio.radius;
151
+ bounds = _this$props.bounds;
155
152
  var autocompleteSessionToken = _this.state.autocompleteSessionToken;
156
153
 
157
- var options = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
154
+ var options = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
158
155
  input: value
159
156
  }, bounds && {
160
157
  bounds: bounds
@@ -164,9 +161,6 @@ var GooglePlacesSearchInput = /*#__PURE__*/function (_Component) {
164
161
  }
165
162
  }), types && {
166
163
  types: types
167
- }), location && {
168
- location: location,
169
- radius: radius
170
164
  }), {}, {
171
165
  sessionToken: autocompleteSessionToken
172
166
  });
@@ -255,8 +249,5 @@ exports.default = GooglePlacesSearchInput;
255
249
  (0, _defineProperty2.default)(GooglePlacesSearchInput, "defaultProps", {
256
250
  placeholder: 'Search Address or Venue',
257
251
  country: 'us',
258
- icon: /*#__PURE__*/_react.default.createElement(_search.default, null),
259
- biasOptions: {
260
- radius: 8000
261
- }
252
+ icon: /*#__PURE__*/_react.default.createElement(_search.default, null)
262
253
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spothero/ui",
3
- "version": "13.9.0-beta.0",
3
+ "version": "13.9.0",
4
4
  "description": "SpotHero's React component UI library.",
5
5
  "main": "v2/index-bundled-cjs/index.js",
6
6
  "module": "v2/index.js",
@@ -27,26 +27,11 @@ export default class GooglePlacesSearchInput extends Component {
27
27
  googleMaps: PropTypes.object,
28
28
  /** A custom element (typically a PoweredByGoogle component) to display at the bottom of the suggestion list. */
29
29
  poweredByGoogleFooter: PropTypes.element.isRequired,
30
- /** An object containing the bias options */
31
- biasOptions: PropTypes.shape({
32
- /** The location (lat and long), to bias the search results around.
33
- * * @see https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest.location
34
- */
35
- location: PropTypes.shape({
36
- latitude: PropTypes.number,
37
- Longitude: PropTypes.number,
38
- }),
39
- /** The radius, in meters, to bias the search results within */
40
- radius: PropTypes.number,
41
- })
42
30
  };
43
31
  static defaultProps = {
44
32
  placeholder: 'Search Address or Venue',
45
33
  country: 'us',
46
34
  icon: <IconSearch />,
47
- biasOptions: {
48
- radius: 8000,
49
- }
50
35
  };
51
36
 
52
37
  constructor(props) {
@@ -129,7 +114,7 @@ export default class GooglePlacesSearchInput extends Component {
129
114
  };
130
115
 
131
116
  _searchSuggestions = value => {
132
- const {country, types, bounds, biasOptions: {location, radius}} = this.props;
117
+ const {country, types, bounds} = this.props;
133
118
  const {autocompleteSessionToken} = this.state;
134
119
 
135
120
  const options = {
@@ -141,7 +126,6 @@ export default class GooglePlacesSearchInput extends Component {
141
126
  },
142
127
  }),
143
128
  ...(types && {types}),
144
- ...(location && {location, radius}),
145
129
  sessionToken: autocompleteSessionToken,
146
130
  };
147
131
 
@@ -48,7 +48,13 @@ const ImageCarousel = ({images, width, height, ...props}) => {
48
48
  }
49
49
 
50
50
  return (
51
- <Box as="section" position="relative" overflow="hidden" width={imgWidth} {...props}>
51
+ <Box
52
+ as="section"
53
+ position="relative"
54
+ overflow="hidden"
55
+ width={imgWidth}
56
+ {...props}
57
+ >
52
58
  <Box ref={viewportRef}>
53
59
  <Box display="flex" role="group">
54
60
  {images.map((image, index) => {
@@ -103,7 +109,7 @@ const ImageCarousel = ({images, width, height, ...props}) => {
103
109
  bgColor="black"
104
110
  opacity="0.6"
105
111
  >
106
- <IconChevronLeft/>
112
+ <IconChevronLeft />
107
113
  </Box>
108
114
  </Button>
109
115
  <Button
@@ -132,7 +138,7 @@ const ImageCarousel = ({images, width, height, ...props}) => {
132
138
  bgColor="black"
133
139
  opacity="0.6"
134
140
  >
135
- <IconChevronRight/>
141
+ <IconChevronRight />
136
142
  </Box>
137
143
  </Button>
138
144
  <Box
@@ -0,0 +1,28 @@
1
+ import React, {forwardRef, cloneElement, Children} from 'react';
2
+ import {Popover as ChakraPopover} from '@chakra-ui/react';
3
+ import PropTypes from 'prop-types';
4
+
5
+ const Popover = forwardRef((props, ref) => {
6
+ const {children, ...rest} = props;
7
+
8
+ return (
9
+ <ChakraPopover {...rest} ref={ref}>
10
+ {Children.toArray(children).map((child, index) =>
11
+ cloneElement(child, {
12
+ ref,
13
+ variant: props.variant,
14
+ key: `Popover-child-${index}`,
15
+ })
16
+ )}
17
+ </ChakraPopover>
18
+ );
19
+ });
20
+
21
+ Popover.propTypes = {
22
+ /** React children */
23
+ children: PropTypes.node,
24
+ /** Styles the Popover */
25
+ variant: PropTypes.oneOf(['light', 'dark']),
26
+ };
27
+
28
+ export default Popover;
@@ -0,0 +1,113 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ import disableArgs from 'storybook/utils/disable-args';
5
+ import {createSelectControl} from 'storybook/utils/create-control';
6
+
7
+ import {Popover, PopoverContent, PopoverTrigger} from './index';
8
+
9
+ import {Flex} from '@chakra-ui/react';
10
+ import Button from 'v2/components/Button/Button';
11
+
12
+ export default {
13
+ title: 'v2/Popover',
14
+ component: Popover,
15
+ subcomponents: {
16
+ PopoverContent,
17
+ PopoverTrigger,
18
+ },
19
+ parameters: {
20
+ importBy: 'Popover',
21
+ removeBaseHtmlClass: true,
22
+ chakraLink: 'https://chakra-ui.com/docs/overlay/popover',
23
+ },
24
+ argTypes: {
25
+ ...disableArgs('children'),
26
+ },
27
+ };
28
+
29
+ const OverviewTemplate = props => (
30
+ <Popover defaultIsOpen {...props}>
31
+ <Flex justifyContent="center" alignItems="center">
32
+ <PopoverTrigger>
33
+ <Button>Trigger</Button>
34
+ </PopoverTrigger>
35
+ </Flex>
36
+
37
+ <PopoverContent header="Confirmation!">
38
+ Are you sure you want to have that milkshake?
39
+ </PopoverContent>
40
+ </Popover>
41
+ );
42
+
43
+ OverviewTemplate.propTypes = {
44
+ variant: PropTypes.oneOf(['light', 'dark']),
45
+ };
46
+
47
+ export const Variant = OverviewTemplate.bind({});
48
+ Variant.argTypes = {
49
+ ...createSelectControl('variant', ['light', 'dark']),
50
+ };
51
+ Variant.args = {
52
+ variant: 'light',
53
+ };
54
+
55
+ export const Placement = OverviewTemplate.bind({});
56
+ Placement.argTypes = {
57
+ ...createSelectControl('placement', [
58
+ 'top',
59
+ 'right',
60
+ 'bottom',
61
+ 'left',
62
+ 'auto',
63
+ 'auto-start',
64
+ 'auto-end',
65
+ 'top-start',
66
+ 'top-end',
67
+ 'bottom-start',
68
+ 'bottom-end',
69
+ 'right-start',
70
+ 'right-end',
71
+ 'left-start',
72
+ 'left-end',
73
+ ]),
74
+
75
+ ...disableArgs('variant'),
76
+ };
77
+ Placement.args = {
78
+ placement: 'bottom',
79
+ };
80
+ const NoHeaderTemplate = props => (
81
+ <Popover defaultIsOpen {...props}>
82
+ <PopoverTrigger>
83
+ <Button>Trigger</Button>
84
+ </PopoverTrigger>
85
+
86
+ <PopoverContent>
87
+ Are you sure you want to have that milkshake?
88
+ </PopoverContent>
89
+ </Popover>
90
+ );
91
+
92
+ export const NoHeader = NoHeaderTemplate.bind({});
93
+
94
+ NoHeader.argTypes = {
95
+ ...disableArgs(['variant', 'placement']),
96
+ };
97
+
98
+ const NoCloseButtonTemplate = props => (
99
+ <Popover defaultIsOpen {...props}>
100
+ <PopoverTrigger>
101
+ <Button>Trigger</Button>
102
+ </PopoverTrigger>
103
+
104
+ <PopoverContent hideCloseButton header="Confirmation!">
105
+ Are you sure you want to have that milkshake?
106
+ </PopoverContent>
107
+ </Popover>
108
+ );
109
+
110
+ export const NoCloseButton = NoCloseButtonTemplate.bind({});
111
+ NoCloseButton.argTypes = {
112
+ ...disableArgs(['variant', 'placement']),
113
+ };
@@ -0,0 +1,10 @@
1
+ import React, {forwardRef} from 'react';
2
+ import {PopoverArrow as ChakraPopoverArrow} from '@chakra-ui/react';
3
+
4
+ import styles from './styles/popover-arrow';
5
+
6
+ const PopoverArrow = forwardRef((props, ref) => {
7
+ return <ChakraPopoverArrow ref={ref} {...props} {...styles(props)} />;
8
+ });
9
+
10
+ export default PopoverArrow;
@@ -0,0 +1,10 @@
1
+ import React, {forwardRef} from 'react';
2
+ import {PopoverCloseButton as ChakraPopoverCloseButton} from '@chakra-ui/react';
3
+
4
+ import styles from './styles/popover-close-button';
5
+
6
+ const PopoverCloseButton = forwardRef((props, ref) => {
7
+ return <ChakraPopoverCloseButton ref={ref} {...props} {...styles(props)} />;
8
+ });
9
+
10
+ export default PopoverCloseButton;
@@ -0,0 +1,41 @@
1
+ import React, {forwardRef} from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {
4
+ PopoverBody,
5
+ PopoverHeader,
6
+ PopoverContent as ChakraPopoverContent,
7
+ } from '@chakra-ui/react';
8
+
9
+ import PopoverArrow from './PopoverArrow';
10
+ import PopoverCloseButton from './PopoverCloseButton';
11
+
12
+ const PopoverContent = forwardRef((props, ref) => {
13
+ const {header, variant, children, hideCloseButton, ...rest} = props;
14
+
15
+ return (
16
+ <ChakraPopoverContent {...rest} ref={ref}>
17
+ <PopoverArrow variant={variant} />
18
+ {hideCloseButton ? null : <PopoverCloseButton variant={variant} />}
19
+ {header ? <PopoverHeader>{header}</PopoverHeader> : null}
20
+ <PopoverBody>{children}</PopoverBody>
21
+ </ChakraPopoverContent>
22
+ );
23
+ });
24
+
25
+ PopoverContent.propTypes = {
26
+ /** React children */
27
+ children: PropTypes.node,
28
+ /** Whether or not to hide the close button */
29
+ hideCloseButton: PropTypes.bool,
30
+ /** Styles the Popover */
31
+ variant: PropTypes.oneOf(['light', 'dark']),
32
+ /** The string or node for the header (optional) */
33
+ header: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
34
+ };
35
+
36
+ PopoverContent.defaultProps = {
37
+ variant: 'light',
38
+ hideCloseButton: false,
39
+ };
40
+
41
+ export default PopoverContent;
@@ -0,0 +1,3 @@
1
+ export {PopoverTrigger} from '@chakra-ui/react';
2
+ export {default as Popover} from './Popover';
3
+ export {default as PopoverContent} from './PopoverContent';
@@ -0,0 +1,21 @@
1
+ import merge from 'lodash/merge';
2
+ import chakraDefaultTheme from '@chakra-ui/theme';
3
+
4
+ import popper from './popper';
5
+ import body from './popover-body';
6
+ import header from './popover-header';
7
+ import content from './popover-content';
8
+
9
+ const parts = ['popper', 'content', 'header', 'body'];
10
+
11
+ const baseStyle = props => ({
12
+ header,
13
+ content,
14
+ body: body(props),
15
+ popper: popper(props),
16
+ });
17
+
18
+ export default merge(chakraDefaultTheme.components.Popover, {
19
+ parts,
20
+ baseStyle,
21
+ });
@@ -0,0 +1,5 @@
1
+ const arrowStyles = ({variant}) => ({
2
+ backgroundColor: variant === 'dark' ? 'secondary.default' : 'white',
3
+ });
4
+
5
+ export default arrowStyles;
@@ -0,0 +1,5 @@
1
+ const body = props => ({
2
+ fontSize: 'sm',
3
+ });
4
+
5
+ export default body;
@@ -0,0 +1,17 @@
1
+ const pseudoStyles = variant => ({
2
+ bgColor: variant === 'dark' ? 'gray.600' : 'gray.50',
3
+ });
4
+
5
+ const closeButtonStyles = ({variant}) => ({
6
+ color: variant === 'dark' ? 'white' : 'black',
7
+ fontSize: '0.5rem',
8
+ position: 'absolute',
9
+ top: 0,
10
+ right: 0,
11
+ padding: 4,
12
+ borderTopRightRadius: 4,
13
+ _hover: pseudoStyles(variant),
14
+ _focus: pseudoStyles(variant),
15
+ });
16
+
17
+ export default closeButtonStyles;
@@ -0,0 +1,5 @@
1
+ export default {
2
+ padding: 4,
3
+ marginBottom: 0,
4
+ maxWidth: '20rem',
5
+ };
@@ -0,0 +1,6 @@
1
+ const headerStyles = {
2
+ marginBottom: 2,
3
+ fontWeight: 'semibold',
4
+ };
5
+
6
+ export default headerStyles;
@@ -0,0 +1,12 @@
1
+ const popperStyles = ({variant}) => ({
2
+ borderRadius: 4,
3
+ boxShadow: '2px 2px 4px 0 rgba(0,45,91,0.1)',
4
+ color: variant === 'dark' ? 'white' : 'black',
5
+ background: variant === 'dark' ? 'secondary.default' : 'white',
6
+ borderColor: 'gray.100',
7
+ '--popper-arrow-shadow-color': t => t.colors.gray['100'],
8
+ borderWidth: '1px',
9
+ borderStyle: 'solid',
10
+ });
11
+
12
+ export default popperStyles;
@@ -23,6 +23,7 @@ export {default as Image} from './Image/Image';
23
23
  export const ImageCarousel = import('./ImageCarousel/ImageCarousel');
24
24
  export {default as Loader} from './Loader/Loader';
25
25
  export {default as Checkbox} from './Checkbox';
26
+ export {Popover, PopoverTrigger, PopoverContent} from './Popover';
26
27
 
27
28
  // generic chakra reexports
28
29
  export {
@@ -10,3 +10,4 @@ export {default as Heading} from './Heading/Heading.styles';
10
10
  export {default as Tabs} from './Tabs/styles';
11
11
  export {default as Select} from './Select/styles';
12
12
  export {default as Checkbox} from './Checkbox/styles';
13
+ export {default as Popover} from './Popover/styles';