@synerise/ds-short-cuts 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,33 @@
1
+ ---
2
+ id: short-cuts
3
+ title: ShortCuts
4
+ ---
5
+
6
+ ShortCuts UI Component
7
+
8
+ ## Installation
9
+ ```
10
+ npm i @synerise/ds-short-cuts
11
+ or
12
+ yarn add @synerise/ds-short-cuts
13
+ ```
14
+
15
+ ## Usage
16
+ ```
17
+ import ShortCuts from '@synerise/ds-short-cuts'
18
+
19
+ <ShortCuts />
20
+
21
+ ```
22
+
23
+ ## Demo
24
+
25
+ <iframe src="/storybook-static/iframe.html?id=components-short-cuts--default"></iframe>
26
+
27
+ ## API
28
+
29
+ | Property | Description | Type | Default |
30
+ | size | sizes of short cut | `S` , `L` | - |
31
+ | children | render component | ReactNode | - |
32
+ | color | type of colors | string | - |
33
+ | icon | render icon | ReactNode | - |
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ShortCutsProps } from './ShortCuts.types';
3
+ declare const ShortCuts: ({ size, children, color, icon, ...htmlAttributes }: ShortCutsProps) => React.JSX.Element;
4
+ export default ShortCuts;
@@ -0,0 +1,29 @@
1
+ var _excluded = ["size", "children", "color", "icon"];
2
+
3
+ function _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); }
4
+
5
+ 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; }
6
+
7
+ import React from 'react';
8
+ import * as S from './ShortCuts.style';
9
+
10
+ var ShortCuts = function ShortCuts(_ref) {
11
+ var size = _ref.size,
12
+ children = _ref.children,
13
+ color = _ref.color,
14
+ icon = _ref.icon,
15
+ htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
16
+
17
+ return /*#__PURE__*/React.createElement(S.ShortCutWrapper, _extends({
18
+ color: color
19
+ }, htmlAttributes), /*#__PURE__*/React.createElement(S.Wrapper, {
20
+ icon: icon,
21
+ color: color,
22
+ size: size
23
+ }, icon ? /*#__PURE__*/React.createElement(S.ShortCutIcon, {
24
+ color: color,
25
+ component: icon
26
+ }) : children));
27
+ };
28
+
29
+ export default ShortCuts;
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const ShortCutWrapper: import("styled-components").StyledComponent<"div", any, {
3
+ color?: "dark" | "light" | undefined;
4
+ size?: "S" | "L" | undefined;
5
+ }, never>;
6
+ export declare const Wrapper: import("styled-components").StyledComponent<"div", any, {
7
+ size?: "S" | "L" | undefined;
8
+ color?: "dark" | "light" | undefined;
9
+ icon?: ReactNode;
10
+ }, never>;
11
+ export declare const ShortCutIcon: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-icon").IconProps>, any, {
12
+ color?: "dark" | "light" | undefined;
13
+ }, never>;
@@ -0,0 +1,49 @@
1
+ import styled from 'styled-components';
2
+ import Icon from '@synerise/ds-icon';
3
+
4
+ var getPadding = function getPadding(props) {
5
+ if (props.size === 'L' && props.icon) {
6
+ return '8px';
7
+ }
8
+
9
+ if (props.size === 'S' && props.icon) {
10
+ return '4px';
11
+ }
12
+
13
+ if (props.size === 'L') {
14
+ return '8px 14px';
15
+ }
16
+
17
+ if (props.size === 'S') {
18
+ return '4px 10px';
19
+ }
20
+
21
+ return '0px';
22
+ };
23
+
24
+ export var ShortCutWrapper = styled.div.withConfig({
25
+ displayName: "ShortCutsstyle__ShortCutWrapper",
26
+ componentId: "vo5qxe-0"
27
+ })(["display:flex;background-color:", ";border-radius:6px;border-bottom:2px solid ", ";box-shadow:0 0 10px 2px ", ";"], function (props) {
28
+ return props.color === 'dark' ? props.theme.palette['grey-600'] : props.theme.palette.white;
29
+ }, function (props) {
30
+ return props.color === 'dark' ? props.theme.palette['grey-500'] : props.theme.palette['grey-300'];
31
+ }, function (props) {
32
+ return props.color === 'dark' ? props.theme.palette['grey-300'] : props.theme.palette['grey-100'];
33
+ });
34
+ export var Wrapper = styled.div.withConfig({
35
+ displayName: "ShortCutsstyle__Wrapper",
36
+ componentId: "vo5qxe-1"
37
+ })(["display:flex;align-items:center;justify-content:center;min-width:", ";padding:", ";font-size:18px;color:", ";"], function (props) {
38
+ return props.size === 'S' ? '28px' : '36px';
39
+ }, function (props) {
40
+ return getPadding(props);
41
+ }, function (props) {
42
+ return props.color === 'dark' ? props.theme.palette.white : props.theme.palette['grey-600'];
43
+ });
44
+ export var ShortCutIcon = styled(Icon).withConfig({
45
+ displayName: "ShortCutsstyle__ShortCutIcon",
46
+ componentId: "vo5qxe-2"
47
+ })(["fill:", ";"], function (props) {
48
+ return props.color === 'dark' ? props.theme.palette.white : props.theme.palette['grey-600'];
49
+ });
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { ExactlyOne, WithHTMLAttributes } from '@synerise/ds-utils';
3
+ export type ShortCutsProps = WithHTMLAttributes<HTMLDivElement, {
4
+ size?: 'S' | 'L';
5
+ color?: 'light' | 'dark';
6
+ }> & ExactlyOne<{
7
+ icon?: ReactNode;
8
+ }, {
9
+ children?: ReactNode;
10
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './ShortCuts';
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default } from './ShortCuts';
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom/extend-expect';
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@synerise/ds-short-cuts",
3
+ "version": "0.0.1",
4
+ "description": "ShortCuts 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
+ },
30
+ "sideEffects": [
31
+ "dist/style/*",
32
+ "*.less"
33
+ ],
34
+ "types": "dist/index.d.ts",
35
+ "dependencies": {
36
+ "@synerise/ds-icon": "^0.66.2"
37
+ },
38
+ "peerDependencies": {
39
+ "@synerise/ds-core": "*",
40
+ "react": ">=16.9.0 <= 17.0.2"
41
+ },
42
+ "gitHead": "a1842a3e25b17cd0f9b3614f4ac2b4a3bc4da1f8"
43
+ }