Skip to content

Commit

Permalink
Remove prop-types
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Jan 6, 2025
1 parent 176f6c6 commit b1233a6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 193 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
190 changes: 0 additions & 190 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import loadSdk from './loadSdk';

const {
Expand Down Expand Up @@ -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<YT.PlayerEventHandler<YT.PlayerEvent>>,
/**
* Sent when the player triggers an error.
*/
onError: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnErrorEvent>>,
/**
* Sent when the video is cued and ready to play.
*/
onCued: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnStateChangeEvent>>,
/**
* Sent when the video is buffering.
*/
onBuffering: PropTypes.func as PropTypes.Requireable<
YT.PlayerEventHandler<YT.OnStateChangeEvent>
>,
/**
* Sent when playback has been started or resumed.
*/
onPlaying: PropTypes.func as PropTypes.Requireable<
YT.PlayerEventHandler<YT.OnStateChangeEvent>
>,
/**
* Sent when playback has been paused.
*/
onPause: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnStateChangeEvent>>,
/**
* Sent when playback has stopped.
*/
onEnd: PropTypes.func as PropTypes.Requireable<YT.PlayerEventHandler<YT.OnStateChangeEvent>>,
onStateChange: PropTypes.func as PropTypes.Requireable<
YT.PlayerEventHandler<YT.OnStateChangeEvent>
>,
onPlaybackRateChange: PropTypes.func as PropTypes.Requireable<
YT.PlayerEventHandler<YT.OnPlaybackRateChangeEvent>
>,
onPlaybackQualityChange: PropTypes.func as PropTypes.Requireable<
YT.PlayerEventHandler<YT.OnPlaybackQualityChangeEvent>
>,
};
}

export { useYouTube };
export default YouTube;

0 comments on commit b1233a6

Please sign in to comment.