@atlaskit/modal-dialog 17.2.7 → 17.3.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 +13 -0
- package/README.md +12 -0
- package/dist/cjs/internal/components/modal-wrapper.js +1 -1
- package/dist/cjs/internal/title-icon-messages.js +19 -0
- package/dist/cjs/modal-title.js +14 -2
- package/dist/es2019/internal/components/modal-wrapper.js +1 -1
- package/dist/es2019/internal/title-icon-messages.js +13 -0
- package/dist/es2019/modal-title.js +13 -1
- package/dist/esm/internal/components/modal-wrapper.js +1 -1
- package/dist/esm/internal/title-icon-messages.js +13 -0
- package/dist/esm/modal-title.js +13 -1
- package/dist/types/internal/title-icon-messages.d.ts +3 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/modal-dialog
|
|
2
2
|
|
|
3
|
+
## 17.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`edde589c7f2d7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/edde589c7f2d7) -
|
|
8
|
+
Integrate modal title warning and danger icon labels with React Intl behind
|
|
9
|
+
platform_modal_title_icon_label, preserving English fallbacks without a provider. Adds a React
|
|
10
|
+
Intl runtime dependency.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 17.2.7
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -12,3 +12,15 @@ yarn add @atlaskit/modal-dialog
|
|
|
12
12
|
|
|
13
13
|
Detailed docs and example usage can be found
|
|
14
14
|
[here](https://atlassian.design/components/modal-dialog/).
|
|
15
|
+
|
|
16
|
+
## Internationalisation
|
|
17
|
+
|
|
18
|
+
With `platform_modal_title_icon_label` enabled, the warning and danger title icons use the
|
|
19
|
+
application's React Intl message catalog. Include translations for
|
|
20
|
+
`modal-dialog.title.warning-icon-label` and `modal-dialog.title.danger-icon-label` in the existing
|
|
21
|
+
`IntlProvider` messages. No additional modal props are needed. Missing translations and applications
|
|
22
|
+
without an `IntlProvider` retain the English labels.
|
|
23
|
+
|
|
24
|
+
The package is registered in `platform/i18n-resources.json` for Traduki extraction. Translation
|
|
25
|
+
catalog publication and inclusion in consuming applications are prerequisites for enabling the gate.
|
|
26
|
+
The localized title example demonstrates the catalog integration.
|
|
@@ -108,7 +108,7 @@ function useModalCloseHandler(providedOnClose) {
|
|
|
108
108
|
action: 'closed',
|
|
109
109
|
componentName: 'modalDialog',
|
|
110
110
|
packageName: "@atlaskit/modal-dialog",
|
|
111
|
-
packageVersion: "17.2.
|
|
111
|
+
packageVersion: "17.2.7"
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
114
|
function getScrollMode(_ref) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.titleIconMessages = void 0;
|
|
7
|
+
var _reactIntl = require("react-intl");
|
|
8
|
+
var titleIconMessages = exports.titleIconMessages = (0, _reactIntl.defineMessages)({
|
|
9
|
+
warning: {
|
|
10
|
+
id: 'modal-dialog.title.warning-icon-label',
|
|
11
|
+
defaultMessage: 'warning',
|
|
12
|
+
description: 'Accessible label for the warning icon inside a modal dialog heading. Identifies the severity of the dialog to screen reader users.'
|
|
13
|
+
},
|
|
14
|
+
danger: {
|
|
15
|
+
id: 'modal-dialog.title.danger-icon-label',
|
|
16
|
+
defaultMessage: 'danger',
|
|
17
|
+
description: 'Accessible label for the error icon inside a modal dialog heading with danger appearance. Indicates a destructive or high-risk action to screen reader users.'
|
|
18
|
+
}
|
|
19
|
+
});
|
package/dist/cjs/modal-title.js
CHANGED
|
@@ -8,11 +8,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
10
|
require("./modal-title.compiled.css");
|
|
11
|
-
var
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
12
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _reactIntl = require("react-intl");
|
|
13
15
|
var _statusError = _interopRequireDefault(require("@atlaskit/icon/core/status-error"));
|
|
14
16
|
var _statusWarning = _interopRequireDefault(require("@atlaskit/icon/core/status-warning"));
|
|
17
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
18
|
var _hooks = require("./hooks");
|
|
19
|
+
var _titleIconMessages = require("./internal/title-icon-messages");
|
|
16
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
21
|
var iconColor = {
|
|
18
22
|
danger: "var(--ds-icon-danger, #C9372C)",
|
|
@@ -24,11 +28,19 @@ var textStyles = null;
|
|
|
24
28
|
var truncatedTextStyles = null;
|
|
25
29
|
var TitleIcon = function TitleIcon(_ref) {
|
|
26
30
|
var appearance = _ref.appearance;
|
|
31
|
+
var intl = (0, _react.useContext)(_reactIntl.IntlContext);
|
|
27
32
|
var Icon = appearance === 'danger' ? _statusError.default : _statusWarning.default;
|
|
33
|
+
var label = appearance;
|
|
34
|
+
if ((0, _fg.fg)('platform_modal_title_icon_label')) {
|
|
35
|
+
var message = _titleIconMessages.titleIconMessages[appearance];
|
|
36
|
+
if (intl && message) {
|
|
37
|
+
label = intl.formatMessage(message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
28
40
|
return /*#__PURE__*/React.createElement("span", {
|
|
29
41
|
className: (0, _runtime.ax)(["_16jlidpf _1o9zidpf _i0dl1wug _syaz1kw7 _1wyb1kw7 _zg8l1kw7 _k48p1kw7 _1dyz1kw7 _vwz41kw7"])
|
|
30
42
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
31
|
-
label:
|
|
43
|
+
label: label,
|
|
32
44
|
color: iconColor[appearance],
|
|
33
45
|
spacing: "spacious"
|
|
34
46
|
}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export const titleIconMessages = defineMessages({
|
|
3
|
+
warning: {
|
|
4
|
+
id: 'modal-dialog.title.warning-icon-label',
|
|
5
|
+
defaultMessage: 'warning',
|
|
6
|
+
description: 'Accessible label for the warning icon inside a modal dialog heading. Identifies the severity of the dialog to screen reader users.'
|
|
7
|
+
},
|
|
8
|
+
danger: {
|
|
9
|
+
id: 'modal-dialog.title.danger-icon-label',
|
|
10
|
+
defaultMessage: 'danger',
|
|
11
|
+
description: 'Accessible label for the error icon inside a modal dialog heading with danger appearance. Indicates a destructive or high-risk action to screen reader users.'
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
import "./modal-title.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useContext } from 'react';
|
|
6
|
+
import { IntlContext } from 'react-intl';
|
|
5
7
|
import ErrorIcon from '@atlaskit/icon/core/status-error';
|
|
6
8
|
import WarningIcon from '@atlaskit/icon/core/status-warning';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
10
|
import { useModal } from './hooks';
|
|
11
|
+
import { titleIconMessages } from './internal/title-icon-messages';
|
|
8
12
|
const iconColor = {
|
|
9
13
|
danger: "var(--ds-icon-danger, #C9372C)",
|
|
10
14
|
warning: "var(--ds-icon-warning, #E06C00)"
|
|
@@ -16,11 +20,19 @@ const truncatedTextStyles = null;
|
|
|
16
20
|
const TitleIcon = ({
|
|
17
21
|
appearance
|
|
18
22
|
}) => {
|
|
23
|
+
const intl = useContext(IntlContext);
|
|
19
24
|
const Icon = appearance === 'danger' ? ErrorIcon : WarningIcon;
|
|
25
|
+
let label = appearance;
|
|
26
|
+
if (fg('platform_modal_title_icon_label')) {
|
|
27
|
+
const message = titleIconMessages[appearance];
|
|
28
|
+
if (intl && message) {
|
|
29
|
+
label = intl.formatMessage(message);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
return /*#__PURE__*/React.createElement("span", {
|
|
21
33
|
className: ax(["_16jlidpf _1o9zidpf _i0dl1wug _syaz1kw7 _1wyb1kw7 _zg8l1kw7 _k48p1kw7 _1dyz1kw7 _vwz41kw7"])
|
|
22
34
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
23
|
-
label:
|
|
35
|
+
label: label,
|
|
24
36
|
color: iconColor[appearance],
|
|
25
37
|
spacing: "spacious"
|
|
26
38
|
}));
|
|
@@ -100,7 +100,7 @@ function useModalCloseHandler(providedOnClose) {
|
|
|
100
100
|
action: 'closed',
|
|
101
101
|
componentName: 'modalDialog',
|
|
102
102
|
packageName: "@atlaskit/modal-dialog",
|
|
103
|
-
packageVersion: "17.2.
|
|
103
|
+
packageVersion: "17.2.7"
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
function getScrollMode(_ref) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export var titleIconMessages = defineMessages({
|
|
3
|
+
warning: {
|
|
4
|
+
id: 'modal-dialog.title.warning-icon-label',
|
|
5
|
+
defaultMessage: 'warning',
|
|
6
|
+
description: 'Accessible label for the warning icon inside a modal dialog heading. Identifies the severity of the dialog to screen reader users.'
|
|
7
|
+
},
|
|
8
|
+
danger: {
|
|
9
|
+
id: 'modal-dialog.title.danger-icon-label',
|
|
10
|
+
defaultMessage: 'danger',
|
|
11
|
+
description: 'Accessible label for the error icon inside a modal dialog heading with danger appearance. Indicates a destructive or high-risk action to screen reader users.'
|
|
12
|
+
}
|
|
13
|
+
});
|
package/dist/esm/modal-title.js
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
import "./modal-title.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useContext } from 'react';
|
|
6
|
+
import { IntlContext } from 'react-intl';
|
|
5
7
|
import ErrorIcon from '@atlaskit/icon/core/status-error';
|
|
6
8
|
import WarningIcon from '@atlaskit/icon/core/status-warning';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
10
|
import { useModal } from './hooks';
|
|
11
|
+
import { titleIconMessages } from './internal/title-icon-messages';
|
|
8
12
|
var iconColor = {
|
|
9
13
|
danger: "var(--ds-icon-danger, #C9372C)",
|
|
10
14
|
warning: "var(--ds-icon-warning, #E06C00)"
|
|
@@ -15,11 +19,19 @@ var textStyles = null;
|
|
|
15
19
|
var truncatedTextStyles = null;
|
|
16
20
|
var TitleIcon = function TitleIcon(_ref) {
|
|
17
21
|
var appearance = _ref.appearance;
|
|
22
|
+
var intl = useContext(IntlContext);
|
|
18
23
|
var Icon = appearance === 'danger' ? ErrorIcon : WarningIcon;
|
|
24
|
+
var label = appearance;
|
|
25
|
+
if (fg('platform_modal_title_icon_label')) {
|
|
26
|
+
var message = titleIconMessages[appearance];
|
|
27
|
+
if (intl && message) {
|
|
28
|
+
label = intl.formatMessage(message);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
19
31
|
return /*#__PURE__*/React.createElement("span", {
|
|
20
32
|
className: ax(["_16jlidpf _1o9zidpf _i0dl1wug _syaz1kw7 _1wyb1kw7 _zg8l1kw7 _k48p1kw7 _1dyz1kw7 _vwz41kw7"])
|
|
21
33
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
22
|
-
label:
|
|
34
|
+
label: label,
|
|
23
35
|
color: iconColor[appearance],
|
|
24
36
|
spacing: "spacious"
|
|
25
37
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/modal-dialog",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.3.0",
|
|
4
4
|
"description": "A modal dialog displays content that requires user interaction, in a layer above the page.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@atlaskit/button": "^25.8.0",
|
|
43
43
|
"@atlaskit/css": "^1.1.0",
|
|
44
44
|
"@atlaskit/ds-lib": "^9.0.0",
|
|
45
|
-
"@atlaskit/icon": "^38.
|
|
45
|
+
"@atlaskit/icon": "^38.2.0",
|
|
46
46
|
"@atlaskit/layering": "^6.1.0",
|
|
47
47
|
"@atlaskit/motion": "^10.0.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"bind-event-listener": "^3.0.0",
|
|
59
59
|
"raf-schd": "^4.0.3",
|
|
60
60
|
"react-focus-lock": "^2.9.5",
|
|
61
|
+
"react-intl": "^7.0.0",
|
|
61
62
|
"react-scrolllock": "^5.0.1"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|