@synerise/ds-information-card 0.4.9 → 0.4.11

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +50 -9
  3. package/dist/InformationCard.d.ts +24 -24
  4. package/dist/InformationCard.js +63 -169
  5. package/dist/InformationCard.styles.d.ts +18 -1
  6. package/dist/InformationCard.styles.js +83 -17
  7. package/dist/InformationCard.types.d.ts +11 -2
  8. package/dist/InformationCard.utils.d.ts +12 -0
  9. package/dist/InformationCard.utils.js +50 -0
  10. package/dist/InformationCardActions/InformationCardActions.d.ts +3 -0
  11. package/dist/InformationCardActions/InformationCardActions.js +27 -0
  12. package/dist/InformationCardActions/InformationCardActions.types.d.ts +10 -0
  13. package/dist/InformationCardActions/InformationCardActions.types.js +1 -0
  14. package/dist/InformationCardDescription/InformationCardDescription.d.ts +8 -0
  15. package/dist/InformationCardDescription/InformationCardDescription.js +42 -0
  16. package/dist/InformationCardFooter/InformationCardFooter.d.ts +3 -0
  17. package/dist/InformationCardFooter/InformationCardFooter.js +42 -0
  18. package/dist/InformationCardFooter/InformationCardFooter.types.d.ts +8 -0
  19. package/dist/InformationCardFooter/InformationCardFooter.types.js +1 -0
  20. package/dist/InformationCardPropertyList/InformationCardPropertyList.d.ts +3 -0
  21. package/dist/InformationCardPropertyList/InformationCardPropertyList.js +22 -0
  22. package/dist/InformationCardPropertyList/InformationCardPropertyList.types.d.ts +11 -0
  23. package/dist/InformationCardPropertyList/InformationCardPropertyList.types.js +1 -0
  24. package/dist/InformationCardSummary/InformationCardSummary.d.ts +3 -0
  25. package/dist/InformationCardSummary/InformationCardSummary.js +20 -0
  26. package/dist/InformationCardSummary/InformationCardSummary.types.d.ts +11 -0
  27. package/dist/InformationCardSummary/InformationCardSummary.types.js +1 -0
  28. package/dist/index.d.ts +4 -1
  29. package/dist/index.js +3 -1
  30. package/package.json +16 -13
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.4.11](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.4.10...@synerise/ds-information-card@0.4.11) (2024-06-27)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-information-card
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.4.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.4.9...@synerise/ds-information-card@0.4.10) (2024-06-24)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **information-card:** updated ui and added actions and properties ([c30ed42](https://github.com/Synerise/synerise-design/commit/c30ed4203511f2c29aeea6d8bc17a6fd6170ffe5))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.4.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.4.8...@synerise/ds-information-card@0.4.9) (2024-06-21)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-information-card
package/README.md CHANGED
@@ -9,6 +9,7 @@ Information card shows details of an object or entity.
9
9
  It should be used as an additional information (details) provider when user is selecting something using menu or dropdown.
10
10
 
11
11
  ## Installation
12
+
12
13
  ```
13
14
  npm i @synerise/ds-information-card
14
15
  or
@@ -24,15 +25,18 @@ yarn workspace @synerise/ds-information-card build
24
25
  ```
25
26
 
26
27
  ## Usage
28
+
27
29
  ```js
28
- import InformationCard from '@synerise/ds-information-card'
29
- import Popover from 'antd/popover'
30
+ import InformationCard from '@synerise/ds-information-card';
31
+ import Popover from 'antd/popover';
30
32
 
31
33
  <Popover
32
- defaultVisible={false}
33
- placement="right"
34
- content={() => <InformationCard title="Entity full name" subtitle="entity.id"/>}
35
- >Entity short name</Popover>
34
+ defaultVisible={false}
35
+ placement="right"
36
+ content={() => <InformationCard title="Entity full name" subtitle="entity.id" />}
37
+ >
38
+ Entity short name
39
+ </Popover>;
36
40
  ```
37
41
 
38
42
  Generally, components require being capable of rendering this and usually an additional effort is required to get them to support rendering.
@@ -49,9 +53,11 @@ By default class is `ignore-click-outside` (so looking for `domElement.closest('
49
53
 
50
54
  <iframe src="/storybook-static/iframe.html?id=components-information-card--default"></iframe>
51
55
 
52
- ## API| Property | Description | Type | Default |
53
- |-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|---------|
54
- | actionButton | custom jsx element for rendering in action button (bottom-right) | `boolean` &#124; `(() => ReactNode)` | - |
56
+ ## API
57
+
58
+ | Property | Description | Type | Default | |
59
+ | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | ------- | --- |
60
+ | actionButton | custom jsx element for rendering in action button (bottom-right) | `boolean` &#124; `(() => ReactNode)` | - |
55
61
  | actionButtonCallback | default action button callback method | `() => void` | - |
56
62
  | actionButtonTooltipText | default action button tooltip | `string` | - |
57
63
  | asTooltip | adjusts the styles to be displayed as a tooltip | `boolean` | - |
@@ -69,3 +75,38 @@ By default class is `ignore-click-outside` (so looking for `domElement.closest('
69
75
  | renderFooter | render prop for rendering the bottom part of (by default section with a small text and an optional action button on the right) | `() => JSX.Element` | - |
70
76
  | subtitle | Second line. Required prop. Can be copied. | `string` | - |
71
77
  | title | Title of the information-card. Can be copied. | `string` | - |
78
+ | actionsMenu | Config for displaying "quick actions" - a button in footer that reveals a menu with links | `ActionsMenuProps` | - |
79
+ | propertyListItems | an array of object properties to list, can also include dividers | `InformationCardPropertyListItem[]` | - |
80
+ | summaryItems | An array of (label + icon + optional tooltip) summary items to display below properties | `InformationCardSummaryItem[]` | - |
81
+
82
+ ### ActionsMenuProps
83
+
84
+ Quick actions menu
85
+
86
+ | Property | Description | Type | Default |
87
+ | --------------- | ----------------------------------- | -------------------- | --------------- |
88
+ | items | Array of menu items. See ds-menu | `MenuItemProps[]` | - |
89
+ | menuProps | Menu props. See ds-menu | `Partial<MenuProps>` | - |
90
+ | buttonLabel | footer button label that shows menu | `ReactNode` | 'Quick actions' |
91
+ | navigationLabel | Back to content navigation label | `ReactNode` | 'Quick actions' |
92
+
93
+ ### InformationCardPropertyListItem
94
+
95
+ Displays a list of properties (label & value)
96
+
97
+ | Property | Description | Type | Default |
98
+ | -------- | -------------------------------- | ----------- | ------- |
99
+ | label | label to display in the list | `ReactNode` | - |
100
+ | value | valur to display in the list | `ReactNode` | - |
101
+ | type | Back to content navigation label | `divider` | - |
102
+
103
+ ### InformationCardSummaryItem
104
+
105
+ Displays a list of icons with value and optional tooltip
106
+
107
+ | Property | Description | Type | Default |
108
+ | ------------ | ------------------------------ | -------------- | ------- |
109
+ | icon | Icon to render | `ReactNode` | - |
110
+ | label | Label to display | `ReactNode` | - |
111
+ | tooltip | Tooltip text | `ReactNode` | - |
112
+ | tooltipProps | Tooltip config, see ds-tooltip | `TooltipProps` | - |
@@ -1,26 +1,26 @@
1
- import React, { PropsWithChildren } from 'react';
2
- import { InlineAlertType } from '@synerise/ds-alert/dist/InlineAlert/InlineAlert.types';
3
- import { InformationCardProps, BadgeData } from './InformationCard.types';
1
+ import React from 'react';
4
2
  import 'rc-trigger/assets/index.less';
5
- /**
6
- * Custom builder for badgeSlots with icon
7
- */
8
- export declare function buildIconBadge(data: BadgeData): React.JSX.Element;
9
- declare const InformationCard: React.ForwardRefExoticComponent<InformationCardProps & React.RefAttributes<HTMLDivElement>>;
10
- export declare function buildInitialsBadge(name: string): React.JSX.Element;
11
- /**
12
- * helper for wrapping a notice
13
- */
14
- export declare function buildExtraInfo(message: string, level?: InlineAlertType): React.JSX.Element;
15
- /**
16
- * Helper for returning initials. Handles cases such as John Smith, J. Smith, JS.
17
- */
18
- export declare function getInitials(name: string): string;
19
- type InitialsProps = PropsWithChildren<{
20
- name?: string;
21
- }>;
22
- /**
23
- * Wrapper for obtaining an avatar based on initials
24
- */
25
- export declare function Initials({ name, children }: InitialsProps): React.JSX.Element;
3
+ declare const InformationCard: React.ForwardRefExoticComponent<{
4
+ actionButton?: boolean | (() => React.ReactNode) | undefined;
5
+ actionButtonCallback?: (() => void) | undefined;
6
+ actionButtonTooltipText?: string | undefined;
7
+ actionsMenu?: Omit<import("./InformationCardActions/InformationCardActions.types").InformationCardActionsProps, "onHeaderClick" | "maxHeight"> | undefined;
8
+ asTooltip?: boolean | undefined;
9
+ avatarTooltipText?: string | undefined;
10
+ className?: string | undefined;
11
+ copyTooltip?: string | undefined;
12
+ copiedTooltip?: string | undefined;
13
+ descriptionConfig?: string | import("@synerise/ds-subtle-form/dist/Elements/TextArea/TextArea.types").SubtleTextAreaProps | null | undefined;
14
+ renderFooter?: (() => JSX.Element) | undefined;
15
+ footerText?: React.ReactNode;
16
+ icon?: React.ReactNode;
17
+ iconColor?: string | undefined;
18
+ notice?: React.ReactNode;
19
+ renderBadge?: Function | null | undefined;
20
+ subtitle?: string | undefined;
21
+ title: string;
22
+ renderAdditionalDescription?: (() => React.ReactNode) | undefined;
23
+ propertyListItems?: import(".").InformationCardPropertyItem[] | undefined;
24
+ summaryItems?: import("./InformationCardSummary/InformationCardSummary.types").InformationCardSummaryItem[] | undefined;
25
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
26
26
  export default InformationCard;
@@ -1,50 +1,28 @@
1
- var _excluded = ["actionButton", "actionButtonTooltipText", "actionButtonCallback", "asTooltip", "avatarTooltipText", "copyTooltip", "copiedTooltip", "renderFooter", "renderBadge", "subtitle", "title", "notice", "footerText", "icon", "iconColor", "descriptionConfig", "className", "renderAdditionalDescription"];
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; }
1
+ var _excluded = ["actionButton", "actionButtonTooltipText", "actionButtonCallback", "actionsMenu", "asTooltip", "avatarTooltipText", "copyTooltip", "copiedTooltip", "renderFooter", "renderBadge", "subtitle", "title", "notice", "footerText", "icon", "iconColor", "descriptionConfig", "className", "renderAdditionalDescription", "propertyListItems", "summaryItems"];
4
2
 
5
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); }
6
4
 
7
- import React, { forwardRef, useState } from 'react';
8
- import { Text } from '@synerise/ds-typography';
9
- import Button from '@synerise/ds-button';
10
- import Divider from '@synerise/ds-divider';
11
- import Icon, { ArrowRuCircleM, SegmentM } from '@synerise/ds-icon';
12
- import Avatar, { ObjectAvatar } from '@synerise/ds-avatar';
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
+
7
+ import React, { forwardRef, useState, useRef, useEffect } from 'react';
8
+ import { SegmentM } from '@synerise/ds-icon';
13
9
  import Card from '@synerise/ds-card';
14
- import SubtleForm from '@synerise/ds-subtle-form';
15
- import Tooltip from '@synerise/ds-tooltip';
10
+ import { useResizeObserver } from '@synerise/ds-utils';
16
11
  import Copy from '@synerise/ds-description/dist/Row/Copy';
17
12
  import { RowWrapper } from '@synerise/ds-description/dist/Row/DescriptionRow.styles';
18
- import Badge from '@synerise/ds-badge';
19
- import Alert from '@synerise/ds-alert';
20
- import * as S from './InformationCard.styles';
21
13
  import "rc-trigger/assets/index.css";
22
- /**
23
- * Custom builder for badgeSlots with icon
24
- */
25
-
26
- export function buildIconBadge(data) {
27
- var avatarExtra = {
28
- object: {}
29
- };
30
-
31
- if (data.avatarTooltipText) {
32
- avatarExtra.object = {
33
- description: data.avatarTooltipText
34
- };
35
- }
36
-
37
- return /*#__PURE__*/React.createElement(ObjectAvatar, _extends({}, avatarExtra, {
38
- color: data.iconColor,
39
- iconComponent: /*#__PURE__*/React.createElement(Icon, {
40
- component: data.iconElement
41
- })
42
- }));
43
- }
14
+ import * as S from './InformationCard.styles';
15
+ import { InformationCardFooter } from './InformationCardFooter/InformationCardFooter';
16
+ import { buildIconBadge } from './InformationCard.utils';
17
+ import { InformationCardActions } from './InformationCardActions/InformationCardActions';
18
+ import { InformationCardDescription } from './InformationCardDescription/InformationCardDescription';
19
+ import { InformationCardPropertyList } from './InformationCardPropertyList/InformationCardPropertyList';
20
+ import { InformationCardSummary } from './InformationCardSummary/InformationCardSummary';
44
21
  var InformationCard = forwardRef(function (_ref, ref) {
45
22
  var actionButton = _ref.actionButton,
46
23
  actionButtonTooltipText = _ref.actionButtonTooltipText,
47
24
  actionButtonCallback = _ref.actionButtonCallback,
25
+ actionsMenu = _ref.actionsMenu,
48
26
  asTooltip = _ref.asTooltip,
49
27
  avatarTooltipText = _ref.avatarTooltipText,
50
28
  copyTooltip = _ref.copyTooltip,
@@ -61,8 +39,19 @@ var InformationCard = forwardRef(function (_ref, ref) {
61
39
  descriptionConfig = _ref.descriptionConfig,
62
40
  className = _ref.className,
63
41
  renderAdditionalDescription = _ref.renderAdditionalDescription,
42
+ propertyListItems = _ref.propertyListItems,
43
+ summaryItems = _ref.summaryItems,
64
44
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
65
45
 
46
+ var _useState = useState(false),
47
+ isActionsMenuVisible = _useState[0],
48
+ setIsActionsMenuVisible = _useState[1];
49
+
50
+ var mainSlideRef = useRef(null);
51
+
52
+ var _useResizeObserver = useResizeObserver(mainSlideRef),
53
+ height = _useResizeObserver.height;
54
+
66
55
  var copyableSlot = function copyableSlot(content) {
67
56
  return /*#__PURE__*/React.createElement(RowWrapper, {
68
57
  copyable: true
@@ -81,15 +70,29 @@ var InformationCard = forwardRef(function (_ref, ref) {
81
70
  })));
82
71
  };
83
72
 
84
- return /*#__PURE__*/React.createElement(S.InfoCardWrapper, {
73
+ var hasFooter = !!(footerText || actionButton || actionsMenu); // eslint-disable-next-line react-hooks/exhaustive-deps
74
+
75
+ useEffect(function () {
76
+ var _mainSlideRef$current;
77
+
78
+ if (!((_mainSlideRef$current = mainSlideRef.current) != null && _mainSlideRef$current.clientWidth)) {
79
+ setIsActionsMenuVisible(false);
80
+ }
81
+ });
82
+ return /*#__PURE__*/React.createElement(S.InfoCardWrapper, _extends({
85
83
  "data-testid": "information-card",
84
+ "data-popup-container": true,
86
85
  ref: ref,
87
86
  "aria-label": "information card",
88
87
  className: "ds-info-card " + className,
89
- asTooltip: asTooltip
88
+ asTooltip: asTooltip,
89
+ isActionsMenuVisible: isActionsMenuVisible,
90
+ hasActionsMenu: !!actionsMenu,
91
+ hasFooter: !!(renderFooter || hasFooter)
92
+ }, props), /*#__PURE__*/React.createElement(S.InfoCardSlidesWrapper, null, /*#__PURE__*/React.createElement(S.InfoCardSlide, {
93
+ ref: mainSlideRef
90
94
  }, /*#__PURE__*/React.createElement(Card, {
91
- background: "white" // @ts-ignore
92
- ,
95
+ background: "white",
93
96
  renderBadge: function renderBadge() {
94
97
  var _renderBadge;
95
98
 
@@ -110,138 +113,29 @@ var InformationCard = forwardRef(function (_ref, ref) {
110
113
  withoutPadding: true,
111
114
  lively: false,
112
115
  withHeader: true
113
- }, (descriptionConfig !== null || notice) && /*#__PURE__*/React.createElement(DescriptionField, {
116
+ }, (descriptionConfig !== null || notice) && /*#__PURE__*/React.createElement(InformationCardDescription, {
114
117
  extraInformation: notice || /*#__PURE__*/React.createElement(React.Fragment, null),
115
118
  descriptionConfig: descriptionConfig
116
- }), renderAdditionalDescription && renderAdditionalDescription(), renderFooter && renderFooter() || (footerText || actionButton) && /*#__PURE__*/React.createElement(Footer, _extends({
117
- text: footerText
118
- }, props, {
119
+ }), renderAdditionalDescription && renderAdditionalDescription(), propertyListItems && /*#__PURE__*/React.createElement(InformationCardPropertyList, {
120
+ items: propertyListItems
121
+ }), summaryItems && /*#__PURE__*/React.createElement(InformationCardSummary, {
122
+ items: summaryItems
123
+ }), renderFooter && renderFooter() || hasFooter && /*#__PURE__*/React.createElement(InformationCardFooter, {
124
+ text: footerText,
119
125
  actionButton: actionButton,
120
126
  actionButtonCallback: actionButtonCallback,
121
- actionButtonTooltipText: actionButtonTooltipText
122
- }))));
123
- });
124
- export function buildInitialsBadge(name) {
125
- return /*#__PURE__*/React.createElement(Initials, {
126
- name: name
127
- });
128
- }
129
- /**
130
- * helper for wrapping a notice
131
- */
132
-
133
- export function buildExtraInfo(message, level) {
134
- return /*#__PURE__*/React.createElement(S.ExtraInfo, null, /*#__PURE__*/React.createElement(Alert.InlineAlert, {
135
- type: level || 'warning',
136
- message: message
137
- }));
138
- }
139
- /**
140
- * Helper for returning initials. Handles cases such as John Smith, J. Smith, JS.
141
- */
142
-
143
- export function getInitials(name) {
144
- var hasTokens = name.indexOf(' ') !== -1;
145
- return name.substring(0, hasTokens ? 1 : 2) + (hasTokens ? name.charAt(name.lastIndexOf(' ') + 1) : '');
146
- }
147
-
148
- /**
149
- * Wrapper for obtaining an avatar based on initials
150
- */
151
- export function Initials(_ref2) {
152
- var name = _ref2.name,
153
- children = _ref2.children;
154
- return /*#__PURE__*/React.createElement(Badge, null, /*#__PURE__*/React.createElement(Avatar, {
155
- size: "medium",
156
- shape: "circle",
157
- backgroundColor: "blue"
158
- }, name && getInitials(name) || children));
159
- }
160
-
161
- /**
162
- * Returns default information card's description section.
163
- */
164
- function DescriptionField(_ref3) {
165
- var _ref3$extraInformatio = _ref3.extraInformation,
166
- extraInformation = _ref3$extraInformatio === void 0 ? undefined : _ref3$extraInformatio,
167
- descriptionConfig = _ref3.descriptionConfig;
168
-
169
- // note: if popover containing this information card will have
170
- // `destroyTooltipOnHide` (or `keepParent`) set to false, then description state hook will be getting reset
171
- var _useState = useState(''),
172
- description = _useState[0],
173
- setDescription = _useState[1];
174
-
175
- var renderDescription = function renderDescription() {
176
- if (descriptionConfig) {
177
- return typeof descriptionConfig === 'string' ? /*#__PURE__*/React.createElement(S.NonEditableWrapper, null, descriptionConfig) : /*#__PURE__*/React.createElement(SubtleForm.TextArea, _extends({
178
- minRows: 1,
179
- value: description,
180
- onChange: function onChange(value) {
181
- descriptionConfig.onChange && descriptionConfig.onChange(value);
182
- setDescription(value);
183
- },
184
- placeholder: "placeholder",
185
- suffixTooltip: "Edit"
186
- }, descriptionConfig, descriptionConfig.error ? {
187
- error: descriptionConfig.error,
188
- errorText: function errorText(isErr, text) {
189
- return isErr ? text : '';
190
- }
191
- } : {}, {
192
- disabled: descriptionConfig.disabled
193
- }));
194
- }
195
-
196
- return /*#__PURE__*/React.createElement(React.Fragment, null);
197
- };
198
-
199
- return /*#__PURE__*/React.createElement(S.DescriptionWrapper, {
200
- "data-testid": "information-card-description"
201
- }, /*#__PURE__*/React.createElement(S.AlertWrapper, null, extraInformation), descriptionConfig && renderDescription());
202
- }
203
- /**
204
- * Tooltip helper for action button in footer
205
- */
206
-
207
-
208
- function withTooltip(Component, actionButtonTooltipText, props) {
209
- // type is related to ds-tooltip's: shouldRenderDescription (it makes use of description prop only if tooltip type!=='default')
210
- return /*#__PURE__*/React.createElement(Tooltip, _extends({
211
- type: 'default',
212
- title: actionButtonTooltipText
213
- }, props), Component);
214
- }
215
- /**
216
- * Renders footer part including handling action button with an optional tooltip
217
- */
218
-
219
-
220
- function Footer(_ref4) {
221
- var _ref4$actionButton = _ref4.actionButton,
222
- actionButton = _ref4$actionButton === void 0 ? false : _ref4$actionButton,
223
- actionButtonCallback = _ref4.actionButtonCallback,
224
- _ref4$actionButtonToo = _ref4.actionButtonTooltipText,
225
- actionButtonTooltipText = _ref4$actionButtonToo === void 0 ? '' : _ref4$actionButtonToo,
226
- _ref4$text = _ref4.text,
227
- text = _ref4$text === void 0 ? '' : _ref4$text;
228
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
229
- marginTop: 8,
230
- marginBottom: 0,
231
- dashed: true
232
- }), /*#__PURE__*/React.createElement(S.Flex, {
233
- "data-testid": "information-card-footer",
234
- style: {
235
- alignItems: 'center'
127
+ actionButtonTooltipText: actionButtonTooltipText,
128
+ actionsMenuButtonLabel: actionsMenu == null ? void 0 : actionsMenu.buttonLabel,
129
+ actionsMenuButtonOnClick: actionsMenu ? function () {
130
+ return setIsActionsMenuVisible(true);
131
+ } : undefined
132
+ }))), actionsMenu && /*#__PURE__*/React.createElement(S.InfoCardSlide, {
133
+ height: height
134
+ }, /*#__PURE__*/React.createElement(InformationCardActions, _extends({}, actionsMenu, {
135
+ maxHeight: height,
136
+ onHeaderClick: function onHeaderClick() {
137
+ return setIsActionsMenuVisible(false);
236
138
  }
237
- }, /*#__PURE__*/React.createElement(S.FlexGrow, null, text && /*#__PURE__*/React.createElement(Text, {
238
- size: "xsmall"
239
- }, text)), /*#__PURE__*/React.createElement(S.ActionButtonContainer, null, actionButton && actionButton === true && withTooltip( /*#__PURE__*/React.createElement(Button, {
240
- color: "grey",
241
- type: "secondary",
242
- mode: "single-icon",
243
- onClick: actionButtonCallback
244
- }, /*#__PURE__*/React.createElement(ArrowRuCircleM, null)), actionButtonTooltipText) || typeof actionButton === 'function' && actionButton())));
245
- }
246
-
139
+ })))));
140
+ });
247
141
  export default InformationCard;
@@ -1,12 +1,22 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Flex: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- export declare const FlexGrow: import("styled-components").StyledComponent<"div", any, import("react").DetailedHTMLFactory<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
3
+ export declare const Divider: import("styled-components").StyledComponent<({ marginBottom, marginTop, style, labelAbove, labelBelow, ...antdDividerProps }: import("@synerise/ds-divider").DividerProps) => import("react").JSX.Element, any, {}, never>;
4
+ export declare const FooterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const ActionsMenuItems: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const FlexGrow: import("styled-components").StyledComponent<"div", any, {
4
7
  grow?: number | undefined;
5
8
  }, never>;
6
9
  export declare const ActionButtonContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
10
+ export declare const InfoCardSlidesWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
11
+ export declare const InfoCardSlide: import("styled-components").StyledComponent<"div", any, {
12
+ height?: number | undefined;
13
+ }, never>;
7
14
  export declare const InfoCardWrapper: import("styled-components").StyledComponent<"div", any, {
8
15
  footerText?: string | undefined;
9
16
  asTooltip?: boolean | undefined;
17
+ hasActionsMenu?: boolean | undefined;
18
+ isActionsMenuVisible?: boolean | undefined;
19
+ hasFooter?: boolean | undefined;
10
20
  }, never>;
11
21
  export declare const AlertWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
12
22
  export declare const NonEditableWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -23,3 +33,10 @@ export declare const ExtraInfo: import("styled-components").StyledComponent<"div
23
33
  export declare const TooltipComponentClassName: import("styled-components").StyledComponent<"div", any, Omit<import("@synerise/ds-tooltip/dist/Tooltip.types").default, "type"> & {
24
34
  tooltipType: import("@synerise/ds-tooltip").tooltipTypes;
25
35
  }, never>;
36
+ export declare const InformationCardActionsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
37
+ export declare const InformationCardPropertyListWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
38
+ export declare const InformationCardPropertyItem: import("styled-components").StyledComponent<"div", any, {}, never>;
39
+ export declare const InformationCardPropertyItemLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
40
+ export declare const InformationCardPropertyItemValue: import("styled-components").StyledComponent<"span", any, {}, never>;
41
+ export declare const InformationCardSummaryWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
42
+ export declare const InformationCardSummaryItem: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -2,53 +2,89 @@ var _templateObject;
2
2
 
3
3
  function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
4
4
 
5
- import styled, { createGlobalStyle } from 'styled-components';
5
+ import styled, { createGlobalStyle, css } from 'styled-components';
6
6
  import { CardStyles } from '@synerise/ds-card';
7
+ import DSDivider from '@synerise/ds-divider';
8
+ import { macro } from '@synerise/ds-typography';
7
9
  import * as S from '@synerise/ds-tooltip/dist/Tooltip.styles';
8
- import { ButtonStyles } from '@synerise/ds-button';
10
+ var INFOCARD_WIDTH = 320;
9
11
  export var Flex = styled.div.withConfig({
10
12
  displayName: "InformationCardstyles__Flex",
11
13
  componentId: "zxu5qa-0"
12
14
  })(["display:flex;"]);
15
+ export var Divider = styled(DSDivider).withConfig({
16
+ displayName: "InformationCardstyles__Divider",
17
+ componentId: "zxu5qa-1"
18
+ })(["border-color:", ";margin:8px 0;"], function (props) {
19
+ return props.theme.palette['grey-300'];
20
+ });
21
+ export var FooterWrapper = styled(Flex).withConfig({
22
+ displayName: "InformationCardstyles__FooterWrapper",
23
+ componentId: "zxu5qa-2"
24
+ })(["background:", ";border-top:solid 1px ", ";padding:8px;"], function (props) {
25
+ return props.theme.palette['grey-050'];
26
+ }, function (props) {
27
+ return props.theme.palette['grey-100'];
28
+ });
29
+ export var ActionsMenuItems = styled.div.withConfig({
30
+ displayName: "InformationCardstyles__ActionsMenuItems",
31
+ componentId: "zxu5qa-3"
32
+ })([""]);
13
33
  export var FlexGrow = styled.div.withConfig({
14
34
  displayName: "InformationCardstyles__FlexGrow",
15
- componentId: "zxu5qa-1"
16
- })(["flex-grow:", ";margin-top:16px;margin-bottom:8px;"], function (_ref) {
35
+ componentId: "zxu5qa-4"
36
+ })(["flex-grow:", ";"], function (_ref) {
17
37
  var _ref$grow = _ref.grow,
18
38
  grow = _ref$grow === void 0 ? 1 : _ref$grow;
19
39
  return grow;
20
40
  });
21
41
  export var ActionButtonContainer = styled.div.withConfig({
22
42
  displayName: "InformationCardstyles__ActionButtonContainer",
23
- componentId: "zxu5qa-2"
24
- })(["margin:8px 0 8px 0;"]);
43
+ componentId: "zxu5qa-5"
44
+ })([""]);
45
+ export var InfoCardSlidesWrapper = styled.div.withConfig({
46
+ displayName: "InformationCardstyles__InfoCardSlidesWrapper",
47
+ componentId: "zxu5qa-6"
48
+ })([""]);
49
+ export var InfoCardSlide = styled.div.withConfig({
50
+ displayName: "InformationCardstyles__InfoCardSlide",
51
+ componentId: "zxu5qa-7"
52
+ })(["", ""], function (props) {
53
+ return props.height && "max-height: " + props.height + "px;";
54
+ });
25
55
  export var InfoCardWrapper = styled.div.withConfig({
26
56
  displayName: "InformationCardstyles__InfoCardWrapper",
27
- componentId: "zxu5qa-3"
28
- })(["margin-left:", ";width:294px;overflow-wrap:anywhere;", "{background-color:white;margin-bottom:1px;font-weight:400;padding:16px 16px 8px 16px;border-radius:3px;box-shadow:", ";}", "{padding-top:0;}", "{padding:0 0 1px 0;margin-bottom:8px;}", "{align-self:center;margin-left:10px;margin-right:10px;}", "{margin:0;}", "", "{margin-bottom:0;font-size:14px;}", "{width:32px;height:32px;}.ds-button{background:transparent;}.btn-focus,.btn-focus:hover{box-shadow:unset;}"], function (props) {
57
+ componentId: "zxu5qa-8"
58
+ })(["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;}", "{margin:0;height:20px;}", "{height:16px;}", "", "{margin-bottom:0;font-size:14px;}.ds-button{background:transparent;}.btn-focus,.btn-focus:hover{box-shadow:unset;}"], function (props) {
29
59
  return props.asTooltip ? '0' : '8px';
30
- }, CardStyles.Card.Container, function (props) {
60
+ }, INFOCARD_WIDTH, InfoCardSlidesWrapper, function (props) {
61
+ return props.hasActionsMenu ? INFOCARD_WIDTH * 2 : INFOCARD_WIDTH;
62
+ }, function (props) {
63
+ return props.isActionsMenuVisible ? "-" + INFOCARD_WIDTH + "px" : '0';
64
+ }, InfoCardSlide, INFOCARD_WIDTH, function (props) {
31
65
  return props.asTooltip ? 'unset' : '0 16px 32px 0 rgba(35, 41, 54, 0.1)';
32
- }, CardStyles.Card.PaddingWrapper, CardStyles.Card.Header, CardStyles.Card.IconContainer, CardStyles.Card.HeaderContent, CardStyles.Card.Title, CardStyles.Card.Title, ButtonStyles.Button.AntdButton);
66
+ }, CardStyles.Card.Container, function (props) {
67
+ return !props.hasFooter && css(["padding-bottom:8px;margin-bottom:1px;"]);
68
+ }, CardStyles.Card.PaddingWrapper, CardStyles.Card.Header, CardStyles.Card.IconContainer, CardStyles.Card.HeaderContent, CardStyles.Card.TitleWrapper, CardStyles.Card.Description, CardStyles.Card.Title, CardStyles.Card.Title);
33
69
  export var AlertWrapper = styled.div.withConfig({
34
70
  displayName: "InformationCardstyles__AlertWrapper",
35
- componentId: "zxu5qa-4"
71
+ componentId: "zxu5qa-9"
36
72
  })(["padding-bottom:8px;:empty{display:none;}"]);
