@synerise/ds-information-card 0.8.6 → 0.9.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/CHANGELOG.md +22 -0
- package/README.md +16 -10
- package/dist/InformationCard.d.ts +3 -3
- package/dist/InformationCard.js +3 -3
- package/dist/InformationCard.styles.js +4 -4
- package/dist/InformationCard.types.d.ts +8 -7
- package/dist/InformationCardTooltip/InformationCardTooltip.js +10 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.1](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.9.0...@synerise/ds-information-card@0.9.1) (2025-02-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **information-card:** prevent rendering copy icon for empty string ([43403ec](https://github.com/Synerise/synerise-design/commit/43403ec058df73120ade0f4b0cd8b3635b9a5da6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [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)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **information-card:** title and subtitle prop types ([8180cbb](https://github.com/Synerise/synerise-design/commit/8180cbb1820a76b737e83159e32375d546c8c64d))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [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)
|
|
7
29
|
|
|
8
30
|
**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
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
39
|
-
</
|
|
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
|
|
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?:
|
|
21
|
-
title:
|
|
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;
|
package/dist/InformationCard.js
CHANGED
|
@@ -45,7 +45,7 @@ var InformationCard = forwardRef(function (_ref, ref) {
|
|
|
45
45
|
var _useResizeObserver = useResizeObserver(mainSlideRef),
|
|
46
46
|
height = _useResizeObserver.height;
|
|
47
47
|
var copyableSlot = function copyableSlot(content) {
|
|
48
|
-
return /*#__PURE__*/React.createElement(RowWrapper, {
|
|
48
|
+
return content && /*#__PURE__*/React.createElement(RowWrapper, {
|
|
49
49
|
copyable: true
|
|
50
50
|
}, /*#__PURE__*/React.createElement(S.Flex, {
|
|
51
51
|
style: {
|
|
@@ -96,8 +96,8 @@ var InformationCard = forwardRef(function (_ref, ref) {
|
|
|
96
96
|
avatarTooltipText: avatarTooltipText
|
|
97
97
|
}));
|
|
98
98
|
},
|
|
99
|
-
title: title ? copyableSlot(title) :
|
|
100
|
-
description: subtitle ? copyableSlot(subtitle) :
|
|
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 =
|
|
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 {
|
|
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.
|
|
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?:
|
|
85
|
+
subtitle?: ReactNode;
|
|
85
86
|
/**
|
|
86
|
-
* Title of the information-card.
|
|
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:
|
|
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
|
-
}
|
|
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.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "InformationCard UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -35,18 +35,18 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-alert": "^0.9.
|
|
39
|
-
"@synerise/ds-avatar": "^0.18.
|
|
38
|
+
"@synerise/ds-alert": "^0.9.6",
|
|
39
|
+
"@synerise/ds-avatar": "^0.18.6",
|
|
40
40
|
"@synerise/ds-badge": "^0.9.4",
|
|
41
41
|
"@synerise/ds-button": "^0.23.1",
|
|
42
|
-
"@synerise/ds-card": "^0.20.
|
|
42
|
+
"@synerise/ds-card": "^0.20.6",
|
|
43
43
|
"@synerise/ds-description": "^0.5.4",
|
|
44
44
|
"@synerise/ds-divider": "^0.9.3",
|
|
45
|
-
"@synerise/ds-dropdown": "^0.19.
|
|
45
|
+
"@synerise/ds-dropdown": "^0.19.6",
|
|
46
46
|
"@synerise/ds-icon": "^0.71.1",
|
|
47
|
-
"@synerise/ds-menu": "^0.21.
|
|
47
|
+
"@synerise/ds-menu": "^0.21.6",
|
|
48
48
|
"@synerise/ds-scrollbar": "^0.12.4",
|
|
49
|
-
"@synerise/ds-subtle-form": "^0.10.
|
|
49
|
+
"@synerise/ds-subtle-form": "^0.10.6",
|
|
50
50
|
"@synerise/ds-tooltip": "^0.16.0",
|
|
51
51
|
"@synerise/ds-typography": "^0.17.4",
|
|
52
52
|
"@synerise/ds-utils": "^0.32.1",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"react-intl": ">=3.12.0 <= 6.8",
|
|
59
59
|
"styled-components": "^5.3.3"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "4c0b561a53624f2bbb21360d2150d07f4019484c"
|
|
62
62
|
}
|