@micromag/element-webview 0.3.491 → 0.3.497

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.
Files changed (3) hide show
  1. package/es/index.js +21 -10
  2. package/lib/index.js +21 -10
  3. package/package.json +4 -4
package/es/index.js CHANGED
@@ -2,15 +2,13 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
2
  import classNames from 'classnames';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
+ import { useIntl } from 'react-intl';
5
6
  import { Close } from '@micromag/core/components';
6
7
  import Button from '@micromag/element-button';
7
8
 
8
9
  var styles = {"container":"micromag-element-webview-container","close":"micromag-element-webview-close","iframe":"micromag-element-webview-iframe","top":"micromag-element-webview-top","icon":"micromag-element-webview-icon"};
9
10
 
10
11
  var propTypes = {
11
- iframeRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
12
- current: PropTypes.any // eslint-disable-line
13
- })]),
14
12
  url: PropTypes.string,
15
13
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
16
14
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -20,7 +18,6 @@ var propTypes = {
20
18
  className: PropTypes.string
21
19
  };
22
20
  var defaultProps = {
23
- iframeRef: null,
24
21
  url: null,
25
22
  width: null,
26
23
  height: null,
@@ -30,16 +27,16 @@ var defaultProps = {
30
27
  className: null
31
28
  };
32
29
  function WebView(_ref) {
33
- var iframeRef = _ref.iframeRef,
34
- url = _ref.url,
30
+ var url = _ref.url,
35
31
  width = _ref.width,
36
32
  height = _ref.height,
37
33
  closeable = _ref.closeable,
38
34
  focusable = _ref.focusable,
39
35
  onClose = _ref.onClose,
40
36
  className = _ref.className;
37
+ var intl = useIntl();
41
38
  return /*#__PURE__*/React.createElement("div", {
42
- className: classNames([styles.container, _defineProperty(_defineProperty({}, styles.closeable, closeable), className, className !== null)]),
39
+ className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty({}, styles.hidden, !focusable), styles.closeable, closeable), className, className !== null)]),
43
40
  style: {
44
41
  width: width,
45
42
  height: height
@@ -48,14 +45,28 @@ function WebView(_ref) {
48
45
  className: styles.top
49
46
  }, /*#__PURE__*/React.createElement(Button, {
50
47
  className: styles.close,
48
+ "aria-label": intl.formatMessage({
49
+ id: "cXt3NU",
50
+ defaultMessage: [{
51
+ "type": 0,
52
+ "value": "Close Popup"
53
+ }]
54
+ }),
55
+ focusable: focusable,
51
56
  onClick: onClose
52
57
  }, /*#__PURE__*/React.createElement(Close, {
53
58
  className: styles.closeIcon
54
59
  }))) : null, /*#__PURE__*/React.createElement("iframe", {
55
60
  className: styles.iframe,
56
- tabIndex: !focusable ? -1 : null,
57
- ref: iframeRef,
58
- title: "Popup",
61
+ "aria-hidden": !focusable ? 'true' : null,
62
+ tabIndex: focusable ? '0' : '-1',
63
+ title: intl.formatMessage({
64
+ id: "17zT4Q",
65
+ defaultMessage: [{
66
+ "type": 0,
67
+ "value": "Popup"
68
+ }]
69
+ }),
59
70
  src: url || 'about:blank'
60
71
  }));
61
72
  }
package/lib/index.js CHANGED
@@ -4,15 +4,13 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
4
  var classNames = require('classnames');
5
5
  var PropTypes = require('prop-types');
6
6
  var React = require('react');
7
+ var reactIntl = require('react-intl');
7
8
  var components = require('@micromag/core/components');
8
9
  var Button = require('@micromag/element-button');
9
10
 
10
11
  var styles = {"container":"micromag-element-webview-container","close":"micromag-element-webview-close","iframe":"micromag-element-webview-iframe","top":"micromag-element-webview-top","icon":"micromag-element-webview-icon"};
11
12
 
12
13
  var propTypes = {
13
- iframeRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
14
- current: PropTypes.any // eslint-disable-line
15
- })]),
16
14
  url: PropTypes.string,
17
15
  width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
18
16
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -22,7 +20,6 @@ var propTypes = {
22
20
  className: PropTypes.string
23
21
  };
24
22
  var defaultProps = {
25
- iframeRef: null,
26
23
  url: null,
27
24
  width: null,
28
25
  height: null,
@@ -32,16 +29,16 @@ var defaultProps = {
32
29
  className: null
33
30
  };
34
31
  function WebView(_ref) {
35
- var iframeRef = _ref.iframeRef,
36
- url = _ref.url,
32
+ var url = _ref.url,
37
33
  width = _ref.width,
38
34
  height = _ref.height,
39
35
  closeable = _ref.closeable,
40
36
  focusable = _ref.focusable,
41
37
  onClose = _ref.onClose,
42
38
  className = _ref.className;
39
+ var intl = reactIntl.useIntl();
43
40
  return /*#__PURE__*/React.createElement("div", {
44
- className: classNames([styles.container, _defineProperty(_defineProperty({}, styles.closeable, closeable), className, className !== null)]),
41
+ className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty({}, styles.hidden, !focusable), styles.closeable, closeable), className, className !== null)]),
45
42
  style: {
46
43
  width: width,
47
44
  height: height
@@ -50,14 +47,28 @@ function WebView(_ref) {
50
47
  className: styles.top
51
48
  }, /*#__PURE__*/React.createElement(Button, {
52
49
  className: styles.close,
50
+ "aria-label": intl.formatMessage({
51
+ id: "cXt3NU",
52
+ defaultMessage: [{
53
+ "type": 0,
54
+ "value": "Close Popup"
55
+ }]
56
+ }),
57
+ focusable: focusable,
53
58
  onClick: onClose
54
59
  }, /*#__PURE__*/React.createElement(components.Close, {
55
60
  className: styles.closeIcon
56
61
  }))) : null, /*#__PURE__*/React.createElement("iframe", {
57
62
  className: styles.iframe,
58
- tabIndex: !focusable ? -1 : null,
59
- ref: iframeRef,
60
- title: "Popup",
63
+ "aria-hidden": !focusable ? 'true' : null,
64
+ tabIndex: focusable ? '0' : '-1',
65
+ title: intl.formatMessage({
66
+ id: "17zT4Q",
67
+ defaultMessage: [{
68
+ "type": 0,
69
+ "value": "Popup"
70
+ }]
71
+ }),
61
72
  src: url || 'about:blank'
62
73
  }));
63
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/element-webview",
3
- "version": "0.3.491",
3
+ "version": "0.3.497",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -63,8 +63,8 @@
63
63
  "@fortawesome/fontawesome-svg-core": "^1.2.32",
64
64
  "@fortawesome/free-solid-svg-icons": "^5.15.1",
65
65
  "@fortawesome/react-fontawesome": "^0.1.13",
66
- "@micromag/core": "^0.3.491",
67
- "@micromag/element-button": "^0.3.491",
66
+ "@micromag/core": "^0.3.497",
67
+ "@micromag/element-button": "^0.3.497",
68
68
  "classnames": "^2.2.6",
69
69
  "lodash": "^4.17.21",
70
70
  "prop-types": "^15.7.2",
@@ -75,5 +75,5 @@
75
75
  "access": "public",
76
76
  "registry": "https://registry.npmjs.org/"
77
77
  },
78
- "gitHead": "d4af8a992fad6d8d50e41e347a4b92e6e025b984"
78
+ "gitHead": "94e795f19f551f20411fb12fada0906c5cdb0d4b"
79
79
  }