Website : rimsha.abasa.com
backdoor
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
canvas
/
node_modules
/
@instructure
/
ui-buttons
/
lib
/
ToggleButton
/
Filename :
index.js
back
Copy
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = exports.ToggleButton = void 0; var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); var _react = _interopRequireWildcard(require("react")); var _testable = require("@instructure/ui-testable/lib/testable.js"); var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js"); var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js"); var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip"); var _IconButton = require("../IconButton"); var _props = require("./props"); const _excluded = ["as", "color", "elementRef", "size", "interaction", "mountNode", "renderIcon", "renderTooltipContent", "screenReaderLabel", "status", "placement", "onClick"]; var _dec, _class, _class2; /* * The MIT License (MIT) * * Copyright (c) 2015 - present Instructure, Inc. * * 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. */ /** --- category: components --- **/ let ToggleButton = exports.ToggleButton = (_dec = (0, _testable.testable)(), _dec(_class = (_class2 = class ToggleButton extends _react.Component { constructor(props) { super(props); this.ref = null; this.handleRef = el => { const elementRef = this.props.elementRef; if (typeof elementRef === 'function') { elementRef(el); } }; this.state = { isShowingTooltip: props.isShowingTooltip || false }; } get isShowingTooltip() { return typeof this.props.isShowingTooltip === 'undefined' ? this.state.isShowingTooltip : this.props.isShowingTooltip; } render() { const _this$props = this.props, as = _this$props.as, color = _this$props.color, elementRef = _this$props.elementRef, size = _this$props.size, interaction = _this$props.interaction, mountNode = _this$props.mountNode, renderIcon = _this$props.renderIcon, renderTooltipContent = _this$props.renderTooltipContent, screenReaderLabel = _this$props.screenReaderLabel, status = _this$props.status, placement = _this$props.placement, onClick = _this$props.onClick, props = (0, _objectWithoutProperties2.default)(_this$props, _excluded); return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, { renderTip: renderTooltipContent, on: ['hover', 'focus'], placement: placement, color: color === 'primary-inverse' ? 'primary-inverse' : 'primary', isShowingContent: this.isShowingTooltip, onShowContent: () => { this.setState({ isShowingTooltip: true }); }, onHideContent: () => { this.setState({ isShowingTooltip: false }); }, mountNode: mountNode, elementRef: el => this.ref = el }, /*#__PURE__*/_react.default.createElement(_IconButton.IconButton, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), { screenReaderLabel: screenReaderLabel, withBackground: false, withBorder: false, color: color, size: size, elementRef: this.handleRef, as: as, onClick: onClick, interaction: interaction, "aria-pressed": status === 'pressed' }), (0, _callRenderProp.callRenderProp)(renderIcon))); } }, _class2.displayName = "ToggleButton", _class2.componentId = 'ToggleButton', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = { size: 'medium', as: 'button', // Leave interaction default undefined so that `disabled` and `readOnly` can also be supplied interaction: void 0, mountNode: null, color: 'secondary', placement: 'top center', constrain: 'window' }, _class2)) || _class); var _default = exports.default = ToggleButton;