grommet 2.23.0 → 2.24.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/components/Anchor/Anchor.js +2 -3
- package/components/CheckBoxGroup/index.d.ts +1 -3
- package/components/DataTable/stories/SpaceX.js +6 -4
- package/components/DataTable/stories/SpaceXUngrouped.js +4 -2
- package/components/Drop/DropContainer.js +6 -2
- package/components/FileInput/index.d.ts +6 -1
- package/components/Form/stories/HelpAndError.js +1 -1
- package/components/Grid/index.d.ts +6 -2
- package/components/Layer/Layer.js +1 -1
- package/components/Layer/LayerContainer.js +6 -2
- package/components/List/List.js +103 -40
- package/components/List/index.d.ts +3 -1
- package/components/List/propTypes.js +3 -1
- package/components/List/stories/Disabled.js +33 -0
- package/components/Notification/Notification.js +17 -8
- package/components/Notification/index.d.ts +1 -0
- package/components/Notification/propTypes.js +1 -0
- package/components/PageHeader/PageHeader.js +80 -0
- package/components/PageHeader/index.d.ts +26 -0
- package/components/PageHeader/index.js +8 -0
- package/components/PageHeader/propTypes.js +30 -0
- package/components/PageHeader/stories/Custom.js +47 -0
- package/components/PageHeader/stories/MultipleActions.js +79 -0
- package/components/PageHeader/stories/Responsive.js +37 -0
- package/components/PageHeader/stories/Simple.js +36 -0
- package/components/RadioButtonGroup/index.d.ts +2 -1
- package/components/Select/Select.js +0 -2
- package/components/Select/SelectContainer.js +9 -0
- package/components/Table/StyledTable.js +1 -1
- package/components/TextInput/TextInput.js +32 -3
- package/components/TextInput/stories/DefaultSuggestion.js +1 -0
- package/components/TextInput/stories/Suggestions.js +1 -0
- package/components/Tip/Tip.js +18 -6
- package/components/Video/Video.js +100 -46
- package/components/Video/index.d.ts +1 -0
- package/components/Video/propTypes.js +1 -1
- package/components/Video/stories/typescript/ControlsBelow.tsx +6 -2
- package/components/index.d.ts +1 -0
- package/components/index.js +8 -0
- package/es6/components/Anchor/Anchor.js +2 -3
- package/es6/components/CheckBoxGroup/index.d.ts +1 -3
- package/es6/components/DataTable/stories/SpaceX.js +6 -4
- package/es6/components/DataTable/stories/SpaceXUngrouped.js +4 -2
- package/es6/components/Drop/DropContainer.js +4 -2
- package/es6/components/FileInput/index.d.ts +6 -1
- package/es6/components/Form/stories/HelpAndError.js +1 -1
- package/es6/components/Grid/index.d.ts +6 -2
- package/es6/components/Layer/Layer.js +1 -1
- package/es6/components/Layer/LayerContainer.js +4 -2
- package/es6/components/List/List.js +104 -41
- package/es6/components/List/index.d.ts +3 -1
- package/es6/components/List/propTypes.js +3 -1
- package/es6/components/List/stories/Disabled.js +20 -0
- package/es6/components/Notification/Notification.js +17 -8
- package/es6/components/Notification/index.d.ts +1 -0
- package/es6/components/Notification/propTypes.js +1 -0
- package/es6/components/PageHeader/PageHeader.js +63 -0
- package/es6/components/PageHeader/index.d.ts +26 -0
- package/es6/components/PageHeader/index.js +1 -0
- package/es6/components/PageHeader/propTypes.js +19 -0
- package/es6/components/PageHeader/stories/Custom.js +32 -0
- package/es6/components/PageHeader/stories/MultipleActions.js +63 -0
- package/es6/components/PageHeader/stories/Responsive.js +25 -0
- package/es6/components/PageHeader/stories/Simple.js +24 -0
- package/es6/components/RadioButtonGroup/index.d.ts +2 -1
- package/es6/components/Select/Select.js +0 -2
- package/es6/components/Select/SelectContainer.js +9 -0
- package/es6/components/Table/StyledTable.js +1 -1
- package/es6/components/TextInput/TextInput.js +32 -3
- package/es6/components/TextInput/stories/DefaultSuggestion.js +1 -0
- package/es6/components/TextInput/stories/Suggestions.js +1 -0
- package/es6/components/Tip/Tip.js +18 -6
- package/es6/components/Video/Video.js +99 -46
- package/es6/components/Video/index.d.ts +1 -0
- package/es6/components/Video/propTypes.js +1 -1
- package/es6/components/Video/stories/typescript/ControlsBelow.tsx +6 -2
- package/es6/components/index.d.ts +1 -0
- package/es6/components/index.js +1 -0
- package/es6/languages/default.json +4 -1
- package/es6/themes/base.d.ts +47 -7
- package/es6/themes/base.js +72 -1
- package/grommet.min.js +1 -1
- package/grommet.min.js.map +1 -1
- package/languages/default.json +4 -1
- package/package.json +30 -26
- package/themes/base.d.ts +47 -7
- package/themes/base.js +73 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Anchor, Button, PageHeader, Page, PageContent } from 'grommet';
|
|
3
|
+
export var Responsive = function Responsive() {
|
|
4
|
+
return (
|
|
5
|
+
/*#__PURE__*/
|
|
6
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
7
|
+
// <Grommet theme={...}>
|
|
8
|
+
React.createElement(Page, null, /*#__PURE__*/React.createElement(PageContent, null, /*#__PURE__*/React.createElement(PageHeader, {
|
|
9
|
+
title: "Grommet",
|
|
10
|
+
subtitle: "Responsive allows PageHeader layout to switch to a \n single column at responsive breakpoints specified in the theme.",
|
|
11
|
+
actions: /*#__PURE__*/React.createElement(Button, {
|
|
12
|
+
label: "Get Started",
|
|
13
|
+
primary: true
|
|
14
|
+
}),
|
|
15
|
+
parent: /*#__PURE__*/React.createElement(Anchor, {
|
|
16
|
+
label: "Parent Page"
|
|
17
|
+
}),
|
|
18
|
+
responsive: true
|
|
19
|
+
}))) // </Grommet>
|
|
20
|
+
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export default {
|
|
24
|
+
title: 'Layout/PageHeader/Responsive'
|
|
25
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Anchor, Button, PageHeader, Page, PageContent } from 'grommet';
|
|
3
|
+
export var Simple = function Simple() {
|
|
4
|
+
return (
|
|
5
|
+
/*#__PURE__*/
|
|
6
|
+
// Uncomment <Grommet> lines when using outside of storybook
|
|
7
|
+
// <Grommet theme={...}>
|
|
8
|
+
React.createElement(Page, null, /*#__PURE__*/React.createElement(PageContent, null, /*#__PURE__*/React.createElement(PageHeader, {
|
|
9
|
+
title: "Grommet",
|
|
10
|
+
subtitle: "Grommet helps you build responsive and accessible \n mobile-first projects for the web with an easy to use component \n library.",
|
|
11
|
+
actions: /*#__PURE__*/React.createElement(Button, {
|
|
12
|
+
label: "Get Started",
|
|
13
|
+
primary: true
|
|
14
|
+
}),
|
|
15
|
+
parent: /*#__PURE__*/React.createElement(Anchor, {
|
|
16
|
+
label: "Parent Page"
|
|
17
|
+
})
|
|
18
|
+
}))) // </Grommet>
|
|
19
|
+
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export default {
|
|
23
|
+
title: 'Layout/PageHeader/Simple'
|
|
24
|
+
};
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { BoxProps } from '../Box/index';
|
|
3
3
|
|
|
4
4
|
export interface RadioButtonGroupProps {
|
|
5
|
+
children?: Function;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
name: string;
|
|
7
8
|
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
@@ -22,7 +23,7 @@ export interface RadioButtonGroupProps {
|
|
|
22
23
|
export interface RadioButtonGroupExtendedProps
|
|
23
24
|
extends RadioButtonGroupProps,
|
|
24
25
|
BoxProps,
|
|
25
|
-
Omit<JSX.IntrinsicElements['div'], 'onClick' | 'onChange'> {}
|
|
26
|
+
Omit<JSX.IntrinsicElements['div'], 'children' | 'onClick' | 'onChange'> {}
|
|
26
27
|
|
|
27
28
|
declare const RadioButtonGroup: React.FC<RadioButtonGroupExtendedProps>;
|
|
28
29
|
|
|
@@ -255,6 +255,15 @@ var SelectContainer = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
255
255
|
var nextActiveIndex = activeIndex - 1;
|
|
256
256
|
var clearButton = clearRef.current;
|
|
257
257
|
|
|
258
|
+
if (nextActiveIndex === -1) {
|
|
259
|
+
var searchInput = searchRef.current;
|
|
260
|
+
|
|
261
|
+
if (searchInput && searchInput.focus) {
|
|
262
|
+
setActiveIndex(nextActiveIndex);
|
|
263
|
+
setFocusWithoutScroll(searchInput);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
258
267
|
while (nextActiveIndex >= 0 && isDisabled(nextActiveIndex)) {
|
|
259
268
|
nextActiveIndex -= 1;
|
|
260
269
|
}
|
|
@@ -75,7 +75,7 @@ Object.setPrototypeOf(StyledTableFooter.defaultProps, defaultProps);
|
|
|
75
75
|
var StyledTable = styled.table.withConfig({
|
|
76
76
|
displayName: "StyledTable",
|
|
77
77
|
componentId: "sc-1m3u5g-6"
|
|
78
|
-
})(["border-spacing:0;border-collapse:collapse;width:inherit
|
|
78
|
+
})(["border-spacing:0;border-collapse:collapse;width:inherit;", " ", ";"], genericStyles, function (props) {
|
|
79
79
|
return props.theme.table && props.theme.table.extend;
|
|
80
80
|
});
|
|
81
81
|
StyledTable.defaultProps = {};
|
|
@@ -273,6 +273,8 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
273
273
|
onClickOutside: clickOutside,
|
|
274
274
|
onEsc: closeDrop
|
|
275
275
|
}, dropProps), /*#__PURE__*/React.createElement(ContainerBox, {
|
|
276
|
+
id: id ? "listbox__" + id : undefined,
|
|
277
|
+
role: "listbox",
|
|
276
278
|
overflow: "auto",
|
|
277
279
|
dropHeight: dropHeight,
|
|
278
280
|
onMouseMove: function onMouseMove() {
|
|
@@ -285,8 +287,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
285
287
|
step: theme.select.step,
|
|
286
288
|
show: activeSuggestionIndex !== -1 ? activeSuggestionIndex : undefined
|
|
287
289
|
}, function (suggestion, index, itemRef) {
|
|
288
|
-
|
|
290
|
+
var active = activeSuggestionIndex === index;
|
|
291
|
+
var selected = suggestion === value; // Determine whether the label is done as a child or
|
|
289
292
|
// as an option Button kind property.
|
|
293
|
+
|
|
290
294
|
var renderedLabel = renderLabel(suggestion);
|
|
291
295
|
var child;
|
|
292
296
|
if (typeof renderedLabel !== 'string') // must be an element rendered by suggestions.label
|
|
@@ -300,7 +304,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
300
304
|
key: stringLabel(suggestion) + "-" + index,
|
|
301
305
|
ref: itemRef
|
|
302
306
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
303
|
-
|
|
307
|
+
id: id ? "listbox-option-" + index + "__" + id : undefined,
|
|
308
|
+
role: "option",
|
|
309
|
+
"aria-selected": selected ? 'true' : 'false',
|
|
310
|
+
active: active,
|
|
304
311
|
fill: "horizontal",
|
|
305
312
|
plain: !child ? undefined : true,
|
|
306
313
|
align: "start",
|
|
@@ -332,6 +339,28 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
332
339
|
keyboardProps.onTab = closeDrop;
|
|
333
340
|
} else if (suggestions && suggestions.length > 0) {
|
|
334
341
|
keyboardProps.onDown = openDrop;
|
|
342
|
+
}
|
|
343
|
+
/*
|
|
344
|
+
If the text input has a list of suggestions, add the WAI-ARIA 1.2
|
|
345
|
+
combobox role and states.
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
var comboboxProps = {};
|
|
350
|
+
var activeOptionID;
|
|
351
|
+
|
|
352
|
+
if (id && (suggestions == null ? void 0 : suggestions.length) > -1) {
|
|
353
|
+
if (showDrop && activeSuggestionIndex > -1) {
|
|
354
|
+
activeOptionID = "listbox-option-" + activeSuggestionIndex + "__" + id;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
comboboxProps = {
|
|
358
|
+
'aria-activedescendant': activeOptionID,
|
|
359
|
+
'aria-autocomplete': 'list',
|
|
360
|
+
'aria-expanded': showDrop ? 'true' : 'false',
|
|
361
|
+
'aria-controls': showDrop ? "listbox__" + id : undefined,
|
|
362
|
+
role: 'combobox'
|
|
363
|
+
};
|
|
335
364
|
} // For the Keyboard target below, if we have focus,
|
|
336
365
|
// either on the input element or within the drop,
|
|
337
366
|
// then we set the target to the document,
|
|
@@ -359,7 +388,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
359
388
|
focus: focus,
|
|
360
389
|
focusIndicator: focusIndicator,
|
|
361
390
|
textAlign: textAlign
|
|
362
|
-
}, rest, extraProps, {
|
|
391
|
+
}, rest, extraProps, comboboxProps, {
|
|
363
392
|
defaultValue: renderLabel(defaultValue),
|
|
364
393
|
value: renderLabel(value),
|
|
365
394
|
readOnly: readOnly,
|
|
@@ -28,6 +28,7 @@ export var DefaultSuggestion = function DefaultSuggestion() {
|
|
|
28
28
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
29
29
|
width: "medium"
|
|
30
30
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
31
|
+
id: "grommet-text-combobox-default-suggestion",
|
|
31
32
|
value: value,
|
|
32
33
|
onChange: onChange,
|
|
33
34
|
onSelect: onSelect,
|
|
@@ -39,6 +39,7 @@ export var Suggestions = function Suggestions() {
|
|
|
39
39
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
40
40
|
width: "medium"
|
|
41
41
|
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
42
|
+
id: "grommet-text-combobox",
|
|
42
43
|
value: value,
|
|
43
44
|
onChange: onChange,
|
|
44
45
|
onSuggestionSelect: onSuggestionSelect,
|
|
@@ -45,17 +45,29 @@ var Tip = /*#__PURE__*/forwardRef(function (_ref, tipRef) {
|
|
|
45
45
|
|
|
46
46
|
var child = Children.count(children) <= 1 && ! /*#__PURE__*/React.isValidElement(children) && /*#__PURE__*/React.createElement("span", null, children) || Children.only(children);
|
|
47
47
|
var clonedChild = /*#__PURE__*/cloneElement(child, {
|
|
48
|
-
onMouseEnter: function onMouseEnter() {
|
|
49
|
-
|
|
48
|
+
onMouseEnter: function onMouseEnter(event) {
|
|
49
|
+
var _child$props;
|
|
50
|
+
|
|
51
|
+
setOver(true);
|
|
52
|
+
if ((_child$props = child.props) != null && _child$props.onMouseEnter) child.props.onMouseEnter(event);
|
|
50
53
|
},
|
|
51
|
-
onMouseLeave: function onMouseLeave() {
|
|
52
|
-
|
|
54
|
+
onMouseLeave: function onMouseLeave(event) {
|
|
55
|
+
var _child$props2;
|
|
56
|
+
|
|
57
|
+
setOver(false);
|
|
58
|
+
if ((_child$props2 = child.props) != null && _child$props2.onMouseLeave) child.props.onMouseLeave(event);
|
|
53
59
|
},
|
|
54
|
-
onFocus: function onFocus() {
|
|
60
|
+
onFocus: function onFocus(event) {
|
|
61
|
+
var _child$props3;
|
|
62
|
+
|
|
55
63
|
if (usingKeyboard) setOver(true);
|
|
64
|
+
if ((_child$props3 = child.props) != null && _child$props3.onFocus) child.props.onFocus(event);
|
|
56
65
|
},
|
|
57
|
-
onBlur: function onBlur() {
|
|
66
|
+
onBlur: function onBlur(event) {
|
|
67
|
+
var _child$props4;
|
|
68
|
+
|
|
58
69
|
if (usingKeyboard) setOver(false);
|
|
70
|
+
if ((_child$props4 = child.props) != null && _child$props4.onBlur) child.props.onBlur(event);
|
|
59
71
|
},
|
|
60
72
|
key: 'tip-child',
|
|
61
73
|
ref: function ref(node) {
|
|
@@ -8,6 +8,7 @@ import React, { forwardRef, useCallback, useContext, useEffect, useMemo, useRef,
|
|
|
8
8
|
import { ThemeContext } from 'styled-components';
|
|
9
9
|
import { useLayoutEffect } from '../../utils/use-isomorphic-layout-effect';
|
|
10
10
|
import { defaultProps } from '../../default-props';
|
|
11
|
+
import { AnnounceContext } from '../../contexts/AnnounceContext';
|
|
11
12
|
import { Box } from '../Box';
|
|
12
13
|
import { Button } from '../Button';
|
|
13
14
|
import { Menu } from '../Menu';
|
|
@@ -62,6 +63,8 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
62
63
|
var _useContext = useContext(MessageContext),
|
|
63
64
|
format = _useContext.format;
|
|
64
65
|
|
|
66
|
+
var announce = useContext(AnnounceContext);
|
|
67
|
+
|
|
65
68
|
var _useState = useState([]),
|
|
66
69
|
captions = _useState[0],
|
|
67
70
|
setCaptions = _useState[1];
|
|
@@ -82,29 +85,33 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
82
85
|
playing = _useState5[0],
|
|
83
86
|
setPlaying = _useState5[1];
|
|
84
87
|
|
|
85
|
-
var _useState6 = useState(),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
var _useState6 = useState(false),
|
|
89
|
+
announceAudioDescription = _useState6[0],
|
|
90
|
+
setAnnounceAudioDescription = _useState6[1];
|
|
88
91
|
|
|
89
92
|
var _useState7 = useState(),
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
scrubTime = _useState7[0],
|
|
94
|
+
setScrubTime = _useState7[1];
|
|
92
95
|
|
|
93
|
-
var _useState8 = useState(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
var _useState8 = useState(),
|
|
97
|
+
volume = _useState8[0],
|
|
98
|
+
setVolume = _useState8[1];
|
|
96
99
|
|
|
97
|
-
var _useState9 = useState(),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
var _useState9 = useState(false),
|
|
101
|
+
hasPlayed = _useState9[0],
|
|
102
|
+
setHasPlayed = _useState9[1];
|
|
100
103
|
|
|
101
104
|
var _useState10 = useState(),
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
interacting = _useState10[0],
|
|
106
|
+
setInteracting = _useState10[1];
|
|
104
107
|
|
|
105
108
|
var _useState11 = useState(),
|
|
106
|
-
|
|
107
|
-
|
|
109
|
+
height = _useState11[0],
|
|
110
|
+
setHeight = _useState11[1];
|
|
111
|
+
|
|
112
|
+
var _useState12 = useState(),
|
|
113
|
+
width = _useState12[0],
|
|
114
|
+
setWidth = _useState12[1];
|
|
108
115
|
|
|
109
116
|
var containerRef = useRef();
|
|
110
117
|
var scrubberRef = useRef();
|
|
@@ -158,7 +165,12 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
158
165
|
return function () {
|
|
159
166
|
return clearTimeout(timer);
|
|
160
167
|
};
|
|
161
|
-
}, [interacting]);
|
|
168
|
+
}, [interacting]); // track which audio description track is active
|
|
169
|
+
|
|
170
|
+
var _useState13 = useState(),
|
|
171
|
+
activeTrack = _useState13[0],
|
|
172
|
+
setActiveTrack = _useState13[1];
|
|
173
|
+
|
|
162
174
|
useLayoutEffect(function () {
|
|
163
175
|
var video = videoRef.current;
|
|
164
176
|
|
|
@@ -188,48 +200,66 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
188
200
|
|
|
189
201
|
|
|
190
202
|
var textTracks = video.textTracks;
|
|
203
|
+
var nextCaptions = [];
|
|
204
|
+
var set = false; // iterate through all of the tracks provided
|
|
191
205
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var track = textTracks[0];
|
|
196
|
-
var active = track.mode === 'showing';
|
|
197
|
-
|
|
198
|
-
if (!captions || !captions[0] || captions[0].active !== active) {
|
|
199
|
-
// get label if provided and if the track is active
|
|
200
|
-
// (currently showing) or not
|
|
201
|
-
setCaptions([{
|
|
202
|
-
label: track.label,
|
|
203
|
-
active: active
|
|
204
|
-
}]);
|
|
205
|
-
}
|
|
206
|
-
} else {
|
|
207
|
-
// multiple tracks provided
|
|
208
|
-
var nextCaptions = [];
|
|
209
|
-
var set = false;
|
|
206
|
+
var _loop = function _loop(i) {
|
|
207
|
+
var track = textTracks[i];
|
|
208
|
+
var active = track.mode === 'showing';
|
|
210
209
|
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
var getActiveTrack = function getActiveTrack(currentVideoTime) {
|
|
211
|
+
var nextActiveTrack;
|
|
213
212
|
|
|
214
|
-
|
|
213
|
+
for (var j = 0; j < track.cues.length; j += 1) {
|
|
214
|
+
var _track$cues$j, _track$cues$j2;
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
active: _active
|
|
219
|
-
});
|
|
216
|
+
if (currentVideoTime > (track == null ? void 0 : (_track$cues$j = track.cues[j]) == null ? void 0 : _track$cues$j.startTime) && currentVideoTime < (track == null ? void 0 : (_track$cues$j2 = track.cues[j]) == null ? void 0 : _track$cues$j2.endTime)) {
|
|
217
|
+
var _track$cues$j3;
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
set = true;
|
|
219
|
+
nextActiveTrack = track == null ? void 0 : (_track$cues$j3 = track.cues[j]) == null ? void 0 : _track$cues$j3.text;
|
|
223
220
|
}
|
|
224
221
|
}
|
|
225
222
|
|
|
223
|
+
return nextActiveTrack;
|
|
224
|
+
}; // track is an audio description
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
if (track.kind === 'descriptions') {
|
|
228
|
+
if (announceAudioDescription) {
|
|
229
|
+
video.ontimeupdate = function () {
|
|
230
|
+
var nextActiveTrack = getActiveTrack(video.currentTime);
|
|
231
|
+
|
|
232
|
+
if (activeTrack !== nextActiveTrack) {
|
|
233
|
+
if (nextActiveTrack) {
|
|
234
|
+
announce(nextActiveTrack, 'assertive');
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
setActiveTrack(nextActiveTrack);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
} // otherwise treat as captions
|
|
242
|
+
else {
|
|
243
|
+
nextCaptions.push({
|
|
244
|
+
label: track.label,
|
|
245
|
+
active: active
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
if (!captions || !captions[i] || captions[i].active !== active) {
|
|
249
|
+
set = true;
|
|
250
|
+
}
|
|
251
|
+
|
|
226
252
|
if (set) {
|
|
227
253
|
setCaptions(nextCaptions);
|
|
228
254
|
}
|
|
229
255
|
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
for (var i = 0; i < textTracks.length; i += 1) {
|
|
259
|
+
_loop(i);
|
|
230
260
|
}
|
|
231
261
|
}
|
|
232
|
-
}, [captions, height, videoRef, width]);
|
|
262
|
+
}, [activeTrack, announce, announceAudioDescription, captions, height, videoRef, width]);
|
|
233
263
|
var play = useCallback(function () {
|
|
234
264
|
return videoRef.current.play();
|
|
235
265
|
}, [videoRef]);
|
|
@@ -306,7 +336,8 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
306
336
|
Pause: theme.video.icons.pause,
|
|
307
337
|
Play: theme.video.icons.play,
|
|
308
338
|
ReduceVolume: theme.video.icons.reduceVolume,
|
|
309
|
-
Volume: theme.video.icons.volume
|
|
339
|
+
Volume: theme.video.icons.volume,
|
|
340
|
+
Description: theme.video.icons.description
|
|
310
341
|
};
|
|
311
342
|
var captionControls = captions.map(function (caption, index) {
|
|
312
343
|
return {
|
|
@@ -315,7 +346,10 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
315
346
|
}),
|
|
316
347
|
label: caption.label,
|
|
317
348
|
active: caption.active,
|
|
318
|
-
a11yTitle: caption.label ||
|
|
349
|
+
a11yTitle: caption.label || format({
|
|
350
|
+
id: 'video.captions',
|
|
351
|
+
messages: messages
|
|
352
|
+
}),
|
|
319
353
|
onClick: function onClick() {
|
|
320
354
|
showCaptions(caption.active ? -1 : index);
|
|
321
355
|
var updatedCaptions = [];
|
|
@@ -331,6 +365,19 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
331
365
|
}
|
|
332
366
|
};
|
|
333
367
|
});
|
|
368
|
+
var descriptionControls = {
|
|
369
|
+
icon: /*#__PURE__*/React.createElement(Icons.Description, {
|
|
370
|
+
color: iconColor
|
|
371
|
+
}),
|
|
372
|
+
a11yTitle: format({
|
|
373
|
+
id: 'video.audioDescriptions',
|
|
374
|
+
messages: messages
|
|
375
|
+
}),
|
|
376
|
+
active: announceAudioDescription,
|
|
377
|
+
onClick: function onClick() {
|
|
378
|
+
return setAnnounceAudioDescription(!announceAudioDescription);
|
|
379
|
+
}
|
|
380
|
+
};
|
|
334
381
|
var volumeControls = ['volume', 'reduceVolume'].map(function (control) {
|
|
335
382
|
return {
|
|
336
383
|
icon: control === 'volume' ? /*#__PURE__*/React.createElement(Icons.Volume, {
|
|
@@ -358,6 +405,7 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
358
405
|
});
|
|
359
406
|
var buttonProps = {
|
|
360
407
|
captions: captionControls,
|
|
408
|
+
descriptions: descriptionControls,
|
|
361
409
|
volume: volumeControls,
|
|
362
410
|
fullScreen: {
|
|
363
411
|
icon: /*#__PURE__*/React.createElement(Icons.FullScreen, {
|
|
@@ -409,6 +457,11 @@ var Video = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
409
457
|
return undefined;
|
|
410
458
|
}
|
|
411
459
|
|
|
460
|
+
if (item === 'descriptions') {
|
|
461
|
+
controlsMenuItems.push(buttonProps[item]);
|
|
462
|
+
return undefined;
|
|
463
|
+
}
|
|
464
|
+
|
|
412
465
|
if (typeof item === 'string') {
|
|
413
466
|
return controlsMenuItems.push(buttonProps[item]);
|
|
414
467
|
}
|
|
@@ -9,7 +9,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
9
9
|
autoPlay: PropTypes.bool,
|
|
10
10
|
controls: PropTypes.oneOfType([PropTypes.oneOf([false, 'over', 'below']), PropTypes.shape({
|
|
11
11
|
position: PropTypes.oneOf([false, 'over', 'below']),
|
|
12
|
-
items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(['captions', 'fullScreen', 'play', 'pause', 'volume']), PropTypes.shape({
|
|
12
|
+
items: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(['captions', 'descriptions', 'fullScreen', 'play', 'pause', 'volume']), PropTypes.shape({
|
|
13
13
|
icon: PropTypes.element,
|
|
14
14
|
a11yTitle: PropTypes.string,
|
|
15
15
|
onClick: PropTypes.func,
|
|
@@ -6,7 +6,10 @@ export const ControlsBelow = () => (
|
|
|
6
6
|
<Box align="center" pad="large">
|
|
7
7
|
<Video
|
|
8
8
|
skipInterval={2}
|
|
9
|
-
controls={{
|
|
9
|
+
controls={{
|
|
10
|
+
position: 'below',
|
|
11
|
+
items: ['captions', 'descriptions'],
|
|
12
|
+
}}
|
|
10
13
|
>
|
|
11
14
|
<source src="small.mp4" type="video/mp4" />
|
|
12
15
|
<source
|
|
@@ -21,7 +24,8 @@ export const ControlsBelow = () => (
|
|
|
21
24
|
src="http://techslides.com/demos/sample-videos/small.3gp"
|
|
22
25
|
type="video/3gp"
|
|
23
26
|
/>
|
|
24
|
-
<track kind="
|
|
27
|
+
<track kind="captions" srcLang="en" src="small-en.vtt" />
|
|
28
|
+
<track kind="descriptions" srcLang="en" src="small-en-description.vtt" />
|
|
25
29
|
</Video>
|
|
26
30
|
</Box>
|
|
27
31
|
);
|
package/es6/components/index.js
CHANGED
|
@@ -58,7 +58,9 @@
|
|
|
58
58
|
"suggestionIsOpen": "Suggestions drop is open, continue to use arrow keys to navigate"
|
|
59
59
|
},
|
|
60
60
|
"video": {
|
|
61
|
+
"captions": "closed captions",
|
|
61
62
|
"closeMenu": "close menu",
|
|
63
|
+
"audioDescriptions": "video audio description",
|
|
62
64
|
"fullScreen": "full screen",
|
|
63
65
|
"progressMeter": "video progress",
|
|
64
66
|
"scrubber": "scrubber",
|
|
@@ -66,6 +68,7 @@
|
|
|
66
68
|
"pauseButton": "pause",
|
|
67
69
|
"playButton": "play",
|
|
68
70
|
"volumeDown": "volume down",
|
|
69
|
-
"volumeUp": "volume up"
|
|
71
|
+
"volumeUp": "volume up",
|
|
72
|
+
"description": "video audio description"
|
|
70
73
|
}
|
|
71
74
|
}
|
package/es6/themes/base.d.ts
CHANGED
|
@@ -33,6 +33,14 @@ import { Box } from '../components/Box';
|
|
|
33
33
|
import { Text, TextProps } from '../components/Text';
|
|
34
34
|
import { LayerPositionType, LayerProps } from '../components/Layer';
|
|
35
35
|
import { DropProps } from '../components/Drop';
|
|
36
|
+
import {
|
|
37
|
+
AreasType,
|
|
38
|
+
GridColumnsType,
|
|
39
|
+
GridGapType,
|
|
40
|
+
GridSizeType,
|
|
41
|
+
} from '../components/Grid';
|
|
42
|
+
import { HeadingProps } from '../components/Heading';
|
|
43
|
+
import { ParagraphProps } from '../components/Paragraph';
|
|
36
44
|
|
|
37
45
|
export declare const base: DeepReadonly<ThemeType>;
|
|
38
46
|
export declare const generate: (
|
|
@@ -437,6 +445,7 @@ export interface ThemeType {
|
|
|
437
445
|
color?: ColorType;
|
|
438
446
|
extend?: ExtendType<PropsOf<typeof Anchor>>;
|
|
439
447
|
fontWeight?: number;
|
|
448
|
+
gap?: GapType;
|
|
440
449
|
hover?: {
|
|
441
450
|
extend?: ExtendType<PropsOf<typeof Anchor>>;
|
|
442
451
|
textDecoration?: string;
|
|
@@ -1004,13 +1013,11 @@ export interface ThemeType {
|
|
|
1004
1013
|
container?: BoxProps;
|
|
1005
1014
|
item?: {
|
|
1006
1015
|
background?: BackgroundType;
|
|
1007
|
-
border?:
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
size?: string;
|
|
1013
|
-
};
|
|
1016
|
+
border?: BorderType;
|
|
1017
|
+
disabled?: {
|
|
1018
|
+
color?: ColorType;
|
|
1019
|
+
cursor?: string;
|
|
1020
|
+
};
|
|
1014
1021
|
pad?: PadType;
|
|
1015
1022
|
extend?: ExtendType;
|
|
1016
1023
|
};
|
|
@@ -1147,6 +1154,39 @@ export interface ThemeType {
|
|
|
1147
1154
|
large?: BoxProps;
|
|
1148
1155
|
};
|
|
1149
1156
|
};
|
|
1157
|
+
pageHeader?: {
|
|
1158
|
+
actions?: BoxProps;
|
|
1159
|
+
pad?: PadType;
|
|
1160
|
+
parent?: BoxProps;
|
|
1161
|
+
responsive?: {
|
|
1162
|
+
actions?: BoxProps;
|
|
1163
|
+
areas?: AreasType;
|
|
1164
|
+
breakpoints?: string[];
|
|
1165
|
+
columns?: GridColumnsType;
|
|
1166
|
+
rows?: GridSizeType;
|
|
1167
|
+
gap?: GridGapType;
|
|
1168
|
+
};
|
|
1169
|
+
subtitle?: ParagraphProps;
|
|
1170
|
+
title?: HeadingProps;
|
|
1171
|
+
small?: {
|
|
1172
|
+
areas?: AreasType;
|
|
1173
|
+
columns?: GridColumnsType;
|
|
1174
|
+
rows?: GridSizeType;
|
|
1175
|
+
gap?: GridGapType;
|
|
1176
|
+
};
|
|
1177
|
+
medium?: {
|
|
1178
|
+
areas?: AreasType;
|
|
1179
|
+
columns?: GridColumnsType;
|
|
1180
|
+
rows?: GridSizeType;
|
|
1181
|
+
gap?: GridGapType;
|
|
1182
|
+
};
|
|
1183
|
+
large?: {
|
|
1184
|
+
areas?: AreasType;
|
|
1185
|
+
columns?: GridColumnsType;
|
|
1186
|
+
rows?: GridSizeType;
|
|
1187
|
+
gap?: GridGapType;
|
|
1188
|
+
};
|
|
1189
|
+
};
|
|
1150
1190
|
pagination?: {
|
|
1151
1191
|
button?: ButtonType | string;
|
|
1152
1192
|
container?: BoxProps | { extend?: ExtendType };
|