UNPKG

@elastic/eui

Version:

Elastic UI Component Library

76 lines (75 loc) 3.87 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /* * The MIT License (MIT) * * Copyright (c) 2018 HackerOne Inc and individual contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ import React from "react"; import PropTypes from "prop-types"; import classnames from "classnames"; import { jsx as ___EmotionJSX } from "@emotion/react"; var WeekNumber = /*#__PURE__*/function (_React$Component) { _inherits(WeekNumber, _React$Component); var _super = _createSuper(WeekNumber); function WeekNumber() { var _this; _classCallCheck(this, WeekNumber); for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } _this = _super.call.apply(_super, [this].concat(args)); _defineProperty(_assertThisInitialized(_this), "handleClick", function (event) { if (_this.props.onClick) { _this.props.onClick(event); } }); return _this; } _createClass(WeekNumber, [{ key: "render", value: function render() { var weekNumberClasses = { "react-datepicker__week-number": true, "react-datepicker__week-number--clickable": !!this.props.onClick }; return ___EmotionJSX("div", { className: classnames(weekNumberClasses), "aria-label": "week-".concat(this.props.weekNumber), onClick: this.handleClick }, this.props.weekNumber); } }]); return WeekNumber; }(React.Component); _defineProperty(WeekNumber, "propTypes", { weekNumber: PropTypes.number.isRequired, onClick: PropTypes.func }); export { WeekNumber as default };