mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 16:35:14 +00:00
104 lines
5.1 KiB
JavaScript
104 lines
5.1 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
exports.__esModule = true;
|
|
exports.default = void 0;
|
|
|
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
|
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
|
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
|
var _react = _interopRequireWildcard(require("react"));
|
|
|
|
var _ThemeProvider = require("./ThemeProvider");
|
|
|
|
var _TabContext = _interopRequireDefault(require("./TabContext"));
|
|
|
|
var _SelectableContext = _interopRequireWildcard(require("./SelectableContext"));
|
|
|
|
var _Fade = _interopRequireDefault(require("./Fade"));
|
|
|
|
var _excluded = ["activeKey", "getControlledId", "getControllerId"],
|
|
_excluded2 = ["bsPrefix", "className", "active", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "mountOnEnter", "unmountOnExit", "transition", "as", "eventKey"];
|
|
|
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
|
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
|
|
function useTabContext(props) {
|
|
var context = (0, _react.useContext)(_TabContext.default);
|
|
if (!context) return props;
|
|
var activeKey = context.activeKey,
|
|
getControlledId = context.getControlledId,
|
|
getControllerId = context.getControllerId,
|
|
rest = (0, _objectWithoutPropertiesLoose2.default)(context, _excluded);
|
|
var shouldTransition = props.transition !== false && rest.transition !== false;
|
|
var key = (0, _SelectableContext.makeEventKey)(props.eventKey);
|
|
return (0, _extends2.default)({}, props, {
|
|
active: props.active == null && key != null ? (0, _SelectableContext.makeEventKey)(activeKey) === key : props.active,
|
|
id: getControlledId(props.eventKey),
|
|
'aria-labelledby': getControllerId(props.eventKey),
|
|
transition: shouldTransition && (props.transition || rest.transition || _Fade.default),
|
|
mountOnEnter: props.mountOnEnter != null ? props.mountOnEnter : rest.mountOnEnter,
|
|
unmountOnExit: props.unmountOnExit != null ? props.unmountOnExit : rest.unmountOnExit
|
|
});
|
|
}
|
|
|
|
var TabPane = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
var _useTabContext = useTabContext(props),
|
|
bsPrefix = _useTabContext.bsPrefix,
|
|
className = _useTabContext.className,
|
|
active = _useTabContext.active,
|
|
onEnter = _useTabContext.onEnter,
|
|
onEntering = _useTabContext.onEntering,
|
|
onEntered = _useTabContext.onEntered,
|
|
onExit = _useTabContext.onExit,
|
|
onExiting = _useTabContext.onExiting,
|
|
onExited = _useTabContext.onExited,
|
|
mountOnEnter = _useTabContext.mountOnEnter,
|
|
unmountOnExit = _useTabContext.unmountOnExit,
|
|
Transition = _useTabContext.transition,
|
|
_useTabContext$as = _useTabContext.as,
|
|
Component = _useTabContext$as === void 0 ? 'div' : _useTabContext$as,
|
|
_ = _useTabContext.eventKey,
|
|
rest = (0, _objectWithoutPropertiesLoose2.default)(_useTabContext, _excluded2);
|
|
|
|
var prefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'tab-pane');
|
|
if (!active && !Transition && unmountOnExit) return null;
|
|
|
|
var pane = /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({}, rest, {
|
|
ref: ref,
|
|
role: "tabpanel",
|
|
"aria-hidden": !active,
|
|
className: (0, _classnames.default)(className, prefix, {
|
|
active: active
|
|
})
|
|
}));
|
|
|
|
if (Transition) pane = /*#__PURE__*/_react.default.createElement(Transition, {
|
|
in: active,
|
|
onEnter: onEnter,
|
|
onEntering: onEntering,
|
|
onEntered: onEntered,
|
|
onExit: onExit,
|
|
onExiting: onExiting,
|
|
onExited: onExited,
|
|
mountOnEnter: mountOnEnter,
|
|
unmountOnExit: unmountOnExit
|
|
}, pane); // We provide an empty the TabContext so `<Nav>`s in `<TabPane>`s don't
|
|
// conflict with the top level one.
|
|
|
|
return /*#__PURE__*/_react.default.createElement(_TabContext.default.Provider, {
|
|
value: null
|
|
}, /*#__PURE__*/_react.default.createElement(_SelectableContext.default.Provider, {
|
|
value: null
|
|
}, pane));
|
|
});
|
|
|
|
TabPane.displayName = 'TabPane';
|
|
var _default = TabPane;
|
|
exports.default = _default;
|
|
module.exports = exports["default"]; |