1 | import "core-js/modules/es.array.concat.js";
|
2 | import "core-js/modules/es.array.index-of.js";
|
3 | import "core-js/modules/es.object.keys.js";
|
4 |
|
5 | function _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; }
|
6 |
|
7 | function _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; }
|
8 |
|
9 | import React, { Fragment } from 'react';
|
10 | import { styled } from '@storybook/theming';
|
11 | import { FlexBar } from '../bar/bar';
|
12 | import { Icons } from '../icon/icon';
|
13 | import { IconButton } from '../bar/button';
|
14 |
|
15 | var Zoom = function Zoom(_ref) {
|
16 | var zoom = _ref.zoom,
|
17 | resetZoom = _ref.resetZoom;
|
18 | return React.createElement(React.Fragment, null, React.createElement(IconButton, {
|
19 | key: "zoomin",
|
20 | onClick: function onClick(e) {
|
21 | e.preventDefault();
|
22 | zoom(0.8);
|
23 | },
|
24 | title: "Zoom in"
|
25 | }, React.createElement(Icons, {
|
26 | icon: "zoom"
|
27 | })), React.createElement(IconButton, {
|
28 | key: "zoomout",
|
29 | onClick: function onClick(e) {
|
30 | e.preventDefault();
|
31 | zoom(1.25);
|
32 | },
|
33 | title: "Zoom out"
|
34 | }, React.createElement(Icons, {
|
35 | icon: "zoomout"
|
36 | })), React.createElement(IconButton, {
|
37 | key: "zoomreset",
|
38 | onClick: function onClick(e) {
|
39 | e.preventDefault();
|
40 | resetZoom();
|
41 | },
|
42 | title: "Reset zoom"
|
43 | }, React.createElement(Icons, {
|
44 | icon: "zoomreset"
|
45 | })));
|
46 | };
|
47 |
|
48 | var Eject = function Eject(_ref2) {
|
49 | var baseUrl = _ref2.baseUrl,
|
50 | storyId = _ref2.storyId;
|
51 | return React.createElement(IconButton, {
|
52 | key: "opener",
|
53 | href: "".concat(baseUrl, "?id=").concat(storyId),
|
54 | target: "_blank",
|
55 | title: "Open canvas in new tab"
|
56 | }, React.createElement(Icons, {
|
57 | icon: "share"
|
58 | }));
|
59 | };
|
60 |
|
61 | Eject.displayName = "Eject";
|
62 | var Bar = styled(FlexBar)({
|
63 | position: 'absolute',
|
64 | left: 0,
|
65 | right: 0,
|
66 | top: 0,
|
67 | transition: 'transform .2s linear'
|
68 | });
|
69 | export var Toolbar = function Toolbar(_ref3) {
|
70 | var storyId = _ref3.storyId,
|
71 | baseUrl = _ref3.baseUrl,
|
72 | zoom = _ref3.zoom,
|
73 | resetZoom = _ref3.resetZoom,
|
74 | rest = _objectWithoutProperties(_ref3, ["storyId", "baseUrl", "zoom", "resetZoom"]);
|
75 |
|
76 | return React.createElement(Bar, rest, React.createElement(Fragment, {
|
77 | key: "left"
|
78 | }, React.createElement(Zoom, {
|
79 | zoom: zoom,
|
80 | resetZoom: resetZoom
|
81 | })), React.createElement(Fragment, {
|
82 | key: "right"
|
83 | }, storyId && React.createElement(Eject, {
|
84 | storyId: storyId,
|
85 | baseUrl: baseUrl
|
86 | })));
|
87 | };
|
88 | Toolbar.displayName = "Toolbar"; |
\ | No newline at end of file |