mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
15 KiB
JSON
1 line
15 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inheritsLoose from \"@babel/runtime/helpers/esm/inheritsLoose\";\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport Carousel from './Carousel';\nimport CarouselItem from './CarouselItem';\nimport CarouselControl from './CarouselControl';\nimport CarouselIndicators from './CarouselIndicators';\nimport CarouselCaption from './CarouselCaption';\nvar propTypes = {\n items: PropTypes.array.isRequired,\n indicators: PropTypes.bool,\n controls: PropTypes.bool,\n autoPlay: PropTypes.bool,\n defaultActiveIndex: PropTypes.number,\n activeIndex: PropTypes.number,\n next: PropTypes.func,\n previous: PropTypes.func,\n goToIndex: PropTypes.func\n};\n\nvar UncontrolledCarousel = /*#__PURE__*/function (_Component) {\n _inheritsLoose(UncontrolledCarousel, _Component);\n\n function UncontrolledCarousel(props) {\n var _this;\n\n _this = _Component.call(this, props) || this;\n _this.animating = false;\n _this.state = {\n activeIndex: props.defaultActiveIndex || 0\n };\n _this.next = _this.next.bind(_assertThisInitialized(_this));\n _this.previous = _this.previous.bind(_assertThisInitialized(_this));\n _this.goToIndex = _this.goToIndex.bind(_assertThisInitialized(_this));\n _this.onExiting = _this.onExiting.bind(_assertThisInitialized(_this));\n _this.onExited = _this.onExited.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n var _proto = UncontrolledCarousel.prototype;\n\n _proto.onExiting = function onExiting() {\n this.animating = true;\n };\n\n _proto.onExited = function onExited() {\n this.animating = false;\n };\n\n _proto.next = function next() {\n if (this.animating) return;\n var nextIndex = this.state.activeIndex === this.props.items.length - 1 ? 0 : this.state.activeIndex + 1;\n this.setState({\n activeIndex: nextIndex\n });\n };\n\n _proto.previous = function previous() {\n if (this.animating) return;\n var nextIndex = this.state.activeIndex === 0 ? this.props.items.length - 1 : this.state.activeIndex - 1;\n this.setState({\n activeIndex: nextIndex\n });\n };\n\n _proto.goToIndex = function goToIndex(newIndex) {\n if (this.animating) return;\n this.setState({\n activeIndex: newIndex\n });\n };\n\n _proto.render = function render() {\n var _this2 = this;\n\n var _this$props = this.props,\n defaultActiveIndex = _this$props.defaultActiveIndex,\n autoPlay = _this$props.autoPlay,\n indicators = _this$props.indicators,\n controls = _this$props.controls,\n items = _this$props.items,\n goToIndex = _this$props.goToIndex,\n props = _objectWithoutPropertiesLoose(_this$props, [\"defaultActiveIndex\", \"autoPlay\", \"indicators\", \"controls\", \"items\", \"goToIndex\"]);\n\n var activeIndex = this.state.activeIndex;\n var slides = items.map(function (item) {\n var key = item.key || item.src;\n return /*#__PURE__*/React.createElement(CarouselItem, {\n onExiting: _this2.onExiting,\n onExited: _this2.onExited,\n key: key\n }, /*#__PURE__*/React.createElement(\"img\", {\n className: \"d-block w-100\",\n src: item.src,\n alt: item.altText\n }), /*#__PURE__*/React.createElement(CarouselCaption, {\n captionText: item.caption,\n captionHeader: item.header || item.caption\n }));\n });\n return /*#__PURE__*/React.createElement(Carousel, _extends({\n activeIndex: activeIndex,\n next: this.next,\n previous: this.previous,\n ride: autoPlay ? 'carousel' : undefined\n }, props), indicators && /*#__PURE__*/React.createElement(CarouselIndicators, {\n items: items,\n activeIndex: props.activeIndex || activeIndex,\n onClickHandler: goToI
|