@synerise/ds-card 0.9.2
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/CHANGELOG.md +1058 -0
- package/LICENSE.md +21 -0
- package/README.md +101 -0
- package/dist/Card/Card.d.ts +4 -0
- package/dist/Card/Card.js +99 -0
- package/dist/Card/Card.styles.d.ts +36 -0
- package/dist/Card/Card.styles.js +111 -0
- package/dist/Card/Card.types.d.ts +24 -0
- package/dist/Card/Card.types.js +0 -0
- package/dist/CardBadge/CardBadge.d.ts +4 -0
- package/dist/CardBadge/CardBadge.js +16 -0
- package/dist/CardBadge/CardBadge.styles.d.ts +4 -0
- package/dist/CardBadge/CardBadge.styles.js +33 -0
- package/dist/CardBadge/CardBadge.types.d.ts +6 -0
- package/dist/CardBadge/CardBadge.types.js +0 -0
- package/dist/CardGroup/CardGroup.d.ts +4 -0
- package/dist/CardGroup/CardGroup.js +14 -0
- package/dist/CardGroup/CardGroup.styles.d.ts +3 -0
- package/dist/CardGroup/CardGroup.styles.js +22 -0
- package/dist/CardGroup/CardGroup.types.d.ts +6 -0
- package/dist/CardGroup/CardGroup.types.js +0 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +47 -0
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,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: card
|
|
3
|
+
title: Card
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Cards contain content and actions related to a single subject.
|
|
7
|
+
|
|
8
|
+
## When to use it
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
To display any kind of content (for example, tables, charts, dashboards, and more).
|
|
13
|
+
|
|
14
|
+
## Component anatomy
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This component is complex, which means it consists of other components:
|
|
19
|
+
|
|
20
|
+
- [icon](/docs/components/icon/)
|
|
21
|
+
- [typography](/docs/components/typography/)
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
npm i @synerise/ds-card
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
or
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
yarn add @synerise/ds-card
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
<Card
|
|
43
|
+
lively
|
|
44
|
+
withHeader
|
|
45
|
+
title="Card Example"
|
|
46
|
+
description="Some description"
|
|
47
|
+
icon={<IconComponent />}
|
|
48
|
+
iconColor="#54cb0b"
|
|
49
|
+
size="medium"
|
|
50
|
+
>
|
|
51
|
+
Content
|
|
52
|
+
</Card>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Card single
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
<iframe src="/storybook-static/iframe.html?id=components-card--single"></iframe>
|
|
60
|
+
|
|
61
|
+
## Card group
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
<iframe src="/storybook-static/iframe.html?id=components-card--group"></iframe>
|
|
66
|
+
|
|
67
|
+
## API
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### Properties
|
|
72
|
+
|
|
73
|
+
| Property | Description | Type | Default |
|
|
74
|
+
| --------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ------- |
|
|
75
|
+
| background | Background of Card container | `white` / `white-shadow` / `grey` / `grey-shadow` / `outline` | `white` |
|
|
76
|
+
| children | Defines if the button casts a shadow when the cursor is hovered over | React.ReactNode | - |
|
|
77
|
+
| className | Defines the class name of the container | string | - |
|
|
78
|
+
| compactHeader | Set as `true`, displays the description next to the header. Set as `false`, displays the description below the header | boolean | - |
|
|
79
|
+
| description | Defines the content of the card description (in the header) | React.ReactNode | string |
|
|
80
|
+
| disabled | Defines if the state of the component is disabled | boolean | - |
|
|
81
|
+
| headerBorderBottom | Show line under CardHeader | boolean | `false` |
|
|
82
|
+
| headerSideChildren | Defines if the container includes a button (in the header) | React.ReactNode | - |
|
|
83
|
+
| staticContent | Defines content that's visible even if hideContent is `true` | React.ReactNode | - |
|
|
84
|
+
| hideContent | Defines the initial visibility of the content | boolean | `false` |
|
|
85
|
+
| icon | Icon of CardBadge | React.ReactNode | - |
|
|
86
|
+
| iconColor | Defines the color of the icon | string | - |
|
|
87
|
+
| lively | Defines if the container casts a shadow when the cursor is hovered over | boolean | - |
|
|
88
|
+
| raised | Defines if the container casts a shadow on the background | boolean | - |
|
|
89
|
+
| style | Defines the CSS of the container | React.CSSProperties | - |
|
|
90
|
+
| size | Defines the width of the container (the container width is set to 100% when this property is not passed). | `small` (472px) / `medium` (588px) / `large` (966px) / `extraLarge` (1232px) | - |
|
|
91
|
+
| title | Defines the title of the card (in the header) | string | - |
|
|
92
|
+
| withHeader | Defines if the header is shown | boolean | - |
|
|
93
|
+
| withoutPadding | Reset padding of ContentContainer | boolean | `false` |
|
|
94
|
+
| showSideChildrenWhenHeaderHidden | Show headerSideChildren on the bottom when header is scrolled out of view | boolean | `false` |
|
|
95
|
+
|
|
96
|
+
#### CardBadge
|
|
97
|
+
|
|
98
|
+
| Property | Description | Type | Default |
|
|
99
|
+
| -------- | ----------------------------------- | ------------------------------------------- | --------- |
|
|
100
|
+
| Icon | Icon rendered in badge | React.ReactNode | - |
|
|
101
|
+
| Status | Defines the color of badge and icon | `success` / `error` / `warning` / `default` | `default` |
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import Icon from '@synerise/ds-icon';
|
|
15
|
+
import AnimateHeight from 'react-animate-height';
|
|
16
|
+
import VisibilitySensor from 'react-visibility-sensor';
|
|
17
|
+
import * as S from './Card.styles';
|
|
18
|
+
|
|
19
|
+
var Card = function Card(_ref) {
|
|
20
|
+
var children = _ref.children,
|
|
21
|
+
raised = _ref.raised,
|
|
22
|
+
disabled = _ref.disabled,
|
|
23
|
+
style = _ref.style,
|
|
24
|
+
className = _ref.className,
|
|
25
|
+
lively = _ref.lively,
|
|
26
|
+
withHeader = _ref.withHeader,
|
|
27
|
+
title = _ref.title,
|
|
28
|
+
description = _ref.description,
|
|
29
|
+
compactHeader = _ref.compactHeader,
|
|
30
|
+
icon = _ref.icon,
|
|
31
|
+
iconColor = _ref.iconColor,
|
|
32
|
+
headerSideChildren = _ref.headerSideChildren,
|
|
33
|
+
onHeaderClick = _ref.onHeaderClick,
|
|
34
|
+
withoutPadding = _ref.withoutPadding,
|
|
35
|
+
headerBorderBottom = _ref.headerBorderBottom,
|
|
36
|
+
_ref$background = _ref.background,
|
|
37
|
+
background = _ref$background === void 0 ? 'white-shadow' : _ref$background,
|
|
38
|
+
hideContent = _ref.hideContent,
|
|
39
|
+
staticContent = _ref.staticContent,
|
|
40
|
+
showSideChildrenWhenHeaderHidden = _ref.showSideChildrenWhenHeaderHidden;
|
|
41
|
+
var fatTitle = !description || description && compactHeader;
|
|
42
|
+
|
|
43
|
+
var _React$useState = React.useState(false),
|
|
44
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
|
+
headerActionsVisible = _React$useState2[0],
|
|
46
|
+
setHeaderActionsVisible = _React$useState2[1];
|
|
47
|
+
|
|
48
|
+
return React.createElement(S.Container, {
|
|
49
|
+
raised: raised,
|
|
50
|
+
disabled: disabled,
|
|
51
|
+
style: style,
|
|
52
|
+
className: "ds-card ".concat(className || ''),
|
|
53
|
+
lively: lively,
|
|
54
|
+
background: background
|
|
55
|
+
}, withHeader && React.createElement(S.Header, {
|
|
56
|
+
onClick: onHeaderClick,
|
|
57
|
+
headerBorderBottom: headerBorderBottom
|
|
58
|
+
}, icon && React.createElement(S.IconContainer, {
|
|
59
|
+
description: description,
|
|
60
|
+
compact: compactHeader
|
|
61
|
+
}, React.createElement(Icon, {
|
|
62
|
+
component: icon,
|
|
63
|
+
color: iconColor
|
|
64
|
+
})), React.createElement(S.HeaderContent, {
|
|
65
|
+
compact: compactHeader,
|
|
66
|
+
hasIcon: !!icon
|
|
67
|
+
}, title && React.createElement(S.Title, {
|
|
68
|
+
description: description,
|
|
69
|
+
level: 4,
|
|
70
|
+
fat: !!fatTitle
|
|
71
|
+
}, title), description && React.createElement(S.Description, null, description)), headerSideChildren && React.createElement(VisibilitySensor, {
|
|
72
|
+
partialVisibility: true,
|
|
73
|
+
onChange: setHeaderActionsVisible
|
|
74
|
+
}, React.createElement(S.HeaderSideChildren, {
|
|
75
|
+
onClick: function onClick(event) {
|
|
76
|
+
return event.stopPropagation();
|
|
77
|
+
}
|
|
78
|
+
}, headerSideChildren))), staticContent && React.createElement(AnimateHeight, {
|
|
79
|
+
className: "static-content-card-animation",
|
|
80
|
+
duration: 300,
|
|
81
|
+
height: hideContent ? 'auto' : 0
|
|
82
|
+
}, React.createElement(S.ChildrenContainer, null, React.createElement(S.PaddingWrapper, {
|
|
83
|
+
withoutPadding: withoutPadding,
|
|
84
|
+
withHeader: withHeader
|
|
85
|
+
}, staticContent))), React.createElement(AnimateHeight, {
|
|
86
|
+
className: "card-animation",
|
|
87
|
+
duration: 300,
|
|
88
|
+
height: hideContent ? 0 : 'auto'
|
|
89
|
+
}, React.createElement(S.ChildrenContainer, null, React.createElement(S.PaddingWrapper, {
|
|
90
|
+
withoutPadding: withoutPadding,
|
|
91
|
+
withHeader: withHeader
|
|
92
|
+
}, children))), showSideChildrenWhenHeaderHidden && React.createElement(AnimateHeight, {
|
|
93
|
+
className: "card-animation-footer",
|
|
94
|
+
duration: 0,
|
|
95
|
+
height: headerSideChildren && !headerActionsVisible ? 'auto' : 0
|
|
96
|
+
}, React.createElement(S.FooterContainer, null, headerSideChildren)));
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default Card;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Backgrounds } from './Card.types';
|
|
3
|
+
declare type IconContainerProps = {
|
|
4
|
+
compact?: boolean;
|
|
5
|
+
description?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const HeaderSideChildren: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const IconContainer: import("styled-components").StyledComponent<"div", any, IconContainerProps, never>;
|
|
9
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
raised?: boolean | undefined;
|
|
11
|
+
disabled?: boolean | undefined;
|
|
12
|
+
lively?: boolean | undefined;
|
|
13
|
+
background: Backgrounds;
|
|
14
|
+
}, never>;
|
|
15
|
+
export declare const Header: import("styled-components").StyledComponent<"div", any, {
|
|
16
|
+
onClick?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
|
|
17
|
+
headerBorderBottom?: boolean | undefined;
|
|
18
|
+
}, never>;
|
|
19
|
+
export declare const Title: import("styled-components").StyledComponent<React.FC<Pick<import("antd/lib/typography/Base").BlockProps & {
|
|
20
|
+
level?: 1 | 2 | 3 | 4 | 5 | undefined;
|
|
21
|
+
}, "code" | "mark" | "style" | "title" | "type" | "className" | "id" | "aria-label" | "children" | "disabled" | "editable" | "copyable" | "ellipsis" | "underline" | "delete" | "keyboard" | "prefixCls" | "level">>, any, {
|
|
22
|
+
fat: boolean;
|
|
23
|
+
description?: React.ReactNode;
|
|
24
|
+
}, never>;
|
|
25
|
+
export declare const Description: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
26
|
+
export declare const HeaderContent: import("styled-components").StyledComponent<"div", any, {
|
|
27
|
+
compact?: boolean | undefined;
|
|
28
|
+
hasIcon: boolean;
|
|
29
|
+
}, never>;
|
|
30
|
+
export declare const ChildrenContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
31
|
+
export declare const PaddingWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
32
|
+
withHeader?: boolean | undefined;
|
|
33
|
+
withoutPadding?: boolean | undefined;
|
|
34
|
+
}, never>;
|
|
35
|
+
export declare const FooterContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import Typography from '@synerise/ds-typography';
|
|
3
|
+
var whiteBg = ['white', 'white-shadow'];
|
|
4
|
+
var greyBg = ['grey', 'grey-shadow'];
|
|
5
|
+
var withBoxShadow = ['white-shadow', 'grey-shadow'];
|
|
6
|
+
var withOutline = ['outline'];
|
|
7
|
+
|
|
8
|
+
var backgroundColor = function backgroundColor(props) {
|
|
9
|
+
if (whiteBg.includes(props.background)) return props.theme.palette.white;
|
|
10
|
+
if (greyBg.includes(props.background)) return props.theme.palette['grey-050'];
|
|
11
|
+
return props.theme.palette.transparent;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var boxShadow = function boxShadow(props) {
|
|
15
|
+
if (withBoxShadow.includes(props.background)) return "0 4px 12px 0 rgba(35, 41, 54, 0.04)";
|
|
16
|
+
if (withOutline.includes(props.background)) return "".concat(props.theme.palette['grey-200'], " 0px 0px 0px 1px inset");
|
|
17
|
+
return 'none';
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
var getHeight = function getHeight(props) {
|
|
21
|
+
if (props.compact && props.description) {
|
|
22
|
+
return ' 32px';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (props.compact) {
|
|
26
|
+
return ' 32px';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (props.description) {
|
|
30
|
+
return '24px';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return ' 32px';
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export var HeaderSideChildren = styled.div.withConfig({
|
|
37
|
+
displayName: "Cardstyles__HeaderSideChildren",
|
|
38
|
+
componentId: "sc-18exblx-0"
|
|
39
|
+
})(["position:relative;padding-left:24px;"]);
|
|
40
|
+
export var IconContainer = styled.div.withConfig({
|
|
41
|
+
displayName: "Cardstyles__IconContainer",
|
|
42
|
+
componentId: "sc-18exblx-1"
|
|
43
|
+
})(["display:flex;width:24px;height:", ";align-items:center;"], function (props) {
|
|
44
|
+
return getHeight(props);
|
|
45
|
+
});
|
|
46
|
+
export var Container = styled.div.withConfig({
|
|
47
|
+
displayName: "Cardstyles__Container",
|
|
48
|
+
componentId: "sc-18exblx-2"
|
|
49
|
+
})(["background-color:", ";box-shadow:", ";border-radius:", ";display:flex;flex-flow:column;width:100%;.card-animation{> *{transition:opacity 0.3s ease;opacity:0;}&.rah-static--height-auto{> *{opacity:1;}}}", " ", ";", ""], function (props) {
|
|
50
|
+
return props.background ? backgroundColor(props) : props.theme.palette.transparent;
|
|
51
|
+
}, function (props) {
|
|
52
|
+
return props.background ? boxShadow(props) : 'none';
|
|
53
|
+
}, function (props) {
|
|
54
|
+
return props.theme.variable('@border-radius-base');
|
|
55
|
+
}, function (props) {
|
|
56
|
+
return !!props.raised && css(["box-shadow:", ";"], props.theme.variable('@box-shadow-active'));
|
|
57
|
+
}, function (props) {
|
|
58
|
+
return !!props.disabled && css(["pointer-events:none;opacity:0.4;", "{opacity:0.16;}", "{opacity:0.4;}"], HeaderSideChildren, IconContainer);
|
|
59
|
+
}, function (props) {
|
|
60
|
+
return !!props.lively && css(["&:hover{box-shadow:", ";}"], props.theme.variable('@box-shadow-active'));
|
|
61
|
+
});
|
|
62
|
+
export var Header = styled.div.withConfig({
|
|
63
|
+
displayName: "Cardstyles__Header",
|
|
64
|
+
componentId: "sc-18exblx-3"
|
|
65
|
+
})(["padding:24px 24px 24px 24px;display:flex;flex-direction:row;flex-wrap:nowrap;align-items:flex-start;position:relative;&:after{position:absolute;bottom:0;left:24px;right:24px;height:1px;content:'';display:", ";background-color:", ";}&:hover{", "}"], function (props) {
|
|
66
|
+
return props.headerBorderBottom ? 'block' : 'none';
|
|
67
|
+
}, function (props) {
|
|
68
|
+
return props.theme.palette['grey-100'];
|
|
69
|
+
}, function (props) {
|
|
70
|
+
return !!props.onClick && "cursor:pointer;";
|
|
71
|
+
});
|
|
72
|
+
export var Title = styled(Typography.Title).withConfig({
|
|
73
|
+
displayName: "Cardstyles__Title",
|
|
74
|
+
componentId: "sc-18exblx-4"
|
|
75
|
+
})(["&&{display:flex;align-items:center;min-height:", ";margin:0;margin-bottom:", ";}"], function (props) {
|
|
76
|
+
return props.fat ? '32px' : '20px';
|
|
77
|
+
}, function (props) {
|
|
78
|
+
return props.description ? '6px' : '0';
|
|
79
|
+
});
|
|
80
|
+
export var Description = styled.div.withConfig({
|
|
81
|
+
displayName: "Cardstyles__Description",
|
|
82
|
+
componentId: "sc-18exblx-5"
|
|
83
|
+
})(["&&{margin:0;}"]);
|
|
84
|
+
export var HeaderContent = styled.div.withConfig({
|
|
85
|
+
displayName: "Cardstyles__HeaderContent",
|
|
86
|
+
componentId: "sc-18exblx-6"
|
|
87
|
+
})(["max-width:100%;flex:1;", ";", ""], function (props) {
|
|
88
|
+
return props.hasIcon && css(["margin:0 0 0 20px;"]);
|
|
89
|
+
}, function (props) {
|
|
90
|
+
return !!props.compact && css(["display:flex;align-items:flex-start;flex-direction:row;", "{height:32px;line-height:32px;margin:0;}", "{border-left:1px solid ", ";height:32px;line-height:32px;padding:0 0 0 24px;margin:0 0 0 24px;}"], Title, Description, props.theme.palette['grey-200']);
|
|
91
|
+
});
|
|
92
|
+
export var ChildrenContainer = styled.div.withConfig({
|
|
93
|
+
displayName: "Cardstyles__ChildrenContainer",
|
|
94
|
+
componentId: "sc-18exblx-7"
|
|
95
|
+
})([""]);
|
|
96
|
+
export var PaddingWrapper = styled.div.withConfig({
|
|
97
|
+
displayName: "Cardstyles__PaddingWrapper",
|
|
98
|
+
componentId: "sc-18exblx-8"
|
|
99
|
+
})(["padding:", ";", ""], function (props) {
|
|
100
|
+
return props.withoutPadding ? '0' : "24px";
|
|
101
|
+
}, function (props) {
|
|
102
|
+
return !!props.withHeader && "padding-top: 0;";
|
|
103
|
+
});
|
|
104
|
+
export var FooterContainer = styled.div.withConfig({
|
|
105
|
+
displayName: "Cardstyles__FooterContainer",
|
|
106
|
+
componentId: "sc-18exblx-9"
|
|
107
|
+
})(["padding:24px;display:flex;align-items:center;justify-content:flex-end;background:", ";border-top:solid 1px ", ";"], function (props) {
|
|
108
|
+
return props.theme.palette.white;
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return props.theme.palette['grey-100'];
|
|
111
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare type Backgrounds = 'white' | 'white-shadow' | 'grey' | 'grey-shadow' | 'outline';
|
|
3
|
+
export interface CardProps {
|
|
4
|
+
raised?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
lively?: boolean;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
withHeader?: boolean;
|
|
11
|
+
compactHeader?: boolean;
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
iconColor?: string;
|
|
16
|
+
staticContent?: React.ReactNode;
|
|
17
|
+
headerSideChildren?: React.ReactNode;
|
|
18
|
+
onHeaderClick?: (e: React.SyntheticEvent) => void;
|
|
19
|
+
withoutPadding?: boolean;
|
|
20
|
+
headerBorderBottom?: boolean;
|
|
21
|
+
background?: Backgrounds;
|
|
22
|
+
hideContent?: boolean;
|
|
23
|
+
showSideChildrenWhenHeaderHidden?: boolean;
|
|
24
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Icon from '@synerise/ds-icon';
|
|
3
|
+
import * as S from './CardBadge.styles';
|
|
4
|
+
|
|
5
|
+
var CardBadge = function CardBadge(_ref) {
|
|
6
|
+
var icon = _ref.icon,
|
|
7
|
+
_ref$status = _ref.status,
|
|
8
|
+
status = _ref$status === void 0 ? 'default' : _ref$status;
|
|
9
|
+
return React.createElement(S.CardBadge, {
|
|
10
|
+
status: status
|
|
11
|
+
}, React.createElement(Icon, {
|
|
12
|
+
component: icon
|
|
13
|
+
}));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default CardBadge;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import styled from 'styled-components'; // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
|
|
4
|
+
var background = {
|
|
5
|
+
success: 'green-600',
|
|
6
|
+
warning: 'yellow-600',
|
|
7
|
+
error: 'red-600',
|
|
8
|
+
"default": 'transparent'
|
|
9
|
+
};
|
|
10
|
+
var color = {
|
|
11
|
+
success: 'white',
|
|
12
|
+
warning: 'white',
|
|
13
|
+
error: 'white',
|
|
14
|
+
"default": 'grey-400'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var boxShadow = function boxShadow(props) {
|
|
18
|
+
return props.status === 'default' ? "".concat(props.theme.palette['grey-400'], " 0px 0px 0px 1.5px inset") : 'none';
|
|
19
|
+
}; // eslint-disable-next-line import/prefer-default-export
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export var CardBadge = styled.div.withConfig({
|
|
23
|
+
displayName: "CardBadgestyles__CardBadge",
|
|
24
|
+
componentId: "sc-1xcnpyh-0"
|
|
25
|
+
})(["width:24px;height:24px;display:flex;align-items:center;justify-content:center;background-color:", ";box-shadow:", ";border-radius:50%;&&& svg{color:", ";fill:", ";}"], function (props) {
|
|
26
|
+
return props.theme.palette[background[props.status]];
|
|
27
|
+
}, function (props) {
|
|
28
|
+
return boxShadow(props);
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return props.theme.palette[color[props.status]];
|
|
31
|
+
}, function (props) {
|
|
32
|
+
return props.theme.palette[color[props.status]];
|
|
33
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as S from './CardGroup.styles';
|
|
3
|
+
|
|
4
|
+
var CardGroup = function CardGroup(_ref) {
|
|
5
|
+
var className = _ref.className,
|
|
6
|
+
children = _ref.children,
|
|
7
|
+
columns = _ref.columns;
|
|
8
|
+
return React.createElement(S.Container, {
|
|
9
|
+
className: className,
|
|
10
|
+
items: columns
|
|
11
|
+
}, children);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default CardGroup;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
8
|
+
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
12
|
+
|
|
13
|
+
import styled from 'styled-components'; // eslint-disable-next-line import/prefer-default-export
|
|
14
|
+
|
|
15
|
+
export var Container = styled.div.withConfig({
|
|
16
|
+
displayName: "CardGroupstyles__Container",
|
|
17
|
+
componentId: "qyudjs-0"
|
|
18
|
+
})(["display:grid;grid-column-gap:24px;grid-row-gap:24px;grid-template-columns:", ";width:100%;"], function (props) {
|
|
19
|
+
return _toConsumableArray(new Array(props.items)).map(function () {
|
|
20
|
+
return '1fr';
|
|
21
|
+
}).join(' ');
|
|
22
|
+
});
|
|
File without changes
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@synerise/ds-card",
|
|
3
|
+
"version": "0.9.2",
|
|
4
|
+
"description": "Card 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 --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
|
+
"prepublish": "npm run build",
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"test:watch": "npm run test -- --watchAll",
|
|
27
|
+
"types": "tsc --noEmit"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": [
|
|
30
|
+
"dist/style/*",
|
|
31
|
+
"*.less"
|
|
32
|
+
],
|
|
33
|
+
"types": "dist/index.d.ts",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@synerise/ds-icon": "^0.45.0",
|
|
36
|
+
"@synerise/ds-typography": "^0.11.9",
|
|
37
|
+
"@synerise/ds-utils": "^0.8.31",
|
|
38
|
+
"react-animate-height": "^2.0.23",
|
|
39
|
+
"react-visibility-sensor": "^5.1.1"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@synerise/ds-core": "*",
|
|
43
|
+
"antd": "^4",
|
|
44
|
+
"react": ">=16.9.0 < 17.0.0"
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "a9b2577e3c7e6b51625ab3ecca84600819ad0eeb"
|
|
47
|
+
}
|