@newhighsco/chipset 6.14.10 → 6.14.12

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 (46) hide show
  1. package/package.json +32 -32
  2. package/src/components/Backdrop/Backdrop.jsx +3 -3
  3. package/src/components/Button/Button.jsx +3 -2
  4. package/src/components/Button/ButtonGroup.jsx +2 -2
  5. package/src/components/Button/index.jsx +2 -2
  6. package/src/components/Card/Card.jsx +3 -2
  7. package/src/components/Card/CardHeading.jsx +2 -1
  8. package/src/components/Card/CardImage.jsx +2 -1
  9. package/src/components/Card/index.jsx +1 -1
  10. package/src/components/ContentContainer/ContentContainer.jsx +3 -2
  11. package/src/components/ContentContainer/index.js +0 -1
  12. package/src/components/CreditLockup/CreditLockup.jsx +3 -3
  13. package/src/components/CreditLockup/index.js +0 -1
  14. package/src/components/Element/Element.jsx +1 -1
  15. package/src/components/FooterContainer/FooterContainer.jsx +2 -3
  16. package/src/components/Grid/Grid.jsx +2 -2
  17. package/src/components/Grid/GridItem.jsx +2 -2
  18. package/src/components/Grid/index.js +1 -2
  19. package/src/components/HeaderContainer/HeaderContainer.jsx +2 -3
  20. package/src/components/Icon/Icon.jsx +3 -2
  21. package/src/components/Icon/index.js +0 -1
  22. package/src/components/Image/Image.jsx +1 -1
  23. package/src/components/Landmark/Landmark.jsx +3 -3
  24. package/src/components/List/List.jsx +3 -2
  25. package/src/components/List/index.js +0 -1
  26. package/src/components/LiveStream/LiveStream.jsx +21 -22
  27. package/src/components/LiveStream/index.js +0 -1
  28. package/src/components/LiveStream/utils.js +22 -16
  29. package/src/components/Navigation/Navigation.jsx +6 -6
  30. package/src/components/Navigation/index.js +0 -1
  31. package/src/components/PageContainer/PageContainer.jsx +2 -3
  32. package/src/components/PageContainer/index.js +0 -1
  33. package/src/components/Prose/Prose.jsx +2 -2
  34. package/src/components/Prose/index.js +0 -1
  35. package/src/components/ResponsiveMedia/ResponsiveMedia.jsx +2 -2
  36. package/src/components/ResponsiveMedia/index.js +0 -1
  37. package/src/components/SiteContainer/SiteContainer.jsx +3 -2
  38. package/src/components/SiteContainer/index.js +0 -1
  39. package/src/components/SmartLink/SmartLink.jsx +2 -1
  40. package/src/components/SmartLink/index.jsx +1 -0
  41. package/src/components/Tooltip/Tooltip.jsx +5 -4
  42. package/src/components/Tooltip/index.js +0 -1
  43. package/src/components/VisuallyHidden/VisuallyHidden.jsx +2 -2
  44. package/src/components/index.js +1 -1
  45. package/src/docs/README.stories.mdx +2 -2
  46. package/src/index.js +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@newhighsco/chipset",
3
3
  "description": "Shareable, theme-able component library by New High Score",
4
- "version": "6.14.10",
4
+ "version": "6.14.12",
5
5
  "author": "New High Score <hello@newhighsco.re>",
6
6
  "license": "ISC",
