@atlaskit/inline-message 11.2.8 → 11.4.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/inline-message
2
2
 
3
+ ## 11.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bcf29b33526`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bcf29b33526) - 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
+ ## 11.3.1
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
+ ## 11.3.0
20
+
21
+ ### Minor Changes
22
+
23
+ - [`38469010a1c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/38469010a1c) - Replaces usage of the `type` prop with `appearance`.
24
+
3
25
  ## 11.2.8
4
26
 
5
27
  ### Patch Changes
@@ -13,7 +13,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
13
13
 
14
14
  var _react = require("react");
15
15
 
16
- var _core = require("@emotion/core");
16
+ var _react2 = require("@emotion/react");
17
17
 
18
18
  var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button"));
19
19
 
@@ -32,22 +32,22 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
32
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
33
 
34
34
  /** @jsx jsx */
35
- var buttonContentsStyles = (0, _core.css)({
35
+ var buttonContentsStyles = (0, _react2.css)({
36
36
  display: 'flex',
37
37
  alignItems: 'center',
38
38
  textDecoration: 'none'
39
39
  });
40
- var titleStyles = (0, _core.css)({
40
+ var titleStyles = (0, _react2.css)({
41
41
  padding: "0 ".concat(_constants.itemSpacing, "px"),
42
42
  fontWeight: 500
43
43
  });
44
- var textStyles = (0, _core.css)({
44
+ var textStyles = (0, _react2.css)({
45
45
  padding: "0 ".concat(_constants.itemSpacing, "px"),
46
46
  overflow: 'hidden',
47
47
  textOverflow: 'ellipsis',
48
48
  whiteSpace: 'nowrap'
49
49
  });
50
- var rootStyles = (0, _core.css)({
50
+ var rootStyles = (0, _react2.css)({
51
51
  display: 'inline-block',
52
52
  maxWidth: '100%',
53
53
  '&:focus': {
@@ -126,6 +126,7 @@ var InlineMessage = function InlineMessage(_ref) {
126
126
  title = _ref$title === void 0 ? '' : _ref$title,
127
127
  _ref$type = _ref.type,
128
128
  type = _ref$type === void 0 ? 'connectivity' : _ref$type,
129
+ appearance = _ref.appearance,
129
130
  children = _ref.children,
130
131
  testId = _ref.testId,
131
132
  iconLabel = _ref.iconLabel;
@@ -144,34 +145,39 @@ var InlineMessage = function InlineMessage(_ref) {
144
145
  return setIsOpen(false);
145
146
  }, [setIsOpen]);
146
147
  var theme = (0, _components.useGlobalTheme)();
147
- return (0, _core.jsx)("div", {
148
+
149
+ if (!appearance) {
150
+ appearance = type;
151
+ }
152
+
153
+ return (0, _react2.jsx)("div", {
148
154
  css: rootStyles,
149
155
  style: {
150
156
  '--icon-accent-color': iconColor({
151
- appearance: type,
157
+ appearance: appearance,
152
158
  theme: theme
153
159
  })
154
160
  },
155
161
  "data-testid": testId
156
- }, (0, _core.jsx)(_inlineDialog.default, {
162
+ }, (0, _react2.jsx)(_inlineDialog.default, {
157
163
  onClose: onCloseDialog,
158
164
  content: children,
159
165
  isOpen: isOpen,
160
166
  placement: placement,
161
167
  testId: testId && "".concat(testId, "--inline-dialog")
162
- }, (0, _core.jsx)(_customThemeButton.default, {
168
+ }, (0, _react2.jsx)(_customThemeButton.default, {
163
169
  "data-ds--inline-message--button": true,
164
170
  appearance: "subtle-link",
165
171
  onClick: toggleDialog,
166
172
  spacing: "none",
167
173
  testId: testId && "".concat(testId, "--button")
168
- }, (0, _core.jsx)("div", {
174
+ }, (0, _react2.jsx)("div", {
169
175
  css: buttonContentsStyles
170
- }, (0, _core.jsx)(_messageIcon.default, {
176
+ }, (0, _react2.jsx)(_messageIcon.default, {
171
177
  isOpen: isOpen,
172
- appearance: type,
178
+ appearance: appearance,
173
179
  label: iconLabel
174
- }), title && (0, _core.jsx)("span", {
180
+ }), title && (0, _react2.jsx)("span", {
175
181
  style: {
176
182
  color: titleColor({
177
183
  theme: theme
@@ -179,7 +185,7 @@ var InlineMessage = function InlineMessage(_ref) {
179
185
  },
180
186
  css: titleStyles,
181
187
  "data-testid": testId && "".concat(testId, "--title")
182
- }, title), secondaryText && (0, _core.jsx)("span", {
188
+ }, title), secondaryText && (0, _react2.jsx)("span", {
183
189
  style: {
184
190
  color: textColor({
185
191
  theme: theme
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.default = void 0;
9
9
 
10
- var _core = require("@emotion/core");
10
+ var _react = require("@emotion/react");
11
11
 
12
12
  var colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
13
13
 
@@ -42,13 +42,13 @@ var iconColor = (0, _components.themed)('appearance', {
42
42
  dark: "var(--ds-icon-danger, ".concat(colors.R400, ")")
43
43
  }
44
44
  });
45
- var iconWrapperStyles = (0, _core.css)({
45
+ var iconWrapperStyles = (0, _react.css)({
46
46
  display: 'flex',
47
47
  alignItems: 'center',
48
48
  flex: '0 0 auto',
49
49
  color: 'var(--icon-color)'
50
50
  });
51
- var iconColorStyles = (0, _core.css)({
51
+ var iconColorStyles = (0, _react.css)({
52
52
  color: 'var(--icon-accent-color)'
53
53
  });
54
54
  /**
@@ -66,7 +66,7 @@ var SelectedIcon = function SelectedIcon(_ref) {
66
66
  SelectedIcon = _typesMapping$appeara.icon,
67
67
  defaultLabel = _typesMapping$appeara.defaultLabel;
68
68
  var theme = (0, _components.useGlobalTheme)();
69
- return (0, _core.jsx)("span", {
69
+ return (0, _react.jsx)("span", {
70
70
  "data-ds--inline-message--icon": true,
71
71
  style: {
72
72
  '--icon-color': iconColor({
@@ -75,7 +75,7 @@ var SelectedIcon = function SelectedIcon(_ref) {
75
75
  })
76
76
  },
77
77
  css: [iconWrapperStyles, isOpen && iconColorStyles]
78
- }, (0, _core.jsx)(SelectedIcon, {
78
+ }, (0, _react.jsx)(SelectedIcon, {
79
79
  testId: "inline-message-icon",
80
80
  label: label || defaultLabel,
81
81
  size: "medium"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-message",
3
- "version": "11.2.8",
3
+ "version": "11.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { useCallback, useState } from 'react';
3
- import { css, jsx } from '@emotion/core';
3
+ import { css, jsx } from '@emotion/react';
4
4
  import Button from '@atlaskit/button/custom-theme-button';
5
5
  import InlineDialog from '@atlaskit/inline-dialog';
6
6
  import * as colors from '@atlaskit/theme/colors';
@@ -97,6 +97,7 @@ const InlineMessage = ({
97
97
  secondaryText = '',
98
98
  title = '',
99
99
  type = 'connectivity',
100
+ appearance,
100
101
  children,
101
102
  testId,
102
103
  iconLabel
@@ -107,11 +108,16 @@ const InlineMessage = ({
107
108
  }, [setIsOpen]);
108
109
  const onCloseDialog = useCallback(() => setIsOpen(false), [setIsOpen]);
109
110
  const theme = useGlobalTheme();
111
+
112
+ if (!appearance) {
113
+ appearance = type;
114
+ }
115
+
110
116
  return jsx("div", {
111
117
  css: rootStyles,
112
118
  style: {
113
119
  '--icon-accent-color': iconColor({
114
- appearance: type,
120
+ appearance: appearance,
115
121
  theme
116
122
  })
117
123
  },
@@ -132,7 +138,7 @@ const InlineMessage = ({
132
138
  css: buttonContentsStyles
133
139
  }, jsx(MessageIcon, {
134
140
  isOpen: isOpen,
135
- appearance: type,
141
+ appearance: appearance,
136
142
  label: iconLabel
137
143
  }), title && jsx("span", {
138
144
  style: {
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/react';
3
3
  import * as colors from '@atlaskit/theme/colors';
4
4
  import { themed, useGlobalTheme } from '@atlaskit/theme/components';
5
5
  import { typesMapping } from '../../constants';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-message",
3
- "version": "11.2.8",
3
+ "version": "11.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
 
3
3
  /** @jsx jsx */
4
4
  import { useCallback, useState } from 'react';
5
- import { css, jsx } from '@emotion/core';
5
+ import { css, jsx } from '@emotion/react';
6
6
  import Button from '@atlaskit/button/custom-theme-button';
7
7
  import InlineDialog from '@atlaskit/inline-dialog';
8
8
  import * as colors from '@atlaskit/theme/colors';
@@ -103,6 +103,7 @@ var InlineMessage = function InlineMessage(_ref) {
103
103
  title = _ref$title === void 0 ? '' : _ref$title,
104
104
  _ref$type = _ref.type,
105
105
  type = _ref$type === void 0 ? 'connectivity' : _ref$type,
106
+ appearance = _ref.appearance,
106
107
  children = _ref.children,
107
108
  testId = _ref.testId,
108
109
  iconLabel = _ref.iconLabel;
@@ -121,11 +122,16 @@ var InlineMessage = function InlineMessage(_ref) {
121
122
  return setIsOpen(false);
122
123
  }, [setIsOpen]);
123
124
  var theme = useGlobalTheme();
125
+
126
+ if (!appearance) {
127
+ appearance = type;
128
+ }
129
+
124
130
  return jsx("div", {
125
131
  css: rootStyles,
126
132
  style: {
127
133
  '--icon-accent-color': iconColor({
128
- appearance: type,
134
+ appearance: appearance,
129
135
  theme: theme
130
136
  })
131
137
  },
@@ -146,7 +152,7 @@ var InlineMessage = function InlineMessage(_ref) {
146
152
  css: buttonContentsStyles
147
153
  }, jsx(MessageIcon, {
148
154
  isOpen: isOpen,
149
- appearance: type,
155
+ appearance: appearance,
150
156
  label: iconLabel
151
157
  }), title && jsx("span", {
152
158
  style: {
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/react';
3
3
  import * as colors from '@atlaskit/theme/colors';
4
4
  import { themed, useGlobalTheme } from '@atlaskit/theme/components';
5
5
  import { typesMapping } from '../../constants';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-message",
3
- "version": "11.2.8",
3
+ "version": "11.4.0",
4
4
  "sideEffects": false
5
5
  }
@@ -23,6 +23,12 @@ interface InlineMessageProps {
23
23
  * Set the icon to be used before the title. Options are: connectivity,
24
24
  * confirmation, info, warning, and error.
25
25
  */
26
+ appearance?: IconAppearance;
27
+ /**
28
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-5207 for more information.
29
+ * Instead use the 'appearance' prop.
30
+ * Set the icon to be used before the title.
31
+ */
26
32
  type?: IconAppearance;
27
33
  /**
28
34
  A unique string that appears as a data attribute, `data-testid`,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-message",
3
- "version": "11.2.8",
3
+ "version": "11.4.0",
4
4
  "description": "An inline message lets users know when important information is available or when an action is required.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
7
7
  },
8
- "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
9
9
  "author": "Atlassian Pty Ltd",
10
10
  "license": "Apache-2.0",
11
11
  "main": "dist/cjs/index.js",
@@ -19,24 +19,26 @@
19
19
  "deprecatedAutoEntryPoints": true,
20
20
  "releaseModel": "scheduled",
21
21
  "website": {
22
- "name": "Inline message"
22
+ "name": "Inline message",
23
+ "category": "Components"
23
24
  }
24
25
  },
25
26
  "dependencies": {
26
27
  "@atlaskit/button": "^16.3.0",
27
28
  "@atlaskit/icon": "^21.10.0",
28
- "@atlaskit/inline-dialog": "^13.3.0",
29
- "@atlaskit/theme": "^12.1.0",
29
+ "@atlaskit/inline-dialog": "^13.4.0",
30
+ "@atlaskit/theme": "^12.2.0",
30
31
  "@atlaskit/tokens": "^0.10.0",
31
32
  "@babel/runtime": "^7.0.0",
32
- "@emotion/core": "^10.0.9"
33
+ "@emotion/react": "^11.7.1"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "react": "^16.8.0"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@atlaskit/docs": "*",
39
- "@atlaskit/section-message": "^6.1.0",
40
+ "@atlaskit/ds-lib": "^2.0.1",
41
+ "@atlaskit/section-message": "^6.2.0",
40
42
  "@atlaskit/ssr": "*",
41
43
  "@atlaskit/visual-regression": "*",
42
44
  "@atlaskit/webdriver-runner": "*",
@@ -44,7 +46,7 @@
44
46
  "@testing-library/react": "^8.0.1",
45
47
  "enzyme": "^3.10.0",
46
48
  "react-dom": "^16.8.0",
47
- "typescript": "4.2.4"
49
+ "typescript": "4.3.5"
48
50
  },
49
51
  "keywords": [
50
52
  "atlaskit",
@@ -56,6 +58,7 @@
56
58
  "import-structure": "atlassian-conventions"
57
59
  },
58
60
  "@repo/internal": {
61
+ "dom-events": "use-bind-event-listener",
59
62
  "design-system": "v1",
60
63
  "styling": [
61
64
  "static",
package/report.api.md ADDED
@@ -0,0 +1,100 @@
1
+ ## API Report File for "@atlaskit/inline-message"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ````ts
6
+ import { FC } from 'react';
7
+ import { ReactNode } from 'react';
8
+
9
+ declare type IconAppearance =
10
+ | 'connectivity'
11
+ | 'confirmation'
12
+ | 'info'
13
+ | 'warning'
14
+ | 'error';
15
+
16
+ declare type InlineDialogPlacement =
17
+ | 'auto-start'
18
+ | 'auto'
19
+ | 'auto-end'
20
+ | 'top-start'
21
+ | 'top'
22
+ | 'top-end'
23
+ | 'right-start'
24
+ | 'right'
25
+ | 'right-end'
26
+ | 'bottom-end'
27
+ | 'bottom'
28
+ | 'bottom-start'
29
+ | 'left-end'
30
+ | 'left'
31
+ | 'left-start';
32
+
33
+ /**
34
+ * __Inline message__
35
+ *
36
+ * An inline message lets users know when important information is available or when an action is required.
37
+ *
38
+ * - [Examples](https://atlassian.design/components/inline-message/examples)
39
+ * - [Code](https://atlassian.design/components/inline-message/code)
40
+ * - [Usage](https://atlassian.design/components/inline-message/usage)
41
+ *
42
+ * @example
43
+ *
44
+ * ```jsx
45
+ * const Component = () => (
46
+ * <InlineMessage
47
+ * title="Inline Message Title Example"
48
+ * secondaryText="Secondary Text"
49
+ * >
50
+ * <p>Some text that would be inside the open dialog and otherwise hidden.</p>
51
+ * </InlineMessage>
52
+ * );
53
+ * ```
54
+ */
55
+ declare const InlineMessage: FC<InlineMessageProps>;
56
+ export default InlineMessage;
57
+
58
+ declare interface InlineMessageProps {
59
+ /**
60
+ * The elements to be displayed by the inline dialog.
61
+ */
62
+ children?: ReactNode;
63
+ /**
64
+ * The placement to be passed to the inline dialog. Determines where around
65
+ * the text the dialog is displayed.
66
+ */
67
+ placement?: InlineDialogPlacement;
68
+ /**
69
+ * Text to display second.
70
+ */
71
+ secondaryText?: ReactNode;
72
+ /**
73
+ * Text to display first, bolded for emphasis.
74
+ */
75
+ title?: ReactNode;
76
+ /**
77
+ * Set the icon to be used before the title. Options are: connectivity,
78
+ * confirmation, info, warning, and error.
79
+ */
80
+ type?: IconAppearance;
81
+ /**
82
+ A unique string that appears as a data attribute, `data-testid`,
83
+ in the rendered code. It is provided to serve as a hook for automated tests.
84
+
85
+ The value of `testId` is attached to the different sub-components in Inline Message:
86
+ - `testId`: the top-level inline message component
87
+ - `testId--inline-dialog`: the content of the message
88
+ - `testId--button`: the button element that opens the dialog on press
89
+ - `testId--title`: the title of the message
90
+ - `testId--text`: the text of the message
91
+ */
92
+ testId?: string;
93
+ /**
94
+ * Text to be used as label for the button icon. Can be used to provide useful information for users with screen readers when there is no title and/or secondaryText
95
+ */
96
+ iconLabel?: string;
97
+ }
98
+
99
+ export {};
100
+ ````