elseware-ui 2.3.0 → 2.3.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.
@@ -1,9 +1,7 @@
1
- /// <reference types="@types/react" />
2
- import React from "react";
3
1
  interface YoutubeVideoPlayerProps {
4
2
  videoUrl: string;
5
3
  width?: number;
6
4
  height?: number;
7
5
  }
8
- declare const YoutubeVideoPlayer: React.FC<YoutubeVideoPlayerProps>;
6
+ declare function YoutubeVideoPlayer({ videoUrl, width, height, }: YoutubeVideoPlayerProps): import("react/jsx-runtime").JSX.Element;
9
7
  export default YoutubeVideoPlayer;
package/build/index.es.js CHANGED
@@ -33604,14 +33604,17 @@ var getYoutubeEmbedUrl = function (url) {
33604
33604
  var videoIdMatch = url.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/);
33605
33605
  return videoIdMatch ? "https://www.youtube.com/embed/".concat(videoIdMatch[1]) : "";
33606
33606
  };
33607
- var YoutubeVideoPlayer = function (_a) {
33607
+ function YoutubeVideoPlayer(_a) {
33608
33608
  var videoUrl = _a.videoUrl, _b = _a.width, width = _b === void 0 ? 750 : _b, _c = _a.height, height = _c === void 0 ? 422 : _c;
33609
33609
  var embedUrl = getYoutubeEmbedUrl(videoUrl);
33610
33610
  if (!embedUrl) {
33611
33611
  return jsxRuntime.jsx(FormResponse, { text: "Invalid YouTube URL", variant: "danger" });
33612
33612
  }
33613
- return (jsxRuntime.jsx("div", __assign$1({ className: "flex justify-center" }, { children: jsxRuntime.jsx("iframe", { width: width, height: height, src: embedUrl, title: "YouTube video player", frameBorder: "0", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, className: "rounded-lg shadow-lg" }) })));
33614
- };
33613
+ return (jsxRuntime.jsx("div", __assign$1({ className: "flex justify-center" }, { children: jsxRuntime.jsx("div", __assign$1({ className: "relative w-full", style: {
33614
+ maxWidth: "".concat(width, "px"),
33615
+ paddingTop: "".concat((height / width) * 100, "%"),
33616
+ } }, { children: jsxRuntime.jsx("iframe", { src: embedUrl, title: "YouTube video player", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, className: "absolute top-0 left-0 w-full h-full rounded-lg shadow-lg" }) })) })));
33617
+ }
33615
33618
 
33616
33619
  function InputResponse(_a) {
33617
33620
  var _b;
package/build/index.js CHANGED
@@ -33630,14 +33630,17 @@ var getYoutubeEmbedUrl = function (url) {
33630
33630
  var videoIdMatch = url.match(/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/);
33631
33631
  return videoIdMatch ? "https://www.youtube.com/embed/".concat(videoIdMatch[1]) : "";
33632
33632
  };
33633
- var YoutubeVideoPlayer = function (_a) {
33633
+ function YoutubeVideoPlayer(_a) {
33634
33634
  var videoUrl = _a.videoUrl, _b = _a.width, width = _b === void 0 ? 750 : _b, _c = _a.height, height = _c === void 0 ? 422 : _c;
33635
33635
  var embedUrl = getYoutubeEmbedUrl(videoUrl);
33636
33636
  if (!embedUrl) {
33637
33637
  return jsxRuntime.jsx(FormResponse, { text: "Invalid YouTube URL", variant: "danger" });
33638
33638
  }
33639
- return (jsxRuntime.jsx("div", __assign$1({ className: "flex justify-center" }, { children: jsxRuntime.jsx("iframe", { width: width, height: height, src: embedUrl, title: "YouTube video player", frameBorder: "0", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, className: "rounded-lg shadow-lg" }) })));
33640
- };
33639
+ return (jsxRuntime.jsx("div", __assign$1({ className: "flex justify-center" }, { children: jsxRuntime.jsx("div", __assign$1({ className: "relative w-full", style: {
33640
+ maxWidth: "".concat(width, "px"),
33641
+ paddingTop: "".concat((height / width) * 100, "%"),
33642
+ } }, { children: jsxRuntime.jsx("iframe", { src: embedUrl, title: "YouTube video player", allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture", allowFullScreen: true, className: "absolute top-0 left-0 w-full h-full rounded-lg shadow-lg" }) })) })));
33643
+ }
33641
33644
 
33642
33645
  function InputResponse(_a) {
33643
33646
  var _b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elseware-ui",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "private": false,
5
5
  "description": "A modern and customizable React UI component library by elseware Technology.",
6
6
  "types": "build/index.d.ts",