@uncinc/uncinc-react-kitchen-sink 2.18.0 → 2.19.1
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/dist/components/AccessibleLinkDescription/index.d.ts +6 -0
- package/dist/components/AccessibleLinkDescription/index.js +12 -0
- package/dist/components/Button/index.js +22 -11
- package/dist/components/MediaPlayer/index.lazy.js +4 -0
- package/dist/components/MediaPlayer/types.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/setupTests.js +7 -0
- package/dist/styles/assets/_base.scss +12 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
var AccessibleLinkDescription = function AccessibleLinkDescription(_ref) {
|
|
4
|
+
var id = _ref.id;
|
|
5
|
+
var _useTranslation = useTranslation(),
|
|
6
|
+
t = _useTranslation.t;
|
|
7
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
8
|
+
className: "visually-hidden",
|
|
9
|
+
id: id
|
|
10
|
+
}, t(['atoms.accessible_link_description', 'Opens in a new tab']));
|
|
11
|
+
};
|
|
12
|
+
export default AccessibleLinkDescription;
|
|
@@ -6,9 +6,11 @@ import React from 'react';
|
|
|
6
6
|
import { Link } from 'react-router-dom';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import classNames from 'classnames';
|
|
9
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
10
|
import gtm from '../../helpers/gtm';
|
|
10
11
|
import { isExternalLink, isHashLink } from '../../helpers/link';
|
|
11
12
|
import withMapping from '../../Context/withMapping';
|
|
13
|
+
import AccessibleLinkDescription from '../AccessibleLinkDescription';
|
|
12
14
|
import './style.scss';
|
|
13
15
|
export var Button = function Button(_ref) {
|
|
14
16
|
var href = _ref.href,
|
|
@@ -24,6 +26,7 @@ export var Button = function Button(_ref) {
|
|
|
24
26
|
target = _ref.target,
|
|
25
27
|
forwardRef = _ref.forwardRef,
|
|
26
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
+
var accessibleLinkDescriptionId = "accessible-link-description-".concat(uuidv4());
|
|
27
30
|
var classes = classNames('Button', className, {
|
|
28
31
|
'Button--primary': primary,
|
|
29
32
|
'Button--inverted': inverted,
|
|
@@ -46,8 +49,7 @@ export var Button = function Button(_ref) {
|
|
|
46
49
|
// eslint-disable-next-line react/button-has-type
|
|
47
50
|
React.createElement("button", _extends({
|
|
48
51
|
type: htmlType,
|
|
49
|
-
className: classes
|
|
50
|
-
href: href
|
|
52
|
+
className: classes
|
|
51
53
|
}, props, {
|
|
52
54
|
ref: forwardRef,
|
|
53
55
|
onClick: onClick
|
|
@@ -55,35 +57,44 @@ export var Button = function Button(_ref) {
|
|
|
55
57
|
);
|
|
56
58
|
}
|
|
57
59
|
if (isExternalLink(href)) {
|
|
58
|
-
return /*#__PURE__*/React.createElement("a", _extends({
|
|
60
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", _extends({
|
|
59
61
|
className: classes,
|
|
60
62
|
href: href,
|
|
61
63
|
target: "_blank",
|
|
62
64
|
rel: "noreferrer noopener"
|
|
63
65
|
}, props, {
|
|
64
66
|
ref: forwardRef,
|
|
65
|
-
onClick: onClick
|
|
66
|
-
|
|
67
|
+
onClick: onClick,
|
|
68
|
+
"aria-describedby": accessibleLinkDescriptionId
|
|
69
|
+
}), children), /*#__PURE__*/React.createElement(AccessibleLinkDescription, {
|
|
70
|
+
id: accessibleLinkDescriptionId
|
|
71
|
+
}));
|
|
67
72
|
}
|
|
68
73
|
if (isHashLink(href)) {
|
|
69
|
-
return /*#__PURE__*/React.createElement("a", _extends({
|
|
74
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("a", _extends({
|
|
70
75
|
className: classes,
|
|
71
76
|
href: href,
|
|
72
77
|
target: target,
|
|
73
78
|
rel: "noreferrer noopener"
|
|
74
79
|
}, props, {
|
|
75
80
|
ref: forwardRef,
|
|
76
|
-
onClick: onClick
|
|
77
|
-
|
|
81
|
+
onClick: onClick,
|
|
82
|
+
"aria-describedby": target === '_blank' ? accessibleLinkDescriptionId : undefined
|
|
83
|
+
}), children), target === '_blank' && /*#__PURE__*/React.createElement(AccessibleLinkDescription, {
|
|
84
|
+
id: accessibleLinkDescriptionId
|
|
85
|
+
}));
|
|
78
86
|
}
|
|
79
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
87
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Link, _extends({
|
|
80
88
|
to: href,
|
|
81
89
|
className: classes,
|
|
82
90
|
target: target
|
|
83
91
|
}, props, {
|
|
84
92
|
ref: forwardRef,
|
|
85
|
-
onClick: onClick
|
|
86
|
-
|
|
93
|
+
onClick: onClick,
|
|
94
|
+
"aria-describedby": target === '_blank' ? accessibleLinkDescriptionId : undefined
|
|
95
|
+
}), children), target === '_blank' && /*#__PURE__*/React.createElement(AccessibleLinkDescription, {
|
|
96
|
+
id: accessibleLinkDescriptionId
|
|
97
|
+
}));
|
|
87
98
|
};
|
|
88
99
|
Button.defaultProps = {
|
|
89
100
|
primary: true,
|
|
@@ -23,6 +23,7 @@ var MediaPlayer = function MediaPlayer(_ref) {
|
|
|
23
23
|
audioOnly = _ref.audioOnly,
|
|
24
24
|
notSupportedMessage = _ref.notSupportedMessage,
|
|
25
25
|
className = _ref.className,
|
|
26
|
+
onReady = _ref.onReady,
|
|
26
27
|
onPlay = _ref.onPlay,
|
|
27
28
|
_ref$autoPlay = _ref.autoPlay,
|
|
28
29
|
autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
|
|
@@ -95,6 +96,9 @@ var MediaPlayer = function MediaPlayer(_ref) {
|
|
|
95
96
|
// Passing down the VideoJS events.
|
|
96
97
|
useEffect(function () {
|
|
97
98
|
if (ready) {
|
|
99
|
+
if (onReady) {
|
|
100
|
+
onReady(player);
|
|
101
|
+
}
|
|
98
102
|
if (autoPlay && onPlay) {
|
|
99
103
|
player.one('play', function (event) {
|
|
100
104
|
return onPlay(player, event);
|
|
@@ -16,6 +16,7 @@ export type MediaPlayerProps = {
|
|
|
16
16
|
autoPlay?: boolean;
|
|
17
17
|
notSupportedMessage?: string;
|
|
18
18
|
className?: string;
|
|
19
|
+
onReady?: (player: NativeVideoJsPlayer) => void;
|
|
19
20
|
onPlay?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
20
21
|
onPause?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
|
21
22
|
onEnded?: (player: NativeVideoJsPlayer, event: EventTarget) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as Accordion } from "./components/Accordion";
|
|
|
3
3
|
export { default as AccordionItem } from "./components/Accordion/AccordionItem";
|
|
4
4
|
export { default as AccordionItemVariant } from "./components/Accordion/AccordionItemVariant";
|
|
5
5
|
export { default as Button } from "./components/Button";
|
|
6
|
+
export { default as AccessibleLinkDescription } from "./components/AccessibleLinkDescription";
|
|
6
7
|
export { default as Hamburger } from "./components/Hamburger";
|
|
7
8
|
export { default as Image } from "./components/Image";
|
|
8
9
|
export { default as Icon } from "./components/Icon";
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export { default as Accordion } from './components/Accordion';
|
|
|
4
4
|
export { default as AccordionItem } from './components/Accordion/AccordionItem';
|
|
5
5
|
export { default as AccordionItemVariant } from './components/Accordion/AccordionItemVariant';
|
|
6
6
|
export { default as Button } from './components/Button';
|
|
7
|
+
export { default as AccessibleLinkDescription } from './components/AccessibleLinkDescription';
|
|
7
8
|
export { default as Hamburger } from './components/Hamburger';
|
|
8
9
|
export { default as Image } from './components/Image';
|
|
9
10
|
export { default as Icon } from './components/Icon';
|
package/dist/setupTests.js
CHANGED
|
@@ -6,6 +6,18 @@
|
|
|
6
6
|
display: none !important;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
.visually-hidden {
|
|
10
|
+
position: absolute;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
width: 1px;
|
|
13
|
+
height: 1px;
|
|
14
|
+
margin: -1px;
|
|
15
|
+
padding: 0;
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
clip: rect(0, 0, 0, 0);
|
|
18
|
+
border: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
html {
|
|
10
22
|
font-size: 62.5%;
|
|
11
23
|
}
|