@digital-b2c/coreui-kit 0.29.4 → 0.29.5

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/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import { ScrollTrigger } from 'gsap/ScrollTrigger';
7
7
  import { createPortal } from 'react-dom';
8
8
  import { Swiper, SwiperSlide } from 'swiper/react';
9
9
  import { A11y, FreeMode, Navigation, Pagination as Pagination$1 } from 'swiper/modules';
10
- import ReactPlayer from 'react-player';
10
+ import ReactPlayer2 from 'react-player';
11
11
  import 'swiper/css';
12
12
 
13
13
  var __defProp = Object.defineProperty;
@@ -2784,7 +2784,7 @@ var CardCarousel = ({
2784
2784
  ariaLabel: "Video player",
2785
2785
  closeLabel: "Close video",
2786
2786
  children: activeVideo && /* @__PURE__ */ jsx(
2787
- ReactPlayer,
2787
+ ReactPlayer2,
2788
2788
  {
2789
2789
  src: activeVideo,
2790
2790
  playing: true,
@@ -6039,11 +6039,14 @@ var TextCenterWithMedia_module_default = {
6039
6039
  thumbnailWrapper: "TextCenterWithMedia_module_thumbnailWrapper",
6040
6040
  thumbnail: "TextCenterWithMedia_module_thumbnail",
6041
6041
  playButton: "TextCenterWithMedia_module_playButton",
6042
- video: "TextCenterWithMedia_module_video"
6042
+ video: "TextCenterWithMedia_module_video",
6043
+ videoPreview: "TextCenterWithMedia_module_videoPreview",
6044
+ videoPreviewElement: "TextCenterWithMedia_module_videoPreviewElement"
6043
6045
  };
6044
6046
  var TextCenterWithMediaTitle = ({ children }) => {
6045
6047
  return /* @__PURE__ */ jsx(Fragment, { children });
6046
6048
  };
6049
+ var DIRECT_FILE_PATTERN = /\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i;
6047
6050
  var TextCenterWithMedia = ({
6048
6051
  className,
6049
6052
  title,
@@ -6067,10 +6070,11 @@ var TextCenterWithMedia = ({
6067
6070
  };
6068
6071
  const slots = resolveCompoundSlots(children, { title: TextCenterWithMediaTitle });
6069
6072
  const titleNode = (_a = slots.title) != null ? _a : title;
6073
+ const isDirectFile = !!videoUrl && DIRECT_FILE_PATTERN.test(videoUrl);
6070
6074
  return /* @__PURE__ */ jsxs("section", { className: clsx72(TextCenterWithMedia_module_default.textCenterWithMedia, className), children: [
6071
6075
  /* @__PURE__ */ jsxs(Container, { children: [
6072
6076
  titleNode && /* @__PURE__ */ jsx("h2", { className: "h2", children: titleNode }),
6073
- /* @__PURE__ */ jsx("div", { className: TextCenterWithMedia_module_default.thumbnailWrapper, children: thumbnail && /* @__PURE__ */ jsxs(Fragment, { children: [
6077
+ /* @__PURE__ */ jsx("div", { className: TextCenterWithMedia_module_default.thumbnailWrapper, children: thumbnail ? /* @__PURE__ */ jsxs(Fragment, { children: [
6074
6078
  /* @__PURE__ */ jsx(Picture, { src: thumbnail, alt: "Video thumbnail", className: TextCenterWithMedia_module_default.thumbnail }),
6075
6079
  /* @__PURE__ */ jsx(
6076
6080
  "button",
@@ -6081,6 +6085,28 @@ var TextCenterWithMedia = ({
6081
6085
  children: /* @__PURE__ */ jsx(Icon, { type: "play", size: 90 })
6082
6086
  }
6083
6087
  )
6088
+ ] }) : videoUrl && /* @__PURE__ */ jsxs("div", { className: TextCenterWithMedia_module_default.videoPreview, children: [
6089
+ isDirectFile ? /* @__PURE__ */ jsx(
6090
+ "video",
6091
+ {
6092
+ src: videoUrl,
6093
+ preload: "metadata",
6094
+ muted: true,
6095
+ playsInline: true,
6096
+ tabIndex: -1,
6097
+ "aria-hidden": "true",
6098
+ className: TextCenterWithMedia_module_default.videoPreviewElement
6099
+ }
6100
+ ) : /* @__PURE__ */ jsx(ReactPlayer2, { src: videoUrl, light: true, playing: false, width: "100%", height: "100%" }),
6101
+ /* @__PURE__ */ jsx(
6102
+ "button",
6103
+ {
6104
+ className: TextCenterWithMedia_module_default.playButton,
6105
+ onClick: () => setIsOpen(true),
6106
+ "aria-label": "Play video",
6107
+ children: /* @__PURE__ */ jsx(Icon, { type: "play", size: 90 })
6108
+ }
6109
+ )
6084
6110
  ] }) })
6085
6111
  ] }),
6086
6112
  /* @__PURE__ */ jsx(
@@ -6091,7 +6117,7 @@ var TextCenterWithMedia = ({
6091
6117
  ariaLabel: "Video player",
6092
6118
  closeLabel: "Close video",
6093
6119
  children: videoUrl && isOpen && /* @__PURE__ */ jsx(
6094
- ReactPlayer,
6120
+ ReactPlayer2,
6095
6121
  {
6096
6122
  ref: videoRef,
6097
6123
  src: videoUrl,