37
73
  export var NonEditableWrapper = styled.div.withConfig({
38
74
  displayName: "InformationCardstyles__NonEditableWrapper",
39
- componentId: "zxu5qa-5"
75
+ componentId: "zxu5qa-10"
40
76
  })(["padding-bottom:8px;:empty{display:none;}"]);
41
77
  export var DescriptionWrapper = styled.div.withConfig({
42
78
  displayName: "InformationCardstyles__DescriptionWrapper",
43
- componentId: "zxu5qa-6"
44
- })([""]);
79
+ componentId: "zxu5qa-11"
80
+ })(["padding:0 16px;"]);
45
81
  /**
46
82
  * This component can be used to style container with popovers/tooltips to disable arrow.
47
83
  */
48
84
 
49
85
  export var HidePopoverArrowWrapper = styled.div.withConfig({
50
86
  displayName: "InformationCardstyles__HidePopoverArrowWrapper",
51
- componentId: "zxu5qa-7"
87
+ componentId: "zxu5qa-12"
52
88
  })([".ant-popover-arrow-content,.ant-tooltip-arrow-content{display:none;}"]);
53
89
  /**
54
90
  * Should be mounted in application where.
@@ -57,6 +93,36 @@ export var HidePopoverArrowWrapper = styled.div.withConfig({
57
93
  export var GlobalCSSHidePopoverArrow = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n .ant-popover-arrow-content,.ant-tooltip-arrow-content {\n display: none;\n}"])));
58
94
  export var ExtraInfo = styled.div.withConfig({
59
95
  displayName: "InformationCardstyles__ExtraInfo",
60
- componentId: "zxu5qa-8"
96
+ componentId: "zxu5qa-13"
61
97
  })(["margin-bottom:1px;"]);
62
- export var TooltipComponentClassName = S.TooltipComponent;
98
+ export var TooltipComponentClassName = S.TooltipComponent;
99
+ export var InformationCardActionsWrapper = styled.div.withConfig({
100
+ displayName: "InformationCardstyles__InformationCardActionsWrapper",
101
+ componentId: "zxu5qa-14"
102
+ })(["padding:8px;"]);
103
+ export var InformationCardPropertyListWrapper = styled.div.withConfig({
104
+ displayName: "InformationCardstyles__InformationCardPropertyListWrapper",
105
+ componentId: "zxu5qa-15"
106
+ })(["display:flex;flex-direction:column;padding:0 16px 8px;"]);
107
+ export var InformationCardPropertyItem = styled.div.withConfig({
108
+ displayName: "InformationCardstyles__InformationCardPropertyItem",
109
+ componentId: "zxu5qa-16"
110
+ })(["display:flex;align-items:center;height:24px;gap:8px;"]);
111
+ export var InformationCardPropertyItemLabel = styled.span.withConfig({
112
+ displayName: "InformationCardstyles__InformationCardPropertyItemLabel",
113
+ componentId: "zxu5qa-17"
114
+ })(["", ""], macro.small);
115
+ export var InformationCardPropertyItemValue = styled.span.withConfig({
116
+ displayName: "InformationCardstyles__InformationCardPropertyItemValue",
117
+ componentId: "zxu5qa-18"
118
+ })(["", " font-weight:500;"], macro.small);
119
+ export var InformationCardSummaryWrapper = styled(Flex).withConfig({
120
+ displayName: "InformationCardstyles__InformationCardSummaryWrapper",
121
+ componentId: "zxu5qa-19"
122
+ })(["margin:0 16px;border-top:dashed 1px ", ";padding-top:16px;padding-bottom:8px;gap:4px;flex-wrap:wrap;"], function (props) {
123
+ return props.theme.palette['grey-300'];
124
+ });
125
+ export var InformationCardSummaryItem = styled(Flex).withConfig({
126
+ displayName: "InformationCardstyles__InformationCardSummaryItem",
127
+ componentId: "zxu5qa-20"
128
+ })(["font-weight:500;align-items:center;gap:4px;"]);
@@ -1,7 +1,10 @@
1
- import type { ReactNode } from 'react';
1
+ import type { HTMLAttributes, ReactNode } from 'react';
2
2
  import { SubtleTextAreaProps } from '@synerise/ds-subtle-form/dist/Elements/TextArea/TextArea.types';
3
3
  import { Color, Size } from '@synerise/ds-avatar/dist/Avatar.types';
4
4
  import { IconProps } from '@synerise/ds-icon';
5
+ import { InformationCardPropertyListProps } from './InformationCardPropertyList/InformationCardPropertyList.types';
6
+ import { InformationCardActionsProps } from './InformationCardActions/InformationCardActions.types';
7
+ import { InformationCardSummaryProps } from './InformationCardSummary/InformationCardSummary.types';
5
8
  export type BadgeData = {
6
9
  type?: string;
7
10
  title?: string;
@@ -24,6 +27,10 @@ export type InformationCardProps = {
24
27
  * default action button tooltip
25
28
  */
