@newhighsco/chipset 6.13.7 → 6.14.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.
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.13.7",
4
+ "version": "6.14.1",
5
5
  "author": "New High Score <hello@newhighsco.re>",
6
6
  "license": "ISC",
7
7
  "config": {
@@ -32,8 +32,7 @@
32
32
  "test": "npm-run-all --parallel test:*",
33
33
  "test:js": "jest --maxWorkers=2 --coverage",
34
34
  "tdd": "yarn test:js --watch",
35
- "snapshot": "npm-run-all --parallel snapshot:*",
36
- "snapshot:chromatic": "chromatic --storybook-build-dir build --auto-accept-changes main --exit-once-uploaded",
35
+ "snapshot": "chromatic --storybook-build-dir build --auto-accept-changes main --exit-once-uploaded",
37
36
  "lint": "npm-run-all --parallel lint:*",
38
37
  "lint:js": "eslint --cache --ignore-path .gitignore --ext .js,.json,.jsx,.mdx .",
39
38
  "lint:css": "stylelint '**/*.{css,scss}' --cache --ignore-path .gitignore",
@@ -42,7 +41,7 @@
42
41
  "format:css": "yarn lint:css --fix"
43
42
  },
44
43
  "dependencies": {
45
- "@dr.pogodin/react-themes": "1.4.1",
44
+ "@dr.pogodin/react-themes": "1.4.2",
46
45
  "classnames": "2.3.1",
47
46
  "react-device-detect": "2.1.2"
48
47
  },
@@ -53,40 +52,40 @@
53
52
  "@babel/preset-react": "7.16.7",
54
53
  "@commitlint/cli": "16.2.3",
55
54
  "@fullhuman/postcss-purgecss": "4.1.3",
56
- "@newhighsco/browserslist-config": "1.0.3",
57
- "@newhighsco/commitlint-config": "1.0.24",
58
- "@newhighsco/editor-config": "1.1.2",
59
- "@newhighsco/eslint-config": "3.1.17",
60
- "@newhighsco/postcss-config": "3.4.70",
61
- "@newhighsco/prettier-config": "2.0.17",
62
- "@newhighsco/release-config": "1.1.6",
63
- "@newhighsco/storybook-preset": "4.4.25",
64
- "@newhighsco/stylelint-config": "3.0.19",
55
+ "@newhighsco/browserslist-config": "1.1.0",
56
+ "@newhighsco/commitlint-config": "1.1.0",
57
+ "@newhighsco/editor-config": "1.2.0",
58
+ "@newhighsco/eslint-config": "3.1.22",
59
+ "@newhighsco/postcss-config": "3.4.74",
60
+ "@newhighsco/prettier-config": "2.0.18",
61
+ "@newhighsco/release-config": "1.3.1",
62
+ "@newhighsco/storybook-preset": "4.4.27",
63
+ "@newhighsco/stylelint-config": "3.0.23",
65
64
  "@storybook/builder-webpack5": "6.4.19",
66
65
  "@storybook/manager-webpack5": "6.4.19",
67
66
  "@storybook/react": "6.4.19",
68
- "@wojtekmaj/enzyme-adapter-react-17": "0.6.6",
67
+ "@wojtekmaj/enzyme-adapter-react-17": "0.6.7",
69
68
  "babel-jest": "27.5.1",
70
- "babel-loader": "8.2.3",
69
+ "babel-loader": "8.2.4",
71
70
  "chromatic": "6.5.3",
72
71
  "enzyme": "3.11.0",
73
- "eslint": "8.11.0",
72
+ "eslint": "8.12.0",
74
73
  "husky": "7.0.4",
75
74
  "identity-obj-proxy": "3.0.0",
76
75
  "jest": "27.5.1",
77
76
  "npm-run-all": "4.1.5",
78
77
  "postcss": "8.4.12",
79
- "prettier": "2.6.0",
80
- "react": "17.0.2",
81
- "react-dom": "17.0.2",
78
+ "prettier": "2.6.1",
79
+ "react": "18.0.0",
80
+ "react-dom": "18.0.0",
82
81
  "sass-true": "6.1.0",
83
82
  "semantic-release": "19.0.2",
84
- "stylelint": "14.6.0",
83
+ "stylelint": "14.6.1",
85
84
  "webpack": "5.70.0"
86
85
  },
87
86
  "peerDependencies": {
88
- "react": "17.0.2",
89
- "react-dom": "17.0.2"
87
+ "react": "18.0.0",
88
+ "react-dom": "18.0.0"
90
89
  },
91
90
  "browserslist": [
92
91
  "extends @newhighsco/browserslist-config"
@@ -1,19 +1,29 @@
1
1
  import React from 'react'
2
- import { number, object, oneOfType, string } from 'prop-types'
2
+ import { func, number, object, oneOfType, string } from 'prop-types'
3
3
  import Image from '../Image'
4
4
  import ResponsiveMedia from '../ResponsiveMedia'
5
5
 
6
- const CardImage = ({ src, ratio, theme, ...rest }) => {
6
+ const renderImage = ({ render, src, ...rest }) => {
7
+ if (render) return render()
7
8
  if (!src) return null
8
9
 
10
+ return <Image src={src} {...rest} />
11
+ }
12
+
13
+ const CardImage = ({ ratio, theme, ...rest }) => {
14
+ const image = renderImage({ ...rest })
15
+
16
+ if (!image) return null
17
+
9
18
  return (
10
19
  <ResponsiveMedia ratio={ratio} className={theme?.image}>
11
- <Image src={src} {...rest} />
20
+ {image}
12
21
  </ResponsiveMedia>
13
22
  )
14
23
  }
15
24
 
16
25
  CardImage.propTypes = {
26
+ render: func,
17
27
  src: string,
18
28
  alt: string,
19
29
  ratio: oneOfType([number, string]),