From b1233a6dfe821a5e17875608ce2ba596eabbd9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Mon, 6 Jan 2025 13:17:02 +0100 Subject: [PATCH] Remove prop-types --- package.json | 4 +- src/index.tsx | 190 -------------------------------------------------- 2 files changed, 1 insertion(+), 193 deletions(-) diff --git a/package.json b/package.json index 7ffe444..5b15e8e 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,8 @@ "url": "https://github.com/u-wave/react-youtube/issues" }, "dependencies": { - "@types/prop-types": "^15.7.5", "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0", - "@types/youtube": "^0.1.0", - "prop-types": "^15.8.1" + "@types/youtube": "^0.1.0" }, "devDependencies": { "@microsoft/api-extractor": "^7.48.1", diff --git a/src/index.tsx b/src/index.tsx index 0cb2f10..d5d15b9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import PropTypes from 'prop-types'; import loadSdk from './loadSdk'; const { @@ -417,194 +416,5 @@ function YouTube({ ); } -if (process.env.NODE_ENV !== 'production') { - YouTube.propTypes = { - /** - * An 11-character string representing a YouTube video ID. - */ - video: PropTypes.string, - /** - * DOM ID for the player element. - */ - id: PropTypes.string, - /** - * CSS className for the player element. - */ - className: PropTypes.string, - /** - * Inline style for the player element. - */ - style: PropTypes.object, // eslint-disable-line react/forbid-prop-types - /** - * Width of the player element. - */ - width: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.string, - ]), - /** - * Height of the player element. - */ - height: PropTypes.oneOfType([ - PropTypes.number, - PropTypes.string, - ]), - - /** - * Pause the video. - */ - paused: PropTypes.bool, - - /** - * YouTube host to use: 'https://www.youtube.com' or 'https://www.youtube-nocookie.com'. - * - * @default 'https://www.youtube.com' - */ - host: PropTypes.string, - - /** - * The YouTube API will usually default this value correctly. It is exposed for completeness. - */ - origin: PropTypes.string, - - // Player parameters - - /** - * Whether the video should start playing automatically. - * - * https://developers.google.com/youtube/player_parameters#autoplay - */ - autoplay: PropTypes.bool, - /** - * Whether to show captions below the video. - * - * https://developers.google.com/youtube/player_parameters#cc_load_policy - */ - showCaptions: PropTypes.bool, - /** - * Whether to show video controls. - * - * https://developers.google.com/youtube/player_parameters#controls - */ - controls: PropTypes.bool, - /** - * Ignore keyboard controls. - * - * https://developers.google.com/youtube/player_parameters#disablekb - */ - disableKeyboard: PropTypes.bool, - /** - * Whether to display the fullscreen button. - * - * https://developers.google.com/youtube/player_parameters#fs - */ - allowFullscreen: PropTypes.bool, - /** - * The player's interface language. The parameter value is an ISO 639-1 - * two-letter language code or a fully specified locale. - * - * https://developers.google.com/youtube/player_parameters#hl - */ - lang: PropTypes.string, - /** - * Whether to show annotations on top of the video. - * - * https://developers.google.com/youtube/player_parameters#iv_load_policy - */ - annotations: PropTypes.bool, - /** - * Time in seconds at which to start playing the video. - * - * https://developers.google.com/youtube/player_parameters#start - */ - startSeconds: PropTypes.number, - /** - * Time in seconds at which to stop playing the video. - * - * https://developers.google.com/youtube/player_parameters#end - */ - endSeconds: PropTypes.number, - /** - * Remove most YouTube logos from the player. - * - * https://developers.google.com/youtube/player_parameters#modestbranding - */ - modestBranding: PropTypes.bool, - /** - * Whether to play the video inline on iOS, instead of fullscreen. - * - * https://developers.google.com/youtube/player_parameters#playsinline - */ - playsInline: PropTypes.bool, - /** - * Whether to show related videos after the video is over. - * - * https://developers.google.com/youtube/player_parameters#rel - */ - showRelatedVideos: PropTypes.bool, - - /** - * The playback volume, **as a number between 0 and 1**. - */ - volume: PropTypes.number, - - /** - * Whether the video's sound should be muted. - */ - muted: PropTypes.bool, - - /** - * Playback speed. - * - * https://developers.google.com/youtube/iframe_api_reference#setPlaybackRate - */ - playbackRate: PropTypes.number, - - // Events - - /** - * Sent when the YouTube player API has loaded. - */ - onReady: PropTypes.func as PropTypes.Requireable>, - /** - * Sent when the player triggers an error. - */ - onError: PropTypes.func as PropTypes.Requireable>, - /** - * Sent when the video is cued and ready to play. - */ - onCued: PropTypes.func as PropTypes.Requireable>, - /** - * Sent when the video is buffering. - */ - onBuffering: PropTypes.func as PropTypes.Requireable< - YT.PlayerEventHandler - >, - /** - * Sent when playback has been started or resumed. - */ - onPlaying: PropTypes.func as PropTypes.Requireable< - YT.PlayerEventHandler - >, - /** - * Sent when playback has been paused. - */ - onPause: PropTypes.func as PropTypes.Requireable>, - /** - * Sent when playback has stopped. - */ - onEnd: PropTypes.func as PropTypes.Requireable>, - onStateChange: PropTypes.func as PropTypes.Requireable< - YT.PlayerEventHandler - >, - onPlaybackRateChange: PropTypes.func as PropTypes.Requireable< - YT.PlayerEventHandler - >, - onPlaybackQualityChange: PropTypes.func as PropTypes.Requireable< - YT.PlayerEventHandler - >, - }; -} - export { useYouTube }; export default YouTube;