@websolutespa/bom-mixer-ui 1.5.6 → 1.5.8

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
@@ -1,5 +1,19 @@
1
1
  # @websolutespa/bom-mixer-ui
2
2
 
3
+ ## 1.5.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: Link prefetch opt-in
8
+
9
+ ## 1.5.7
10
+
11
+ ### Patch Changes
12
+
13
+ - Modified: Media added muted video caption support
14
+ - Updated dependencies
15
+ - @websolutespa/bom-mixer-models@1.5.10
16
+
3
17
  ## 1.5.6
4
18
 
5
19
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -1525,15 +1525,22 @@ const Link = /*#__PURE__*/React__default.default.forwardRef((_a, forwardedRef) =
1525
1525
  children,
1526
1526
  href = '',
1527
1527
  passHref,
1528
- legacyBehavior
1528
+ legacyBehavior,
1529
+ prefetch
1529
1530
  } = _a,
1530
- props = __rest(_a, ["children", "href", "passHref", "legacyBehavior"]);
1531
+ props = __rest(_a, ["children", "href", "passHref", "legacyBehavior", "prefetch"]);
1531
1532
  passHref = passHref === false ? false : true;
1532
1533
  legacyBehavior = legacyBehavior === false ? false : true;
1534
+ /**
1535
+ * original prefetch is setted by default to true and activates with viewport visibility
1536
+ * we are setting it by default to false, however prefetching will still occur on hover
1537
+ */
1538
+ prefetch = prefetch === true ? true : false;
1533
1539
  return jsxRuntime.jsx(NextLink__default.default, Object.assign({
1534
1540
  ref: forwardedRef,
1535
1541
  href: href,
1536
1542
  passHref: passHref,
1543
+ prefetch: prefetch,
1537
1544
  legacyBehavior: legacyBehavior
1538
1545
  }, props, {
1539
1546
  children: children
@@ -4504,6 +4511,9 @@ const MediaBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
4504
4511
  as = 'div'
4505
4512
  } = _a,
4506
4513
  props = __rest(_a, ["children", "item", "onClick", "className", "eager", "alt", "title", "as"]);
4514
+ const {
4515
+ locale
4516
+ } = bomMixerHooks.useLayout();
4507
4517
  const {
4508
4518
  id,
4509
4519
  open
@@ -4516,6 +4526,7 @@ const MediaBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
4516
4526
  galleryId: id,
4517
4527
  alt,
4518
4528
  title,
4529
+ locale,
4519
4530
  open
4520
4531
  }) : children;
4521
4532
  return jsxRuntime.jsx(StyledMedia$1, Object.assign({
@@ -4530,6 +4541,18 @@ MediaBase.displayName = 'Media';
4530
4541
  const Media = bomCore.withSchema(MediaBase, {
4531
4542
  Info: MediaInfo
4532
4543
  });
4544
+ const StyledVideo = styled__default.default('video')`
4545
+ &.video {
4546
+ &--muted {
4547
+ &::cue {
4548
+ background-color: transparent;
4549
+ background-image: none;
4550
+ color: transparent;
4551
+ font-size: 0;
4552
+ }
4553
+ }
4554
+ }
4555
+ `;
4533
4556
  function getMediaItems(itemOrItems, options) {
4534
4557
  if (options === void 0) {
4535
4558
  options = {};
@@ -4594,16 +4617,22 @@ function getMediaItems(itemOrItems, options) {
4594
4617
  }
4595
4618
  return props;
4596
4619
  };
4597
- return items.map((media, m) => bomCore.resolveMediaType(media) === 'video' ? jsxRuntime.jsx("video", Object.assign({
4620
+ return items.map((media, m) => bomCore.resolveMediaType(media) === 'video' ? jsxRuntime.jsxs(StyledVideo, Object.assign({
4621
+ className: "video video--muted",
4598
4622
  playsInline: true,
4599
4623
  autoPlay: true,
4600
4624
  muted: true,
4601
4625
  loop: true
4602
4626
  }, getMediaItemProps(media), {
4603
- children: jsxRuntime.jsx("source", {
4627
+ children: [jsxRuntime.jsx("source", {
4604
4628
  src: media.src,
4605
4629
  type: "video/mp4"
4606
- })
4630
+ }), options.locale && jsxRuntime.jsx("track", {
4631
+ src: `/captions.vtt?locale=${options.locale}&title=${media.title}`,
4632
+ kind: "captions",
4633
+ srcLang: options.locale,
4634
+ label: "Video Captions"
4635
+ })]
4607
4636
  }), m) : jsxRuntime.jsx(MediaImage, Object.assign({}, media, {
4608
4637
  draggable: false
4609
4638
  }, getMediaItemProps(media)), m));