@websolutespa/bom-mixer-ui 1.5.6 → 1.5.7

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,13 @@
1
1
  # @websolutespa/bom-mixer-ui
2
2
 
3
+ ## 1.5.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: Media added muted video caption support
8
+ - Updated dependencies
9
+ - @websolutespa/bom-mixer-models@1.5.10
10
+
3
11
  ## 1.5.6
4
12
 
5
13
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -4504,6 +4504,9 @@ const MediaBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
4504
4504
  as = 'div'
4505
4505
  } = _a,
4506
4506
  props = __rest(_a, ["children", "item", "onClick", "className", "eager", "alt", "title", "as"]);
4507
+ const {
4508
+ locale
4509
+ } = bomMixerHooks.useLayout();
4507
4510
  const {
4508
4511
  id,
4509
4512
  open
@@ -4516,6 +4519,7 @@ const MediaBase = /*#__PURE__*/React.forwardRef((_a, ref) => {
4516
4519
  galleryId: id,
4517
4520
  alt,
4518
4521
  title,
4522
+ locale,
4519
4523
  open
4520
4524
  }) : children;
4521
4525
  return jsxRuntime.jsx(StyledMedia$1, Object.assign({
@@ -4530,6 +4534,18 @@ MediaBase.displayName = 'Media';
4530
4534
  const Media = bomCore.withSchema(MediaBase, {
4531
4535
  Info: MediaInfo
4532
4536
  });
4537
+ const StyledVideo = styled__default.default('video')`
4538
+ &.video {
4539
+ &--muted {
4540
+ &::cue {
4541
+ background-color: transparent;
4542
+ background-image: none;
4543
+ color: transparent;
4544
+ font-size: 0;
4545
+ }
4546
+ }
4547
+ }
4548
+ `;
4533
4549
  function getMediaItems(itemOrItems, options) {
4534
4550
  if (options === void 0) {
4535
4551
  options = {};
@@ -4594,16 +4610,22 @@ function getMediaItems(itemOrItems, options) {
4594
4610
  }
4595
4611
  return props;
4596
4612
  };
4597
- return items.map((media, m) => bomCore.resolveMediaType(media) === 'video' ? jsxRuntime.jsx("video", Object.assign({
4613
+ return items.map((media, m) => bomCore.resolveMediaType(media) === 'video' ? jsxRuntime.jsxs(StyledVideo, Object.assign({
4614
+ className: "video video--muted",
4598
4615
  playsInline: true,
4599
4616
  autoPlay: true,
4600
4617
  muted: true,
4601
4618
  loop: true
4602
4619
  }, getMediaItemProps(media), {
4603
- children: jsxRuntime.jsx("source", {
4620
+ children: [jsxRuntime.jsx("source", {
4604
4621
  src: media.src,
4605
4622
  type: "video/mp4"
4606
- })
4623
+ }), options.locale && jsxRuntime.jsx("track", {
4624
+ src: `/captions.vtt?locale=${options.locale}&title=${media.title}`,
4625
+ kind: "captions",
4626
+ srcLang: options.locale,
4627
+ label: "Video Captions"
4628
+ })]
4607
4629
  }), m) : jsxRuntime.jsx(MediaImage, Object.assign({}, media, {
4608
4630
  draggable: false
4609
4631
  }, getMediaItemProps(media)), m));