@synerise/ds-information-card 0.8.5 → 0.9.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.9.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.8.6...@synerise/ds-information-card@0.9.0) (2025-02-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * **information-card:** title and subtitle prop types ([8180cbb](https://github.com/Synerise/synerise-design/commit/8180cbb1820a76b737e83159e32375d546c8c64d))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.8.6](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.8.5...@synerise/ds-information-card@0.8.6) (2025-02-18)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-information-card
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.8.5](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.8.4...@synerise/ds-information-card@0.8.5) (2025-02-17)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-information-card
package/README.md CHANGED
@@ -27,22 +27,28 @@ yarn workspace @synerise/ds-information-card build
27
27
  ## Usage
28
28
 
29
29
  ```js
30
- import InformationCard from '@synerise/ds-information-card';
31
- import Popover from 'antd/popover';
32
-
33
- <Popover
34
- defaultVisible={false}
35
- placement="right"
36
- content={() => <InformationCard title="Entity full name" subtitle="entity.id" />}
30
+ import { InformationCardTooltip } from '@synerise/ds-information-card';
31
+
32
+ <InformationCardTooltip
33
+ informationCardProps={{
34
+ title: 'Title',
35
+ subtitle: 'Subtitle',
36
+ icon: <SegmentM color="mars" />,
37
+ iconColor: 'mars',
38
+ avatarTooltipText: 'Tooltip Text',
39
+ }}
40
+ triggerProps={{
41
+ popupPlacement: 'top'
42
+ }}
37
43
  >
38
- Entity short name
39
- </Popover>;
44
+ <button>Element to attach infocard to</button>
45
+ </InformationCardTooltip>;
40
46
  ```
41
47
 
42
48
  Generally, components require being capable of rendering this and usually an additional effort is required to get them to support rendering.
43
49
  See text's menu item element `packages/components/menu/src/Elements/Item/Text/Text.tsx`.
44
50
 
45
- Note that `title` and `subtitle` are required props. For just a single line of text consider using just tooltip or popover.
51
+ Note that `title` and `subtitle` are required props. For just a single line of text consider using @synerise/ds-tooltip.
46
52
 
47
53
  ### Usage with dropdown and other components relying on `rc-trigger` `getPopupContainer`
48
54
 
@@ -17,10 +17,10 @@ declare const InformationCard: React.ForwardRefExoticComponent<{
17
17
  iconColor?: string | undefined;
18
18
  notice?: React.ReactNode;
19
19
  renderBadge?: Function | null | undefined;
20
- subtitle?: string | undefined;
21
- title: string;
20
+ subtitle?: React.ReactNode;
21
+ title: React.ReactNode;
22
22
  renderAdditionalDescription?: (() => React.ReactNode) | undefined;
23
23
  propertyListItems?: import(".").InformationCardPropertyItem[] | undefined;
24
24
  summaryItems?: import("./InformationCardSummary/InformationCardSummary.types").InformationCardSummaryItem[] | undefined;
25
- } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
25
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, "title" | "className" | "icon" | "actionButton" | "actionButtonCallback" | "actionButtonTooltipText" | "actionsMenu" | "asTooltip" | "avatarTooltipText" | "copyTooltip" | "copiedTooltip" | "descriptionConfig" | "renderFooter" | "footerText" | "iconColor" | "notice" | "renderBadge" | "subtitle" | "renderAdditionalDescription" | "propertyListItems" | "summaryItems"> & React.RefAttributes<HTMLDivElement>>;
26
26
  export default InformationCard;
@@ -96,8 +96,8 @@ var InformationCard = forwardRef(function (_ref, ref) {
96
96
  avatarTooltipText: avatarTooltipText
97
97
  }));
98
98
  },
99
- title: title ? copyableSlot(title) : /*#__PURE__*/React.createElement(React.Fragment, null),
100
- description: subtitle ? copyableSlot(subtitle) : /*#__PURE__*/React.createElement(React.Fragment, null),
99
+ title: typeof title === 'string' ? copyableSlot(title) : title,
100
+ description: typeof subtitle === 'string' ? copyableSlot(subtitle) : subtitle,
101
101
  headerSideChildren: undefined,
102
102
  compactHeader: false,
103
103
  withoutPadding: true,
@@ -6,7 +6,7 @@ import { DescriptionCopyable } from '@synerise/ds-description';
6
6
  import DSDivider from '@synerise/ds-divider';
7
7
  import { macro } from '@synerise/ds-typography';
8
8
  import * as S from '@synerise/ds-tooltip/dist/Tooltip.styles';