26
29
  actionButtonTooltipText?: string;
30
+ /**
31
+ * renders "Quick actions" button in footer that slides main content to reveal actionsMenu.items (menu)
32
+ */
33
+ actionsMenu?: Omit<InformationCardActionsProps, 'onHeaderClick' | 'maxHeight'>;
27
34
  /**
28
35
  * adjusts the styles to be displayed as a tooltip
29
36
  */
@@ -83,4 +90,6 @@ export type InformationCardProps = {
83
90
  * list of object parameters to display
84
91
  */
85
92
  renderAdditionalDescription?: () => ReactNode;
86
- };
93
+ propertyListItems?: InformationCardPropertyListProps['items'];
94
+ summaryItems?: InformationCardSummaryProps['items'];
95
+ } & HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1,12 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ import { InlineAlertType } from '@synerise/ds-alert/dist/InlineAlert/InlineAlert.types';
3
+ import { BadgeData } from './InformationCard.types';
4
+ export declare function buildInitialsBadge(name: string): React.JSX.Element;
5
+ export declare function buildExtraInfo(message: string, level?: InlineAlertType): React.JSX.Element;
6
+ export declare function getInitials(name: string): string;
7
+ type InitialsProps = PropsWithChildren<{
8
+ name?: string;
9
+ }>;
10
+ export declare function Initials({ name, children }: InitialsProps): React.JSX.Element;
11
+ export declare function buildIconBadge(data: BadgeData): React.JSX.Element;
12
+ export {};
@@ -0,0 +1,50 @@
1
+ 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); }
2
+
3
+ import React from 'react';
4
+ import Alert from '@synerise/ds-alert';
5
+ import Avatar, { ObjectAvatar } from '@synerise/ds-avatar';
6
+ import Badge from '@synerise/ds-badge';
7
+ import Icon from '@synerise/ds-icon';
8
+ import * as S from './InformationCard.styles';
9
+ export function buildInitialsBadge(name) {
10
+ return /*#__PURE__*/React.createElement(Initials, {
11
+ name: name
12
+ });
13
+ }
14
+ export function buildExtraInfo(message, level) {
15
+ return /*#__PURE__*/React.createElement(S.ExtraInfo, null, /*#__PURE__*/React.createElement(Alert.InlineAlert, {
16
+ type: level || 'warning',
17
+ message: message
18
+ }));
19
+ }
20
+ export function getInitials(name) {
21
+ var hasTokens = name.indexOf(' ') !== -1;
22
+ return name.substring(0, hasTokens ? 1 : 2) + (hasTokens ? name.charAt(name.lastIndexOf(' ') + 1) : '');
23
+ }
24
+ export function Initials(_ref) {
25
+ var name = _ref.name,
26
+ children = _ref.children;
27
+ return /*#__PURE__*/React.createElement(Badge, null, /*#__PURE__*/React.createElement(Avatar, {
28
+ size: "medium",
29
+ shape: "circle",
30
+ backgroundColor: "blue"
31
+ }, name && getInitials(name) || children));
32
+ }
33
+ export function buildIconBadge(data) {
34
+ var avatarExtra = {
35
+ object: {}
36
+ };
37
+
38
+ if (data.avatarTooltipText) {
39
+ avatarExtra.object = {
40
+ description: data.avatarTooltipText
41
+ };
42
+ }
43
+
44
+ return /*#__PURE__*/React.createElement(ObjectAvatar, _extends({}, avatarExtra, {
45
+ color: data.iconColor,
46
+ iconComponent: /*#__PURE__*/React.createElement(Icon, {
47
+ component: data.iconElement
48
+ })
49
+ }));
50
+ }
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { InformationCardActionsProps } from './InformationCardActions.types';
3
+ export declare const InformationCardActions: ({ onHeaderClick, navigationLabel, items, menuProps, maxHeight, }: InformationCardActionsProps) => React.JSX.Element;
@@ -0,0 +1,27 @@
1
+ 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); }
2
+
3
+ import React from 'react';
4
+ import { FormattedMessage } from 'react-intl';
5
+ import Dropdown from '@synerise/ds-dropdown';
6
+ import Menu from '@synerise/ds-menu';
7
+ import Scrollbar from '@synerise/ds-scrollbar';
8
+ import * as S from '../InformationCard.styles';
9
+ var NAV_HEIGHT = 61;
10
+ export var InformationCardActions = function InformationCardActions(_ref) {
11
+ var onHeaderClick = _ref.onHeaderClick,
12
+ navigationLabel = _ref.navigationLabel,
13
+ items = _ref.items,
14
+ menuProps = _ref.menuProps,
15
+ maxHeight = _ref.maxHeight;
16
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown.BackAction, {
17
+ label: navigationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
18
+ id: "DS.INFORMATION-CARD.QUICK-ACTIONS",
19
+ defaultMessage: "Quick actions"
20
+ }),
21
+ onClick: onHeaderClick
22
+ }), /*#__PURE__*/React.createElement(S.InformationCardActionsWrapper, null, /*#__PURE__*/React.createElement(Scrollbar, {
23
+ maxHeight: maxHeight ? maxHeight - NAV_HEIGHT : undefined
24
+ }, /*#__PURE__*/React.createElement(Menu, _extends({}, menuProps, {
25
+ dataSource: items
26
+ })))));
27
+ };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ import { MenuItemProps, AntdMenuProps } from '@synerise/ds-menu';
3
+ export type InformationCardActionsProps = {
4
+ items: MenuItemProps[];
5
+ menuProps?: Partial<AntdMenuProps>;
6
+ buttonLabel?: ReactNode;
7
+ navigationLabel?: ReactNode;
8
+ onHeaderClick: () => void;
9
+ maxHeight?: number;
10
+ };
@@ -0,0 +1,8 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { SubtleTextAreaProps } from '@synerise/ds-subtle-form/dist/Elements/TextArea/TextArea.types';
3
+ type InformationCardDescriptionProps = {
4
+ extraInformation?: ReactNode;
5
+ descriptionConfig?: SubtleTextAreaProps | string | null;
6
+ };
7
+ export declare const InformationCardDescription: ({ extraInformation, descriptionConfig, }: InformationCardDescriptionProps) => React.JSX.Element;
8
+ export {};
@@ -0,0 +1,42 @@
1
+ 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); }
2
+
3
+ import React, { useState } from 'react';
4
+ import SubtleForm from '@synerise/ds-subtle-form';
5
+ import * as S from '../InformationCard.styles';
6
+ export var InformationCardDescription = function InformationCardDescription(_ref) {
7
+ var _ref$extraInformation = _ref.extraInformation,
8
+ extraInformation = _ref$extraInformation === void 0 ? undefined : _ref$extraInformation,
9
+ descriptionConfig = _ref.descriptionConfig;
10
+
11
+ var _useState = useState(''),
12
+ description = _useState[0],
13
+ setDescription = _useState[1];
14
+
15
+ var renderDescription = function renderDescription() {
16
+ if (descriptionConfig) {
17
+ return typeof descriptionConfig === 'string' ? /*#__PURE__*/React.createElement(S.NonEditableWrapper, null, descriptionConfig) : /*#__PURE__*/React.createElement(SubtleForm.TextArea, _extends({
18
+ minRows: 1,
19
+ value: description,
20
+ onChange: function onChange(value) {
21
+ descriptionConfig.onChange && descriptionConfig.onChange(value);
22
+ setDescription(value);
23
+ },
24
+ placeholder: "placeholder",
25
+ suffixTooltip: "Edit"
26
+ }, descriptionConfig, descriptionConfig.error ? {
27
+ error: descriptionConfig.error,
28
+ errorText: function errorText(isError, text) {
29
+ return isError ? text : '';
30
+ }
31
+ } : {}, {
32
+ disabled: descriptionConfig.disabled
33
+ }));
34
+ }
35
+
36
+ return /*#__PURE__*/React.createElement(React.Fragment, null);
37
+ };
38
+
39
+ return /*#__PURE__*/React.createElement(S.DescriptionWrapper, {
40
+ "data-testid": "information-card-description"
41
+ }, /*#__PURE__*/React.createElement(S.AlertWrapper, null, extraInformation), descriptionConfig && renderDescription());
42
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { InformationCardFooterProps } from './InformationCardFooter.types';
3
+ export declare const InformationCardFooter: ({ actionButton, actionButtonCallback, actionsMenuButtonLabel, actionsMenuButtonOnClick, actionButtonTooltipText, text, }: InformationCardFooterProps) => React.JSX.Element;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { FormattedMessage } from 'react-intl';
3
+ import Icon, { AngleRightS, ArrowRuCircleM } from '@synerise/ds-icon';
4
+ import Tooltip from '@synerise/ds-tooltip';
5
+ import { Text } from '@synerise/ds-typography';
6
+ import Button from '@synerise/ds-button';
7
+ import * as S from '../InformationCard.styles';
8
+ export var InformationCardFooter = function InformationCardFooter(_ref) {
9
+ var _ref$actionButton = _ref.actionButton,
10
+ actionButton = _ref$actionButton === void 0 ? false : _ref$actionButton,
11
+ actionButtonCallback = _ref.actionButtonCallback,
12
+ actionsMenuButtonLabel = _ref.actionsMenuButtonLabel,
13
+ actionsMenuButtonOnClick = _ref.actionsMenuButtonOnClick,
14
+ _ref$actionButtonTool = _ref.actionButtonTooltipText,
15
+ actionButtonTooltipText = _ref$actionButtonTool === void 0 ? '' : _ref$actionButtonTool,
16
+ _ref$text = _ref.text,
17
+ text = _ref$text === void 0 ? '' : _ref$text;
18
+ return /*#__PURE__*/React.createElement(S.FooterWrapper, {
19
+ "data-testid": "information-card-footer",
20
+ style: {
21
+ alignItems: 'center'
22
+ }
23
+ }, actionsMenuButtonOnClick && /*#__PURE__*/React.createElement(Button, {
24
+ type: "ghost",
25
+ mode: "label-icon",
26
+ onClick: actionsMenuButtonOnClick
27
+ }, actionsMenuButtonLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
28
+ id: "DS.INFORMATION-CARD.QUICK-ACTIONS",
29
+ defaultMessage: "Quick actions"
30
+ }), /*#__PURE__*/React.createElement(Icon, {
31
+ component: /*#__PURE__*/React.createElement(AngleRightS, null)
32
+ })), /*#__PURE__*/React.createElement(S.FlexGrow, null, text && /*#__PURE__*/React.createElement(Text, {
33
+ size: "xsmall"
34
+ }, text)), /*#__PURE__*/React.createElement(S.ActionButtonContainer, null, actionButton && actionButton === true && /*#__PURE__*/React.createElement(Tooltip, {
35
+ type: "default",
36
+ title: actionButtonTooltipText
37
+ }, /*#__PURE__*/React.createElement(Button, {
38
+ type: "ghost",
39
+ mode: "single-icon",
40
+ onClick: actionButtonCallback
41
+ }, /*#__PURE__*/React.createElement(ArrowRuCircleM, null))) || typeof actionButton === 'function' && actionButton()));
42
+ };
@@ -0,0 +1,8 @@
1
+ import { MouseEvent } from 'react';
2
+ import { InformationCardActionsProps } from '../InformationCardActions/InformationCardActions.types';
3
+ import { InformationCardProps } from '../InformationCard.types';
4
+ export type InformationCardFooterProps = {
5
+ text: InformationCardProps['footerText'];
6
+ actionsMenuButtonLabel?: InformationCardActionsProps['buttonLabel'];
7
+ actionsMenuButtonOnClick?: (event: MouseEvent) => void;
8
+ } & Pick<InformationCardProps, 'actionButton' | 'actionButtonTooltipText' | 'actionButtonTooltipText' | 'actionButtonCallback'>;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { InformationCardPropertyListProps } from './InformationCardPropertyList.types';
3
+ export declare const InformationCardPropertyList: ({ items }: InformationCardPropertyListProps) => React.JSX.Element;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import * as S from '../InformationCard.styles';
3
+ export var InformationCardPropertyList = function InformationCardPropertyList(_ref) {
4
+ var items = _ref.items;
5
+ return /*#__PURE__*/React.createElement(S.InformationCardPropertyListWrapper, {
6
+ "data-testid": "information-card-property-list"
7
+ }, items == null ? void 0 : items.map(function (_ref2) {
8
+ var type = _ref2.type,
9
+ label = _ref2.label,
10
+ value = _ref2.value;
11
+
12
+ if (type === 'divider') {
13
+ return /*#__PURE__*/React.createElement(S.Divider, {
14
+ dashed: true
15
+ });
16
+ }
17
+
18
+ return /*#__PURE__*/React.createElement(S.InformationCardPropertyItem, {
19
+ key: ""
20
+ }, label && /*#__PURE__*/React.createElement(S.InformationCardPropertyItemLabel, null, label, ":"), /*#__PURE__*/React.createElement(S.InformationCardPropertyItemValue, null, value));
21
+ }));
22
+ };
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ export type InformationCardPropertyItemTypes = 'divider';
3
+ export type InformationCardPropertyItem = {
4
+ label: ReactNode;
5
+ value?: ReactNode;
6
+ type?: InformationCardPropertyItemTypes;
7
+ };
8
+ export type InformationCardPropertyListProps = {
9
+ items?: InformationCardPropertyItem[];
10
+ summaryItems?: InformationCardPropertyItem[];
11
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { InformationCardSummaryProps } from './InformationCardSummary.types';
3
+ export declare const InformationCardSummary: ({ items }: InformationCardSummaryProps) => React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ 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); }
2
+
3
+ import React from 'react';
4
+ import Tooltip from '@synerise/ds-tooltip/dist/Tooltip';
5
+ import * as S from '../InformationCard.styles';
6
+ export var InformationCardSummary = function InformationCardSummary(_ref) {
7
+ var items = _ref.items;
8
+ return /*#__PURE__*/React.createElement(S.InformationCardSummaryWrapper, {
9
+ "data-testid": "information-card-summary"
10
+ }, items == null ? void 0 : items.map(function (_ref2) {
11
+ var icon = _ref2.icon,
12
+ label = _ref2.label,
13
+ tooltip = _ref2.tooltip,
14
+ tooltipProps = _ref2.tooltipProps;
15
+ var item = /*#__PURE__*/React.createElement(S.InformationCardSummaryItem, null, icon && /*#__PURE__*/React.createElement("div", null, icon), label && /*#__PURE__*/React.createElement("div", null, label));
16
+ return tooltip ? /*#__PURE__*/React.createElement(Tooltip, _extends({
17
+ title: tooltip
18
+ }, tooltipProps), item) : item;
19
+ }));
20
+ };
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ import { TooltipProps } from '@synerise/ds-tooltip';
3
+ export type InformationCardSummaryItem = {
4
+ label: ReactNode;
5
+ icon: ReactNode;
6
+ tooltip?: ReactNode;
7
+ tooltipProps?: TooltipProps;
8
+ };
9
+ export type InformationCardSummaryProps = {
10
+ items?: InformationCardSummaryItem[];
11
+ };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
- export { default, buildExtraInfo, buildIconBadge, buildInitialsBadge } from './InformationCard';
1
+ export { default } from './InformationCard';
2
+ export { InformationCardPropertyList } from './InformationCardPropertyList/InformationCardPropertyList';
3
+ export type { InformationCardPropertyItem, InformationCardPropertyItemTypes, InformationCardPropertyListProps, } from './InformationCardPropertyList/InformationCardPropertyList.types';
4
+ export { buildExtraInfo, buildIconBadge, buildInitialsBadge } from './InformationCard.utils';
2
5
  export type { InformationCardProps } from './InformationCard.types';
