@uncinc/uncinc-react-kitchen-sink 2.20.10 → 2.20.12
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/Dialog/index.js +5 -3
- package/dist/components/Form/TextField/index.js +1 -1
- package/dist/components/MediaPlayer/index.lazy.js +52 -0
- package/dist/components/MediaPlayer/types.d.ts +5 -1
- package/dist/config/i18next/locales/en.json +3 -1
- package/dist/config/i18next/locales/nl.json +3 -1
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { RemoveScroll } from 'react-remove-scroll';
|
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import classnames from 'classnames';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
13
|
import useDialogHelpers from '../../hooks/useDialogHelpers';
|
|
13
14
|
import './style.scss';
|
|
14
15
|
var Dialog = function Dialog(props) {
|
|
@@ -37,14 +38,15 @@ var Dialog = function Dialog(props) {
|
|
|
37
38
|
var TitleComponent = titleComponent;
|
|
38
39
|
var WrapperComponent = wrapperComponent;
|
|
39
40
|
var BackdropComponent = backdropComponent;
|
|
41
|
+
var uuid = uuidv4();
|
|
40
42
|
var _useDialogHelpers = useDialogHelpers({
|
|
41
43
|
id: id,
|
|
42
44
|
wrapperElement: wrapper,
|
|
43
45
|
closeFunction: closeFunction,
|
|
44
46
|
isOpen: isOpen,
|
|
45
|
-
disableClosers: disableClosers
|
|
47
|
+
disableClosers: disableClosers,
|
|
48
|
+
ariaLabelledBy: uuid
|
|
46
49
|
}),
|
|
47
|
-
labelId = _useDialogHelpers.labelId,
|
|
48
50
|
dialogHelpersProps = _useDialogHelpers.dialogHelpersProps,
|
|
49
51
|
dialogId = _useDialogHelpers.id;
|
|
50
52
|
if (!isOpen) return null;
|
|
@@ -56,7 +58,7 @@ var Dialog = function Dialog(props) {
|
|
|
56
58
|
}, dialogHelpersProps, {
|
|
57
59
|
forwardRef: wrapper
|
|
58
60
|
}), /*#__PURE__*/React.createElement("div", {
|
|
59
|
-
id:
|
|
61
|
+
id: uuid,
|
|
60
62
|
className: "Dialog__sr-only"
|
|
61
63
|
}, dialogLabel), TitleComponent && /*#__PURE__*/React.createElement("div", {
|
|
62
64
|
className: "Dialog__title"
|
|
@@ -99,7 +99,7 @@ export var TextField = function TextField(props) {
|
|
|
99
99
|
onKeyUp: handleChange,
|
|
100
100
|
"aria-describedby": "".concat(error && isTouched ? errorId : '', " ").concat(description ? descriptionId : '').trim() || undefined,
|
|
101
101
|
"aria-invalid": Boolean(error && isTouched),
|
|
102
|
-
autoComplete: autoCompleteField
|
|
102
|
+
autoComplete: autoCompleteField || undefined,
|
|
103
103
|
type: revealPassword ? 'text' : inputType,
|
|
104
104
|
value: value,
|
|
105
105
|
disabled: disabled,
|
|
@@ -8,10 +8,12 @@ import React, { useEffect, useMemo } from 'react';
|
|
|
8
8
|
import c from 'classnames';
|
|
9
9
|
import { useVideoJS } from 'react-hook-videojs';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import VideoJSTypes from 'video.js';
|
|
11
12
|
import 'video.js/dist/video-js.css';
|
|
12
13
|
import './style.scss';
|
|
13
14
|
var MediaPlayer = function MediaPlayer(_ref) {
|
|
14
15
|
var src = _ref.src,
|
|
16
|
+
altVideoSrc = _ref.altVideoSrc,
|
|
15
17
|
type = _ref.type,
|
|
16
18
|
controls = _ref.controls,
|
|
17
19
|
posterUrl = _ref.posterUrl,
|
|
@@ -44,6 +46,7 @@ var MediaPlayer = function MediaPlayer(_ref) {
|
|
|
44
46
|
duration: 'durationDisplay',
|
|
45
47
|
seekbar: 'progressControl',
|
|
46
48
|
captions: 'subsCapsButton',
|
|
49
|
+
audioDescription: 'audioTrackButton',
|
|
47
50
|
volume: 'volumePanel',
|
|
48
51
|
fullscreen: 'fullscreenToggle'
|
|
49
52
|
};
|
|
@@ -96,6 +99,55 @@ var MediaPlayer = function MediaPlayer(_ref) {
|
|
|
96
99
|
if (onReady) {
|
|
97
100
|
onReady(player);
|
|
98
101
|
}
|
|
102
|
+
if (altVideoSrc) {
|
|
103
|
+
var audioTracks = player.audioTracks();
|
|
104
|
+
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
audioTracks.addTrack(new VideoJSTypes.AudioTrack({
|
|
107
|
+
id: 'main',
|
|
108
|
+
kind: 'main',
|
|
109
|
+
label: t('organisms.media_player.standard_audio'),
|
|
110
|
+
language: altVideoSrc.language,
|
|
111
|
+
enabled: true
|
|
112
|
+
}));
|
|
113
|
+
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
audioTracks.addTrack(new VideoJSTypes.AudioTrack({
|
|
116
|
+
id: 'ad',
|
|
117
|
+
kind: 'alternative',
|
|
118
|
+
label: t('organisms.media_player.alt_audio'),
|
|
119
|
+
language: altVideoSrc.language,
|
|
120
|
+
enabled: false
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
// Handle switching
|
|
124
|
+
audioTracks.on('change', function () {
|
|
125
|
+
var currentTime = player.currentTime();
|
|
126
|
+
var isPaused = player.paused();
|
|
127
|
+
var activeTrack = Array.from(audioTracks).find(function (track) {
|
|
128
|
+
return track.enabled;
|
|
129
|
+
});
|
|
130
|
+
if (!activeTrack) return;
|
|
131
|
+
if (activeTrack.id === 'ad') {
|
|
132
|
+
player.src({
|
|
133
|
+
src: altVideoSrc.src,
|
|
134
|
+
type: type
|
|
135
|
+
});
|
|
136
|
+
} else {
|
|
137
|
+
player.src({
|
|
138
|
+
src: src,
|
|
139
|
+
type: type
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
player.one('loadedmetadata', function () {
|
|
143
|
+
player.currentTime(currentTime);
|
|
144
|
+
if (!isPaused) {
|
|
145
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
146
|
+
player.play();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
99
151
|
if (autoPlay && onPlay) {
|
|
100
152
|
player.one('play', function (event) {
|
|
101
153
|
return onPlay(player, event);
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { VideoJsPlayer as NativeVideoJsPlayer, VideoJsPlayerOptions } from 'video.js';
|
|
2
2
|
export type MimeType = 'audio/3gpp' | 'audio/aac' | 'audio/flac' | 'audio/mpeg' | 'audio/mp3' | 'audio/mp4' | 'audio/ogg' | 'audio/wav' | 'audio/webm' | 'video/3gpp' | 'video/mpeg' | 'video/mpeg' | 'video/mp4' | 'video/ogg' | 'video/quicktime' | 'video/webm' | 'video/youtube' | 'video/vimeo';
|
|
3
|
-
export type Control = 'play' | 'currentTime' | 'timeDivider' | 'duration' | 'seekbar' | 'captions' | 'volume' | 'fullscreen';
|
|
3
|
+
export type Control = 'play' | 'currentTime' | 'timeDivider' | 'duration' | 'seekbar' | 'captions' | 'volume' | 'fullscreen' | 'audioDescription';
|
|
4
4
|
export type VideoJSControls = {
|
|
5
5
|
[K in Control]: string;
|
|
6
6
|
};
|
|
7
7
|
export type VideoJsPlayer = NativeVideoJsPlayer;
|
|
8
8
|
export type MediaPlayerProps = {
|
|
9
9
|
src: string;
|
|
10
|
+
altVideoSrc?: {
|
|
11
|
+
src: string;
|
|
12
|
+
language: string;
|
|
13
|
+
};
|
|
10
14
|
type: MimeType;
|
|
11
15
|
controls?: Control[] | false;
|
|
12
16
|
posterUrl?: string;
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
},
|
|
35
35
|
"organisms": {
|
|
36
36
|
"media_player": {
|
|
37
|
-
"not_supported_message": "The current file cannot be played."
|
|
37
|
+
"not_supported_message": "The current file cannot be played.",
|
|
38
|
+
"standard_audio" : "Standard audio",
|
|
39
|
+
"alt_audio": "Alternative audio"
|
|
38
40
|
},
|
|
39
41
|
"text": {
|
|
40
42
|
"read_more": "Read more",
|
|
@@ -72,7 +72,9 @@
|
|
|
72
72
|
},
|
|
73
73
|
"organisms": {
|
|
74
74
|
"media_player": {
|
|
75
|
-
"not_supported_message": "Het huidige bestand kan niet worden afgespeeld."
|
|
75
|
+
"not_supported_message": "Het huidige bestand kan niet worden afgespeeld.",
|
|
76
|
+
"standard_audio" : "Standaard audio",
|
|
77
|
+
"alt_audio": "Alternatieve audio"
|
|
76
78
|
},
|
|
77
79
|
"text": {
|
|
78
80
|
"read_more": "Lees meer",
|