UNPKG

3.02 kBJavaScriptView Raw
1import "core-js/modules/es.array.index-of.js";
2import "core-js/modules/es.array.map.js";
3import "core-js/modules/es.object.keys.js";
4import "core-js/modules/es.string.bold.js";
5
6function _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; }
7
8function _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; }
9
10import React from 'react';
11import { styled } from '@storybook/theming';
12var Container = styled.div(function (_ref) {
13 var theme = _ref.theme;
14 return {
15 position: 'absolute',
16 bottom: 0,
17 right: 0,
18 maxWidth: '100%',
19 display: 'flex',
20 background: theme.background.content,
21 zIndex: 1
22 };
23});
24export var ActionButton = styled.button(function (_ref2) {
25 var theme = _ref2.theme;
26 return {
27 border: '0 none',
28 padding: '4px 10px',
29 cursor: 'pointer',
30 display: 'flex',
31 alignItems: 'center',
32 color: theme.color.defaultText,
33 background: theme.background.content,
34 fontSize: 12,
35 lineHeight: '16px',
36 fontFamily: theme.typography.fonts.base,
37 fontWeight: theme.typography.weight.bold,
38 borderTop: "1px solid ".concat(theme.appBorderColor),
39 borderLeft: "1px solid ".concat(theme.appBorderColor),
40 marginLeft: -1,
41 borderRadius: "4px 0 0 0",
42 '&:not(:last-child)': {
43 borderRight: "1px solid ".concat(theme.appBorderColor)
44 },
45 '& + *': {
46 borderLeft: "1px solid ".concat(theme.appBorderColor),
47 borderRadius: 0
48 },
49 '&:focus': {
50 boxShadow: "".concat(theme.color.secondary, " 0 -3px 0 0 inset"),
51 outline: '0 none'
52 }
53 };
54}, function (_ref3) {
55 var disabled = _ref3.disabled;
56 return disabled && {
57 cursor: 'not-allowed',
58 opacity: 0.5
59 };
60});
61ActionButton.displayName = 'ActionButton';
62export var ActionBar = function ActionBar(_ref4) {
63 var actionItems = _ref4.actionItems,
64 props = _objectWithoutProperties(_ref4, ["actionItems"]);
65
66 return /*#__PURE__*/React.createElement(Container, props, actionItems.map(function (_ref5, index) {
67 var title = _ref5.title,
68 onClick = _ref5.onClick,
69 disabled = _ref5.disabled;
70 return (
71 /*#__PURE__*/
72 // eslint-disable-next-line react/no-array-index-key
73 React.createElement(ActionButton, {
74 key: index,
75 onClick: onClick,
76 disabled: disabled
77 }, title)
78 );
79 }));
80};
81ActionBar.displayName = "ActionBar";
\No newline at end of file