7
7
  "config": {
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "scripts": {
28
28
  "prepare": "is-ci || husky install",
29
- "start": "start-storybook --docs --no-manager-cache",
29
+ "start": "start-storybook --port 49928 --docs --no-manager-cache",
30
30
  "prebuild": "rm -rf build",
31
31
  "build": "build-storybook --output-dir build --docs --quiet",
32
32
  "pretest": "yarn lint",
@@ -42,48 +42,48 @@
42
42
  "format:css": "yarn lint:css --fix"
43
43
  },
44
44
  "dependencies": {
45
- "@dr.pogodin/react-themes": "1.4.6",
45
+ "@dr.pogodin/react-themes": "1.4.7",
46
46
  "classnames": "2.3.2",
47
- "react-device-detect": "2.2.2"
47
+ "react-device-detect": "2.2.3"
48
48
  },
49
49
  "devDependencies": {
50
- "@babel/core": "7.20.2",
51
- "@babel/polyfill": "7.12.1",
50
+ "@babel/core": "7.20.12",
52
51
  "@babel/preset-env": "7.20.2",
53
52
  "@babel/preset-react": "7.18.6",
54
- "@commitlint/cli": "17.2.0",
53
+ "@commitlint/cli": "17.4.2",
55
54
  "@fullhuman/postcss-purgecss": "5.0.0",
56
55
  "@newhighsco/browserslist-config": "1.1.0",
57
- "@newhighsco/commitlint-config": "1.1.9",
56
+ "@newhighsco/commitlint-config": "1.1.13",
58
57
  "@newhighsco/editor-config": "1.2.0",
59
- "@newhighsco/eslint-config": "3.4.4",
60
- "@newhighsco/postcss-config": "3.5.96",
61
- "@newhighsco/prettier-config": "2.1.3",
62
- "@newhighsco/release-config": "1.3.9",
63
- "@newhighsco/storybook-preset": "4.5.49",
64
- "@newhighsco/stylelint-config": "3.1.24",
65
- "@storybook/builder-webpack5": "6.5.13",
66
- "@storybook/manager-webpack5": "6.5.13",
67
- "@storybook/react": "6.5.13",
68
- "@wojtekmaj/enzyme-adapter-react-17": "0.7.0",
69
- "babel-jest": "27.5.1",
70
- "babel-loader": "9.1.0",
71
- "chromatic": "6.11.4",
72
- "enzyme": "3.11.0",
73
- "eslint": "8.26.0",
74
- "husky": "8.0.1",
75
- "is-ci": "3.0.1",
58
+ "@newhighsco/eslint-config": "4.0.11",
59
+ "@newhighsco/postcss-config": "3.5.113",
60
+ "@newhighsco/prettier-config": "2.1.8",
61
+ "@newhighsco/release-config": "1.3.15",
62
+ "@newhighsco/storybook-preset": "4.5.62",
63
+ "@newhighsco/stylelint-config": "3.1.33",
64
+ "@storybook/builder-webpack5": "6.5.16",
65
+ "@storybook/manager-webpack5": "6.5.16",
66
+ "@storybook/react": "6.5.16",
67
+ "@testing-library/jest-dom": "5.16.5",
68
+ "@testing-library/react": "13.4.0",
69
+ "babel-loader": "9.1.2",
70
+ "chromatic": "6.17.0",
71
+ "eslint": "8.33.0",
72
+ "husky": "8.0.3",
76
73
  "identity-obj-proxy": "3.0.0",
77
- "jest": "27.5.1",
74
+ "is-ci": "3.0.1",
75
+ "jest": "29.4.2",
76
+ "jest-environment-jsdom": "29.4.2",
77
+ "jest-environment-node-single-context": "29.0.0",
78
78
  "npm-run-all": "4.1.5",
79
- "postcss": "8.4.18",
80
- "prettier": "2.7.1",
79
+ "postcss": "8.4.21",
80
+ "prettier": "2.8.4",
81
81
  "react": "18.2.0",
82
82
  "react-dom": "18.2.0",
83
- "sass-true": "6.1.0",
84
- "semantic-release": "19.0.5",
85
- "stylelint": "14.14.1",
86
- "webpack": "5.74.0"
83
+ "sass-true": "7.0.0",
84
+ "semantic-release": "20.1.0",
85
+ "stylelint": "14.16.1",
86
+ "webpack": "5.75.0"
87
87
  },
88
88
  "peerDependencies": {
89
89
  "react": "18.2.0",
@@ -1,8 +1,8 @@
1
- import React from 'react'
2
- import { node, string } from 'prop-types'
3
1
  import classNames from 'classnames'
4
- import Element from '../Element'
2
+ import { node, string } from 'prop-types'
3
+ import React from 'react'
5
4
 
5
+ import Element from '../Element'
6
6
  import styles from './Backdrop.module.scss'
7
7
 
8
8
  /**
@@ -1,6 +1,7 @@
1
- import React from 'react'
2
- import { bool, func, node, object, oneOfType, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { bool, func, node, object, oneOfType, shape, string } from 'prop-types'
3
+ import React from 'react'
4
+
4
5
  import SmartLink from '../SmartLink'
5
6
 
6
7
  const Button = ({ active, children, theme, className, setRef, ...rest }) => {
@@ -1,6 +1,6 @@
1
- import React from 'react'
2
- import { node, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { node, shape, string } from 'prop-types'
3
+ import React from 'react'
4
4
 
5
5
  const ButtonGroup = ({ children, theme, className }) => {
6
6
  if (!children) return null
@@ -1,9 +1,9 @@
1
1
  import React, { forwardRef } from 'react'
2
+
2
3
  import { withTheme } from '../../providers'
3
4
  import PureButton from './Button'
4
- import PureButtonGroup from './ButtonGroup'
5
-
6
5
  import theme from './Button.module.scss'
6
+ import PureButtonGroup from './ButtonGroup'
7
7
 
8
8
  const { displayName } = PureButton
9
9
  const ButtonWithRef = forwardRef((props, ref) => (
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import classNames from 'classnames'
2
2
  import {
3
3
  func,
4
4
  node,
@@ -8,7 +8,8 @@ import {
8
8
  shape,
9
9
  string
10
10
  } from 'prop-types'
11
- import classNames from 'classnames'
11
+ import React from 'react'
12
+
12
13
  import CardHeading from './CardHeading'
13
14
  import CardImage from './CardImage'
14
15
 
@@ -1,5 +1,6 @@
1
- import React from 'react'
2
1
  import { func, node, object, oneOfType, string } from 'prop-types'
2
+ import React from 'react'
3
+
3
4
  import SmartLink from '../SmartLink'
4
5
 
5
6
  const CardHeading = ({ href, target, children, ref, theme }) => {
@@ -1,5 +1,6 @@
1
- import React from 'react'
2
1
  import { func, number, object, oneOfType, string } from 'prop-types'
2
+ import React from 'react'
3
+
3
4
  import Image from '../Image'
4
5
  import ResponsiveMedia from '../ResponsiveMedia'
5
6
 
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef } from 'react'
2
+
2
3
  import { withTheme } from '../../providers'
3
4
  import PureCard from './Card'
4
-
5
5
  import theme from './Card.module.scss'
6
6
 
7
7
  const { displayName } = PureCard
@@ -1,6 +1,7 @@
1
- import React from 'react'
2
- import { bool, node, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { bool, node, shape, string } from 'prop-types'
3
+ import React from 'react'
4
+
4
5
  import Element from '../Element'
5
6
 
6
7
  /**
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureContentContainer from './ContentContainer'
3
-
4
3
  import theme from './ContentContainer.module.scss'
5
4
 
6
5
  const { displayName } = PureContentContainer
@@ -1,8 +1,8 @@
1
- import React from 'react'
2
1
  import { oneOf, shape, string } from 'prop-types'
3
- import SmartLink from '../SmartLink'
4
- import Icon from '../Icon'
2
+ import React from 'react'
5
3
 
4
+ import Icon from '../Icon'
5
+ import SmartLink from '../SmartLink'
6
6
  import { ReactComponent as LogoSvg } from './images/logo.svg'
7
7
 
8
8
  const name = 'New High Score'
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureCreditLockup from './CreditLockup'
3
-
4
3
  import theme from './CreditLockup.module.scss'
5
4
 
6
5
  const { displayName } = PureCreditLockup
@@ -1,5 +1,5 @@
1
- import React from 'react'
2
1
  import { func, node, oneOfType, string } from 'prop-types'
2
+ import React from 'react'
3
3
 
4
4
  const Element = ({ as: Component = 'div', ...rest }) => <Component {...rest} />
5
5
 
@@ -1,10 +1,9 @@
1
- import React from 'react'
2
1
  import { node } from 'prop-types'
2
+ import React from 'react'
3
+
3
4
  import ContentContainer from '../ContentContainer'
4
5
 
5
6
  const FooterContainer = ({ children, theme, ...rest }) => {
6
- if (!children) return null
7
-
8
7
  return (
9
8
  <ContentContainer as="footer" role="contentinfo" theme={theme} {...rest}>
10
9
  {children}
@@ -1,6 +1,6 @@
1
- import React from 'react'
2
- import { bool, node, oneOf, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { bool, node, oneOf, shape, string } from 'prop-types'
3
+ import React from 'react'
4
4
 
5
5
  /**
6
6
  * `Grid` provides a simple `inline-block` based responsive grid
@@ -1,6 +1,6 @@
1
- import React from 'react'
2
- import { arrayOf, node, oneOf, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { arrayOf, node, oneOf, shape, string } from 'prop-types'
3
+ import React from 'react'
4
4
 
5
5
  const GridItem = ({ sizes, children, theme, className, ...rest }) => {
6
6
  if (!children) return null
@@ -1,8 +1,7 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureGrid from './Grid'
3
- import PureGridItem from './GridItem'
4
-
5
3
  import theme from './Grid.module.scss'
4
+ import PureGridItem from './GridItem'
6
5
 
7
6
  const { displayName } = PureGrid
8
7
  const Grid = withTheme(displayName, theme)(PureGrid)
@@ -1,10 +1,9 @@
1
- import React from 'react'
2
1
  import { node } from 'prop-types'
2
+ import React from 'react'
3
+
3
4
  import ContentContainer from '../ContentContainer'
4
5
 
5
6
  const HeaderContainer = ({ children, theme, ...rest }) => {
6
- if (!children) return null
7
-
8
7
  return (
9
8
  <ContentContainer
10
9
  id="top"
@@ -1,6 +1,7 @@
1
- import React from 'react'
2
- import { node, number, oneOfType, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { node, number, oneOfType, shape, string } from 'prop-types'
3
+ import React from 'react'
4
+
4
5
  import VisuallyHidden from '../VisuallyHidden'
5
6
 
6
7
  /**
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureIcon from './Icon'
3
-
4
3
  import theme from './Icon.module.scss'
5
4
 
6
5
  const { displayName } = PureIcon
@@ -1,5 +1,5 @@
1
- import React from 'react'
2
1
  import { arrayOf, oneOf, shape, string } from 'prop-types'
2
+ import React from 'react'
3
3
 
4
4
  const Image = ({
5
5
  src,
@@ -1,7 +1,7 @@
1
- import React from 'react'
2
1
  import { node } from 'prop-types'
3
- import VisuallyHidden from '../VisuallyHidden'
2
+ import React from 'react'
4
3
 
4
+ import VisuallyHidden from '../VisuallyHidden'
5
5
  import styles from './Landmark.module.scss'
6
6
 
7
7
  /**
@@ -11,7 +11,7 @@ const Landmark = ({ children, ...rest }) => (
11
11
  <>
12
12
  {/* eslint-disable jsx-a11y/anchor-is-valid */}
13
13
  <a className={styles.root} {...rest}>
14
- {children && <VisuallyHidden>{children}</VisuallyHidden>}
14
+ <VisuallyHidden>{children}</VisuallyHidden>
15
15
  </a>
16
16
  {/* eslint-enable jsx-a11y/anchor-is-valid */}
17
17
  </>
@@ -1,6 +1,7 @@
1
- import React from 'react'
2
- import { bool, node, oneOf, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { bool, node, oneOf, shape, string } from 'prop-types'
3
+ import React from 'react'
4
+
4
5
  import Element from '../Element'
5
6
 
6
7
  const List = ({
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureList from './List'
3
-
4
3
  import theme from './List.module.scss'
5
4
 
6
5
  const { displayName } = PureList
@@ -1,8 +1,10 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { bool, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { bool, shape, string } from 'prop-types'
3
+ import React, { useEffect, useState } from 'react'
4
+
4
5
  import Grid from '../Grid'
5
6
  import ResponsiveMedia from '../ResponsiveMedia'
7
+ import VisuallyHidden from '../VisuallyHidden'
6
8
  import { getLiveStreamUrls } from './utils'
7
9
 
8
10
  const LiveStream = ({
@@ -15,8 +17,7 @@ const LiveStream = ({
15
17
  theme,
16
18
  className
17
19
  }) => {
18
- if (!href) return null
19
-
20
+ const [loading, setLoading] = useState(true)
20
21
  const [liveStreamUrls, setLiveSteamUrls] = useState({
21
22
  videoUrl: null,
22
23
  chatUrl: null
@@ -24,19 +25,23 @@ const LiveStream = ({
24
25
 
25
26
  useEffect(() => {
26
27
  const loadUrls = async () => {
27
- setLiveSteamUrls(
28
- await getLiveStreamUrls({
29
- href,
30
- autoPlay,
31
- muted,
32
- darkMode,
33
- showChat
34
- })
35
- )
28
+ const urls = await getLiveStreamUrls({
29
+ href,
30
+ autoPlay,
31
+ muted,
32
+ darkMode,
33
+ showChat
34
+ })
35
+
36
+ setLiveSteamUrls(urls)
37
+ setLoading(false)
36
38
  }
37
39
 
38
40
  loadUrls()
39
- }, [href])
41
+ // eslint-disable-next-line react-hooks/exhaustive-deps
42
+ }, [])
43
+
44
+ if (loading) return <VisuallyHidden>Loading live stream</VisuallyHidden>
40
45
 
41
46
  const { videoUrl, chatUrl } = liveStreamUrls
42
47
 
@@ -47,9 +52,8 @@ const LiveStream = ({
47
52
  <Grid.Item className={theme?.video}>
48
53
  <ResponsiveMedia ratio="16:9">
49
54
  <iframe
50
- data-test-id="LiveStreamVideo"
51
55
  title="Live stream"
52
- src={videoUrl.toString()}
56
+ src={videoUrl.href}
53
57
  allowFullScreen={allowFullScreen}
54
58
  loading="lazy"
55
59
  />
@@ -57,12 +61,7 @@ const LiveStream = ({
57
61
  </Grid.Item>
58
62
  {chatUrl && (
59
63
  <Grid.Item className={theme?.chat}>
60
- <iframe
61
- data-test-id="LiveStreamChat"
62
- title="Live chat"
63
- src={chatUrl.toString()}
64
- loading="lazy"
65
- />
64
+ <iframe title="Live chat" src={chatUrl.href} loading="lazy" />
66
65
  </Grid.Item>
67
66
  )}
68
67
  </Grid>
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureLiveStream from './LiveStream'
3
-
4
3
  import theme from './LiveStream.module.scss'
5
4
 
6
5
  const { displayName } = PureLiveStream
@@ -1,11 +1,11 @@
1
1
  import fetch from 'node-fetch'
2
- import urlJoin from 'url-join'
3
2
  import { isMobile } from 'react-device-detect'
3
+ import urlJoin from 'url-join'
4
4
 
5
5
  const getExternalUrl = url =>
6
6
  `https://api.allorigins.win/get?url=${encodeURIComponent(url)}`
7
7
 
8
- const location = typeof window !== 'undefined' ? window.location : null
8
+ const { hostname } = window.location
9
9
 
10
10
  const PROVIDERS = {
11
11
  facebook: {
@@ -19,8 +19,7 @@ const PROVIDERS = {
19
19
  })
20
20
 
21
21
  return url
22
- },
23
- getChatUrl: () => ''
22
+ }
24
23
  },
25
24
  twitch: {
26
25
  urlRegEx: /^(https?:\/\/)?(www\.)?(twitch\.tv)\/(.+)$/,
@@ -29,7 +28,7 @@ const PROVIDERS = {
29
28
  const url = new URL('https://player.twitch.tv')
30
29
  url.search = new URLSearchParams({
31
30
  channel,
32
- parent: location?.hostname,
31
+ parent: hostname,
33
32
  autoplay: !!autoPlay,
34
33
  muted: !!muted
35
34
  })
@@ -39,7 +38,7 @@ const PROVIDERS = {
39
38
  getChatUrl: ({ channel, darkMode }) => {
40
39
  const url = new URL(`https://www.twitch.tv/embed/${channel}/chat`)
41
40
  url.search = new URLSearchParams({
42
- parent: location?.hostname,
41
+ parent: hostname,
43
42
  ...(darkMode && { darkpopout: '' })
44
43
  })
45
44
 
@@ -49,13 +48,17 @@ const PROVIDERS = {
49
48
  youtube: {
50
49
  urlRegEx: /^(https?:\/\/)?(www\.)?(youtube\.com)(\/c(hannel)?)?\/(.+)$/,
51
50
  getChannelParam: async url => {
52
- const { contents } = await fetch(
53
- getExternalUrl(urlJoin(url, 'live'))
54
- ).then(response => response.json())
51
+ try {
52
+ const { contents } = await fetch(
53
+ getExternalUrl(urlJoin(url, 'live'))
54
+ ).then(response => response.json())
55
55
 
56
- return contents.match(
57
- /"liveStreamabilityRenderer":{"videoId":"(\w+?)"/
58
- )?.[1]
56
+ return contents?.match(
57
+ /"liveStreamabilityRenderer":{"videoId":"([\w|-]+?)"/
58
+ )?.[1]
59
+ } catch {
60
+ return null
61
+ }
59
62
  },
60
63
  getVideoUrl: ({ channel, autoPlay, muted }) => {
61
64
  const url = new URL(`https://www.youtube-nocookie.com/embed/${channel}`)
@@ -72,7 +75,7 @@ const PROVIDERS = {
72
75
  const url = new URL('https://www.youtube.com/live_chat')
73
76
  url.search = new URLSearchParams({
74
77
  v: channel,
75
- embed_domain: location?.hostname,
78
+ embed_domain: hostname,
76
79
  ...(darkMode && { dark_theme: 1 })
77
80
  })
78
81
 
@@ -82,6 +85,8 @@ const PROVIDERS = {
82
85
  }
83
86
 
84
87
  const getProvider = url => {
88
+ if (!url) return null
89
+
85
90
  const keys = Object.keys(PROVIDERS)
86
91
  let i = keys.length
87
92
 
@@ -100,9 +105,10 @@ export const getLiveStreamUrls = async ({
100
105
  showChat
101
106
  }) => {
102
107
  const provider = getProvider(href)
103
- const channel = await (provider && provider.getChannelParam(href))
104
- const videoUrl = channel && provider.getVideoUrl({ channel, autoPlay, muted })
105
- const chatUrl = channel && provider.getChatUrl({ channel, darkMode })
108
+ const channel = await provider?.getChannelParam(href)
109
+ const videoUrl =
110
+ channel && provider?.getVideoUrl?.({ channel, autoPlay, muted })
111
+ const chatUrl = channel && provider?.getChatUrl?.({ channel, darkMode })
106
112
 
107
113
  return { videoUrl, chatUrl: showChat && chatUrl }
108
114
  }
@@ -1,15 +1,15 @@
1
- import React from 'react'
2
- import { array, bool, func, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { array, bool, func, shape, string } from 'prop-types'
3
+ import React from 'react'
4
+
4
5
  import { useToggle } from '../../hooks'
5
6
  import Button from '../Button'
6
7
  import Icon from '../Icon'
7
8
  import List from '../List'
8
9
  import SmartLink from '../SmartLink'
9
10
  import VisuallyHidden from '../VisuallyHidden'
10
-
11
- import { ReactComponent as MenuSvg } from './images/menu.svg'
12
11
  import { ReactComponent as CloseSvg } from './images/close.svg'
12
+ import { ReactComponent as MenuSvg } from './images/menu.svg'
13
13
 
14
14
  const Navigation = ({
15
15
  title = 'Navigation',
@@ -21,10 +21,10 @@ const Navigation = ({
21
21
  theme,
22
22
  className
23
23
  }) => {
24
- if (!links.length) return null
25
-
26
24
  const [visible, setVisibility] = useToggle(!toggle)
27
25
 
26
+ if (!links.length) return null
27
+
28
28
  const toggleVisibility = () => {
29
29
  setVisibility()
30
30
  onToggle({ visible })
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureNavigation from './Navigation'
3
-
4
3
  import theme from './Navigation.module.scss'
5
4
 
6
5
  const { displayName } = PureNavigation
@@ -1,13 +1,12 @@
1
- import React from 'react'
2
1
  import { node } from 'prop-types'
2
+ import React from 'react'
3
+
3
4
  import ContentContainer from '../ContentContainer'
4
5
 
5
6
  /**
6
7
  * The `PageContainer` flexes to fill the unused space within its parent
7
8
  */
8
9
  const PageContainer = ({ header, footer, children, theme, ...rest }) => {
9
- if (!children) return null
10
-
11
10
  return (
12
11
  <>
13
12
  {header}
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PurePageContainer from './PageContainer'
3
-
4
3
  import theme from './PageContainer.module.scss'
5
4
 
6
5
  const { displayName } = PurePageContainer
@@ -1,6 +1,6 @@
1
- import React from 'react'
2
- import { node, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { node, shape, string } from 'prop-types'
3
+ import React from 'react'
4
4
 
5
5
  const Prose = ({ html, children, theme, className, ...rest }) => {
6
6
  if (!html && !children) return null
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureProse from './Prose'
3
-
4
3
  import theme from './Prose.module.scss'
5
4
 
6
5
  const { displayName } = PureProse
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import classNames from 'classnames'
2
2
  import {
3
3
  func,
4
4
  node,
@@ -8,7 +8,7 @@ import {
8
8
  shape,
9
9
  string
10
10
  } from 'prop-types'
11
- import classNames from 'classnames'
11
+ import React from 'react'
12
12
 
13
13
  const ratioRegExp = /^\d+:\d+$/
14
14
 
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureResponsiveMedia from './ResponsiveMedia'
3
-
4
3
  import theme from './ResponsiveMedia.module.scss'
5
4
 
6
5
  const { displayName } = PureResponsiveMedia
@@ -1,6 +1,7 @@
1
- import React from 'react'
2
- import { node, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { node, shape, string } from 'prop-types'
3
+ import React from 'react'
4
+
4
5
  import Element from '../Element'
5
6
 
6
7
  /**
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureSiteContainer from './SiteContainer'
3
-
4
3
  import theme from './SiteContainer.module.scss'
5
4
 
6
5
  const { displayName } = PureSiteContainer
@@ -1,5 +1,6 @@
1
- import React from 'react'
2
1
  import { func, node, object, oneOf, oneOfType, string } from 'prop-types'
2
+ import React from 'react'
3
+
3
4
  import { absoluteUrl } from '../../utils'
4
5
 
5
6
  /**
@@ -1,4 +1,5 @@
1
1
  import React, { forwardRef } from 'react'
2
+
2
3
  import PureSmartLink from './SmartLink'
3
4
 
4
5
  const { displayName } = PureSmartLink
@@ -1,6 +1,7 @@
1
- import React from 'react'
2
- import { bool, node, oneOf, shape, string } from 'prop-types'
3
1
  import classNames from 'classnames'
2
+ import { bool, node, oneOf, shape, string } from 'prop-types'
3
+ import React from 'react'
4
+
4
5
  import { useToggle } from '../../hooks'
5
6
  import SmartLink from '../SmartLink'
6
7
 
@@ -21,10 +22,10 @@ const Tooltip = ({
21
22
  theme,
22
23
  className
23
24
  }) => {
24
- if (!heading && !children) return null
25
-
26
25
  const [visible, setVisibility] = useToggle(!hidden)
27
26
 
27
+ if (!heading && !children) return null
28
+
28
29
  return (
29
30
  <span
30
31
  className={classNames(theme?.root, className)}
@@ -1,6 +1,5 @@
1
1
  import { withTheme } from '../../providers'
2
2
  import PureTooltip from './Tooltip'
3
-
4
3
  import theme from './Tooltip.module.scss'
5
4
 
6
5
  const { displayName } = PureTooltip
@@ -1,7 +1,7 @@
1
- import React from 'react'
2
1
  import { node } from 'prop-types'
3
- import Element from '../Element'
2
+ import React from 'react'
4
3
 
4
+ import Element from '../Element'
5
5
  import styles from './VisuallyHidden.module.scss'
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- export { default as ContentContainer } from './ContentContainer'
2
1
  export { default as Backdrop } from './Backdrop'
3
2
  export { default as Button } from './Button'
4
3
  export { default as Card } from './Card'
4
+ export { default as ContentContainer } from './ContentContainer'
5
5
  export { default as CreditLockup } from './CreditLockup'
6
6
  export { default as Element } from './Element'
7
7
  export { default as FooterContainer } from './FooterContainer'
@@ -1,8 +1,8 @@
1
1
  import { Meta, Title } from '@storybook/addon-docs'
2
- import { CreditLockup, Image, SmartLink } from '../../src'
3
- import packageInfo from '../../package.json'
4
2
 
5
3
  import { ReactComponent as LogoSvg } from '../../.storybook/static/logo.svg'
4
+ import packageInfo from '../../package.json'
5
+ import { CreditLockup, Image, SmartLink } from '../../src'
6
6
 
7
7
  <Meta title="Docs/README" />
8
8
 
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from './utils'
2
1
  export * from './components'
3
2
  export * from './hooks'
4
3
  export * from './providers'
4
+ export * from './utils'