package/dist/index.js CHANGED
@@ -1 +1,3 @@
1
- export { default, buildExtraInfo, buildIconBadge, buildInitialsBadge } from './InformationCard';
1
+ export { default } from './InformationCard';
2
+ export { InformationCardPropertyList } from './InformationCardPropertyList/InformationCardPropertyList';
3
+ export { buildExtraInfo, buildIconBadge, buildInitialsBadge } from './InformationCard.utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-information-card",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "InformationCard UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,20 +34,22 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-alert": "^0.8.15",
38
- "@synerise/ds-avatar": "^0.16.4",
37
+ "@synerise/ds-alert": "^0.8.16",
38
+ "@synerise/ds-avatar": "^0.16.5",
39
39
  "@synerise/ds-badge": "^0.7.1",
40
- "@synerise/ds-button": "^0.21.0",
41
- "@synerise/ds-card": "^0.17.0",
42
- "@synerise/ds-description": "^0.3.107",
40
+ "@synerise/ds-button": "^0.21.1",
41
+ "@synerise/ds-card": "^0.18.0",
42
+ "@synerise/ds-description": "^0.3.108",
43
43
  "@synerise/ds-divider": "^0.7.0",
44
- "@synerise/ds-dropdown": "^0.18.1",
45
- "@synerise/ds-icon": "^0.62.1",
46
- "@synerise/ds-menu": "^0.19.2",
47
- "@synerise/ds-subtle-form": "^0.9.112",
48
- "@synerise/ds-tooltip": "^0.14.30",
44
+ "@synerise/ds-dropdown": "^0.18.2",
45
+ "@synerise/ds-icon": "^0.63.0",
46
+ "@synerise/ds-menu": "^0.19.3",
47
+ "@synerise/ds-scrollbar": "^0.11.2",
48
+ "@synerise/ds-subtle-form": "^0.9.113",
49
+ "@synerise/ds-tooltip": "^0.14.31",
49
50
  "@synerise/ds-typography": "^0.15.0",
50
- "rc-trigger": "5.2.5"
51
+ "rc-trigger": "5.2.5",
52
+ "react-intl": "3.12.0"
51
53
  },
52
54
  "peerDependencies": {
53
55
  "@synerise/ds-core": "*",
@@ -55,9 +57,10 @@
55
57
  "styled-components": "5.0.1"
56
58
  },
57
59
  "devDependencies": {
60
+ "@storybook/addon-actions": "6.5.16",
58
61
  "@synerise/ds-utils": "^0.27.0",
59
62
  "@testing-library/jest-dom": "5.1.1",
60
63
  "@testing-library/react": "10.0.1"
61
64
  },
62
- "gitHead": "ef835e848d4f02cca258130baa6c9f44dfa15dd0"
65
+ "gitHead": "587eb113074985ae21e4f0c25ec33c3e3e2e072b"
63
66
  }