UNPKG

2.19 kBJavaScriptView Raw
1"use strict";
2
3function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
5require("core-js/modules/es.array.map");
6
7Object.defineProperty(exports, "__esModule", {
8 value: true
9});
10exports.ToolBarMenuOptions = void 0;
11
12var React = _interopRequireWildcard(require("react"));
13
14var _components = require("@storybook/components");
15
16var _constants = require("../../shared/constants");
17
18function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
19
20function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
21
22var ToolBarMenuOptions = function ToolBarMenuOptions(_ref) {
23 var activeName = _ref.activeName,
24 list = _ref.list,
25 onSelectOption = _ref.onSelectOption;
26 return React.createElement(_components.TooltipLinkList, {
27 links: list.map(function (name) {
28 return {
29 key: name,
30 id: name,
31 title: name !== _constants.OPT_OUT ? name : 'Off',
32 active: name === activeName,
33 onClick: onSelectOption(name)
34 };
35 })
36 });
37};
38
39exports.ToolBarMenuOptions = ToolBarMenuOptions;
\No newline at end of file