@kiva/kv-components 3.83.1 → 3.83.2

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
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.83.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.83.1...@kiva/kv-components@3.83.2) (2024-06-25)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * max dimensions on kvContentfulImg ([#419](https://github.com/kiva/kv-ui-elements/issues/419)) ([4496979](https://github.com/kiva/kv-ui-elements/commit/4496979544fa7d9d941111bff234aae58aa5ca16))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [3.83.1](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@3.83.0...@kiva/kv-components@3.83.1) (2024-06-07)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "3.83.1",
3
+ "version": "3.83.2",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -75,5 +75,5 @@
75
75
  "optional": true
76
76
  }
77
77
  },
78
- "gitHead": "fd9613c908f4eeaddb1a8395e864c5c0448c53af"
78
+ "gitHead": "b24be12d68662bf99ee0d17a1ed6f4b788ae0ce5"
79
79
  }
@@ -213,9 +213,22 @@ export default {
213
213
 
214
214
  const buildUrl = (image = null, multiplier = 1) => {
215
215
  let src = image && image.url ? `${image.url}?` : `${contentfulSrc.value}?`;
216
- const imgWidth = image ? image.width : width.value;
217
- const imgHeight = image ? image.height : height.value;
218
-
216
+ let imgWidth = image ? image.width : width.value;
217
+ let imgHeight = image ? image.height : height.value;
218
+ // The max contentful image size is 4000px so we have to
219
+ // impose a limit of 2000px here for both height and width
220
+ // so when we request the retina x2 image we don't go over the 4000px limit
221
+ let newMultiplier;
222
+ if (imgWidth >= 2000) {
223
+ newMultiplier = imgWidth / 1999;
224
+ imgWidth = 1999;
225
+ imgHeight = Math.round(imgHeight / newMultiplier);
226
+ }
227
+ if (imgHeight >= 2000) {
228
+ newMultiplier = imgHeight / 1999;
229
+ imgHeight = 1999;
230
+ imgWidth = Math.round(imgWidth / newMultiplier);
231
+ }
219
232
  if (imgWidth) {
220
233
  src += `w=${imgWidth * multiplier}`;
221
234
  }
@@ -4,7 +4,7 @@ export default {
4
4
  title: 'KvContentfulImg',
5
5
  component: KvContentfulImg,
6
6
  args: {
7
- contentfulSrc: 'https://images.ctfassets.net/j0p9a6ql0rn7/2TWV32iioxapwjn26ZpigZ/84ac39a1396d6be9eea472cf8791faa7/Cynthia.png',
7
+ contentfulSrc: 'https://images.ctfassets.net/j0p9a6ql0rn7/35lkLRfbLxzFPlDVgA4aKI/c435630d811f9ad35ddfc88eaea22b08/Blog-import-1082518_us_shawn_16.jpg',
8
8
  fallbackFormat: 'jpg',
9
9
  width: 200,
10
10
  height: null,
@@ -77,6 +77,7 @@ export const ResponsiveImageSet = (args, { argTypes }) => ({
77
77
  />
78
78
  `,
79
79
  });
80
+
80
81
  ResponsiveImageSet.args = {
81
82
  fit: 'fill',
82
83
  focus: 'face',
@@ -168,3 +169,28 @@ export const WithCaption = (args, { argTypes }) => ({
168
169
  />
169
170
  `,
170
171
  });
172
+
173
+ export const GiantImage = (args, { argTypes }) => ({
174
+ props: Object.keys(argTypes),
175
+ components: {
176
+ KvContentfulImg,
177
+ },
178
+ template: `
179
+ <kv-contentful-img
180
+ :contentful-src="contentfulSrc"
181
+ :fallback-format="fallbackFormat"
182
+ :width="width"
183
+ :height="height"
184
+ alt="Descriptive alt text"
185
+ :loading="loading"
186
+ :fit="fit"
187
+ :focus="focus"
188
+ />
189
+ `,
190
+ });
191
+
192
+ GiantImage.args = {
193
+ contentfulSrc: 'https://images.ctfassets.net/j0p9a6ql0rn7/7dVINOyAxRaXM8p6aq7p5s/9213f63ff10dec57c5f740c056afe8a8/gradient-hero-bg__1_.jpg',
194
+ width: 4000,
195
+ height: 2000,
196
+ };