@synerise/ds-toolbar 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Synerise
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ ---
2
+ id: toolbar
3
+ title: Toolbar
4
+ ---
5
+
6
+ Toolbar UI Component
7
+
8
+ ## Installation
9
+
10
+ ```
11
+ npm i @synerise/ds-toolbar
12
+ or
13
+ yarn add @synerise/ds-toolbar
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```
19
+ import Toolbar from '@synerise/ds-toolbar'
20
+
21
+ <Toolbar>
22
+ <ToolbarGroup>
23
+ <ToolbarButton mode="single-icon">
24
+ <Icon component={<StepBackM />} />
25
+ </ToolbarButton>
26
+ <ToolbarButton mode="single-icon">
27
+ <Icon component={<StepForwardM />} />
28
+ </ToolbarButton>
29
+ </ToolbarGroup>
30
+ </Toolbar>
31
+
32
+ ```
33
+
34
+ ## Demo
35
+
36
+ <iframe src="/storybook-static/iframe.html?id=components-toolbar--default"></iframe>
37
+
38
+ ## API
39
+
40
+ ### Toolbar
41
+
42
+ | Property | Description | Type | Default |
43
+ | -------- | ----------------------- | --------- | ------- |
44
+ | children | contents of the toolbar | ReactNode | - |
45
+
46
+ ### ToolbarGroup
47
+
48
+ | Property | Description | Type | Default |
49
+ | --------- | ------------------------------------------------- | --------- | ------- |
50
+ | children | contents of the toolbar | ReactNode | - |
51
+ | isCompact | compact ToolbarGroup has 0px gap between elements | boolean | - |
52
+
53
+ ### ToolbarButton
54
+
55
+ see ds-button for more props
56
+
57
+ | Property | Description | Type | Default |
58
+ | ------------ | -------------- | ------------------------------------------------ | ------- |
59
+ | type | type of button | 'ghost-primary' / 'ghost' / 'custom-color-ghost' | - |
60
+ | tooltipProps | Tooltip config | TooltipProps see ds-tooltip | - |
61
+ | badgeProps | Badge config | BadgeProps see ds-badge | - |
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { ToolbarProps } from './Toolbar.types';
3
+ declare const Toolbar: ({ children, ...htmlAttributes }: ToolbarProps) => React.JSX.Element;
4
+ export default Toolbar;
@@ -0,0 +1,10 @@
1
+ var _excluded = ["children"];
2
+ 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; }
3
+ import React from 'react';
4
+ import * as S from './Toolbar.styles';
5
+ var Toolbar = function Toolbar(_ref) {
6
+ var children = _ref.children,
7
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
8
+ return /*#__PURE__*/React.createElement(S.ToolbarWrapper, htmlAttributes, children);
9
+ };
10
+ export default Toolbar;
@@ -0,0 +1,5 @@
1
+ export declare const ToolbarWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const ToolbarLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const ToolbarGroup: import("styled-components").StyledComponent<"div", any, {
4
+ isCompact?: boolean | undefined;
5
+ }, never>;
@@ -0,0 +1,21 @@
1
+ import styled from 'styled-components';
2
+ export var ToolbarWrapper = styled.div.withConfig({
3
+ displayName: "Toolbarstyles__ToolbarWrapper",
4
+ componentId: "sc-1wn8say-0"
5
+ })(["display:flex;gap:8px;"]);
6
+ export var ToolbarLabel = styled.div.withConfig({
7
+ displayName: "Toolbarstyles__ToolbarLabel",
8
+ componentId: "sc-1wn8say-1"
9
+ })(["display:flex;align-items:center;justify-content:center;padding:0 12px;font-weight:500;color:", ";"], function (props) {
10
+ return props.theme.palette['grey-600'];
11
+ });
12
+ export var ToolbarGroup = styled.div.withConfig({
13
+ displayName: "Toolbarstyles__ToolbarGroup",
14
+ componentId: "sc-1wn8say-2"
15
+ })(["display:flex;", ";background:", ";padding:4px;border-radius:3px;align-content:center;box-shadow:0px 4px 12px 0px ", "0A;"], function (props) {
16
+ return !props.isCompact && "gap: 4px";
17
+ }, function (props) {
18
+ return props.theme.palette.white;
19
+ }, function (props) {
20
+ return props.theme.palette['grey-900'];
21
+ });
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ButtonProps } from '@synerise/ds-button';
3
+ import type { TooltipProps } from '@synerise/ds-tooltip';
4
+ import type { BadgeProps } from '@synerise/ds-badge';
5
+ import { WithHTMLAttributes } from '@synerise/ds-utils';
6
+ export type ToolbarProps = WithHTMLAttributes<HTMLDivElement, {
7
+ children: ReactNode;
8
+ }>;
9
+ export type ToolbarLabelProps = WithHTMLAttributes<HTMLDivElement, {
10
+ children: ReactNode;
11
+ }>;
12
+ export type ToolbarGroupProps = WithHTMLAttributes<HTMLDivElement, {
13
+ children: ReactNode;
14
+ isCompact?: boolean;
15
+ }>;
16
+ export type ToolbarButtonProps = Omit<ButtonProps, 'type'> & {
17
+ type?: 'ghost-primary' | 'ghost' | 'custom-color-ghost';
18
+ tooltipProps?: TooltipProps;
19
+ badgeProps?: BadgeProps;
20
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { ToolbarButtonProps } from '../../Toolbar.types';
3
+ export declare const ToolbarButton: ({ tooltipProps, badgeProps, ...props }: ToolbarButtonProps) => React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ var _excluded = ["tooltipProps", "badgeProps"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
3
+ 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; }
4
+ import React from 'react';
5
+ import Button from '@synerise/ds-button';
6
+ import Tooltip from '@synerise/ds-tooltip';
7
+ import Badge from '@synerise/ds-badge';
8
+ export var ToolbarButton = function ToolbarButton(_ref) {
9
+ var tooltipProps = _ref.tooltipProps,
10
+ badgeProps = _ref.badgeProps,
11
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
12
+ var rawButton = /*#__PURE__*/React.createElement(Button, _extends({
13
+ type: "ghost"
14
+ }, props));
15
+ var button = badgeProps ? /*#__PURE__*/React.createElement(Badge, badgeProps, rawButton) : rawButton;
16
+ return tooltipProps ? /*#__PURE__*/React.createElement(Tooltip, tooltipProps, button) : button;
17
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { ToolbarGroupProps } from '../../Toolbar.types';
3
+ export declare const ToolbarGroup: ({ children, isCompact, ...htmlAttributes }: ToolbarGroupProps) => React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ var _excluded = ["children", "isCompact"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
3
+ 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; }
4
+ import React from 'react';
5
+ import * as S from '../../Toolbar.styles';
6
+ export var ToolbarGroup = function ToolbarGroup(_ref) {
7
+ var children = _ref.children,
8
+ isCompact = _ref.isCompact,
9
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
10
+ return /*#__PURE__*/React.createElement(S.ToolbarGroup, _extends({
11
+ isCompact: isCompact
12
+ }, htmlAttributes), children);
13
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { ToolbarLabelProps } from '../../Toolbar.types';
3
+ export declare const ToolbarLabel: ({ children, ...htmlAttributes }: ToolbarLabelProps) => React.JSX.Element;
@@ -0,0 +1,9 @@
1
+ var _excluded = ["children"];
2
+ 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; }
3
+ import React from 'react';
4
+ import * as S from '../../Toolbar.styles';
5
+ export var ToolbarLabel = function ToolbarLabel(_ref) {
6
+ var children = _ref.children,
7
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
8
+ return /*#__PURE__*/React.createElement(S.ToolbarLabel, htmlAttributes, children);
9
+ };
@@ -0,0 +1,3 @@
1
+ export * from './ToolbarGroup/ToolbarGroup';
2
+ export * from './ToolbarButton/ToolbarButton';
3
+ export * from './ToolbarLabel/ToolbarLabel';
@@ -0,0 +1,3 @@
1
+ export * from './ToolbarGroup/ToolbarGroup';
2
+ export * from './ToolbarButton/ToolbarButton';
3
+ export * from './ToolbarLabel/ToolbarLabel';
@@ -0,0 +1,3 @@
1
+ export { default } from './Toolbar';
2
+ export * from './components';
3
+ export type { ToolbarProps } from './Toolbar.types';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default } from './Toolbar';
2
+ export * from './components';
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@synerise/ds-toolbar",
3
+ "version": "0.0.1",
4
+ "description": "Toolbar UI Component for the Synerise Design System",
5
+ "license": "ISC",
6
+ "repository": "Synerise/synerise-design",
7
+ "main": "dist/index.js",
8
+ "files": [
9
+ "/dist",
10
+ "CHANGELOG.md",
11
+ "README.md",
12
+ "package.json",
13
+ "LICENSE.md"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "build": "npm run build:js && npm run build:css && npm run defs",
20
+ "build:css": "node ../../../scripts/style/less.js",
21
+ "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
+ "build:watch": "npm run build:js -- --watch",
23
+ "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
+ "pack:ci": "npm pack --pack-destination ../../portal/storybook-static/static",
25
+ "prepublish": "npm run build",
26
+ "test": "jest",
27
+ "test:watch": "npm run test -- --watchAll",
28
+ "types": "tsc --noEmit",
29
+ "upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
30
+ },
31
+ "sideEffects": [
32
+ "dist/style/*",
33
+ "*.less"
34
+ ],
35
+ "types": "dist/index.d.ts",
36
+ "dependencies": {
37
+ "@synerise/ds-badge": "^0.8.22",
38
+ "@synerise/ds-button": "^0.22.0",
39
+ "@synerise/ds-tooltip": "^0.14.52",
40
+ "@synerise/ds-utils": "^0.31.2"
41
+ },
42
+ "peerDependencies": {
43
+ "@synerise/ds-core": "*",
44
+ "react": ">=16.9.0 <= 17.0.2",
45
+ "styled-components": "5.0.1"
46
+ },
47
+ "gitHead": "944213811bd19a6e10380cb3b84bb1bda6ce8a10"
48
+ }