@synerise/ds-information-card 0.6.2 → 0.7.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.7.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.6.2...@synerise/ds-information-card@0.7.0) (2024-11-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * **items-roll:** replaced Menu.Item with ListItem ([2cfcbdc](https://github.com/Synerise/synerise-design/commit/2cfcbdc501c0ad21557372c0f9d9cb76b3d034cb))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.6.2](https://github.com/Synerise/synerise-design/compare/@synerise/ds-information-card@0.6.1...@synerise/ds-information-card@0.6.2) (2024-11-21)
7
18
 
8
19
 
@@ -1,9 +1,6 @@
1
1
  var _excluded = ["actionButton", "actionButtonTooltipText", "actionButtonCallback", "actionsMenu", "asTooltip", "avatarTooltipText", "copyTooltip", "copiedTooltip", "renderFooter", "renderBadge", "subtitle", "title", "notice", "footerText", "icon", "iconColor", "descriptionConfig", "className", "renderAdditionalDescription", "propertyListItems", "summaryItems"];
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
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; }
6
-
7
4
  import React, { forwardRef, useState, useRef, useEffect } from 'react';
8
5
  import { SegmentM } from '@synerise/ds-icon';
9
6
  import Card from '@synerise/ds-card';
@@ -19,38 +16,34 @@ import { InformationCardPropertyList } from './InformationCardPropertyList/Infor
19
16
  import { InformationCardSummary } from './InformationCardSummary/InformationCardSummary';
20
17
  var InformationCard = forwardRef(function (_ref, ref) {
21
18
  var actionButton = _ref.actionButton,
22
- actionButtonTooltipText = _ref.actionButtonTooltipText,
23
- actionButtonCallback = _ref.actionButtonCallback,
24
- actionsMenu = _ref.actionsMenu,
25
- asTooltip = _ref.asTooltip,
26
- avatarTooltipText = _ref.avatarTooltipText,
27
- copyTooltip = _ref.copyTooltip,
28
- copiedTooltip = _ref.copiedTooltip,
29
- renderFooter = _ref.renderFooter,
30
- _renderBadge2 = _ref.renderBadge,
31
- subtitle = _ref.subtitle,
32
- title = _ref.title,
33
- notice = _ref.notice,
34
- footerText = _ref.footerText,
35
- _ref$icon = _ref.icon,
36
- iconElement = _ref$icon === void 0 ? /*#__PURE__*/React.createElement(SegmentM, null) : _ref$icon,
37
- iconColor = _ref.iconColor,
38
- descriptionConfig = _ref.descriptionConfig,
39
- className = _ref.className,
40
- renderAdditionalDescription = _ref.renderAdditionalDescription,
41
- propertyListItems = _ref.propertyListItems,
42
- summaryItems = _ref.summaryItems,
43
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
44
-
19
+ actionButtonTooltipText = _ref.actionButtonTooltipText,
20
+ actionButtonCallback = _ref.actionButtonCallback,
21
+ actionsMenu = _ref.actionsMenu,
22
+ asTooltip = _ref.asTooltip,
23
+ avatarTooltipText = _ref.avatarTooltipText,
24
+ copyTooltip = _ref.copyTooltip,
25
+ copiedTooltip = _ref.copiedTooltip,
26
+ renderFooter = _ref.renderFooter,
27
+ _renderBadge2 = _ref.renderBadge,
28
+ subtitle = _ref.subtitle,
29
+ title = _ref.title,
30
+ notice = _ref.notice,
31
+ footerText = _ref.footerText,
32
+ _ref$icon = _ref.icon,
33
+ iconElement = _ref$icon === void 0 ? /*#__PURE__*/React.createElement(SegmentM, null) : _ref$icon,
34
+ iconColor = _ref.iconColor,
35
+ descriptionConfig = _ref.descriptionConfig,
36
+ className = _ref.className,
37
+ renderAdditionalDescription = _ref.renderAdditionalDescription,
38
+ propertyListItems = _ref.propertyListItems,
39
+ summaryItems = _ref.summaryItems,
40
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
45
41
  var _useState = useState(false),
46
- isActionsMenuVisible = _useState[0],
47
- setIsActionsMenuVisible = _useState[1];
48
-
42
+ isActionsMenuVisible = _useState[0],
43
+ setIsActionsMenuVisible = _useState[1];
49
44
  var mainSlideRef = useRef(null);
50
-
51
45
  var _useResizeObserver = useResizeObserver(mainSlideRef),
52
- height = _useResizeObserver.height;
53
-
46
+ height = _useResizeObserver.height;
54
47
  var copyableSlot = function copyableSlot(content) {
55
48
  return /*#__PURE__*/React.createElement(RowWrapper, {
56
49
  copyable: true
@@ -68,12 +61,11 @@ var InformationCard = forwardRef(function (_ref, ref) {
68
61
  }
69
62
  })));
70
63
  };
64
+ var hasFooter = !!(footerText || actionButton || actionsMenu);
71
65
 
72
- var hasFooter = !!(footerText || actionButton || actionsMenu); // eslint-disable-next-line react-hooks/exhaustive-deps
73
-
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
74
67
  useEffect(function () {
75
68
  var _mainSlideRef$current;
76
-
77
69
  if (!((_mainSlideRef$current = mainSlideRef.current) != null && _mainSlideRef$current.clientWidth)) {
78
70
  setIsActionsMenuVisible(false);
79
71
  }
@@ -94,7 +86,6 @@ var InformationCard = forwardRef(function (_ref, ref) {
94
86
  background: "white",
95
87
  renderBadge: function renderBadge() {
96
88
  var _renderBadge;
97
-
98
89
  return _renderBadge2 !== null && /*#__PURE__*/React.createElement("div", {
99
90
  style: {
100
91
  marginRight: '16px'
@@ -1,7 +1,5 @@
1
1
  var _templateObject;
2
-
3
2
  function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
4
-
5
3
  import styled, { createGlobalStyle, css } from 'styled-components';
6
4
  import { CardStyles } from '@synerise/ds-card';
7
5
  import { DescriptionCopyable } from '@synerise/ds-description';
@@ -40,7 +38,7 @@ export var FlexGrow = styled.div.withConfig({
40
38
  componentId: "zxu5qa-5"
41
39
  })(["flex-grow:", ";"], function (_ref) {
42
40
  var _ref$grow = _ref.grow,
43
- grow = _ref$grow === void 0 ? 1 : _ref$grow;
41
+ grow = _ref$grow === void 0 ? 1 : _ref$grow;
44
42
  return grow;
45
43
  });
46
44
  export var ActionButtonContainer = styled.div.withConfig({
@@ -83,18 +81,18 @@ export var DescriptionWrapper = styled.div.withConfig({
83
81
  displayName: "InformationCardstyles__DescriptionWrapper",
84
82
  componentId: "zxu5qa-12"
85
83
  })(["padding:0 16px;"]);
84
+
86
85
  /**
87
86
  * This component can be used to style container with popovers/tooltips to disable arrow.
88
87
  */
89
-
90
88
  export var HidePopoverArrowWrapper = styled.div.withConfig({
91
89
  displayName: "InformationCardstyles__HidePopoverArrowWrapper",
92
90
  componentId: "zxu5qa-13"
93
91
  })([".ant-popover-arrow-content,.ant-tooltip-arrow-content{display:none;}"]);
92
+
94
93
  /**
95
94
  * Should be mounted in application where.
96
95
  */
97
-
98
96
  export var GlobalCSSHidePopoverArrow = createGlobalStyle(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n .ant-popover-arrow-content,.ant-tooltip-arrow-content {\n display: none;\n}"])));
99
97
  export var ExtraInfo = styled.div.withConfig({
100
98
  displayName: "InformationCardstyles__ExtraInfo",
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
2
  import React from 'react';
4
3
  import Alert from '@synerise/ds-alert';
5
4
  import Avatar, { ObjectAvatar } from '@synerise/ds-avatar';
@@ -23,7 +22,7 @@ export function getInitials(name) {
23
22
  }
24
23
  export function Initials(_ref) {
25
24
  var name = _ref.name,
26
- children = _ref.children;
25
+ children = _ref.children;
27
26
  return /*#__PURE__*/React.createElement(Badge, null, /*#__PURE__*/React.createElement(Avatar, {
28
27
  size: "medium",
29
28
  shape: "circle",
@@ -34,13 +33,11 @@ export function buildIconBadge(data) {
34
33
  var avatarExtra = {
35
34
  object: {}
36
35
  };
37
-
38
36
  if (data.avatarTooltipText) {
39
37
  avatarExtra.object = {
40
38
  description: data.avatarTooltipText
41
39
  };
42
40
  }
43
-
44
41
  return /*#__PURE__*/React.createElement(ObjectAvatar, _extends({}, avatarExtra, {
45
42
  color: data.iconColor,
46
43
  iconComponent: /*#__PURE__*/React.createElement(Icon, {
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
2
  import React from 'react';
4
3
  import { FormattedMessage } from 'react-intl';
5
4
  import Dropdown from '@synerise/ds-dropdown';
@@ -9,10 +8,10 @@ import * as S from '../InformationCard.styles';
9
8
  var NAV_HEIGHT = 61;
10
9
  export var InformationCardActions = function InformationCardActions(_ref) {
11
10
  var onHeaderClick = _ref.onHeaderClick,
12
- navigationLabel = _ref.navigationLabel,
13
- items = _ref.items,
14
- menuProps = _ref.menuProps,
15
- maxHeight = _ref.maxHeight;
11
+ navigationLabel = _ref.navigationLabel,
12
+ items = _ref.items,
13
+ menuProps = _ref.menuProps,
14
+ maxHeight = _ref.maxHeight;
16
15
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Dropdown.BackAction, {
17
16
  label: navigationLabel || /*#__PURE__*/React.createElement(FormattedMessage, {
18
17
  id: "DS.INFORMATION-CARD.QUICK-ACTIONS",
@@ -1,17 +1,14 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
2
  import React, { useState } from 'react';
4
3
  import SubtleForm from '@synerise/ds-subtle-form';
5
4
  import * as S from '../InformationCard.styles';
6
5
  export var InformationCardDescription = function InformationCardDescription(_ref) {
7
6
  var _ref$extraInformation = _ref.extraInformation,
8
- extraInformation = _ref$extraInformation === void 0 ? undefined : _ref$extraInformation,
9
- descriptionConfig = _ref.descriptionConfig;
10
-
7
+ extraInformation = _ref$extraInformation === void 0 ? undefined : _ref$extraInformation,
8
+ descriptionConfig = _ref.descriptionConfig;
11
9
  var _useState = useState(''),
12
- description = _useState[0],
13
- setDescription = _useState[1];
14
-
10
+ description = _useState[0],
11
+ setDescription = _useState[1];
15
12
  var renderDescription = function renderDescription() {
16
13
  if (descriptionConfig) {
17
14
  return typeof descriptionConfig === 'string' ? /*#__PURE__*/React.createElement(S.NonEditableWrapper, null, descriptionConfig) : /*#__PURE__*/React.createElement(SubtleForm.TextArea, _extends({
@@ -32,10 +29,8 @@ export var InformationCardDescription = function InformationCardDescription(_ref
32
29
  disabled: descriptionConfig.disabled
33
30
  }));
34
31
  }
35
-
36
32
  return /*#__PURE__*/React.createElement(React.Fragment, null);
37
33
  };
38
-
39
34
  return /*#__PURE__*/React.createElement(S.DescriptionWrapper, {
40
35
  "data-testid": "information-card-description"
41
36
  }, /*#__PURE__*/React.createElement(S.AlertWrapper, null, extraInformation), descriptionConfig && renderDescription());
@@ -7,14 +7,14 @@ import Button from '@synerise/ds-button';
7
7
  import * as S from '../InformationCard.styles';
8
8
  export var InformationCardFooter = function InformationCardFooter(_ref) {
9
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;
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
18
  return /*#__PURE__*/React.createElement(S.FooterWrapper, {
19
19
  "data-testid": "information-card-footer",
20
20
  style: {
@@ -6,17 +6,17 @@ export var InformationCardPropertyList = function InformationCardPropertyList(_r
6
6
  "data-testid": "information-card-property-list"
7
7
  }, items == null ? void 0 : items.map(function (_ref2) {
8
8
  var type = _ref2.type,
9
- label = _ref2.label,
10
- value = _ref2.value;
11
-
9
+ label = _ref2.label,
10
+ value = _ref2.value,
11
+ key = _ref2.key;
12
12
  if (type === 'divider') {
13
13
  return /*#__PURE__*/React.createElement(S.Divider, {
14
- dashed: true
14
+ dashed: true,
15
+ key: key
15
16
  });
16
17
  }
17
-
18
18
  return /*#__PURE__*/React.createElement(S.InformationCardPropertyItem, {
19
- key: ""
19
+ key: key
20
20
  }, label && /*#__PURE__*/React.createElement(S.InformationCardPropertyItemLabel, null, label, ":"), /*#__PURE__*/React.createElement(S.InformationCardPropertyItemValue, null, value));
21
21
  }));
22
22
  };
@@ -1,8 +1,9 @@
1
- import type { ReactNode } from 'react';
1
+ import type { Key, ReactNode } from 'react';
2
2
  export type InformationCardPropertyItemTypes = 'divider';
3
3
  export type InformationCardPropertyItem = {
4
4
  label: ReactNode;
5
5
  value?: ReactNode;
6
+ key?: Key;
6
7
  type?: InformationCardPropertyItemTypes;
7
8
  };
8
9
  export type InformationCardPropertyListProps = {
@@ -1,5 +1,4 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
2
  import React from 'react';
4
3
  import Tooltip from '@synerise/ds-tooltip/dist/Tooltip';
5
4
  import * as S from '../InformationCard.styles';
@@ -9,10 +8,13 @@ export var InformationCardSummary = function InformationCardSummary(_ref) {
9
8
  "data-testid": "information-card-summary"
10
9
  }, items == null ? void 0 : items.map(function (_ref2) {
11
10
  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));
11
+ label = _ref2.label,
12
+ tooltip = _ref2.tooltip,
13
+ tooltipProps = _ref2.tooltipProps,
14
+ key = _ref2.key;
15
+ var item = /*#__PURE__*/React.createElement(S.InformationCardSummaryItem, {
16
+ key: key
17
+ }, icon && /*#__PURE__*/React.createElement("div", null, icon), label && /*#__PURE__*/React.createElement("div", null, label));
16
18
  return tooltip ? /*#__PURE__*/React.createElement(Tooltip, _extends({
17
19
  title: tooltip
18
20
  }, tooltipProps), item) : item;
@@ -1,10 +1,11 @@
1
- import type { ReactNode } from 'react';
2
- import { TooltipProps } from '@synerise/ds-tooltip';
1
+ import type { ReactNode, Key } from 'react';
2
+ import type { TooltipProps } from '@synerise/ds-tooltip';
3
3
  export type InformationCardSummaryItem = {
4
4
  label: ReactNode;
5
5
  icon: ReactNode;
6
6
  tooltip?: ReactNode;
7
7
  tooltipProps?: TooltipProps;
8
+ key?: Key;
8
9
  };
9
10
  export type InformationCardSummaryProps = {
10
11
  items?: InformationCardSummaryItem[];
@@ -1,9 +1,6 @@
1
1
  var _excluded = ["triggerProps", "children", "style", "informationCardProps"];
2
-
3
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
-
5
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; }
6
-
7
4
  import React, { useCallback, useMemo } from 'react';
8
5
  import Trigger from 'rc-trigger';
9
6
  import { useTheme } from '@synerise/ds-core';
@@ -12,13 +9,11 @@ import { TRIGGER_PLACEMENTS } from './InformationCard.constants';
12
9
  import * as S from './InformationCardTooltip.styles';
13
10
  export var InformationCardTooltip = function InformationCardTooltip(_ref) {
14
11
  var _triggerProps$default;
15
-
16
12
  var triggerProps = _ref.triggerProps,
17
- children = _ref.children,
18
- style = _ref.style,
19
- informationCardProps = _ref.informationCardProps,
20
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
21
-
13
+ children = _ref.children,
14
+ style = _ref.style,
15
+ informationCardProps = _ref.informationCardProps,
16
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
22
17
  var dsTheme = useTheme();
23
18
  var zIndex = parseInt(dsTheme.variables['zindex-tooltip'], 10);
24
19
  var renderedInfocard = useMemo(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-information-card",
3
- "version": "0.6.2",
3
+ "version": "0.7.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.8.38",
39
- "@synerise/ds-avatar": "^0.17.21",
40
- "@synerise/ds-badge": "^0.8.19",
41
- "@synerise/ds-button": "^0.21.19",
42
- "@synerise/ds-card": "^0.19.16",
43
- "@synerise/ds-description": "^0.4.2",
44
- "@synerise/ds-divider": "^0.7.15",
45
- "@synerise/ds-dropdown": "^0.18.24",
46
- "@synerise/ds-icon": "^0.67.0",
47
- "@synerise/ds-menu": "^0.20.6",
48
- "@synerise/ds-scrollbar": "^0.11.19",
49
- "@synerise/ds-subtle-form": "^0.9.136",
50
- "@synerise/ds-tooltip": "^0.14.49",
51
- "@synerise/ds-typography": "^0.16.6",
38
+ "@synerise/ds-alert": "^0.8.39",
39
+ "@synerise/ds-avatar": "^0.17.22",
40
+ "@synerise/ds-badge": "^0.8.20",
41
+ "@synerise/ds-button": "^0.21.20",
42
+ "@synerise/ds-card": "^0.19.17",
43
+ "@synerise/ds-description": "^0.4.3",
44
+ "@synerise/ds-divider": "^0.7.16",
45
+ "@synerise/ds-dropdown": "^0.18.25",
46
+ "@synerise/ds-icon": "^0.67.1",
47
+ "@synerise/ds-menu": "^0.20.7",
48
+ "@synerise/ds-scrollbar": "^0.11.20",
49
+ "@synerise/ds-subtle-form": "^0.9.137",
50
+ "@synerise/ds-tooltip": "^0.14.50",
51
+ "@synerise/ds-typography": "^0.16.7",
52
52
  "@synerise/ds-utils": "^0.31.2",
53
53
  "rc-trigger": "5.2.5"
54
54
  },
@@ -58,5 +58,5 @@
58
58
  "react-intl": ">=3.12.0 <= 6.8",
59
59
  "styled-components": "5.0.1"
60
60
  },
61
- "gitHead": "05f083c767e2cec3c2f91c9475aee89852a77d6c"
61
+ "gitHead": "4a56ee7ef816c22341ce704154dc7aa65b7d1dcc"
62
62
  }