@synerise/ds-card 0.15.16 → 0.16.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,17 @@
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.16.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@0.15.16...@synerise/ds-card@0.16.0) (2024-01-31)
7
+
8
+
9
+ ### Features
10
+
11
+ * **card:** add optional tag next to title ([df51722](https://github.com/Synerise/synerise-design/commit/df51722a57814174da067bfb57943432ca683d07))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.15.16](https://github.com/Synerise/synerise-design/compare/@synerise/ds-card@0.15.15...@synerise/ds-card@0.15.16) (2024-01-24)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-card
package/README.md CHANGED
@@ -91,6 +91,7 @@ yarn add @synerise/ds-card
91
91
  | style | Defines the CSS of the container | React.CSSProperties | - |
92
92
  | 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) | - |
93
93
  | title | Defines the title of the card (in the header) | string | - |
94
+ | titleTag | an optional status tag next to title | ReactElement | - |
94
95
  | withHeader | Defines if the header is shown | boolean | - |
95
96
  | withoutPadding | Reset padding of ContentContainer | boolean | `false` |
96
97
  | showSideChildrenWhenHeaderHidden | Show headerSideChildren on the bottom when header is scrolled out of view | boolean | `false` |
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { CardProps } from './Card.types';
3
- declare const Card: React.FC<CardProps>;
2
+ declare const Card: ({ children, raised, disabled, style, className, lively, withHeader, defaultHeaderBackgroundColor, title, description, compactHeader, icon, avatar, renderBadge, iconColor, headerSideChildren, onHeaderClick, withoutPadding, headerBorderBottom, background, hideContent, staticContent, titleTag, showSideChildrenWhenHeaderHidden, ...props }: CardProps) => JSX.Element;
4
3
  export default Card;
package/dist/Card/Card.js CHANGED
@@ -1,10 +1,10 @@
1
- var _excluded = ["children", "raised", "disabled", "style", "className", "lively", "withHeader", "defaultHeaderBackgroundColor", "title", "description", "compactHeader", "icon", "avatar", "renderBadge", "iconColor", "headerSideChildren", "onHeaderClick", "withoutPadding", "headerBorderBottom", "background", "hideContent", "staticContent", "showSideChildrenWhenHeaderHidden"];
1
+ var _excluded = ["children", "raised", "disabled", "style", "className", "lively", "withHeader", "defaultHeaderBackgroundColor", "title", "description", "compactHeader", "icon", "avatar", "renderBadge", "iconColor", "headerSideChildren", "onHeaderClick", "withoutPadding", "headerBorderBottom", "background", "hideContent", "staticContent", "titleTag", "showSideChildrenWhenHeaderHidden"];
2
2
 
3
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
4
 
5
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
6
 
7
- import * as React from 'react';
7
+ import React, { useState } from 'react';
8
8
  import Icon from '@synerise/ds-icon';
9
9
  import AnimateHeight from 'react-animate-height';
10
10
  import VisibilitySensor from 'react-visibility-sensor';
@@ -34,14 +34,29 @@ var Card = function Card(_ref) {
34
34
  background = _ref$background === void 0 ? 'white-shadow' : _ref$background,
35
35
  hideContent = _ref.hideContent,
36
36
  staticContent = _ref.staticContent,
37
+ titleTag = _ref.titleTag,
37
38
  showSideChildrenWhenHeaderHidden = _ref.showSideChildrenWhenHeaderHidden,
38
39
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
39
40
 
40
41
  var fatTitle = !description || description && compactHeader;
41
42
 
42
- var _React$useState = React.useState(false),
43
- headerActionsVisible = _React$useState[0],
44
- setHeaderActionsVisible = _React$useState[1];
43
+ var _useState = useState(false),
44
+ headerActionsVisible = _useState[0],
45
+ setHeaderActionsVisible = _useState[1];
46
+
47
+ var renderTitle = function renderTitle() {
48
+ if (!title && !titleTag) {
49
+ return null;
50
+ }
51
+
52
+ return /*#__PURE__*/React.createElement(S.TitleWrapper, {
53
+ compact: compactHeader,
54
+ description: Boolean(description)
55
+ }, title && /*#__PURE__*/React.createElement(S.Title, {
56
+ level: 4,
57
+ fat: !!fatTitle
58
+ }, title), titleTag && /*#__PURE__*/React.createElement(S.TitleTag, null, titleTag));
59
+ };
45
60
 
46
61
  return /*#__PURE__*/React.createElement(S.Container, _extends({
47
62
  raised: raised,
@@ -65,11 +80,7 @@ var Card = function Card(_ref) {
65
80
  })) || avatar || renderBadge && renderBadge(), /*#__PURE__*/React.createElement(S.HeaderContent, {
66
81
  compact: compactHeader,
67
82
  hasIconOrAvatar: Boolean(icon || avatar)
68
- }, title && /*#__PURE__*/React.createElement(S.Title, {
69
- description: Boolean(description),
70
- level: 4,
71
- fat: !!fatTitle
72
- }, title), description && /*#__PURE__*/React.createElement(S.Description, null, description)), headerSideChildren && /*#__PURE__*/React.createElement(VisibilitySensor, {
83
+ }, renderTitle(), description && /*#__PURE__*/React.createElement(S.Description, null, description)), headerSideChildren && /*#__PURE__*/React.createElement(VisibilitySensor, {
73
84
  partialVisibility: true,
74
85
  onChange: setHeaderActionsVisible
75
86
  }, /*#__PURE__*/React.createElement(S.HeaderSideChildren, {
@@ -18,8 +18,12 @@ export declare const Header: import("styled-components").StyledComponent<"div",
18
18
  }, never>;
19
19
  export declare const Title: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => JSX.Element, any, {
20
20
  fat: boolean;
21
+ }, never>;
22
+ export declare const TitleWrapper: import("styled-components").StyledComponent<"div", any, {
23
+ compact?: boolean | undefined;
21
24
  description?: boolean | undefined;
22
25
  }, never>;
26
+ export declare const TitleTag: import("styled-components").StyledComponent<"div", any, {}, never>;
23
27
  export declare const Description: import("styled-components").StyledComponent<"div", any, {}, never>;
24
28
  export declare const HeaderContent: import("styled-components").StyledComponent<"div", any, {
25
29
  compact?: boolean | undefined;
@@ -1,5 +1,6 @@
1
1
  import styled, { css } from 'styled-components';
2
2
  import { Title as DSTitle } from '@synerise/ds-typography';
3
+ import { Container as TagsContainer } from '@synerise/ds-tags/dist/Tags.styles';
3
4
  var whiteBg = ['white', 'white-shadow'];
4
5
  var greyBg = ['grey', 'grey-shadow'];
5
6
  var withBoxShadow = ['white-shadow', 'grey-shadow'];
@@ -58,20 +59,28 @@ export var Header = styled.div.withConfig({
58
59
  export var Title = styled(DSTitle).withConfig({
59
60
  displayName: "Cardstyles__Title",
60
61
  componentId: "sc-18exblx-4"
61
- })(["&&{display:flex;align-items:center;min-height:", ";margin:0;margin-bottom:", ";line-height:1.4;}"], function (props) {
62
+ })(["&&{display:flex;align-items:center;min-height:", ";margin:0;line-height:1.4;}"], function (props) {
62
63
  return props.fat ? '32px' : '20px';
63
- }, function (props) {
64
- return props.description ? '6px' : '0';
65
64
  });
65
+ export var TitleWrapper = styled.div.withConfig({
66
+ displayName: "Cardstyles__TitleWrapper",
67
+ componentId: "sc-18exblx-5"
68
+ })(["display:flex;flex-direction:row;gap:4px;align-items:center;margin-bottom:", ";", "{margin-bottom:0;}"], function (props) {
69
+ return props.description && !props.compact ? '6px' : '0';
70
+ }, TagsContainer);
71
+ export var TitleTag = styled.div.withConfig({
72
+ displayName: "Cardstyles__TitleTag",
73
+ componentId: "sc-18exblx-6"
74
+ })([""]);
66
75
  export var Description = styled.div.withConfig({
67
76
  displayName: "Cardstyles__Description",
68
- componentId: "sc-18exblx-5"
77
+ componentId: "sc-18exblx-7"
69
78
  })(["&&{color:", ";font-size:13px;line-height:1.38;margin:0;}"], function (props) {
70
79
  return props.theme.palette['grey-600'];
71
80
  });
72
81
  export var HeaderContent = styled.div.withConfig({
73
82
  displayName: "Cardstyles__HeaderContent",
74
- componentId: "sc-18exblx-6"
83
+ componentId: "sc-18exblx-8"
75
84
  })(["max-width:100%;flex:1;display:flex;flex-direction:", ";align-items:", ";margin:0 0 0 ", ";", ""], function (props) {
76
85
  return props.compact ? 'row' : 'column';
77
86
  }, function (props) {
@@ -87,11 +96,11 @@ export var HeaderContent = styled.div.withConfig({
87
96
  });
88
97
  export var ChildrenContainer = styled.div.withConfig({
89
98
  displayName: "Cardstyles__ChildrenContainer",
90
- componentId: "sc-18exblx-7"
99
+ componentId: "sc-18exblx-9"
91
100
  })([""]);
92
101
  export var PaddingWrapper = styled.div.withConfig({
93
102
  displayName: "Cardstyles__PaddingWrapper",
94
- componentId: "sc-18exblx-8"
103
+ componentId: "sc-18exblx-10"
95
104
  })(["padding:", ";", ""], function (props) {
96
105
  return props.withoutPadding ? '0' : "24px";
97
106
  }, function (props) {
@@ -99,7 +108,7 @@ export var PaddingWrapper = styled.div.withConfig({
99
108
  });
100
109
  export var FooterContainer = styled.div.withConfig({
101
110
  displayName: "Cardstyles__FooterContainer",
102
- componentId: "sc-18exblx-9"
111
+ componentId: "sc-18exblx-11"
103
112
  })(["padding:24px;display:flex;align-items:center;justify-content:flex-end;background:", ";border-top:solid 1px ", ";"], function (props) {
104
113
  return props.theme.palette.white;
105
114
  }, function (props) {
@@ -1,27 +1,28 @@
1
- import * as React from 'react';
1
+ import { SyntheticEvent, ReactNode, CSSProperties } from 'react';
2
2
  export type Backgrounds = 'white' | 'white-shadow' | 'grey' | 'grey-shadow' | 'outline';
3
3
  export interface CardProps {
4
4
  raised?: boolean;
5
5
  disabled?: boolean;
6
6
  className?: string;
7
7
  lively?: boolean;
8
- children?: React.ReactNode;
9
- style?: React.CSSProperties;
8
+ children?: ReactNode;
9
+ style?: CSSProperties;
10
10
  withHeader?: boolean;
11
11
  defaultHeaderBackgroundColor?: boolean;
12
12
  compactHeader?: boolean;
13
- title?: React.ReactNode;
14
- description?: React.ReactNode;
15
- icon?: React.ReactNode;
16
- renderBadge?: () => React.ReactNode;
13
+ title?: ReactNode;
14
+ description?: ReactNode;
15
+ icon?: ReactNode;
16
+ renderBadge?: () => ReactNode;
17
17
  iconColor?: string;
18
- avatar?: React.ReactNode;
19
- staticContent?: React.ReactNode;
20
- headerSideChildren?: React.ReactNode;
21
- onHeaderClick?: (e: React.SyntheticEvent) => void;
18
+ avatar?: ReactNode;
19
+ staticContent?: ReactNode;
20
+ headerSideChildren?: ReactNode;
21
+ onHeaderClick?: (e: SyntheticEvent) => void;
22
22
  withoutPadding?: boolean;
23
23
  headerBorderBottom?: boolean;
24
24
  background?: Backgrounds;
25
25
  hideContent?: boolean;
26
26
  showSideChildrenWhenHeaderHidden?: boolean;
27
+ titleTag?: ReactNode;
27
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-card",
3
- "version": "0.15.16",
3
+ "version": "0.16.0",
4
4
  "description": "Card UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,8 +34,9 @@
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
36
  "@synerise/ds-icon": "^0.60.0",
37
+ "@synerise/ds-tags": "^0.8.28",
37
38
  "@synerise/ds-typography": "^0.14.2",
38
- "@synerise/ds-utils": "^0.8.31",
39
+ "@synerise/ds-utils": "^0.24.24",
39
40
  "react-animate-height": "^2.0.23",
40
41
  "react-visibility-sensor": "^5.1.1"
41
42
  },
@@ -44,5 +45,8 @@
44
45
  "antd": "4.7.0",
45
46
  "react": ">=16.9.0 < 17.0.0"
46
47
  },
47
- "gitHead": "9e7d97fc5f8a9fd938b38e9d1678e050e0478e0e"
48
+ "devDependencies": {
49
+ "@synerise/ds-avatar": "^0.15.19"
50
+ },
51
+ "gitHead": "e5a143a9e2d157a2cbb9db7a5ef67e2f10acef84"
48
52
  }