@synerise/ds-alert 0.7.48 → 0.7.50

Sign up to get free protection for your applications and to get access to all the features.
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.7.50](https://github.com/Synerise/synerise-design/compare/@synerise/ds-alert@0.7.49...@synerise/ds-alert@0.7.50) (2023-12-11)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-alert
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.7.49](https://github.com/Synerise/synerise-design/compare/@synerise/ds-alert@0.7.48...@synerise/ds-alert@0.7.49) (2023-11-09)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **SectionMessage:** [TC-1304] click handling when closing section message ([5ccd4af](https://github.com/Synerise/synerise-design/commit/5ccd4afd4c65f7afa33b69857400ebf9b53a90c5))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.7.48](https://github.com/Synerise/synerise-design/compare/@synerise/ds-alert@0.7.47...@synerise/ds-alert@0.7.48) (2023-10-30)
7
26
 
8
27
  **Note:** Version bump only for package @synerise/ds-alert
@@ -1,4 +1,3 @@
1
- import * as React from 'react';
2
1
  import { Props } from './SectionMessage.types';
3
- declare const SectionMessage: React.FC<Props>;
2
+ declare const SectionMessage: ({ icon, type, message, description, showMoreLabel, onShowMore, onClose, newClient, moreButtons, withEmphasis, withLink, unorderedList, color, withClose, customColor, customColorIcon, customIcon, textButton, }: Props) => JSX.Element;
4
3
  export default SectionMessage;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import Icon, { CloseM, WarningFillM, UserAddM, Check3M, HelpFillM, UserUpM, UpdateDataM, NotificationsReceiveM } from '@synerise/ds-icon';
3
3
  import Button from '@synerise/ds-button';
4
4
  import * as S from './SectionMessage.styles';
@@ -20,6 +20,7 @@ var SectionMessage = function SectionMessage(_ref) {
20
20
  description = _ref.description,
21
21
  showMoreLabel = _ref.showMoreLabel,
22
22
  onShowMore = _ref.onShowMore,
23
+ onClose = _ref.onClose,
23
24
  newClient = _ref.newClient,
24
25
  moreButtons = _ref.moreButtons,
25
26
  withEmphasis = _ref.withEmphasis,
@@ -31,18 +32,23 @@ var SectionMessage = function SectionMessage(_ref) {
31
32
  customColorIcon = _ref.customColorIcon,
32
33
  customIcon = _ref.customIcon,
33
34
  textButton = _ref.textButton;
34
- var renderMessage = React.useMemo(function () {
35
+ var renderMessage = useMemo(function () {
35
36
  return /*#__PURE__*/React.createElement(S.AlertContent, {
36
37
  withLink: withLink
37
38
  }, message && /*#__PURE__*/React.createElement(S.AlertMessage, null, message), /*#__PURE__*/React.createElement(S.Text, null, description && /*#__PURE__*/React.createElement(S.AlertDescription, null, description), withLink && /*#__PURE__*/React.createElement(S.LinkWrapper, null, withLink), withEmphasis && !withLink && /*#__PURE__*/React.createElement(S.EmphasisWrapper, null, withEmphasis)), onShowMore && showMoreLabel && /*#__PURE__*/React.createElement(S.AlertShowMore, {
38
39
  onClick: onShowMore
39
40
  }, showMoreLabel), moreButtons, unorderedList && !moreButtons && unorderedList);
40
41
  }, [message, description, showMoreLabel, onShowMore, moreButtons, withEmphasis, withLink, unorderedList]);
41
- var renderIcon = React.useMemo(function () {
42
+ var renderIcon = useMemo(function () {
42
43
  if (icon) return icon;
43
44
  if (ICONS[type]) return ICONS[type];
44
45
  return DEFAULT_ICON;
45
46
  }, [icon, type]);
47
+
48
+ var handleClose = function handleClose() {
49
+ onClose && onClose();
50
+ };
51
+
46
52
  return /*#__PURE__*/React.createElement(S.Container, {
47
53
  color: color,
48
54
  customColor: customColor
@@ -56,7 +62,9 @@ var SectionMessage = function SectionMessage(_ref) {
56
62
  mode: "icon-label"
57
63
  }, /*#__PURE__*/React.createElement(Icon, {
58
64
  component: /*#__PURE__*/React.createElement(UserAddM, null)
59
- }), textButton), withClose && /*#__PURE__*/React.createElement(S.IconCloseWrapper, null, /*#__PURE__*/React.createElement(Icon, {
65
+ }), textButton), withClose && /*#__PURE__*/React.createElement(S.IconCloseWrapper, {
66
+ onClick: handleClose
67
+ }, /*#__PURE__*/React.createElement(Icon, {
60
68
  component: /*#__PURE__*/React.createElement(CloseM, null)
61
69
  })))));
62
70
  };
@@ -14,6 +14,7 @@ export interface Props extends Omit<AlertProps, 'type' | 'message'> {
14
14
  mode?: ModeType;
15
15
  showMoreLabel?: React.ReactNode;
16
16
  onShowMore?: () => void;
17
+ onClose?: () => void;
17
18
  newClient?: boolean | React.ReactNode;
18
19
  moreButtons?: boolean | React.ReactNode;
19
20
  withEmphasis?: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-alert",
3
- "version": "0.7.48",
3
+ "version": "0.7.50",
4
4
  "description": "Alert UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -18,7 +18,7 @@
18
18
  "scripts": {
19
19
  "build": "npm run build:js && npm run build:css && npm run defs",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
- "build:js": "babel --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
21
+ "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
22
  "build:watch": "npm run build:js -- --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "npm pack --pack-destination ../../portal/storybook-static/static",
@@ -33,8 +33,8 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-button": "^0.18.7",
37
- "@synerise/ds-icon": "^0.58.7",
36
+ "@synerise/ds-button": "^0.18.8",
37
+ "@synerise/ds-icon": "^0.58.8",
38
38
  "animate.css": "^4.1.1",
39
39
  "react-animate-height": "^2.0.23",
40
40
  "react-dom": "16.13.0",
@@ -47,9 +47,9 @@
47
47
  "styled-components": "5.0.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@synerise/ds-utils": "^0.24.21",
50
+ "@synerise/ds-utils": "^0.24.22",
51
51
  "@testing-library/jest-dom": "5.1.1",
52
52
  "@testing-library/react": "10.0.1"
53
53
  },
54
- "gitHead": "854aa713ea3fb1e9348fd351888da807f761a3f4"
54
+ "gitHead": "5ab278e69cd049334216bc9867cca2ce6a5fc218"
55
55
  }