UNPKG

3.21 kBJavaScriptView Raw
1import "core-js/modules/es.array.index-of.js";
2import "core-js/modules/es.function.name.js";
3import "core-js/modules/es.object.assign.js";
4import "core-js/modules/es.object.keys.js";
5
6function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
7
8function _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; }
9
10function _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; }
11
12import React from 'react';
13import { styled } from '@storybook/theming';
14import { ResetWrapper } from '../typography/DocumentFormatting';
15import { getBlockBackgroundStyle } from './BlockBackgroundStyles';
16var ItemLabel = styled.div(function (_ref) {
17 var theme = _ref.theme;
18 return {
19 fontFamily: theme.typography.fonts.base,
20 fontSize: theme.typography.size.s2,
21 color: theme.color.defaultText,
22 marginLeft: 10,
23 lineHeight: 1.2
24 };
25});
26var ItemSpecimen = styled.div(function (_ref2) {
27 var theme = _ref2.theme;
28 return Object.assign({}, getBlockBackgroundStyle(theme), {
29 overflow: 'hidden',
30 height: 40,
31 width: 40,
32 display: 'flex',
33 alignItems: 'center',
34 justifyContent: 'center',
35 flex: 'none',
36 '> img, > svg': {
37 width: 20,
38 height: 20
39 }
40 });
41});
42var Item = styled.div({
43 display: 'inline-flex',
44 flexDirection: 'row',
45 alignItems: 'center',
46 flex: '0 1 calc(20% - 10px)',
47 minWidth: 120,
48 margin: '0px 10px 30px 0'
49});
50var List = styled.div({
51 display: 'flex',
52 flexFlow: 'row wrap'
53});
54
55/**
56 * An individual icon with a caption and an example (passed as `children`).
57 */
58export var IconItem = function IconItem(_ref3) {
59 var name = _ref3.name,
60 children = _ref3.children;
61 return /*#__PURE__*/React.createElement(Item, null, /*#__PURE__*/React.createElement(ItemSpecimen, null, children), /*#__PURE__*/React.createElement(ItemLabel, null, name));
62};
63IconItem.displayName = "IconItem";
64
65/**
66 * Show a grid of icons, as specified by `IconItem`.
67 */
68export var IconGallery = function IconGallery(_ref4) {
69 var children = _ref4.children,
70 props = _objectWithoutProperties(_ref4, ["children"]);
71
72 return /*#__PURE__*/React.createElement(ResetWrapper, null, /*#__PURE__*/React.createElement(List, _extends({}, props, {
73 className: "docblock-icongallery"
74 }), children));
75};
76IconGallery.displayName = "IconGallery";
\No newline at end of file