9
- var INFOCARD_WIDTH = 320;
9
+ var INFOCARD_WIDTH = 350;
10
10
  export var Flex = styled.div.withConfig({
11
11
  displayName: "InformationCardstyles__Flex",
12
12
  componentId: "zxu5qa-0"
@@ -18,7 +18,7 @@ export var Copyable = styled(DescriptionCopyable).withConfig({
18
18
  export var Divider = styled(DSDivider).withConfig({
19
19
  displayName: "InformationCardstyles__Divider",
20
20
  componentId: "zxu5qa-2"
21
- })(["border-color:", ";margin:8px 0;"], function (props) {
21
+ })(["&&{border-color:", ";margin:8px 0;}"], function (props) {
22
22
  return props.theme.palette['grey-300'];
23
23
  });
24
24
  export var FooterWrapper = styled(Flex).withConfig({
@@ -58,7 +58,7 @@ export var InfoCardSlide = styled.div.withConfig({
58
58
  export var InfoCardWrapper = styled.div.withConfig({
59
59
  displayName: "InformationCardstyles__InfoCardWrapper",
60
60
  componentId: "zxu5qa-9"
61
- })(["margin-left:", ";width:", "px;overflow:hidden;", "{width:", "px;display:flex;transition:left 0.3s;position:relative;left:", ";}", "{width:", "px;height:min-content;}overflow-wrap:anywhere;background-color:white;border-radius:3px;box-shadow:", ";", "{font-weight:400;", "}", "{padding-top:0;display:flex;flex-direction:column;gap:8px;}", "{padding:16px 16px 1px 16px;margin-bottom:16px;}", "{align-self:center;margin-left:10px;margin-right:10px;}", "{margin:0;gap:2px;}", "{margin:0;}", "", "{margin-bottom:0;font-size:14px;}.ds-button{background:transparent;}.btn-focus,.btn-focus:hover{box-shadow:unset;}"], function (props) {
61
+ })(["margin-left:", ";width:", "px;overflow:hidden;", "{width:", "px;display:flex;transition:left 0.3s;position:relative;left:", ";}", "{width:", "px;height:min-content;}overflow-wrap:anywhere;background-color:white;border-radius:3px;box-shadow:", ";", "{font-weight:400;", "}", "{padding-top:0;display:flex;flex-direction:column;gap:8px;}", "{padding:16px 16px 1px 16px;margin-bottom:16px;}", "{align-self:center;margin-left:10px;margin-right:10px;}", "{margin:0;gap:2px;}", "{margin:0;}", "", "{margin-bottom:0;font-size:14px;}", "", "{font-size:11px;}.ds-button{background:transparent;}.btn-focus,.btn-focus:hover{box-shadow:unset;}"], function (props) {
62
62
  return props.asTooltip ? '0' : '8px';
63
63
  }, INFOCARD_WIDTH, InfoCardSlidesWrapper, function (props) {
64
64
  return props.hasActionsMenu ? INFOCARD_WIDTH * 2 : INFOCARD_WIDTH;
@@ -68,7 +68,7 @@ export var InfoCardWrapper = styled.div.withConfig({
68
68
  return props.asTooltip ? 'unset' : '0 16px 32px 0 rgba(35, 41, 54, 0.1)';
69
69
  }, CardStyles.Card.Container, function (props) {
70
70
  return !props.hasFooter && css(["padding-bottom:8px;margin-bottom:1px;"]);
71
- }, CardStyles.Card.PaddingWrapper, CardStyles.Card.Header, CardStyles.Card.IconContainer, CardStyles.Card.HeaderContent, CardStyles.Card.TitleWrapper, CardStyles.Card.Title, CardStyles.Card.Title);
71
+ }, CardStyles.Card.PaddingWrapper, CardStyles.Card.Header, CardStyles.Card.IconContainer, CardStyles.Card.HeaderContent, CardStyles.Card.TitleWrapper, CardStyles.Card.Title, CardStyles.Card.Title, CardStyles.Card.Description, CardStyles.Card.Description);
72
72
  export var AlertWrapper = styled.div.withConfig({
73
73
  displayName: "InformationCardstyles__AlertWrapper",
74
74
  componentId: "zxu5qa-10"
@@ -1,4 +1,5 @@
1
- import type { HTMLAttributes, ReactNode } from 'react';
1
+ import type { ReactNode } from 'react';
2
+ import type { WithHTMLAttributes } from '@synerise/ds-utils';
2
3
  import { SubtleTextAreaProps } from '@synerise/ds-subtle-form/dist/Elements/TextArea/TextArea.types';
3
4
  import { Color, Size } from '@synerise/ds-avatar/dist/Avatar.types';
4
5
  import { IconProps } from '@synerise/ds-icon';
@@ -14,7 +15,7 @@ export type BadgeData = {
14
15
  iconSize?: Size | string;
15
16
  avatarTooltipText?: string;
16
17
  };
17
- export type InformationCardProps = {
18
+ export type InformationCardProps = WithHTMLAttributes<HTMLDivElement, {
18
19
  /**
19
20
  * custom jsx element for rendering in action button (bottom-right)
20
21
  */
@@ -79,17 +80,17 @@ export type InformationCardProps = {
79
80
  */
80
81
  renderBadge?: Function | null;
81
82
  /**
82
- * Second line. Required prop. Can be copied.
83
+ * Second line. Required prop. If you pass a string it will be copyable on click, with a copy icon visible on hover.
83
84
  */
84
- subtitle?: string;
85
+ subtitle?: ReactNode;
85
86
  /**
86
- * Title of the information-card. Can be copied.
87
+ * Title of the information-card. If you pass a string it will be copyable on click, with a copy icon visible on hover.
87
88
  */
88
- title: string;
89
+ title: ReactNode;
89
90
  /**
90
91
  * list of object parameters to display
91
92
  */
92
93
  renderAdditionalDescription?: () => ReactNode;
93
94
  propertyListItems?: InformationCardPropertyListProps['items'];
94
95
  summaryItems?: InformationCardSummaryProps['items'];
95
- } & HTMLAttributes<HTMLDivElement>;
96
+ }>;
@@ -24,6 +24,14 @@ export var InformationCardTooltip = function InformationCardTooltip(_ref) {
24
24
  return event.stopPropagation();
25
25
  };
26
26
  }, []);
27
+ var _ref2 = triggerProps || {},
28
+ popupAlign = _ref2.popupAlign;
29
+ var triggerPopupAlign = _extends({
30
+ overflow: _extends({
31
+ adjustX: true,
32
+ adjustY: true
33
+ }, popupAlign == null ? void 0 : popupAlign.overflow)
34
+ }, popupAlign);
27
35
  return (
28
36
  /*#__PURE__*/
29
37
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
@@ -41,7 +49,8 @@ export var InformationCardTooltip = function InformationCardTooltip(_ref) {
41
49
  popupStyle: {
42
50
  zIndex: zIndex
43
51
  },
44
- zIndex: zIndex
52
+ zIndex: zIndex,
53
+ popupAlign: triggerPopupAlign
45
54
  }, triggerProps), /*#__PURE__*/React.createElement(S.InformationCardTooltipTrigger, null, children)))
46
55
  );
47
56
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-information-card",
3
- "version": "0.8.5",
3
+ "version": "0.9.0",
4
4
  "description": "InformationCard UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -35,20 +35,20 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-alert": "^0.9.4",
39
- "@synerise/ds-avatar": "^0.18.4",
40
- "@synerise/ds-badge": "^0.9.3",
38
+ "@synerise/ds-alert": "^0.9.6",
39
+ "@synerise/ds-avatar": "^0.18.6",
40
+ "@synerise/ds-badge": "^0.9.4",
41
41
  "@synerise/ds-button": "^0.23.1",
42
- "@synerise/ds-card": "^0.20.4",
43
- "@synerise/ds-description": "^0.5.3",
44
- "@synerise/ds-divider": "^0.9.2",
45
- "@synerise/ds-dropdown": "^0.19.4",
42
+ "@synerise/ds-card": "^0.20.6",
43
+ "@synerise/ds-description": "^0.5.4",
44
+ "@synerise/ds-divider": "^0.9.3",
45
+ "@synerise/ds-dropdown": "^0.19.6",
46
46
  "@synerise/ds-icon": "^0.71.1",
47
- "@synerise/ds-menu": "^0.21.4",
48
- "@synerise/ds-scrollbar": "^0.12.3",
49
- "@synerise/ds-subtle-form": "^0.10.4",
50
- "@synerise/ds-tooltip": "^0.15.3",
51
- "@synerise/ds-typography": "^0.17.3",
47
+ "@synerise/ds-menu": "^0.21.6",
48
+ "@synerise/ds-scrollbar": "^0.12.4",
49
+ "@synerise/ds-subtle-form": "^0.10.6",
50
+ "@synerise/ds-tooltip": "^0.16.0",
51
+ "@synerise/ds-typography": "^0.17.4",
52
52
  "@synerise/ds-utils": "^0.32.1",
53
53
  "rc-trigger": "^5.3.4"
54
54
  },
@@ -58,5 +58,5 @@
58
58
  "react-intl": ">=3.12.0 <= 6.8",
59
59
  "styled-components": "^5.3.3"
60
60
  },
61
- "gitHead": "627d5249e79b471d6363e9d04642eb011a329d71"
61
+ "gitHead": "ff8f06f5408bac1f19bb81fdb2dc49dc650cd81e"
62
62
  }