UNPKG

3.47 kBJavaScriptView Raw
1import "core-js/modules/es.array.index-of.js";
2import "core-js/modules/es.object.keys.js";
3import "core-js/modules/es.string.bold.js";
4
5function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
7function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
9function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
11function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
13function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
15function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
17function _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; }
18
19function _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; }
20
21import React, { Children } from 'react';
22import { styled } from '@storybook/theming';
23var Title = styled.div(function (_ref) {
24 var theme = _ref.theme;
25 return {
26 fontWeight: theme.typography.weight.bold
27 };
28});
29var Desc = styled.div();
30var Message = styled.div(function (_ref2) {
31 var theme = _ref2.theme;
32 return {
33 padding: 30,
34 textAlign: 'center',
35 color: theme.color.defaultText,
36 fontSize: theme.typography.size.s2 - 1
37 };
38});
39export var Placeholder = function Placeholder(_ref3) {
40 var children = _ref3.children,
41 props = _objectWithoutProperties(_ref3, ["children"]);
42
43 var _Children$toArray = Children.toArray(children),
44 _Children$toArray2 = _slicedToArray(_Children$toArray, 2),
45 title = _Children$toArray2[0],
46 desc = _Children$toArray2[1];
47
48 return /*#__PURE__*/React.createElement(Message, props, /*#__PURE__*/React.createElement(Title, null, title), desc && /*#__PURE__*/React.createElement(Desc, null, desc));
49};
50Placeholder.displayName = "Placeholder";
\No newline at end of file