@atlaskit/section-message 8.5.1 → 8.6.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
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/section-message
2
2
 
3
+ ## 8.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`98ff1fe25f14a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/98ff1fe25f14a) -
8
+ Introduces the `onDismiss` callback function for usage with the `isDismissible` prop.
9
+
10
+ ## 8.5.2
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 8.5.1
4
17
 
5
18
  ### Patch Changes
@@ -52,14 +52,16 @@ var SectionMessage = /*#__PURE__*/(0, _react.forwardRef)(function SectionMessage
52
52
  title = _ref.title,
53
53
  icon = _ref.icon,
54
54
  isDismissible = _ref.isDismissible,
55
+ onDismiss = _ref.onDismiss,
55
56
  testId = _ref.testId;
56
57
  var _useState = (0, _react.useState)(false),
57
58
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
58
59
  dismissed = _useState2[0],
59
60
  setDismissed = _useState2[1];
60
61
  var handleDismiss = (0, _react.useCallback)(function () {
62
+ onDismiss === null || onDismiss === void 0 || onDismiss();
61
63
  setDismissed(true);
62
- }, []);
64
+ }, [onDismiss]);
63
65
  var _getAppearanceIconSty = (0, _appearanceIcon.getAppearanceIconStyles)(appearance, icon),
64
66
  primaryColor = _getAppearanceIconSty.primaryIconColor,
65
67
  secondaryColor = _getAppearanceIconSty.backgroundColor,
@@ -41,12 +41,14 @@ const SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage({
41
41
  title,
42
42
  icon,
43
43
  isDismissible,
44
+ onDismiss,
44
45
  testId
45
46
  }, ref) {
46
47
  const [dismissed, setDismissed] = useState(false);
47
48
  const handleDismiss = useCallback(() => {
49
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
48
50
  setDismissed(true);
49
- }, []);
51
+ }, [onDismiss]);
50
52
  const {
51
53
  primaryIconColor: primaryColor,
52
54
  backgroundColor: secondaryColor,
@@ -43,14 +43,16 @@ var SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(_ref, ref)
43
43
  title = _ref.title,
44
44
  icon = _ref.icon,
45
45
  isDismissible = _ref.isDismissible,
46
+ onDismiss = _ref.onDismiss,
46
47
  testId = _ref.testId;
47
48
  var _useState = useState(false),
48
49
  _useState2 = _slicedToArray(_useState, 2),
49
50
  dismissed = _useState2[0],
50
51
  setDismissed = _useState2[1];
51
52
  var handleDismiss = useCallback(function () {
53
+ onDismiss === null || onDismiss === void 0 || onDismiss();
52
54
  setDismissed(true);
53
- }, []);
55
+ }, [onDismiss]);
54
56
  var _getAppearanceIconSty = getAppearanceIconStyles(appearance, icon),
55
57
  primaryColor = _getAppearanceIconSty.primaryIconColor,
56
58
  secondaryColor = _getAppearanceIconSty.backgroundColor,
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { type ComponentType } from 'react';
2
2
  import type { Appearance, SectionMessageProps } from '../types';
