MCPcopy Create free account
hub / github.com/docker/getting-started / Carousel

Function Carousel

app/src/static/js/react-bootstrap.js:10999–11086  ·  view source on GitHub ↗
(props, context)

Source from the content-addressed store, hash-verified

10997 _inheritsLoose(Carousel, _React$Component);
10998
10999 function Carousel(props, context) {
11000 var _this;
11001
11002 _this = _React$Component.call(this, props, context) || this;
11003
11004 _this.handleSlideEnd = function () {
11005 var pendingIndex = _this._pendingIndex;
11006 _this._isSliding = false;
11007 _this._pendingIndex = null;
11008 if (pendingIndex != null) _this.to(pendingIndex);else _this.cycle();
11009 };
11010
11011 _this.handleMouseOut = function () {
11012 _this.cycle();
11013 };
11014
11015 _this.handleMouseOver = function () {
11016 if (_this.props.pauseOnHover) _this.pause();
11017 };
11018
11019 _this.handleKeyDown = function (event) {
11020 if (/input|textarea/i.test(event.target.tagName)) return;
11021
11022 switch (event.key) {
11023 case 'ArrowLeft':
11024 event.preventDefault();
11025
11026 _this.handlePrev(event);
11027
11028 break;
11029
11030 case 'ArrowRight':
11031 event.preventDefault();
11032
11033 _this.handleNext(event);
11034
11035 break;
11036
11037 default:
11038 break;
11039 }
11040 };
11041
11042 _this.handleNextWhenVisible = function () {
11043 if (!_this.isUnmounted && !document.hidden && style_default()(_this.carousel.current, 'visibility') !== 'hidden') {
11044 _this.handleNext();
11045 }
11046 };
11047
11048 _this.handleNext = function (e) {
11049 if (_this._isSliding) return;
11050 var _this$props = _this.props,
11051 wrap = _this$props.wrap,
11052 activeIndex = _this$props.activeIndex;
11053 var index = activeIndex + 1;
11054 var count = Carousel_countChildren(_this.props.children);
11055
11056 if (index > count - 1) {

Callers

nothing calls this directly

Calls 1

Carousel_countChildrenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…