1 | var _excluded = ["className", "listClassName", "cssModule", "size", "tag", "listTag", "aria-label"];
|
2 | function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
3 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4 | function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
5 | function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
6 | import React from 'react';
|
7 | import PropTypes from 'prop-types';
|
8 | import classNames from 'classnames';
|
9 | import { mapToCssModules, tagPropType } from './utils';
|
10 | var propTypes = {
|
11 | children: PropTypes.node,
|
12 |
|
13 | className: PropTypes.string,
|
14 |
|
15 | listClassName: PropTypes.string,
|
16 |
|
17 | cssModule: PropTypes.object,
|
18 |
|
19 | size: PropTypes.string,
|
20 |
|
21 | tag: tagPropType,
|
22 |
|
23 | listTag: tagPropType,
|
24 | 'aria-label': PropTypes.string
|
25 | };
|
26 | function Pagination(props) {
|
27 | var className = props.className,
|
28 | listClassName = props.listClassName,
|
29 | cssModule = props.cssModule,
|
30 | size = props.size,
|
31 | _props$tag = props.tag,
|
32 | Tag = _props$tag === void 0 ? 'nav' : _props$tag,
|
33 | _props$listTag = props.listTag,
|
34 | ListTag = _props$listTag === void 0 ? 'ul' : _props$listTag,
|
35 | _props$ariaLabel = props['aria-label'],
|
36 | label = _props$ariaLabel === void 0 ? 'pagination' : _props$ariaLabel,
|
37 | attributes = _objectWithoutProperties(props, _excluded);
|
38 | var classes = mapToCssModules(classNames(className), cssModule);
|
39 | var listClasses = mapToCssModules(classNames(listClassName, 'pagination', _defineProperty({}, "pagination-".concat(size), !!size)), cssModule);
|
40 | return React.createElement(Tag, {
|
41 | className: classes,
|
42 | "aria-label": label
|
43 | }, React.createElement(ListTag, _extends({}, attributes, {
|
44 | className: listClasses
|
45 | })));
|
46 | }
|
47 | Pagination.propTypes = propTypes;
|
48 | export default Pagination; |
\ | No newline at end of file |