@synerise/ds-card 0.16.19 → 0.17.0

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 CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.17.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@0.16.20...@synerise/ds-card@0.17.0) (2024-06-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * **card:** added a summary subcomponent ([4ca43a2](https://github.com/Synerise/synerise-design/commit/4ca43a2b057776f62d26f350eaa7e66521ff9f3d))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.16.20](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@0.16.19...@synerise/ds-card@0.16.20) (2024-05-31)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-card
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.16.19](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@0.16.18...@synerise/ds-card@0.16.19) (2024-05-29)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-card
package/README.md CHANGED
@@ -103,3 +103,22 @@ yarn add @synerise/ds-card
103
103
  | -------- | ----------------------------------- | ------------------------------------------- | --------- |
104
104
  | Icon | Icon rendered in badge | React.ReactNode | - |
105
105
  | Status | Defines the color of badge and icon | `success` / `error` / `warning` / `default` | `default` |
106
+
107
+ #### CardSummary
108
+
109
+ Renders a summary in a bulletted list form. Can be assigned to Card.staticContent prop
110
+
111
+ | Property | Description | Type | Default |
112
+ | -------- | ------------------------------------------- | ------------------------ | ------- |
113
+ | title | Otional title rendered above bulletted list | `React.ReactNode` | - |
114
+ | items | Defines the color of badge and icon | `CardSummaryItemProps[]` | - |
115
+
116
+
117
+ #### CardSummaryItemProps
118
+
119
+ | Property | Description | Type | Default |
120
+ | ----------------- | ------------------------------------------------------------------------------ | ---------------------- | ------- |
121
+ | key | Unique key | `React.Key` | - |
122
+ | label | Optional label to display | `React.ReactNode` | - |
123
+ | value | Mandatory value to display | `React.ReactNode` | - |
124
+ | summaryRowObjects | Optional array of react elements, renders 4 in a row in a toggleable container | `React.ReactElement[]` | - |
package/dist/Card/Card.js CHANGED
@@ -9,6 +9,7 @@ import Icon from '@synerise/ds-icon';
9
9
  import AnimateHeight from 'react-animate-height';
10
10
  import VisibilitySensor from 'react-visibility-sensor';
11
11
  import * as S from './Card.styles';
12
+ import { ANIMATION_DURATION } from '../constants';
12
13
 
13
14
  var Card = function Card(_ref) {
14
15
  var children = _ref.children,
@@ -93,7 +94,7 @@ var Card = function Card(_ref) {
93
94
  }
94
95
  }, headerSideChildren))), staticContent && /*#__PURE__*/React.createElement(AnimateHeight, {
95
96
  className: "static-content-card-animation",
96
- duration: 300,
97
+ duration: ANIMATION_DURATION,
97
98
  height: hideContent ? 'auto' : 0
98
99
  }, /*#__PURE__*/React.createElement(S.ChildrenContainer, {
99
100
  "data-testid": "card-static-content"
@@ -102,7 +103,7 @@ var Card = function Card(_ref) {
102
103
  withHeader: withHeader
103
104
  }, staticContent))), /*#__PURE__*/React.createElement(AnimateHeight, {
104
105
  className: "card-animation",
105
- duration: 300,
106
+ duration: ANIMATION_DURATION,
106
107
  height: hideContent ? 0 : 'auto'
107
108
  }, /*#__PURE__*/React.createElement(S.ChildrenContainer, {
108
109
  "data-testid": "card-content"
@@ -1,9 +1,9 @@
1
- import * as React from 'react';
1
+ import type { MouseEventHandler, ReactNode } from 'react';
2
2
  import { Backgrounds } from './Card.types';
3
3
  export declare const HeaderSideChildren: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export declare const IconContainer: import("styled-components").StyledComponent<"div", any, {
5
5
  compact?: boolean | undefined;
6
- description?: React.ReactNode;
6
+ description?: ReactNode;
7
7
  }, never>;
8
8
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
9
9
  raised?: boolean | undefined;
@@ -12,11 +12,11 @@ export declare const Container: import("styled-components").StyledComponent<"div
12
12
  background: Backgrounds;
13
13
  }, never>;
14
14
  export declare const Header: import("styled-components").StyledComponent<"div", any, {
15
- onClick?: React.MouseEventHandler<Element> | undefined;
15
+ onClick?: MouseEventHandler<Element> | undefined;
16
16
  headerBorderBottom?: boolean | undefined;
17
17
  defaultHeaderBackgroundColor?: boolean | undefined;
18
18
  }, never>;
19
- export declare const Title: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => React.JSX.Element, any, {
19
+ export declare const Title: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => import("react").JSX.Element, any, {
20
20
  fat: boolean;
21
21
  }, never>;
22
22
  export declare const TitleWrapper: import("styled-components").StyledComponent<"div", any, {
@@ -1,6 +1,7 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { Title as DSTitle } from '@synerise/ds-typography';
3
3
  import { Container as TagsContainer } from '@synerise/ds-tags/dist/Tags.styles';
4
+ import { CardSummaryWrapper } from '../CardSummary/CardSummary.styles';
4
5
  var whiteBg = ['white', 'white-shadow'];
5
6
  var greyBg = ['grey', 'grey-shadow'];
6
7
  var withBoxShadow = ['white-shadow', 'grey-shadow'];
@@ -101,11 +102,11 @@ export var ChildrenContainer = styled.div.withConfig({
101
102
  export var PaddingWrapper = styled.div.withConfig({
102
103
  displayName: "Cardstyles__PaddingWrapper",
103
104
  componentId: "sc-18exblx-10"
104
- })(["padding:", ";", ""], function (props) {
105
+ })(["padding:", ";", " ", "{margin:0 48px;}"], function (props) {
105
106
  return props.withoutPadding ? '0' : "24px";
106
107
  }, function (props) {
107
108
  return !!props.withHeader && "padding-top: 0;";
108
- });
109
+ }, CardSummaryWrapper);
109
110
  export var FooterContainer = styled.div.withConfig({
110
111
  displayName: "Cardstyles__FooterContainer",
111
112
  componentId: "sc-18exblx-11"
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import { CardGroupProps } from './CardGroup.types';
3
- declare const CardGroup: React.FC<CardGroupProps>;
3
+ declare const CardGroup: ({ className, children, columns }: CardGroupProps) => React.JSX.Element;
4
4
  export default CardGroup;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import * as S from './CardGroup.styles';
3
3
 
4
4
  var CardGroup = function CardGroup(_ref) {
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
1
+ import { ReactNode } from 'react';
2
2
  export interface CardGroupProps {
3
3
  className?: string;
4
- children: React.ReactNode;
4
+ children: ReactNode;
5
5
  columns: number;
6
6
  }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { CardSummaryProps } from './CardSummary.types';
3
+ export declare const CardSummary: ({ title, items, ...props }: CardSummaryProps) => React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ var _excluded = ["title", "items"],
2
+ _excluded2 = ["key"];
3
+
4
+ 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); }
5
+
6
+ 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; }
7
+
8
+ import React from 'react';
9
+ import * as S from './CardSummary.styles';
10
+ import { CardSummaryItem } from './CardSummaryItem';
11
+ export var CardSummary = function CardSummary(_ref) {
12
+ var title = _ref.title,
13
+ items = _ref.items,
14
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+
16
+ return /*#__PURE__*/React.createElement(S.CardSummaryWrapper, props, title && /*#__PURE__*/React.createElement(S.CardSummaryTitle, {
17
+ level: 5
18
+ }, title), /*#__PURE__*/React.createElement(S.CardSummaryList, null, items.map(function (_ref2) {
19
+ var key = _ref2.key,
20
+ item = _objectWithoutPropertiesLoose(_ref2, _excluded2);
21
+
22
+ return /*#__PURE__*/React.createElement(CardSummaryItem, _extends({}, item, {
23
+ key: key
24
+ }));
25
+ })));
26
+ };
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import BaseAnimateHeight from 'react-animate-height';
3
+ export declare const AnimateHeight: import("styled-components").StyledComponent<typeof BaseAnimateHeight, any, {
4
+ isOpen: boolean;
5
+ duration: number;
6
+ }, never>;
7
+ export declare const CardSummaryWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const CardSummaryTitle: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => import("react").JSX.Element, any, {}, never>;
9
+ export declare const CardSummaryList: import("styled-components").StyledComponent<"div", any, {}, never>;
10
+ export declare const CardSummaryItemWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
11
+ export declare const CardSummaryItemDetails: import("styled-components").StyledComponent<"div", any, {}, never>;
12
+ export declare const CardSummaryItemLabel: import("styled-components").StyledComponent<({ size, className, children, ellipsis }: {
13
+ size?: import("@synerise/ds-typography").TextSize | undefined;
14
+ ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps | undefined;
15
+ children?: import("react").ReactNode;
16
+ className?: string | undefined;
17
+ }) => import("react").JSX.Element, any, {}, never>;
18
+ export declare const CardSummaryItemValue: import("styled-components").StyledComponent<({ size, className, children, ellipsis }: {
19
+ size?: import("@synerise/ds-typography").TextSize | undefined;
20
+ ellipsis?: import("@synerise/ds-typography/dist/Ellipsis").EllipsisProps | undefined;
21
+ children?: import("react").ReactNode;
22
+ className?: string | undefined;
23
+ }) => import("react").JSX.Element, any, {}, never>;
24
+ export declare const Icon: import("styled-components").StyledComponent<import("react").FC<import("@synerise/ds-icon").IconProps>, any, {
25
+ isOpen: boolean;
26
+ }, never>;
27
+ export declare const CardSummaryItemObjects: import("styled-components").StyledComponent<"div", any, {}, never>;
28
+ export declare const CardSummaryItemObject: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,55 @@
1
+ import styled from 'styled-components';
2
+ import BaseAnimateHeight from 'react-animate-height';
3
+ import { Title, Text } from '@synerise/ds-typography';
4
+ import DSIcon from '@synerise/ds-icon';
5
+ import { Tag } from '@synerise/ds-tags/dist/Tag/Tag.styles';
6
+ export var AnimateHeight = styled(BaseAnimateHeight).withConfig({
7
+ displayName: "CardSummarystyles__AnimateHeight",
8
+ componentId: "sc-1yj41os-0"
9
+ })(["margin-top:", ";transition:margin ", "ms;"], function (props) {
10
+ return props.isOpen ? '0' : '-8px';
11
+ }, function (props) {
12
+ return props.duration;
13
+ });
14
+ export var CardSummaryWrapper = styled.div.withConfig({
15
+ displayName: "CardSummarystyles__CardSummaryWrapper",
16
+ componentId: "sc-1yj41os-1"
17
+ })([""]);
18
+ export var CardSummaryTitle = styled(Title).withConfig({
19
+ displayName: "CardSummarystyles__CardSummaryTitle",
20
+ componentId: "sc-1yj41os-2"
21
+ })([""]);
22
+ export var CardSummaryList = styled.div.withConfig({
23
+ displayName: "CardSummarystyles__CardSummaryList",
24
+ componentId: "sc-1yj41os-3"
25
+ })(["display:flex;flex-direction:column;gap:8px;"]);
26
+ export var CardSummaryItemWrapper = styled.div.withConfig({
27
+ displayName: "CardSummarystyles__CardSummaryItemWrapper",
28
+ componentId: "sc-1yj41os-4"
29
+ })(["display:flex;flex-direction:column;gap:8px;"]);
30
+ export var CardSummaryItemDetails = styled.div.withConfig({
31
+ displayName: "CardSummarystyles__CardSummaryItemDetails",
32
+ componentId: "sc-1yj41os-5"
33
+ })(["&:before{content:'\u2022';margin-right:8px;}display:flex;gap:4px;line-height:24px;"]);
34
+ export var CardSummaryItemLabel = styled(Text).withConfig({
35
+ displayName: "CardSummarystyles__CardSummaryItemLabel",
36
+ componentId: "sc-1yj41os-6"
37
+ })(["line-height:24px;"]);
38
+ export var CardSummaryItemValue = styled(Text).withConfig({
39
+ displayName: "CardSummarystyles__CardSummaryItemValue",
40
+ componentId: "sc-1yj41os-7"
41
+ })(["line-height:24px;font-weight:500;"]);
42
+ export var Icon = styled(DSIcon).withConfig({
43
+ displayName: "CardSummarystyles__Icon",
44
+ componentId: "sc-1yj41os-8"
45
+ })(["transform:rotate(", "deg);"], function (props) {
46
+ return props.isOpen ? '180' : '0';
47
+ });
48
+ export var CardSummaryItemObjects = styled.div.withConfig({
49
+ displayName: "CardSummarystyles__CardSummaryItemObjects",
50
+ componentId: "sc-1yj41os-9"
51
+ })(["display:flex;gap:8px;margin-left:16px;"]);
52
+ export var CardSummaryItemObject = styled.div.withConfig({
53
+ displayName: "CardSummarystyles__CardSummaryItemObject",
54
+ componentId: "sc-1yj41os-10"
55
+ })(["flex-basis:25%;min-width:0;", "{margin-left:0;}"], Tag);
@@ -0,0 +1,11 @@
1
+ import { HTMLAttributes, ReactElement, ReactNode, Key } from 'react';
2
+ export type CardSummaryItemProps = {
3
+ key: Key;
4
+ label?: ReactNode;
5
+ value: ReactNode;
6
+ summaryRowObjects?: ReactElement[];
7
+ } & HTMLAttributes<HTMLDivElement>;
8
+ export type CardSummaryProps = {
9
+ title?: ReactNode;
10
+ items: CardSummaryItemProps[];
11
+ } & HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { CardSummaryItemProps } from './CardSummary.types';
3
+ export declare const CardSummaryItem: ({ label, value, summaryRowObjects, ...rest }: CardSummaryItemProps) => React.JSX.Element;
@@ -0,0 +1,44 @@
1
+ var _excluded = ["label", "value", "summaryRowObjects"];
2
+
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
+
5
+ import React, { useState } from 'react';
6
+ import { v4 as uuid } from 'uuid';
7
+ import { AngleDownS } from '@synerise/ds-icon';
8
+ import * as S from './CardSummary.styles';
9
+ import { ANIMATION_DURATION } from '../constants';
10
+ export var CardSummaryItem = function CardSummaryItem(_ref) {
11
+ var label = _ref.label,
12
+ value = _ref.value,
13
+ summaryRowObjects = _ref.summaryRowObjects,
14
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+
16
+ var _useState = useState(false),
17
+ isOpen = _useState[0],
18
+ setIsOpen = _useState[1];
19
+
20
+ var withObjects = !!(summaryRowObjects != null && summaryRowObjects.length);
21
+
22
+ var handleClick = function handleClick() {
23
+ setIsOpen(!isOpen);
24
+ };
25
+
26
+ var icon = /*#__PURE__*/React.createElement(S.Icon, {
27
+ isOpen: isOpen,
28
+ component: /*#__PURE__*/React.createElement(AngleDownS, null),
29
+ onClick: handleClick
30
+ });
31
+ return /*#__PURE__*/React.createElement(S.CardSummaryItemWrapper, rest, /*#__PURE__*/React.createElement(S.CardSummaryItemDetails, null, label && /*#__PURE__*/React.createElement(S.CardSummaryItemLabel, {
32
+ size: "small"
33
+ }, label, ":"), /*#__PURE__*/React.createElement(S.CardSummaryItemValue, {
34
+ size: "small"
35
+ }, value, " ", withObjects && icon)), withObjects && /*#__PURE__*/React.createElement(S.AnimateHeight, {
36
+ duration: ANIMATION_DURATION,
37
+ height: isOpen ? 'auto' : 0,
38
+ isOpen: isOpen
39
+ }, /*#__PURE__*/React.createElement(S.CardSummaryItemObjects, null, summaryRowObjects == null ? void 0 : summaryRowObjects.map(function (object) {
40
+ return /*#__PURE__*/React.createElement(S.CardSummaryItemObject, {
41
+ key: object.key || uuid()
42
+ }, object);
43
+ }))));
44
+ };
@@ -0,0 +1 @@
1
+ export declare const ANIMATION_DURATION = 300;
@@ -0,0 +1 @@
1
+ export var ANIMATION_DURATION = 300;
package/dist/index.d.ts CHANGED
@@ -2,9 +2,12 @@ import * as MainCardStyles from './Card/Card.styles';
2
2
  import * as CardGroupStyles from './CardGroup/CardGroup.styles';
3
3
  import * as CardBadgeStyles from './CardBadge/CardBadge.styles';
4
4
  export { default } from './Card/Card';
5
+ export type { Backgrounds, CardProps } from './Card/Card.types';
5
6
  export { default as CardGroup } from './CardGroup/CardGroup';
7
+ export { CardGroupProps } from './CardGroup/CardGroup.types';
6
8
  export { default as CardBadge } from './CardBadge/CardBadge';
7
- export type { Backgrounds, CardProps } from './Card/Card.types';
9
+ export { CardSummary } from './CardSummary/CardSummary';
10
+ export type { CardSummaryProps } from './CardSummary/CardSummary.types';
8
11
  export declare const CardStyles: {
9
12
  Card: typeof MainCardStyles;
10
13
  CardGroup: typeof CardGroupStyles;
package/dist/index.js CHANGED
@@ -3,7 +3,9 @@ import * as CardGroupStyles from './CardGroup/CardGroup.styles';
3
3
  import * as CardBadgeStyles from './CardBadge/CardBadge.styles';
4
4
  export { default } from './Card/Card';
5
5
  export { default as CardGroup } from './CardGroup/CardGroup';
6
+ export { CardGroupProps } from './CardGroup/CardGroup.types';
6
7
  export { default as CardBadge } from './CardBadge/CardBadge';
8
+ export { CardSummary } from './CardSummary/CardSummary';
7
9
  export var CardStyles = {
8
10
  Card: MainCardStyles,
9
11
  CardGroup: CardGroupStyles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-card",
3
- "version": "0.16.19",
3
+ "version": "0.17.0",
4
4
  "description": "Card UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,20 +33,20 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-icon": "^0.62.0",
37
- "@synerise/ds-tags": "^0.8.46",
36
+ "@synerise/ds-avatar": "^0.16.4",
37
+ "@synerise/ds-icon": "^0.62.1",
38
+ "@synerise/ds-tags": "^0.9.1",
38
39
  "@synerise/ds-typography": "^0.15.0",
39
40
  "@synerise/ds-utils": "^0.27.0",
40
41
  "react-animate-height": "^2.0.23",
41
- "react-visibility-sensor": "^5.1.1"
42
+ "react-visibility-sensor": "^5.1.1",
43
+ "uuid": "^8.3.2"
42
44
  },
43
45
  "peerDependencies": {
44
46
  "@synerise/ds-core": "*",
45
47
  "antd": "4.7.0",
46
- "react": ">=16.9.0 < 17.0.0"
48
+ "react": ">=16.9.0 <= 17.0.2",
49
+ "styled-components": "5.0.1"
47
50
  },
48
- "devDependencies": {
49
- "@synerise/ds-avatar": "^0.16.2"
50
- },
51
- "gitHead": "6bd94c78745df68ee3b853120a863ab24fc233ef"
51
+ "gitHead": "ef835e848d4f02cca258130baa6c9f44dfa15dd0"
52
52
  }