3
3
  export declare function getAppearanceIconStyles(appearance: Appearance, icon: SectionMessageProps['icon']): {
4
4
  Icon: React.ElementType<any, keyof React.JSX.IntrinsicElements> | (({ size, primaryColor, secondaryColor, }: {
@@ -8,5 +8,5 @@ export declare function getAppearanceIconStyles(appearance: Appearance, icon: Se
8
8
  }) => React.JSX.Element);
9
9
  backgroundColor: string;
10
10
  primaryIconColor: string;
11
- LegacyFallbackIcon?: React.ComponentType<any> | undefined;
11
+ LegacyFallbackIcon?: ComponentType<any>;
12
12
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SectionMessageActionProps } from './types';
3
2
  /**
4
3
  * __Section message action__
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SectionMessageProps } from './types';
3
2
  /**
4
3
  * __Section message__
@@ -39,6 +39,10 @@ export interface SectionMessageProps {
39
39
  * It does not handle persistence of the dismissed state across page reloads or remounts.
40
40
  */
41
41
  isDismissible?: boolean;
42
+ /**
43
+ * A callback function that is called when the user dismisses the message.
44
+ */
45
+ onDismiss?: () => void;
42
46
  /**
43
47
  * A `testId` prop is a unique string that appears as a data attribute `data-testid`
44
48
  * in the rendered code, serving as a hook for automated tests.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { type ComponentType } from 'react';
2
2
  import type { Appearance, SectionMessageProps } from '../types';
3
3
  export declare function getAppearanceIconStyles(appearance: Appearance, icon: SectionMessageProps['icon']): {
4
4
  Icon: React.ElementType<any, keyof React.JSX.IntrinsicElements> | (({ size, primaryColor, secondaryColor, }: {
@@ -8,5 +8,5 @@ export declare function getAppearanceIconStyles(appearance: Appearance, icon: Se
8
8
  }) => React.JSX.Element);
9
9
  backgroundColor: string;
10
10
  primaryIconColor: string;
11
- LegacyFallbackIcon?: React.ComponentType<any> | undefined;
11
+ LegacyFallbackIcon?: ComponentType<any>;
12
12
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SectionMessageActionProps } from './types';
3
2
  /**
4
3
  * __Section message action__
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SectionMessageProps } from './types';
3
2
  /**
4
3
  * __Section message__
@@ -39,6 +39,10 @@ export interface SectionMessageProps {
39
39
  * It does not handle persistence of the dismissed state across page reloads or remounts.
40
40
  */
41
41
  isDismissible?: boolean;
42
+ /**
43
+ * A callback function that is called when the user dismisses the message.
44
+ */
45
+ onDismiss?: () => void;
42
46
  /**
43
47
  * A `testId` prop is a unique string that appears as a data attribute `data-testid`
44
48
  * in the rendered code, serving as a hook for automated tests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "8.5.1",
3
+ "version": "8.6.0",
4
4
  "description": "A section message is used to alert users to a particular section of the screen.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,11 +38,11 @@
38
38
  ".": "./src/index.tsx"
39
39
  },
40
40
  "dependencies": {
41
- "@atlaskit/button": "^23.3.0",
41
+ "@atlaskit/button": "^23.4.0",
42
42
  "@atlaskit/codemod-utils": "^4.2.0",
43
43
  "@atlaskit/css": "^0.12.0",
44
44
  "@atlaskit/heading": "^5.2.0",
45
- "@atlaskit/icon": "^27.9.0",
45
+ "@atlaskit/icon": "^28.1.0",
46
46
  "@atlaskit/link": "^3.2.0",
47
47
  "@atlaskit/platform-feature-flags": "^1.1.0",
48
48
  "@atlaskit/primitives": "^14.11.0",
@@ -61,14 +61,13 @@
61
61
  "@atlaskit/code": "^17.2.0",
62
62
  "@atlaskit/docs": "^11.0.0",
63
63
  "@atlaskit/ds-lib": "^5.0.0",
64
- "@atlaskit/form": "^12.0.0",
64
+ "@atlaskit/form": "^12.2.0",
65
65
  "@atlaskit/range": "^9.2.0",
66
66
  "@atlassian/feature-flags-test-utils": "^0.3.0",
67
- "@atlassian/ssr-tests": "^0.2.0",
67
+ "@atlassian/ssr-tests": "^0.3.0",
68
68
  "@testing-library/react": "^13.4.0",
69
69
  "@testing-library/user-event": "^14.4.3",
70
- "react-dom": "^18.2.0",
71
- "typescript": "~5.4.2"
70
+ "react-dom": "^18.2.0"
72
71
  },
73
72
  "techstack": {
74
73
  "@atlassian/frontend": {
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/entry-points/section-message.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/entry-points/section-message.d.ts"
14
14
  ]
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/entry-points/section-message-action.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/entry-points/section-message-action.d.ts"
14
14
  ]
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/entry-points/types.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/entry-points/types.d.ts"
14
14
  ]