@atlaskit/section-message 6.1.13 → 6.2.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,27 @@
1
1
  # @atlaskit/section-message
2
2
 
3
+ ## 6.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`24ff3516c8d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24ff3516c8d) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+
13
+ ## 6.1.15
14
+
15
+ ### Patch Changes
16
+
17
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
18
+
19
+ ## 6.1.14
20
+
21
+ ### Patch Changes
22
+
23
+ - [`8202e37941b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8202e37941b) - Internal code change turning on new linting rules.
24
+
3
25
  ## 6.1.13
4
26
 
5
27
  ### Patch Changes
File without changes
@@ -129,7 +129,7 @@ export const mapActionsProp = (
129
129
  const linkComponentAttributeValue = transferLinkComponentProp(j, element);
130
130
  actionsAttributes = getJSXAttributesByName(j, element, ACTIONS_PROP_NAME);
131
131
 
132
- actionsAttributes.forEach((attribute: ASTPath<JSXAttribute>) => {
132
+ actionsAttributes?.forEach((attribute: ASTPath<JSXAttribute>) => {
133
133
  j(attribute)
134
134
  .find(j.JSXExpressionContainer)
135
135
  .forEach((expressionContainer: ASTPath<JSXExpressionContainer>) => {
File without changes
@@ -9,7 +9,7 @@ exports.default = void 0;
9
9
 
10
10
  var _react = require("react");
11
11
 
12
- var _core = require("@emotion/core");
12
+ var _react2 = require("@emotion/react");
13
13
 
14
14
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
15
15
 
@@ -19,7 +19,7 @@ var _constants = require("@atlaskit/theme/constants");
19
19
 
20
20
  /** @jsx jsx */
21
21
  var actionsSeparatorWidth = (0, _constants.gridSize)() * 2;
22
- var actionStyles = (0, _core.css)({
22
+ var actionStyles = (0, _react2.css)({
23
23
  display: 'flex',
24
24
  margin: 0,
25
25
  alignItems: 'center',
@@ -33,16 +33,26 @@ var actionStyles = (0, _core.css)({
33
33
  verticalAlign: 'middle'
34
34
  }
35
35
  });
36
+ /**
37
+ * __Section message action__
38
+ *
39
+ * A section message action is designed to work with the `action` prop from
40
+ * `SectionMessage`. It renders either a button or a link depending on whether
41
+ * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
42
+ *
43
+ * - [Examples](https://atlassian.design/components/section-message/examples#actions)
44
+ */
45
+
36
46
  var SectionMessageAction = /*#__PURE__*/(0, _react.memo)(function SectionMessageAction(_ref) {
37
47
  var children = _ref.children,
38
48
  onClick = _ref.onClick,
39
49
  href = _ref.href,
40
50
  testId = _ref.testId,
41
51
  linkComponent = _ref.linkComponent;
42
- return (0, _core.jsx)("li", {
52
+ return (0, _react2.jsx)("li", {
43
53
  css: actionStyles,
44
54
  "data-testid": testId
45
- }, onClick || href ? (0, _core.jsx)(_standardButton.default, {
55
+ }, onClick || href ? (0, _react2.jsx)(_standardButton.default, {
46
56
  appearance: "link",
47
57
  spacing: "none",
48
58
  onClick: onClick,
@@ -13,7 +13,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
13
13
 
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
 
16
- var _core = require("@emotion/core");
16
+ var _react2 = require("@emotion/react");
17
17
 
18
18
  var _colors = require("@atlaskit/theme/colors");
19
19
 
@@ -39,16 +39,16 @@ var titleColor = {
39
39
  light: "var(--ds-text, ".concat(_colors.N800, ")"),
40
40
  dark: "var(--ds-text, ".concat(_colors.DN600, ")")
41
41
  };
42
- var containerStyles = (0, _core.css)({
42
+ var containerStyles = (0, _react2.css)({
43
43
  display: 'flex',
44
44
  padding: "".concat(containerPadding, "px"),
45
45
  borderRadius: "".concat((0, _constants.borderRadius)(), "px")
46
46
  });
47
- var contentContainerStyles = (0, _core.css)({
47
+ var contentContainerStyles = (0, _react2.css)({
48
48
  flexGrow: 1,
49
49
  wordBreak: 'break-word'
50
50
  });
51
- var titleStyles = (0, _core.css)({
51
+ var titleStyles = (0, _react2.css)({
52
52
  margin: "0 0 ".concat(titleMarginBottom, "px"),
53
53
  fontSize: "".concat(_typography.headingSizes.h500.size / (0, _constants.fontSize)(), "em"),
54
54
  fontStyle: 'inherit',
@@ -56,7 +56,7 @@ var titleStyles = (0, _core.css)({
56
56
  letterSpacing: '-0.006em',
57
57
  lineHeight: "".concat(_typography.headingSizes.h500.lineHeight / _typography.headingSizes.h500.size)
58
58
  });
59
- var actionsStyles = (0, _core.css)({
59
+ var actionsStyles = (0, _react2.css)({
60
60
  display: 'flex',
61
61
  marginTop: "".concat(actionMarginTop, "px"),
62
62
  paddingLeft: 0,
@@ -67,7 +67,7 @@ var actionsStyles = (0, _core.css)({
67
67
  // Since the icons will have a consistent size, we can treat them as pre-calculated
68
68
  // space.
69
69
 
70
- var iconWrapperStyles = (0, _core.css)({
70
+ var iconWrapperStyles = (0, _react2.css)({
71
71
  display: 'flex',
72
72
  margin: '-2px 0',
73
73
  flex: "0 0 ".concat(iconWrapperWidth, "px")
@@ -100,31 +100,41 @@ var SectionMessageWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Sectio
100
100
 
101
101
  var actionsArray = _react.default.Children.toArray(actions);
102
102
 
103
- return (0, _core.jsx)("section", {
103
+ return (0, _react2.jsx)("section", {
104
104
  css: containerStyles,
105
105
  style: containerStyleWithBackground,
106
106
  "data-testid": testId,
107
107
  ref: ref
108
- }, (0, _core.jsx)("div", {
108
+ }, (0, _react2.jsx)("div", {
109
109
  css: iconWrapperStyles
110
- }, (0, _core.jsx)(Icon, {
110
+ }, (0, _react2.jsx)(Icon, {
111
111
  primaryColor: primaryIconColor,
112
112
  secondaryColor: backgroundColor
113
- })), (0, _core.jsx)("div", {
113
+ })), (0, _react2.jsx)("div", {
114
114
  css: contentContainerStyles,
115
115
  "data-testid": testId && "".concat(testId, "--content")
116
- }, title ? (0, _core.jsx)("h1", {
116
+ }, title ? (0, _react2.jsx)("h1", {
117
117
  css: titleStyles,
118
118
  style: memoizedTitleColor
119
- }, title) : null, (0, _core.jsx)("div", null, children), actionsArray.length > 0 ? (0, _core.jsx)("ul", {
119
+ }, title) : null, (0, _react2.jsx)("div", null, children), actionsArray.length > 0 ? (0, _react2.jsx)("ul", {
120
120
  css: actionsStyles,
121
121
  "data-testid": testId && "".concat(testId, "--actions")
122
122
  }, actionsArray) : null));
123
123
  });
124
+ /**
125
+ * __Section message__
126
+ *
127
+ * A section message is used to alert users to a particular section of the screen.
128
+ *
129
+ * - [Examples](https://atlassian.design/components/section-message/examples)
130
+ * - [Code](https://atlassian.design/components/section-message/code)
131
+ * - [Usage](https://atlassian.design/components/section-message/usage)
132
+ */
133
+
124
134
  var SectionMessage = /*#__PURE__*/(0, _react.forwardRef)(function SectionMessage(props, ref) {
125
- return (0, _core.jsx)(_components.default.Consumer, null, function (_ref2) {
135
+ return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
126
136
  var mode = _ref2.mode;
127
- return (0, _core.jsx)(SectionMessageWithMode, (0, _extends2.default)({}, props, {
137
+ return (0, _react2.jsx)(SectionMessageWithMode, (0, _extends2.default)({}, props, {
128
138
  mode: mode,
129
139
  ref: ref
130
140
  }));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.1.13",
3
+ "version": "6.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { memo } from 'react';
3
- import { css, jsx } from '@emotion/core';
3
+ import { css, jsx } from '@emotion/react';
4
4
  import Button from '@atlaskit/button/standard-button';
5
5
  import { N500 } from '@atlaskit/theme/colors';
6
6
  import { gridSize } from '@atlaskit/theme/constants';
@@ -19,6 +19,16 @@ const actionStyles = css({
19
19
  verticalAlign: 'middle'
20
20
  }
21
21
  });
22
+ /**
23
+ * __Section message action__
24
+ *
25
+ * A section message action is designed to work with the `action` prop from
26
+ * `SectionMessage`. It renders either a button or a link depending on whether
27
+ * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
28
+ *
29
+ * - [Examples](https://atlassian.design/components/section-message/examples#actions)
30
+ */
31
+
22
32
  const SectionMessageAction = /*#__PURE__*/memo(function SectionMessageAction({
23
33
  children,
24
34
  onClick,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import React, { forwardRef, useMemo } from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import { DN600, N800 } from '@atlaskit/theme/colors';
7
7
  import GlobalTheme from '@atlaskit/theme/components';
8
8
  import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
@@ -92,6 +92,16 @@ const SectionMessageWithMode = /*#__PURE__*/forwardRef(function SectionMessage({
92
92
  "data-testid": testId && `${testId}--actions`
93
93
  }, actionsArray) : null));
94
94
  });
95
+ /**
96
+ * __Section message__
97
+ *
98
+ * A section message is used to alert users to a particular section of the screen.
99
+ *
100
+ * - [Examples](https://atlassian.design/components/section-message/examples)
101
+ * - [Code](https://atlassian.design/components/section-message/code)
102
+ * - [Usage](https://atlassian.design/components/section-message/usage)
103
+ */
104
+
95
105
  const SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(props, ref) {
96
106
  return jsx(GlobalTheme.Consumer, null, ({
97
107
  mode
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.1.13",
3
+ "version": "6.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { memo } from 'react';
3
- import { css, jsx } from '@emotion/core';
3
+ import { css, jsx } from '@emotion/react';
4
4
  import Button from '@atlaskit/button/standard-button';
5
5
  import { N500 } from '@atlaskit/theme/colors';
6
6
  import { gridSize } from '@atlaskit/theme/constants';
@@ -19,6 +19,16 @@ var actionStyles = css({
19
19
  verticalAlign: 'middle'
20
20
  }
21
21
  });
22
+ /**
23
+ * __Section message action__
24
+ *
25
+ * A section message action is designed to work with the `action` prop from
26
+ * `SectionMessage`. It renders either a button or a link depending on whether
27
+ * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
28
+ *
29
+ * - [Examples](https://atlassian.design/components/section-message/examples#actions)
30
+ */
31
+
22
32
  var SectionMessageAction = /*#__PURE__*/memo(function SectionMessageAction(_ref) {
23
33
  var children = _ref.children,
24
34
  onClick = _ref.onClick,
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import React, { forwardRef, useMemo } from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import { DN600, N800 } from '@atlaskit/theme/colors';
7
7
  import GlobalTheme from '@atlaskit/theme/components';
8
8
  import { borderRadius, fontSize, gridSize } from '@atlaskit/theme/constants';
@@ -97,6 +97,16 @@ var SectionMessageWithMode = /*#__PURE__*/forwardRef(function SectionMessage(_re
97
97
  "data-testid": testId && "".concat(testId, "--actions")
98
98
  }, actionsArray) : null));
99
99
  });
100
+ /**
101
+ * __Section message__
102
+ *
103
+ * A section message is used to alert users to a particular section of the screen.
104
+ *
105
+ * - [Examples](https://atlassian.design/components/section-message/examples)
106
+ * - [Code](https://atlassian.design/components/section-message/code)
107
+ * - [Usage](https://atlassian.design/components/section-message/usage)
108
+ */
109
+
100
110
  var SectionMessage = /*#__PURE__*/forwardRef(function SectionMessage(props, ref) {
101
111
  return jsx(GlobalTheme.Consumer, null, function (_ref2) {
102
112
  var mode = _ref2.mode;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.1.13",
3
+ "version": "6.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import type { SectionMessageActionProps } from './types';
3
+ /**
4
+ * __Section message action__
5
+ *
6
+ * A section message action is designed to work with the `action` prop from
7
+ * `SectionMessage`. It renders either a button or a link depending on whether
8
+ * an `onClick` or `href` prop is supplied, with a dot seperator in between actions.
9
+ *
10
+ * - [Examples](https://atlassian.design/components/section-message/examples#actions)
11
+ */
3
12
  declare const SectionMessageAction: import("react").NamedExoticComponent<SectionMessageActionProps>;
4
13
  export default SectionMessageAction;
@@ -1,5 +1,14 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
3
  import type { SectionMessageProps } from './types';
4
+ /**
5
+ * __Section message__
6
+ *
7
+ * A section message is used to alert users to a particular section of the screen.
8
+ *
9
+ * - [Examples](https://atlassian.design/components/section-message/examples)
10
+ * - [Code](https://atlassian.design/components/section-message/code)
11
+ * - [Usage](https://atlassian.design/components/section-message/usage)
12
+ */
4
13
  declare const SectionMessage: React.ForwardRefExoticComponent<SectionMessageProps & React.RefAttributes<HTMLElement>>;
5
14
  export default SectionMessage;
@@ -1,18 +1,57 @@
1
1
  import type { ReactElement } from 'react';
2
2
  import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
- /** Appearance determines the icon and background color pairing indicating the message type */
3
+ /**
4
+ * Appearance determines the icon and background color pairing indicating the message type
5
+ */
4
6
  export declare type Appearance = 'information' | 'warning' | 'error' | 'success' | 'discovery';
5
7
  export interface SectionMessageProps {
6
- /** The appearance styling to use for the section message. */
8
+ /**
9
+ * The appearance styling to use for the section message.
10
+ */
7
11
  appearance?: Appearance;
12
+ /**
13
+ * The main content of the section message. This accepts a react node, although
14
+ * we recommend that this should be a paragraph.
15
+ */
8
16
  children: React.ReactNode;
17
+ /**
18
+ * The heading of the section message.
19
+ */
9
20
  title?: string;
21
+ /**
22
+ * Actions for the user to take after reading the section message. Accepts a ReactElement
23
+ * or an array of one or more SectionMessageAction React elements, which are applied as link buttons.
24
+ * Middle dots are automatically added between multiple link buttons, so no elements
25
+ * should be present between multiple actions.
26
+ *
27
+ * In general, avoid using more than two actions.
28
+ */
10
29
  actions?: ReactElement | ReactElement<SectionMessageActionProps>[];
30
+ /**
31
+ * An Icon component to be rendered instead of the default icon for the component.
32
+ * This should only be an `@atlaskit/icon` icon. You can check out [this example](/packages/design-system/section-message/example/custom-icon)
33
+ * to see how to provide this icon.
34
+ */
11
35
  icon?: React.ElementType;
36
+ /**
37
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
38
+ * in the rendered code, serving as a hook for automated tests.
39
+ */
12
40
  testId?: string;
13
41
  }
14
42
  export interface SectionMessageActionProps {
43
+ /**
44
+ * The text that needs to be displayed for section message action.
45
+ */
15
46
  children: React.ReactNode;
47
+ /**
48
+ * A custom link component. This prop is designed to allow a custom link
49
+ * component to be passed to the rendered link button. The
50
+ * intended use-case is for when a custom router component such as react router
51
+ * is being used within the application.
52
+ *
53
+ * This component will only be used if a href prop is passed.
54
+ */
16
55
  linkComponent?: React.ComponentType<any>;
17
56
  /**
18
57
  * Click handler which will be attached to the rendered link button. The second argument can be used to
@@ -23,5 +62,9 @@ export interface SectionMessageActionProps {
23
62
  * The URL that the rendered link button will point to.
24
63
  */
25
64
  href?: string;
65
+ /**
66
+ * A `testId` prop is a unique string that appears as a data attribute `data-testid`
67
+ * in the rendered code, serving as a hook for automated tests.
68
+ */
26
69
  testId?: string;
27
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/section-message",
3
- "version": "6.1.13",
3
+ "version": "6.2.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/"
@@ -13,28 +13,29 @@
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
15
  "sideEffects": false,
16
- "atlaskit:src": "src/index.ts",
16
+ "atlaskit:src": "src/index.tsx",
17
17
  "atlassian": {
18
18
  "team": "Design System Team",
19
19
  "releaseModel": "scheduled",
20
20
  "website": {
21
- "name": "Section message"
21
+ "name": "Section message",
22
+ "category": "Components"
22
23
  }
23
24
  },
24
25
  "af:exports": {
25
- "./section-message": "./src/entry-points/section-message.ts",
26
- "./section-message-action": "./src/entry-points/section-message-action.ts",
27
- "./types": "./src/entry-points/types.ts",
28
- ".": "./src/index.ts"
26
+ "./section-message": "./src/entry-points/section-message.tsx",
27
+ "./section-message-action": "./src/entry-points/section-message-action.tsx",
28
+ "./types": "./src/entry-points/types.tsx",
29
+ ".": "./src/index.tsx"
29
30
  },
30
31
  "dependencies": {
31
32
  "@atlaskit/button": "^16.3.0",
32
33
  "@atlaskit/codemod-utils": "^4.1.0",
33
34
  "@atlaskit/icon": "^21.10.0",
34
- "@atlaskit/theme": "^12.1.0",
35
+ "@atlaskit/theme": "^12.2.0",
35
36
  "@atlaskit/tokens": "^0.10.0",
36
37
  "@babel/runtime": "^7.0.0",
37
- "@emotion/core": "^10.0.9"
38
+ "@emotion/react": "^11.7.1"
38
39
  },
39
40
  "peerDependencies": {
40
41
  "react": "^16.8.0"
@@ -43,6 +44,7 @@
43
44
  "@atlaskit/analytics-next": "^8.1.2",
44
45
  "@atlaskit/code": "^14.3.0",
45
46
  "@atlaskit/docs": "*",
47
+ "@atlaskit/ds-lib": "^2.1.0",
46
48
  "@atlaskit/range": "^6.0.0",
47
49
  "@atlaskit/ssr": "*",
48
50
  "@atlaskit/visual-regression": "*",
@@ -55,13 +57,15 @@
55
57
  "react-dom": "^16.8.0",
56
58
  "react-test-renderer": "^16.8.0",
57
59
  "storybook-addon-performance": "^0.16.0",
58
- "typescript": "4.2.4"
60
+ "typescript": "4.3.5"
59
61
  },
60
62
  "techstack": {
61
63
  "@atlassian/frontend": {
62
64
  "import-structure": "atlassian-conventions"
63
65
  },
64
66
  "@repo/internal": {
67
+ "design-system": "v1",
68
+ "dom-events": "use-bind-event-listener",
65
69
  "ui-components": "lite-mode",
66
70
  "analytics": "analytics-next",
67
71
  "styling": [
package/report.api.md ADDED
@@ -0,0 +1,57 @@
1
+ ## API Report File for "@atlaskit/section-message"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { NamedExoticComponent } from 'react';
9
+ import { default as React_2 } from 'react';
10
+ import type { ReactElement } from 'react';
11
+ import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
12
+
13
+ /** Appearance determines the icon and background color pairing indicating the message type */
14
+ export declare type Appearance =
15
+ | 'information'
16
+ | 'warning'
17
+ | 'error'
18
+ | 'success'
19
+ | 'discovery';
20
+
21
+ declare const SectionMessage: React_2.ForwardRefExoticComponent<
22
+ SectionMessageProps & React_2.RefAttributes<HTMLElement>
23
+ >;
24
+ export default SectionMessage;
25
+
26
+ export declare const SectionMessageAction: NamedExoticComponent<SectionMessageActionProps>;
27
+
28
+ export declare interface SectionMessageActionProps {
29
+ children: React.ReactNode;
30
+ linkComponent?: React.ComponentType<any>;
31
+ /**
32
+ * Click handler which will be attached to the rendered link button. The second argument can be used to
33
+ * track analytics data. See the tutorial in the analytics-next package for details.
34
+ */
35
+ onClick?: (
36
+ e: React.MouseEvent<HTMLElement>,
37
+ analyticsEvent: UIAnalyticsEvent,
38
+ ) => void;
39
+ /**
40
+ * The URL that the rendered link button will point to.
41
+ */
42
+ href?: string;
43
+ testId?: string;
44
+ }
45
+
46
+ export declare interface SectionMessageProps {
47
+ /** The appearance styling to use for the section message. */
48
+ appearance?: Appearance;
49
+ children: React.ReactNode;
50
+ title?: string;
51
+ actions?: ReactElement | ReactElement<SectionMessageActionProps>[];
52
+ icon?: React.ElementType;
53
+ testId?: string;
54
+ }
55
+
56
+ export {};
57
+ ```